net.sf.sdedit.drawable
Class Drawable

java.lang.Object
  extended by net.sf.sdedit.drawable.Drawable
All Implemented Interfaces:
Constants
Direct Known Subclasses:
Cross, ExtensibleDrawable, Figure, Fragment, LabeledBox, SequenceElement, Text

public abstract class Drawable
extends Object
implements Constants

A Drawable object is a representation of a visible component that occurs in a sequence diagram. This representation is not concerned with semantic aspects of the component, it just provides the information and the behaviour that is necessary to display the component.

A draw(Graphics2D) method must be implemented, so a Drawable object is able to draw itself into a Graphics context.

Author:
Markus Strauch

Field Summary
 
Fields inherited from interface net.sf.sdedit.Constants
ACTIVE_LIFELINE_COLOR, ANTI_ALIAS, dashed, DEFAULT_CODE_FONT, DEFAULT_CURSOR, DEFAULT_ENCODING_SCHEME, dotted, emptyStroke, GLOBAL_CONF_FILE, HAND_CURSOR, MOVE_CURSOR, SAVE_AS_FILE_PROPERTY, SAVE_AS_TYPE_PROPERTY, solid, TEST_FREEHEP_CLASSNAME, thick, thick_dashed, THREAD_COLORS
 
Constructor Summary
protected Drawable()
          Creates a new Drawable with the visibility set to true
 
Method Summary
abstract  void computeLayoutInformation()
          This method is called when and if the left and top positions of the drawable components of a sequence diagram are fixed.
 boolean contains(Point point)
           
abstract  void draw(Graphics2D g2d)
          Draws the sequence diagram element into the given Graphics2D context, using the rectangle starting at getTop(), getLeft(), sized getHeight(), getWidth().
protected static void drawMultilineString(Graphics2D g, String[] string, int x, int y, int simpleHeight, int width, boolean bottomOrTop, Color background)
           
 int getBottom()
           
 int getHeight()
           
 int getLeft()
           
 int getRight()
           
 int getTop()
           
 int getWidth()
           
 boolean intersects(Rectangle rectangle)
          Returns true if this drawable component's bounds intersect the rectangle given.
 boolean isVisible()
           
 void setBottom(int bottom)
           
 void setHeight(int height)
           
 void setLeft(int left)
           
 void setRight(int right)
           
 void setTop(int top)
           
 void setVisible(boolean visible)
           
 void setWidth(int width)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Drawable

protected Drawable()
Creates a new Drawable with the visibility set to true

Method Detail

draw

public abstract void draw(Graphics2D g2d)
Draws the sequence diagram element into the given Graphics2D context, using the rectangle starting at getTop(), getLeft(), sized getHeight(), getWidth().

Parameters:
g2d - the Graphics2D context to draw this drawable sequence diagram element into

computeLayoutInformation

public abstract void computeLayoutInformation()
This method is called when and if the left and top positions of the drawable components of a sequence diagram are fixed. Its purpose is to use this information to compute even finer layout information, such as the width of the component.


getTop

public final int getTop()

getLeft

public final int getLeft()

getWidth

public final int getWidth()

getHeight

public final int getHeight()

setHeight

public final void setHeight(int height)

setLeft

public final void setLeft(int left)

setTop

public final void setTop(int top)

setWidth

public final void setWidth(int width)

getBottom

public final int getBottom()

getRight

public final int getRight()

setRight

public final void setRight(int right)

setBottom

public final void setBottom(int bottom)

intersects

public boolean intersects(Rectangle rectangle)
Returns true if this drawable component's bounds intersect the rectangle given.

Parameters:
rectangle - a rectangle specifiying an area of the sequence diagram
Returns:
true if this drawable component's bounds intersect the rectangle

contains

public boolean contains(Point point)

isVisible

public boolean isVisible()
Returns:
the visible

setVisible

public final void setVisible(boolean visible)
Parameters:
visible - the visible to set

drawMultilineString

protected static final void drawMultilineString(Graphics2D g,
                                                String[] string,
                                                int x,
                                                int y,
                                                int simpleHeight,
                                                int width,
                                                boolean bottomOrTop,
                                                Color background)


Copyright © 2011. All Rights Reserved.