|
From: Remi P. <pno...@us...> - 2002-06-11 14:05:44
|
Update of /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer
In directory usw-pr-cvs1:/tmp/cvs-serv25059/jprojecttimer/de/cgarbs/apps/jprojecttimer
Modified Files:
GanttDiagram.java MainWindow.java ProjectPane.java
Project.java TaskEditDialog.java Task.java TaskListPane.java
TaskList.java TaskListTableModel.java
Added Files:
GanttDesign.java
Log Message:
Beta for version 0.0.7
--- NEW FILE: GanttDesign.java ---
/*
* $Id: GanttDesign.java,v 1.1 2002/06/11 14:05:40 pnovdenx Exp $
*
* 2001,2002 (C) by Remi Poujeaux <pou...@mb...>
*
* Licensed under GNU GPL (see COPYING for details)
*
*/
package de.cgarbs.apps.jprojecttimer;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Date;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
import java.awt.Color;
import java.lang.Integer;
/** @author Remi Poujeaux <pou...@mb...>
* @version $Id: GanttDesign.java,v 1.1 2002/06/11 14:05:40 pnovdenx Exp $
*/
public class GanttDesign
{
// tables describing the Gantt chart settings (colors. sizes...)
Color [] ganttColor = {Color.white,Color.yellow,Color.lightGray,Color.black,
Color.red, Color.green, Color.lightGray};
final static String [] colorTechName = {"backColor","headColor","linesColor","textColor",
"arrowColor", "taskDoneColor", "taskToDoColor"};
final static int BACKCOLOR = 0;
final static int HEADERCOLOR = 1;
final static int LINESCOLOR = 2;
final static int TEXTCOLOR = 3;
final static int ARROWCOLOR = 4;
final static int TASKDONECOLOR = 5;
final static int TASKTODOCOLOR = 6;
final static int NBCOLORS = 7; // number of colors
int headerHeight = 30;
int taskYMargin = 7; // top/bottom margin of each task bar
int rightMargin = 10; // mainly for task with lenght 0
int colStep = 5; // step to write column text
public Color getGanttColor(int i)
{
return ganttColor [i];
}
public void setGanttColor(int i, Color c)
{
ganttColor[i] = c;
}
}
Index: GanttDiagram.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/GanttDiagram.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** GanttDiagram.java 2 Apr 2002 15:00:23 -0000 1.10
--- GanttDiagram.java 11 Jun 2002 14:05:40 -0000 1.11
***************
*** 22,25 ****
--- 22,27 ----
import java.util.Enumeration;
import java.util.Iterator;
+ import java.util.LinkedList;
+
import java.awt.event.MouseAdapter;
import java.awt.event.MouseMotionAdapter;
***************
*** 97,106 ****
Graphics2D g = (Graphics2D) graph;
TaskList tasks = project.getTaskList();
int textWidth = 0;
! int headerHeight = 30;
! int taskYMargin = 7; // top/bottom margin of each task bar
! int rightMargin = 10; // mainly for task with lenght 0
! int colStep = 5;// step to write column text
! g.setColor(Color.white);
g.fillRect(0, 0, width + 1, height + 1);
width = width - rightMargin;
--- 99,109 ----
Graphics2D g = (Graphics2D) graph;
TaskList tasks = project.getTaskList();
+ LinkedList sortedTasks = new LinkedList();
int textWidth = 0;
! int headerHeight = project.ganttDesign.headerHeight;
! int taskYMargin = project.ganttDesign.taskYMargin; // top/bottom margin of each task bar
! int rightMargin = project.ganttDesign.rightMargin; // mainly for task with lenght 0
! int colStep = project.ganttDesign.colStep; // step to write column text
! g.setColor(project.getGanttColor(GanttDesign.BACKCOLOR));
g.fillRect(0, 0, width + 1, height + 1);
width = width - rightMargin;
***************
*** 112,115 ****
--- 115,157 ----
cols = 1;
}
+ // Sorting the tasks by WBS (quick and dirty...)
+ sortedTasks.add ((Task)tasks.elementAt(0));
+ int j,insertPos=0; // index to lookup in already sorted tasks
+ for (int row = 1; row < tasks.size();row++)
+ {
+ Task task = (Task) tasks.elementAt(row);
+ if (sortedTasks.size() == 1)
+ {
+ if (task.getWBS().compareTo(((Task) sortedTasks.get(0)).getWBS()) <0)
+ {
+ insertPos=0;
+ }
+ else
+ {
+ insertPos=1;
+ }
+ }
+ else
+ {
+ for (j = 0; j <= sortedTasks.size();j++)
+ {
+ if (j == sortedTasks.size())
+ {
+ insertPos = j;
+ }
+ else
+ {
+ if (task.getWBS().compareTo(((Task) sortedTasks.get(j)).getWBS()) < 0)
+ {
+ insertPos = j;
+ j=sortedTasks.size();
+ }
+ }
+ }
+ }
+ sortedTasks.add(insertPos,task);
+ }
+
+
// Calculating textWidth by parsing all tasks texts
for (int row = 0; row < tasks.size(); row++) {
***************
*** 120,128 ****
textWidth = textWidth + 10;
// Headings coloring
! g.setColor(Color.yellow);
g.fillRect(0,0,textWidth,height);
g.fillRect(0,0,width+rightMargin,headerHeight);
// Header
! g.setColor(Color.black);
String colNumber = "1";
int colNumberMetric = g.getFontMetrics().stringWidth( colNumber );
--- 162,170 ----
textWidth = textWidth + 10;
// Headings coloring
! g.setColor(project.getGanttColor(GanttDesign.HEADERCOLOR));
g.fillRect(0,0,textWidth,height);
g.fillRect(0,0,width+rightMargin,headerHeight);
// Header
! g.setColor(project.getGanttColor(GanttDesign.TEXTCOLOR));
String colNumber = "1";
int colNumberMetric = g.getFontMetrics().stringWidth( colNumber );
***************
*** 136,140 ****
int rowHeight = (height - headerHeight)/ tasks.size();
// Horizontal lines to separate tasks
! g.setColor(Color.lightGray);
for (int row = 0; row < tasks.size(); row++) {
g.drawLine(0,row*rowHeight + headerHeight,width+rightMargin,row*rowHeight + headerHeight);
--- 178,182 ----
int rowHeight = (height - headerHeight)/ tasks.size();
// Horizontal lines to separate tasks
! g.setColor(project.getGanttColor(GanttDesign.LINESCOLOR));
for (int row = 0; row < tasks.size(); row++) {
g.drawLine(0,row*rowHeight + headerHeight,width+rightMargin,row*rowHeight + headerHeight);
***************
*** 154,173 ****
}
// Links between tasks
! g.setColor(Color.red);
for (int row = 0; row < tasks.size(); row++) {
! Task task = (Task) tasks.elementAt(row);
for (Iterator i = task.getDependencies().iterator(); i.hasNext();) {
Task prevTask = (Task) i.next();
! int prevRow = tasks.indexOf(prevTask);
int startX = textWidth + task.getStart() * ((width - textWidth) / cols);
int endX = textWidth + (prevTask.getStart()+prevTask.getLength()) * ((width - textWidth) / cols);
! int startY = row*rowHeight + headerHeight + taskYMargin;
! int endY = prevRow*rowHeight + headerHeight + taskYMargin + rowHeight/2;
! int midY;
if (row>prevRow){ // under its predecessor
midY = (prevRow+1)*rowHeight + headerHeight;
}
else { // above its predecessor
midY = prevRow*rowHeight + headerHeight;
}
g.drawLine (startX, startY,startX,midY);
--- 196,216 ----
}
// Links between tasks
! g.setColor(project.getGanttColor(GanttDesign.ARROWCOLOR));
for (int row = 0; row < tasks.size(); row++) {
! Task task = (Task) sortedTasks.get(row);
for (Iterator i = task.getDependencies().iterator(); i.hasNext();) {
Task prevTask = (Task) i.next();
! int prevRow = sortedTasks.indexOf(prevTask);
int startX = textWidth + task.getStart() * ((width - textWidth) / cols);
int endX = textWidth + (prevTask.getStart()+prevTask.getLength()) * ((width - textWidth) / cols);
! int endY = prevRow*rowHeight + headerHeight + rowHeight/2;
! int startY,midY;
if (row>prevRow){ // under its predecessor
midY = (prevRow+1)*rowHeight + headerHeight;
+ startY = row*rowHeight + headerHeight + taskYMargin;
}
else { // above its predecessor
midY = prevRow*rowHeight + headerHeight;
+ startY = (row+1)*rowHeight + headerHeight - taskYMargin;
}
g.drawLine (startX, startY,startX,midY);
***************
*** 177,186 ****
int xPoints[] = new int[3];
int yPoints[] = new int[3];
! xPoints[0] = startX;
! yPoints[0] = startY;
! xPoints[1] = xPoints[0] -4;
! yPoints[1] = yPoints[0] -4;
! xPoints[2] = xPoints[0] +5;
! yPoints[2] = yPoints[0] -4;
g.fillPolygon(xPoints,yPoints,3);
}
--- 220,239 ----
int xPoints[] = new int[3];
int yPoints[] = new int[3];
! if (row>prevRow){ // under its predecessor
! xPoints[0] = startX;
! yPoints[0] = startY;
! xPoints[1] = xPoints[0] -5;
! yPoints[1] = yPoints[0] -5;
! xPoints[2] = xPoints[0] +6;
! yPoints[2] = yPoints[0] -5;
! }
! else { // above its predecessor
! xPoints[0] = startX;
! yPoints[0] = startY;
! xPoints[1] = xPoints[0] +6;
! yPoints[1] = yPoints[0] +6;
! xPoints[2] = xPoints[0] -7;
! yPoints[2] = yPoints[0] +6;
! }
g.fillPolygon(xPoints,yPoints,3);
}
***************
*** 188,199 ****
// Tasks
for (int row = 0; row < tasks.size(); row++) {
! ((Task) tasks.elementAt(row)).paint(g,
0,
width,
row * rowHeight + headerHeight,
rowHeight,
cols,
! textWidth,
! taskYMargin
);
}
--- 241,253 ----
// Tasks
for (int row = 0; row < tasks.size(); row++) {
! ((Task) sortedTasks.get(row)).paint(g,
0,
width,
row * rowHeight + headerHeight,
+ project.ganttDesign,
rowHeight,
cols,
! textWidth
! // taskYMargin
);
}
Index: MainWindow.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/MainWindow.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** MainWindow.java 25 Jan 2002 20:41:15 -0000 1.6
--- MainWindow.java 11 Jun 2002 14:05:40 -0000 1.7
***************
*** 29,32 ****
--- 29,35 ----
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
+ import javax.swing.ImageIcon;
+
+
/** @author Christian Garbs <mi...@cg...>
***************
*** 204,207 ****
--- 207,211 ----
try {
//project.writeToStream(new PrintStream(new FileOutputStream(project.getFile())));
+ //project.setName(pp.name.getText());
project.writeToXML(new PrintStream(new FileOutputStream(project.getFile())));
project.hasBeenSaved();
***************
*** 247,250 ****
--- 251,259 ----
public void performAbout()
{
+ JOptionPane.showMessageDialog(null,
+ "JProjectTimer V0.0.7", "JProjectTimer",
+ JOptionPane.INFORMATION_MESSAGE,
+ new ImageIcon("images/jptbmp.gif","LOGO"));
+
}
}
Index: ProjectPane.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/ProjectPane.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ProjectPane.java 25 Jan 2002 20:41:15 -0000 1.2
--- ProjectPane.java 11 Jun 2002 14:05:40 -0000 1.3
***************
*** 10,29 ****
package de.cgarbs.apps.jprojecttimer;
import javax.swing.JPanel;
/** @author Christian Garbs <mi...@cg...>
* @version $Id$
*/
! public class ProjectPane extends JPanel
{
Project project;
!
public ProjectPane(Project project)
{
! this.project = project;
}
public void refresh()
{
}
}
--- 10,131 ----
package de.cgarbs.apps.jprojecttimer;
+ import de.cgarbs.util.Resource;
+
import javax.swing.JPanel;
+ import javax.swing.JButton;
+ import javax.swing.event.*;
+ import javax.swing.JTextField;
+ import javax.swing.JLabel;
+ import java.awt.GridBagConstraints;
+ import java.awt.GridBagLayout;
+ import java.awt.event.*;
+ import java.awt.*;
+ import javax.swing.*;
+
/** @author Christian Garbs <mi...@cg...>
* @version $Id$
*/
! public class ProjectPane extends JPanel implements FocusListener, ActionListener
{
Project project;
! JTextField name, author;
! JButton [] colorButton = new JButton[GanttDesign.NBCOLORS];
! JLabel [] colorLabel = new JLabel[GanttDesign.NBCOLORS];
public ProjectPane(Project project)
{
! GridBagLayout gridbag = new GridBagLayout();
! this.setLayout(gridbag);
! GridBagConstraints constraints = new GridBagConstraints();
! this.project = project;
!
! buildConstraints(constraints, 0, 0, 1, 1, 10, 40);
! constraints.fill = GridBagConstraints.NONE;
! constraints.anchor = GridBagConstraints.EAST;
! JLabel label1 = new JLabel(Resource.get("projectName")+": ");
! gridbag.setConstraints(label1, constraints);
! this.add(label1);
!
! buildConstraints(constraints, 0, 1, 1, 1, 10, 40);
! constraints.fill = GridBagConstraints.NONE;
! constraints.anchor = GridBagConstraints.EAST;
! JLabel label2 = new JLabel(Resource.get("author")+": ");
! gridbag.setConstraints(label2, constraints);
! this.add(label2);
!
! buildConstraints(constraints, 1, 0, 1, 1, 90, 0);
! constraints.fill = GridBagConstraints.HORIZONTAL;
! name = new JTextField(project.getName());
! gridbag.setConstraints(name, constraints);
! name.addFocusListener(this);
! this.add(name);
!
! buildConstraints(constraints, 1, 1, 1, 1, 90, 0);
! constraints.fill = GridBagConstraints.HORIZONTAL;
! author = new JTextField(project.getAuthor());
! gridbag.setConstraints(author, constraints);
! author.addFocusListener(this);
! this.add(author);
!
! for (int i = 0; i < GanttDesign.NBCOLORS; i++)
! {
! buildConstraints(constraints, 0, i+2,1, 1, 10,40);
! constraints.fill = GridBagConstraints.HORIZONTAL;
! constraints.anchor = GridBagConstraints.EAST;
! colorButton[i] = new JButton (Resource.get(GanttDesign.colorTechName[i]));
! colorButton[i].setActionCommand(String.valueOf(i));
! colorButton[i].addActionListener(this);
! colorButton[i].setForeground(Color.black);
!
! gridbag.setConstraints(colorButton[i], constraints);
! this.add(colorButton[i]);
!
! buildConstraints(constraints, 1, i+2,1, 1, 10,40);
! constraints.fill = GridBagConstraints.NONE;
! constraints.anchor = GridBagConstraints.WEST;
! colorLabel[i] = new JLabel (" ");// to have a colored square...
! colorLabel[i].setOpaque (true);
! colorLabel[i].setBackground(project.getGanttColor(i));
! colorLabel[i].setBorder(BorderFactory.createLineBorder(Color.black));
!
! gridbag.setConstraints(colorLabel[i], constraints);
! this.add(colorLabel[i]);
!
! }
}
public void refresh()
{
+ }
+ void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx, int wy)
+ {
+ gbc.gridx = gx;
+ gbc.gridy = gy;
+ gbc.gridwidth = gw;
+ gbc.gridheight = gh;
+ gbc.weightx = wx;
+ gbc.weighty = wy;
+ }
+
+ public void focusLost(FocusEvent e)
+ {
+ project.setName(name.getText());
+ project.setAuthor(author.getText());
+ }
+ public void focusGained(FocusEvent e)
+ {
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ int i = Integer.parseInt(e.getActionCommand());
+ Color col = JColorChooser.showDialog(this,GanttDesign.colorTechName[i],project.getGanttColor(i));
+ if (col != null)
+ {
+ project.setGanttColor (i, col);
+ colorLabel[i].setBackground(col);
+
+ }
+
}
}
Index: Project.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/Project.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Project.java 25 Jan 2002 20:41:15 -0000 1.4
--- Project.java 11 Jun 2002 14:05:40 -0000 1.5
***************
*** 20,23 ****
--- 20,25 ----
import org.jdom.input.*;
import org.jdom.output.*;
+ import java.awt.Color;
+ import java.lang.Integer;
/** @author Christian Garbs <mi...@cg...>
***************
*** 30,33 ****
--- 32,39 ----
String name;
+ String author;
+
+ GanttDesign ganttDesign = new GanttDesign();
+
int timeScale;
boolean anchored;
***************
*** 91,95 ****
--- 97,135 ----
this.file = file;
}
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ needsToBeSaved = true;
+
+ }
+ public String getAuthor()
+ {
+ return author;
+ }
+
+ public void setAuthor(String author)
+ {
+ this.author = author;
+ needsToBeSaved = true;
+ }
+ public Color getGanttColor(int i)
+ {
+ return ganttDesign.ganttColor [i];
+ }
+
+ public void setGanttColor(int i, Color c)
+ {
+ ganttDesign.ganttColor[i] = c;
+ needsToBeSaved = true;
+
+ }
+
public boolean needsToBeSaved()
{
***************
*** 154,157 ****
--- 194,205 ----
{
name = root.getChild("name").getText();
+ author = root.getChild("author").getText();
+ for (int i = 0; i < GanttDesign.NBCOLORS ; i++)
+ {
+ ganttDesign.ganttColor[i] = new Color (Integer
+ .parseInt(root.getChild(GanttDesign.colorTechName[i]).getText()));
+ }
+ //
+
timeScale =
Integer.parseInt(root.getChild("timeScale")
***************
*** 175,179 ****
else
System.err.println(
! "File not readable. Check input format for XML and prject type");
}
--- 223,227 ----
else
System.err.println(
! "File not readable. Check input format for XML and project type");
}
***************
*** 190,193 ****
--- 238,246 ----
root.addContent(new Element("name").addContent(name));
+ root.addContent(new Element("author").addContent(author));
+ for (int i = 0;i <GanttDesign.NBCOLORS;i++)
+ {
+ root.addContent(new Element(GanttDesign.colorTechName[i]).addContent(ganttDesign.ganttColor[i].getRGB()+""));
+ }
root.addContent(new Element("timeScale").addContent(timeScale + ""));
root.addContent(new Element("anchored").addContent(anchored + ""));
Index: TaskEditDialog.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/TaskEditDialog.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TaskEditDialog.java 25 Jan 2002 20:41:15 -0000 1.5
--- TaskEditDialog.java 11 Jun 2002 14:05:40 -0000 1.6
***************
*** 37,41 ****
Task t;
TaskList tasks;
! JTextField name, length, completion;
JList list;
--- 37,41 ----
Task t;
TaskList tasks;
! JTextField name, WBS, length, completion;
JList list;
***************
*** 95,103 ****
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
JLabel label2 = new JLabel(" "+Resource.get("duration")+": ");
gridbag.setConstraints(label2, constraints);
panel.add(label2);
! buildConstraints(constraints, 0, 2, 1, 1, 10, 40);
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.NORTHEAST;
--- 95,110 ----
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
+ JLabel label5 = new JLabel(" WBS: ");
+ gridbag.setConstraints(label5, constraints);
+ panel.add(label5);
+
+ buildConstraints(constraints, 0, 2, 1, 1, 10, 40);
+ constraints.fill = GridBagConstraints.NONE;
+ constraints.anchor = GridBagConstraints.EAST;
JLabel label2 = new JLabel(" "+Resource.get("duration")+": ");
gridbag.setConstraints(label2, constraints);
panel.add(label2);
! buildConstraints(constraints, 0, 3, 1, 1, 10, 40);
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.NORTHEAST;
***************
*** 106,110 ****
panel.add(label3);
! buildConstraints(constraints, 0, 3, 1, 1, 10, 40);
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.NORTHEAST;
--- 113,117 ----
panel.add(label3);
! buildConstraints(constraints, 0, 4, 1, 1, 10, 40);
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.NORTHEAST;
***************
*** 122,130 ****
buildConstraints(constraints, 1, 1, 1, 1, 90, 0);
constraints.fill = GridBagConstraints.HORIZONTAL;
length = new JTextField(Integer.toString(t.getLength()));
gridbag.setConstraints(length, constraints);
panel.add(length);
! buildConstraints(constraints, 1, 2, 1, 1, 90, 0);
constraints.fill = GridBagConstraints.HORIZONTAL;
completion = new JTextField(Integer.toString(t.getCompletion()));
--- 129,143 ----
buildConstraints(constraints, 1, 1, 1, 1, 90, 0);
constraints.fill = GridBagConstraints.HORIZONTAL;
+ WBS = new JTextField(t.getWBS());
+ gridbag.setConstraints(WBS, constraints);
+ panel.add(WBS);
+
+ buildConstraints(constraints, 1, 2, 1, 1, 90, 0);
+ constraints.fill = GridBagConstraints.HORIZONTAL;
length = new JTextField(Integer.toString(t.getLength()));
gridbag.setConstraints(length, constraints);
panel.add(length);
! buildConstraints(constraints, 1, 3, 1, 1, 90, 0);
constraints.fill = GridBagConstraints.HORIZONTAL;
completion = new JTextField(Integer.toString(t.getCompletion()));
***************
*** 133,137 ****
// Listbox
! buildConstraints(constraints, 1, 3, 1, 1, 90, 0);
constraints.fill = GridBagConstraints.HORIZONTAL;
JScrollPane listScrollPane = new JScrollPane(list);
--- 146,150 ----
// Listbox
! buildConstraints(constraints, 1, 4, 1, 1, 90, 0);
constraints.fill = GridBagConstraints.HORIZONTAL;
JScrollPane listScrollPane = new JScrollPane(list);
***************
*** 152,156 ****
buttons.add(cancel);
! buildConstraints(constraints, 0, 4, 2, 1, 10, 40);
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.CENTER;
--- 165,169 ----
buttons.add(cancel);
! buildConstraints(constraints, 0, 5, 2, 1, 10, 40);
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.CENTER;
***************
*** 187,191 ****
}
t.setName(name.getText());
!
int[] indices = list.getSelectedIndices();
--- 200,204 ----
}
t.setName(name.getText());
! t.setWBS(WBS.getText());
int[] indices = list.getSelectedIndices();
Index: Task.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/Task.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Task.java 10 Feb 2002 13:26:00 -0000 1.7
--- Task.java 11 Jun 2002 14:05:40 -0000 1.8
***************
*** 51,54 ****
--- 51,59 ----
private String name = " ";
+ /** This is a string containing the Work Breakdown Structure (WBS)
+ */
+
+ private String WBS = " ";
+
/** This is a list of Tasks that must be finished before this task can start.
*/
***************
*** 90,93 ****
--- 95,109 ----
needsToBeSaved = true;
}
+
+ public Task(String name, String WBS, int length, int completion, TaskList dependencies)
+ {
+ setName(name);
+ setWBS(WBS);
+ setLength(length);
+ setCompletion(completion);
+ setDependencies(dependencies);
+ needsToBeSaved = true;
+ }
+
/** Tags this task as dirty (meaning it's contents have changed and it has to be recalculated).
***************
*** 162,165 ****
--- 178,189 ----
return name;
}
+ /** Returns the WBS of this task.
+ *
+ * @return WBS of this task
+ */
+ public String getWBS()
+ {
+ return WBS;
+ }
/** Returns a list of all tasks that have to be finished before this task can begin.
***************
*** 181,184 ****
--- 205,217 ----
needsToBeSaved = true;
}
+ /** Changes the WBS of this task.
+ *
+ * @param WBS New WBS of task
+ */
+ public void setWBS(String WBS)
+ {
+ this.WBS = WBS;
+ needsToBeSaved = true;
+ }
/** Changes the duration of this task.
***************
*** 288,296 ****
/** */
! public void paint(Graphics g, int x, int width, int y, int height, int cols, int textWidth, int taskYMargin)
{
!
// Text
! g.setColor(Color.black);
g.drawString(getName(), x+5, y+height/2);
--- 321,330 ----
/** */
! public void paint(Graphics g, int x, int width, int y, GanttDesign ganttDesign, int height, int cols, int textWidth)
{
! int taskYMargin = ganttDesign.taskYMargin;
// Text
! g.setColor(ganttDesign.ganttColor[GanttDesign.TEXTCOLOR]);
! // g.setColor(Color.black);
g.drawString(getName(), x+5, y+height/2);
***************
*** 308,312 ****
if (getLength() > 0){
! g.setColor(Color.lightGray);
g.fillRect(taskX,
taskY,
--- 342,346 ----
if (getLength() > 0){
! g.setColor(ganttDesign.ganttColor[GanttDesign.TASKTODOCOLOR]);
g.fillRect(taskX,
taskY,
***************
*** 315,319 ****
);
if (completion > 0) {
! g.setColor(Color.green);
g.fillRect(taskX,
taskY,
--- 349,353 ----
);
if (completion > 0) {
! g.setColor(ganttDesign.ganttColor[GanttDesign.TASKDONECOLOR]);
g.fillRect(taskX,
taskY,
***************
*** 322,326 ****
);
}
! g.setColor(Color.black);
g.drawRect(taskX,
taskY,
--- 356,360 ----
);
}
! g.setColor(Color.black); // task bar outline is always black
g.drawRect(taskX,
taskY,
***************
*** 344,352 ****
yPoints[2] = yPoints[0] + taskHeight-1;
if (completion==0){
! g.setColor(Color.lightGray);
}
else{
! g.setColor(Color.green);
}
g.fillPolygon(xPoints,yPoints,4);
--- 378,386 ----
yPoints[2] = yPoints[0] + taskHeight-1;
if (completion==0){
! g.setColor(ganttDesign.ganttColor[GanttDesign.TASKTODOCOLOR]);
}
else{
! g.setColor(ganttDesign.ganttColor[GanttDesign.TASKDONECOLOR]);
}
g.fillPolygon(xPoints,yPoints,4);
Index: TaskListPane.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/TaskListPane.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** TaskListPane.java 4 Feb 2002 22:53:53 -0000 1.8
--- TaskListPane.java 11 Jun 2002 14:05:40 -0000 1.9
***************
*** 75,81 ****
table.getColumnModel().getColumn(0).setPreferredWidth(50);
table.getColumnModel().getColumn(1).setPreferredWidth(250);
! table.getColumnModel().getColumn(2).setPreferredWidth(50);
! table.getColumnModel().getColumn(3).setPreferredWidth(150);
! table.getColumnModel().getColumn(4).setPreferredWidth(35);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
--- 75,82 ----
table.getColumnModel().getColumn(0).setPreferredWidth(50);
table.getColumnModel().getColumn(1).setPreferredWidth(250);
! table.getColumnModel().getColumn(2).setPreferredWidth(150);
! table.getColumnModel().getColumn(3).setPreferredWidth(50);
! table.getColumnModel().getColumn(4).setPreferredWidth(150);
! table.getColumnModel().getColumn(5).setPreferredWidth(35);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
Index: TaskList.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/TaskList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TaskList.java 25 Jan 2002 20:41:15 -0000 1.4
--- TaskList.java 11 Jun 2002 14:05:40 -0000 1.5
***************
*** 239,242 ****
--- 239,244 ----
Integer.parseInt(taskElement.getChildText("id"));
String name = taskElement.getChildText("name");
+ String WBS = taskElement.getChildText("WBS");
+
int length =
Integer.parseInt(taskElement.getChildText("length"));
***************
*** 244,248 ****
Integer.parseInt(taskElement.getChildText("completion"));
! addElement(new Task(name, length, completion,
new TaskList()));
--- 246,250 ----
Integer.parseInt(taskElement.getChildText("completion"));
! addElement(new Task(name, WBS, length, completion,
new TaskList()));
***************
*** 315,318 ****
--- 317,324 ----
.addContent(new Element("name")
.addContent(aTask.getName() + ""));
+ taskElement
+ .addContent(new Element("WBS")
+ .addContent(aTask.getWBS() + ""));
+
taskElement
.addContent(new Element("completion")
Index: TaskListTableModel.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/TaskListTableModel.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** TaskListTableModel.java 25 Jan 2002 20:41:15 -0000 1.3
--- TaskListTableModel.java 11 Jun 2002 14:05:40 -0000 1.4
***************
*** 24,27 ****
--- 24,28 ----
Resource.get("no."),
Resource.get("task"),
+ "WBS",
Resource.get("duration"),
Resource.get("predecessors"),
***************
*** 60,65 ****
return ((Task) tasks.elementAt(row)).getName();
case 2:
! return new Integer(((Task) tasks.elementAt(row)).getLength());
case 3:
String s = null;
for (Enumeration e = ((Task) tasks.elementAt(row)).getDependencies().elements(); e.hasMoreElements(); ) {
--- 61,68 ----
return ((Task) tasks.elementAt(row)).getName();
case 2:
! return ((Task) tasks.elementAt(row)).getWBS();
case 3:
+ return new Integer(((Task) tasks.elementAt(row)).getLength());
+ case 4:
String s = null;
for (Enumeration e = ((Task) tasks.elementAt(row)).getDependencies().elements(); e.hasMoreElements(); ) {
***************
*** 76,81 ****
return s;
}
! case 4:
return new Integer(((Task) tasks.elementAt(row)).getCompletion());
}
return null;
--- 79,85 ----
return s;
}
! case 5:
return new Integer(((Task) tasks.elementAt(row)).getCompletion());
+
}
return null;
***************
*** 84,88 ****
public int getColumnCount()
{
! return 5;
}
--- 88,92 ----
public int getColumnCount()
{
! return 6;
}
|