de.cau.cs.kieler.karma
Class SwitchableFigure

java.lang.Object
  extended by org.eclipse.draw2d.Figure
      extended by org.eclipse.draw2d.Shape
          extended by de.cau.cs.kieler.karma.SwitchableFigure
All Implemented Interfaces:
IFigure
Direct Known Subclasses:
Entity2EditPart.EntityFigure, Entity3EditPart.EntityFigure, Node2EditPart.NodeFigure, Node4EditPart.NodeFigure, PortEditPart.PortFigure, RegionStateEditPart.StateFigure, StateEditPart.StateFigure, SwitchableCollapseFigure

public class SwitchableFigure
extends Shape

Class for encapsulating the actual drawn figure to avoid inheritance problems. Also has some additional methods for example changing resizeability.

Rating red

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
 
Field Summary
protected  IFigure currentFigure
          The figure that will actually be displayed.
 
Fields inherited from class org.eclipse.draw2d.Shape
lineStyle, lineWidth
 
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
SwitchableFigure()
          The constructor.
 
Method Summary
protected  void fillShape(Graphics graphics)
           
 IFigure getCurrentFigure()
          Getter for the currently displayed figure.
 float[] getLineDash()
           
 int getLineStyle()
           
 int getLineWidth()
           
 float getLineWidthFloat()
           
 boolean getResizeable()
          check if the figure may be be resized.
protected  void outlineShape(Graphics graphics)
           
 void paint(Graphics graphics)
           
 void setBackgroundColor(Color bg)
          
 void setBounds(Rectangle rect)
          
 void setBoundsDirect(Rectangle rect)
          Directly set the bounds of this figure, without further checks.
 void setCurrentFigure(IFigure figure)
          Setter for the currently displayed figure.
 void setFill(boolean fill)
           
 void setForegroundColor(Color fg)
          
 void setLineDash(float[] dash)
           
 void setLineStyle(int style)
           
 void setLineWidth(int w)
           
 void setLineWidthFloat(float value)
           
 void setMaximumSize(Dimension d)
           
 void setMinimumSize(Dimension d)
           
 void setPreferredSize(Dimension d)
           
 void setResizeable(Boolean b)
          set the figure to be resizeable or not.
 void setSize(int w, int h)
           
 
Methods inherited from class org.eclipse.draw2d.Shape
getAlpha, getAntialias, getLineAttributes, getLineCap, getLineDashOffset, getLineJoin, getLineMiterLimit, paintFigure, setAlpha, setAlpha, setAntialias, setAntialias, setFillXOR, setLineAttributes, setLineCap, setLineDashOffset, setLineJoin, setLineMiterLimit, setOutline, setOutlineXOR, setXOR
 
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, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBorder, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setLayoutManager, setLocation, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, 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
 

Field Detail

currentFigure

protected IFigure currentFigure
The figure that will actually be displayed.

Constructor Detail

SwitchableFigure

public SwitchableFigure()
The constructor. Sets default figure.

Method Detail

paint

public void paint(Graphics graphics)
Specified by:
paint in interface IFigure
Overrides:
paint in class Figure

getCurrentFigure

public IFigure getCurrentFigure()
Getter for the currently displayed figure.

Returns:
the current figure

setCurrentFigure

public void setCurrentFigure(IFigure figure)
Setter for the currently displayed figure.

Parameters:
figure - new figure to be displayed

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

setBounds

public void setBounds(Rectangle rect)

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

setBoundsDirect

public void setBoundsDirect(Rectangle rect)
Directly set the bounds of this figure, without further checks.

Parameters:
rect - the new bounds

setMinimumSize

public void setMinimumSize(Dimension d)
Specified by:
setMinimumSize in interface IFigure
Overrides:
setMinimumSize in class Figure

setMaximumSize

public void setMaximumSize(Dimension d)
Specified by:
setMaximumSize in interface IFigure
Overrides:
setMaximumSize in class Figure

setSize

public void setSize(int w,
                    int h)
Specified by:
setSize in interface IFigure
Overrides:
setSize in class Figure

setPreferredSize

public void setPreferredSize(Dimension d)
Specified by:
setPreferredSize in interface IFigure
Overrides:
setPreferredSize in class Figure

fillShape

protected void fillShape(Graphics graphics)
Specified by:
fillShape in class Shape

outlineShape

protected void outlineShape(Graphics graphics)
Specified by:
outlineShape in class Shape

setLineWidth

public void setLineWidth(int w)
Overrides:
setLineWidth in class Shape

getLineWidth

public int getLineWidth()
Overrides:
getLineWidth in class Shape

setLineWidthFloat

public void setLineWidthFloat(float value)
Overrides:
setLineWidthFloat in class Shape

getLineWidthFloat

public float getLineWidthFloat()
Overrides:
getLineWidthFloat in class Shape

setLineStyle

public void setLineStyle(int style)
Overrides:
setLineStyle in class Shape

getLineStyle

public int getLineStyle()
Overrides:
getLineStyle in class Shape

setLineDash

public void setLineDash(float[] dash)
Overrides:
setLineDash in class Shape

getLineDash

public float[] getLineDash()
Overrides:
getLineDash in class Shape

getResizeable

public boolean getResizeable()
check if the figure may be be resized.

Returns:
true if resizeable else false

setResizeable

public void setResizeable(Boolean b)
set the figure to be resizeable or not.

Parameters:
b - false for not resizeable

setFill

public void setFill(boolean fill)
Overrides:
setFill in class Shape