From: <nic...@us...> - 2003-09-03 10:38:13
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt In directory sc8-pr-cvs1:/tmp/cvs-serv9315/src/scratchpad/org/krysalis/jcharts/gantt Modified Files: PlanRenderer.java Log Message: Fix clipping so that the component does not draw outside of bounds. Index: PlanRenderer.java =================================================================== RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/PlanRenderer.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PlanRenderer.java 2 Sep 2003 16:25:55 -0000 1.8 --- PlanRenderer.java 3 Sep 2003 10:38:08 -0000 1.9 *************** *** 38,41 **** --- 38,42 ---- import java.awt.Font; import java.awt.Graphics2D; + import java.awt.Rectangle; import java.awt.Shape; import java.awt.font.LineMetrics; *************** *** 62,66 **** int barspaceHeight = 20; int barHeightMargin = (barspaceHeight - barHeigth) / 2; ! int barspaceWidth = 700; int firstSpaceWidth = 250; int secondSpaceWidth = 100; --- 63,67 ---- int barspaceHeight = 20; int barHeightMargin = (barspaceHeight - barHeigth) / 2; ! int barspaceWidth = 600; int firstSpaceWidth = 250; int secondSpaceWidth = 100; *************** *** 78,81 **** --- 79,83 ---- HashMap hints) { + //@todo int height = 6000; *************** *** 102,113 **** 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); --- 104,116 ---- 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); g2.setBackground(Color.WHITE); *************** *** 298,306 **** g2.setClip(leftclip); g2.drawString(label, 0, currentTopEdge + 12); ! g2.setClip(null); g2.setClip(middleclip); g2.drawString(name, firstSpaceWidth, currentTopEdge + 12); ! g2.setClip(null); int type = currentAction.getType(); --- 301,309 ---- g2.setClip(leftclip); g2.drawString(label, 0, currentTopEdge + 12); ! g2.setClip(oldClipBounds); g2.setClip(middleclip); g2.drawString(name, firstSpaceWidth, currentTopEdge + 12); ! g2.setClip(oldClipBounds); int type = currentAction.getType(); *************** *** 351,355 **** currentTopEdge + 9); ! g2.setClip(null); //rowItems List fragments = currentAction.getRowItems(); --- 354,358 ---- currentTopEdge + 9); ! g2.setClip(oldClipBounds); //rowItems List fragments = currentAction.getRowItems(); *************** *** 379,383 **** g2.setPaint(Color.BLACK); g2.draw(taskGraphic); ! } --- 382,386 ---- g2.setPaint(Color.BLACK); g2.draw(taskGraphic); ! g2.setClip(oldClipBounds); } *************** *** 423,430 **** g2.setPaint(new Color(normMult, 0, 0)); g2.fill(milestoneShape); - g2.setPaint(Color.BLACK); g2.draw(milestoneShape); ! g2.setClip(null); } --- 426,432 ---- g2.setPaint(new Color(normMult, 0, 0)); g2.fill(milestoneShape); g2.setPaint(Color.BLACK); g2.draw(milestoneShape); ! g2.setClip(oldClipBounds); } *************** *** 450,454 **** g2.setPaint(Color.BLACK); g2.draw(taskGraphic); ! break; default : --- 452,456 ---- g2.setPaint(Color.BLACK); g2.draw(taskGraphic); ! g2.setClip(oldClipBounds); break; default : |