JavaGantt 2011.1 API

eu.beesoft.gantt.chart
Class GanttNodeLayer

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

public class GanttNodeLayer
extends Layer

Paints gantt nodes as time-line objects on chart component. Also supports the mouse cursor changes in dependency on the pointed gantt node and moving or dragging of that node.


Constructor Summary
GanttNodeLayer()
          Default constructor.
 
Method Summary
protected  boolean canMove(GanttNode node)
          Returns true if given node can be moved by mouse dragging.
protected  boolean canResize(GanttNode node)
          Returns true if given node can be resized by mouse dragging.
 java.awt.Color getMilestoneBorderColor()
          Returns color used to paint border of a milestone object.
 java.awt.Color getMilestoneInteriorColor()
          Returns color used to paint the interior of a milestone object.
protected  java.util.List<javax.swing.Action> getPopupActions(GanttNode node)
          Returns a list of (popup) actions for given node.
 java.awt.Color getSummaryColor()
          Returns color used to paint summary object.
 java.awt.Color getTaskBorderColor()
          Returns color used to paint the border of a task (non-summary, non-milestone) object.
 java.awt.Color getTaskInteriorColor()
          Returns color used to paint the interior of a task (non-summary, non-milestone) object.
protected  void mouseDragged(java.awt.event.MouseEvent e)
          Overrides mouseDragged() method in Layer to drag (move or resize) the pointed node.
protected  void mouseMoved(java.awt.event.MouseEvent e)
          Overrides mouseMoved() method in Layer to change mouse cursor depending on the pointed node.
protected  void mousePressed(java.awt.event.MouseEvent e)
          Overrides mousePressed() method in Layer to catch click on node in chart component.
protected  void mouseReleased(java.awt.event.MouseEvent e)
          Overrides mouseReleased() method in Layer to process changes in GanttNodes invoked by mouse dragging and to transfer them to the model.
protected  void paint(java.awt.Graphics g)
          Paints all on-screen visible nodes.
protected  void paintMilestone(GanttNode node, java.awt.Graphics g)
          Paints milestone node.
protected  void paintSummary(GanttNode node, java.awt.Graphics g)
          Paints summary node.
protected  void paintTask(GanttNode node, java.awt.Graphics g)
          Paints task (non-summary, non-milestone) node.
 void setMilestoneBorderColor(java.awt.Color milestoneBorderColor)
          Sets the color used to paint border of a milestone object.
 void setMilestoneInteriorColor(java.awt.Color milestoneInteriorColor)
          Sets the color used to paint the interior of a milestone object.
 void setSummaryColor(java.awt.Color summaryColor)
          Sets the color used to paint summary object.
 void setTaskBorderColor(java.awt.Color taskBorderColor)
          Sets the color used to paint the border of a task (non-summary, non-milestone) object.
 void setTaskInteriorColor(java.awt.Color taskInteriorColor)
          Sets the color used to paint the interior of a task (non-summary, non-milestone) object.
 
Methods inherited from class eu.beesoft.gantt.chart.Layer
getGantt, getGanttModel, getHeaderHeight, getChartComponent, getNodeAt, getPaintedNodes, getPosition, isVisible, mouseClicked, mouseEntered, mouseExited, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GanttNodeLayer

public GanttNodeLayer()
Default constructor.

Method Detail

getSummaryColor

public java.awt.Color getSummaryColor()
Returns color used to paint summary object.

Returns:
the summary color

setSummaryColor

public void setSummaryColor(java.awt.Color summaryColor)
Sets the color used to paint summary object.

Parameters:
summaryColor - the summary color to set

getMilestoneBorderColor

public java.awt.Color getMilestoneBorderColor()
Returns color used to paint border of a milestone object.

Returns:
the milestone border color

setMilestoneBorderColor

public void setMilestoneBorderColor(java.awt.Color milestoneBorderColor)
Sets the color used to paint border of a milestone object.

Parameters:
milestoneBorderColor - the milestone border color to set

getMilestoneInteriorColor

public java.awt.Color getMilestoneInteriorColor()
Returns color used to paint the interior of a milestone object.

Returns:
the milestone interior color

setMilestoneInteriorColor

public void setMilestoneInteriorColor(java.awt.Color milestoneInteriorColor)
Sets the color used to paint the interior of a milestone object.

Parameters:
milestoneInteriorColor - the milestone interior color to set

getTaskBorderColor

public java.awt.Color getTaskBorderColor()
Returns color used to paint the border of a task (non-summary, non-milestone) object.

Returns:
the task border color

setTaskBorderColor

public void setTaskBorderColor(java.awt.Color taskBorderColor)
Sets the color used to paint the border of a task (non-summary, non-milestone) object.

Parameters:
taskBorderColor - the task border color to set

getTaskInteriorColor

public java.awt.Color getTaskInteriorColor()
Returns color used to paint the interior of a task (non-summary, non-milestone) object.

Returns:
the task interior color

setTaskInteriorColor

public void setTaskInteriorColor(java.awt.Color taskInteriorColor)
Sets the color used to paint the interior of a task (non-summary, non-milestone) object.

Parameters:
taskInteriorColor - the task interior color to set

paint

protected void paint(java.awt.Graphics g)
Paints all on-screen visible nodes. It obtains nodes from method getPaintedNodes(). Then it checks type of TimelineObject stored as user-object in gantt node and calls one of these methods to paint node: Note, you can obtain the node position and size by method node.getBounds().

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

paintMilestone

protected void paintMilestone(GanttNode node,
                              java.awt.Graphics g)
Paints milestone node.

Parameters:
node - - the node to paint
g - - the graphics context to use for painting

paintSummary

protected void paintSummary(GanttNode node,
                            java.awt.Graphics g)
Paints summary node.

Parameters:
node - - the node to paint
g - - the graphics context to use for painting

paintTask

protected void paintTask(GanttNode node,
                         java.awt.Graphics g)
Paints task (non-summary, non-milestone) node.

Parameters:
node - - the node to paint
g - - the graphics context to use for painting

mousePressed

protected void mousePressed(java.awt.event.MouseEvent e)
Overrides mousePressed() method in Layer to catch click on node in chart component.

If a node is double-clicked, it calls doubleClicked() on JavaGantt.

Simple pressing the left mouse button starts pointed GanttNode moving or resizing.

Right click invokes method getPopupActions(GanttNode). If that method returns non-null list of actions, it displays popup menu for pointed node.

Overrides:
mousePressed in class Layer
Parameters:
e - - mouse event

mouseReleased

protected void mouseReleased(java.awt.event.MouseEvent e)
Overrides mouseReleased() method in Layer to process changes in GanttNodes invoked by mouse dragging and to transfer them to the model.

Overrides:
mouseReleased in class Layer
Parameters:
e - - mouse event

getPopupActions

protected java.util.List<javax.swing.Action> getPopupActions(GanttNode node)
Returns a list of (popup) actions for given node. It invokes JavaGantt.getPopupActions() in this implementation. Override it if you want display different popup for node in treetable and in the chart.

Parameters:
node - - gantt node for which are actions requested
Returns:
list of actions or null if there are no actions

canResize

protected boolean canResize(GanttNode node)
Returns true if given node can be resized by mouse dragging. In this implementation it returns true for non-milestone non-summary timeline object only.

Parameters:
node - - checked gantt node
Returns:
true if node can be resized by mouse dragging

canMove

protected boolean canMove(GanttNode node)
Returns true if given node can be moved by mouse dragging. In this implementation it returns true for non-summary timeline object only.

Parameters:
node - - checked gantt node
Returns:
true if node can be resized by mouse dragging

mouseMoved

protected void mouseMoved(java.awt.event.MouseEvent e)
Overrides mouseMoved() method in Layer to change mouse cursor depending on the pointed node.

Overrides:
mouseMoved in class Layer
Parameters:
e - - mouse event

mouseDragged

protected void mouseDragged(java.awt.event.MouseEvent e)
Overrides mouseDragged() method in Layer to drag (move or resize) the pointed node.

Overrides:
mouseDragged in class Layer
Parameters:
e - - mouse event

JavaGantt 2011.1 API