Class EditUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
activateLastSelectedCellEditor
(SelectionLayer selectionLayer, IConfigRegistry configRegistry, boolean byTraversal) static boolean
allCellsEditable
(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) For every selected cell it is checked whether the cell is editable or not.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
allCellsEditable
(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) For every cell that is selected it is checked whether the cell is editable or not.static Collection<ILayerCell>
getEditableCellsInSelection
(SelectionLayer selectionLayer, IConfigRegistry configRegistry) Returns all cells from theSelectionLayer
that are selected AND editable.static Collection<ILayerCell>
getEditableCellsInSelection
(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Returns all cells from theSelectionLayer
that are selected AND editable.static ILayerCell
getLastSelectedCell
(SelectionLayer selectionLayer) static ICellEditor
getLastSelectedCellEditor
(SelectionLayer selectionLayer, IConfigRegistry configRegistry) static Collection<ILayerCell>
getSelectedCellsForEditing
(SelectionLayer selectionLayer) Returns the collection of selectedILayerCell
s that are eligible for editing.static Collection<ILayerCell>
getSelectedCellsForEditing
(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer) Returns the collection of selectedILayerCell
s that are eligible for editing.static boolean
isCellEditable
(PositionCoordinate cellCoords, IConfigRegistry configRegistry) Checks if the cell at the specified coordinates is editable or not.static boolean
isCellEditable
(ILayerCell layerCell, IConfigRegistry configRegistry) Checks if the givenILayerCell
is editable or not.static boolean
isConverterSame
(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverter
configured.static boolean
isConverterSame
(SelectionLayer selectionLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverter
configured.static boolean
isConverterSame
(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverter
configured.static boolean
isEditorSame
(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) Checks if all selected cells have the sameICellEditor
configured.static boolean
isEditorSame
(SelectionLayer selectionLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameICellEditor
configured.static boolean
isEditorSame
(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameICellEditor
configured.static boolean
isValueSame
(Collection<ILayerCell> selectedCells) Checks if all selected cells contain the same canonical value.static boolean
isValueSame
(SelectionLayer selectionLayer) Checks if all selected cells contain the same canonical value.static boolean
isValueSame
(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer) Checks if all selected cells contain the same canonical value.
-
Method Details
-
getLastSelectedCell
- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection from.- Returns:
- The last cell of the current selection in the specified
SelectionLayer
. Will returnnull
if there is no selection.
-
getLastSelectedCellEditor
public static ICellEditor getLastSelectedCellEditor(SelectionLayer selectionLayer, IConfigRegistry configRegistry) - Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selectio from.configRegistry
- TheIConfigRegistry
needed to access the configuredICellEditor
.- Returns:
- The
ICellEditor
of the last cell of the current selection in the specifiedSelectionLayer
. Will returnnull
if there is no selection.
-
activateLastSelectedCellEditor
public static boolean activateLastSelectedCellEditor(SelectionLayer selectionLayer, IConfigRegistry configRegistry, boolean byTraversal) - Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.configRegistry
- TheIConfigRegistry
needed to access the configuredICellEditor
.byTraversal
-true
if the activation is triggered by traversal,false
if not- Returns:
true
if the current selected cell contains an editor that should be activated,false
if not
-
allCellsEditable
public static boolean allCellsEditable(SelectionLayer selectionLayer, IConfigRegistry configRegistry) For every cell that is selected it is checked whether the cell is editable or not.In case a
IRowSelectionModel
is in use, only the selection anchor is checked.- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.configRegistry
- TheIConfigRegistry
needed to access the configuredIEditableRule
s.- Returns:
true
if all selected cells are editable,false
if at least one cell is not editable.
-
allCellsEditable
public static boolean allCellsEditable(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) For every cell that is selected it is checked whether the cell is editable or not.In case a
IRowSelectionModel
is in use, only the selection anchor is checked.Note:
Converts theSelectionLayer
based cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayer
adds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.upperLayer
- The layer on top of the givenSelectionLayer
to which the selection should be converted to. Can benull
which causes the resulting selected cells to be related to theSelectionLayer
.configRegistry
- TheIConfigRegistry
needed to access the configuredIEditableRule
s.- Returns:
true
if all selected cells are editable,false
if at least one cell is not editable.- Since:
- 1.6
-
allCellsEditable
public static boolean allCellsEditable(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) For every selected cell it is checked whether the cell is editable or not. If the collection of selected cells isnull
or empty, this method will also returntrue
.- Parameters:
selectedCells
- The collection of selected cells that should be checked.configRegistry
- TheIConfigRegistry
needed to access the configuredIEditableRule
s.- Returns:
true
if all selected cells are editable,false
if at least one cell is not editable.
-
isCellEditable
Checks if the cell at the specified coordinates is editable or not.- Parameters:
cellCoords
- The coordinates of the cell to check the editable state, related to the givenILayer
.configRegistry
- TheIConfigRegistry
needed to access the configuredIEditableRule
s.- Returns:
true
if the cell is editable,false
if not- Since:
- 1.6
-
isCellEditable
Checks if the givenILayerCell
is editable or not.- Parameters:
layerCell
- The cell to check the editable state.configRegistry
- TheIConfigRegistry
needed to access the configuredIEditableRule
s.- Returns:
true
if the cell is editable,false
if not- Since:
- 2.3
-
isEditorSame
Checks if all selected cells have the sameICellEditor
configured. This is needed for the multi edit feature to determine if a multi edit is possible.- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.configRegistry
- TheIConfigRegistry
needed to access the configuredICellEditor
s.- Returns:
true
if all selected cells have the sameICellEditor
configured,false
if at least one cell has anotherICellEditor
configured.
-
isEditorSame
public static boolean isEditorSame(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameICellEditor
configured. This is needed for the multi edit feature to determine if a multi edit is possible.Note:
Converts theSelectionLayer
based cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayer
adds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.upperLayer
- The layer on top of the givenSelectionLayer
to which the selection should be converted to. Can benull
which causes the resulting selected cells to be related to theSelectionLayer
.configRegistry
- TheIConfigRegistry
needed to access the configuredICellEditor
s.- Returns:
true
if all selected cells have the sameICellEditor
configured,false
if at least one cell has anotherICellEditor
configured.- Since:
- 1.6
-
isEditorSame
public static boolean isEditorSame(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) Checks if all selected cells have the sameICellEditor
configured. This is needed for the multi edit feature to determine if a multi edit is possible. If the collection of selected cells isnull
or empty, this method will also returntrue
.- Parameters:
selectedCells
- The collection of selected cells that should be checked.configRegistry
- TheIConfigRegistry
needed to access the configuredICellEditor
s.- Returns:
true
if all selected cells have the sameICellEditor
configured,false
if at least one cell has anotherICellEditor
configured.
-
isConverterSame
public static boolean isConverterSame(SelectionLayer selectionLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverter
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.
- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.configRegistry
- TheIConfigRegistry
needed to access the configuredIDisplayConverter
s.- Returns:
true
if all selected cells have the sameIDisplayConverter
configured,false
if at least one cell has anotherIDisplayConverter
configured.
-
isConverterSame
public static boolean isConverterSame(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverter
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.
Note:
Converts theSelectionLayer
based cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayer
adds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.upperLayer
- The layer on top of the givenSelectionLayer
to which the selection should be converted to. Can benull
which causes the resulting selected cells to be related to theSelectionLayer
.configRegistry
- TheIConfigRegistry
needed to access the configuredIDisplayConverter
s.- Returns:
true
if all selected cells have the sameIDisplayConverter
configured,false
if at least one cell has anotherIDisplayConverter
configured.- Since:
- 1.6
-
isConverterSame
public static boolean isConverterSame(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverter
configured. This is needed for the multi edit feature to determine if a multi edit is possible. If the collection of selected cells isnull
or empty, this method will also returntrue
.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.
- Parameters:
selectedCells
- The collection of selected cells that should be checked.configRegistry
- TheIConfigRegistry
needed to access the configuredIDisplayConverter
s.- Returns:
true
if all selected cells have the sameIDisplayConverter
configured,false
if at least one cell has anotherIDisplayConverter
configured.
-
isValueSame
Checks if all selected cells contain the same canonical value. This is needed for multi edit to know if the editor should be initialised with the value that is shared amongst all cells.- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.- Returns:
true
if all cells contain the same value,false
if at least one cell contains another value.
-
isValueSame
Checks if all selected cells contain the same canonical value. This is needed for multi edit to know if the editor should be initialised with the value that is shared amongst all cells.Note:
Converts theSelectionLayer
based cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayer
adds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.upperLayer
- The layer on top of the givenSelectionLayer
to which the selection should be converted to. Can benull
which causes the resulting selected cells to be related to theSelectionLayer
.- Returns:
true
if all cells contain the same value,false
if at least one cell contains another value.- Since:
- 1.6
-
isValueSame
Checks if all selected cells contain the same canonical value. This is needed for multi edit to know if the editor should be initialized with the value that is shared amongst all cells. If the collection of selected cells isnull
or empty, this method will also returntrue
.- Parameters:
selectedCells
- The collection of selected cells that should be checked.- Returns:
true
if all cells contain the same value,false
if at least one cell contains another value.
-
getSelectedCellsForEditing
Returns the collection of selectedILayerCell
s that are eligible for editing. This method is used for multi edit support, to ensure the editing also with row selection.In case of cell selection, simply all selected cells are returned.
In case a
IRowSelectionModel
is configured, the selected cells in correlation to the selection anchor are returned. This means, in case only one row is selected, the selection anchor is returned. In case multiple rows are selected, the cells at the column position of the selection anchor for all selected rows are returned.- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.- Returns:
- The selected
ILayerCell
s that are eligible for editing.
-
getSelectedCellsForEditing
public static Collection<ILayerCell> getSelectedCellsForEditing(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer) Returns the collection of selectedILayerCell
s that are eligible for editing.Note:
Converts theSelectionLayer
based cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayer
adds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.upperLayer
- The layer on top of the givenSelectionLayer
to which the selection should be converted to. Can benull
which causes the resulting selected cells to be related to theSelectionLayer
.- Returns:
- The selected
ILayerCell
s that are eligible for editing, related to the given upperLayer. - Since:
- 1.6
- See Also:
-
getEditableCellsInSelection
public static Collection<ILayerCell> getEditableCellsInSelection(SelectionLayer selectionLayer, IConfigRegistry configRegistry) Returns all cells from theSelectionLayer
that are selected AND editable.- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.configRegistry
- TheIConfigRegistry
needed to access the configuredIEditableRule
s.- Returns:
- The selected
ILayerCell
s that are editable. - Since:
- 2.3
-
getEditableCellsInSelection
public static Collection<ILayerCell> getEditableCellsInSelection(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Returns all cells from theSelectionLayer
that are selected AND editable.Note:
Converts theSelectionLayer
based cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayer
adds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer
- TheSelectionLayer
to retrieve the current selection.upperLayer
- The layer on top of the givenSelectionLayer
to which the selection should be converted to. Can benull
which causes the resulting selected cells to be related to theSelectionLayer
.configRegistry
- TheIConfigRegistry
needed to access the configuredIEditableRule
s.- Returns:
- The selected
ILayerCell
s that are editable, related to the given upperLayer. - Since:
- 2.3
- See Also:
-