de.cau.cs.kieler.core.ui.figures
Class AttributeAwareSwitchFigure

java.lang.Object
  extended by org.eclipse.draw2d.Figure
      extended by de.cau.cs.kieler.core.ui.figures.AttributeAwareSwitchFigure
All Implemented Interfaces:
IAttributeAwareFigure, IFigure, Adapter
Direct Known Subclasses:
AttributeAwareStateFigure

public abstract class AttributeAwareSwitchFigure
extends Figure
implements IAttributeAwareFigure

An attribute aware figure that switches the displayed figure according to attribute changes.

Rating proposed yellow
(2010-01-26) msp

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure
Figure.FigureIterator, Figure.IdentitySearch
 
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
IFigure.NoInsets
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
Adapter.Internal
 
Field Summary
 
Fields inherited from class org.eclipse.draw2d.Figure
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip
 
Fields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
 
Constructor Summary
AttributeAwareSwitchFigure()
          The constructor.
 
Method Summary
protected  void addConditionalFigure(IFigure figure, ICondition<EObject> condition)
          Adds a figure with associated condition.
 IFigure getCurrentFigure()
          Returns the current figure that is to be drawn.
 Notifier getTarget()
          
 void listenTo(EObject object)
          Listen to changes in attributes of the given model element.
 void notifyChanged(Notification notification)
          Adjust the appearance to the changes reported in the notification.
 void paint(Graphics graphics)
          Paints the figure.
 void setBackgroundColor(Color bg)
          
 void setDefaultFigure(IFigure figure)
          Set the figure that is to be drawn if no condition is fulfilled.
 void setForegroundColor(Color fg)
          
 void setTarget(Notifier newTarget)
          
 
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, paintBorder, paintChildren, paintClientArea, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.draw2d.IFigure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isOpaque, isRequestFocusEnabled, isShowing, isVisible, remove, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBorder, setBounds, setClippingStrategy, setConstraint, setCursor, setEnabled, setFocusTraversable, setFont, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
 
Methods inherited from interface org.eclipse.emf.common.notify.Adapter
isAdapterForType
 

Constructor Detail

AttributeAwareSwitchFigure

public AttributeAwareSwitchFigure()
The constructor.

Method Detail

paint

public void paint(Graphics graphics)
Paints the figure. Instead of painting the figure itself, its currentFigure is painted after its bounds have been adjusted.

Specified by:
paint in interface IFigure
Overrides:
paint in class Figure
Parameters:
graphics - The Graphics object used for painting

setDefaultFigure

public void setDefaultFigure(IFigure figure)
Set the figure that is to be drawn if no condition is fulfilled.

Parameters:
figure - The figure to be drawn if no condition is fulfilled.

getCurrentFigure

public IFigure getCurrentFigure()
Returns the current figure that is to be drawn.

Returns:
The current figure that is to be drawn.

setForegroundColor

public void setForegroundColor(Color fg)

Specified by:
setForegroundColor in interface IFigure
Overrides:
setForegroundColor in class Figure

setBackgroundColor

public void setBackgroundColor(Color bg)

Specified by:
setBackgroundColor in interface IFigure
Overrides:
setBackgroundColor in class Figure

notifyChanged

public void notifyChanged(Notification notification)
Adjust the appearance to the changes reported in the notification.

Specified by:
notifyChanged in interface Adapter
Parameters:
notification - The notification containing the changes made to the model element.

getTarget

public Notifier getTarget()

Specified by:
getTarget in interface Adapter

setTarget

public void setTarget(Notifier newTarget)

Specified by:
setTarget in interface Adapter

listenTo

public void listenTo(EObject object)
Listen to changes in attributes of the given model element.

Specified by:
listenTo in interface IAttributeAwareFigure
Parameters:
object - the model element that is watched

addConditionalFigure

protected void addConditionalFigure(IFigure figure,
                                    ICondition<EObject> condition)
Adds a figure with associated condition.

Parameters:
figure - the figure
condition - the condition