Class AceCommandDescription

java.lang.Object
cn.mapway.document.ui.client.component.ace.AceCommandDescription

public class AceCommandDescription extends Object
Rules describing how editor runs this command (from keyboard, from command line or by AceEditor.execCommand(String) API calls).
  • Constructor Details

    • AceCommandDescription

      public AceCommandDescription(String name, AceCommandDescription.ExecAction exec)
      Define Ace command with command line name and execution action
      Parameters:
      name - command line name
      exec - execution action
  • Method Details

    • getName

      public String getName()
      Give command line name.
      Returns:
      command line name
    • getExec

      Give execution action of this command.
      Returns:
      execution action
    • getBindKey

      public AceCommandDescription.KeyBinding getBindKey()
      Give key bindings.
      Returns:
      key bindings
    • isReadOnly

      public boolean isReadOnly()
      Describe does this command change editor document or not.
      Returns:
      whether or not editor document could be changed
    • isPassEvent

      public boolean isPassEvent()
      In case this parameter is true keyboard event will be passed to original listener.
      Returns:
      true in case event shouldn't be stopped after command execution
    • getScrollIntoView

      public AceCommandDescription.ScrollIntoView getScrollIntoView()
      Give scroll settings for this command. In case it's null command is executed without scroll adjustment. Otherwise see AceCommandDescription.ScrollIntoView for details.
      Returns:
      scroll settings
    • getMultiSelectAction

      public AceCommandDescription.MultiSelectAction getMultiSelectAction()
      Give multi-select action for this command. In case it's null command is executed once without virtual changes in selection ranges. Otherwise see AceCommandDescription.MultiSelectAction for details.
      Returns:
      multi-select action
    • getAceCommandGroup

      public String getAceCommandGroup()
      Give Ace command group name of this command.
      Returns:
      Ace command group name
    • withBindKey

      Chainable setter method for bindKey property.
      Parameters:
      bindKey - key binding (e.g. "shift-esc|ctrl-`" or "Command+Alt+C")
      Returns:
      reference to this command description
    • withBindKey

      public AceCommandDescription withBindKey(String bindKeyForAllPlatforms)
      Chainable setter method for bindKey property for all platforms.
      Parameters:
      bindKeyForAllPlatforms - key binding (e.g. "shift-esc|ctrl-`" or "Command+Alt+C")
      Returns:
      reference to this command description
    • withBindKey

      public AceCommandDescription withBindKey(String bindKeyForAllPlatformsExceptMac, String bindKeyForMac)
      Chainable setter method for bindKey property for Mac and other platforms separately.
      Parameters:
      bindKeyForAllPlatformsExceptMac - key binding for everything except Mac (e.g. "shift-esc|ctrl-`")
      bindKeyForMac - key binding for Mac (e.g. "shift-esc|ctrl-`" or "Command+Alt+C")
      Returns:
      reference to this command description
    • withReadOnly

      public AceCommandDescription withReadOnly(boolean readOnly)
      Chainable setter method for readOnly property.
      Parameters:
      readOnly - describes does this command change editor document or not
      Returns:
      reference to this command description
    • withPassEvent

      public AceCommandDescription withPassEvent(boolean passEvent)
      Chainable setter method for passEvent property.
      Parameters:
      passEvent - in case it's true keyboard event will not be stopped and will be passed to original listener after command execution
      Returns:
      reference to this command description
    • withScrollIntoView

      public AceCommandDescription withScrollIntoView(AceCommandDescription.ScrollIntoView scrollIntoView)
      Chainable setter method for scrollIntoView property.
      Parameters:
      scrollIntoView - scroll settings for this command (in case it's null command is executed without scroll adjustment; otherwise see AceCommandDescription.ScrollIntoView for details)
      Returns:
      reference to this command description
    • withMultiSelectAction

      public AceCommandDescription withMultiSelectAction(AceCommandDescription.MultiSelectAction multiSelectAction)
      Chainable setter method for multiSelectAction property.
      Parameters:
      multiSelectAction - multi-select action for this command (in case it's null command is executed once without virtual changes in selection ranges; otherwise see AceCommandDescription.MultiSelectAction for details)
      Returns:
      reference to this command description
    • withAceCommandGroup

      public AceCommandDescription withAceCommandGroup(String aceCommandGroup)
      Chainable setter method for aceCommandGroup property.
      Parameters:
      aceCommandGroup - Ace command group name of this command
      Returns:
      reference to this command description
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fromJavaScript

      public static AceCommandDescription fromJavaScript(com.google.gwt.core.client.JavaScriptObject obj)
      Create Ace command from javascript object.
      Parameters:
      obj - javascript object describing Ace command
      Returns:
      Ace command description object
    • toJavaScript

      public com.google.gwt.core.client.JavaScriptObject toJavaScript(AceEditor editor)
      Create javascript object from Ace command description.
      Parameters:
      editor - Ace editor java wrapper
      Returns:
      Ace command javascript object