Extending : Reference : Related Class of Figure customization
  
Related Class of Figure customization
IStateFigure Interface
public void initialize(StateEditPart editPart): It should implement all necessary methods for the figure initialization.
public WrappingLabel getFigureStateIdFigure(): It should return the text inside the figure.
public WrappingLabel getFigureStateTagFigure(): It should return the icon inside the figure.
AbstractStateFigure class
public void initialize(StateEditPart editPart): It creates the layout, the figure dimensions, as well as the contents and the outline figure.
public WrappingLabel getFigureStateIdFigure(): It returns a WrappingLabel object that contains the text (id) in the figure.
public WrappingLabel getFigureStateTagFigure(): It returns a WrappingLabel object that contains the icon (tag) in the figure.
public void setLayoutFigure(): It creates the layout.
StateFigure class
It has a set of methods that should be overridden to provide a different behavior. The most relevant are:
Color getShadowColor(): It returns black color. Override it in case the color of shadow must be different from black.
void paintShadow(Graphics graphics) : Creates a figure shadow. Override it if the figure doesn’t have shadow.
Color getOutlineColor(Graphics g): It calculates the outline color depending if the state has or not input/output mapping. It should be overriden in order to determine and set the color behavior as necessary.
void drawOutline(Graphics g, Translatable t): It displays a rectangular outline shape. It should be overriden to display another outline shape.
void setOutline(): Paints the figure outline by invoking setOutline(true). Override it in case the figure doesn’t need to have an outline.
void drawShape(Graphics g): It draws a rectangular shape. It should be overriden to draw a shape different from rectangular.
Void fillShape(Graphics g): It fills the interior of the shape based on the background color and gradient defined in the <appearance> section of the state configuration file.
void addTagAndId(WrappingLabel tag, WrappingLabel id): It adds first the tag figure (that will contain the icon) and second the id figure (that will contain the state name). It should be overriden to change this behavior (i.e. to add first the id and second the icon in order to locate the icon below the text).
WrappingLabel createStateIdFigure(): It creates the text label in the state figure. Override it in order to change any of its features, such as text or alignment.
WrappingLabel createStateTagFigure(): It creates the icon in the state figure. Override it in order to change any of its features.
void createContents(): It creates two labels inside the figure: the one that contains the icon and the one that contains the label. It invokes addTagAndId(tag, id). It must be overridden to change this behavior (i.e.: to locate icon below the text, invoke addTagAndId(id, tag)).
Go up to
Reference