org.argouml.uml.ui
Class PropPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.argouml.ui.TabSpawnable
                      extended byorg.argouml.uml.ui.PropPanel
All Implemented Interfaces:
Accessible, Cloneable, EventListener, ImageObserver, ru.novosoft.uml.MElementListener, MenuContainer, org.tigris.swidgets.Orientable, Serializable, TabModelTarget, TabTarget, TargetListener, 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 LabelledLayout 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.

The Properties panels for UML Model Elements are structured in an inheritance hierarchy that matches the UML 1.3 metamodel.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  ResourceBundle bundle
           
private  JToolBar buttonPanel
           
private  JPanel captionPanel
           
private  JPanel center
          The metaclass/property pairs for the third party listener (if we have set one up.
private  int lastRow
           
private  EventListenerList listenerList
           
private  Object modelElement
           
private  Vector panels
           
private static Profile profile
           
private  Font smallFont
           
private  Object target
           
private  JLabel titleLabel
           
 
Fields inherited from class org.argouml.ui.TabSpawnable
 
Fields inherited from class javax.swing.JPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
 
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(String title, ImageIcon icon, org.tigris.swidgets.Orientation orientation)
          Construct new PropPanel using LabelledLayout.
PropPanel(String title, org.tigris.swidgets.Orientation orientation)
          Constructs a new Proppanel without an icon.
 
Method Summary
protected  void addButton(Component button)
           
 JLabel addField(String label, Component component)
          Add a component with the specified label.
 JLabel addFieldAfter(String label, Component component, Component afterComponent)
          Add a component with the specified label positioned after another component.
 JLabel addFieldBefore(String label, Component component, Component beforeComponent)
          Add a component with the specified label positioned before another component.
 void addLinkField(String label, JComponent component)
          Deprecated. replaced by according widgets as of version 0.17.1
protected  void addSeperator()
          Add a seperator.
private  void fireTargetAdded(TargetEvent targetEvent)
           
private  void fireTargetRemoved(TargetEvent targetEvent)
           
private  void fireTargetSet(TargetEvent targetEvent)
           
 String formatCollection(Iterator iter)
          Formats a collection of model elements.
 String formatElement(Object element)
          Formats the specified model element.
 String formatNamespace(Object namespace)
          Formats the model element as a namespace.
protected  JToolBar getButtonPanel()
          Deprecated. As of V0.17.1. Reason: Nobody has any business poking around in my Panels. Use addButton(Component) instead.
protected  Object 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.
 Object getModelElement()
           
 Profile getProfile()
           
private  ResourceBundle getResourceBundle()
          TODO: Do we need this?
 Object getTarget()
          get the current target
protected  JLabel getTitleLabel()
           
 boolean isRemovableElement()
          Check whether this element can be deleted.
 void listRoleItemSet(ru.novosoft.uml.MElementEvent mee)
           
 String localize(String key)
          Returns a localized string corresponding to the key.
protected static ImageIcon lookupIcon(String name)
          Look up an icon.
 void propertySet(ru.novosoft.uml.MElementEvent mee)
           
 void recovered(ru.novosoft.uml.MElementEvent mee)
           
 void refresh()
          Refreshes the tab IN TOTAL
private  EventListenerList registrateTargetListeners(Container container)
          Builds a eventlistenerlist of all targetlisteners that are part of this container and its children.
 void removed(ru.novosoft.uml.MElementEvent mee)
           
 void removeElement()
          Remove this element.
 void roleAdded(ru.novosoft.uml.MElementEvent mee)
           
 void roleRemoved(ru.novosoft.uml.MElementEvent mee)
           
 void setNameEventListening(Object[] metaclasses)
          Deprecated. by Jaap 3 Nov 2002 (ArgoUml version unknown - earlier than 0.13.5), replaced by UmlModelEventPump.addModelEventListener( Object , Object). since components should register themselves.
 void setOrientation(org.tigris.swidgets.Orientation orientation)
          Set the orientation of the panel.
 void setTarget(Object t)
          Deprecated. As Of Argouml version 0.13.5, This will change visibility from release 0.16
protected  void setTitleLabel(JLabel theTitleLabel)
           
 boolean shouldBeEnabled(Object t)
          Returns true if the tab should be enabled with the given target
 void targetAdded(TargetEvent e)
          Fired when a target is added to the list of targets.
 void targetRemoved(TargetEvent e)
          Fired when a target is removed from the list of targets
 void targetSet(TargetEvent e)
          Fired when a total new set of targets is set
 
Methods inherited from class org.argouml.ui.TabSpawnable
clone, getOrientation, getTitle, setTitle, spawn
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

target

private Object target

modelElement

private Object modelElement

profile

private static Profile profile

bundle

private ResourceBundle bundle

panels

private Vector panels

lastRow

private int lastRow

listenerList

private EventListenerList listenerList

center

private JPanel center
The metaclass/property pairs for the third party listener (if we have set one up. We use this when creating a new listener on target change.


buttonPanel

private JToolBar buttonPanel

titleLabel

private JLabel titleLabel

captionPanel

private JPanel captionPanel

smallFont

private Font smallFont
Constructor Detail

PropPanel

public PropPanel(String title,
                 ImageIcon icon,
                 org.tigris.swidgets.Orientation orientation)
Construct new PropPanel using LabelledLayout.

Parameters:
icon - The icon to display for the panel
title - The title of the panel
orientation - the orientation

PropPanel

public PropPanel(String title,
                 org.tigris.swidgets.Orientation orientation)
Constructs a new Proppanel without an icon. If there is an icon it's updated at runtime via settarget.

Parameters:
title - the title
orientation - the orientation
Method Detail

setOrientation

public void setOrientation(org.tigris.swidgets.Orientation orientation)
Set the orientation of the panel.

Specified by:
setOrientation in interface org.tigris.swidgets.Orientable
Overrides:
setOrientation in class TabSpawnable
See Also:
Orientable.setOrientation(org.tigris.swidgets.Orientation)

addButton

protected void addButton(Component button)
Parameters:
button - the button to be added to the button panel

addField

public JLabel addField(String label,
                       Component component)
Add a component with the specified label.

Parameters:
label - the label for the component
component - the component
Returns:
the label added

addFieldAfter

public JLabel addFieldAfter(String label,
                            Component component,
                            Component afterComponent)
Add a component with the specified label positioned after another component.

Parameters:
label - the label for the component
component - the component
afterComponent - the component before
Returns:
the newly added label

addFieldBefore

public JLabel addFieldBefore(String label,
                             Component component,
                             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
Returns:
the newly added component

addLinkField

public final void addLinkField(String label,
                               JComponent component)
Deprecated. replaced by according widgets as of version 0.17.1

Adds a component to the fields of the specified panel and sets the background and color to indicate the field is a link.

This method is never used.

Parameters:
label - the required string label
component - Component to be added

localize

public final String localize(String key)
Description copied from interface: UMLUserInterfaceContainer
Returns a localized string corresponding to the key.

Specified by:
localize in interface UMLUserInterfaceContainer
Parameters:
key - key for resource bundle, typically english literal
Returns:
localized string for key based on system settings and configuration file
See Also:
UMLUserInterfaceContainer.localize(java.lang.String)

addSeperator

protected final void addSeperator()
Add a seperator.


getResourceBundle

private ResourceBundle getResourceBundle()
TODO: Do we need this?

Returns:
null

getProfile

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

setTarget

public void setTarget(Object t)
Deprecated. As Of Argouml version 0.13.5, This will change visibility from release 0.16

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

This involves resetting the third party listeners.

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

registrateTargetListeners

private EventListenerList registrateTargetListeners(Container container)
Builds a eventlistenerlist of all targetlisteners that are part of this container and its children.

Parameters:
container - the container to search for targetlisteners
Returns:
an EventListenerList with all TargetListeners on this container and its children.

getTarget

public final Object getTarget()
Description copied from interface: TabTarget
get the current target

Specified by:
getTarget in interface TabTarget
Returns:
the target
See Also:
TabTarget.getTarget()

getModelElement

public final Object getModelElement()
Specified by:
getModelElement in interface UMLUserInterfaceContainer
Returns:
the current target for the container if the target is a MModelElement, otherwise null
See Also:
UMLUserInterfaceContainer.getModelElement()

refresh

public void refresh()
Description copied from interface: TabTarget
Refreshes the tab IN TOTAL

Specified by:
refresh in interface TabTarget
See Also:
TabTarget.refresh()

shouldBeEnabled

public boolean shouldBeEnabled(Object t)
Description copied from interface: TabTarget
Returns true if the tab should be enabled with the given target

Specified by:
shouldBeEnabled in interface TabTarget
Parameters:
t - the given target
Returns:
true if the tab should be enabled
See Also:
TabTarget.shouldBeEnabled(java.lang.Object)

propertySet

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

listRoleItemSet

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

recovered

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

removed

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

roleAdded

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

roleRemoved

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

getDisplayNamespace

protected Object 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.

Returns:
the namespace

formatElement

public String formatElement(Object element)
Description copied from interface: UMLUserInterfaceContainer
Formats the specified model element. Typically, deferred to the profile.

Specified by:
formatElement in interface UMLUserInterfaceContainer
Parameters:
element - the given element
Returns:
the formatted string
See Also:
UMLUserInterfaceContainer.formatElement(java.lang.Object)

formatNamespace

public String formatNamespace(Object namespace)
Description copied from interface: UMLUserInterfaceContainer
Formats the model element as a namespace.

Specified by:
formatNamespace in interface UMLUserInterfaceContainer
Parameters:
namespace - the namespace
Returns:
the formatted string
See Also:
UMLUserInterfaceContainer.formatNamespace(java.lang.Object)

formatCollection

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

Specified by:
formatCollection in interface UMLUserInterfaceContainer
Parameters:
iter - an iterator into the collection of modelelements
Returns:
the formatted string
See Also:
UMLUserInterfaceContainer.formatCollection(java.util.Iterator)

setNameEventListening

public void setNameEventListening(Object[] metaclasses)
Deprecated. by Jaap 3 Nov 2002 (ArgoUml version unknown - earlier than 0.13.5), replaced by UmlModelEventPump.addModelEventListener( Object , Object). 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.

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()
Remove this element.


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.

Returns:
whether this element can be deleted
Since:
0.13.2

targetAdded

public void targetAdded(TargetEvent e)
Description copied from interface: TargetListener
Fired when a target is added to the list of targets.

Specified by:
targetAdded in interface TargetListener
Parameters:
e - The targetevent, name will be TARGET_ADDED
See Also:
TargetListener.targetAdded(TargetEvent)

targetRemoved

public void targetRemoved(TargetEvent e)
Description copied from interface: TargetListener
Fired when a target is removed from the list of targets

Specified by:
targetRemoved in interface TargetListener
Parameters:
e - The targetevent, name will be TARGET_REMOVED
See Also:
TargetListener.targetRemoved(TargetEvent)

targetSet

public void targetSet(TargetEvent e)
Description copied from interface: TargetListener
Fired when a total new set of targets is set

Specified by:
targetSet in interface TargetListener
Parameters:
e - The targetevent, name will be TARGET_SET
See Also:
TargetListener.targetSet(TargetEvent)

fireTargetSet

private void fireTargetSet(TargetEvent targetEvent)

fireTargetAdded

private void fireTargetAdded(TargetEvent targetEvent)

fireTargetRemoved

private void fireTargetRemoved(TargetEvent targetEvent)

setTitleLabel

protected void setTitleLabel(JLabel theTitleLabel)
Parameters:
theTitleLabel - the title of the panel shown at the top

getTitleLabel

protected JLabel getTitleLabel()
Returns:
the title of the panel shown at the top

getButtonPanel

protected JToolBar getButtonPanel()
Deprecated. As of V0.17.1. Reason: Nobody has any business poking around in my Panels. Use addButton(Component) instead.

Returns:
Returns the buttonPanel.

lookupIcon

protected static ImageIcon lookupIcon(String name)
Look up an icon.

Parameters:
name - the resource name.
Returns:
an ImageIcon corresponding to the given resource name


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook