|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.tockit.canvas.CanvasItem
net.sourceforge.toscanaj.view.diagram.LabelView
This class encapsulates all generic label drawing code. The actual classes to use are the AttributeLabelView and the ObjectLabelView which are distinguished by position (above vs. below the node) and default display type (list vs. number).
Nested Class Summary | |
protected static class |
LabelView.DragMode
|
static interface |
LabelView.LabelFactory
|
Field Summary | |
protected static int |
ABOVE
Used when the label should be drawn above the given point. |
protected static int |
BELOW
Used when the label should be drawn below the given point. |
protected static int |
DEFAULT_DISPLAY_LINES
Gives the number of display lines used on a new label. |
protected DiagramView |
diagramView
Store the diagram view that the label belongs to. |
protected int |
displayLines
The current display size in lines. |
protected LabelView.DragMode |
dragMode
|
protected int |
firstItem
The first item displayed in the list. |
protected LabelInfo |
labelInfo
The label information that should be drawn. |
protected float |
lineHeight
The height of a single line in the view. |
protected static int |
MIN_DISPLAY_LINES
Gives the minimum number of display lines possible. |
protected static LabelView.DragMode |
MOVING
|
protected NodeView |
nodeView
|
protected static LabelView.DragMode |
NOT_DRAGGING
|
protected java.util.Vector |
observers
|
protected java.awt.geom.Rectangle2D |
rect
The bounding rectangle for the label itself. |
protected static LabelView.DragMode |
RESIZING
|
protected boolean |
scrollbarShown
|
protected static LabelView.DragMode |
SCROLLING
|
Constructor Summary | |
protected |
LabelView(DiagramView diagramView,
NodeView nodeView,
LabelInfo label)
Creates a view for the given label information. |
Method Summary | |
void |
addObserver(ChangeObserver observer)
|
boolean |
containsPoint(java.awt.geom.Point2D point)
Returns true whenever the point is in the bounding rectangle. |
void |
draw(java.awt.Graphics2D graphics)
Draws the label at the given position in the graphic context. |
java.awt.geom.Rectangle2D |
getCanvasBounds(java.awt.Graphics2D graphics)
|
protected java.awt.Color |
getConnectorColor()
|
protected java.awt.geom.Point2D |
getConnectorEndPosition()
|
abstract java.lang.Object |
getEntryAt(int position)
|
static LabelView.LabelFactory |
getFactory()
|
java.awt.Font |
getFont()
|
int |
getIndexOfPosition(java.awt.geom.Point2D pos)
Calculates which item was hit. |
double |
getLabelHeight()
Return Label height |
double |
getLabelWidth()
Return Label width |
NodeView |
getNodeView()
|
abstract int |
getNumberOfEntries()
|
protected abstract int |
getPlacement()
Returns the placement of the label (above or below the node). |
java.awt.geom.Point2D |
getPosition()
|
protected abstract boolean |
highlightedInFilter()
|
protected abstract boolean |
highlightedInIdeal()
|
protected abstract boolean |
isFaded()
|
boolean |
isVisible()
|
protected void |
notifyObservers()
|
void |
processClickEvent(java.awt.geom.Point2D pos)
Handles scrolling of the items. |
void |
processDragEvent(java.awt.geom.Point2D from,
java.awt.geom.Point2D to,
boolean isDrop)
|
void |
processEvent(org.tockit.events.Event e)
|
void |
setFont(java.awt.Font font)
|
void |
setScrollbarShown(boolean scrollbarShown)
|
void |
startDrag(java.awt.geom.Point2D from,
java.awt.geom.Point2D to)
|
void |
update(java.lang.Object source)
Update label view as label info has change. |
void |
updateBounds(java.awt.Graphics2D graphics)
|
void |
updateEntries()
|
Methods inherited from class org.tockit.canvas.CanvasItem |
hasAutoRaise |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int ABOVE
protected static final int BELOW
protected static final int MIN_DISPLAY_LINES
displayLines
,
Constant Field Valuesprotected static final int DEFAULT_DISPLAY_LINES
displayLines
,
Constant Field Valuesprotected java.awt.geom.Rectangle2D rect
protected LabelInfo labelInfo
protected DiagramView diagramView
protected NodeView nodeView
protected int displayLines
protected int firstItem
protected boolean scrollbarShown
protected float lineHeight
protected java.util.Vector observers
protected LabelView.DragMode dragMode
protected static final LabelView.DragMode NOT_DRAGGING
protected static final LabelView.DragMode RESIZING
protected static final LabelView.DragMode MOVING
protected static final LabelView.DragMode SCROLLING
Constructor Detail |
protected LabelView(DiagramView diagramView, NodeView nodeView, LabelInfo label)
getFactory()
Method Detail |
public static LabelView.LabelFactory getFactory()
public void updateEntries()
public void update(java.lang.Object source)
update
in interface ChangeObserver
public double getLabelWidth()
public double getLabelHeight()
public java.awt.geom.Point2D getPosition()
public boolean isVisible()
public void draw(java.awt.Graphics2D graphics)
public void updateBounds(java.awt.Graphics2D graphics)
protected java.awt.geom.Point2D getConnectorEndPosition()
protected abstract boolean isFaded()
protected java.awt.Color getConnectorColor()
protected abstract int getPlacement()
public boolean containsPoint(java.awt.geom.Point2D point)
public void processDragEvent(java.awt.geom.Point2D from, java.awt.geom.Point2D to, boolean isDrop)
public void startDrag(java.awt.geom.Point2D from, java.awt.geom.Point2D to)
public void processClickEvent(java.awt.geom.Point2D pos)
public java.awt.geom.Rectangle2D getCanvasBounds(java.awt.Graphics2D graphics)
public int getIndexOfPosition(java.awt.geom.Point2D pos)
protected abstract boolean highlightedInIdeal()
protected abstract boolean highlightedInFilter()
public abstract int getNumberOfEntries()
public abstract java.lang.Object getEntryAt(int position)
public void processEvent(org.tockit.events.Event e)
processEvent
in interface org.tockit.events.EventBrokerListener
public void addObserver(ChangeObserver observer)
protected void notifyObservers()
public NodeView getNodeView()
public java.awt.Font getFont()
public void setFont(java.awt.Font font)
public void setScrollbarShown(boolean scrollbarShown)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |