public class EditUtils extends Object
Constructor and Description |
---|
EditUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
allCellsEditable(SelectionLayer selectionLayer,
IConfigRegistry configRegistry)
For every cell that is selected it is checked whether the cell is editable or not.
|
static boolean |
commitAndCloseActiveEditor()
Checks if there is an active editor registered.
|
static ILayerCell |
getLastSelectedCell(SelectionLayer selectionLayer) |
static ICellEditor |
getLastSelectedCellEditor(SelectionLayer selectionLayer,
IConfigRegistry configRegistry) |
static boolean |
isCellEditable(SelectionLayer selectionLayer,
IConfigRegistry configRegistry,
PositionCoordinate cellCoords)
Checks if the cell at the specified coordinates is editable or not.
|
static boolean |
isConverterSame(SelectionLayer selectionLayer,
IConfigRegistry configRegistry)
Checks if all selected cells have the same
IDisplayConverter configured. |
static boolean |
isEditorSame(SelectionLayer selectionLayer,
IConfigRegistry configRegistry)
Checks if all selected cells have the same
ICellEditor configured. |
static boolean |
isValueSame(SelectionLayer selectionLayer)
Checks if all selected cells contain the same canonical value.
|
public static ILayerCell getLastSelectedCell(SelectionLayer selectionLayer)
selectionLayer
- The SelectionLayer
to retrieve the current selection from.SelectionLayer
.
Will return null
if there is no selection.public static ICellEditor getLastSelectedCellEditor(SelectionLayer selectionLayer, IConfigRegistry configRegistry)
selectionLayer
- The SelectionLayer
to retrieve the current selection from.configRegistry
- The IConfigRegistry
needed to access the configured
ICellEditor
.ICellEditor
of the last cell of the current selection in the specified
SelectionLayer
. Will return null
if there is no selection.public static boolean allCellsEditable(SelectionLayer selectionLayer, IConfigRegistry configRegistry)
selectionLayer
- The SelectionLayer
to retrieve the current selection.configRegistry
- The IConfigRegistry
needed to access the configured
IEditableRule
s.true
if all selected cells are editable, false
if
at least one cell is not editable.public static boolean isCellEditable(SelectionLayer selectionLayer, IConfigRegistry configRegistry, PositionCoordinate cellCoords)
Note: The coordinates need to be related to the given SelectionLayer, otherwise the wrong cell will be used for the check.
selectionLayer
- The SelectionLayer
to check the cell coordinates against.configRegistry
- The IConfigRegistry
needed to access the configured
IEditableRule
s.cellCoords
- The coordinates of the cell to check the editable state, related to
the given SelectionLayer
true
if the cell is editable, false
if notpublic static boolean isEditorSame(SelectionLayer selectionLayer, IConfigRegistry configRegistry)
ICellEditor
configured. This is needed for
the multi edit feature to determine if a multi edit is possible.selectionLayer
- The SelectionLayer
to retrieve the current selection.configRegistry
- The IConfigRegistry
needed to access the configured
ICellEditor
s.true
if all selected cells have the same ICellEditor
configured, false
if at least one cell has another ICellEditor
configured.public static boolean isConverterSame(SelectionLayer selectionLayer, IConfigRegistry configRegistry)
IDisplayConverter
configured. This is needed
for the multi edit feature to determine if a multi edit is possible.
Let's assume there are two columns, one containing an Integer, the other a Date. Both have a TextCellEditor configured, so if only the editor is checked, the multi edit dialog would open. On committing a changed value an error would occur because of wrong conversion.
selectionLayer
- The SelectionLayer
to retrieve the current selection.configRegistry
- The IConfigRegistry
needed to access the configured
IDisplayConverter
s.true
if all selected cells have the same IDisplayConverter
configured, false
if at least one cell has another IDisplayConverter
configured.public static boolean isValueSame(SelectionLayer selectionLayer)
selectionLayer
- The SelectionLayer
to retrieve the current selection.true
if all cells contain the same value, false
if at least
one cell contains another value.public static boolean commitAndCloseActiveEditor()
false
if there is an open editor that can not be committed
because of conversion/validation errors, true
if there is
no active open editor or it could be closed after committing the value.Copyright © 2013. All Rights Reserved.