From: <nic...@us...> - 2003-09-04 11:45:31
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv16733/src/scratchpad/org/krysalis/jcharts/gantt Modified Files: DateHandlerTest.java DateHandler.java PlanRenderer.java Log Message: Reformat and tidy code. Index: DateHandlerTest.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/DateHandlerTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DateHandlerTest.java 3 Sep 2003 10:38:45 -0000 1.1 --- DateHandlerTest.java 4 Sep 2003 11:45:16 -0000 1.2 *************** *** 53,57 **** final public void testGetStringDateFromWeek() throws ParseException { - //TODO Implement getStringDateFromWeek(). //TRANSFORMING WEEK: 39 into: Mon Sep 22 10:36:32 CEST 2003 String result = DateHandler.getStringDateFromWeek(39, true); --- 53,56 ---- Index: DateHandler.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/DateHandler.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DateHandler.java 3 Sep 2003 10:39:49 -0000 1.8 --- DateHandler.java 4 Sep 2003 11:45:16 -0000 1.9 *************** *** 225,229 **** 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()); --- 225,230 ---- public static String getStringDateFromWeek(int week, boolean startDay) throws ParseException { ! //@debug ! //System.out.print("TRANSFORMING WEEK: " + String.valueOf(week)); Calendar c = Calendar.getInstance(); c.setTime(new Date()); *************** *** 238,242 **** Date result = c.getTime(); ! System.out.println(" into: " + result); return dateStampFormat.format(result); --- 239,244 ---- Date result = c.getTime(); ! //@debug ! //System.out.println(" into: " + result); return dateStampFormat.format(result); Index: PlanRenderer.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/PlanRenderer.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PlanRenderer.java 3 Sep 2003 10:38:08 -0000 1.9 --- PlanRenderer.java 4 Sep 2003 11:45:16 -0000 1.10 *************** *** 79,83 **** HashMap hints) { - //@todo int height = 6000; --- 79,82 ---- *************** *** 92,96 **** //@todo String height LineMetrics lm = font.getLineMetrics(title, g2.getFontRenderContext()); ! // ----------------------------------------- // Month *1 --- 91,95 ---- //@todo String height LineMetrics lm = font.getLineMetrics(title, g2.getFontRenderContext()); ! // ----------------------------------------- // Month *1 *************** *** 100,114 **** // Day *3 // ----------------------------------------- ! float singleDateHeight = (lm.getHeight() + 2); float currentTopEdge = singleDateHeight * 3; float rightEdge; Rectangle oldClipBounds = g2.getClipBounds(); ! Shape fullclip = new Rectangle2D.Float(0, 0, width, height).createIntersection(oldClipBounds); ! Shape leftclip = new Rectangle2D.Float(0, 0, firstSpaceWidth, height).createIntersection(oldClipBounds); Shape middleclip = ! new Rectangle2D.Float(firstSpaceWidth, 0, secondSpaceWidth, height).createIntersection(oldClipBounds); Shape rightclip = ! new Rectangle2D.Float(leftWidth, 0, width - leftWidth, height).createIntersection(oldClipBounds); //g2.clip(fullclip); --- 99,124 ---- // Day *3 // ----------------------------------------- ! float singleDateHeight = (lm.getHeight() + 2); float currentTopEdge = singleDateHeight * 3; float rightEdge; Rectangle oldClipBounds = g2.getClipBounds(); ! if (oldClipBounds == null) { ! oldClipBounds = new Rectangle(0, 0, width, height); ! } ! Shape fullclip = ! new Rectangle2D.Float(0, 0, width, height).createIntersection( ! oldClipBounds); ! Shape leftclip = ! new Rectangle2D.Float(0, 0, firstSpaceWidth, height).createIntersection( ! oldClipBounds); Shape middleclip = ! new Rectangle2D ! .Float(firstSpaceWidth, 0, secondSpaceWidth, height) ! .createIntersection(oldClipBounds); Shape rightclip = ! new Rectangle2D ! .Float(leftWidth, 0, width - leftWidth, height) ! .createIntersection(oldClipBounds); //g2.clip(fullclip); *************** *** 144,154 **** 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)); --- 154,166 ---- 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)); *************** *** 157,172 **** //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)); --- 169,184 ---- //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)); *************** *** 192,231 **** 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 = --- 204,255 ---- 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 = *************** *** 260,264 **** // currentDateLocation + 1, // currentTopEdge + offset*15); ! //if MONTH if (cal.get(Calendar.DAY_OF_MONTH) == 1) { --- 284,288 ---- // currentDateLocation + 1, // currentTopEdge + offset*15); ! //if MONTH if (cal.get(Calendar.DAY_OF_MONTH) == 1) { *************** *** 267,271 **** g2.drawString( dh.monthFormat(cal.getTime()), ! (int) currentDateLocation +2, (int) (topDateHeight - 2)); --- 291,295 ---- g2.drawString( dh.monthFormat(cal.getTime()), ! (int) currentDateLocation + 2, (int) (topDateHeight - 2)); *************** *** 277,281 **** currentDateLocation, (topDateHeight))); ! g2.draw( new Line2D.Float( --- 301,305 ---- currentDateLocation, (topDateHeight))); ! g2.draw( new Line2D.Float( *************** *** 336,341 **** g2.draw(taskGraphic); ! //@todo add descr ! //addDescr(doc, taskGraphic, name); //start and end dates --- 360,364 ---- g2.draw(taskGraphic); ! //@todo add tooltip //start and end dates |