|
From: <nic...@us...> - 2003-09-02 11:12:07
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt
In directory sc8-pr-cvs1:/tmp/cvs-serv32138/src/scratchpad/org/krysalis/jcharts/gantt
Modified Files:
PlanRenderer.java
Log Message:
Fix erroneous rendering of dates and items making the code much cleaner.
Index: PlanRenderer.java
===================================================================
RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/PlanRenderer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PlanRenderer.java 2 Sep 2003 10:32:51 -0000 1.5
--- PlanRenderer.java 2 Sep 2003 11:12:03 -0000 1.6
***************
*** 162,175 ****
count++, offset++, cal.roll(Calendar.DAY_OF_YEAR, true)) {
- //@todo use absolute computed numbers, not increments
- // for max precision
float currentDateLocation =
leftWidth + offset * singleDayWidth;
! if (count % 7 == 6 || count % 7 == 0) {
! //Saturday and sunday
! g2.setPaint(new Color(230, 230, 230));
!
! Shape holidayDay =
new Rectangle2D.Float(
currentDateLocation,
--- 162,169 ----
count++, offset++, cal.roll(Calendar.DAY_OF_YEAR, true)) {
float currentDateLocation =
leftWidth + offset * singleDayWidth;
! Shape currentDay =
new Rectangle2D.Float(
currentDateLocation,
***************
*** 177,218 ****
(float) singleDayWidth,
(height - currentTopEdge));
!
! g2.fill(holidayDay);
! g2.draw(holidayDay);
}
else if (dh.isToday(cal)) {
//today
g2.setPaint(new Color(200, 150, 150));
-
- Shape today =
- new Rectangle2D.Float(
- currentDateLocation,
- (float) currentTopEdge,
- (float) singleDayWidth,
- (height - currentTopEdge));
-
- g2.fill(today);
- g2.draw(today);
-
}
else {
! g2.setPaint(new Color(200, 200, 200));
!
! g2.draw(
! new Rectangle2D.Float(
! currentDateLocation,
! (float) (currentTopEdge + 0.5),
! (float) ((width - leftWidth) / (dh.getTotalDays() - 3)),
! (height - 1 - currentTopEdge)));
}
!
! //@todo
! //addDescr(doc, rect, dh.simpleFormat(cal.getTime()));
if (cal.get(Calendar.DAY_OF_MONTH) == 1) {
- //Sunday
g2.setPaint(Color.BLACK);
! //@todo
! //text.setAttributeNS(null, "style", "font-size:8");
g2.drawString(
dh.monthFormat(cal.getTime()),
--- 171,205 ----
(float) singleDayWidth,
(height - currentTopEdge));
!
! if (count % 7 == 0 || count % 7 == 1) {
! //Saturday and sunday
! g2.setPaint(new Color(230, 230, 230));
}
else if (dh.isToday(cal)) {
//today
g2.setPaint(new Color(200, 150, 150));
}
else {
! //other days
! g2.setPaint(Color.WHITE);
}
! g2.fill(currentDay);
!
! g2.setPaint(new Color(200, 200, 200));
! g2.draw(currentDay);
!
! // //@debug
! // g2.setPaint(Color.RED);
! // //@debug
! // g2.drawString(
! // dh.shortFormat(cal.getTime()),
! // currentDateLocation + 1,
! // currentTopEdge + offset*15);
!
! //@todo add date number eventually
if (cal.get(Calendar.DAY_OF_MONTH) == 1) {
g2.setPaint(Color.BLACK);
!
g2.drawString(
dh.monthFormat(cal.getTime()),
***************
*** 224,231 ****
new Line2D.Float(
currentDateLocation,
! (float) (currentTopEdge + 0.5),
currentDateLocation,
! (height - 1 - currentTopEdge)));
!
}
--- 211,218 ----
new Line2D.Float(
currentDateLocation,
! (float) currentTopEdge,
currentDateLocation,
! (height - currentTopEdge)));
!
}
***************
*** 269,277 ****
Shape taskGraphic =
new Rectangle2D.Float(
! leftWidth
! + 1
! + daysToStart * barspaceWidth / (dh.getTotalDays() - 2),
currentTopEdge + barHeightMargin,
! (days + 1) * barspaceWidth / (dh.getTotalDays() - 2),
barHeigth);
--- 256,262 ----
Shape taskGraphic =
new Rectangle2D.Float(
! leftWidth + daysToStart * singleDayWidth,
currentTopEdge + barHeightMargin,
! (days+1) * singleDayWidth,
barHeigth);
***************
*** 289,302 ****
g2.drawString(
dh.shortFormat(start),
! leftWidth
! + daysToStart * barspaceWidth / (dh.getTotalDays() - 2)
! - 25,
! currentTopEdge + 9);
g2.drawString(
dh.shortFormat(end),
! leftWidth
! + daysToStart * barspaceWidth / (dh.getTotalDays() - 2)
! + days * barspaceWidth / (dh.getTotalDays() - 2)
+ 5,
currentTopEdge + 9);
--- 274,284 ----
g2.drawString(
dh.shortFormat(start),
! leftWidth + daysToStart * singleDayWidth - 25,
! currentTopEdge + 9);
g2.drawString(
dh.shortFormat(end),
! leftWidth + daysToStart * singleDayWidth +
! (days+1) * singleDayWidth
+ 5,
currentTopEdge + 9);
***************
*** 320,329 ****
taskGraphic =
new Rectangle2D.Float(
! leftWidth
! + fragmentdaysToStart
! * barspaceWidth
! / (dh.getTotalDays() - 2),
currentTopEdge + barHeightMargin,
! fragmentDays * barspaceWidth / (dh.getTotalDays() - 2),
barHeigth);
--- 302,308 ----
taskGraphic =
new Rectangle2D.Float(
! leftWidth + fragmentdaysToStart * singleDayWidth,
currentTopEdge + barHeightMargin,
! (fragmentDays+1) * singleDayWidth,
barHeigth);
***************
*** 364,374 ****
(float) leftWidth
+ daysToStartMilestone
! * barspaceWidth
! / (dh.getTotalDays() - 2),
(float) currentTopEdge
+ barspaceHeight
- barHeightMargin
- mul,
! (float) milestoneWidth,
mul);
--- 343,353 ----
(float) leftWidth
+ daysToStartMilestone
! * singleDayWidth,
(float) currentTopEdge
+ barspaceHeight
- barHeightMargin
- mul,
! //@todo not using milestonewidth
! (float) singleDayWidth,
mul);
***************
*** 396,404 ****
taskGraphic =
new Rectangle2D.Float(
! leftWidth
! + 1
! + daysToStart * barspaceWidth / (dh.getTotalDays() - 2),
currentTopEdge + barHeightMargin,
! (days + 1) * barspaceWidth / (dh.getTotalDays() - 2),
barHeigth);
--- 375,381 ----
taskGraphic =
new Rectangle2D.Float(
! leftWidth + daysToStart * singleDayWidth ,
currentTopEdge + barHeightMargin,
! (days + 1) * singleDayWidth,
barHeigth);
***************
*** 419,435 ****
}
! int currentDays =
! (int) (dh.getCurrentTime()
! - dh.getLastWeek().getTime()
! + 43200000 / 86400000);
!
! g2.setPaint(new Color(100, 100, 100));
! g2.drawString(
! dh.format(dh.getCurrentDate()),
! (float) (200 + (currentDays + 0.5) * 300 / 35),
! currentTopEdge - 1);
!
! g2.setPaint(new Color(200, 50, 50));
!
}
--- 396,400 ----
}
!
}
|