Source Code Cross Referenced for SourceElementFigure.java in  » Testing » KeY » visualdebugger » draw2d » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » KeY » visualdebugger.draw2d 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package visualdebugger.draw2d;
002:
003:        import org.eclipse.draw2d.*;
004:        import org.eclipse.draw2d.geometry.Insets;
005:        import org.eclipse.jdt.core.ICompilationUnit;
006:        import org.eclipse.jdt.core.dom.ASTNode;
007:        import org.eclipse.jdt.core.dom.Expression;
008:        import org.eclipse.jdt.core.dom.Statement;
009:        import org.eclipse.swt.graphics.Color;
010:        import org.eclipse.swt.widgets.Display;
011:
012:        import de.uka.ilkd.key.visualdebugger.VisualDebugger;
013:        import de.uka.ilkd.key.visualdebugger.executiontree.ETNode;
014:        import de.uka.ilkd.key.visualdebugger.executiontree.ETStatementNode;
015:
016:        public class SourceElementFigure extends Figure {
017:
018:            private boolean selected;
019:
020:            static final Color gradient1 = new Color(null, 232, 232, 240);
021:
022:            static final Color gradient2 = new Color(null, 176, 184, 216);
023:
024:            static final Color gradient12 = new Color(null, 236, 152, 188);
025:
026:            static final Color gradient22 = new Color(null, 236, 196, 213);
027:
028:            static final Color corner1 = new Color(null, 200, 208, 223);
029:
030:            static final Color corner2 = new Color(null, 160, 172, 200);
031:
032:            static final Color blue = new Color(null, 152, 168, 200);
033:
034:            static final Color shadow = new Color(null, 202, 202, 202);
035:
036:            static final int CORNER_SIZE = 00;
037:
038:            ETNode etNode = null;
039:
040:            final ETStatementNode sNode;
041:
042:            Statement statement;
043:
044:            Expression expression;
045:
046:            ICompilationUnit unit;
047:
048:            // static final Border BORDER = new CompoundBorder(new FoldedPageBorder(),
049:            // new MarginBorder(4, 4, 8, 3));
050:            static final Border BORDER = new LineBorder(ColorConstants.black, 1);
051:
052:            static final Border BREAKMODEBORDER = new LineBorder(
053:                    ColorConstants.red, 2);
054:
055:            static final Border ROUNDEDBORDER = new RoundedBorder(
056:                    ColorConstants.black, 1);
057:
058:            public static class RoundedBorder extends LineBorder {
059:
060:                public RoundedBorder(Color color, int width) {
061:                    super (color, width);
062:                }
063:
064:                public void paint(IFigure figure, Graphics graphics,
065:                        Insets insets) {
066:                    tempRect.setBounds(getPaintRectangle(figure, insets));
067:                    if (getWidth() % 2 == 1) {
068:                        tempRect.width--;
069:                        tempRect.height--;
070:                    }
071:                    tempRect.shrink(getWidth() / 2, getWidth() / 2);
072:                    graphics.setLineWidth(getWidth());
073:                    if (getColor() != null)
074:                        graphics.setForegroundColor(getColor());
075:                    graphics.drawRoundRectangle(tempRect, 12, 12);
076:                }
077:            }
078:
079:            private Label label = new Label();
080:
081:            public SourceElementFigure(String text) {
082:                this ();
083:                if (text.length() > 20)
084:                    text = text.substring(0, 20);
085:                label.setFont(Display.getCurrent().getSystemFont());
086:                label.setText(text);
087:            }
088:
089:            public SourceElementFigure() {
090:                setBorder(BORDER);
091:                setLayoutManager(new StackLayout());
092:                add(label);
093:                sNode = null;
094:                statement = null;
095:                unit = null;
096:            }
097:
098:            public SourceElementFigure(ETStatementNode etNode) {
099:                // this();
100:
101:                setLayoutManager(new StackLayout());
102:                add(label);
103:                String labelText = "";
104:                String st = "";
105:                boolean breakpoint = false;
106:                // if (etNode.getStatementId()!=null){
107:                if (etNode.getStatementId().isStatement()) {
108:
109:                    if (VisualDebugger.getVisualDebugger().getBpManager()
110:                            .suspendByBreakpoint(etNode.getStatementId())) {
111:                        breakpoint = true;
112:                        setBorder(BREAKMODEBORDER);
113:                    } else
114:                        setBorder(BORDER);
115:                    statement = (Statement) visualdebugger.Activator
116:                            .getDefault().getASTNodeForStatementId(
117:                                    etNode.getStatementId());
118:
119:                    unit = visualdebugger.Activator.getDefault()
120:                            .getCompilationUnit(etNode.getStatementId());
121:                    st = statement.toString();
122:                } else {
123:                    expression = visualdebugger.Activator.getDefault()
124:                            .getExpression(etNode.getStatementId());
125:                    setBorder(ROUNDEDBORDER);
126:                    unit = visualdebugger.Activator.getDefault()
127:                            .getCompilationUnit(etNode.getStatementId());
128:                    st = expression.toString();
129:                }
130:
131:                labelText = st;
132:                int i = st.indexOf("\n");
133:                if (i > -1)
134:                    labelText = st.substring(0, i);
135:                label.setText(labelText);
136:                // }
137:
138:                sNode = etNode;
139:                if (breakpoint)
140:                    st = "Statement Breakpoint is reached...\n" + st;
141:                this .setToolTip(new Label(st));
142:            }
143:
144:            /**
145:             * @see org.eclipse.draw2d.Figure#paintFigure(org.eclipse.draw2d.Graphics)
146:             */
147:            protected void paintFigure(Graphics g) {
148:                super .paintFigure(g);
149:                if (selected) {
150:                    g.setForegroundColor(ColorConstants.menuBackgroundSelected);
151:                    g.setBackgroundColor(ColorConstants.titleGradient);
152:                } else {
153:                    if (statement != null || label.getText().equals("Start")) {
154:                        g.setForegroundColor(gradient1);
155:                        g.setBackgroundColor(gradient2);
156:                    } else {
157:                        g.setForegroundColor(gradient12);
158:                        g.setBackgroundColor(gradient22);
159:
160:                    }
161:                }
162:                g.fillGradient(getBounds().getResized(-1, -1), true);
163:
164:            }
165:
166:            public void setSelected(boolean value) {
167:                this .selected = value;
168:                if (selected)
169:                    label.setForegroundColor(ColorConstants.white);
170:                else
171:                    label.setForegroundColor(null);
172:                repaint();
173:            }
174:
175:            /**
176:             * @see java.lang.Object#toString()
177:             */
178:            public String toString() {
179:                // return ((Label) getChildren().get(0)).getText();
180:                if (getETNode() != null)
181:                    if (getETNode().getITNodesArray()[0] != null)
182:                        return getETNode().getITNodesArray()[0].getId() + "";
183:
184:                return "nullds";
185:            }
186:
187:            public void validate() {
188:                repaint();
189:                super .validate();
190:            }
191:
192:            public ETNode getETNode() {
193:                return sNode;
194:            }
195:
196:            public Statement getStatement() {
197:                return statement;
198:            }
199:
200:            public ICompilationUnit getUnit() {
201:                return unit;
202:            }
203:
204:            public ASTNode getASTNode() {
205:                if (statement != null)
206:                    return statement;
207:                else
208:                    return expression;
209:            }
210:
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.