Class ControlDecorationProvider
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.edit.editor.ControlDecorationProvider
-
public class ControlDecorationProvider extends Object
This class adds support for adding aControlDecoration
to the editor controls of aICellEditor
. It is currently only used by theTextCellEditor
.The default location for the
ControlDecoration
is the top right of the editor. If the editor is located such that theControlDecoration
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 Summary
Constructors Constructor Description ControlDecorationProvider()
Create a defaultControlDecorationProvider
for handling error decorations.ControlDecorationProvider(String fieldDecorationId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createErrorDecorationIfRequired(org.eclipse.swt.widgets.Control controlToDecorate)
If showing an error decoration is enabled, this method will create and add aControlDecoration
for the givenControl
by using the configured information.void
dispose()
Ensure to hide the decoration and dispose any resources related to theControlDecoration
void
hideDecoration()
Will hide the control decoration.void
setDecorationPositionOverride(int decorationPositionOverride)
Set the position configuration where the decoration should be rendered relative to the control that should be decorated.void
setErrorDecorationEnabled(boolean enabled)
Enables/disables the error decoration.void
setErrorDecorationText(String errorText)
void
setFieldDecorationId(String fieldDecorationId)
Configure the id that should be used to retrieve theFieldDecoration
to be used by thisControlDecorationProvider
.void
showDecoration()
Will show the control decoration.void
showErrorDecorationHover(String errorText)
Will show the control decoration adding the given text as description text.
-
-
-
Constructor Detail
-
ControlDecorationProvider
public ControlDecorationProvider()
Create a defaultControlDecorationProvider
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, ornull
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, ornull
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 theFieldDecoration
to be used by thisControlDecorationProvider
.- Parameters:
fieldDecorationId
- The String to determine theFieldDecoration
to use by theControlDecoration
that is provided by thisControlDecorationProvider
.
-
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
, andSWT.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 theControlDecoration
-
createErrorDecorationIfRequired
public void createErrorDecorationIfRequired(org.eclipse.swt.widgets.Control controlToDecorate)
If showing an error decoration is enabled, this method will create and add aControlDecoration
for the givenControl
by using the configured information.- Parameters:
controlToDecorate
- TheControl
to create the decoration for.
-
-