org.ceryle.ui.graph
Class AssociationEditorDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by org.ceryle.ui.graph.AssociationEditorDialog
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class AssociationEditorDialog
extends JDialog

A singleton class extending JDialog, providing basic dialog features for an Association editor. This embeds an EditorLayoutPanel, a prototype graph. Note that the dialog is not automatically displayed upon instantiation.

Since:
JDK1.4
Version:
$Id: AssociationEditorDialog.java,v 3.23 2007-06-20 01:28:20 altheim Exp $
Author:
Murray Altheim
See Also:
Serialized Form

Nested Class Summary
protected  class AssociationEditorDialog.ATPopup
          Inner class handles role popup menus.
 class AssociationEditorDialog.DialogDisposer
           
protected  class AssociationEditorDialog.PlayerPopup
          Inner class handles player popup menus.
protected  class AssociationEditorDialog.RolePopup
          Inner class handles role popup menus.
 
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int ASSOC_DIR_FORWARD
          Indicates a forwardly-directed Association.
static int ASSOC_DIR_NONE
          Indicates an undirected Association.
static int ASSOC_DIR_REFLEXIVE
          Indicates a reflexive Association.
static int ASSOC_DIR_REVERSE
          Indicates a reverse-directed Association.
static String assocEditorHelpID
          The ID in the Help collection for the Association Editor.
protected  JCheckBoxMenuItem btn_isTemplate
           
static int delay
          The delay (in seconds) following which a call to backgroundCreate() calls the singleton instantiation thread.
static int HORIZ_SIZE
          The default horizontal size of the dialog.
static int VERT_SIZE
          The default vertical size of the dialog.
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
static void backgroundCreate()
          Uses a TimerTask to create an AssociationEditor a few seconds after being called, so that the initial display of the Graphview has time to stabilize before building the editor.
protected  void categorySelected(int category, int clickcount)
          Receives notification of a node selection in the embedded graph.
 void clear()
          Clear all stored content.
protected  void closing()
           
protected  JPanel createButtonPanel()
          Returns the southernmost toolbar containing the buttons set and close buttons, as well as the toolbar buttons for manipulating topics, associations, and occurrences.
 boolean editAssociation(TMLayoutPanel tmlpanel, ANode anode)
          Sets the editing facilities for the provided ANode and its underlying Association.
static AssociationEditorDialog getInstance()
          As this is a singleton class, this returns the single instance of this class.
protected  void handlePopupMenuEvent(MouseEvent event, int nodeID, TMNode node)
          Handles right-click MouseEvents on the EditorLayoutPanel by displaying a context-sensitive popup menu.
 boolean isEditable()
          Returns true if the current association template is editable.
 boolean isInTransition()
          Returns true if the AssociationEditorDialog is in transition between loading topics.
protected  void revertAssociation()
          Revert the Association Editors's characteristics to the original graph/topic map.
protected  boolean saveAssociation()
          Save this Association's characteristics to the current graph/topic map, returning true if the save was successful.
 void saveProperties()
          Save any UI properties to the preferences file.
 Topic selectRole()
          Responds to a selection from a dialog button to select a role Topic from a tree.
 void selectType()
          Responds to a selection from the dialog button to select an Association typing Topic from a tree.
protected  void setAssociation(Association assoc, Topic type, boolean query)
          Sets the Association and typing Topic value and displayed label according to either the Association assoc OR the Topic topic, with priority given the former.
protected  void setDirty(boolean state)
          Sets the dirty state for this dialog.
protected  void setIsTemplate(boolean enabled, boolean isTemplate, boolean isEditable)
          Sets the "is Association Template" checkbox to the parameter value isTemplate.
protected  void setTopic_PlayerLeft(Member member, Topic player, TNode tnode, boolean query)
          Sets the left Member, the player Topic value and displayed label according to the Topic topic.
protected  void setTopic_PlayerRight(Member member, Topic player, TNode tnode, boolean query)
          Sets the right Member, the player Topic value and displayed label according to the Topic topic.
protected  void setTopic_RoleLeft(Topic role, boolean query)
          Sets the left role Topic value and displayed label according to the Topic topic.
protected  void setTopic_RoleRight(Topic role, boolean query)
          Sets the right role Topic value and displayed label according to the Topic topic.
 void setVisible(boolean visible)
          Overrides the superclass to finish up with graph animation prior to showing the dialog.
 boolean somethingHasChanged()
          Returns true if anything has changed between the original Association and the current editor configuration.
protected  void somethingMayHaveChanged()
          This compares the current configuration with the original set upon opening the dialog, and if changed, sets the dirty state true, otherwise sets it false.
 void updatePrototypeFont()
          Notifies the EditorLayoutPanel that the base GraphNode font size has changed.
 boolean xEditAssociation(TMLayoutPanel tmlpanel, ANode anode)
          Sets the editing facilities for the provided ANode and its underlying Association.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

assocEditorHelpID

public static final String assocEditorHelpID
The ID in the Help collection for the Association Editor.

See Also:
Constant Field Values

ASSOC_DIR_NONE

public static final int ASSOC_DIR_NONE
Indicates an undirected Association.

See Also:
Constant Field Values

ASSOC_DIR_FORWARD

public static final int ASSOC_DIR_FORWARD
Indicates a forwardly-directed Association.

See Also:
Constant Field Values

ASSOC_DIR_REVERSE

public static final int ASSOC_DIR_REVERSE
Indicates a reverse-directed Association.

See Also:
Constant Field Values

ASSOC_DIR_REFLEXIVE

public static final int ASSOC_DIR_REFLEXIVE
Indicates a reflexive Association.

See Also:
Constant Field Values

HORIZ_SIZE

public static int HORIZ_SIZE
The default horizontal size of the dialog.


VERT_SIZE

public static int VERT_SIZE
The default vertical size of the dialog.


delay

public static int delay
The delay (in seconds) following which a call to backgroundCreate() calls the singleton instantiation thread. Default is 7 seconds.


btn_isTemplate

protected JCheckBoxMenuItem btn_isTemplate
Method Detail

getInstance

public static AssociationEditorDialog getInstance()
As this is a singleton class, this returns the single instance of this class. If the AssociationEditorDialog object has already been created, this method returns it.


backgroundCreate

public static void backgroundCreate()
Uses a TimerTask to create an AssociationEditor a few seconds after being called, so that the initial display of the Graphview has time to stabilize before building the editor. After the editor has been created, calling this message again has no effect. If {} is called in the interim, it will cancel the waiting Thread.


setVisible

public void setVisible(boolean visible)
Overrides the superclass to finish up with graph animation prior to showing the dialog.

Overrides:
setVisible in class Component

clear

public void clear()
Clear all stored content.


editAssociation

public boolean editAssociation(TMLayoutPanel tmlpanel,
                               ANode anode)
Sets the editing facilities for the provided ANode and its underlying Association. The return value can be used as an indicator on whether to show the dialog.

Returns:
true if the Association can be edited

xEditAssociation

public boolean xEditAssociation(TMLayoutPanel tmlpanel,
                                ANode anode)
Sets the editing facilities for the provided ANode and its underlying Association. The return value can be used as an indicator on whether to show the dialog.

Returns:
true if the Association can be edited

setIsTemplate

protected void setIsTemplate(boolean enabled,
                             boolean isTemplate,
                             boolean isEditable)
Sets the "is Association Template" checkbox to the parameter value isTemplate. If isEditable is false, this disables the ability to change the role Topics.


isEditable

public boolean isEditable()
Returns true if the current association template is editable. This also returns true if there is no template match.


setAssociation

protected void setAssociation(Association assoc,
                              Topic type,
                              boolean query)
Sets the Association and typing Topic value and displayed label according to either the Association assoc OR the Topic topic, with priority given the former. If the Association is not provided the Topic is used attempt to locate the corresponding Association template to supply the various roles and labels. If it cannot be found, the EditorLayoutPanel's corresponding ANode is cleared of its Association object.

If query is true, a dialog box will allow re-selection.


setTopic_RoleLeft

protected void setTopic_RoleLeft(Topic role,
                                 boolean query)
Sets the left role Topic value and displayed label according to the Topic topic.

If query is true, a dialog box will allow re-selection.


setTopic_PlayerLeft

protected void setTopic_PlayerLeft(Member member,
                                   Topic player,
                                   TNode tnode,
                                   boolean query)
Sets the left Member, the player Topic value and displayed label according to the Topic topic.

If query is true, a dialog box will allow re-selection.


setTopic_RoleRight

protected void setTopic_RoleRight(Topic role,
                                  boolean query)
Sets the right role Topic value and displayed label according to the Topic topic.

If query is true, a dialog box will allow re-selection.


setTopic_PlayerRight

protected void setTopic_PlayerRight(Member member,
                                    Topic player,
                                    TNode tnode,
                                    boolean query)
Sets the right Member, the player Topic value and displayed label according to the Topic topic.

If query is true, a dialog box will allow re-selection.


categorySelected

protected void categorySelected(int category,
                                int clickcount)
Receives notification of a node selection in the embedded graph. (This currently doesn't do anything.)


selectRole

public Topic selectRole()
Responds to a selection from a dialog button to select a role Topic from a tree.


handlePopupMenuEvent

protected void handlePopupMenuEvent(MouseEvent event,
                                    int nodeID,
                                    TMNode node)
Handles right-click MouseEvents on the EditorLayoutPanel by displaying a context-sensitive popup menu. These are lazily-instantiated.


selectType

public void selectType()
Responds to a selection from the dialog button to select an Association typing Topic from a tree.


createButtonPanel

protected JPanel createButtonPanel()
Returns the southernmost toolbar containing the buttons set and close buttons, as well as the toolbar buttons for manipulating topics, associations, and occurrences.


closing

protected void closing()

saveProperties

public void saveProperties()
Save any UI properties to the preferences file.


revertAssociation

protected void revertAssociation()
Revert the Association Editors's characteristics to the original graph/topic map.


saveAssociation

protected boolean saveAssociation()
Save this Association's characteristics to the current graph/topic map, returning true if the save was successful.


somethingHasChanged

public boolean somethingHasChanged()
Returns true if anything has changed between the original Association and the current editor configuration.


somethingMayHaveChanged

protected void somethingMayHaveChanged()
This compares the current configuration with the original set upon opening the dialog, and if changed, sets the dirty state true, otherwise sets it false.


setDirty

protected void setDirty(boolean state)
Sets the dirty state for this dialog.


updatePrototypeFont

public void updatePrototypeFont()
Notifies the EditorLayoutPanel that the base GraphNode font size has changed.


isInTransition

public boolean isInTransition()
Returns true if the AssociationEditorDialog is in transition between loading topics.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.