|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
kaapo.project.graphics.DCGraphics
kaapo.project.graphics.SolidGraphics
public abstract class SolidGraphics
A general DCGraphics class for solid, auto-resizing elements. Available shape types are rectangle, round rectange, ellipse, circle and no-boundary. The graphics component contains one text section, possibly multi-line.
Nested Class Summary | |
---|---|
static class |
SolidGraphics.BoundaryType
|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected String |
attrname
|
protected SolidGraphics.BoundaryType |
boundaryType
|
protected Shape |
drawShape
|
protected ElementWrapper |
ewrapper
|
protected double |
minMargin
|
protected boolean |
observerEnabled
Used to disable or enable DC observing on demand. |
protected static double |
OUTER_SHAPE_MARGIN
|
protected Shape |
outerShape
|
protected static double |
ROUND_RECTANGLE_ARC_SIZE
|
protected DirectTextArea |
textArea
|
Fields inherited from class kaapo.project.graphics.DCGraphics |
---|
dc, dcw, pm |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
SolidGraphics(DiagramComponent dc,
ElementWrapper ew,
ProjectManager pm,
String attrname,
SolidGraphics.BoundaryType boundaryType)
Constructs the element with default margin. |
|
SolidGraphics(DiagramComponent dc,
ElementWrapper ew,
ProjectManager pm,
String attrname,
SolidGraphics.BoundaryType boundaryType,
double minMargin)
Constructs the element. |
Method Summary | |
---|---|
protected Shape |
buildShape(double x,
double y,
double width,
double height)
Builds the outer boundary shape. |
protected void |
disableObserver()
|
protected void |
enableObserver()
|
Shape |
getOuterBoundary()
Returns the outer boundary (shape) of graphical representation of the element. |
protected Dimension |
minSize(double innerWidth,
double innerHeight)
Calculate minimum size for the element so that the element fully encloses the rectangle given. |
protected void |
paintComponent(Graphics g)
|
protected void |
setWrapperSelected()
|
void |
update(Observable subject,
Object message)
This method is called whenever the observed object is changed. |
void |
updateDCGraphics()
Update the graphical appearance after element properties have been changed. |
Methods inherited from class kaapo.project.graphics.DCGraphics |
---|
calcConnectionIntersectPoint, getConnectionBoundary, getDiagramComponent, getDiagramComponentWrapper, getHotSpots, getProjectManager, removeObserver, updateDCGraphicsLater |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final double ROUND_RECTANGLE_ARC_SIZE
protected static final double OUTER_SHAPE_MARGIN
protected String attrname
protected double minMargin
protected SolidGraphics.BoundaryType boundaryType
protected ElementWrapper ewrapper
protected Shape drawShape
protected Shape outerShape
protected DirectTextArea textArea
protected boolean observerEnabled
Constructor Detail |
---|
public SolidGraphics(DiagramComponent dc, ElementWrapper ew, ProjectManager pm, String attrname, SolidGraphics.BoundaryType boundaryType, double minMargin)
dc
- Associated diagram componentew
- Associated element wrapperpm
- Project Manager that is used to modify the
diagram component attributesattrname
- Name of the DC attribute that is shown
on the element text area.boundaryType
- Boundary type.minMargin
- Minimum margin area between the text
and the boundary, in pixels. In other words, there
is always at least minMargin
pixels from
any point in the text area to the boundary.public SolidGraphics(DiagramComponent dc, ElementWrapper ew, ProjectManager pm, String attrname, SolidGraphics.BoundaryType boundaryType)
Method Detail |
---|
public Shape getOuterBoundary()
DCGraphics
getOuterBoundary
in class DCGraphics
public void updateDCGraphics()
DCGraphics
updateDCGraphics
in class DCGraphics
protected Dimension minSize(double innerWidth, double innerHeight)
innerWidth
- Width of element content (e.g. text),
including margin.innerHeight
- Height of element content (e.g. text),
including margin.
protected Shape buildShape(double x, double y, double width, double height)
protected void paintComponent(Graphics g)
paintComponent
in class JComponent
protected void disableObserver()
protected void enableObserver()
protected void setWrapperSelected()
public void update(Observable subject, Object message)
Observer
It's safe to modify the subject's observer list from update method. It won't affect the current notify round though, but the next.
update
in interface Observer
update
in class DCGraphics
subject
- the subject that fires the updatemessage
- the message delivered to observer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |