Class EditConfigHelper
IConfigRegistry.-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanactivateEditorOnTraversal(IConfigRegistry configRegistry, List<String> configLabels) Determines whether the editor that is about to be opened via traversal or after commit selection movement should be opened or not.static IEditErrorHandlergetEditErrorHandler(IConfigRegistry configRegistry, ConfigAttribute<IEditErrorHandler> configAttribute, List<String> configLabels) Searches for the registeredIEditErrorHandlerthat should be used by this editor.static booleanopenAdjacentEditor(IConfigRegistry configRegistry, List<String> configLabels) Determines behavior after committing the value of this editor in combination with selection movement.static booleanopenInline(IConfigRegistry configRegistry, List<String> configLabels) Determines whether the editor should be opened inline or using a dialog.static booleansupportMultiEdit(IConfigRegistry configRegistry, List<String> configLabels) Determines whether this editor supports multi edit behavior or not.
-
Method Details
-
getEditErrorHandler
public static IEditErrorHandler getEditErrorHandler(IConfigRegistry configRegistry, ConfigAttribute<IEditErrorHandler> configAttribute, List<String> configLabels) Searches for the registeredIEditErrorHandlerthat should be used by this editor.- Parameters:
configRegistry- TheConfigRegistryof the NatTable instance this editor is connected to.configAttribute- The config attribute specifying if theIEditErrorHandlerfor conversion or validation errors is requested.configLabels- The config labels attached to the cell this editor is opened for, needed to find the registeredIEditErrorHandlerinConfigRegistry.- Returns:
- The registered
IEditErrorHandlerout of the specifiedConfigRegistryfor the config attribute and config labels, or theLoggingErrorHandlingif no otherIEditErrorHandleris registered. - See Also:
-
openInline
Determines whether the editor should be opened inline or using a dialog. By default it will check this by configuration attributeEditConfigAttributes.OPEN_IN_DIALOG. If there is no configuration found for this,truewill be returned for backwards compatibility.If this method returns
true, the editor will be opened inline (default).There might be editors that are only able to be opened in a dialog. These implementations need to override this method to always return
false, so the editor never gets opened inline.- Parameters:
configRegistry- TheIConfigRegistryto retrieve the configuration for inline/dialog editing out of. Needed here because the instanceIConfigRegistrymight not be set on calling this method.configLabels- The labels out of the LabelStack of the cell whose editor should be activated. Needed here because this method needs to be called prior to activation to determine where to activate it.- Returns:
trueif the editor should opened inline,falseif not.- See Also:
-
supportMultiEdit
Determines whether this editor supports multi edit behavior or not. If this method returnstrue, on selecting and pressing F2 on several cells that are editable, having the same editor type and converter registered, a multi edit dialog will open. By default this method will returntrue. You can change this behavior by setting the configuration attributeEditConfigAttributes.SUPPORT_MULTI_EDIT.You should consider returning
falsee.g. if the update operation is complex or you use conditional validation, where a value is validated against another value in the data model.- Parameters:
configRegistry- TheIConfigRegistryto retrieve the configuration for multi edit support out of. Needed here because the instanceIConfigRegistrymight not be set on calling this method.configLabels- The labels out of the LabelStack of the cell whose editor should be activated. Needed here because this method needs to be called prior to activation to determine where to activate it.- Returns:
trueif this editor will open in a subdialog for multi editing,falseif the multi editing of this kind of cell editor is not supported.- See Also:
-
openAdjacentEditor
Determines behavior after committing the value of this editor in combination with selection movement. If this method returntrueand the selection is moved after committing, the editor for the newly selected cell will be activated immediately. If this method returnsfalseor the selection is not moved after commit, no action should be executed.The behavior previous to this configuration was to not open the adjacent editor. So if there is no configuration registered for this,
falsewill be returned by default.Note: It only makes sense to call this method if the editor is already activated. Calling this method on an editor that has not been activated already will lead to exceptions.
- Parameters:
configRegistry- TheIConfigRegistryto retrieve the configuration out of. Needed here because the instanceIConfigRegistrymight not be set on calling this method.configLabels- The labels out of the LabelStack of the cell whose editor should be activated. Needed here because this method needs to be called prior to activation to determine where to activate it.- Returns:
trueif the adjacent editor should be opened if the selection moves after commit,falseif not.- See Also:
-
activateEditorOnTraversal
public static boolean activateEditorOnTraversal(IConfigRegistry configRegistry, List<String> configLabels) Determines whether the editor that is about to be opened via traversal or after commit selection movement should be opened or not. If this method returnstrue, the editor gets activated, otherwise not. It is necessary to avoid immediate value changes on selection movements to a checkbox or to avoid opening a dialog editor on traversal.- Parameters:
configRegistry- TheIConfigRegistryto retrieve the configuration out of. Needed here because the instanceIConfigRegistrymight not be set on calling this method.configLabels- The labels out of the LabelStack of the cell whose editor should be activated. Needed here because this method needs to be called prior to activation to determine where to activate it.- Returns:
trueif the editor should be opened if the selection moves after commit,falseif not.- See Also:
-