Class EditorState<T>

    • Constructor Detail

      • EditorState

        public EditorState​(java.lang.String path)
    • Method Detail

      • getRowIndex

        public static int getRowIndex​(java.lang.String path)
        Parses full attribute path for i.e. editor or validation violation and extracts index of row which matches the path.
        Parameters:
        path - full attribute path
        Returns:
        index of row or -1, if path does not match
      • getRowPath

        public static java.lang.String getRowPath​(java.lang.String path)
        Parses full attribute path for i.e. editor or validation violation and extracts a path relative to single row object from it.
        Parameters:
        path - full attribute path
        Returns:
        row object path, empty string if a path point exactly to object or null if path does not match row object path
      • getArrayPath

        public static java.lang.String getArrayPath​(java.lang.String path)
        Parses full attribute path for i.e. editor or validation violation and extracts a path that points to property containing array value.
        Parameters:
        path - full attribute path
        Returns:
        array path or null if path does not match row object path
      • setListheaderSortState

        public void setListheaderSortState​(ListheaderSortState listheaderSortState)
      • getListheaderSortState

        public java.util.Optional<ListheaderSortState> getListheaderSortState()
      • removeRowState

        public void removeRowState​(T row)
        Removes a row bound to provided row object
        Parameters:
        row - row object
      • removeAllRowStates

        public void removeAllRowStates()
        Resets all row states
      • addRowState

        public RowState<T> addRowState​(T row)
        Adds new row state bound to provided row object. If editor's state already contains a row for this object, then nothing is changed and it's state is returned.
        Parameters:
        row - row object to be added
        Returns:
        state of row bound to provided row object
      • refreshRowStateReference

        public void refreshRowStateReference​(T row)
      • getRowState

        public RowState<T> getRowState​(T row)
        Gets a state of row bound to provided object.
        Parameters:
        row - row object
        Returns:
        state of row or null if no row is bound to provided object
      • getRowIndex

        public int getRowIndex​(T row)
        Gets index of row bound to provided object
        Parameters:
        row - row object
        Returns:
        index of row or -1 if no row is bound to provided object
      • getRowPath

        public java.lang.String getRowPath​(int rowIndex)
        Gets a path to specified row, relative to current editor.
        Parameters:
        rowIndex - index of row
        Returns:
        path to object bound to specified row
      • updateValidationResult

        public ValidationResult updateValidationResult​(T row,
                                                       java.util.List<ValidationInfo> validationInfos)
        Sets new validation violations of specified row
        Parameters:
        row - row object
        validationInfos - new violations
        Returns:
        validation result of row after modification
      • collectValidationResult

        public ValidationResult collectValidationResult()
        Creates new instance of ValidationResult that contains validation violations for all rows. Violations for each row is available under prefix equal to its index.
        Returns:
        collected validation results for all rows
      • getValidationResult

        public ValidationResult getValidationResult​(T row)
        Gets validation result of specified row
        Parameters:
        row - row object
        Returns:
        validation result of row bound to provided object or ValidationResult.EMPTY if no row bound to object
      • validationChanged

        public void validationChanged​(java.lang.String path)
        Notifies all validation observers about changes in violations.
        Parameters:
        path - path relative to current editor
        See Also:
        getRowPath(int)
      • getObservable

        protected com.hybris.cockpitng.editor.extendedmultireferenceeditor.state.EditorState.ValidationObservable getObservable()
      • getValidationObservable

        public Observable getValidationObservable()
      • getRowStates

        public java.util.Collection<RowState> getRowStates()
        Gets states of all rows defined for editor
        Returns:
        states of all rows
      • getEntries

        public java.util.Collection<java.util.Map.Entry<T,​RowState>> getEntries()
        Gets states of all rows with object bound to them
        Returns:
        entries representing a row object with its state
      • getRow

        public T getRow​(int index)
        Gets an object bound to row on specified index
        Parameters:
        index - row index
        Returns:
        object bound to row or null if no row is defined on specified index
      • afterDesktopChanged

        public void afterDesktopChanged()
        Description copied from interface: DesktopAware
        Method that is fired when desktop is changed i.e. this method is called only when the desktop is changed on the client side.

        Note: This method isn't invoked by framework i.e. it has to be called within custom code.

        Specified by:
        afterDesktopChanged in interface DesktopAware