ix.iview
Class ActionEditorPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--ix.iview.AConstructFramePanel
                                |
                                +--ix.iview.ActionEditorPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, ConstraintListener, ConstructFraming, java.util.EventListener, FramePanel, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, ix.iview.domain.event.UIDomainListener

public class ActionEditorPanel
extends AConstructFramePanel
implements ConstructFraming, ConstraintListener, java.awt.event.ActionListener, ix.iview.domain.event.UIDomainListener

An editor/viewer panel for refinement structures. The editor has a flag that specifies whether it is in advanced mode (true) or in simple mode (false).

The editor is created with an advanced flag (true for advanced). Subsequently, the refinement can be set using the setRefinement method.

The editor will not let you update a current refinement yet, because we have not yet worked out how to manage the impact this would have on other modules that use the domain. The editor will let you add new refinements (if you have changed an old one, change the name to save it).

The refinement name, pattern, and comments are currently simply strings. They can all be edited by typing into their fields. The pattern should not stay as a string - it should change into something a bit more constrained. This will be changed when the refinement models have been sorted out.

Sub-activities and constraints can be added, deleted, and cleared, either using the buttons or using keys (enter or insert for add, delete for delete).

Sub-activities are simple LLists for the moment. Adding a sub-activity expects the user to type in a pattern (currently just a string) and it will generate a number for the activity. Deleting sub-activities will also delete any constraints in which the deleted activity participates.

The only constraints currently known are ordering constraints. Adding constraints will bring up an editor that lets the user select activities and time-points. For the moment, these "proper" constraints are translated into simple versions because other modules cannot handle anything more complex. A simple constraint "( )" stands for "( End Before Begin ). The constraint editor and the DomainEditor are ready to provide and manage "proper" constraints, but we will not provide them until other modules can deal with them.

Example code for using the ActionEditorPanel:


    ...
    editorPanel = new ActionEditorPanel(this,isAdvanced);
    mainJPanel.add(editorPanel); 
    ...

See Also:
Serialized Form

Inner Class Summary
(package private)  class ActionEditorPanel.EdMouseAdapter
           
 
Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent, javax.swing.JComponent.ActionStandin, javax.swing.JComponent.IntVector, javax.swing.JComponent.KeyboardState
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
 ConditionEffectEditor conditionEditor
           
(package private)  ConstructEditing currentPanel
           
(package private)  IFormModel formModel
           
(package private)  GExpansionEditor graphPanel
           
(package private)  java.lang.String lineSeparator
           
 OrderingEditor orderingEditor
          An editor for temporal relations
 SpecEditor specEditor
           
 
Fields inherited from class ix.iview.AConstructFramePanel
formPanel, mainPanel, parent, scrollPane
 
Fields inherited from class javax.swing.JComponent
_bounds, accessibleContext, listenerList, paintingChild, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
component, containerListener, layoutMgr, listeningBoundsChildren, listeningChildren, ncomponents
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, newEventsOnly, ownedWindowK, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ActionEditorPanel(DomainEditor theParent, boolean isAdvanced)
          Creates the editor panel with the given parent in advanced/simple mode.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
          Wakes up the ActionListener with a user action.
 boolean beforeClosing()
           
 boolean checkConstruct()
          User request to check the refinement - not implemented.
protected  boolean clearOrderings()
           
 void clearUIConstruct()
          Clears the current construct and the panel.
 void constructAdded(RefinementEvent event)
           
 void constructAdded(ix.iview.domain.event.UIDomainEvent event)
          Called when a UI construct is added.
 void constructEdited(ix.iview.domain.event.UIDomainEvent event)
          Called when a UI construct is edited.
 void constructRemoved(ix.iview.domain.event.UIDomainEvent event)
          Called when a UI construct is removed.
 void domainCleared(ix.iview.domain.event.UIDomainEvent event)
           
 void domainEdited(ix.iview.domain.event.UIDomainEvent se)
           
 void domainSet(ix.iview.domain.event.UIDomainEvent event)
           
 void ensureConditionEditor()
           
 void ensureRelationEditor()
           
 void ensureSpecEditor(java.lang.String type)
           
 void ensureSpecEditor(java.lang.String type, java.lang.String init)
           
 boolean frameActionPerformed(java.awt.event.ActionEvent event)
          Recognises panel specific events and processes them.
 java.util.List getAllConstructs()
          Gets a full list of the constructs of the panel's type in the domain.
 java.util.ArrayList getAllExpansions(NodeSpec node)
           
 Named getNamedConstruct(java.lang.String name)
          Gets a named construct of the panel's type from the domain
 void gotConstraint(java.lang.Object o, java.lang.Object constraint)
          Wakes up the ConstraintListener with a newly defined ordering.
 boolean isAdvancedSet()
           
 boolean isSequenceSet()
           
 ix.iview.domain.UIObject makeNewConstruct()
          User request to make a new action.
 ix.iview.domain.UIRefinement makeNewRefinement(java.lang.String name, LList pattern)
           
 void makeParallel()
          Puts the nodes of the current refinement in parallel.
 void makeSequence()
          Puts the nodes of the current refinement into sequence.
static java.util.List makeSequence(java.util.List nodes)
          Puts the given nodes into sequence.
 void newConstruct()
          User request to make a new action.
protected  ix.iview.domain.UIObject noteConstruct()
          Note the settings in the editor in a UIObject.
 void noteTextNodes()
          Parse the nodes from the text area and store them in the current refinement.
protected static void notImp(java.lang.String message)
           
static boolean orderingsAreSequential(LList nodes, LList orderings)
          Checks whether the orderings are a sequence of the nodes.
protected  void resetUIConstruct(ix.iview.domain.UIObject object)
          Same as setUIConstruct, but remembers the setting of the miniConstraints
 void revertConstruct()
          User request to revert an action to when it was last saved in the draft domain.
 void revertOConstruct()
          User request to revert an action to when it was last saved in the draft domain.
 void saveConstruct()
          User request to save an action into the draft domain.
 void setAdvanced(boolean newAdvanced)
          Sets the editor to advanced (true) or simple (false) mode.
 void setDefaultSequence(boolean newSequence)
          Sets the flag to put nodes in sequence (true) or in parallel (false) If the state of the checkbox does not correspond to the new setting, it is changed.
 void setOrdering(boolean isSequence)
           
protected  void setPanel(ConstructEditing panel)
           
 void setUIConstruct(ix.iview.domain.UIObject object)
          Sets the given UI construct to be viewed/edited.
 void setUIConstructOnly(ix.iview.domain.UIObject object)
          Sets the given UI construct to be viewed/edited without noting the previous construct.
protected  void setupActionTree()
           
protected  javax.swing.JPanel setupMainPanel()
           
 void userMakeParallel()
          User request to put the nodes of the current action in parallel.
 void userMakeSequence()
          User request to put the nodes of the current action into sequence.
 
Methods inherited from class ix.iview.AConstructFramePanel
beforeOpening, beforeSwitching, clear, getDomain, getUIDomain, noteDraftConstruct, registerListKeys, setConstruct, setUIDomain, setupEditor, setupOuterPanel
 
Methods inherited from class javax.swing.JPanel
, getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, alwaysOnTop, checkIfChildObscuredBySibling, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMouseEventTarget, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFocusOwner, setLayout, transferFocus, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, constructComponentName, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resetGC, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ix.iview.ConstructFraming
getDomain, getUIDomain, setConstruct, setUIDomain
 

Field Detail

orderingEditor

public OrderingEditor orderingEditor
An editor for temporal relations

conditionEditor

public ConditionEffectEditor conditionEditor

specEditor

public SpecEditor specEditor

formModel

IFormModel formModel

currentPanel

ConstructEditing currentPanel

graphPanel

GExpansionEditor graphPanel

lineSeparator

java.lang.String lineSeparator
Constructor Detail

ActionEditorPanel

public ActionEditorPanel(DomainEditor theParent,
                         boolean isAdvanced)
Creates the editor panel with the given parent in advanced/simple mode. Creates all panel components, the mouse listener, and the relation editor.
Parameters:
parent - the DomainEditor frame that the panel belons to. Used mainly to keep toggle buttons and menus in synch
isAdvanced - a flag specifying whether the editor is to display its advanced features or not.
Method Detail

setupMainPanel

protected javax.swing.JPanel setupMainPanel()
Overrides:
setupMainPanel in class AConstructFramePanel

setupActionTree

protected void setupActionTree()

setPanel

protected void setPanel(ConstructEditing panel)

isAdvancedSet

public boolean isAdvancedSet()
Returns:
the current setting of the advanced flag

setAdvanced

public void setAdvanced(boolean newAdvanced)
Sets the editor to advanced (true) or simple (false) mode. If the editor was in graph mode If the editor is already in the given mode, nothing is done. For advanced mode, a constraint panel appears with all constraints listed and buttons for adding constraings. For simple mode, the constraint panel only contains a radio button for sequencing nodes and a button to set the mode to advanced.

isSequenceSet

public boolean isSequenceSet()
Returns:
the current setting of the sequence flag

setDefaultSequence

public void setDefaultSequence(boolean newSequence)
Sets the flag to put nodes in sequence (true) or in parallel (false) If the state of the checkbox does not correspond to the new setting, it is changed. If the editor is already in the given mode, nothing is done. Currently, nothing else changes in the panel

orderingsAreSequential

public static boolean orderingsAreSequential(LList nodes,
                                             LList orderings)
Checks whether the orderings are a sequence of the nodes.
Parameters:
nodes - the nodes that can be part of the ordering.
orderings - the orderings to be tested.

setOrdering

public void setOrdering(boolean isSequence)

makeSequence

public void makeSequence()
Puts the nodes of the current refinement into sequence.

makeSequence

public static java.util.List makeSequence(java.util.List nodes)
Puts the given nodes into sequence.

makeParallel

public void makeParallel()
Puts the nodes of the current refinement in parallel.

ensureRelationEditor

public void ensureRelationEditor()

ensureConditionEditor

public void ensureConditionEditor()

ensureSpecEditor

public void ensureSpecEditor(java.lang.String type)

ensureSpecEditor

public void ensureSpecEditor(java.lang.String type,
                             java.lang.String init)

beforeClosing

public boolean beforeClosing()
Overrides:
beforeClosing in class AConstructFramePanel

setUIConstruct

public void setUIConstruct(ix.iview.domain.UIObject object)
Sets the given UI construct to be viewed/edited. Also sets the uiConstruct in the current editorPanel
Specified by:
setUIConstruct in interface ConstructFraming
Overrides:
setUIConstruct in class AConstructFramePanel
Parameters:
object - the UI object to be viewed/edited

setUIConstructOnly

public void setUIConstructOnly(ix.iview.domain.UIObject object)
Sets the given UI construct to be viewed/edited without noting the previous construct. Also sets the uiConstruct in the current editorPanel
Parameters:
object - the UI object to be viewed/edited

clearUIConstruct

public void clearUIConstruct()
Clears the current construct and the panel. Also sets the uiConstruct in the current editorPanel

makeNewRefinement

public ix.iview.domain.UIRefinement makeNewRefinement(java.lang.String name,
                                                      LList pattern)

getAllExpansions

public java.util.ArrayList getAllExpansions(NodeSpec node)

noteConstruct

protected ix.iview.domain.UIObject noteConstruct()
Note the settings in the editor in a UIObject. Do not save into doamin.
Overrides:
noteConstruct in class AConstructFramePanel

resetUIConstruct

protected void resetUIConstruct(ix.iview.domain.UIObject object)
Same as setUIConstruct, but remembers the setting of the miniConstraints

checkConstruct

public boolean checkConstruct()
User request to check the refinement - not implemented.
Specified by:
checkConstruct in interface ConstructFraming

newConstruct

public void newConstruct()
User request to make a new action.
Specified by:
newConstruct in interface ConstructFraming
Overrides:
newConstruct in class AConstructFramePanel

makeNewConstruct

public ix.iview.domain.UIObject makeNewConstruct()
User request to make a new action.
Specified by:
makeNewConstruct in interface ConstructFraming
Overrides:
makeNewConstruct in class AConstructFramePanel

saveConstruct

public void saveConstruct()
User request to save an action into the draft domain.
Specified by:
saveConstruct in interface ConstructFraming

revertConstruct

public void revertConstruct()
User request to revert an action to when it was last saved in the draft domain.

revertOConstruct

public void revertOConstruct()
User request to revert an action to when it was last saved in the draft domain.

getAllConstructs

public java.util.List getAllConstructs()
Description copied from interface: ConstructFraming
Gets a full list of the constructs of the panel's type in the domain.
Specified by:
getAllConstructs in interface ConstructFraming

getNamedConstruct

public Named getNamedConstruct(java.lang.String name)
Description copied from interface: ConstructFraming
Gets a named construct of the panel's type from the domain
Specified by:
getNamedConstruct in interface ConstructFraming

userMakeSequence

public void userMakeSequence()
User request to put the nodes of the current action into sequence.

userMakeParallel

public void userMakeParallel()
User request to put the nodes of the current action in parallel.

noteTextNodes

public void noteTextNodes()
Parse the nodes from the text area and store them in the current refinement.

clearOrderings

protected boolean clearOrderings()

constructAdded

public void constructAdded(ix.iview.domain.event.UIDomainEvent event)
Called when a UI construct is added. Use getSource() to get at the domain (UI/IX) in which the event occurred. Use getObject() to get at the object (UI/IX) that has been added.
Specified by:
constructAdded in interface ix.iview.domain.event.UIDomainListener

constructAdded

public void constructAdded(RefinementEvent event)
Specified by:
constructAdded in interface ix.iview.domain.event.UIDomainListener

constructEdited

public void constructEdited(ix.iview.domain.event.UIDomainEvent event)
Called when a UI construct is edited. Use getSource() to get at the UIDomain in which the event occurred. Use getObject() to get at the UIObject that has been edited.
Specified by:
constructEdited in interface ix.iview.domain.event.UIDomainListener

constructRemoved

public void constructRemoved(ix.iview.domain.event.UIDomainEvent event)
Called when a UI construct is removed. Use getSource() to get at the UIDomain in which the event occurred. Use getObject() to get at the UIObject that has been removed.
Specified by:
constructRemoved in interface ix.iview.domain.event.UIDomainListener

domainCleared

public void domainCleared(ix.iview.domain.event.UIDomainEvent event)
Specified by:
domainCleared in interface ix.iview.domain.event.UIDomainListener

domainEdited

public void domainEdited(ix.iview.domain.event.UIDomainEvent se)
Specified by:
domainEdited in interface ix.iview.domain.event.UIDomainListener

domainSet

public void domainSet(ix.iview.domain.event.UIDomainEvent event)
Specified by:
domainSet in interface ix.iview.domain.event.UIDomainListener

gotConstraint

public void gotConstraint(java.lang.Object o,
                          java.lang.Object constraint)
Wakes up the ConstraintListener with a newly defined ordering. This is called when a new ordering has been defined by the component with which the ConstraintListener registered its interest.
Specified by:
gotConstraint in interface ConstraintListener
Parameters:
o - the object to which the constraint applies
constraint - the new constraint

frameActionPerformed

public boolean frameActionPerformed(java.awt.event.ActionEvent event)
Recognises panel specific events and processes them. This is a separate method because it must let other event handlers know whether it recognised the event.
Specified by:
frameActionPerformed in interface ConstructFraming
Overrides:
frameActionPerformed in class AConstructFramePanel
Parameters:
event - the event to be processed.
Returns:
true if the event was recognised, false if not.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Wakes up the ActionListener with a user action. This is called when a KeyStroke or other panel event happens in which the ActionListener registered its interest.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class AConstructFramePanel

notImp

protected static void notImp(java.lang.String message)