KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nightlabs > editor2d > figures > FeedbackShapeFigure


1 /**
2  * <p> Project: com.nightlabs.editor2d </p>
3  * <p> Copyright: Copyright (c) 2004 </p>
4  * <p> Company: NightLabs GmbH (Germany) </p>
5  * <p> Creation Date: 17.02.2005 </p>
6  * <p> Author: Daniel Mazurek </p>
7 **/

8 package com.nightlabs.editor2d.figures;
9
10 import org.apache.log4j.Logger;
11 import org.eclipse.draw2d.geometry.Rectangle;
12
13 import com.nightlabs.editor2d.util.J2DUtil;
14
15
16 public class FeedbackShapeFigure
17 extends AbstractShapeFigure
18 {
19   public static final Logger LOGGER = Logger.getLogger(FeedbackShapeFigure.class);
20   
21   public void setBounds(Rectangle newBounds)
22   {
23     Rectangle oldBounds = getBounds();
24     J2DUtil.transformGeneralShape(getGeneralShape(), oldBounds, newBounds);
25     
26     super.repaint();
27   }
28   
29 // public void setBounds(Rectangle newBounds)
30
// {
31
// Rectangle oldBounds = getBounds();
32
// AffineTransform at = J2DUtil.getAffineTransform(oldBounds, newBounds);
33
// getGeneralShape().transform(at);
34
// for (Iterator it = getChildren().iterator(); it.hasNext(); ) {
35
// IFigure child = (IFigure) it.next();
36
// if (child instanceof ShapeFigure) {
37
// ShapeFigure shapeFigure = (ShapeFigure) child;
38
// shapeFigure.transform(at);
39
// }
40
// }
41
// super.setBounds(J2DUtil.toDraw2D(getGPBounds()));
42
// }
43

44 // public Rectangle getBounds()
45
// {
46
// Rectangle totalBounds = new Rectangle();
47
// Rectangle gpBounds = J2DUtil.toDraw2D(getGeneralShape().getBounds());
48
// for (Iterator it = getChildren().iterator(); it.hasNext(); )
49
// {
50
// IFigure child = (IFigure) it.next();
51
// if (child instanceof ShapeFigure) {
52
// ShapeFigure childFigure = (ShapeFigure) child;
53
// Rectangle childBounds = J2DUtil.toDraw2D(childFigure.getGeneralShape().getBounds());
54
// gpBounds = gpBounds.union(childBounds);
55
// }
56
// }
57
// return gpBounds;
58
// }
59

60 // public void transform(AffineTransform at)
61
// {
62
// getGeneralShape().transform(at);
63
// outlineArea = null;
64
// bounds = J2DUtil.toDraw2D(getGeneralShape().getBounds());
65
// for (Iterator it = getChildren().iterator(); it.hasNext(); ) {
66
// IFigure child = (IFigure) it.next();
67
// if (child instanceof ShapeFigure) {
68
// ShapeFigure shapeFigure = (ShapeFigure) child;
69
// shapeFigure.transform(at);
70
// }
71
// }
72
// repaint();
73
// }
74
}
75
Popular Tags