org.argouml.uml.ui
Class PropPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--org.argouml.ui.TabSpawnable
                                |
                                +--org.argouml.uml.ui.PropPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.lang.Cloneable, java.util.EventListener, java.awt.image.ImageObserver, ru.novosoft.uml.MElementListener, java.awt.MenuContainer, NavigationListener, Orientable, java.io.Serializable, TabModelTarget, UMLUserInterfaceContainer
Direct Known Subclasses:
PropPanelDiagram, PropPanelModelElement, TabDocumentation

public abstract class PropPanel
extends TabSpawnable
implements TabModelTarget, ru.novosoft.uml.MElementListener, UMLUserInterfaceContainer

This abstract class provides the basic layout and event dispatching support for all Property Panels. The property panel is layed out as a number (specified in the constructor) of equally sized panels that split the available space. Each panel has a column of "captions" and matching column of "fields" which are laid out indepently from the other panels.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected static javax.swing.ImageIcon _deleteIcon
           
protected static javax.swing.ImageIcon _navBackIcon
           
protected static javax.swing.ImageIcon _navForwardIcon
           
protected static javax.swing.ImageIcon _navUpIcon
           
protected  javax.swing.JPanel buttonPanel
           
protected  java.awt.Font smallFont
           
 
Fields inherited from class org.argouml.ui.TabSpawnable
cat, orientation, OVERLAPP
 
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
PropPanel(java.lang.String title, javax.swing.ImageIcon icon, int panelCount)
          Constructs the PropPanel - DO NOT USE.
PropPanel(java.lang.String title, javax.swing.ImageIcon icon, Orientation orientation)
          Construct new PropPanel using LabelledLayout
PropPanel(java.lang.String title, int panelCount)
          Deprecated. 7-Dec-2002 by Bob Tarling. Use the constructor specifying orientation instead.
PropPanel(java.lang.String title, Orientation orientation)
          Constructs a new Proppanel without an icon.
 
Method Summary
 void addCaption(java.awt.Component component, int row, int panel, double weighty)
          Adds a component to the captions of the specified panel.
 void addCaption(java.lang.String label, int row, int panel, double weighty)
           
 void addField(java.awt.Component component, int row, int panel, double weighty)
          Adds a component to the fields of the specified panel.
 javax.swing.JLabel addField(java.lang.String label, java.awt.Component component)
          Add a component with the specified label
 javax.swing.JLabel addFieldAfter(java.lang.String label, java.awt.Component component, java.awt.Component afterComponent)
          Add a component with the specified label positioned after another component
 javax.swing.JLabel addFieldBefore(java.lang.String label, java.awt.Component component, java.awt.Component beforeComponent)
          Add a component with the specified label positioned before another component
 void addLinkField(java.awt.Component component, int row, int panel, double weighty)
          Adds a component to the fields of the specified panel and sets the background and color to indicate the field is a link.
 void addLinkField(java.lang.String label, javax.swing.JComponent component)
          Adds a component to the fields of the specified panel and sets the background and color to indicate the field is a link.
 void addMElementListener(ru.novosoft.uml.MBase target)
          This method (and removeMElementListener) can be overriden if the prop panel wants to monitor additional objects.
 void addNavigationListener(NavigationListener navListener)
          Registers a listener for navigation events.
 java.lang.String formatCollection(java.util.Iterator iter)
          Formats a collection of model elements.
 java.lang.String formatElement(ru.novosoft.uml.foundation.core.MModelElement element)
          Formats the specified model element.
 java.lang.String formatNamespace(ru.novosoft.uml.foundation.core.MNamespace ns)
          Formats the model element as a namespace.
protected  ru.novosoft.uml.foundation.core.MNamespace getDisplayNamespace()
          This method can be overriden in derived Panels where the appropriate namespace for display may not be the same as the namespace of the target
 ru.novosoft.uml.foundation.core.MModelElement getModelElement()
          Returns the current target for the container if the target is a MModelElement, otherwise null.
 Profile getProfile()
          Returns the current profile, may not be null.
 java.util.ResourceBundle getResourceBundle()
           
 java.lang.Object getTarget()
          Returns the current target for the container, may be null.
 boolean isNavigateBackEnabled()
          Returns true if this listener has a target for a back navigation.
 boolean isNavigateForwardEnabled()
          Returns true if this listener has a target for a back navigation.
 boolean isRemovableElement()
          check whether this element can be deleted.
 void listRoleItemSet(ru.novosoft.uml.MElementEvent mee)
           
 java.lang.String localize(java.lang.String key)
          Returns a localized string corresponding to the key
 boolean navigateBack(boolean attempt)
          Called to navigate to previous selection returns true if navigation performed
 void navigateBackAction()
           
 boolean navigateForward(boolean attempt)
          Called to navigate to next selection returns true if navigation performed
 void navigateForwardAction()
           
 void navigateTo(java.lang.Object element)
          Called by a user interface element when a request to navigate to a model element has been received.
 void open(java.lang.Object element)
          Called by a user interface element when a request to open a model element in a new window has been recieved.
 void propertySet(ru.novosoft.uml.MElementEvent mee)
           
 void recovered(ru.novosoft.uml.MElementEvent mee)
           
 void refresh()
           
 void removed(ru.novosoft.uml.MElementEvent mee)
           
 void removeElement()
           
protected  void removeMElementListener(ru.novosoft.uml.MBase target)
          This method (and addMElementListener) can be overriden if the prop panel wants to monitor additional objects.
 void removeNavigationListener(NavigationListener navListener)
          Removes a listener for navigation events.
 void roleAdded(ru.novosoft.uml.MElementEvent mee)
           
 void roleRemoved(ru.novosoft.uml.MElementEvent mee)
           
 void setNameEventListening(java.lang.Class[] metaclasses)
          Deprecated. since components should register themselves.
 void setOrientation(Orientation orientation)
           
 void setTarget(java.lang.Object t)
          Set the target to be associated with a particular property panel. This involves resetting the third party listeners.
 boolean shouldBeEnabled()
           
 
Methods inherited from class org.argouml.ui.TabSpawnable
clone, getTitle, setTitle, spawn
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, 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, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, 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, 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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buttonPanel

protected javax.swing.JPanel buttonPanel

_navBackIcon

protected static javax.swing.ImageIcon _navBackIcon

_navForwardIcon

protected static javax.swing.ImageIcon _navForwardIcon

_deleteIcon

protected static javax.swing.ImageIcon _deleteIcon

_navUpIcon

protected static javax.swing.ImageIcon _navUpIcon

smallFont

protected java.awt.Font smallFont
Constructor Detail

PropPanel

public PropPanel(java.lang.String title,
                 int panelCount)
Deprecated. 7-Dec-2002 by Bob Tarling. Use the constructor specifying orientation instead.

Constructs the PropPanel.
Parameters:
title - Title of panel
panelCount - number of horizontal panels

PropPanel

public PropPanel(java.lang.String title,
                 javax.swing.ImageIcon icon,
                 int panelCount)
Constructs the PropPanel - DO NOT USE.
Parameters:
title - Title of panel
panelCount - number of horizontal panels

PropPanel

public PropPanel(java.lang.String title,
                 javax.swing.ImageIcon icon,
                 Orientation orientation)
Construct new PropPanel using LabelledLayout
Parameters:
icon - The icon to display for the panel
title - The title of the panel
sectionCount - the number of sections in the proppanel

PropPanel

public PropPanel(java.lang.String title,
                 Orientation orientation)
Constructs a new Proppanel without an icon. If there is an icon it's updated at runtime via settarget.
Parameters:
title -  
orientation -  
Method Detail

setOrientation

public void setOrientation(Orientation orientation)
Overrides:
setOrientation in class TabSpawnable

addCaption

public void addCaption(java.awt.Component component,
                       int row,
                       int panel,
                       double weighty)
Adds a component to the captions of the specified panel.
Parameters:
component - Component to be added (typically a JLabel)
row - row index, zero-based.
panel - panel index, zero-based.
weighty - specifies how to distribute extra vertical space, see GridBagConstraint for details on usage.

addCaption

public void addCaption(java.lang.String label,
                       int row,
                       int panel,
                       double weighty)

addField

public javax.swing.JLabel addField(java.lang.String label,
                                   java.awt.Component component)
Add a component with the specified label
Parameters:
label - the label for the component
component - the component

addFieldAfter

public javax.swing.JLabel addFieldAfter(java.lang.String label,
                                        java.awt.Component component,
                                        java.awt.Component afterComponent)
Add a component with the specified label positioned after another component
Parameters:
label - the label for the component
component - the component

addFieldBefore

public javax.swing.JLabel addFieldBefore(java.lang.String label,
                                         java.awt.Component component,
                                         java.awt.Component beforeComponent)
Add a component with the specified label positioned before another component
Parameters:
label - the label for the component
component - the component
beforeComponent - the component

addLinkField

public final void addLinkField(java.lang.String label,
                               javax.swing.JComponent component)
Adds a component to the fields of the specified panel and sets the background and color to indicate the field is a link.
Parameters:
label - the required string label
component - Component to be added

localize

public final java.lang.String localize(java.lang.String key)
Description copied from interface: UMLUserInterfaceContainer
Returns a localized string corresponding to the key
Specified by:
localize in interface UMLUserInterfaceContainer
Following copied from interface: org.argouml.uml.ui.UMLUserInterfaceContainer
Parameters:
key - key for resource bundle, typically english literal
Returns:
localized string for key based on system settings and configuration file

getResourceBundle

public java.util.ResourceBundle getResourceBundle()

addField

public void addField(java.awt.Component component,
                     int row,
                     int panel,
                     double weighty)
Adds a component to the fields of the specified panel.
Parameters:
component - Component to be added
row - row index, zero-based.
panel - panel index, zero-based.
weighty - specifies how to distribute extra vertical space, see GridBagConstraint for details on usage.

addLinkField

public final void addLinkField(java.awt.Component component,
                               int row,
                               int panel,
                               double weighty)
Adds a component to the fields of the specified panel and sets the background and color to indicate the field is a link.
Parameters:
component - Component to be added
row - row index, zero-based.
panel - panel index, zero-based.
weighty - specifies how to distribute extra vertical space, see GridBagConstraint for details on usage.

getProfile

public Profile getProfile()
Description copied from interface: UMLUserInterfaceContainer
Returns the current profile, may not be null.
Specified by:
getProfile in interface UMLUserInterfaceContainer

removeMElementListener

protected void removeMElementListener(ru.novosoft.uml.MBase target)
This method (and addMElementListener) can be overriden if the prop panel wants to monitor additional objects.
Parameters:
target - target of prop panel

addMElementListener

public void addMElementListener(ru.novosoft.uml.MBase target)
This method (and removeMElementListener) can be overriden if the prop panel wants to monitor additional objects. This method is public only since it is called from a Runnable object.
Parameters:
target - target of prop panel

setTarget

public void setTarget(java.lang.Object t)

Set the target to be associated with a particular property panel.

This involves resetting the third party listeners.

Specified by:
setTarget in interface TabModelTarget
Parameters:
t - The object to be set as a target.

getTarget

public final java.lang.Object getTarget()
Description copied from interface: UMLUserInterfaceContainer
Returns the current target for the container, may be null.
Specified by:
getTarget in interface TabModelTarget

getModelElement

public final ru.novosoft.uml.foundation.core.MModelElement getModelElement()
Description copied from interface: UMLUserInterfaceContainer
Returns the current target for the container if the target is a MModelElement, otherwise null.
Specified by:
getModelElement in interface UMLUserInterfaceContainer

refresh

public void refresh()
Specified by:
refresh in interface TabModelTarget

shouldBeEnabled

public boolean shouldBeEnabled()
Specified by:
shouldBeEnabled in interface TabModelTarget

propertySet

public void propertySet(ru.novosoft.uml.MElementEvent mee)
Specified by:
propertySet in interface ru.novosoft.uml.MElementListener

listRoleItemSet

public void listRoleItemSet(ru.novosoft.uml.MElementEvent mee)
Specified by:
listRoleItemSet in interface ru.novosoft.uml.MElementListener

recovered

public void recovered(ru.novosoft.uml.MElementEvent mee)
Specified by:
recovered in interface ru.novosoft.uml.MElementListener

removed

public void removed(ru.novosoft.uml.MElementEvent mee)
Specified by:
removed in interface ru.novosoft.uml.MElementListener

roleAdded

public void roleAdded(ru.novosoft.uml.MElementEvent mee)
Specified by:
roleAdded in interface ru.novosoft.uml.MElementListener

roleRemoved

public void roleRemoved(ru.novosoft.uml.MElementEvent mee)
Specified by:
roleRemoved in interface ru.novosoft.uml.MElementListener

getDisplayNamespace

protected ru.novosoft.uml.foundation.core.MNamespace getDisplayNamespace()
This method can be overriden in derived Panels where the appropriate namespace for display may not be the same as the namespace of the target

formatElement

public java.lang.String formatElement(ru.novosoft.uml.foundation.core.MModelElement element)
Description copied from interface: UMLUserInterfaceContainer
Formats the specified model element. Typically, deferred to the profile.
Specified by:
formatElement in interface UMLUserInterfaceContainer

formatNamespace

public java.lang.String formatNamespace(ru.novosoft.uml.foundation.core.MNamespace ns)
Description copied from interface: UMLUserInterfaceContainer
Formats the model element as a namespace.
Specified by:
formatNamespace in interface UMLUserInterfaceContainer

formatCollection

public java.lang.String formatCollection(java.util.Iterator iter)
Description copied from interface: UMLUserInterfaceContainer
Formats a collection of model elements. Typically, deferred to the profile.
Specified by:
formatCollection in interface UMLUserInterfaceContainer

navigateTo

public void navigateTo(java.lang.Object element)
Description copied from interface: NavigationListener
Called by a user interface element when a request to navigate to a model element has been received.
Specified by:
navigateTo in interface NavigationListener

open

public void open(java.lang.Object element)
Description copied from interface: NavigationListener
Called by a user interface element when a request to open a model element in a new window has been recieved.
Specified by:
open in interface NavigationListener

navigateBack

public boolean navigateBack(boolean attempt)
Description copied from interface: NavigationListener
Called to navigate to previous selection returns true if navigation performed
Specified by:
navigateBack in interface NavigationListener
Following copied from interface: org.argouml.ui.NavigationListener
Parameters:
attempt - false if navigation accomplished by earlier listener
Returns:
true if navigation performed

navigateBackAction

public void navigateBackAction()

navigateForward

public boolean navigateForward(boolean attempt)
Description copied from interface: NavigationListener
Called to navigate to next selection returns true if navigation performed
Specified by:
navigateForward in interface NavigationListener
Following copied from interface: org.argouml.ui.NavigationListener
Parameters:
attempt - false if navigation accomplished by earlier listener
Returns:
true if navigation performed

navigateForwardAction

public void navigateForwardAction()

isNavigateForwardEnabled

public boolean isNavigateForwardEnabled()
Description copied from interface: NavigationListener
Returns true if this listener has a target for a back navigation. Only one listener needs to return true for the back button to be enabled.
Specified by:
isNavigateForwardEnabled in interface NavigationListener

isNavigateBackEnabled

public boolean isNavigateBackEnabled()
Description copied from interface: NavigationListener
Returns true if this listener has a target for a back navigation. Only one listener needs to return true for the back button to be enabled.
Specified by:
isNavigateBackEnabled in interface NavigationListener

addNavigationListener

public void addNavigationListener(NavigationListener navListener)
Registers a listener for navigation events.
Specified by:
addNavigationListener in interface UMLUserInterfaceContainer

removeNavigationListener

public void removeNavigationListener(NavigationListener navListener)
Description copied from interface: UMLUserInterfaceContainer
Removes a listener for navigation events.
Specified by:
removeNavigationListener in interface UMLUserInterfaceContainer

setNameEventListening

public void setNameEventListening(java.lang.Class[] metaclasses)
Deprecated. since components should register themselves.

Calling this method with an array of metaclasses (for example, MClassifier.class) will result in the prop panel propagating any name changes or removals on any object that on the same event queue as the target that is assignable to one of the metaclasses.

Reworked to use #addThirdPartyEventListening(Object[]), so removing the need for NSUML promiscuous listeners.

Note. Despite the name, the old implementation tried to listen for ownedElement and baseClass events as well as name events. We incorporate all these.

Note Reworked the implementation to use the new UmlModelEventPump mechanism. In the future proppanels should register directly with UmlModelEventPump IF they are really interested in the events themselves. If components on the proppanels are interested, these components should register themselves.

Parameters:
metaclasses - The metaclass array we wish to listen to.

removeElement

public void removeElement()

isRemovableElement

public boolean isRemovableElement()
check whether this element can be deleted. Currently it only checks whether we delete the main model. ArgoUML does not like that.
Since:
0.13.2


ArgoUML (c) 1996-2002
ArgoUML Project Home
ArgoUML Cookbook