eu.beesoft.gantt.chart
Class LabelLayer

java.lang.Object
  extended by eu.beesoft.gantt.chart.Layer
      extended by eu.beesoft.gantt.chart.LabelLayer

public class LabelLayer
extends Layer

Paints text label beside node.


Constructor Summary
LabelLayer()
          Default constructor.
 
Method Summary
 java.awt.Color getColor()
          Returns the text color.
 java.awt.Font getFont()
          Returns the text font.
protected  void paint(java.awt.Graphics g)
          Paints labels for all on-screen visible nodes.
protected  void paintLabel(java.lang.String label, GanttNode node, java.awt.Graphics g)
          Paints label for given node.
 void setColor(java.awt.Color textColor)
          Sets the color used to paint text label.
 void setFont(java.awt.Font font)
          Sets the font used to paint text label.
 
Methods inherited from class eu.beesoft.gantt.chart.Layer
getGantt, getGanttModel, getHeaderHeight, getChartComponent, getNodeAt, getPaintedNodes, getPosition, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelLayer

public LabelLayer()
Default constructor.

Method Detail

getColor

public java.awt.Color getColor()
Returns the text color.

Returns:
the text color

setColor

public void setColor(java.awt.Color textColor)
Sets the color used to paint text label.

Parameters:
textColor - the text color to set

getFont

public java.awt.Font getFont()
Returns the text font.

Returns:
the font

setFont

public void setFont(java.awt.Font font)
Sets the font used to paint text label.

Parameters:
font - the font to set

paint

protected void paint(java.awt.Graphics g)
Paints labels for all on-screen visible nodes. It obtains nodes from method getPaintedNodes().

Then it calls for each node GanttModel.getLabel(TimelineObject) to get label for user object stored in node.

If returned label is not null, it delegates painting to paintLabel(String, GanttNode, Graphics) method, otherwise it does nothing.

Specified by:
paint in class Layer
Parameters:
g - - the graphics context to use for painting

paintLabel

protected void paintLabel(java.lang.String label,
                          GanttNode node,
                          java.awt.Graphics g)
Paints label for given node. In this implementation is label painted on the right from node.

Parameters:
label - - text to paint
node - - node to which label belongs
g - - the graphics context to use for painting