Class EditSelectionCommandHandler

java.lang.Object
org.eclipse.nebula.widgets.nattable.command.AbstractLayerCommandHandler<EditSelectionCommand>
org.eclipse.nebula.widgets.nattable.edit.command.EditSelectionCommandHandler
All Implemented Interfaces:
ILayerCommandHandler<EditSelectionCommand>

public class EditSelectionCommandHandler extends AbstractLayerCommandHandler<EditSelectionCommand>
Command handler for handling EditSelectionCommands. Will first check if all selected cells are editable and if they have the same editor configured. Will call the EditController for activation of the edit mode if these checks succeed.
  • Constructor Details

    • EditSelectionCommandHandler

      public EditSelectionCommandHandler(SelectionLayer selectionLayer)
      Creates a command handler that performs the edit checks on the SelectionLayer.
      Parameters:
      selectionLayer - The SelectionLayer to retrieve the current selection.
    • EditSelectionCommandHandler

      public EditSelectionCommandHandler(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer)
      Creates a command handler that performs the edit checks based on the given upper layer. Needed for example if the upper layer adds information that is needed for checks, e.g. a tree layer.
      Parameters:
      selectionLayer - The SelectionLayer to retrieve the current selection.
      upperLayer - The layer on top of the given SelectionLayer to which the selection should be converted to. Can be null which causes the resulting selected cells to be related to the SelectionLayer.
      Since:
      1.6
  • Method Details

    • getCommandClass

      public Class<EditSelectionCommand> getCommandClass()
    • doCommand

      public boolean doCommand(EditSelectionCommand command)
      Specified by:
      doCommand in class AbstractLayerCommandHandler<EditSelectionCommand>
    • getCellsForEditing

      protected Collection<ILayerCell> getCellsForEditing(SelectionLayer selectionLayer, IUniqueIndexLayer upperLayer, IConfigRegistry configRegistry, boolean byTraversal)
      Retrieve the cells that should be edited.
      Parameters:
      selectionLayer - The SelectionLayer to retrieve the current selection.
      upperLayer - The layer on top of the given SelectionLayer to which the selection should be converted to. Can be null which causes the resulting selected cells to be related to the SelectionLayer.
      configRegistry - The IConfigRegistry needed to access the configured IEditableRules and the configuration if only editing should only be possible if all selected cells are editable, or if all editable cells that are selected should be used.
      byTraversal - true if the activation is triggered by traversal, false if not.
      Returns:
      The selected ILayerCells that should be edited, related to the given upperLayer.
      Since:
      2.3
    • handleOnlyAllSelectedEditable

      protected boolean handleOnlyAllSelectedEditable(IConfigRegistry configRegistry)
      Return whether a multi-edit should only be allowed if all selected cells are editable, or if the non-editable cells should be simply ignored.
      Parameters:
      configRegistry - The IConfigRegistry needed to retrieve the config attribute.
      Returns:
      true if multi-edit should only be possible if all selected cells are editable, false if the non-editable cells should be simply ignored.
      Since:
      2.3
      See Also: