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
The default implementation of ActionContext
-
Constructor Summary
ConstructorDescriptionDefault constructor with no provider, context object, or source componentDefaultActionContext
(ComponentProvider provider) Constructor with no source component and no context objectDefaultActionContext
(ComponentProvider provider, Component sourceComponent) Constructor for ActionContext with context object and sourceComponent being the sameDefaultActionContext
(ComponentProvider provider, Object contextObject, Component sourceComponent) Constructor -
Method Summary
Modifier and TypeMethodDescriptionReturns the object that was included by the ComponentProvider when this context was created.int
Returns the click modifiers for this event.Returns the context's mouse event.Returns the component that is the target of this context.Returns the sourceObject from the actionEvent that triggered this context to be generated.boolean
hasAnyEventClickModifiers
(int modifiersMask) Tests the click modifiers for this event to see if they contain any bit from the specified modifiersMask parameter.setContextObject
(Object contextObject) Sets the context object for this context.void
setEventClickModifiers
(int modifiers) Sets the modifiers for this event that were present when the item was clicked on.Updates the context's mouse event.setSourceComponent
(Component sourceComponent) Sets the source component for this ActionContext.setSourceObject
(Object sourceObject) Sets the sourceObject for this ActionContext.toString()
-
Constructor Details
-
DefaultActionContext
public DefaultActionContext()Default constructor with no provider, context object, or source component -
DefaultActionContext
Constructor with no source component and no context object- Parameters:
provider
- the ComponentProvider that generated this context.
-
DefaultActionContext
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 retrievesourceComponent
- 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
- Specified by:
getComponentProvider
in interfaceActionContext
-
getContextObject
Description copied from interface:ActionContext
Returns the object that was included by the ComponentProvider when this context was created.- Specified by:
getContextObject
in interfaceActionContext
- Returns:
- the object that was included by the ComponentProvider when this context was created.
-
setContextObject
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 interfaceActionContext
- Parameters:
contextObject
- Sets the context object for this context.- Returns:
- this context
-
getSourceObject
Description copied from interface:ActionContext
Returns the sourceObject from the actionEvent that triggered this context to be generated.- Specified by:
getSourceObject
in interfaceActionContext
- 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 interfaceActionContext
- Parameters:
modifiers
- bit-masked int, seeActionEvent.getModifiers()
orMouseEvent.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 interfaceActionContext
- 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 interfaceActionContext
- Parameters:
modifiersMask
- bitmask to test- Returns:
- boolean true if any bit in the eventClickModifiers matches the mask
-
setSourceObject
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 interfaceActionContext
- Parameters:
sourceObject
- the source object- Returns:
- this context
-
setMouseEvent
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 interfaceActionContext
- Parameters:
e
- the event that triggered this context.- Returns:
- this context
-
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 interfaceActionContext
- Returns:
- the mouse event that triggered this context; null implies a key event-based context
-
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 interfaceActionContext
- Returns:
- the component; may be null
-
setSourceComponent
Description copied from interface:ActionContext
Sets the source component for this ActionContext.- Specified by:
setSourceComponent
in interfaceActionContext
- Parameters:
sourceComponent
- the source component- Returns:
- this context
-
toString
-