public abstract class AbstractLayer extends Object
IGanttChartModel.getLayers()
,
LayerContainer.getSystemLayer(Class)
,
LayerContainer.getTimelineObjectLayer(com.dlsc.flexgantt.model.gantt.ILayer)
,
LayerContainer.getCustomLayer(com.dlsc.flexgantt.model.gantt.ILayer)
Modifier and Type | Field and Description |
---|---|
protected float |
alpha
An alpha channel value used to control the transparency of the layer.
|
protected PropertyChangeSupport |
changeSupport
A property change support object on which property change event listeners
can be registered and property change events can be fired.
|
protected AbstractGanttChart |
ganttChart
The parent Gantt chart.
|
protected LayerContainer |
layerContainer
The parent container.
|
static String |
PROPERTY_ALPHA
A constant used for property change events that get fired when the
application calls the
setAlpha(float) method. |
static String |
PROPERTY_VISIBLE
A constant used for property change events that get fired when the
application calls the
setVisible(boolean) method. |
Modifier | Constructor and Description |
---|---|
protected |
AbstractLayer(String name,
LayerContainer lc)
Constructs a new layer.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener l)
Adds a property change listener to the layer.
|
float |
getAlpha()
Returns the alpha channel value used by the layer for rendering
operations.
|
Dateline |
getDateline()
Returns the timeline's dateline
|
Eventline |
getEventline()
Returns the timeline's eventline.
|
AbstractGanttChart |
getGanttChart()
Returns the Gantt chart to which the layer belongs.
|
int |
getHeight()
Convenience method to access
JComponent.getHeight() . |
LayerContainer |
getLayerContainer()
Returns the parent container, the layer container.
|
IPolicyProvider |
getLayerPolicyProvider()
Returns the policy provider of the layer container.
|
IGanttChartModel |
getModel()
Returns the Gantt chart model.
|
String |
getName()
Returns the name of the layer.
|
int |
getStartRow()
Returns the start row of the tree table.
|
long |
getTimeAt(int x)
Returns the time at the given location.
|
Timeline |
getTimeline()
Returns the Gantt chart's timeline.
|
int |
getTimeLocation(long time)
Returns the x-coordinate for the given time point.
|
ITimeSpan |
getTimeSpanUsed()
Returns the time span that is used by the layer.
|
String |
getToolTipText(MouseEvent e)
Returns a tooltip text for the given mouse event (mouse location).
|
TreeTable |
getTreeTable()
Returns the tree table that is shown to the left of the layer
(container).
|
IPolicyProvider |
getTreeTablePolicyProvider()
Returns the policy provider of the tree table.
|
int |
getWidth()
Convenience method to access
JComponent.getWidth() . |
boolean |
isVisible()
Determines whether the layer is currently visible or not.
|
protected void |
paintLayer(Graphics g) |
void |
removePropertyChangeListener(PropertyChangeListener l)
Removes a property change listener from the layer.
|
void |
repaint()
Repaints the layer by repainting the layer container, which will result
in all layers been repainted.
|
void |
repaint(int x,
int y,
int width,
int height)
Repaints the given bounds of the layer by repainting the same bounds on
the layer container, which will result in all layers been repainted.
|
void |
repaint(Rectangle r)
Repaints the given bounds of the layer by repainting the same bounds on
the layer container, which will result in all layers been repainted.
|
void |
setAlpha(float alpha)
Sets the alpha channel value used by the layer for rendering operations.
|
void |
setVisible(boolean visible)
Specifies whether the layer is visible or not.
|
void |
tearDown()
Performs tear down operations when the layer is no longer needed
(removing listeners, etc...).
|
public static final String PROPERTY_ALPHA
setAlpha(float)
method.public static final String PROPERTY_VISIBLE
setVisible(boolean)
method.protected LayerContainer layerContainer
protected AbstractGanttChart ganttChart
protected float alpha
setAlpha(float)
protected PropertyChangeSupport changeSupport
protected AbstractLayer(String name, LayerContainer lc)
name
- the layer namelc
- the parent containerpublic void addPropertyChangeListener(PropertyChangeListener l)
l
- the listener that will be addedremovePropertyChangeListener(PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener l)
l
- the listener that will be removedaddPropertyChangeListener(PropertyChangeListener)
public void tearDown()
public ITimeSpan getTimeSpanUsed()
TimeSpan.UNDEFINED
.public String getName()
public LayerContainer getLayerContainer()
public AbstractGanttChart getGanttChart()
public TreeTable getTreeTable()
public int getStartRow()
public IGanttChartModel getModel()
public Timeline getTimeline()
getDateline()
,
getEventline()
public Dateline getDateline()
getTimeline()
,
getEventline()
public Eventline getEventline()
getTimeline()
,
getEventline()
public IPolicyProvider getLayerPolicyProvider()
public IPolicyProvider getTreeTablePolicyProvider()
public long getTimeAt(int x)
x
- the x-coordinate inside the layer (container) for which to
return a time pointDateline.getTimeAt(int)
public int getTimeLocation(long time)
time
- the time point for which to return a coordinateprotected void paintLayer(Graphics g)
g
- public float getAlpha()
TimelineObjectLayer
), the
grid layer (see GridLayer
) and the calendar layer (see
CalendarLayer
).public void setAlpha(float alpha)
PROPERTY_ALPHA
.
Note: not all layers actually use this value. Layers that do use
it are: the timeline object layer (see TimelineObjectLayer
), the
grid layer (see GridLayer
) and the calendar layer (see
CalendarLayer
).alpha
- the alpha channel value that controls the transparency of
objects rendered by the layerpublic boolean isVisible()
setVisible(boolean)
public void setVisible(boolean visible)
visible
- if TRUE the layer will be visibleisVisible()
public String getToolTipText(MouseEvent e)
e
- the mouse event for which to return a tooltip textpublic void repaint()
Component.repaint()
.repaint(Rectangle)
,
repaint(int, int, int, int)
public void repaint(int x, int y, int width, int height)
Component.repaint(int, int, int, int)
.x
- the x-coordinate of the bounds that will be repaintedy
- the y-coordinate of the bounds that will be repaintedwidth
- the width of the bounds that will be repaintedheight
- the height of the bounds that will be repaintedrepaint()
,
repaint(Rectangle)
public void repaint(Rectangle r)
JComponent.repaint(Rectangle)
.r
- the bounds that will be repaintedrepaint()
,
repaint(int, int, int, int)
public int getWidth()
JComponent.getWidth()
.public int getHeight()
JComponent.getHeight()
.Copyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.