Source Code Cross Referenced for AsyncActivityEditPart.java in  » Workflow-Engines » osbl-1_0 » newprocess » diagram » edit » parts » 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 » Workflow Engines » osbl 1_0 » newprocess.diagram.edit.parts 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package newprocess.diagram.edit.parts;
002:
003:        import newprocess.diagram.edit.policies.AsyncActivityItemSemanticEditPolicy;
004:        import newprocess.diagram.part.New_processVisualIDRegistry;
005:        import newprocess.diagram.providers.New_processElementTypes;
006:
007:        import org.eclipse.draw2d.ColorConstants;
008:        import org.eclipse.draw2d.Graphics;
009:        import org.eclipse.draw2d.IFigure;
010:        import org.eclipse.draw2d.LineBorder;
011:        import org.eclipse.draw2d.RectangleFigure;
012:        import org.eclipse.draw2d.StackLayout;
013:        import org.eclipse.draw2d.ToolbarLayout;
014:        import org.eclipse.draw2d.geometry.Dimension;
015:        import org.eclipse.emf.common.notify.Notification;
016:        import org.eclipse.gef.EditPart;
017:        import org.eclipse.gef.EditPolicy;
018:        import org.eclipse.gef.Request;
019:        import org.eclipse.gef.commands.Command;
020:        import org.eclipse.gef.editpolicies.LayoutEditPolicy;
021:        import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
022:        import org.eclipse.gef.requests.CreateRequest;
023:        import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
024:        import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
025:        import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
026:        import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
027:        import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DecorationEditPolicy;
028:        import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
029:        import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
030:        import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
031:        import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
032:        import org.eclipse.gmf.runtime.emf.type.core.IElementType;
033:        import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
034:        import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
035:        import org.eclipse.gmf.runtime.notation.View;
036:        import org.eclipse.swt.graphics.Color;
037:
038:        /**
039:         * @generated
040:         */
041:        public class AsyncActivityEditPart extends ShapeNodeEditPart {
042:
043:            /**
044:             * @generated
045:             */
046:            public static final int VISUAL_ID = 2003;
047:
048:            /**
049:             * @generated
050:             */
051:            protected IFigure contentPane;
052:
053:            /**
054:             * @generated
055:             */
056:            protected IFigure primaryShape;
057:
058:            /**
059:             * @generated
060:             */
061:            public AsyncActivityEditPart(View view) {
062:                super (view);
063:            }
064:
065:            /**
066:             * @generated
067:             */
068:            protected void createDefaultEditPolicies() {
069:                installEditPolicy(EditPolicyRoles.CREATION_ROLE,
070:                        new CreationEditPolicy() {
071:
072:                            public Command getCommand(Request request) {
073:                                if (understandsRequest(request)) {
074:                                    if (request instanceof  CreateViewAndElementRequest) {
075:                                        CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request)
076:                                                .getViewAndElementDescriptor()
077:                                                .getCreateElementRequestAdapter();
078:                                        IElementType type = (IElementType) adapter
079:                                                .getAdapter(IElementType.class);
080:                                        if (type == New_processElementTypes.Expression_3008) {
081:                                            EditPart compartmentEditPart = getChildBySemanticHint(New_processVisualIDRegistry
082:                                                    .getType(AsyncActivityAsyncActivityPreconditionCompartmentEditPart.VISUAL_ID));
083:                                            return compartmentEditPart == null ? null
084:                                                    : compartmentEditPart
085:                                                            .getCommand(request);
086:                                        }
087:                                        if (type == New_processElementTypes.Expression_3009) {
088:                                            EditPart compartmentEditPart = getChildBySemanticHint(New_processVisualIDRegistry
089:                                                    .getType(AsyncActivityAsyncActivityPostconditionCompartmentEditPart.VISUAL_ID));
090:                                            return compartmentEditPart == null ? null
091:                                                    : compartmentEditPart
092:                                                            .getCommand(request);
093:                                        }
094:                                    }
095:                                    return super .getCommand(request);
096:                                }
097:                                return null;
098:                            }
099:                        });
100:                super .createDefaultEditPolicies();
101:
102:                installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
103:                        new AsyncActivityItemSemanticEditPolicy());
104:                installEditPolicy(EditPolicy.LAYOUT_ROLE,
105:                        createLayoutEditPolicy());
106:            }
107:
108:            /**
109:             * @generated
110:             */
111:            protected LayoutEditPolicy createLayoutEditPolicy() {
112:                LayoutEditPolicy lep = new LayoutEditPolicy() {
113:
114:                    protected EditPolicy createChildEditPolicy(EditPart child) {
115:                        EditPolicy result = child
116:                                .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
117:                        if (result == null) {
118:                            result = new NonResizableEditPolicy();
119:                        }
120:                        return result;
121:                    }
122:
123:                    protected Command getMoveChildrenCommand(Request request) {
124:                        return null;
125:                    }
126:
127:                    protected Command getCreateCommand(CreateRequest request) {
128:                        return null;
129:                    }
130:                };
131:                return lep;
132:            }
133:
134:            /**
135:             * @generated
136:             */
137:            protected IFigure createNodeShape() {
138:                AsyncActivityFigure figure = new AsyncActivityFigure();
139:                return primaryShape = figure;
140:            }
141:
142:            /**
143:             * @generated
144:             */
145:            public AsyncActivityFigure getPrimaryShape() {
146:                return (AsyncActivityFigure) primaryShape;
147:            }
148:
149:            /**
150:             * @generated
151:             */
152:            protected boolean addFixedChild(EditPart childEditPart) {
153:                if (childEditPart instanceof  AsyncActivityNameEditPart) {
154:                    ((AsyncActivityNameEditPart) childEditPart)
155:                            .setLabel(getPrimaryShape()
156:                                    .getFigureAsyncActivityNameFigure());
157:                    return true;
158:                }
159:                if (childEditPart instanceof  AsyncActivityAsyncActivityPreconditionCompartmentEditPart) {
160:                    IFigure pane = getPrimaryShape()
161:                            .getFigureAsyncActivityPreconditionFigure();
162:                    setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
163:                    pane
164:                            .add(((AsyncActivityAsyncActivityPreconditionCompartmentEditPart) childEditPart)
165:                                    .getFigure());
166:                    return true;
167:                }
168:                if (childEditPart instanceof  AsyncActivityAsyncActivityPostconditionCompartmentEditPart) {
169:                    IFigure pane = getPrimaryShape()
170:                            .getFigureAsyncActivityPostconditionFigure();
171:                    setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
172:                    pane
173:                            .add(((AsyncActivityAsyncActivityPostconditionCompartmentEditPart) childEditPart)
174:                                    .getFigure());
175:                    return true;
176:                }
177:                return false;
178:            }
179:
180:            /**
181:             * @generated
182:             */
183:            protected boolean removeFixedChild(EditPart childEditPart) {
184:
185:                if (childEditPart instanceof  AsyncActivityAsyncActivityPreconditionCompartmentEditPart) {
186:                    IFigure pane = getPrimaryShape()
187:                            .getFigureAsyncActivityPreconditionFigure();
188:                    setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
189:                    pane
190:                            .remove(((AsyncActivityAsyncActivityPreconditionCompartmentEditPart) childEditPart)
191:                                    .getFigure());
192:                    return true;
193:                }
194:                if (childEditPart instanceof  AsyncActivityAsyncActivityPostconditionCompartmentEditPart) {
195:                    IFigure pane = getPrimaryShape()
196:                            .getFigureAsyncActivityPostconditionFigure();
197:                    setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
198:                    pane
199:                            .remove(((AsyncActivityAsyncActivityPostconditionCompartmentEditPart) childEditPart)
200:                                    .getFigure());
201:                    return true;
202:                }
203:                return false;
204:            }
205:
206:            /**
207:             * @generated
208:             */
209:            protected void addChildVisual(EditPart childEditPart, int index) {
210:                if (addFixedChild(childEditPart)) {
211:                    return;
212:                }
213:                super .addChildVisual(childEditPart, -1);
214:            }
215:
216:            /**
217:             * @generated
218:             */
219:            protected void removeChildVisual(EditPart childEditPart) {
220:                if (removeFixedChild(childEditPart)) {
221:                    return;
222:                }
223:                super .removeChildVisual(childEditPart);
224:            }
225:
226:            /**
227:             * @generated
228:             */
229:            protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
230:
231:                if (editPart instanceof  AsyncActivityAsyncActivityPreconditionCompartmentEditPart) {
232:                    return getPrimaryShape()
233:                            .getFigureAsyncActivityPreconditionFigure();
234:                }
235:                if (editPart instanceof  AsyncActivityAsyncActivityPostconditionCompartmentEditPart) {
236:                    return getPrimaryShape()
237:                            .getFigureAsyncActivityPostconditionFigure();
238:                }
239:                return super .getContentPaneFor(editPart);
240:            }
241:
242:            /**
243:             * overwritten to update the ActivityDecorators
244:             * @author sh
245:             */
246:            @Override
247:            public void notifyChanged(Notification notification) {
248:                super .notifyChanged(notification);
249:
250:                // notify the decorator
251:                Object editPolicy = this 
252:                        .getEditPolicy(EditPolicyRoles.DECORATION_ROLE);
253:                if (editPolicy instanceof  DecorationEditPolicy) {
254:                    ((DecorationEditPolicy) editPolicy).refresh();
255:                }
256:            }
257:
258:            /**
259:             * @generated
260:             */
261:            protected NodeFigure createNodePlate() {
262:                DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(
263:                        getMapMode().DPtoLP(100), getMapMode().DPtoLP(160));
264:
265:                return result;
266:            }
267:
268:            /**
269:             * Creates figure for this edit part.
270:             * 
271:             * Body of this method does not depend on settings in generation model
272:             * so you may safely remove <i>generated</i> tag and modify it.
273:             * 
274:             * @generated
275:             */
276:            protected NodeFigure createNodeFigure() {
277:                NodeFigure figure = createNodePlate();
278:                figure.setLayoutManager(new StackLayout());
279:                IFigure shape = createNodeShape();
280:                figure.add(shape);
281:                contentPane = setupContentPane(shape);
282:                return figure;
283:            }
284:
285:            /**
286:             * Default implementation treats passed figure as content pane.
287:             * Respects layout one may have set for generated figure.
288:             * @param nodeShape instance of generated figure class
289:             * @generated NOT
290:             * @author sh
291:             */
292:            protected IFigure setupContentPane(IFigure nodeShape) {
293:                if (nodeShape.getLayoutManager() == null) {
294:                    ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
295:                    layout.setSpacing(getMapMode().DPtoLP(0));
296:                    layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
297:                    nodeShape.setLayoutManager(layout);
298:                }
299:                return nodeShape; // use nodeShape itself as contentPane
300:            }
301:
302:            /**
303:             * @generated
304:             */
305:            public IFigure getContentPane() {
306:                if (contentPane != null) {
307:                    return contentPane;
308:                }
309:                return super .getContentPane();
310:            }
311:
312:            /**
313:             * @generated
314:             */
315:            public EditPart getPrimaryChildEditPart() {
316:                return getChildBySemanticHint(New_processVisualIDRegistry
317:                        .getType(AsyncActivityNameEditPart.VISUAL_ID));
318:            }
319:
320:            /**
321:             * @generated
322:             */
323:            public class AsyncActivityFigure extends RectangleFigure {
324:                /**
325:                 * @generated NOT
326:                 * @author sh
327:                 */
328:                public AsyncActivityFigure() {
329:                    this .setFill(true);
330:                    this .setFillXOR(false);
331:                    this .setOutline(true);
332:                    this .setOutlineXOR(false);
333:                    this .setLineWidth(0);
334:                    this .setLineStyle(Graphics.LINE_SOLID);
335:                    this .setPreferredSize(new Dimension(getMapMode()
336:                            .DPtoLP(100), getMapMode().DPtoLP(160)));
337:                    createContents();
338:
339:                    //******************* gradient *******************************
340:                    Color[] highlight = { ColorConstants.black,
341:                            ColorConstants.white };
342:                    Color[] shadow = { ColorConstants.white,
343:                            ColorConstants.black };
344:                    //this.setBorder(new SchemeBorder(new SchemeBorder.Scheme(highlight,shadow)));
345:                    this .setBorder(new LineBorder(ColorConstants.lightGray, 1));
346:                    //************************************************************
347:                }
348:
349:                /**
350:                 * @generated NOT
351:                 * @author sh
352:                 */
353:                private void createContents() {
354:                    // The Precondition Compartment
355:                    RectangleFigure asyncActivityPreconditionFigure0 = new RectangleFigure();
356:                    asyncActivityPreconditionFigure0.setFill(true);
357:                    asyncActivityPreconditionFigure0.setFillXOR(false);
358:                    asyncActivityPreconditionFigure0.setOutline(true);
359:                    asyncActivityPreconditionFigure0.setOutlineXOR(false);
360:                    asyncActivityPreconditionFigure0.setLineWidth(1);
361:                    asyncActivityPreconditionFigure0
362:                            .setLineStyle(Graphics.LINE_SOLID);
363:                    this .add(asyncActivityPreconditionFigure0);
364:                    setFigureAsyncActivityPreconditionFigure(asyncActivityPreconditionFigure0);
365:
366:                    // The Activity Name Figure
367:                    WrapLabel asyncActivityNameFigure0 = new WrapLabel();
368:                    asyncActivityNameFigure0.setText("<...>");
369:                    this .add(asyncActivityNameFigure0);
370:                    setFigureAsyncActivityNameFigure(asyncActivityNameFigure0);
371:
372:                    // The Postcondition Compartment
373:                    RectangleFigure asyncActivityPostconditionFigure0 = new RectangleFigure();
374:                    asyncActivityPostconditionFigure0.setFill(true);
375:                    asyncActivityPostconditionFigure0.setFillXOR(false);
376:                    asyncActivityPostconditionFigure0.setOutline(true);
377:                    asyncActivityPostconditionFigure0.setOutlineXOR(false);
378:                    asyncActivityPostconditionFigure0.setLineWidth(1);
379:                    asyncActivityPostconditionFigure0
380:                            .setLineStyle(Graphics.LINE_SOLID);
381:                    this .add(asyncActivityPostconditionFigure0);
382:                    setFigureAsyncActivityPostconditionFigure(asyncActivityPostconditionFigure0);
383:                }
384:
385:                /**
386:                 * @generated
387:                 */
388:                private WrapLabel fAsyncActivityNameFigure;
389:
390:                /**
391:                 * @generated
392:                 */
393:                public WrapLabel getFigureAsyncActivityNameFigure() {
394:                    return fAsyncActivityNameFigure;
395:                }
396:
397:                /**
398:                 * @generated
399:                 */
400:                private void setFigureAsyncActivityNameFigure(WrapLabel fig) {
401:                    fAsyncActivityNameFigure = fig;
402:                }
403:
404:                /**
405:                 * @generated
406:                 */
407:                private RectangleFigure fAsyncActivityPreconditionFigure;
408:
409:                /**
410:                 * @generated
411:                 */
412:                public RectangleFigure getFigureAsyncActivityPreconditionFigure() {
413:                    return fAsyncActivityPreconditionFigure;
414:                }
415:
416:                /**
417:                 * @generated
418:                 */
419:                private void setFigureAsyncActivityPreconditionFigure(
420:                        RectangleFigure fig) {
421:                    fAsyncActivityPreconditionFigure = fig;
422:                }
423:
424:                /**
425:                 * @generated
426:                 */
427:                private RectangleFigure fAsyncActivityPostconditionFigure;
428:
429:                /**
430:                 * @generated
431:                 */
432:                public RectangleFigure getFigureAsyncActivityPostconditionFigure() {
433:                    return fAsyncActivityPostconditionFigure;
434:                }
435:
436:                /**
437:                 * @generated
438:                 */
439:                private void setFigureAsyncActivityPostconditionFigure(
440:                        RectangleFigure fig) {
441:                    fAsyncActivityPostconditionFigure = fig;
442:                }
443:
444:                /**
445:                 * @generated
446:                 */
447:                private boolean myUseLocalCoordinates = false;
448:
449:                /**
450:                 * @generated
451:                 */
452:                protected boolean useLocalCoordinates() {
453:                    return myUseLocalCoordinates;
454:                }
455:
456:                /**
457:                 * @generated
458:                 */
459:                protected void setUseLocalCoordinates(
460:                        boolean useLocalCoordinates) {
461:                    myUseLocalCoordinates = useLocalCoordinates;
462:                }
463:
464:            }
465:
466:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.