public class LinkLayer extends AbstractSystemLayer implements MouseListener, MouseMotionListener
alpha, changeSupport, ganttChart, layerContainer, PROPERTY_ALPHA, PROPERTY_VISIBLE| Constructor and Description |
|---|
LinkLayer(LayerContainer lc)
Constructs a new layer.
|
| Modifier and Type | Method and Description |
|---|---|
protected Rectangle |
calculateBox(ObjectBounds bounds,
boolean source,
boolean left)
Calculates the "hot spots" for the given object bounds (timeline object).
|
protected int |
calculateHandleIconOffset(Icon icon,
boolean source,
boolean left)
Calculates the offset of the given handle icon.
|
protected Icon |
getHandleIcon(ObjectBounds bounds,
boolean source,
boolean left,
boolean focus)
Returns the icon to be shown as a handle depending on various parameters.
|
int |
getHandleIconOffset()
Returns the distance of the handle icon to the timeline object that it is
decorating.
|
Stroke |
getLineStroke()
Returns the stroke used for drawing the linking line.
|
PathCalculator |
getPathCalculator()
Returns the object used for calculating the path that the linking line
will take when it gets drawn.
|
int |
getProximity()
Returns the maximum distance to the timeline object when the linking
points become visible.
|
boolean |
isLinking()
Determines if the layer is currently used for linking two timeline
objects with each other.
|
boolean |
isLinkStartLocation(Point p)
Determines if the given point is a location where a linking operation can
start.
|
boolean |
isVisible()
Determines if the layer is visible or not.
|
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
protected void |
paintHandle(Graphics g,
Rectangle r,
ObjectBounds bounds,
boolean source,
boolean left,
boolean focus)
Performs the actual drawing of a handle icon.
|
protected void |
paintLayer(Graphics g) |
void |
setHandleIconOffset(int handleIconOffset)
Sets the distance of the handle icon to the timeline object that it is
decorating.
|
void |
setLineStroke(Stroke lineStroke)
Sets the stroke used for drawing the linking line.
|
void |
setPathCalculator(PathCalculator calculator)
Sets the object used for calculating the path that the linking line will
take when it gets drawn.
|
void |
setProximity(int proximity)
Sets the maximum distance to the timeline object when the linking points
become visible.
|
addPropertyChangeListener, getAlpha, getDateline, getEventline, getGanttChart, getHeight, getLayerContainer, getLayerPolicyProvider, getModel, getName, getStartRow, getTimeAt, getTimeline, getTimeLocation, getTimeSpanUsed, getToolTipText, getTreeTable, getTreeTablePolicyProvider, getWidth, removePropertyChangeListener, repaint, repaint, repaint, setAlpha, setVisible, tearDownpublic LinkLayer(LayerContainer lc)
lc - the owner of the layerpublic void setLineStroke(Stroke lineStroke)
lineStroke - the strokepublic Stroke getLineStroke()
public void setProximity(int proximity)
proximity - the distance to the timeline objectpublic int getProximity()
public void setPathCalculator(PathCalculator calculator)
calculator - the path calculatorpublic PathCalculator getPathCalculator()
public void setHandleIconOffset(int handleIconOffset)
handleIconOffset - the distance of the icon to the timeline objectpublic int getHandleIconOffset()
protected Icon getHandleIcon(ObjectBounds bounds, boolean source, boolean left, boolean focus)
bounds - the bounds of the timeline object that will be linked (either
as a source or as a target of the new relationship)source - a flag indicating whether the timeline object will be used as
the source or the target of the new relationshipleft - if TRUE then the icon will be shown on the left side of the
timeline objectfocus - if TRUE then the handle will be focused (the mouse cursor is
hovering on top of it)protected int calculateHandleIconOffset(Icon icon, boolean source, boolean left)
setHandleIconOffset(int)), but certain circumstances might
require a more detailed calculation.icon - the handle iconsource - a flag indicating whether the icon will be used as the source
or the target of the new relationshipleft - if TRUE then the icon will be shown on the left side of the
timeline objectpublic boolean isVisible()
isVisible in class AbstractLayerLayerContainer.setLinkingEnabled(boolean)protected void paintLayer(Graphics g)
paintLayer in class AbstractLayerprotected void paintHandle(Graphics g, Rectangle r, ObjectBounds bounds, boolean source, boolean left, boolean focus)
g - the graphics context into which to drawr - the bounds of the handle iconbounds - the bounds of the timeline object that will be decoratedsource - a flag indicating whether the icon will be used as the source
or the target of the new relationshipleft - if TRUE then the icon will be shown on the left side of the
timeline objectfocus - if TRUE then the icon is currently focused (mouse cursor
hovers over it)public boolean isLinking()
public void mouseClicked(MouseEvent e)
mouseClicked in interface MouseListenerpublic void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenerpublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenerpublic boolean isLinkStartLocation(Point p)
p - the point to checkpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenerpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenerpublic void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenerpublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenerprotected Rectangle calculateBox(ObjectBounds bounds, boolean source, boolean left)
bounds - the object bounds of the timeline object for which to perform
the calculationsource - a flag indicating whether we want to calculate a source or a
target hot spotleft - a flag indicating whether we want to calculate the left or the
right hot spotCopyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.