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.AbstractArgoJPanel
                      extended byorg.argouml.uml.ui.PropPanel
All Implemented Interfaces:
Accessible, Cloneable, EventListener, ImageObserver, MenuContainer, org.tigris.swidgets.Orientable, Serializable, TabModelTarget, TabTarget, TargetListener, UMLUserInterfaceContainer
Direct Known Subclasses:
PropPanelDiagram, PropPanelModelElement, TabDocumentation, TabStereotype

public abstract class PropPanel
extends AbstractArgoJPanel
implements TabModelTarget, 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  JToolBar buttonPanel
           
private  EventListenerList listenerList
           
private static Logger LOG
          Logger.
private  Object modelElement
           
private  Font smallFont
           
private  Object target
           
private  JLabel titleLabel
           
 
Fields inherited from class org.argouml.ui.AbstractArgoJPanel
 
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 addAction(Action action)
          Add a button to the toolbar of a property panel using the action to control the behavior of the action.
protected  void addAction(Action action, String tooltip)
          Add a button to the toolbar of a property panel using the action to control the behavior of the action.
protected  void addButton(Component button)
          Deprecated. use addAction instead. Remove 0.20.0
 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.
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  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()
           
 Object getTarget()
          get the current target
protected  JLabel getTitleLabel()
           
 boolean isRemovableElement()
          Check whether this element can be deleted.
protected static ImageIcon lookupIcon(String name)
          Look up an icon.
 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 removeElement()
          Remove this element.
 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.AbstractArgoJPanel
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

LOG

private static final Logger LOG
Logger.


target

private Object target

modelElement

private Object modelElement

listenerList

private EventListenerList listenerList

buttonPanel

private JToolBar buttonPanel

titleLabel

private JLabel titleLabel

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 AbstractArgoJPanel
See Also:
Orientable.setOrientation(org.tigris.swidgets.Orientation)

addButton

protected void addButton(Component button)
Deprecated. use addAction instead. Remove 0.20.0

Parameters:
button - the button to be added to the button panel

addAction

protected void addAction(Action action)
Add a button to the toolbar of a property panel using the action to control the behavior of the action.

Parameters:
action - the action which will be used in the toolbar button.

addAction

protected void addAction(Action action,
                         String tooltip)
Add a button to the toolbar of a property panel using the action to control the behavior of the action.

Parameters:
action - the action which will be used in the toolbar button.
tooltip - the tooltip to set, or null to skip setting of a new tooltip.

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

addSeperator

protected final void addSeperator()
Add a seperator.


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()

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)

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

getProfile

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

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()

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)

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

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-2005ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook