org.argouml.uml.ui
Class TabStyle

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.TabStyle
All Implemented Interfaces:
Accessible, Cloneable, DelayedVChangeListener, EventListener, ImageObserver, MenuContainer, org.tigris.swidgets.Orientable, PropertyChangeListener, Serializable, TabFigTarget, TabTarget, TargetListener

public class TabStyle
extends TabSpawnable
implements TabFigTarget, PropertyChangeListener, DelayedVChangeListener

Provides support for changing the appearance of a diagram element. For each class of a diagram element, the TabStyle class attempts to find an according class of StylePanel which contains the attributes to be modified in terms of style.

The constructor of TabStyle takes an array argument which contains possible base names for these style panels, or by default StylePanel and SP, alternating between these two prefixes and the namespace of the Fig class or org.argouml.ui. With this configuration, the stylepanel for e.g. org.argouml.uml.diagram.static.structure.ui.FigClass, will be looked at in the following places:

It continues to traverse the superclass structure until a matching class has been found, e.g. If a stylepanel had been found, it will be stored in a cache, which can also be initialized in initPanels()

According the decision taken in issue 502, this tab is renamed "Presentation" for the user. And the Presentation tab shall contain presentation options, and no semantic UML properties (which belong inthe "Properties" panel). In contrast, the diagram pop-up menu for a model element may access both presentation options as well as semantic UML properties.

Note also that the semantic properties of a UML model element exist in one copy only but the presentation options exist in one copy per diagram that the model element is showing in. E.g. a class could have attributes hidden in one diagram and showing in another. So, for the user it would be very logical to seperate these 2 kinds of settings on different tabs.

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  JPanel blankPanel
           
private  JPanel lastPanel
           
private  EventListenerList listenerList
           
private static Logger LOG
           
private  Hashtable panels
           
private  boolean shouldBeEnabled
           
private  StylePanel stylePanel
          The stylepanel shown by the tab style.
private  String[] stylePanelNames
           
private  org.tigris.gef.presentation.Fig target
           
 
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
TabStyle()
          construct a default stylepanel with basenames StylePanel and SP, resulting in the lookup order described above.
TabStyle(String tabName, String[] spn)
          The constructor.
 
Method Summary
 void addPanel(Class c, StylePanel s)
          Adds a style panel to the internal list.
private  void addTargetListener(TargetListener listener)
          Adds a listener.
 void delayedVetoableChange(PropertyChangeEvent pce)
           
 StylePanel findPanelFor(Class targetClass)
          Find the stylepanel for a given target class.
private  void fireTargetAdded(TargetEvent targetEvent)
           
private  void fireTargetRemoved(TargetEvent targetEvent)
           
private  void fireTargetSet(TargetEvent targetEvent)
           
protected  String[] getStylePanelNames()
           
 Object getTarget()
          Return the current target for this stylepanel.
protected  void initPanels()
          Initialize the hashtable of pre lookup panels.
 Class panelClassFor(Class targetClass)
          Get the class for the required stylepanel.
 void propertyChange(PropertyChangeEvent pce)
           
 void refresh()
          Refreshes the tab IN TOTAL
private  void removeTargetListener(TargetListener listener)
          Removes a target listener.
 void setTarget(Object t)
          Deprecated. As of ArgoUml version 0.13.5, the visibility of this method will change in the future, replaced by TargetManager.
 boolean shouldBeEnabled(Object targetItem)
          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, setOrientation, 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

target

private org.tigris.gef.presentation.Fig target

shouldBeEnabled

private boolean shouldBeEnabled

blankPanel

private JPanel blankPanel

panels

private Hashtable panels

lastPanel

private JPanel lastPanel

stylePanel

private StylePanel stylePanel
The stylepanel shown by the tab style.


stylePanelNames

private String[] stylePanelNames

listenerList

private EventListenerList listenerList
Constructor Detail

TabStyle

public TabStyle(String tabName,
                String[] spn)
The constructor.

Parameters:
tabName - the name of the tab
spn - style panel names

TabStyle

public TabStyle()
construct a default stylepanel with basenames StylePanel and SP, resulting in the lookup order described above.

Method Detail

initPanels

protected void initPanels()
Initialize the hashtable of pre lookup panels.


addPanel

public void addPanel(Class c,
                     StylePanel s)
Adds a style panel to the internal list. This allows a plugin to add and register a new style panel at run-time. This property style will then be displayed in the details pane whenever an element of the given metaclass is selected.

Parameters:
c - the metaclass whose details show be displayed in the property panel p
s - an instance of the style panel for the metaclass m

setTarget

public void setTarget(Object t)
Deprecated. As of ArgoUml version 0.13.5, the visibility of this method will change in the future, replaced by TargetManager.

Sets the target of the style tab.

Specified by:
setTarget in interface TabTarget
Parameters:
t - is the new target

refresh

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

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

findPanelFor

public StylePanel findPanelFor(Class targetClass)
Find the stylepanel for a given target class.

Parameters:
targetClass - the target class
Returns:
a Stylepanel object or null on error

panelClassFor

public Class panelClassFor(Class targetClass)
Get the class for the required stylepanel.

Parameters:
targetClass - the class of the current seelcted target.
Returns:
the panel class for the class given or null if none available.

getStylePanelNames

protected String[] getStylePanelNames()
Returns:
the style panel names

getTarget

public Object getTarget()
Return the current target for this stylepanel.

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

shouldBeEnabled

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

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

propertyChange

public void propertyChange(PropertyChangeEvent pce)
Specified by:
propertyChange in interface PropertyChangeListener
See Also:
TargetListener.targetAdded(org.argouml.ui.targetmanager.TargetEvent)

delayedVetoableChange

public void delayedVetoableChange(PropertyChangeEvent pce)
Specified by:
delayedVetoableChange in interface DelayedVChangeListener
Parameters:
pce - the event
See Also:
DelayedVChangeListener.delayedVetoableChange(java.beans.PropertyChangeEvent)

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)

addTargetListener

private void addTargetListener(TargetListener listener)
Adds a listener.

Parameters:
listener - the listener to add

removeTargetListener

private void removeTargetListener(TargetListener listener)
Removes a target listener.

Parameters:
listener - the listener to remove

fireTargetSet

private void fireTargetSet(TargetEvent targetEvent)
Parameters:
targetEvent -

fireTargetAdded

private void fireTargetAdded(TargetEvent targetEvent)
Parameters:
targetEvent -

fireTargetRemoved

private void fireTargetRemoved(TargetEvent targetEvent)
Parameters:
targetEvent -


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