ix.iview
Class AConstructFramePanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by ix.iview.AConstructFramePanel
All Implemented Interfaces:
DataChangeListener, FramePanel, ConstructFraming, UndoEditing, VarSpecifier, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
ActionEditorPanel, AROEditorPanel, GlobalFramePanel, GrammarEditorPanel, SimpleEditorPanel

public abstract class AConstructFramePanel
extends javax.swing.JPanel
implements ConstructFraming, VarSpecifier, java.awt.event.ActionListener, UndoEditing, DataChangeListener

An abstract editor/viewer panel for domain constructs. This kind of panel is intended to sit within a frame (domain editor); it will usually contain one or more ConstuctEditing panels. E.g. the ActionEditorPanel has alternative ConstructEditing panels for simple/comprehensive/graphical views.

This abstract class manages the generic window building (scoll, connection to frame, etc) and undo/redo, options for modified objects, notification of ConstructListeners, open/close/switching behaviour, and variable declarations Abstract methods to define are:

protected JPanel setupMainPanel() to set up the main editing panel. This is called during creation/initialisation. Often, this is a simple wrapper panel that contains a ConstructEditing panel and not much else.

public void refresh() to refresh the panel, making sure updates are shown etc.

public void newConstruct() to clear the panel and set up a new construct of the kind to be edited in this panel

public UIObject makeNewConstruct() to create a construct of the kind to be edited in this panel. Returns the new construct. Note that this method should not change the panel display.

public boolean frameActionPerformed(ActionEvent event) for handling user requests that are generated in the frame (e.g. in the menu) rather than in the panel

public void actionPerformed(ActionEvent ae) Wakes up the ActionListener with a user action. This is called when a KeyStroke or other panel event (e.g. button click) happens in which the ActionListener registered its interest.

protected UIObject noteConstruct() transfer information from the panel into the object that is being edited.

Optional methods to overwrite are: public void viewChanges() to show the user changes between the edited object and the version in the draft domain

public void viewChangesFromOriginal() to show the user changes between the edited object and the version in the published domain

public Set search(String pattern) to search the domain constructs

To add a new ConstructFramePanel to an editor frame, subclass this panel, implement the abstract methods, put a ConstructEditing panel inside (use setupMainPanel to do this), and implement its methods. Tie the methods to the commands using frameActionPerformed and set up your own commands using buttons etc. and the actionPerformed method.

See Also:
Serialized Form

Nested Class Summary
protected  class AConstructFramePanel.FieldValue
           
protected  class AConstructFramePanel.JModifyDialog
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private)  java.util.HashSet currentConstructListeners
           
static boolean DEFAULT_SORT
           
protected  IFormPanel formPanel
          seems like this should not be here!
protected  boolean hasOverview
           
protected  javax.swing.JPanel mainPanel
          The panel's main panel in which editing occurs
 DomainEditorFrame parent
          The panels parent - a DomainEditor
protected  javax.swing.JScrollPane scrollPane
          The scrollPane in which all the panel's contents are placed
protected  boolean switching
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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
AConstructFramePanel()
          Creates an editor panel.
AConstructFramePanel(DomainEditorFrame theParent)
          Creates an editor panel with the given parent.
 
Method Summary
abstract  void actionPerformed(java.awt.event.ActionEvent ae)
          Wakes up the ActionListener with a user action.
 void addCurrentConstructListener(CurrentConstructListener ccl)
           
 void addUndoListener(UndoChangeListener listener)
           
 java.lang.String addVariableDeclaration(java.lang.String name)
          Add the given variable name as a declaration, return the name or "".
 void afterSwitching()
          Ensures that displays are updated for new view/construct.
protected  void askModifyDialog(UIObject uio)
           
protected  void askModifyOptions(UIObject uio)
           
 boolean beforeClosing()
           
 boolean beforeOpening()
           
 boolean beforeSwitching()
          Notes the current panel's contents in the current construct before switching.
 boolean canRedo()
           
 boolean canUndo()
           
 void clear()
           
protected abstract  UIObject cloneConstruct(UIObject original)
           
 void copyConstruct()
          User request to copy the current action.
 void dataChanged(EditableObject o, java.lang.String field, java.lang.Object oVal, java.lang.Object nVal)
           
 void deleteConstruct()
          User request to delete the current action.
 void editConstruct(java.lang.Object construct)
           
 void fireConstructChanged(UIObject oldUIO, UIObject newUIO, java.awt.Component source)
           
abstract  boolean frameActionPerformed(java.awt.event.ActionEvent event)
          Tries to process an action generated in the panel's frame.
 Domain getDomain()
          Gets the current Domain.
 ConstructEditing getEditingPanel()
           
 ConstructEditing getMainPanel()
           
 boolean getSort()
           
 UIObject getUIConstruct()
          Looks up the current construct in the main panel.
 UIDomain getUIDomain()
          Gets the current UIDomain.
 java.util.List getVarsToOffer()
          Offers the declared variables (if any) for completion, splices in selection (if any)
 boolean hasOverview()
           
abstract  UIObject makeNewConstruct()
          Makes a new construct of the panel's type.
 void newConstruct()
          Makes a new construct of the panel's type and get ready to edit it by seting it in the panel.
protected abstract  UIObject noteConstruct()
          Note the contents of the panel into the current object.
protected  void noteDraftConstruct(UIObject uio)
          Note the UIObject in the (right) draft domain
 void OLDsetUIConstruct(UIObject object)
          Sets the given UI construct to be viewed/edited.
 void populatePopup(JObjectPopup popup, java.lang.Object construct)
           
 boolean redo()
           
abstract  void refresh()
           
 void registerListKeys(javax.swing.JComponent comp, java.lang.String commandEnd)
           
 void removeCurrentConstructListener(CurrentConstructListener ccl)
           
 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 a construct into the draft domain.
 java.util.Set search(java.lang.String pattern)
           
 void setConstruct(IXObject object)
          Sets the given construct to be viewed/edited.
 void setSort(boolean sortIt)
           
 void setUIConstruct(UIObject object)
          Sets the given UI construct to be viewed/edited.
 void setUIConstructPanel(UIObject construct)
          overwrite this to not call before/after switching
 void setUIDomain(UIDomain uid)
          Sets the current UIDomain.
protected  void setupEditor()
          Sets the panel's layout and dimensions and the main panel's layout.
protected abstract  javax.swing.JPanel setupMainPanel()
          Sets up the main panel in which construct editing will happen.
protected  void setupOuterPanel()
           
 boolean undo()
           
 java.lang.Object undoGetValue(java.lang.String field)
          Gets the given field to the given value in the editor.
 void undoSetValue(java.lang.String field, java.lang.Object value)
          Sets the given field to the given value in the editor.
 void updateOverview()
           
 void viewChanges()
          into abstract User request to view the changes from the draft version of the object.
 void viewChangesFromOriginal()
          User request to view the changes from the original object.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ix.iview.ConstructFraming
checkConstruct, getAllConstructs, getNamedConstruct
 

Field Detail

parent

public DomainEditorFrame parent
The panels parent - a DomainEditor


scrollPane

protected javax.swing.JScrollPane scrollPane
The scrollPane in which all the panel's contents are placed


mainPanel

protected javax.swing.JPanel mainPanel
The panel's main panel in which editing occurs


formPanel

protected IFormPanel formPanel
seems like this should not be here! define lower down? used lots in ActionEditorPanel and GlobalFramePanel, not here or in DomainEditor


switching

protected boolean switching

hasOverview

protected boolean hasOverview

DEFAULT_SORT

public static boolean DEFAULT_SORT

currentConstructListeners

java.util.HashSet currentConstructListeners
Constructor Detail

AConstructFramePanel

public AConstructFramePanel()
Creates an editor panel. Don't use this


AConstructFramePanel

public AConstructFramePanel(DomainEditorFrame theParent)
Creates an editor panel with the given parent. Creates all panel components, the mouse listener, and the relation editor.

Parameters:
parent - the DomainEditorFrame that the panel belons to. Used mainly to keep toggle buttons and menus in synch
Method Detail

undoSetValue

public void undoSetValue(java.lang.String field,
                         java.lang.Object value)
Sets the given field to the given value in the editor.

Specified by:
undoSetValue in interface UndoEditing

undoGetValue

public java.lang.Object undoGetValue(java.lang.String field)
Gets the given field to the given value in the editor.

Specified by:
undoGetValue in interface UndoEditing

setupEditor

protected void setupEditor()
Sets the panel's layout and dimensions and the main panel's layout.


setupOuterPanel

protected void setupOuterPanel()

setupMainPanel

protected abstract javax.swing.JPanel setupMainPanel()
Sets up the main panel in which construct editing will happen. Often, this is a simple wrapper panel that contains a ConstructEditing panel and not much else.


getEditingPanel

public ConstructEditing getEditingPanel()

registerListKeys

public void registerListKeys(javax.swing.JComponent comp,
                             java.lang.String commandEnd)

getMainPanel

public ConstructEditing getMainPanel()

editConstruct

public void editConstruct(java.lang.Object construct)

deleteConstruct

public void deleteConstruct()
User request to delete the current action.


copyConstruct

public void copyConstruct()
User request to copy the current action.


setUIConstructPanel

public void setUIConstructPanel(UIObject construct)
overwrite this to not call before/after switching


search

public java.util.Set search(java.lang.String pattern)

viewChangesFromOriginal

public void viewChangesFromOriginal()
User request to view the changes from the original object. Collects the changes and shows them to the user.

Specified by:
viewChangesFromOriginal in interface ConstructFraming

viewChanges

public void viewChanges()
into abstract User request to view the changes from the draft version of the object. object. Collects the changes and shows them to the user.

Specified by:
viewChanges in interface ConstructFraming

saveConstruct

public void saveConstruct()
User request to save a construct 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.


setConstruct

public void setConstruct(IXObject object)
Sets the given construct to be viewed/edited. Makes a UI object unless there is already one, displays its details in the relevant fields of the editor, and remembers the UI object as current. Checks whether this object has previously been edited and recovers undo information if available.

Specified by:
setConstruct in interface ConstructFraming
Parameters:
object - the object to be viewed/edited

setUIConstruct

public void setUIConstruct(UIObject object)
Sets the given UI construct to be viewed/edited. Displays the ojbect's details in the relevant fields of the editor, and remembers the object as current. Manages the undo lists.

Specified by:
setUIConstruct in interface ConstructFraming
Parameters:
object - the UIObject to be viewed/edited

OLDsetUIConstruct

public void OLDsetUIConstruct(UIObject object)
Sets the given UI construct to be viewed/edited. Displays the ojbect's details in the relevant fields of the editor, and remembers the object as current. Manages the undo lists.

Parameters:
object - the UIObject to be viewed/edited

getUIConstruct

public UIObject getUIConstruct()
Looks up the current construct in the main panel.


getDomain

public Domain getDomain()
Description copied from interface: ConstructFraming
Gets the current Domain.

Specified by:
getDomain in interface ConstructFraming

getUIDomain

public UIDomain getUIDomain()
Description copied from interface: ConstructFraming
Gets the current UIDomain.

Specified by:
getUIDomain in interface ConstructFraming

setUIDomain

public void setUIDomain(UIDomain uid)
Description copied from interface: ConstructFraming
Sets the current UIDomain.

Specified by:
setUIDomain in interface ConstructFraming

clear

public void clear()

hasOverview

public boolean hasOverview()

updateOverview

public void updateOverview()

setSort

public void setSort(boolean sortIt)

getSort

public boolean getSort()

canUndo

public boolean canUndo()

canRedo

public boolean canRedo()

undo

public boolean undo()

redo

public boolean redo()

populatePopup

public void populatePopup(JObjectPopup popup,
                          java.lang.Object construct)

addUndoListener

public void addUndoListener(UndoChangeListener listener)

addCurrentConstructListener

public void addCurrentConstructListener(CurrentConstructListener ccl)

removeCurrentConstructListener

public void removeCurrentConstructListener(CurrentConstructListener ccl)

fireConstructChanged

public void fireConstructChanged(UIObject oldUIO,
                                 UIObject newUIO,
                                 java.awt.Component source)

beforeClosing

public boolean beforeClosing()

beforeOpening

public boolean beforeOpening()

afterSwitching

public void afterSwitching()
Ensures that displays are updated for new view/construct. Currently just makes sure that undos are shown properly (switching between graphical and form-based).


beforeSwitching

public boolean beforeSwitching()
Notes the current panel's contents in the current construct before switching.

Returns:
true if the switch should still take place, false to cancel the switch.

askModifyOptions

protected void askModifyOptions(UIObject uio)

askModifyDialog

protected void askModifyDialog(UIObject uio)

noteDraftConstruct

protected void noteDraftConstruct(UIObject uio)
Note the UIObject in the (right) draft domain


dataChanged

public void dataChanged(EditableObject o,
                        java.lang.String field,
                        java.lang.Object oVal,
                        java.lang.Object nVal)
Specified by:
dataChanged in interface DataChangeListener

getVarsToOffer

public java.util.List getVarsToOffer()
Offers the declared variables (if any) for completion, splices in selection (if any)

Specified by:
getVarsToOffer in interface VarSpecifier

addVariableDeclaration

public java.lang.String addVariableDeclaration(java.lang.String name)
Description copied from interface: VarSpecifier
Add the given variable name as a declaration, return the name or "".

Specified by:
addVariableDeclaration in interface VarSpecifier

newConstruct

public void newConstruct()
Makes a new construct of the panel's type and get ready to edit it by seting it in the panel. Overwrite if this is not the thing to do. Note: this used to be an abstract method.

Specified by:
newConstruct in interface ConstructFraming

refresh

public abstract void refresh()

makeNewConstruct

public abstract UIObject makeNewConstruct()
Description copied from interface: ConstructFraming
Makes a new construct of the panel's type.

Specified by:
makeNewConstruct in interface ConstructFraming

cloneConstruct

protected abstract UIObject cloneConstruct(UIObject original)

frameActionPerformed

public abstract boolean frameActionPerformed(java.awt.event.ActionEvent event)
Description copied from interface: ConstructFraming
Tries to process an action generated in the panel's frame.

Specified by:
frameActionPerformed in interface FramePanel
Specified by:
frameActionPerformed in interface ConstructFraming
Parameters:
event - the event to be processed.
Returns:
true if the event is recognised, false if not.

actionPerformed

public abstract 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 (button click) happens in which the ActionListener registered its interest.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

noteConstruct

protected abstract UIObject noteConstruct()
Note the contents of the panel into the current object.