Class ControlDecorationProvider


  • public class ControlDecorationProvider
    extends Object
    This class adds support for adding a ControlDecoration to the editor controls of a ICellEditor. It is currently only used by the TextCellEditor.

    The default location for the ControlDecoration is the top right of the editor. If the editor is located such that the ControlDecoration would not be visible here (i.e. cell is at/extends beyond the right edge of the NatTable) then the decoration is placed at the top left of the editor.

    The location can be overridden, in which case the above behaviour does not get used.

    • Constructor Detail

      • ControlDecorationProvider

        public ControlDecorationProvider()
        Create a default ControlDecorationProvider for handling error decorations.
      • ControlDecorationProvider

        public ControlDecorationProvider​(String fieldDecorationId)
        Parameters:
        fieldDecorationId - The field decoration to use by this provider.
        See Also:
        FieldDecorationRegistry
    • Method Detail

      • setErrorDecorationEnabled

        public void setErrorDecorationEnabled​(boolean enabled)
        Enables/disables the error decoration.
        Parameters:
        enabled - true if a decoration should be added, false if not.
      • setErrorDecorationText

        public void setErrorDecorationText​(String errorText)
        Parameters:
        errorText - the text to be shown as a description for the decoration, or null if none has been set.
        See Also:
        ControlDecoration.setDescriptionText(String)
      • showErrorDecorationHover

        public void showErrorDecorationHover​(String errorText)
        Will show the control decoration adding the given text as description text.
        Parameters:
        errorText - the text to be shown in the info hover, or null if no text should be shown.
        See Also:
        ControlDecoration.show(), ControlDecoration.showHoverText(String)
      • setFieldDecorationId

        public void setFieldDecorationId​(String fieldDecorationId)
        Configure the id that should be used to retrieve the FieldDecoration to be used by this ControlDecorationProvider.
        Parameters:
        fieldDecorationId - The String to determine the FieldDecoration to use by the ControlDecoration that is provided by this ControlDecorationProvider.
      • setDecorationPositionOverride

        public void setDecorationPositionOverride​(int decorationPositionOverride)
        Set the position configuration where the decoration should be rendered relative to the control that should be decorated.
        Parameters:
        decorationPositionOverride - bit-wise or of position constants (SWT.TOP, SWT.BOTTOM, SWT.LEFT, SWT.RIGHT, and SWT.CENTER).
      • showDecoration

        public void showDecoration()
        Will show the control decoration.
        See Also:
        ControlDecoration.show()
      • hideDecoration

        public void hideDecoration()
        Will hide the control decoration.
        See Also:
        ControlDecoration.hide()
      • dispose

        public void dispose()
        Ensure to hide the decoration and dispose any resources related to the ControlDecoration
      • createErrorDecorationIfRequired

        public void createErrorDecorationIfRequired​(org.eclipse.swt.widgets.Control controlToDecorate)
        If showing an error decoration is enabled, this method will create and add a ControlDecoration for the given Control by using the configured information.
        Parameters:
        controlToDecorate - The Control to create the decoration for.