|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttemplates.diagram.DiagramElement
public abstract class DiagramElement
Common functionality of graphical representations of TemplateModel
elements.
| Field Summary | |
|---|---|
static java.awt.Color |
COLOR_INCONSIST
Color for rendering inconsistent diagram elements. |
static java.awt.Color |
COLOR_NORM
Default color for rendering diagram elements. |
static java.awt.Color |
COLOR_SELECT
Color for rendering selected diagram elements. |
static java.awt.Color |
COLOR_SELECT_INCONSIST
Color for rendering selected inconsistent diagram elements. |
protected static java.awt.Stroke |
FAT_LINE_STROKE
Stroke for rendering thicker lines. |
protected static java.awt.Font |
globalFont
A pointer to the font to be used to render text on the display. |
protected static java.awt.Graphics |
globalFontRenderer
A pointer to the graphical context which will provide font rendering metrics. |
protected boolean |
highlight
Specifies if the diagram element is highlighted. |
protected boolean |
inconsistent
Specifies if the diagram element is inconsistent. |
protected static java.awt.Stroke |
LINE_STROKE
Default stroke style for rendering diagram elements. |
protected static java.awt.Stroke |
MARKER_STROKE
Stroke for rendering selection marquees. |
protected boolean |
selected
Specifies if the diagram element is selected. |
| Constructor Summary | |
|---|---|
DiagramElement()
|
|
| Method Summary | |
|---|---|
abstract boolean |
contains(java.awt.Point p)
Checks if the diagram element contains the given point. |
abstract void |
draw(java.awt.Graphics2D g2d)
Render the diagram element in the given graphical context, disregarding the inconsistency setting. |
abstract void |
draw(java.awt.Graphics2D g2d,
boolean showInconsistency)
Render the diagram element in the given graphical context, according to the choice of differentiating or not inconsistent diagram elements. |
abstract java.awt.Rectangle |
getBounds()
Retrieve the bounds of the diagram element. |
static java.awt.Font |
getGlobalFont()
Retrieve the font to be used to render text on the display. |
static java.awt.FontMetrics |
getGlobalFontMetrics()
Retrieve the font metrics for rendering text on the display. |
static java.awt.Graphics |
getGlobalFontRenderer()
Retrieve the graphical context which provides font rendering metrics. |
abstract boolean |
intersects(java.awt.Rectangle r)
Checks if the given rectangle intersects the diagram element. |
static void |
setGlobalFont(java.awt.Font f)
Set the font to be used to render text on the display. |
static void |
setGlobalFontRenderer(java.awt.Graphics g)
Set the graphical context which will provide font rendering metrics. |
void |
setHighlight(boolean b)
Set if the diagram element should be rendered as highlighted or not. |
void |
setInconsistent(boolean b)
Set if the diagram element should be rendered as inconsistent or not. |
void |
setSelected(boolean b)
Set if the diagram element should be rendered as selected or not. |
abstract void |
translate(java.awt.Point delta)
Translate the diagram element by the given displacement in the x and y direction. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static java.awt.Graphics globalFontRenderer
Needs to be set before creating TemplateDiagrams.
protected static java.awt.Font globalFont
Needs to be set before creating TemplateDiagrams.
public static final java.awt.Color COLOR_NORM
public static final java.awt.Color COLOR_INCONSIST
public static final java.awt.Color COLOR_SELECT
public static final java.awt.Color COLOR_SELECT_INCONSIST
protected static final java.awt.Stroke LINE_STROKE
protected static final java.awt.Stroke FAT_LINE_STROKE
protected static final java.awt.Stroke MARKER_STROKE
protected boolean highlight
protected boolean selected
protected boolean inconsistent
| Constructor Detail |
|---|
public DiagramElement()
| Method Detail |
|---|
public static void setGlobalFontRenderer(java.awt.Graphics g)
Needs to be set before creating TemplateDiagrams.
g - the graphical context which will provide font rendering
metricspublic static java.awt.Graphics getGlobalFontRenderer()
public static java.awt.FontMetrics getGlobalFontMetrics()
globalFontRenderer and globalFont are set;
null otherwisepublic static void setGlobalFont(java.awt.Font f)
Needs to be set before creating TemplateDiagrams.
f - the font to be used to render text on the displaypublic static java.awt.Font getGlobalFont()
public abstract void translate(java.awt.Point delta)
delta - the displacement in the x and y directionpublic void setHighlight(boolean b)
b - true if the diagram element should be rendered as
highlighted; false otherwisepublic void setSelected(boolean b)
b - true if the diagram element should be rendered as
seelcted; false otherwisepublic void setInconsistent(boolean b)
b - true if the diagram element should be rendered as
inconsistent; false otherwisepublic abstract java.awt.Rectangle getBounds()
public abstract void draw(java.awt.Graphics2D g2d)
g2d - the graphical context where the diagram element has to be
rendered
public abstract void draw(java.awt.Graphics2D g2d,
boolean showInconsistency)
g2d - the graphical context where the diagram element has to be
renderedshowInconsistency - choice for rendering inconsistent diagram elements differently
or not; if true, inconsistent diagram elements
have to be rendered differently; iffalse,
inconsistent diagram elements should be rendered as if they
were consistentpublic abstract boolean contains(java.awt.Point p)
With non-rectangular diagram elements, this is different from checking if
the point is contained within the bounds of the element. More
specifically, a point may be contained within the bounds, but this method
may still return false.
p - the point to be checked
true if the diagram element contains the point;
false otherwisepublic abstract boolean intersects(java.awt.Rectangle r)
With non-rectangular diagram elements, this is different from checking if
the rectangle intersects the bounds of the element. More specifically, a
rectangle may intersect the bounds, but this method may still return
false.
r - the rectangle to be checked
true if the rectangle intersects the diagram
element; false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||