Coverage details for edu.uci.ics.jung.visualization.transform.shape.GraphicsDecorator

LineHitsSource
1 /*
2  * Copyright (c) 2005, the JUNG Project and the Regents of the University of
3  * California All rights reserved.
4  *
5  * This software is open-source under the BSD license; see either "license.txt"
6  * or http://jung.sourceforge.net/license.txt for a description.
7  *
8  * Created on Jul 11, 2005
9  */
10  
11 package edu.uci.ics.jung.visualization.transform.shape;
12  
13 import java.awt.Color;
14 import java.awt.Composite;
15 import java.awt.Font;
16 import java.awt.FontMetrics;
17 import java.awt.Graphics;
18 import java.awt.Graphics2D;
19 import java.awt.GraphicsConfiguration;
20 import java.awt.Image;
21 import java.awt.Paint;
22 import java.awt.Polygon;
23 import java.awt.Rectangle;
24 import java.awt.RenderingHints;
25 import java.awt.Shape;
26 import java.awt.Stroke;
27 import java.awt.RenderingHints.Key;
28 import java.awt.font.FontRenderContext;
29 import java.awt.font.GlyphVector;
30 import java.awt.geom.AffineTransform;
31 import java.awt.image.BufferedImage;
32 import java.awt.image.BufferedImageOp;
33 import java.awt.image.ImageObserver;
34 import java.awt.image.RenderedImage;
35 import java.awt.image.renderable.RenderableImage;
36 import java.text.AttributedCharacterIterator;
37 import java.util.Map;
38  
39  
40 /**
41  * a complete wrapping of Graphics2D, useful as a base class.
42  * @see TransformingGraphics as an example subclass
43  *
44  * @author Tom Nelson - RABA Technologies
45  *
46  *
47  */
48 public abstract class GraphicsDecorator {
49     
50     protected Graphics2D delegate;
51     
52     public GraphicsDecorator() {
530        this(null);
540    }
550    public GraphicsDecorator(Graphics2D delegate) {
560        this.delegate = delegate;
570    }
58     
59     public void setDelegate(Graphics2D delegate) {
600        this.delegate = delegate;
610    }
62     
63     public Graphics2D getDelegate() {
640        return delegate;
65     }
66  
67     /* (non-Javadoc)
68      * @see java.awt.Graphics2D#addRenderingHints(java.util.Map)
69      */
70     public void addRenderingHints(Map hints) {
710        delegate.addRenderingHints(hints);
720    }
73  
74     /* (non-Javadoc)
75      * @see java.awt.Graphics#clearRect(int, int, int, int)
76      */
77     public void clearRect(int x, int y, int width, int height) {
780        delegate.clearRect(x, y, width, height);
790    }
80  
81     /* (non-Javadoc)
82      * @see java.awt.Graphics2D#clip(java.awt.Shape)
83      */
84     public void clip(Shape s) {
850        delegate.clip(s);
860    }
87  
88     /* (non-Javadoc)
89      * @see java.awt.Graphics#clipRect(int, int, int, int)
90      */
91     public void clipRect(int x, int y, int width, int height) {
920        delegate.clipRect(x, y, width, height);
930    }
94  
95     /* (non-Javadoc)
96      * @see java.awt.Graphics#copyArea(int, int, int, int, int, int)
97      */
98     public void copyArea(int x, int y, int width, int height, int dx, int dy) {
990        delegate.copyArea(x, y, width, height, dx, dy);
1000    }
101  
102     /* (non-Javadoc)
103      * @see java.awt.Graphics#create()
104      */
105     public Graphics create() {
1060        return delegate.create();
107     }
108  
109     /* (non-Javadoc)
110      * @see java.awt.Graphics#create(int, int, int, int)
111      */
112     public Graphics create(int x, int y, int width, int height) {
1130        return delegate.create(x, y, width, height);
114     }
115  
116     /* (non-Javadoc)
117      * @see java.awt.Graphics#dispose()
118      */
119     public void dispose() {
1200        delegate.dispose();
1210    }
122  
123     /* (non-Javadoc)
124      * @see java.awt.Graphics2D#draw(java.awt.Shape)
125      */
126     public void draw(Shape s) {
1270        delegate.draw(s);
1280    }
129  
130     /* (non-Javadoc)
131      * @see java.awt.Graphics2D#draw3DRect(int, int, int, int, boolean)
132      */
133     public void draw3DRect(int x, int y, int width, int height, boolean raised) {
1340        delegate.draw3DRect(x, y, width, height, raised);
1350    }
136  
137     /* (non-Javadoc)
138      * @see java.awt.Graphics#drawArc(int, int, int, int, int, int)
139      */
140     public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
1410        delegate.drawArc(x, y, width, height, startAngle, arcAngle);
1420    }
143  
144     /* (non-Javadoc)
145      * @see java.awt.Graphics#drawBytes(byte[], int, int, int, int)
146      */
147     public void drawBytes(byte[] data, int offset, int length, int x, int y) {
1480        delegate.drawBytes(data, offset, length, x, y);
1490    }
150  
151     /* (non-Javadoc)
152      * @see java.awt.Graphics#drawChars(char[], int, int, int, int)
153      */
154     public void drawChars(char[] data, int offset, int length, int x, int y) {
1550        delegate.drawChars(data, offset, length, x, y);
1560    }
157  
158     /* (non-Javadoc)
159      * @see java.awt.Graphics2D#drawGlyphVector(java.awt.font.GlyphVector, float, float)
160      */
161     public void drawGlyphVector(GlyphVector g, float x, float y) {
1620        delegate.drawGlyphVector(g, x, y);
1630    }
164  
165     /* (non-Javadoc)
166      * @see java.awt.Graphics2D#drawImage(java.awt.image.BufferedImage, java.awt.image.BufferedImageOp, int, int)
167      */
168     public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
1690        delegate.drawImage(img, op, x, y);
1700    }
171  
172     /* (non-Javadoc)
173      * @see java.awt.Graphics2D#drawImage(java.awt.Image, java.awt.geom.AffineTransform, java.awt.image.ImageObserver)
174      */
175     public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
1760        return delegate.drawImage(img, xform, obs);
177     }
178  
179     /* (non-Javadoc)
180      * @see java.awt.Graphics#drawImage(java.awt.Image, int, int, java.awt.Color, java.awt.image.ImageObserver)
181      */
182     public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) {
1830        return delegate.drawImage(img, x, y, bgcolor, observer);
184     }
185  
186     /* (non-Javadoc)
187      * @see java.awt.Graphics#drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)
188      */
189     public boolean drawImage(Image img, int x, int y, ImageObserver observer) {
1900        return delegate.drawImage(img, x, y, observer);
191     }
192  
193     /* (non-Javadoc)
194      * @see java.awt.Graphics#drawImage(java.awt.Image, int, int, int, int, java.awt.Color, java.awt.image.ImageObserver)
195      */
196     public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) {
1970        return delegate.drawImage(img, x, y, width, height, bgcolor, observer);
198     }
199  
200     /* (non-Javadoc)
201      * @see java.awt.Graphics#drawImage(java.awt.Image, int, int, int, int, java.awt.image.ImageObserver)
202      */
203     public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) {
2040        return delegate.drawImage(img, x, y, width, height, observer);
205     }
206  
207     /* (non-Javadoc)
208      * @see java.awt.Graphics#drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.Color, java.awt.image.ImageObserver)
209      */
210     public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) {
2110        return delegate.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer);
212     }
213  
214     /* (non-Javadoc)
215      * @see java.awt.Graphics#drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.image.ImageObserver)
216      */
217     public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) {
2180        return delegate.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
219     }
220  
221     /* (non-Javadoc)
222      * @see java.awt.Graphics#drawLine(int, int, int, int)
223      */
224     public void drawLine(int x1, int y1, int x2, int y2) {
2250        delegate.drawLine(x1, y1, x2, y2);
2260    }
227  
228     /* (non-Javadoc)
229      * @see java.awt.Graphics#drawOval(int, int, int, int)
230      */
231     public void drawOval(int x, int y, int width, int height) {
2320        delegate.drawOval(x, y, width, height);
2330    }
234  
235     /* (non-Javadoc)
236      * @see java.awt.Graphics#drawPolygon(int[], int[], int)
237      */
238     public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) {
2390        delegate.drawPolygon(xPoints, yPoints, nPoints);
2400    }
241  
242     /* (non-Javadoc)
243      * @see java.awt.Graphics#drawPolygon(java.awt.Polygon)
244      */
245     public void drawPolygon(Polygon p) {
2460        delegate.drawPolygon(p);
2470    }
248  
249     /* (non-Javadoc)
250      * @see java.awt.Graphics#drawPolyline(int[], int[], int)
251      */
252     public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {
2530        delegate.drawPolyline(xPoints, yPoints, nPoints);
2540    }
255  
256     /* (non-Javadoc)
257      * @see java.awt.Graphics#drawRect(int, int, int, int)
258      */
259     public void drawRect(int x, int y, int width, int height) {
2600        delegate.drawRect(x, y, width, height);
2610    }
262  
263     /* (non-Javadoc)
264      * @see java.awt.Graphics2D#drawRenderableImage(java.awt.image.renderable.RenderableImage, java.awt.geom.AffineTransform)
265      */
266     public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
2670        delegate.drawRenderableImage(img, xform);
2680    }
269  
270     /* (non-Javadoc)
271      * @see java.awt.Graphics2D#drawRenderedImage(java.awt.image.RenderedImage, java.awt.geom.AffineTransform)
272      */
273     public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
2740        delegate.drawRenderedImage(img, xform);
2750    }
276  
277     /* (non-Javadoc)
278      * @see java.awt.Graphics#drawRoundRect(int, int, int, int, int, int)
279      */
280     public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
2810        delegate.drawRoundRect(x, y, width, height, arcWidth, arcHeight);
2820    }
283  
284     /* (non-Javadoc)
285      * @see java.awt.Graphics2D#drawString(java.text.AttributedCharacterIterator, float, float)
286      */
287     public void drawString(AttributedCharacterIterator iterator, float x, float y) {
2880        delegate.drawString(iterator, x, y);
2890    }
290  
291     /* (non-Javadoc)
292      * @see java.awt.Graphics2D#drawString(java.text.AttributedCharacterIterator, int, int)
293      */
294     public void drawString(AttributedCharacterIterator iterator, int x, int y) {
2950        delegate.drawString(iterator, x, y);
2960    }
297  
298     /* (non-Javadoc)
299      * @see java.awt.Graphics2D#drawString(java.lang.String, float, float)
300      */
301     public void drawString(String s, float x, float y) {
3020        delegate.drawString(s, x, y);
3030    }
304  
305     /* (non-Javadoc)
306      * @see java.awt.Graphics2D#drawString(java.lang.String, int, int)
307      */
308     public void drawString(String str, int x, int y) {
3090        delegate.drawString(str, x, y);
3100    }
311  
312     /* (non-Javadoc)
313      * @see java.lang.Object#equals(java.lang.Object)
314      */
315     public boolean equals(Object obj) {
3160        return delegate.equals(obj);
317     }
318  
319     /* (non-Javadoc)
320      * @see java.awt.Graphics2D#fill(java.awt.Shape)
321      */
322     public void fill(Shape s) {
3230        delegate.fill(s);
3240    }
325  
326     /* (non-Javadoc)
327      * @see java.awt.Graphics2D#fill3DRect(int, int, int, int, boolean)
328      */
329     public void fill3DRect(int x, int y, int width, int height, boolean raised) {
3300        delegate.fill3DRect(x, y, width, height, raised);
3310    }
332  
333     /* (non-Javadoc)
334      * @see java.awt.Graphics#fillArc(int, int, int, int, int, int)
335      */
336     public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
3370        delegate.fillArc(x, y, width, height, startAngle, arcAngle);
3380    }
339  
340     /* (non-Javadoc)
341      * @see java.awt.Graphics#fillOval(int, int, int, int)
342      */
343     public void fillOval(int x, int y, int width, int height) {
3440        delegate.fillOval(x, y, width, height);
3450    }
346  
347     /* (non-Javadoc)
348      * @see java.awt.Graphics#fillPolygon(int[], int[], int)
349      */
350     public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) {
3510        delegate.fillPolygon(xPoints, yPoints, nPoints);
3520    }
353  
354     /* (non-Javadoc)
355      * @see java.awt.Graphics#fillPolygon(java.awt.Polygon)
356      */
357     public void fillPolygon(Polygon p) {
3580        delegate.fillPolygon(p);
3590    }
360  
361     /* (non-Javadoc)
362      * @see java.awt.Graphics#fillRect(int, int, int, int)
363      */
364     public void fillRect(int x, int y, int width, int height) {
3650        delegate.fillRect(x, y, width, height);
3660    }
367  
368     /* (non-Javadoc)
369      * @see java.awt.Graphics#fillRoundRect(int, int, int, int, int, int)
370      */
371     public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
3720        delegate.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
3730    }
374  
375     /* (non-Javadoc)
376      * @see java.awt.Graphics#finalize()
377      */
378     public void finalize() {
3790        delegate.finalize();
3800    }
381  
382     /* (non-Javadoc)
383      * @see java.awt.Graphics2D#getBackground()
384      */
385     public Color getBackground() {
3860        return delegate.getBackground();
387     }
388  
389     /* (non-Javadoc)
390      * @see java.awt.Graphics#getClip()
391      */
392     public Shape getClip() {
3930        return delegate.getClip();
394     }
395  
396     /* (non-Javadoc)
397      * @see java.awt.Graphics#getClipBounds()
398      */
399     public Rectangle getClipBounds() {
4000        return delegate.getClipBounds();
401     }
402  
403     /* (non-Javadoc)
404      * @see java.awt.Graphics#getClipBounds(java.awt.Rectangle)
405      */
406     public Rectangle getClipBounds(Rectangle r) {
4070        return delegate.getClipBounds(r);
408     }
409  
410     /* (non-Javadoc)
411      * @see java.awt.Graphics#getClipRect()
412      */
413     public Rectangle getClipRect() {
4140        return delegate.getClipRect();
415     }
416  
417     /* (non-Javadoc)
418      * @see java.awt.Graphics#getColor()
419      */
420     public Color getColor() {
4210        return delegate.getColor();
422     }
423  
424     /* (non-Javadoc)
425      * @see java.awt.Graphics2D#getComposite()
426      */
427     public Composite getComposite() {
4280        return delegate.getComposite();
429     }
430  
431     /* (non-Javadoc)
432      * @see java.awt.Graphics2D#getDeviceConfiguration()
433      */
434     public GraphicsConfiguration getDeviceConfiguration() {
4350        return delegate.getDeviceConfiguration();
436     }
437  
438     /* (non-Javadoc)
439      * @see java.awt.Graphics#getFont()
440      */
441     public Font getFont() {
4420        return delegate.getFont();
443     }
444  
445     /* (non-Javadoc)
446      * @see java.awt.Graphics#getFontMetrics()
447      */
448     public FontMetrics getFontMetrics() {
4490        return delegate.getFontMetrics();
450     }
451  
452     /* (non-Javadoc)
453      * @see java.awt.Graphics#getFontMetrics(java.awt.Font)
454      */
455     public FontMetrics getFontMetrics(Font f) {
4560        return delegate.getFontMetrics(f);
457     }
458  
459     /* (non-Javadoc)
460      * @see java.awt.Graphics2D#getFontRenderContext()
461      */
462     public FontRenderContext getFontRenderContext() {
4630        return delegate.getFontRenderContext();
464     }
465  
466     /* (non-Javadoc)
467      * @see java.awt.Graphics2D#getPaint()
468      */
469     public Paint getPaint() {
4700        return delegate.getPaint();
471     }
472  
473     /* (non-Javadoc)
474      * @see java.awt.Graphics2D#getRenderingHint(java.awt.RenderingHints.Key)
475      */
476     public Object getRenderingHint(Key hintKey) {
4770        return delegate.getRenderingHint(hintKey);
478     }
479  
480     /* (non-Javadoc)
481      * @see java.awt.Graphics2D#getRenderingHints()
482      */
483     public RenderingHints getRenderingHints() {
4840        return delegate.getRenderingHints();
485     }
486  
487     /* (non-Javadoc)
488      * @see java.awt.Graphics2D#getStroke()
489      */
490     public Stroke getStroke() {
4910        return delegate.getStroke();
492     }
493  
494     /* (non-Javadoc)
495      * @see java.awt.Graphics2D#getTransform()
496      */
497     public AffineTransform getTransform() {
4980        return delegate.getTransform();
499     }
500  
501     /* (non-Javadoc)
502      * @see java.lang.Object#hashCode()
503      */
504     public int hashCode() {
5050        return delegate.hashCode();
506     }
507  
508     /* (non-Javadoc)
509      * @see java.awt.Graphics2D#hit(java.awt.Rectangle, java.awt.Shape, boolean)
510      */
511     public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
5120        return delegate.hit(rect, s, onStroke);
513     }
514  
515     /* (non-Javadoc)
516      * @see java.awt.Graphics#hitClip(int, int, int, int)
517      */
518     public boolean hitClip(int x, int y, int width, int height) {
5190        return delegate.hitClip(x, y, width, height);
520     }
521  
522     /* (non-Javadoc)
523      * @see java.awt.Graphics2D#rotate(double, double, double)
524      */
525     public void rotate(double theta, double x, double y) {
5260        delegate.rotate(theta, x, y);
5270    }
528  
529     /* (non-Javadoc)
530      * @see java.awt.Graphics2D#rotate(double)
531      */
532     public void rotate(double theta) {
5330        delegate.rotate(theta);
5340    }
535  
536     /* (non-Javadoc)
537      * @see java.awt.Graphics2D#scale(double, double)
538      */
539     public void scale(double sx, double sy) {
5400        delegate.scale(sx, sy);
5410    }
542  
543     /* (non-Javadoc)
544      * @see java.awt.Graphics2D#setBackground(java.awt.Color)
545      */
546     public void setBackground(Color color) {
5470        delegate.setBackground(color);
5480    }
549  
550     /* (non-Javadoc)
551      * @see java.awt.Graphics#setClip(int, int, int, int)
552      */
553     public void setClip(int x, int y, int width, int height) {
5540        delegate.setClip(x, y, width, height);
5550    }
556  
557     /* (non-Javadoc)
558      * @see java.awt.Graphics#setClip(java.awt.Shape)
559      */
560     public void setClip(Shape clip) {
5610        delegate.setClip(clip);
5620    }
563  
564     /* (non-Javadoc)
565      * @see java.awt.Graphics#setColor(java.awt.Color)
566      */
567     public void setColor(Color c) {
5680        delegate.setColor(c);
5690    }
570  
571     /* (non-Javadoc)
572      * @see java.awt.Graphics2D#setComposite(java.awt.Composite)
573      */
574     public void setComposite(Composite comp) {
5750        delegate.setComposite(comp);
5760    }
577  
578     /* (non-Javadoc)
579      * @see java.awt.Graphics#setFont(java.awt.Font)
580      */
581     public void setFont(Font font) {
5820        delegate.setFont(font);
5830    }
584  
585     /* (non-Javadoc)
586      * @see java.awt.Graphics2D#setPaint(java.awt.Paint)
587      */
588     public void setPaint(Paint paint) {
5890        delegate.setPaint(paint);
5900    }
591  
592     /* (non-Javadoc)
593      * @see java.awt.Graphics#setPaintMode()
594      */
595     public void setPaintMode() {
5960        delegate.setPaintMode();
5970    }
598  
599     /* (non-Javadoc)
600      * @see java.awt.Graphics2D#setRenderingHint(java.awt.RenderingHints.Key, java.lang.Object)
601      */
602     public void setRenderingHint(Key hintKey, Object hintValue) {
6030        delegate.setRenderingHint(hintKey, hintValue);
6040    }
605  
606     /* (non-Javadoc)
607      * @see java.awt.Graphics2D#setRenderingHints(java.util.Map)
608      */
609     public void setRenderingHints(Map hints) {
6100        delegate.setRenderingHints(hints);
6110    }
612  
613     /* (non-Javadoc)
614      * @see java.awt.Graphics2D#setStroke(java.awt.Stroke)
615      */
616     public void setStroke(Stroke s) {
6170        delegate.setStroke(s);
6180    }
619  
620     /* (non-Javadoc)
621      * @see java.awt.Graphics2D#setTransform(java.awt.geom.AffineTransform)
622      */
623     public void setTransform(AffineTransform Tx) {
6240        delegate.setTransform(Tx);
6250    }
626  
627     /* (non-Javadoc)
628      * @see java.awt.Graphics#setXORMode(java.awt.Color)
629      */
630     public void setXORMode(Color c1) {
6310        delegate.setXORMode(c1);
6320    }
633  
634     /* (non-Javadoc)
635      * @see java.awt.Graphics2D#shear(double, double)
636      */
637     public void shear(double shx, double shy) {
6380        delegate.shear(shx, shy);
6390    }
640  
641     /* (non-Javadoc)
642      * @see java.awt.Graphics#toString()
643      */
644     public String toString() {
6450        return delegate.toString();
646     }
647  
648     /* (non-Javadoc)
649      * @see java.awt.Graphics2D#transform(java.awt.geom.AffineTransform)
650      */
651     public void transform(AffineTransform Tx) {
6520        delegate.transform(Tx);
6530    }
654  
655     /* (non-Javadoc)
656      * @see java.awt.Graphics2D#translate(double, double)
657      */
658     public void translate(double tx, double ty) {
6590        delegate.translate(tx, ty);
6600    }
661  
662     /* (non-Javadoc)
663      * @see java.awt.Graphics2D#translate(int, int)
664      */
665     public void translate(int x, int y) {
6660        delegate.translate(x, y);
6670    }
668  
669 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.