Update of /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer
In directory usw-pr-cvs1:/tmp/cvs-serv2471/jprojecttimer/de/cgarbs/apps/jprojecttimer
Modified Files:
GanttDiagram.java
Log Message:
Cosmetics and JavaDoc
Index: GanttDiagram.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/GanttDiagram.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** GanttDiagram.java 10 Feb 2002 13:26:00 -0000 1.9
--- GanttDiagram.java 2 Apr 2002 15:00:23 -0000 1.10
***************
*** 26,29 ****
--- 26,30 ----
import java.awt.event.MouseEvent;
import javax.swing.JFrame;
+ import java.lang.Math;
***************
*** 31,35 ****
/** @author Christian Garbs <mi...@cg...>
* @author Jochen Luell <jo...@lu...>
! * @author Remi POUJEAUX <pou...@mb...>
* @version $Id$
*/
--- 32,36 ----
/** @author Christian Garbs <mi...@cg...>
* @author Jochen Luell <jo...@lu...>
! * @author Remi Poujeaux <pou...@mb...>
* @version $Id$
*/
***************
*** 78,97 ****
}
!
public void refresh()
{
repaint();
}
!
public void paint(Graphics graph)
{
drawGantt(graph, getSize().width, getSize().height);
}
!
public void drawGantt(Graphics graph, int width, int height)
{
Graphics2D g = (Graphics2D) graph;
TaskList tasks = project.getTaskList();
! int textWidth = 70;
int headerHeight = 30;
int taskYMargin = 7; // top/bottom margin of each task bar
--- 79,101 ----
}
! /** Refreshes the Gantt diagram
! */
public void refresh()
{
repaint();
}
! /** Draws the Gantt diagram full screen
! */
public void paint(Graphics graph)
{
drawGantt(graph, getSize().width, getSize().height);
}
! /** Draws the Gantt diagram with a specified size
! */
public void drawGantt(Graphics graph, int width, int height)
{
Graphics2D g = (Graphics2D) graph;
TaskList tasks = project.getTaskList();
! int textWidth = 0;
int headerHeight = 30;
int taskYMargin = 7; // top/bottom margin of each task bar
***************
*** 108,111 ****
--- 112,122 ----
cols = 1;
}
+ // Calculating textWidth by parsing all tasks texts
+ for (int row = 0; row < tasks.size(); row++) {
+ Task task = (Task) tasks.elementAt(row);
+ textWidth = Math.max (textWidth,
+ g.getFontMetrics().stringWidth(task.getName()));
+ }
+ textWidth = textWidth + 10;
// Headings coloring
g.setColor(Color.yellow);
***************
*** 190,194 ****
}
!
public int print(Graphics g, PageFormat pageFormat, int page)
{
--- 201,206 ----
}
! /** Prints the Gantt Diagram on a printer
! */
public int print(Graphics g, PageFormat pageFormat, int page)
{
|