Package docking

Class DefaultActionContext

java.lang.Object
docking.DefaultActionContext
All Implemented Interfaces:
ActionContext
Direct Known Subclasses:
CheckoutsActionContext, CodeComparisonActionContext, DialogProjectTreeContext, FSBActionContext, GraphActionContext, ProgramActionContext, ProjectDataContext, ThemeTableContext, VgActionContext

public class DefaultActionContext extends Object implements ActionContext
The default implementation of ActionContext
  • Constructor Details

    • DefaultActionContext

      public DefaultActionContext()
      Default constructor with no provider, context object, or source component
    • DefaultActionContext

      public DefaultActionContext(ComponentProvider provider)
      Constructor with no source component and no context object
      Parameters:
      provider - the ComponentProvider that generated this context.
    • DefaultActionContext

      public DefaultActionContext(ComponentProvider provider, Component sourceComponent)
      Constructor for ActionContext with context object and sourceComponent being the same
      Parameters:
      provider - the ComponentProvider that generated this context.
      sourceComponent - an optional source object; this is intended to be the component that is the source of the context, usually the focused component
    • DefaultActionContext

      public DefaultActionContext(ComponentProvider provider, Object contextObject, Component sourceComponent)
      Constructor
      Parameters:
      provider - the ComponentProvider that generated this context.
      contextObject - an optional contextObject that the ComponentProvider can provide; this can be anything that actions wish to later retrieve
      sourceComponent - an optional source object; this is intended to be the component that is the source of the context, usually the focused component
  • Method Details

    • getComponentProvider

      public ComponentProvider getComponentProvider()
      Specified by:
      getComponentProvider in interface ActionContext
    • getContextObject

      public Object getContextObject()
      Description copied from interface: ActionContext
      Returns the object that was included by the ComponentProvider when this context was created.
      Specified by:
      getContextObject in interface ActionContext
      Returns:
      the object that was included by the ComponentProvider when this context was created.
    • setContextObject

      public DefaultActionContext setContextObject(Object contextObject)
      Description copied from interface: ActionContext
      Sets the context object for this context. This can be any object of the creator's choosing that can be provided for later retrieval.
      Specified by:
      setContextObject in interface ActionContext
      Parameters:
      contextObject - Sets the context object for this context.
      Returns:
      this context
    • getSourceObject

      public Object getSourceObject()
      Description copied from interface: ActionContext
      Returns the sourceObject from the actionEvent that triggered this context to be generated.
      Specified by:
      getSourceObject in interface ActionContext
      Returns:
      the sourceObject from the actionEvent that triggered this context to be generated.
    • setEventClickModifiers

      public void setEventClickModifiers(int modifiers)
      Description copied from interface: ActionContext
      Sets the modifiers for this event that were present when the item was clicked on.
      Specified by:
      setEventClickModifiers in interface ActionContext
      Parameters:
      modifiers - bit-masked int, see ActionEvent.getModifiers() or MouseEvent.getModifiersEx()
    • getEventClickModifiers

      public int getEventClickModifiers()
      Description copied from interface: ActionContext
      Returns the click modifiers for this event.

      Only present for some mouse assisted events, e.g. clicking on a toolbar button or choosing a menu item in a popup menu.

      Specified by:
      getEventClickModifiers in interface ActionContext
      Returns:
      bit-masked int, see InputEvent.SHIFT_MASK, etc
    • hasAnyEventClickModifiers

      public boolean hasAnyEventClickModifiers(int modifiersMask)
      Description copied from interface: ActionContext
      Tests the click modifiers for this event to see if they contain any bit from the specified modifiersMask parameter.
      Specified by:
      hasAnyEventClickModifiers in interface ActionContext
      Parameters:
      modifiersMask - bitmask to test
      Returns:
      boolean true if any bit in the eventClickModifiers matches the mask
    • setSourceObject

      public DefaultActionContext setSourceObject(Object sourceObject)
      Description copied from interface: ActionContext
      Sets the sourceObject for this ActionContext. This method is used internally by the DockingWindowManager. ComponentProvider and action developers should only use this method for testing.
      Specified by:
      setSourceObject in interface ActionContext
      Parameters:
      sourceObject - the source object
      Returns:
      this context
    • setMouseEvent

      public DefaultActionContext setMouseEvent(MouseEvent e)
      Description copied from interface: ActionContext
      Updates the context's mouse event. Contexts that are based upon key events will have no mouse event. This method is really for the framework to use. Client calls to this method will be overridden by the framework when menu items are clicked.
      Specified by:
      setMouseEvent in interface ActionContext
      Parameters:
      e - the event that triggered this context.
      Returns:
      this context
    • getMouseEvent

      public MouseEvent getMouseEvent()
      Description copied from interface: ActionContext
      Returns the context's mouse event. Contexts that are based upon key events will have no mouse event.
      Specified by:
      getMouseEvent in interface ActionContext
      Returns:
      the mouse event that triggered this context; null implies a key event-based context
    • getSourceComponent

      public Component getSourceComponent()
      Description copied from interface: ActionContext
      Returns the component that is the target of this context. This value should not change whether the context is triggered by a key binding or mouse event.
      Specified by:
      getSourceComponent in interface ActionContext
      Returns:
      the component; may be null
    • setSourceComponent

      public ActionContext setSourceComponent(Component sourceComponent)
      Description copied from interface: ActionContext
      Sets the source component for this ActionContext.
      Specified by:
      setSourceComponent in interface ActionContext
      Parameters:
      sourceComponent - the source component
      Returns:
      this context
    • toString

      public String toString()
      Overrides:
      toString in class Object