|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.jbbres.lib.actions.tools.elements.AbstractActionUI
public abstract class AbstractActionUI
This abstract class provides default implementations for an Action
user interface.
To create a concrete ActionUI
as a subclass of
AbstractActionUI
you need only provide implementations for the
following two methods:
protected Parameters getUIParameters()
protected void setUIParameters(Parameters parameters)
These two methods, which are not part of the original ActionUI
interface, generates and sets the parameters associated to the User
Interface.
The Parameters
object that
the getUIParameters()
method returns is used by Action(s) to
store the state of the action within the .wkfl file when the user saves the
workflow. The same object is given to the
setUIParameters(Parameters)
method when the user opens a .wkfl file,
so the User Interface can be reconstructed at a similar state as it was when
the workflow had been saved.
The Parameters
object is also given to the action service as an
argument of the
ActionService.execute(Object, Parameters)
method. The service will use the
parameters provided to know what settings the user want to apply to the
action when it is executed.
The User Interface Component
objects should be added to the
content pane of the class. The content pane is a JPanel
object
that you can access by calling the getContentPane()
method.
Using an AbstractActionUI object is a great way to let users define the behaviour of the action they are willing to use. However, this setting is defined by the user when he creates the workflow. If the workflow is meant to be re-used with different settings every time it is executed, the user will have to update them manually within the workflow every time, which will depreciate its experience of the application.
To get around this problem, AbstractActionUI
includes a Show
When Run feature. If this feature is turned on, when Action(s)
executes the workflow it displays the user interface for the action when
execution reaches that point. The workflow user – as opposed to the
workflow creator – can then make the required settings before the action
proceeds.
The User Interface of actions using the Show When Run feature includes an
additional section with a “Show when running the workflow check box in
their top section. When a user clicks this control, this section expands to
expose a Prompt text field.
If the check box is selected and the workflow is run, the action displays its
User Interface in a separate window. The input value in the prompt text field
is used as title of the window.
The user makes selections and fills in information in this window and clicks
OK to have the action proceed.
The setShowWhenRunAvailable(boolean)
method activates or deactivates
the Show When Run feature for the User Interface. It is also possible to
define the default state of the “Show when running the workflow check box
by using the setShownWhenRun(boolean)
method, and the default value
of the prompt with the setPrompt(String)
method. Alternatively, the
Show When Run feature can be set within the action property list.
v1.1.0:
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
AbstractActionUI(AbstractAction parent)
Instantiates a new UI. |
Method Summary | |
---|---|
void |
addActionUIListener(ActionUIListener l)
Adds an ActionUIListener to the User Interface. |
void |
firePromptChanged()
Invokes the promptChanged(ActionUIEvent) method of all the listeners. |
void |
fireShowWhenRunOptionChanged()
Invokes the showWhenRunOptionChanged(ActionUIEvent) method of all the listeners. |
ActionService |
getActionService()
Returns the action service associated to this UI. |
ActionUIListener[] |
getActionUIListeners()
Returns all the listeners to the User Interface. |
javax.swing.JPanel |
getContentPane()
Returns the content pane object for this User Interface. |
ActionDescription |
getDescription()
Returns the action description. |
Parameters |
getParameters()
Returns the current settings of the UI. |
AbstractAction |
getParentAction()
Returns the parent action. |
java.lang.String |
getPrompt()
Returns the "Show When Run" prompt text. |
Workflow |
getWorkflow()
Returns the workflow that this UI belongs to. |
boolean |
isPromptAvailable()
Checks if the user can input a personalized "Show When Run" prompt text. |
boolean |
isShownWhenRun()
When the Show When Run feature is on, this method returns the current state of the "Show When Running the Workflow" check box. |
void |
removeActionUIListener(ActionUIListener l)
Removes an ActionUIListener to the User Interface. |
void |
setEnabled(boolean b)
|
void |
setParameters(Parameters parameters)
Restores the UI settings. |
void |
setPrompt(java.lang.String text)
Sets the "Show When Run" prompt text. |
void |
setPromptAvailable(boolean showPrompt)
Allows the user to input a personalized "Show When Run" prompt text. |
void |
setShownWhenRun(boolean b)
Changes the states of the "Show When Running the Workflow" check box. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractActionUI(AbstractAction parent)
parent
- - the action that this UI is representingMethod Detail |
---|
public AbstractAction getParentAction()
public ActionDescription getDescription()
public Workflow getWorkflow()
public ActionService getActionService()
public Parameters getParameters()
setParameters(Parameters)
method.
If the UI has no specific settings, this method returns null
.
setParameters(Parameters)
public void setParameters(Parameters parameters) throws InvalidParametersException
parameters
- - the settings to be restored. Can be null
InvalidParametersException
- Raised when the parameters received are incorrect and cannot
be mapped.getParameters()
public javax.swing.JPanel getContentPane()
public boolean isShownWhenRun()
false
true
if the Show When Run feature is on and the
"Show When Running the Workflow" check box is selected;
false
otherwisesetShownWhenRun(boolean)
public void setShownWhenRun(boolean b)
b
- - the new states of the "Show When Running the Workflow" check
boxisShownWhenRun()
public java.lang.String getPrompt()
setPrompt(String)
,
isPromptAvailable()
public void setPrompt(java.lang.String text)
text
- - the new "Show When Run" prompt text.getPrompt()
,
setPromptAvailable(boolean)
public void setPromptAvailable(boolean showPrompt)
showPrompt
- - true
if the "Show When Run" prompt text field
should be visible. false
otherwise.isPromptAvailable()
public boolean isPromptAvailable()
true
if the user can input a personalized
"Show When Run" prompt text; false
otherwise.setPromptAvailable(boolean)
public void setEnabled(boolean b)
setEnabled
in class javax.swing.JComponent
public void addActionUIListener(ActionUIListener l)
ActionUIListener
to the User Interface.
l
- - the listenerpublic void removeActionUIListener(ActionUIListener l)
ActionUIListener
to the User Interface.
l
- - the listenerpublic ActionUIListener[] getActionUIListeners()
public void fireShowWhenRunOptionChanged()
showWhenRunOptionChanged(ActionUIEvent)
method of all the listeners.
public void firePromptChanged()
promptChanged(ActionUIEvent)
method of all the listeners.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |