You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(95) |
Sep
(42) |
Oct
(2) |
Nov
(7) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
(34) |
Mar
|
Apr
|
May
(64) |
Jun
(113) |
Jul
(60) |
Aug
(9) |
Sep
(6) |
Oct
(20) |
Nov
(11) |
Dec
|
From: <nic...@us...> - 2003-09-02 16:26:03
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv19839/src/scratchpad/org/krysalis/jcharts/gantt Modified Files: DateHandler.java PlanRenderer.java Log Message: Much better date visualization. Index: DateHandler.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/DateHandler.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DateHandler.java 2 Sep 2003 12:45:17 -0000 1.6 --- DateHandler.java 2 Sep 2003 16:25:55 -0000 1.7 *************** *** 56,60 **** private final static DateFormat dateStampFormat = new SimpleDateFormat("yyyyMMdd"); ! private Date currentDay; private long currentTime; --- 56,64 ---- private final static DateFormat dateStampFormat = new SimpleDateFormat("yyyyMMdd"); ! private final static DateFormat dayOfWeekFormat = ! new SimpleDateFormat("E"); ! private final static DateFormat weekNumberFormat = ! new SimpleDateFormat("w"); ! private Date currentDay; private long currentTime; *************** *** 103,106 **** --- 107,118 ---- } + public String shortDayOfWeekFormat(Date d) { + return dayOfWeekFormat.format(d).substring(0,1); + } + + public String weekNumberFormat(Date d) { + return weekNumberFormat.format(d); + } + public Date getCurrentDate() { return currentDay; Index: PlanRenderer.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/PlanRenderer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PlanRenderer.java 2 Sep 2003 11:32:36 -0000 1.7 --- PlanRenderer.java 2 Sep 2003 16:25:55 -0000 1.8 *************** *** 90,94 **** //@todo String height LineMetrics lm = font.getLineMetrics(title, g2.getFontRenderContext()); ! float currentTopEdge = lm.getHeight() + 5; float rightEdge; --- 90,103 ---- //@todo String height LineMetrics lm = font.getLineMetrics(title, g2.getFontRenderContext()); ! ! // ----------------------------------------- ! // Month *1 ! // ----------------------------------------- ! // Week *2 ! // ----------------------------------------- ! // Day *3 ! // ----------------------------------------- ! float singleDateHeight = (lm.getHeight() + 2); ! float currentTopEdge = singleDateHeight * 3; float rightEdge; *************** *** 120,124 **** (float) font.getStringBounds(title, g2.getFontRenderContext()).getWidth(); ! float titlePosition = (float) (80 - titleWidth / 2.0); if (titlePosition < 5) { titlePosition = 5; --- 129,133 ---- (float) font.getStringBounds(title, g2.getFontRenderContext()).getWidth(); ! float titlePosition = (float) ((leftWidth - titleWidth) / 2.0); if (titlePosition < 5) { titlePosition = 5; *************** *** 126,148 **** g2.setPaint(Color.BLACK); ! g2.drawString(title, titlePosition, 18); //Draw Dates DateHandler dh = new DateHandler(startDate, endDate); g2.setPaint(Color.BLACK); g2.draw(new Line2D.Float(0, currentTopEdge, width, currentTopEdge)); ! //firstdate ! g2.drawString( ! dh.shortFormat(dh.getStartDate()), ! leftWidth + 1, ! currentTopEdge - 1); ! //lastdate ! g2.drawString( ! dh.shortFormat(dh.getEndDate()), ! (int) width, ! (int) currentTopEdge - 1); g2.setPaint(new Color(150, 150, 150)); --- 135,169 ---- g2.setPaint(Color.BLACK); ! g2.drawString(title, titlePosition, singleDateHeight); //Draw Dates DateHandler dh = new DateHandler(startDate, endDate); + float topDateHeight = singleDateHeight; + float middleDateHeight = singleDateHeight*2; + float bottomDateHeight = singleDateHeight*3; + g2.setPaint(Color.BLACK); + g2.draw(new Line2D.Float(0, topDateHeight, width, topDateHeight)); + g2.draw(new Line2D.Float(leftWidth, middleDateHeight, width, middleDateHeight)); + g2.draw(new Line2D.Float(leftWidth, bottomDateHeight, width, bottomDateHeight)); + //currentTopEdge!=necessarily to bottomDateHeight g2.draw(new Line2D.Float(0, currentTopEdge, width, currentTopEdge)); ! g2.draw(new Line2D.Float(leftWidth, 0, leftWidth, currentTopEdge)); ! //todo need a better positioning if ever ! // ! // //firstdate ! // g2.drawString( ! // dh.shortFormat(dh.getStartDate()), ! // leftWidth + 1, ! // currentTopEdge - 2); ! // ! // //lastdate ! // g2.drawString( ! // dh.shortFormat(dh.getEndDate()), ! // (int) width, ! // currentTopEdge - 2); g2.setPaint(new Color(150, 150, 150)); *************** *** 164,167 **** --- 185,229 ---- float currentDateLocation = leftWidth + offset * singleDayWidth; + if (count % 7 == 2) { + //Monday + g2.setPaint(Color.BLACK); + + g2.draw(new Line2D.Float(currentDateLocation, topDateHeight, currentDateLocation, middleDateHeight)); + + g2.drawString( + dh.shortFormat(cal.getTime()), + (int) currentDateLocation+2, + (int) (middleDateHeight - 2)); + + // Week number + g2.setPaint(Color.BLACK); + + String weekNumString = dh.weekNumberFormat(cal.getTime()); + float weekNumStringWidth = + (float) font.getStringBounds(weekNumString, g2.getFontRenderContext()).getWidth(); + + //@todo fix centering routing (need string width) + g2.drawString( + dh.weekNumberFormat(cal.getTime()), + (int) (currentDateLocation + 3.5 * singleDayWidth - weekNumStringWidth / 2) - 2, + (int) (bottomDateHeight - 2)); + + g2.draw(new Line2D.Float(currentDateLocation ,middleDateHeight, currentDateLocation, bottomDateHeight)); + + + + + } + + //@todo activate every day as fourth date hint? + // g2.setPaint(Color.BLACK); + // + // g2.drawString( + // dh.shortDayOfWeekFormat(cal.getTime()), + // (int) currentDateLocation +2, + // (int) (bottomDateHeight - 2)); + // + // g2.draw(new Line2D.Float(currentDateLocation ,middleDateHeight, currentDateLocation, bottomDateHeight)); + Shape currentDay = new Rectangle2D.Float( *************** *** 195,201 **** // currentDateLocation + 1, // currentTopEdge + offset*15); ! ! //@todo add date number eventually ! if (cal.get(Calendar.DAY_OF_MONTH) == 1) { g2.setPaint(Color.BLACK); --- 257,262 ---- // currentDateLocation + 1, // currentTopEdge + offset*15); ! ! //if MONTH if (cal.get(Calendar.DAY_OF_MONTH) == 1) { g2.setPaint(Color.BLACK); *************** *** 203,208 **** g2.drawString( dh.monthFormat(cal.getTime()), ! (int) currentDateLocation, ! (int) (currentTopEdge - 1)); g2.setPaint(Color.BLACK); --- 264,269 ---- g2.drawString( dh.monthFormat(cal.getTime()), ! (int) currentDateLocation +2, ! (int) (topDateHeight - 2)); g2.setPaint(Color.BLACK); *************** *** 210,217 **** new Line2D.Float( currentDateLocation, (float) currentTopEdge, currentDateLocation, (height - currentTopEdge))); - } --- 271,284 ---- new Line2D.Float( currentDateLocation, + 0, + currentDateLocation, + (topDateHeight))); + + g2.draw( + new Line2D.Float( + currentDateLocation, (float) currentTopEdge, currentDateLocation, (height - currentTopEdge))); } |
From: <nic...@us...> - 2003-09-02 12:45:43
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv14582/src/scratchpad/org/krysalis/jcharts/gantt Modified Files: DateHandler.java Log Message: Fix weekday handling that was relying on the default date in a week (Tuesday), by forcing Monday instead. Index: DateHandler.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/DateHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DateHandler.java 2 Sep 2003 11:33:05 -0000 1.5 --- DateHandler.java 2 Sep 2003 12:45:17 -0000 1.6 *************** *** 213,235 **** public static String getStringDateFromWeek(int week, boolean startDay) throws ParseException { ! System.out.println("TRANSFORMING WEEK: " + String.valueOf(week)); Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.set(Calendar.WEEK_OF_YEAR, week); ! if (startDay) { ! c.roll(Calendar.DATE, -1); ! } ! else { ! c.roll(Calendar.DATE, 3); ! } ! // String resultYear = String.valueOf(c.get(Calendar.YEAR)); ! // String resultMonth = String.valueOf(c.get(Calendar.MONTH)); ! // if(resultMonth.length()==1){resultMonth="0"+resultMonth;} ! // String resultDay = String.valueOf(c.get(Calendar.DATE)); ! // if(resultDay.length()==1){resultDay="0"+resultMonth;} ! // return resultYear+resultMonth+resultDay; Date result = c.getTime(); return dateStampFormat.format(result); --- 213,230 ---- public static String getStringDateFromWeek(int week, boolean startDay) throws ParseException { ! System.out.print("TRANSFORMING WEEK: " + String.valueOf(week)); Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.set(Calendar.WEEK_OF_YEAR, week); ! c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); ! // | S | M | T | W | T | F | ! // X +4 ! if (!startDay) { ! c.roll(Calendar.DATE, +4); ! } Date result = c.getTime(); + System.out.println(" into: " + result); return dateStampFormat.format(result); |
From: <nic...@us...> - 2003-09-02 11:33:09
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv2691/src/scratchpad/org/krysalis/jcharts/gantt Modified Files: DateHandler.java Log Message: Fix getStringDateFromWeek Index: DateHandler.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/DateHandler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DateHandler.java 2 Sep 2003 10:32:51 -0000 1.4 --- DateHandler.java 2 Sep 2003 11:33:05 -0000 1.5 *************** *** 48,56 **** **/ public class DateHandler { ! ! private final static DateFormat shortFormat = DateFormat.getDateInstance(DateFormat.SHORT); ! private final static DateFormat monthFormat = new SimpleDateFormat("MMMMM"); ! private final static DateFormat dayMonthFormat= new SimpleDateFormat("dd/MM"); ! private final static DateFormat dateStampFormat= new SimpleDateFormat("yyyyMMdd"); private Date currentDay; --- 48,59 ---- **/ public class DateHandler { ! ! private final static DateFormat shortFormat = ! DateFormat.getDateInstance(DateFormat.SHORT); ! private final static DateFormat monthFormat = new SimpleDateFormat("MMMMM"); ! private final static DateFormat dayMonthFormat = ! new SimpleDateFormat("dd/MM"); ! private final static DateFormat dateStampFormat = ! new SimpleDateFormat("yyyyMMdd"); private Date currentDay; *************** *** 65,69 **** public DateHandler(Date startDate, Date endDate) { ! //calculate the date this.currentDay = cleanDay(new Date()); --- 68,72 ---- public DateHandler(Date startDate, Date endDate) { ! //calculate the date this.currentDay = cleanDay(new Date()); *************** *** 73,83 **** cal = Calendar.getInstance(); ! // if (lastWeek == null || future == null) { ! // int dow = cal.get(Calendar.DAY_OF_WEEK); ! // cal.add(Calendar.DATE, -dow - 6); ! // lastWeek = cleanDay(cal.getTime()); ! // cal.add(Calendar.DATE, 5 * 7); ! // future = cleanDay(cal.getTime()); ! // } totalDays = (long) getDayDiff(future, lastWeek); --- 76,86 ---- cal = Calendar.getInstance(); ! // if (lastWeek == null || future == null) { ! // int dow = cal.get(Calendar.DAY_OF_WEEK); ! // cal.add(Calendar.DATE, -dow - 6); ! // lastWeek = cleanDay(cal.getTime()); ! // cal.add(Calendar.DATE, 5 * 7); ! // future = cleanDay(cal.getTime()); ! // } totalDays = (long) getDayDiff(future, lastWeek); *************** *** 87,91 **** shortFormat.format(currentDay); } ! public String format(Date d) { return shortFormat.format(d); --- 90,94 ---- shortFormat.format(currentDay); } ! public String format(Date d) { return shortFormat.format(d); *************** *** 154,167 **** } } ! public int getDayDiff(Date start, Date end) { return (int) ! ((cleanDay(start).getTime() ! - cleanDay(end).getTime() ! + 43200000) / 86400000); } - public static Date getDate(String label) { Calendar cal = Calendar.getInstance(); --- 157,167 ---- } } ! public int getDayDiff(Date start, Date end) { return (int) ! ((cleanDay(start).getTime() - cleanDay(end).getTime() + 43200000) / 86400000); } public static Date getDate(String label) { Calendar cal = Calendar.getInstance(); *************** *** 179,188 **** intVal = Integer.valueOf(str).intValue(); cal.set(Calendar.DATE, intVal); ! ! cal.set(Calendar.HOUR, 0); ! cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); ! return cal.getTime(); } --- 179,188 ---- intVal = Integer.valueOf(str).intValue(); cal.set(Calendar.DATE, intVal); ! ! cal.set(Calendar.HOUR, 0); ! cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); ! return cal.getTime(); } *************** *** 218,222 **** c.set(Calendar.WEEK_OF_YEAR, week); if (startDay) { ! c.roll(Calendar.DATE, -4); } --- 218,225 ---- c.set(Calendar.WEEK_OF_YEAR, week); if (startDay) { ! c.roll(Calendar.DATE, -1); ! } ! else { ! c.roll(Calendar.DATE, 3); } *************** *** 228,240 **** // return resultYear+resultMonth+resultDay; - Date result = c.getTime(); ! return dateStampFormat.format(result); } ! ! // Private helper methods ! private static Date cleanDay(long date) { return DateHandler.cleanDay(new Date(date)); --- 231,241 ---- // return resultYear+resultMonth+resultDay; Date result = c.getTime(); ! return dateStampFormat.format(result); } ! // Private helper methods ! private static Date cleanDay(long date) { return DateHandler.cleanDay(new Date(date)); *************** *** 251,255 **** return date; } ! private static Date parseDate(String date) throws ParseException { DateFormat formatter = new SimpleDateFormat("yyyyMMdd"); --- 252,256 ---- return date; } ! private static Date parseDate(String date) throws ParseException { DateFormat formatter = new SimpleDateFormat("yyyyMMdd"); *************** *** 261,265 **** return formatter.format(date); } - } --- 262,265 ---- |
From: <nic...@us...> - 2003-09-02 11:32:40
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv2600/src/scratchpad/org/krysalis/jcharts/gantt Modified Files: PlanRenderer.java Log Message: Cosmetic changes. Index: PlanRenderer.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/PlanRenderer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PlanRenderer.java 2 Sep 2003 11:12:03 -0000 1.6 --- PlanRenderer.java 2 Sep 2003 11:32:36 -0000 1.7 *************** *** 155,159 **** int offset = 0; ! long singleDayWidth = (width - leftWidth) / dh.getTotalDays() ; Calendar cal = Calendar.getInstance(); cal.setTime(dh.getLastWeek()); --- 155,159 ---- int offset = 0; ! long singleDayWidth = (width - leftWidth) / dh.getTotalDays(); Calendar cal = Calendar.getInstance(); cal.setTime(dh.getLastWeek()); *************** *** 162,175 **** count++, offset++, cal.roll(Calendar.DAY_OF_YEAR, true)) { ! float currentDateLocation = ! leftWidth + offset * singleDayWidth; - Shape currentDay = - new Rectangle2D.Float( - currentDateLocation, - (float) currentTopEdge, - (float) singleDayWidth, - (height - currentTopEdge)); - if (count % 7 == 0 || count % 7 == 1) { //Saturday and sunday --- 162,174 ---- count++, offset++, cal.roll(Calendar.DAY_OF_YEAR, true)) { ! float currentDateLocation = leftWidth + offset * singleDayWidth; ! ! Shape currentDay = ! new Rectangle2D.Float( ! currentDateLocation, ! (float) currentTopEdge, ! (float) singleDayWidth, ! (height - currentTopEdge)); if (count % 7 == 0 || count % 7 == 1) { //Saturday and sunday *************** *** 185,200 **** } 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 --- 184,199 ---- } 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 *************** *** 214,220 **** currentDateLocation, (height - currentTopEdge))); ! } ! } --- 213,219 ---- currentDateLocation, (height - currentTopEdge))); ! } ! } *************** *** 258,262 **** leftWidth + daysToStart * singleDayWidth, currentTopEdge + barHeightMargin, ! (days+1) * singleDayWidth, barHeigth); --- 257,261 ---- leftWidth + daysToStart * singleDayWidth, currentTopEdge + barHeightMargin, ! (days + 1) * singleDayWidth, barHeigth); *************** *** 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); --- 273,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); *************** *** 304,308 **** leftWidth + fragmentdaysToStart * singleDayWidth, currentTopEdge + barHeightMargin, ! (fragmentDays+1) * singleDayWidth, barHeigth); --- 304,308 ---- leftWidth + fragmentdaysToStart * singleDayWidth, currentTopEdge + barHeightMargin, ! (fragmentDays + 1) * singleDayWidth, barHeigth); *************** *** 339,352 **** milestoneMinHeight); Shape milestoneShape = new Rectangle2D.Float( ! (float) leftWidth ! + daysToStartMilestone ! * singleDayWidth, (float) currentTopEdge + barspaceHeight - barHeightMargin - mul, - //@todo not using milestonewidth (float) singleDayWidth, mul); --- 339,350 ---- milestoneMinHeight); + //@todo not using milestonewidth Shape milestoneShape = new Rectangle2D.Float( ! (float) leftWidth + daysToStartMilestone * singleDayWidth, (float) currentTopEdge + barspaceHeight - barHeightMargin - mul, (float) singleDayWidth, mul); *************** *** 375,379 **** taskGraphic = new Rectangle2D.Float( ! leftWidth + daysToStart * singleDayWidth , currentTopEdge + barHeightMargin, (days + 1) * singleDayWidth, --- 373,377 ---- taskGraphic = new Rectangle2D.Float( ! leftWidth + daysToStart * singleDayWidth, currentTopEdge + barHeightMargin, (days + 1) * singleDayWidth, *************** *** 396,400 **** } ! } --- 394,398 ---- } ! } |
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 ---- } ! } |
From: <nic...@us...> - 2003-09-02 10:33:41
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv26444/src/scratchpad/org/krysalis/jcharts/gantt Modified Files: DateHandler.java PlanRenderer.java Log Message: Rename some variables and other date handling cleanings. Index: DateHandler.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/DateHandler.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DateHandler.java 2 Sep 2003 09:08:46 -0000 1.3 --- DateHandler.java 2 Sep 2003 10:32:51 -0000 1.4 *************** *** 48,79 **** **/ public class DateHandler { ! private Date currentDate; private long currentTime; ! private Date startDate; ! private Date endDate; private Date lastWeek; private Date future; ! private Calendar lw; private long totalDays; ! private int startDay; ! private DateFormat df; ! private DateFormat dmf; ! private DateFormat df_ddMM; public String format(Date d) { ! return df.format(d); } ! public String simpleFormat(Date d) { ! return df_ddMM.format(d); } public String monthFormat(Date d) { ! return dmf.format(d); } public Date getCurrentDate() { ! return currentDate; } --- 48,105 ---- **/ public class DateHandler { ! ! private final static DateFormat shortFormat = DateFormat.getDateInstance(DateFormat.SHORT); ! private final static DateFormat monthFormat = new SimpleDateFormat("MMMMM"); ! private final static DateFormat dayMonthFormat= new SimpleDateFormat("dd/MM"); ! private final static DateFormat dateStampFormat= new SimpleDateFormat("yyyyMMdd"); ! ! private Date currentDay; private long currentTime; ! private Date startDay; ! private Date endDay; private Date lastWeek; private Date future; ! private Calendar cal; private long totalDays; ! private int startDayOfWeek; ! public DateHandler(Date startDate, Date endDate) { ! ! //calculate the date ! this.currentDay = cleanDay(new Date()); ! this.currentTime = currentDay.getTime(); ! this.startDay = lastWeek = cleanDay(startDate); ! this.endDay = future = cleanDay(endDate); ! ! cal = Calendar.getInstance(); ! // if (lastWeek == null || future == null) { ! // int dow = cal.get(Calendar.DAY_OF_WEEK); ! // cal.add(Calendar.DATE, -dow - 6); ! // lastWeek = cleanDay(cal.getTime()); ! // cal.add(Calendar.DATE, 5 * 7); ! // future = cleanDay(cal.getTime()); ! // } ! totalDays = (long) getDayDiff(future, lastWeek); ! ! cal.setTime(lastWeek); ! startDayOfWeek = cal.get(Calendar.DAY_OF_WEEK); + shortFormat.format(currentDay); + } + public String format(Date d) { ! return shortFormat.format(d); } ! public String shortFormat(Date d) { ! return dayMonthFormat.format(d); } public String monthFormat(Date d) { ! return monthFormat.format(d); } public Date getCurrentDate() { ! return currentDay; } *************** *** 83,87 **** public Date getEndDate() { ! return endDate; } --- 109,113 ---- public Date getEndDate() { ! return endDay; } *************** *** 95,107 **** public Calendar getLw() { ! return lw; } public Date getStartDate() { ! return startDate; } ! public int getStartDay() { ! return startDay; } --- 121,133 ---- public Calendar getLw() { ! return cal; } public Date getStartDate() { ! return startDay; } ! public int getStartDayOfWeek() { ! return startDayOfWeek; } *************** *** 112,116 **** public boolean isToday(Calendar cal) { Calendar currcal = Calendar.getInstance(); ! currcal.setTime(currentDate); int day = cal.get(Calendar.DAY_OF_MONTH); --- 138,142 ---- public boolean isToday(Calendar cal) { Calendar currcal = Calendar.getInstance(); ! currcal.setTime(currentDay); int day = cal.get(Calendar.DAY_OF_MONTH); *************** *** 128,131 **** --- 154,158 ---- } } + public int getDayDiff(Date start, Date end) { return (int) *************** *** 136,182 **** } - public DateHandler(Date startDate, Date endDate) { - df = DateFormat.getDateInstance(DateFormat.SHORT); - df_ddMM = new SimpleDateFormat("dd/MM"); - dmf = new SimpleDateFormat("MMMMM"); - - //calculate the date - this.currentDate = cleanDay(new Date()); - this.currentTime = currentDate.getTime(); - this.startDate = cleanDay(startDate); - this.endDate = cleanDay(endDate); - - lastWeek = cleanDay(startDate); - future = cleanDay(endDate); - lw = Calendar.getInstance(); - if (lastWeek == null || future == null) { - int dow = lw.get(Calendar.DAY_OF_WEEK); - lw.add(Calendar.DATE, -dow - 6); - lastWeek = cleanDay(lw.getTime()); - lw.add(Calendar.DATE, 5 * 7); - future = cleanDay(lw.getTime()); - } - totalDays = - (long) ((future.getTime() - lastWeek.getTime() + 43200000) / 86400000); - lw.setTime(lastWeek); - startDay = lw.get(Calendar.DAY_OF_WEEK); - - df.format(currentDate); - } - - private static Date cleanDay(long date) { - return DateHandler.cleanDay(new Date(date)); - } - - private static Date cleanDay(int date) { - return DateHandler.cleanDay(new Date(date)); - } - - private static Date cleanDay(Date date) { - date.setHours(0); - date.setMinutes(0); - date.setSeconds(0); - return date; - } public static Date getDate(String label) { --- 163,166 ---- *************** *** 226,239 **** } - private static Date parseDate(String date) throws ParseException { - DateFormat formatter = new SimpleDateFormat("yyyyMMdd"); - return (Date) formatter.parse(date); - } - - private static String formatDate(Date date) throws ParseException { - DateFormat formatter = new SimpleDateFormat("dd/MM"); - return formatter.format(date); - } - //TODO ! add year handling!!! public static String getStringDateFromWeek(int week, boolean startDay) --- 210,213 ---- *************** *** 254,259 **** // return resultYear+resultMonth+resultDay; DateFormat formatter = new SimpleDateFormat("yyyyMMdd"); ! return formatter.format(c.getTime()); } } --- 228,265 ---- // return resultYear+resultMonth+resultDay; + + Date result = c.getTime(); + + return dateStampFormat.format(result); + } + + + // Private helper methods + + private static Date cleanDay(long date) { + return DateHandler.cleanDay(new Date(date)); + } + + private static Date cleanDay(int date) { + return DateHandler.cleanDay(new Date(date)); + } + + private static Date cleanDay(Date date) { + date.setHours(0); + date.setMinutes(0); + date.setSeconds(0); + return date; + } + + private static Date parseDate(String date) throws ParseException { DateFormat formatter = new SimpleDateFormat("yyyyMMdd"); ! return (Date) formatter.parse(date); } + + private static String formatDate(Date date) throws ParseException { + DateFormat formatter = new SimpleDateFormat("dd/MM"); + return formatter.format(date); + } + + } Index: PlanRenderer.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/PlanRenderer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PlanRenderer.java 2 Sep 2003 09:52:11 -0000 1.4 --- PlanRenderer.java 2 Sep 2003 10:32:51 -0000 1.5 *************** *** 109,130 **** // g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float)0.5)); // g2.setPaint(Color.YELLOW); ! // g2.fill(clip1); // g2.setPaint(Color.BLUE); ! // g2.fill(clip2); // g2.setPaint(Color.RED); ! // g2.fill(clip3); // g2.setPaintMode(); ! float strwidth = (float) font.getStringBounds(title, g2.getFontRenderContext()).getWidth(); ! float pos = (float) (80 - strwidth / 2.0); ! if (pos < 5) { ! pos = 5; } g2.setPaint(Color.BLACK); ! g2.drawString(title, pos, 18); DateHandler dh = new DateHandler(startDate, endDate); --- 109,132 ---- // g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float)0.5)); // g2.setPaint(Color.YELLOW); ! // g2.fill(leftclip); // g2.setPaint(Color.BLUE); ! // g2.fill(middleclip); // g2.setPaint(Color.RED); ! // g2.fill(rightclip); // g2.setPaintMode(); ! //Draw Title ! float titleWidth = (float) font.getStringBounds(title, g2.getFontRenderContext()).getWidth(); ! float titlePosition = (float) (80 - titleWidth / 2.0); ! if (titlePosition < 5) { ! titlePosition = 5; } g2.setPaint(Color.BLACK); ! g2.drawString(title, titlePosition, 18); + //Draw Dates DateHandler dh = new DateHandler(startDate, endDate); *************** *** 134,138 **** //firstdate g2.drawString( ! dh.simpleFormat(dh.getLastWeek()), leftWidth + 1, currentTopEdge - 1); --- 136,140 ---- //firstdate g2.drawString( ! dh.shortFormat(dh.getStartDate()), leftWidth + 1, currentTopEdge - 1); *************** *** 140,144 **** //lastdate g2.drawString( ! dh.simpleFormat(dh.getFuture()), (int) width, (int) currentTopEdge - 1); --- 142,146 ---- //lastdate g2.drawString( ! dh.shortFormat(dh.getEndDate()), (int) width, (int) currentTopEdge - 1); *************** *** 153,166 **** int offset = 0; Calendar cal = Calendar.getInstance(); cal.setTime(dh.getLastWeek()); ! for (int count = dh.getStartDay(); ! count < dh.getStartDay() + dh.getTotalDays() - 1; ! count++, offset++) { ! ! cal.roll(Calendar.DAY_OF_YEAR, true); float currentDateLocation = ! leftWidth + (offset) * (width - leftWidth) / (dh.getTotalDays() - 2); if (count % 7 == 6 || count % 7 == 0) { --- 155,169 ---- int offset = 0; + long singleDayWidth = (width - leftWidth) / dh.getTotalDays() ; Calendar cal = Calendar.getInstance(); cal.setTime(dh.getLastWeek()); ! for (int count = dh.getStartDayOfWeek(); ! count < dh.getStartDayOfWeek() + dh.getTotalDays(); ! 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) { *************** *** 170,177 **** Shape holidayDay = new Rectangle2D.Float( ! currentDateLocation, ! (float) (currentTopEdge + 0.5), ! (float) ((width - leftWidth) / (dh.getTotalDays() - 3)), ! (height - 1 - currentTopEdge)); g2.fill(holidayDay); --- 173,180 ---- Shape holidayDay = new Rectangle2D.Float( ! currentDateLocation, ! (float) currentTopEdge, ! (float) singleDayWidth, ! (height - currentTopEdge)); g2.fill(holidayDay); *************** *** 185,191 **** new Rectangle2D.Float( currentDateLocation, ! (float) (currentTopEdge + 0.5), ! (float) ((width - leftWidth) / (dh.getTotalDays() - 3)), ! (height - 1 - currentTopEdge)); g2.fill(today); --- 188,194 ---- new Rectangle2D.Float( currentDateLocation, ! (float) currentTopEdge, ! (float) singleDayWidth, ! (height - currentTopEdge)); g2.fill(today); *************** *** 226,230 **** } ! } --- 229,233 ---- } ! } *************** *** 285,289 **** g2.setPaint(Color.BLACK); g2.drawString( ! dh.simpleFormat(start), leftWidth + daysToStart * barspaceWidth / (dh.getTotalDays() - 2) --- 288,292 ---- g2.setPaint(Color.BLACK); g2.drawString( ! dh.shortFormat(start), leftWidth + daysToStart * barspaceWidth / (dh.getTotalDays() - 2) *************** *** 292,296 **** g2.drawString( ! dh.simpleFormat(end), leftWidth + daysToStart * barspaceWidth / (dh.getTotalDays() - 2) --- 295,299 ---- g2.drawString( ! dh.shortFormat(end), leftWidth + daysToStart * barspaceWidth / (dh.getTotalDays() - 2) |
From: <nic...@us...> - 2003-09-02 09:52:18
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv20488/src/scratchpad/org/krysalis/jcharts/gantt Modified Files: PlanRenderer.java Log Message: Understandable names for the clips. Index: PlanRenderer.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/PlanRenderer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PlanRenderer.java 2 Sep 2003 09:08:47 -0000 1.3 --- PlanRenderer.java 2 Sep 2003 09:52:11 -0000 1.4 *************** *** 93,104 **** float rightEdge; ! Shape clip0 = new Rectangle2D.Float(0, 0, width, height); ! Shape clip1 = new Rectangle2D.Float(0, 0, firstSpaceWidth, height); ! Shape clip2 = new Rectangle2D.Float(firstSpaceWidth, 0, secondSpaceWidth, height); ! Shape clip3 = new Rectangle2D.Float(leftWidth, 0, width - leftWidth, height); ! g2.clip(clip0); g2.setBackground(Color.WHITE); --- 93,104 ---- float rightEdge; ! Shape fullclip = new Rectangle2D.Float(0, 0, width, height); ! Shape leftclip = new Rectangle2D.Float(0, 0, firstSpaceWidth, height); ! Shape middleclip = new Rectangle2D.Float(firstSpaceWidth, 0, secondSpaceWidth, height); ! Shape rightclip = new Rectangle2D.Float(leftWidth, 0, width - leftWidth, height); ! g2.clip(fullclip); g2.setBackground(Color.WHITE); *************** *** 240,248 **** g2.setPaint(Color.BLACK); ! g2.setClip(clip1); g2.drawString(label, 0, currentTopEdge + 12); g2.setClip(null); ! g2.setClip(clip2); g2.drawString(name, firstSpaceWidth, currentTopEdge + 12); g2.setClip(null); --- 240,248 ---- g2.setPaint(Color.BLACK); ! g2.setClip(leftclip); g2.drawString(label, 0, currentTopEdge + 12); g2.setClip(null); ! g2.setClip(middleclip); g2.drawString(name, firstSpaceWidth, currentTopEdge + 12); g2.setClip(null); *************** *** 273,277 **** barHeigth); ! g2.setClip(clip3); g2.setPaint(Color.decode(currentAction.getColor())); g2.fill(taskGraphic); --- 273,277 ---- barHeigth); ! g2.setClip(rightclip); g2.setPaint(Color.decode(currentAction.getColor())); g2.fill(taskGraphic); *************** *** 325,329 **** barHeigth); ! g2.setClip(clip3); g2.setPaint(Color.decode(fragment.getColor())); g2.fill(taskGraphic); --- 325,329 ---- barHeigth); ! g2.setClip(rightclip); g2.setPaint(Color.decode(fragment.getColor())); g2.fill(taskGraphic); *************** *** 373,377 **** PlanRenderer.normalizeMultiplicity4Color(multiplicity); ! g2.setClip(clip3); g2.setPaint(new Color(normMult, 0, 0)); g2.fill(milestoneShape); --- 373,377 ---- PlanRenderer.normalizeMultiplicity4Color(multiplicity); ! g2.setClip(rightclip); g2.setPaint(new Color(normMult, 0, 0)); g2.fill(milestoneShape); *************** *** 400,404 **** barHeigth); ! g2.setClip(clip3); g2.setPaint(Color.BLACK); g2.fill(taskGraphic); --- 400,404 ---- barHeigth); ! g2.setClip(rightclip); g2.setPaint(Color.BLACK); g2.fill(taskGraphic); |
From: <nic...@us...> - 2003-09-02 09:08:52
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv13645/src/scratchpad/org/krysalis/jcharts/gantt Modified Files: DateHandler.java PlanRenderer.java Log Message: Make day "cleaning" private to DateHandler Index: DateHandler.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/DateHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DateHandler.java 2 Sep 2003 08:54:19 -0000 1.2 --- DateHandler.java 2 Sep 2003 09:08:46 -0000 1.3 *************** *** 130,135 **** public int getDayDiff(Date start, Date end) { return (int) ! ((DateHandler.cleanDay(start).getTime() ! - DateHandler.cleanDay(end).getTime() + 43200000) / 86400000); --- 130,135 ---- public int getDayDiff(Date start, Date end) { return (int) ! ((cleanDay(start).getTime() ! - cleanDay(end).getTime() + 43200000) / 86400000); *************** *** 142,159 **** //calculate the date ! this.currentDate = DateHandler.cleanDay(new Date()); this.currentTime = currentDate.getTime(); ! this.startDate = DateHandler.cleanDay(startDate); ! this.endDate = DateHandler.cleanDay(endDate); ! lastWeek = DateHandler.cleanDay(startDate); ! future = DateHandler.cleanDay(endDate); lw = Calendar.getInstance(); if (lastWeek == null || future == null) { int dow = lw.get(Calendar.DAY_OF_WEEK); lw.add(Calendar.DATE, -dow - 6); ! lastWeek = DateHandler.cleanDay(lw.getTime()); lw.add(Calendar.DATE, 5 * 7); ! future = DateHandler.cleanDay(lw.getTime()); } totalDays = --- 142,159 ---- //calculate the date ! this.currentDate = cleanDay(new Date()); this.currentTime = currentDate.getTime(); ! this.startDate = cleanDay(startDate); ! this.endDate = cleanDay(endDate); ! lastWeek = cleanDay(startDate); ! future = cleanDay(endDate); lw = Calendar.getInstance(); if (lastWeek == null || future == null) { int dow = lw.get(Calendar.DAY_OF_WEEK); lw.add(Calendar.DATE, -dow - 6); ! lastWeek = cleanDay(lw.getTime()); lw.add(Calendar.DATE, 5 * 7); ! future = cleanDay(lw.getTime()); } totalDays = *************** *** 165,177 **** } ! public static Date cleanDay(long date) { return DateHandler.cleanDay(new Date(date)); } ! public static Date cleanDay(int date) { return DateHandler.cleanDay(new Date(date)); } ! public static Date cleanDay(Date date) { date.setHours(0); date.setMinutes(0); --- 165,177 ---- } ! private static Date cleanDay(long date) { return DateHandler.cleanDay(new Date(date)); } ! private static Date cleanDay(int date) { return DateHandler.cleanDay(new Date(date)); } ! private static Date cleanDay(Date date) { date.setHours(0); date.setMinutes(0); Index: PlanRenderer.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/PlanRenderer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PlanRenderer.java 2 Sep 2003 08:54:20 -0000 1.2 --- PlanRenderer.java 2 Sep 2003 09:08:47 -0000 1.3 *************** *** 250,255 **** int type = currentAction.getType(); ! Date start = DateHandler.cleanDay(currentAction.getStartDate()); ! Date end = DateHandler.cleanDay(currentAction.getEndDate()); if (end.after(dh.getLastWeek()) && start.before(dh.getFuture())) { --- 250,255 ---- int type = currentAction.getType(); ! Date start = currentAction.getStartDate(); ! Date end = currentAction.getEndDate(); if (end.after(dh.getLastWeek()) && start.before(dh.getFuture())) { *************** *** 307,313 **** RowItem fragment = (RowItem) fragments.get(i); ! Date fragmentStart = ! DateHandler.cleanDay(fragment.getStartDate()); ! Date fragmentEnd = DateHandler.cleanDay(fragment.getEndDate()); int fragmentDays = dh.getDayDiff(fragmentEnd, fragmentStart); --- 307,312 ---- RowItem fragment = (RowItem) fragments.get(i); ! Date fragmentStart = fragment.getStartDate(); ! Date fragmentEnd = fragment.getEndDate(); int fragmentDays = dh.getDayDiff(fragmentEnd, fragmentStart); *************** *** 348,353 **** for (int i = 0; i < milestonesSize; i++) { int multiplicity = ((Integer) multiplicities.get(i)).intValue(); ! Date milestoneStart = ! DateHandler.cleanDay((Date) milestones.get(i)); int daysToStartMilestone = --- 347,351 ---- for (int i = 0; i < milestonesSize; i++) { int multiplicity = ((Integer) multiplicities.get(i)).intValue(); ! Date milestoneStart = (Date) milestones.get(i); int daysToStartMilestone = |
From: <nic...@us...> - 2003-09-02 08:54:47
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv11386/src/scratchpad/org/krysalis/jcharts/gantt Modified Files: DateHandler.java PlanRenderer.java Log Message: Decouple DateHandler from PlanRenderer Index: DateHandler.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/DateHandler.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DateHandler.java 2 Sep 2003 08:43:15 -0000 1.1 --- DateHandler.java 2 Sep 2003 08:54:19 -0000 1.2 *************** *** 48,52 **** **/ public class DateHandler { - private final PlanRenderer dh; private Date currentDate; private long currentTime; --- 48,51 ---- *************** *** 137,143 **** } ! public DateHandler(PlanRenderer renderer, Date startDate, Date endDate) { df = DateFormat.getDateInstance(DateFormat.SHORT); - this.dh = renderer; df_ddMM = new SimpleDateFormat("dd/MM"); dmf = new SimpleDateFormat("MMMMM"); --- 136,141 ---- } ! public DateHandler(Date startDate, Date endDate) { df = DateFormat.getDateInstance(DateFormat.SHORT); df_ddMM = new SimpleDateFormat("dd/MM"); dmf = new SimpleDateFormat("MMMMM"); *************** *** 197,200 **** --- 195,204 ---- intVal = Integer.valueOf(str).intValue(); cal.set(Calendar.DATE, intVal); + + cal.set(Calendar.HOUR, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); } *************** *** 202,206 **** public static Date getDate(Element ele) { String label = ele.getFirstChild().getNodeValue(); ! return DateHandler.getDate(label); } --- 206,210 ---- public static Date getDate(Element ele) { String label = ele.getFirstChild().getNodeValue(); ! return getDate(label); } Index: PlanRenderer.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/PlanRenderer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PlanRenderer.java 2 Sep 2003 08:43:15 -0000 1.1 --- PlanRenderer.java 2 Sep 2003 08:54:20 -0000 1.2 *************** *** 127,131 **** g2.drawString(title, pos, 18); ! DateHandler dh = new DateHandler(this, startDate, endDate); g2.setPaint(Color.BLACK); --- 127,131 ---- g2.drawString(title, pos, 18); ! DateHandler dh = new DateHandler(startDate, endDate); g2.setPaint(Color.BLACK); |
From: <nic...@us...> - 2003-09-02 08:48:23
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/designer/tabs/allChart In directory sc8-pr-cvs1:/tmp/cvs-serv10402/src/java/org/krysalis/jcharts/designer/tabs/allChart Modified Files: ChartPropertiesTab.java Log Message: Organize imports. Index: ChartPropertiesTab.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/designer/tabs/allChart/ChartPropertiesTab.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ChartPropertiesTab.java 9 Aug 2003 17:07:22 -0000 1.1 --- ChartPropertiesTab.java 2 Sep 2003 08:48:19 -0000 1.2 *************** *** 37,46 **** import org.krysalis.jcharts.designer.common.font.FontChooser; import org.krysalis.jcharts.designer.common.stroke.StrokeChooser; import org.krysalis.jcharts.designer.exceptions.DesignerException; - import org.krysalis.jcharts.properties.ChartProperties; - - import javax.swing.*; --- 37,45 ---- + import javax.swing.JPanel; + import org.krysalis.jcharts.designer.common.font.FontChooser; import org.krysalis.jcharts.designer.common.stroke.StrokeChooser; import org.krysalis.jcharts.designer.exceptions.DesignerException; |
From: <nic...@us...> - 2003-09-02 08:48:22
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/demo/samples In directory sc8-pr-cvs1:/tmp/cvs-serv10402/src/java/org/krysalis/jcharts/demo/samples Modified Files: Pie3DSamples.java Log Message: Organize imports. Index: Pie3DSamples.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/demo/samples/Pie3DSamples.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Pie3DSamples.java 9 Aug 2003 19:45:51 -0000 1.1 --- Pie3DSamples.java 2 Sep 2003 08:48:19 -0000 1.2 *************** *** 2,17 **** import org.krysalis.jcharts.chartData.ChartDataException; import org.krysalis.jcharts.chartData.PieChartDataSet; ! import org.krysalis.jcharts.properties.PieChart3DProperties; ! import org.krysalis.jcharts.properties.LegendProperties; ! import org.krysalis.jcharts.properties.LegendAreaProperties; import org.krysalis.jcharts.properties.ChartProperties; import org.krysalis.jcharts.properties.util.ChartStroke; import org.krysalis.jcharts.types.PieLabelType; - import org.krysalis.jcharts.nonAxisChart.PieChart3D; - import org.krysalis.jcharts.test.ChartTestDriver; - - import java.awt.*; --- 2,16 ---- + import java.awt.Color; + import java.awt.Paint; + import org.krysalis.jcharts.chartData.ChartDataException; import org.krysalis.jcharts.chartData.PieChartDataSet; ! import org.krysalis.jcharts.nonAxisChart.PieChart3D; import org.krysalis.jcharts.properties.ChartProperties; + import org.krysalis.jcharts.properties.LegendProperties; + import org.krysalis.jcharts.properties.PieChart3DProperties; import org.krysalis.jcharts.properties.util.ChartStroke; import org.krysalis.jcharts.types.PieLabelType; |
From: <nic...@us...> - 2003-09-02 08:48:22
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/designer/tabs/nonAxisChart In directory sc8-pr-cvs1:/tmp/cvs-serv10402/src/java/org/krysalis/jcharts/designer/tabs/nonAxisChart Modified Files: PieChartTab.java Log Message: Organize imports. Index: PieChartTab.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/designer/tabs/nonAxisChart/PieChartTab.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PieChartTab.java 9 Aug 2003 17:07:23 -0000 1.1 --- PieChartTab.java 2 Sep 2003 08:48:19 -0000 1.2 *************** *** 12,19 **** ! import org.krysalis.jcharts.designer.common.font.FontChooser; ! import org.krysalis.jcharts.designer.common.stroke.StrokeChooser; ! import javax.swing.*; --- 12,18 ---- ! import javax.swing.JPanel; ! import org.krysalis.jcharts.designer.common.stroke.StrokeChooser; |
From: <nic...@us...> - 2003-09-02 08:46:30
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/axisChart In directory sc8-pr-cvs1:/tmp/cvs-serv10113/src/java/org/krysalis/jcharts/axisChart Modified Files: AxisChart.java Log Message: Comment out unused imports. Index: AxisChart.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/axisChart/AxisChart.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AxisChart.java 28 Aug 2003 01:52:30 -0000 1.5 --- AxisChart.java 2 Sep 2003 08:46:26 -0000 1.6 *************** *** 71,76 **** // Dual Y axis changes integrated CMC 25Aug03 ! import java.lang.Math.*; ! import java.lang.Float.*; --- 71,76 ---- // Dual Y axis changes integrated CMC 25Aug03 ! //import java.lang.Math.*; ! //import java.lang.Float.*; |
From: <nic...@us...> - 2003-09-02 08:45:59
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/properties/util In directory sc8-pr-cvs1:/tmp/cvs-serv10020/src/java/org/krysalis/jcharts/properties/util Modified Files: ChartItem.java ChartFont.java Log Message: Switch from @deprecation to @todo. Index: ChartItem.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/properties/util/ChartItem.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ChartItem.java 25 Jun 2003 01:39:25 -0000 1.2 --- ChartItem.java 2 Sep 2003 08:45:55 -0000 1.3 *************** *** 67,71 **** * * @return paint ! * @deprecated if this method is going to exist, it would have to return a clone of the Paint to keep people from modifying contents *****************************************/ public Paint getPaint() --- 67,71 ---- * * @return paint ! * @todo if this method is going to exist, it would have to return a clone of the Paint to keep people from modifying contents *****************************************/ public Paint getPaint() Index: ChartFont.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/properties/util/ChartFont.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ChartFont.java 25 Jun 2003 01:39:25 -0000 1.2 --- ChartFont.java 2 Sep 2003 08:45:55 -0000 1.3 *************** *** 91,95 **** * * @return font ! * @deprecated this allows you to modify the Font **************************************************************************************/ public Font getFont() --- 91,95 ---- * * @return font ! * @todo this allows you to modify the Font **************************************************************************************/ public Font getFont() |
From: <nic...@us...> - 2003-09-02 08:44:05
|
Update of /cvsroot/jcharts/krysalis-jcharts In directory sc8-pr-cvs1:/tmp/cvs-serv9767 Modified Files: .classpath Log Message: Make scratchpad built by eclipse. Index: .classpath =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/.classpath,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .classpath 28 Aug 2003 15:42:57 -0000 1.2 --- .classpath 2 Sep 2003 08:44:02 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- <classpath> <classpathentry kind="src" path="src/java"/> + <classpathentry kind="src" path="src/scratchpad"/> <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/> <classpathentry kind="lib" path="lib/batik-awt-util.jar"/> *************** *** 9,12 **** <classpathentry kind="lib" path="lib/batik-xml.jar"/> <classpathentry kind="lib" path="lib/servlet_2_2.jar"/> ! <classpathentry kind="output" path="build"/> </classpath> --- 10,13 ---- <classpathentry kind="lib" path="lib/batik-xml.jar"/> <classpathentry kind="lib" path="lib/servlet_2_2.jar"/> ! <classpathentry kind="output" path="build"/> </classpath> |
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv9658 Added Files: RowItem.java Row.java PlanRenderer.java Plan.java DateHandler.java Log Message: Initial scratchpad commit of gantt chart impl. Still using it for another project in the making, so it will change a lot. --- NEW FILE: RowItem.java --- /*********************************************************************************************** * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved. * * Redistribution and use of this software and associated documentation ("Software"), with or * without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain copyright statements and notices. * Redistributions must also contain a copy of this document. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to endorse or promote * products derived from this Software without prior written permission of Nathaniel G. * Auvil. For written permission, please contact nat...@us... * * 4. Products derived from this Software may not be called "jCharts" nor may "jCharts" appear * in their names without prior written permission of Nathaniel G. Auvil. jCharts is a * registered trademark of Nathaniel G. Auvil. * * 5. Due credit should be given to the jCharts Project (http://jcharts.sourceforge.net/). * * THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE ************************************************************************************************/ package org.krysalis.jcharts.gantt; import java.util.Date; /** * @author Nicola Ken Barozzi * @version $Id: RowItem.java,v 1.1 2003/09/02 08:43:15 nicolaken Exp $ **/ public class RowItem { private Date startDate, endDate; private String color = "blue"; /** * Returns the endDate. * @return Date */ public Date getEndDate() { return endDate; } /** * Returns the startDate. * @return Date */ public Date getStartDate() { return startDate; } /** * Sets the endDate. * @param endDate The endDate to set */ public void setEndDate(Date endDate) { this.endDate = endDate; } /** * Sets the startDate. * @param startDate The startDate to set */ public void setStartDate(Date startDate) { this.startDate = startDate; } /** * Returns the color. * @return Date */ public String getColor() { return color; } /** * Sets the color. * @param color The color to set */ public void setColor(String color) { this.color = color; } } --- NEW FILE: Row.java --- /*********************************************************************************************** * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved. * * Redistribution and use of this software and associated documentation ("Software"), with or * without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain copyright statements and notices. * Redistributions must also contain a copy of this document. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to endorse or promote * products derived from this Software without prior written permission of Nathaniel G. * Auvil. For written permission, please contact nat...@us... * * 4. Products derived from this Software may not be called "jCharts" nor may "jCharts" appear * in their names without prior written permission of Nathaniel G. Auvil. jCharts is a * registered trademark of Nathaniel G. Auvil. * * 5. Due credit should be given to the jCharts Project (http://jcharts.sourceforge.net/). * * THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE ************************************************************************************************/ package org.krysalis.jcharts.gantt; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * @author Nicola Ken Barozzi * @version $Id: Row.java,v 1.1 2003/09/02 08:43:15 nicolaken Exp $ **/ public class Row { private DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); Date startDate; Date endDate; String owner; String label; int type = TASK; public static final int TASK = 1; public static final int MILESTONE = 2; public static final int GROUPING = 3; String dependant = ""; ArrayList milestones = new ArrayList(); private ArrayList smilestones = new ArrayList(); ArrayList multiplicities = new ArrayList(); ArrayList rowItems = new ArrayList(); String color = "lightblue"; public void setType(int t) { type = t; } public int getType() { return type; } public void setLabel(String str) { label = str; } public void setOwner(String str) { owner = str; } public void setStartDate(Date sd) { startDate = sd; if (endDate == null) { endDate = startDate; } } public void setEndDate(Date ed) { endDate = ed; } public String getLabel() { return label; } public String getOwner() { return owner; } public Date getStartDate() { return startDate; } public Date getEndDate() { return endDate; } /** * Method addMilestone. * @param dat */ public void addMilestone(Date dat) { //I have to use a string format as dates are not //correctly checked for .equals() even if I set hours //times and minutes to 0 (still dunno why) String sdat = df.format(dat); int place = smilestones.indexOf(sdat); if (place > -1) { int currentM = ((Integer) multiplicities.get(place)).intValue(); multiplicities.set(place, new Integer(currentM + 1)); } else { milestones.add(dat); smilestones.add(sdat); multiplicities.add(new Integer(1)); } } public void addRowItem(RowItem rowItem) { rowItems.add(rowItem); } public List getRowItems() { return rowItems; } public List milestones() { return milestones; } public List multiplicities() { return multiplicities; } /** * Method setColor. * @param string * @return String */ public void setColor(String color) { this.color = color; } public String getColor() { return color; } } --- NEW FILE: PlanRenderer.java --- /*********************************************************************************************** * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved. * * Redistribution and use of this software and associated documentation ("Software"), with or * without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain copyright statements and notices. * Redistributions must also contain a copy of this document. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to endorse or promote * products derived from this Software without prior written permission of Nathaniel G. * Auvil. For written permission, please contact nat...@us... * * 4. Products derived from this Software may not be called "jCharts" nor may "jCharts" appear * in their names without prior written permission of Nathaniel G. Auvil. jCharts is a * registered trademark of Nathaniel G. Auvil. * * 5. Due credit should be given to the jCharts Project (http://jcharts.sourceforge.net/). * * THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE ************************************************************************************************/ package org.krysalis.jcharts.gantt; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Shape; import java.awt.font.LineMetrics; import java.awt.geom.Line2D; import java.awt.geom.Rectangle2D; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; /** * @author Nicola Ken Barozzi * @version $Id: PlanRenderer.java,v 1.1 2003/09/02 08:43:15 nicolaken Exp $ **/ public class PlanRenderer { int fontSize = 9; String fontFamily = "SansSerif"; float lSpace = 15; java.awt.Font font = new java.awt.Font(fontFamily, java.awt.Font.PLAIN, (int) fontSize); int barHeigth = 12; int barspaceHeight = 20; int barHeightMargin = (barspaceHeight - barHeigth) / 2; int barspaceWidth = 700; int firstSpaceWidth = 250; int secondSpaceWidth = 100; int leftWidth = secondSpaceWidth + firstSpaceWidth; int milestoneWidth = 6; int milestoneMinHeight = 3; int milestoneMaxHeight = 10; public void render( Graphics2D g2, String title, List data, Date startDate, Date endDate, HashMap hints) { //@todo int height = 6000; int width = leftWidth + barspaceWidth; String[] colours; String[] darkcolours; Font font = new Font(fontFamily, Font.PLAIN, fontSize); g2.setFont(font); //@todo String height LineMetrics lm = font.getLineMetrics(title, g2.getFontRenderContext()); float currentTopEdge = lm.getHeight() + 5; float rightEdge; Shape clip0 = new Rectangle2D.Float(0, 0, width, height); Shape clip1 = new Rectangle2D.Float(0, 0, firstSpaceWidth, height); Shape clip2 = new Rectangle2D.Float(firstSpaceWidth, 0, secondSpaceWidth, height); Shape clip3 = new Rectangle2D.Float(leftWidth, 0, width - leftWidth, height); g2.clip(clip0); g2.setBackground(Color.WHITE); g2.setPaint(Color.WHITE); g2.fill(new Rectangle2D.Float(0, 0, width, height)); //visually debug clip zones // g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float)0.5)); // g2.setPaint(Color.YELLOW); // g2.fill(clip1); // g2.setPaint(Color.BLUE); // g2.fill(clip2); // g2.setPaint(Color.RED); // g2.fill(clip3); // g2.setPaintMode(); float strwidth = (float) font.getStringBounds(title, g2.getFontRenderContext()).getWidth(); float pos = (float) (80 - strwidth / 2.0); if (pos < 5) { pos = 5; } g2.setPaint(Color.BLACK); g2.drawString(title, pos, 18); DateHandler dh = new DateHandler(this, startDate, endDate); g2.setPaint(Color.BLACK); g2.draw(new Line2D.Float(0, currentTopEdge, width, currentTopEdge)); //firstdate g2.drawString( dh.simpleFormat(dh.getLastWeek()), leftWidth + 1, currentTopEdge - 1); //lastdate g2.drawString( dh.simpleFormat(dh.getFuture()), (int) width, (int) currentTopEdge - 1); g2.setPaint(new Color(150, 150, 150)); g2.draw( new Line2D.Float( firstSpaceWidth, currentTopEdge, firstSpaceWidth, height)); int offset = 0; Calendar cal = Calendar.getInstance(); cal.setTime(dh.getLastWeek()); for (int count = dh.getStartDay(); count < dh.getStartDay() + dh.getTotalDays() - 1; count++, offset++) { cal.roll(Calendar.DAY_OF_YEAR, true); float currentDateLocation = leftWidth + (offset) * (width - leftWidth) / (dh.getTotalDays() - 2); if (count % 7 == 6 || count % 7 == 0) { //Saturday and sunday g2.setPaint(new Color(230, 230, 230)); Shape holidayDay = new Rectangle2D.Float( currentDateLocation, (float) (currentTopEdge + 0.5), (float) ((width - leftWidth) / (dh.getTotalDays() - 3)), (height - 1 - 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 + 0.5), (float) ((width - leftWidth) / (dh.getTotalDays() - 3)), (height - 1 - 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()), (int) currentDateLocation, (int) (currentTopEdge - 1)); g2.setPaint(Color.BLACK); g2.draw( new Line2D.Float( currentDateLocation, (float) (currentTopEdge + 0.5), currentDateLocation, (height - 1 - currentTopEdge))); } } //for each action for (int currentActionIndex = 0; currentActionIndex < data.size(); currentActionIndex++) { Row currentAction = (Row) data.get(currentActionIndex); String name = currentAction.getOwner(); String label = currentAction.getLabel(); g2.setPaint(Color.BLACK); g2.setClip(clip1); g2.drawString(label, 0, currentTopEdge + 12); g2.setClip(null); g2.setClip(clip2); g2.drawString(name, firstSpaceWidth, currentTopEdge + 12); g2.setClip(null); int type = currentAction.getType(); Date start = DateHandler.cleanDay(currentAction.getStartDate()); Date end = DateHandler.cleanDay(currentAction.getEndDate()); if (end.after(dh.getLastWeek()) && start.before(dh.getFuture())) { //showing = true; int daysToStart = dh.getDayDiff(start, dh.getLastWeek()); int days = dh.getDayDiff(end, start); int daysFromEnd = dh.getDayDiff(dh.getFuture(), end); switch (type) { case Row.TASK : //the bar itself Shape taskGraphic = new Rectangle2D.Float( leftWidth + 1 + daysToStart * barspaceWidth / (dh.getTotalDays() - 2), currentTopEdge + barHeightMargin, (days + 1) * barspaceWidth / (dh.getTotalDays() - 2), barHeigth); g2.setClip(clip3); g2.setPaint(Color.decode(currentAction.getColor())); g2.fill(taskGraphic); g2.setPaint(Color.BLACK); g2.draw(taskGraphic); //@todo add descr //addDescr(doc, taskGraphic, name); //start and end dates g2.setPaint(Color.BLACK); g2.drawString( dh.simpleFormat(start), leftWidth + daysToStart * barspaceWidth / (dh.getTotalDays() - 2) - 25, currentTopEdge + 9); g2.drawString( dh.simpleFormat(end), leftWidth + daysToStart * barspaceWidth / (dh.getTotalDays() - 2) + days * barspaceWidth / (dh.getTotalDays() - 2) + 5, currentTopEdge + 9); g2.setClip(null); //rowItems List fragments = currentAction.getRowItems(); int fragmentsSize = fragments.size(); for (int i = 0; i < fragmentsSize; i++) { RowItem fragment = (RowItem) fragments.get(i); Date fragmentStart = DateHandler.cleanDay(fragment.getStartDate()); Date fragmentEnd = DateHandler.cleanDay(fragment.getEndDate()); int fragmentDays = dh.getDayDiff(fragmentEnd, fragmentStart); int fragmentdaysToStart = dh.getDayDiff(fragmentStart, dh.getLastWeek()); //the other bars taskGraphic = new Rectangle2D.Float( leftWidth + fragmentdaysToStart * barspaceWidth / (dh.getTotalDays() - 2), currentTopEdge + barHeightMargin, fragmentDays * barspaceWidth / (dh.getTotalDays() - 2), barHeigth); g2.setClip(clip3); g2.setPaint(Color.decode(fragment.getColor())); g2.fill(taskGraphic); g2.setPaint(Color.BLACK); g2.draw(taskGraphic); } //milestones List multiplicities = currentAction.multiplicities(); List milestones = currentAction.milestones(); //debug // System.out.println(label); // for (Iterator i = v.iterator(); i.hasNext();) { // System.out.println(i.next()); // // } int milestonesSize = milestones.size(); for (int i = 0; i < milestonesSize; i++) { int multiplicity = ((Integer) multiplicities.get(i)).intValue(); Date milestoneStart = DateHandler.cleanDay((Date) milestones.get(i)); int daysToStartMilestone = dh.getDayDiff(milestoneStart, dh.getLastWeek()); float mul = PlanRenderer.normalizeMultiplicity4Bar( multiplicity, milestoneMinHeight, milestoneMinHeight); Shape milestoneShape = new Rectangle2D.Float( (float) leftWidth + daysToStartMilestone * barspaceWidth / (dh.getTotalDays() - 2), (float) currentTopEdge + barspaceHeight - barHeightMargin - mul, (float) milestoneWidth, mul); int normMult = PlanRenderer.normalizeMultiplicity4Color(multiplicity); g2.setClip(clip3); g2.setPaint(new Color(normMult, 0, 0)); g2.fill(milestoneShape); g2.setPaint(Color.BLACK); g2.draw(milestoneShape); g2.setClip(null); } break; //@cat milestone case Row.MILESTONE : //@todo milestone break; case Row.GROUPING : //group bar taskGraphic = new Rectangle2D.Float( leftWidth + 1 + daysToStart * barspaceWidth / (dh.getTotalDays() - 2), currentTopEdge + barHeightMargin, (days + 1) * barspaceWidth / (dh.getTotalDays() - 2), barHeigth); g2.setClip(clip3); g2.setPaint(Color.BLACK); g2.fill(taskGraphic); g2.setPaint(Color.BLACK); g2.draw(taskGraphic); break; default : break; } } currentTopEdge += barspaceHeight; } 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)); } public static float normalizeMultiplicity4Bar( int multiplicity, int min, int max) { int partial = multiplicity / 2 + 1; if (partial > 12) { partial = 12; } return (float) partial; } public static int normalizeMultiplicity4Color(int multiplicity) { int partial = 100 + multiplicity * 2; if (partial > 200) { partial = 255; } return partial; } } --- NEW FILE: Plan.java --- /*********************************************************************************************** * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved. * * Redistribution and use of this software and associated documentation ("Software"), with or * without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain copyright statements and notices. * Redistributions must also contain a copy of this document. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to endorse or promote * products derived from this Software without prior written permission of Nathaniel G. * Auvil. For written permission, please contact nat...@us... * * 4. Products derived from this Software may not be called "jCharts" nor may "jCharts" appear * in their names without prior written permission of Nathaniel G. Auvil. jCharts is a * registered trademark of Nathaniel G. Auvil. * * 5. Due credit should be given to the jCharts Project (http://jcharts.sourceforge.net/). * * THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE ************************************************************************************************/ package org.krysalis.jcharts.gantt; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import javax.swing.JPanel; import org.apache.batik.dom.GenericDOMImplementation; import org.apache.batik.svggen.SVGGraphics2D; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * @author Nicola Ken Barozzi * @version $Id: Plan.java,v 1.1 2003/09/02 08:43:15 nicolaken Exp $ **/ public class Plan extends JPanel{ private HashMap hints = new HashMap(); private String title; private List data; private Date startDate; private Date endDate; private PlanRenderer planDrawer = new PlanRenderer(); /** * Empty Constructor */ public Plan() { } public void load(Document planDoc) { Element root = planDoc.getDocumentElement(); String start = root.getAttribute("start"); startDate = DateHandler.getDate(start); String end = root.getAttribute("end"); endDate = DateHandler.getDate(end); title = root.getAttribute("title"); NodeList children = ((Element) root).getChildNodes(); data = new ArrayList(); for (int i = 0; i < children.getLength(); i++) { if("action".equals( children.item(i).getNodeName())) { Element currentElement = (Element) children.item(i); String t = currentElement.getAttribute("type"); NodeList childs = currentElement.getChildNodes(); Row currentRow = new Row(); if (t.equals("milestone")) { currentRow.setType(Row.MILESTONE); } else if (t.equals("task")) { currentRow.setType(Row.TASK); } else if (t.equals("grouping")) { currentRow.setType(Row.GROUPING); } else { } for (int i1 = 0; i1 < childs.getLength(); i1++) { Node obj = childs.item(i1); String nname = obj.getNodeName(); if (nname.equals("label")) { String dat5 = ((Element) obj).getFirstChild().getNodeValue(); currentRow.setLabel(dat5); } else if (nname.equals("owner")) { String dat1 = ((Element) obj).getFirstChild().getNodeValue(); currentRow.setOwner(dat1); } else if (nname.equals("startdate")) { Date dat3 = DateHandler.getDate((Element) obj); currentRow.setStartDate(dat3); } else if (nname.equals("enddate")) { Date dat4 = DateHandler.getDate((Element) obj); currentRow.setEndDate(dat4); } else if (nname.equals("color")) { currentRow.setColor(((Element) obj).getFirstChild().getNodeValue()); } else if (nname.equals("milestones")) { NodeList milestones = obj.getChildNodes(); for (int k = 0; k < milestones.getLength(); k++) { Node currentNode = milestones.item(k); if (currentNode.getNodeName().equals("milestone")) { NodeList els = currentNode.getChildNodes(); for (int m = 0; m < els.getLength(); m++) { currentNode = els.item(m); String currentNodeName = currentNode.getNodeName(); if (currentNodeName.equals("startdate")) { Date dat7 = DateHandler.getDate((Element) currentNode); currentRow.addMilestone(dat7); } } } } } else if (nname.equals("rowItems")) { NodeList fragments = obj.getChildNodes(); for (int k = 0; k < fragments.getLength(); k++) { Node currentNode = fragments.item(k); if (currentNode.getNodeName().equals("fragment")) { NodeList els = currentNode.getChildNodes(); RowItem fragment = new RowItem(); for (int m = 0; m < els.getLength(); m++) { currentNode = els.item(m); String currentNodeName = currentNode.getNodeName(); if (currentNodeName.equals("startdate")) { Date dat2 = DateHandler.getDate((Element) currentNode); fragment.setStartDate(dat2); } if (currentNodeName.equals("enddate")) { Date dat6 = DateHandler.getDate((Element) currentNode); fragment.setEndDate(dat6); } } currentRow.addRowItem(fragment); } } } } Row dat = currentRow; data.add(dat); }} } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if(data!=null&&planDrawer!=null) { planDrawer.render(g2, title, data, startDate, endDate, hints); } } public Dimension getPreferredSize() { //@todo use real width and hight! return new Dimension(1100, 6000); } public void saveAsSvg(File outFile) throws IOException { //Get a DOMImplementation DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); // Create an instance of org.w3c.dom.Document Document document = domImpl.createDocument(null, "svg", null); // Create an instance of the SVG Generator SVGGraphics2D svgGenerator = new SVGGraphics2D(document); // Ask the test to render into the SVG Graphics2D implementation planDrawer.render(svgGenerator, title, data, startDate, endDate, hints); // Finally, stream out SVG to the standard output using UTF-8 // character to byte encoding boolean useCSS = true; // we want to use CSS style attribute Writer out = new BufferedWriter(new FileWriter(outFile)); svgGenerator.stream(out, useCSS); } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } } --- NEW FILE: DateHandler.java --- /*********************************************************************************************** * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved. * * Redistribution and use of this software and associated documentation ("Software"), with or * without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain copyright statements and notices. * Redistributions must also contain a copy of this document. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to endorse or promote * products derived from this Software without prior written permission of Nathaniel G. * Auvil. For written permission, please contact nat...@us... * * 4. Products derived from this Software may not be called "jCharts" nor may "jCharts" appear * in their names without prior written permission of Nathaniel G. Auvil. jCharts is a * registered trademark of Nathaniel G. Auvil. * * 5. Due credit should be given to the jCharts Project (http://jcharts.sourceforge.net/). * * THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE ************************************************************************************************/ package org.krysalis.jcharts.gantt; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import org.w3c.dom.Element; /** * @author Nicola Ken Barozzi * @version $Id: DateHandler.java,v 1.1 2003/09/02 08:43:15 nicolaken Exp $ **/ public class DateHandler { private final PlanRenderer dh; private Date currentDate; private long currentTime; private Date startDate; private Date endDate; private Date lastWeek; private Date future; private Calendar lw; private long totalDays; private int startDay; private DateFormat df; private DateFormat dmf; private DateFormat df_ddMM; public String format(Date d) { return df.format(d); } public String simpleFormat(Date d) { return df_ddMM.format(d); } public String monthFormat(Date d) { return dmf.format(d); } public Date getCurrentDate() { return currentDate; } public long getCurrentTime() { return currentTime; } public Date getEndDate() { return endDate; } public Date getFuture() { return future; } public Date getLastWeek() { return lastWeek; } public Calendar getLw() { return lw; } public Date getStartDate() { return startDate; } public int getStartDay() { return startDay; } public long getTotalDays() { return totalDays; } public boolean isToday(Calendar cal) { Calendar currcal = Calendar.getInstance(); currcal.setTime(currentDate); int day = cal.get(Calendar.DAY_OF_MONTH); int currday = currcal.get(Calendar.DAY_OF_MONTH); int month = cal.get(Calendar.MONTH); int currmonth = currcal.get(Calendar.MONTH); int year = cal.get(Calendar.YEAR); int curryear = currcal.get(Calendar.YEAR); if (day == currday && month == currmonth && year == curryear) { return true; } else { return false; } } public int getDayDiff(Date start, Date end) { return (int) ((DateHandler.cleanDay(start).getTime() - DateHandler.cleanDay(end).getTime() + 43200000) / 86400000); } public DateHandler(PlanRenderer renderer, Date startDate, Date endDate) { df = DateFormat.getDateInstance(DateFormat.SHORT); this.dh = renderer; df_ddMM = new SimpleDateFormat("dd/MM"); dmf = new SimpleDateFormat("MMMMM"); //calculate the date this.currentDate = DateHandler.cleanDay(new Date()); this.currentTime = currentDate.getTime(); this.startDate = DateHandler.cleanDay(startDate); this.endDate = DateHandler.cleanDay(endDate); lastWeek = DateHandler.cleanDay(startDate); future = DateHandler.cleanDay(endDate); lw = Calendar.getInstance(); if (lastWeek == null || future == null) { int dow = lw.get(Calendar.DAY_OF_WEEK); lw.add(Calendar.DATE, -dow - 6); lastWeek = DateHandler.cleanDay(lw.getTime()); lw.add(Calendar.DATE, 5 * 7); future = DateHandler.cleanDay(lw.getTime()); } totalDays = (long) ((future.getTime() - lastWeek.getTime() + 43200000) / 86400000); lw.setTime(lastWeek); startDay = lw.get(Calendar.DAY_OF_WEEK); df.format(currentDate); } public static Date cleanDay(long date) { return DateHandler.cleanDay(new Date(date)); } public static Date cleanDay(int date) { return DateHandler.cleanDay(new Date(date)); } public static Date cleanDay(Date date) { date.setHours(0); date.setMinutes(0); date.setSeconds(0); return date; } public static Date getDate(String label) { Calendar cal = Calendar.getInstance(); String str; str = label.substring(0, 4); int intVal = Integer.valueOf(str).intValue(); cal.set(Calendar.YEAR, intVal); str = label.substring(4, 6); intVal = Integer.valueOf(str).intValue(); cal.set(Calendar.MONTH, intVal - 1); str = label.substring(6, 8); intVal = Integer.valueOf(str).intValue(); cal.set(Calendar.DATE, intVal); return cal.getTime(); } public static Date getDate(Element ele) { String label = ele.getFirstChild().getNodeValue(); return DateHandler.getDate(label); } public static String fixDate(String date) { if (date.length() == 8) { try { return formatDate(parseDate(date)); } catch (ParseException e) { System.err.println(e); return "ERROR"; } } else { return date; } } private static Date parseDate(String date) throws ParseException { DateFormat formatter = new SimpleDateFormat("yyyyMMdd"); return (Date) formatter.parse(date); } private static String formatDate(Date date) throws ParseException { DateFormat formatter = new SimpleDateFormat("dd/MM"); return formatter.format(date); } //TODO ! add year handling!!! public static String getStringDateFromWeek(int week, boolean startDay) throws ParseException { System.out.println("TRANSFORMING WEEK: " + String.valueOf(week)); Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.set(Calendar.WEEK_OF_YEAR, week); if (startDay) { c.roll(Calendar.DATE, -4); } // String resultYear = String.valueOf(c.get(Calendar.YEAR)); // String resultMonth = String.valueOf(c.get(Calendar.MONTH)); // if(resultMonth.length()==1){resultMonth="0"+resultMonth;} // String resultDay = String.valueOf(c.get(Calendar.DATE)); // if(resultDay.length()==1){resultDay="0"+resultMonth;} // return resultYear+resultMonth+resultDay; DateFormat formatter = new SimpleDateFormat("yyyyMMdd"); return formatter.format(c.getTime()); } } |
From: <nic...@us...> - 2003-09-02 08:42:57
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis In directory sc8-pr-cvs1:/tmp/cvs-serv9339/krysalis Log Message: Directory /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis added to the repository |
From: <nic...@us...> - 2003-09-02 08:42:48
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad In directory sc8-pr-cvs1:/tmp/cvs-serv9232/scratchpad Log Message: Directory /cvsroot/jcharts/krysalis-jcharts/src/scratchpad added to the repository |
From: <nic...@us...> - 2003-09-02 08:42:44
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org In directory sc8-pr-cvs1:/tmp/cvs-serv9302/org Log Message: Directory /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org added to the repository |
From: <nic...@us...> - 2003-09-02 08:42:42
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv9463/gantt Log Message: Directory /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt added to the repository |
From: <nic...@us...> - 2003-09-02 08:42:37
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts In directory sc8-pr-cvs1:/tmp/cvs-serv9392/jcharts Log Message: Directory /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts added to the repository |
From: <nat...@us...> - 2003-09-02 01:40:35
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/documentation/resources/images/userGuide/pieCharts In directory sc8-pr-cvs1:/tmp/cvs-serv13768/pieCharts Log Message: Directory /cvsroot/jcharts/krysalis-jcharts/src/documentation/resources/images/userGuide/pieCharts added to the repository |
From: <nat...@us...> - 2003-09-01 18:15:34
|
Update of /cvsroot/jcharts/krysalis-jcharts In directory sc8-pr-cvs1:/tmp/cvs-serv1644 Modified Files: build.xml Log Message: got the release target working again Index: build.xml =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/build.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** build.xml 30 Aug 2003 15:45:15 -0000 1.6 --- build.xml 1 Sep 2003 18:15:30 -0000 1.7 *************** *** 130,194 **** <!--===============================================================================--> <!--===============================================================================--> ! <target name="release" depends="jar"> ! <delete dir="${dir.release}"/> <mkdir dir="${dir.release}"/> ! <!-- //todo need to build WAR of examples --> ! <!-- //todo need to run javadocs target --> ! ! ! <!--======== jCharts.jar ==============================================--> ! <move file="${jar.jCharts}" todir="${dir.release}"/> ! ! <!--======== jCharts source ===========================================--> ! <copy todir="${dir.release}/${dir.src}"> ! <fileset dir="../${dir.src}"> ! <include name="**/*.java"/> ! </fileset> </copy> ! <copy todir="${dir.release}/demo"> ! <fileset dir="../demo"> ! <include name="**/*.java"/> ! <include name="**/*.xml"/> </fileset> </copy> ! <!--======== servlet examples war =====================================--> ! <move file="${servletExamples.war}" todir="${dir.release}"/> ! ! <!--======== servlet examples source ==================================--> ! <copy todir="${dir.release}/${dir.servletsApp}"> ! <fileset dir="../demo/simpleServlet/"> ! <exclude name="**/*.class"/> ! <exclude name="**/*.jar"/> </fileset> ! </copy> ! <!--======== java docs =================================================--> ! <move todir="${dir.release}/${dir.javadocs}"> <fileset dir="${dir.javadocs}"/> </move> - <!--======== build directory ===========================================--> - <mkdir dir="${dir.release}/build"/> - <copy file="build.xml" todir="${dir.release}/build"/> - - <!--======== docs directory ============================================--> - <copy todir="${dir.release}/docs"> - <fileset dir="../docs"/> - </copy> - - - <!--======== lib directory ============================================--> - <copy todir="${dir.release}/lib"> - <fileset dir="../lib"/> - </copy> - <!--======== make the ZIP file =========================================--> --- 130,170 ---- <!--===============================================================================--> <!--===============================================================================--> ! <target name="release" depends="jar,war,javadocs"> ! <delete dir="${dir.build}"/> <delete dir="${dir.release}"/> <mkdir dir="${dir.release}"/> ! <copy todir="${dir.release}/src/java"> ! <fileset dir="src/java"/> ! </copy> ! <copy todir="${dir.release}/legal"> ! <fileset dir="legal"/> ! </copy> ! <copy todir="${dir.release}/lib"> ! <fileset dir="lib"/> </copy> ! <copy todir="${dir.release}"> ! <fileset dir="."> ! <include name="build.xml"/> </fileset> </copy> ! <move todir="${dir.release}"> ! <fileset dir="."> ! <include name="${jar.jCharts}"/> ! <include name="${servletExamples.war}"/> </fileset> ! </move> ! <mkdir dir="${dir.release}/javadocs"/> ! <move todir="${dir.release}/javadocs"> <fileset dir="${dir.javadocs}"/> </move> <!--======== make the ZIP file =========================================--> *************** *** 197,200 **** --- 173,177 ---- <fileset dir="${dir.release}/.."/> </zip> + <delete dir="${dir.release}/.."/> </target> |
From: <nat...@us...> - 2003-09-01 18:15:10
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/documentation/content/xdocs In directory sc8-pr-cvs1:/tmp/cvs-serv1529 Modified Files: antTargets.xml Log Message: got the release target working so updated the docs Index: antTargets.xml =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/documentation/content/xdocs/antTargets.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** antTargets.xml 29 Aug 2003 20:10:44 -0000 1.1 --- antTargets.xml 1 Sep 2003 18:15:05 -0000 1.2 *************** *** 5,9 **** <title>Ant Build Targets</title> <authors> ! <person name="Nathaniel Auvil" email=""/> </authors> </header> --- 5,9 ---- <title>Ant Build Targets</title> <authors> ! <person name="Nathaniel Auvil" email="jch...@li..."/> </authors> </header> *************** *** 56,69 **** - <section> <title>war</title> <p> </p> </section> <section> <title>release</title> <p> </p> </section> --- 56,84 ---- <section> <title>war</title> <p> + Creates the <strong>jCharts</strong> Servlet and JSP demo Web Application. Simply drop this .war in your Servlet Containers applications folder and off you go! </p> + <p><em>Depends: jar</em></p> </section> <section> + <title>deployTomcat</title> + <p> + This is a helper Target to build and deploy the Servlet Web Application to the <link href="http://jakarta.apache.org/tomcat/">Apache Jakarta Tomcat</link> Servlet Container. + </p> + <note> + This target requires an environment variable: <strong>TOMCAT_HOME</strong> to exist and be pointing to the Apache Tomcat installation directory. + </note> + <p><em>Depends: war</em></p> + </section> + + + <section> <title>release</title> <p> + Builds the Krysalis jCharts release archive which includes <strong>everything</strong>. </p> + <p><em>Depends: jar,war,javadocs</em></p> </section> |
From: <nat...@us...> - 2003-08-30 19:01:22
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/documentation/content/xdocs In directory sc8-pr-cvs1:/tmp/cvs-serv28073 Modified Files: license.xml Log Message: updated link to project Index: license.xml =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/documentation/content/xdocs/license.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** license.xml 29 May 2003 02:44:54 -0000 1.1 --- license.xml 30 Aug 2003 19:01:19 -0000 1.2 *************** *** 16,57 **** Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved. ! Redistribution and use of this software and associated documentation ! ("Software"), with or without modification, are permitted provided ! that the following conditions are met: ! 1. Redistributions of source code must retain copyright ! statements and notices. Redistributions must also contain a ! copy of this document. ! 2. Redistributions in binary form must reproduce the ! above copyright notice, this list of conditions and the ! following disclaimer in the documentation and/or other ! materials provided with the distribution. ! 3. The name "jCharts" or any of its contributors must not be used to ! endorse or promote products derived from this Software without ! prior written permission of Nathaniel G. Auvil. For written ! permission, please contact nat...@us... ! 4. Products derived from this Software may not be called "jCharts" ! nor may "jCharts" appear in their names without prior written ! permission of Nathaniel G. Auvil. jCharts is a registered ! trademark of Nathaniel G. Auvil. ! 5. Due credit should be given to the jCharts Project ! (http://jcharts.sourceforge.net/). ! THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS ! ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT ! NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND ! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ! jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ! INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ! (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ! SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ! HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ! STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ! OF THE POSSIBILITY OF SUCH DAMAGE. </source> </section> --- 16,48 ---- Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved. ! Redistribution and use of this software and associated documentation ("Software"), with or ! without modification, are permitted provided that the following conditions are met: ! 1. Redistributions of source code must retain copyright statements and notices. ! Redistributions must also contain a copy of this document. ! 2. Redistributions in binary form must reproduce the above copyright notice, this list of ! conditions and the following disclaimer in the documentation and/or other materials ! provided with the distribution. ! 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to endorse or promote ! products derived from this Software without prior written permission of Nathaniel G. ! Auvil. For written permission, please contact nat...@us... ! 4. Products derived from this Software may not be called "jCharts" nor may "jCharts" appear ! in their names without prior written permission of Nathaniel G. Auvil. jCharts is a ! registered trademark of Nathaniel G. Auvil. ! 5. Due credit should be given to the jCharts Project (http://jcharts.krysalis.org). ! THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS ``AS IS'' AND ANY ! EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ! MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ! jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ! HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,STRICT LIABILITY, OR TORT ! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN ! IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE </source> </section> |