KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ca > mcgill > sable > soot > cfg > figures > CFGNodeFigure


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2004 Jennifer Lhotak
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 package ca.mcgill.sable.soot.cfg.figures;
21
22 import org.eclipse.draw2d.*;
23 import java.util.*;
24 import org.eclipse.swt.*;
25 import org.eclipse.swt.graphics.*;
26 import ca.mcgill.sable.soot.*;
27 import org.eclipse.draw2d.text.*;
28 import ca.mcgill.sable.soot.editors.*;
29 import org.eclipse.jface.resource.*;
30
31 public class CFGNodeFigure extends Figure {
32
33     private Panel nodeFigure;//RectangleFigure rect;
34

35     private XYAnchor srcAnchor;
36     private XYAnchor tgtAnchor;
37
38     private CFGNodeDataFigure data;
39     private CFGFlowFigure before;
40     private CFGFlowFigure after;
41     
42     private boolean hasBefore;
43     private boolean hasAfter;
44     
45     Font f = new Font(null, "Arial", 8, SWT.NORMAL);
46         
47     
48     /**
49      *
50      */

51     public CFGNodeFigure() {
52         super();
53         
54         ToolbarLayout layout2 = new ToolbarLayout();
55         layout2.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
56     
57         this.setLayoutManager(layout2);
58         
59         layout2.setStretchMinorAxis(false);
60     
61     }
62
63     
64     private int getLineBreak(String JavaDoc text){
65         return text.lastIndexOf(" ", 50);
66     }
67     
68
69
70     /**
71      * @return
72      */

73     public Panel getNodeFigure() {
74         return nodeFigure;
75     }
76
77     /**
78      * @param panel
79      */

80     public void setNodeFigure(Panel panel) {
81         nodeFigure = panel;
82     }
83
84
85
86     
87
88     /**
89      * @param figure
90      */

91     public void setAfter(CFGFlowFigure figure) {
92         after = figure;
93     }
94
95     /**
96      * @param figure
97      */

98     public void setBefore(CFGFlowFigure figure) {
99         before = figure;
100     }
101
102     /**
103      * @param figure
104      */

105     public void setData(CFGNodeDataFigure figure) {
106         data = figure;
107     }
108
109     /**
110      * @return
111      */

112     public CFGFlowFigure getAfter() {
113         return after;
114     }
115
116     /**
117      * @return
118      */

119     public CFGFlowFigure getBefore() {
120         return before;
121     }
122
123     /**
124      * @return
125      */

126     public CFGNodeDataFigure getData() {
127         return data;
128     }
129
130     /**
131      * @return
132      */

133     public XYAnchor getSrcAnchor() {
134         int x = this.getBounds().x;
135         int y = this.getBounds().y;
136         int width = this.getBounds().width;
137         int height = this.getBounds().height;
138         org.eclipse.draw2d.geometry.Point p = new org.eclipse.draw2d.geometry.Point(x+width/2, y+height);
139         return new XYAnchor(p);
140     }
141
142     /**
143      * @return
144      */

145     public XYAnchor getTgtAnchor() {
146         return tgtAnchor;
147     }
148
149     Image indicatorImage = null;
150     Label indicatorFigure = null;
151     
152
153     public void addIndicator(){
154         
155     
156     }
157     
158     public void removeIndicator(){
159         
160     }
161     
162
163 }
164
Popular Tags