public class EditConfigHelper extends Object
IConfigRegistry
.Constructor and Description |
---|
EditConfigHelper() |
Modifier and Type | Method and Description |
---|---|
static IEditErrorHandler |
getEditErrorHandler(IConfigRegistry configRegistry,
ConfigAttribute<IEditErrorHandler> configAttribute,
List<String> configLabels)
Searches for the registered
IEditErrorHandler that should be used by this editor. |
static boolean |
openAdjacentEditor(IConfigRegistry configRegistry,
List<String> configLabels)
Determines behaviour after committing the value of this editor in combination with selection
movement.
|
static boolean |
openInline(IConfigRegistry configRegistry,
List<String> configLabels)
Determines whether the editor should be opened inline or using a dialog.
|
static boolean |
supportMultiEdit(IConfigRegistry configRegistry,
List<String> configLabels)
Determines whether this editor supports multi edit behaviour or not.
|
public static IEditErrorHandler getEditErrorHandler(IConfigRegistry configRegistry, ConfigAttribute<IEditErrorHandler> configAttribute, List<String> configLabels)
IEditErrorHandler
that should be used by this editor.configRegistry
- The ConfigRegistry
of the NatTable instance this editor is connected to.configAttribute
- The config attribute specifying if the IEditErrorHandler
for conversion
or validation errors is requested.configLabels
- The config labels attached to the cell this editor is opened for, needed to
find the registered IEditErrorHandler
in ConfigRegistry
.IEditErrorHandler
out of the specified ConfigRegistry
for
the config attribute and config labels, or the LoggingErrorHandling
if no other
IEditErrorHandler
is registered.EditConfigAttributes.CONVERSION_ERROR_HANDLER
,
EditConfigAttributes.VALIDATION_ERROR_HANDLER
public static boolean openInline(IConfigRegistry configRegistry, List<String> configLabels)
EditConfigAttributes.OPEN_IN_DIALOG
.
If there is no configuration found for this, true
will 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.
configRegistry
- The IConfigRegistry
to retrieve the configuration for
inline/dialog editing out of. Needed here because the instance IConfigRegistry
might 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.true
if the editor should opened inline, false
if not.EditConfigAttributes.OPEN_IN_DIALOG
public static boolean supportMultiEdit(IConfigRegistry configRegistry, List<String> configLabels)
true
, 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 return true
. You can change this behaviour by setting
the configuration attribute EditConfigAttributes.SUPPORT_MULTI_EDIT
.
You should consider returning false
e.g. if the update operation is complex or
you use conditional validation, where a value is validated against another value in the data model.
configRegistry
- The IConfigRegistry
to retrieve the configuration for
multi edit support out of. Needed here because the instance IConfigRegistry
might 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.true
if this editor will open in a subdialog for multi editing, false
if the multi editing of this kind of cell editor is not supported.EditConfigAttributes.SUPPORT_MULTI_EDIT
public static boolean openAdjacentEditor(IConfigRegistry configRegistry, List<String> configLabels)
true
and the selection is moved after committing,
the editor for the newly selected cell will be activated immediately. If this method returns
false
or the selection is not moved after commit, no action should be executed.
The behaviour previous to this configuration was to not open the adjacent editor. So if there
is no configuration registered for this, false
will 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.
configRegistry
- The IConfigRegistry
to retrieve the configuration for
multi edit support out of. Needed here because the instance IConfigRegistry
might 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.true
if the adjacent editor should be opened if the selection moves after
commit, false
if not.EditConfigAttributes.OPEN_ADJACENT_EDITOR
Copyright © 2013. All Rights Reserved.