Class AbstractDocumentCommand

All Implemented Interfaces:
Command
Direct Known Subclasses:
AbstractAnnotationCommand, AbstractMessagingCapableDocumentCommand, AbstractToggleSearchCommand, AttachGridCommand, CreateAnnotationCommand, FitPageOnceCommand, GradationCurveCommand, HighlightTextCommand, RedoCommand, ResampleFilterCommand, RotateCommand, SpinCommand, TextAwareAnnotationCommand, UndoCommand, ZoomCommand, ZoomToCommand

public abstract class AbstractDocumentCommand extends AbstractMouseCommand
Abstract superclass for all commands, which need a viewer and a document for functionality.
  • Constructor Details

    • AbstractDocumentCommand

      public AbstractDocumentCommand()
  • Method Details

    • canExecute

      protected boolean canExecute()
      Checks if this command can be executed.
      Overrides:
      canExecute in class AbstractPageViewCommand
      Returns:
      true, if InjectedCommand.execute(java.util.Collection<java.lang.Object>) can be called, false else
    • getDocument

      protected Document getDocument()
      Returns:
      the Document of the PageView
    • setScope

      public void setScope(AbstractDocumentCommand.Scope scope)
      Sets the scope of this command.

      Supported scopes are PAGEVIEW (default), DOCUMENT and PAGE

      Parameters:
      scope - the scope to be configured
    • getScope

      public AbstractDocumentCommand.Scope getScope()
      Returns the current scope of this command.
      Returns:
      the current scope of this command
    • getRenderControls

      protected RenderControls getRenderControls(boolean create)
      Return a RenderControls for the current scope.

      Depending on the scope this method will either return the document controls of the current document or the page controls for the current page in the target PageView.

      Parameters:
      create - if the command should work in a per-page way ( getScope() == AbstractDocumentCommand.Scope.PAGE) and no page control is available, this parameter decides whether to create a new render controls for the page or to return the document render controls.
      Returns:
      RenderControls
    • getID

      public String getID()
      Description copied from interface: Command
      The ID of the command. This is typically the command class name. If the Command is parameterized the ID should comprise the class name + parameter information.
      Returns:
      the ID of the command