Class EditUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanactivateLastSelectedCellEditor(SelectionLayer selectionLayer, IConfigRegistry configRegistry, boolean byTraversal) static booleanallCellsEditable(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) For every selected cell it is checked whether the cell is editable or not.static booleanallCellsEditable(SelectionLayer selectionLayer, IConfigRegistry configRegistry) For every cell that is selected it is checked whether the cell is editable or not.static booleanallCellsEditable(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 theSelectionLayerthat are selected AND editable.static Collection<ILayerCell>getEditableCellsInSelection(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Returns all cells from theSelectionLayerthat are selected AND editable.static ILayerCellgetLastSelectedCell(SelectionLayer selectionLayer) static ICellEditorgetLastSelectedCellEditor(SelectionLayer selectionLayer, IConfigRegistry configRegistry) static Collection<ILayerCell>getSelectedCellsForEditing(SelectionLayer selectionLayer) Returns the collection of selectedILayerCells that are eligible for editing.static Collection<ILayerCell>getSelectedCellsForEditing(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer) Returns the collection of selectedILayerCells that are eligible for editing.static booleanisCellEditable(PositionCoordinate cellCoords, IConfigRegistry configRegistry) Checks if the cell at the specified coordinates is editable or not.static booleanisCellEditable(ILayerCell layerCell, IConfigRegistry configRegistry) Checks if the givenILayerCellis editable or not.static booleanisConverterSame(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverterconfigured.static booleanisConverterSame(SelectionLayer selectionLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverterconfigured.static booleanisConverterSame(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverterconfigured.static booleanisEditorSame(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) Checks if all selected cells have the sameICellEditorconfigured.static booleanisEditorSame(SelectionLayer selectionLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameICellEditorconfigured.static booleanisEditorSame(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameICellEditorconfigured.static booleanisValueSame(Collection<ILayerCell> selectedCells) Checks if all selected cells contain the same canonical value.static booleanisValueSame(SelectionLayer selectionLayer) Checks if all selected cells contain the same canonical value.static booleanisValueSame(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer) Checks if all selected cells contain the same canonical value.
-
Method Details
-
getLastSelectedCell
- Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selection from.- Returns:
- The last cell of the current selection in the specified
SelectionLayer. Will returnnullif there is no selection.
-
getLastSelectedCellEditor
public static ICellEditor getLastSelectedCellEditor(SelectionLayer selectionLayer, IConfigRegistry configRegistry) - Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selectio from.configRegistry- TheIConfigRegistryneeded to access the configuredICellEditor.- Returns:
- The
ICellEditorof the last cell of the current selection in the specifiedSelectionLayer. Will returnnullif there is no selection.
-
activateLastSelectedCellEditor
public static boolean activateLastSelectedCellEditor(SelectionLayer selectionLayer, IConfigRegistry configRegistry, boolean byTraversal) - Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selection.configRegistry- TheIConfigRegistryneeded to access the configuredICellEditor.byTraversal-trueif the activation is triggered by traversal,falseif not- Returns:
trueif the current selected cell contains an editor that should be activated,falseif 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
IRowSelectionModelis in use, only the selection anchor is checked.- Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selection.configRegistry- TheIConfigRegistryneeded to access the configuredIEditableRules.- Returns:
trueif all selected cells are editable,falseif 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
IRowSelectionModelis in use, only the selection anchor is checked.Note:
Converts theSelectionLayerbased cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayeradds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selection.upperLayer- The layer on top of the givenSelectionLayerto which the selection should be converted to. Can benullwhich causes the resulting selected cells to be related to theSelectionLayer.configRegistry- TheIConfigRegistryneeded to access the configuredIEditableRules.- Returns:
trueif all selected cells are editable,falseif 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 isnullor empty, this method will also returntrue.- Parameters:
selectedCells- The collection of selected cells that should be checked.configRegistry- TheIConfigRegistryneeded to access the configuredIEditableRules.- Returns:
trueif all selected cells are editable,falseif 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- TheIConfigRegistryneeded to access the configuredIEditableRules.- Returns:
trueif the cell is editable,falseif not- Since:
- 1.6
-
isCellEditable
Checks if the givenILayerCellis editable or not.- Parameters:
layerCell- The cell to check the editable state.configRegistry- TheIConfigRegistryneeded to access the configuredIEditableRules.- Returns:
trueif the cell is editable,falseif not- Since:
- 2.3
-
isEditorSame
Checks if all selected cells have the sameICellEditorconfigured. This is needed for the multi edit feature to determine if a multi edit is possible.- Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selection.configRegistry- TheIConfigRegistryneeded to access the configuredICellEditors.- Returns:
trueif all selected cells have the sameICellEditorconfigured,falseif at least one cell has anotherICellEditorconfigured.
-
isEditorSame
public static boolean isEditorSame(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameICellEditorconfigured. This is needed for the multi edit feature to determine if a multi edit is possible.Note:
Converts theSelectionLayerbased cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayeradds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selection.upperLayer- The layer on top of the givenSelectionLayerto which the selection should be converted to. Can benullwhich causes the resulting selected cells to be related to theSelectionLayer.configRegistry- TheIConfigRegistryneeded to access the configuredICellEditors.- Returns:
trueif all selected cells have the sameICellEditorconfigured,falseif at least one cell has anotherICellEditorconfigured.- Since:
- 1.6
-
isEditorSame
public static boolean isEditorSame(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) Checks if all selected cells have the sameICellEditorconfigured. This is needed for the multi edit feature to determine if a multi edit is possible. If the collection of selected cells isnullor empty, this method will also returntrue.- Parameters:
selectedCells- The collection of selected cells that should be checked.configRegistry- TheIConfigRegistryneeded to access the configuredICellEditors.- Returns:
trueif all selected cells have the sameICellEditorconfigured,falseif at least one cell has anotherICellEditorconfigured.
-
isConverterSame
public static boolean isConverterSame(SelectionLayer selectionLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverterconfigured. 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- TheSelectionLayerto retrieve the current selection.configRegistry- TheIConfigRegistryneeded to access the configuredIDisplayConverters.- Returns:
trueif all selected cells have the sameIDisplayConverterconfigured,falseif at least one cell has anotherIDisplayConverterconfigured.
-
isConverterSame
public static boolean isConverterSame(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverterconfigured. 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 theSelectionLayerbased cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayeradds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selection.upperLayer- The layer on top of the givenSelectionLayerto which the selection should be converted to. Can benullwhich causes the resulting selected cells to be related to theSelectionLayer.configRegistry- TheIConfigRegistryneeded to access the configuredIDisplayConverters.- Returns:
trueif all selected cells have the sameIDisplayConverterconfigured,falseif at least one cell has anotherIDisplayConverterconfigured.- Since:
- 1.6
-
isConverterSame
public static boolean isConverterSame(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) Checks if all selected cells have the sameIDisplayConverterconfigured. This is needed for the multi edit feature to determine if a multi edit is possible. If the collection of selected cells isnullor 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- TheIConfigRegistryneeded to access the configuredIDisplayConverters.- Returns:
trueif all selected cells have the sameIDisplayConverterconfigured,falseif at least one cell has anotherIDisplayConverterconfigured.
-
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- TheSelectionLayerto retrieve the current selection.- Returns:
trueif all cells contain the same value,falseif 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 theSelectionLayerbased cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayeradds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selection.upperLayer- The layer on top of the givenSelectionLayerto which the selection should be converted to. Can benullwhich causes the resulting selected cells to be related to theSelectionLayer.- Returns:
trueif all cells contain the same value,falseif 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 isnullor empty, this method will also returntrue.- Parameters:
selectedCells- The collection of selected cells that should be checked.- Returns:
trueif all cells contain the same value,falseif at least one cell contains another value.
-
getSelectedCellsForEditing
Returns the collection of selectedILayerCells 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
IRowSelectionModelis 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- TheSelectionLayerto retrieve the current selection.- Returns:
- The selected
ILayerCells that are eligible for editing.
-
getSelectedCellsForEditing
public static Collection<ILayerCell> getSelectedCellsForEditing(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer) Returns the collection of selectedILayerCells that are eligible for editing.Note:
Converts theSelectionLayerbased cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayeradds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selection.upperLayer- The layer on top of the givenSelectionLayerto which the selection should be converted to. Can benullwhich causes the resulting selected cells to be related to theSelectionLayer.- Returns:
- The selected
ILayerCells 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 theSelectionLayerthat are selected AND editable.- Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selection.configRegistry- TheIConfigRegistryneeded to access the configuredIEditableRules.- Returns:
- The selected
ILayerCells that are editable. - Since:
- 2.3
-
getEditableCellsInSelection
public static Collection<ILayerCell> getEditableCellsInSelection(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry) Returns all cells from theSelectionLayerthat are selected AND editable.Note:
Converts theSelectionLayerbased cells to the given upperLayer to be able to inspect the cells if that layer on top of theSelectionLayeradds information that needs to be inspected for editing checks, e.g. a tree layer.- Parameters:
selectionLayer- TheSelectionLayerto retrieve the current selection.upperLayer- The layer on top of the givenSelectionLayerto which the selection should be converted to. Can benullwhich causes the resulting selected cells to be related to theSelectionLayer.configRegistry- TheIConfigRegistryneeded to access the configuredIEditableRules.- Returns:
- The selected
ILayerCells that are editable, related to the given upperLayer. - Since:
- 2.3
- See Also:
-