Source Code Cross Referenced for SyncActivityEditPart.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.SyncActivityItemSemanticEditPolicy;
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 SyncActivityEditPart extends ShapeNodeEditPart {
042:
043:            /**
044:             * @generated
045:             */
046:            public static final int VISUAL_ID = 2001;
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 SyncActivityEditPart(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_3001) {
081:                                            EditPart compartmentEditPart = getChildBySemanticHint(New_processVisualIDRegistry
082:                                                    .getType(SyncActivitySynActivityPreconditionCompartmentEditPart.VISUAL_ID));
083:                                            return compartmentEditPart == null ? null
084:                                                    : compartmentEditPart
085:                                                            .getCommand(request);
086:                                        }
087:                                        if (type == New_processElementTypes.Expression_3006) {
088:                                            EditPart compartmentEditPart = getChildBySemanticHint(New_processVisualIDRegistry
089:                                                    .getType(SyncActivitySynActivityPostconditionCompartmentEditPart.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 SyncActivityItemSemanticEditPolicy());
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:                SyncActivityFigure figure = new SyncActivityFigure();
139:                return primaryShape = figure;
140:            }
141:
142:            /**
143:             * @generated
144:             */
145:            public SyncActivityFigure getPrimaryShape() {
146:                return (SyncActivityFigure) primaryShape;
147:            }
148:
149:            /**
150:             * @generated
151:             */
152:            protected boolean addFixedChild(EditPart childEditPart) {
153:                if (childEditPart instanceof  SyncActivityNameEditPart) {
154:                    ((SyncActivityNameEditPart) childEditPart)
155:                            .setLabel(getPrimaryShape()
156:                                    .getFigureSynActivityNameFigure());
157:                    return true;
158:                }
159:                if (childEditPart instanceof  SyncActivitySynActivityPreconditionCompartmentEditPart) {
160:                    IFigure pane = getPrimaryShape()
161:                            .getFigureSyncActivityPreconditionFigure();
162:                    setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
163:                    pane
164:                            .add(((SyncActivitySynActivityPreconditionCompartmentEditPart) childEditPart)
165:                                    .getFigure());
166:                    return true;
167:                }
168:                if (childEditPart instanceof  SyncActivitySynActivityPostconditionCompartmentEditPart) {
169:                    IFigure pane = getPrimaryShape()
170:                            .getFigureSyncActivityPostconditionFigure();
171:                    setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
172:                    pane
173:                            .add(((SyncActivitySynActivityPostconditionCompartmentEditPart) 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  SyncActivitySynActivityPreconditionCompartmentEditPart) {
186:                    IFigure pane = getPrimaryShape()
187:                            .getFigureSyncActivityPreconditionFigure();
188:                    setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
189:                    pane
190:                            .remove(((SyncActivitySynActivityPreconditionCompartmentEditPart) childEditPart)
191:                                    .getFigure());
192:                    return true;
193:                }
194:                if (childEditPart instanceof  SyncActivitySynActivityPostconditionCompartmentEditPart) {
195:                    IFigure pane = getPrimaryShape()
196:                            .getFigureSyncActivityPostconditionFigure();
197:                    setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way 
198:                    pane
199:                            .remove(((SyncActivitySynActivityPostconditionCompartmentEditPart) 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  SyncActivitySynActivityPreconditionCompartmentEditPart) {
232:                    return getPrimaryShape()
233:                            .getFigureSyncActivityPreconditionFigure();
234:                }
235:                if (editPart instanceof  SyncActivitySynActivityPostconditionCompartmentEditPart) {
236:                    return getPrimaryShape()
237:                            .getFigureSyncActivityPostconditionFigure();
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(SyncActivityNameEditPart.VISUAL_ID));
318:            }
319:
320:            /**
321:             * @generated
322:             */
323:            public class SyncActivityFigure extends RectangleFigure {
324:                /**
325:                 * @generated NOT
326:                 * @author sh
327:                 */
328:                public SyncActivityFigure() {
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 syncActivityPreconditionFigure0 = new RectangleFigure();
356:                    syncActivityPreconditionFigure0.setFill(true);
357:                    syncActivityPreconditionFigure0.setFillXOR(false);
358:                    syncActivityPreconditionFigure0.setOutline(true);
359:                    syncActivityPreconditionFigure0.setOutlineXOR(false);
360:                    syncActivityPreconditionFigure0.setLineWidth(1);
361:                    syncActivityPreconditionFigure0
362:                            .setLineStyle(Graphics.LINE_SOLID);
363:                    this .add(syncActivityPreconditionFigure0);
364:                    setFigureSyncActivityPreconditionFigure(syncActivityPreconditionFigure0);
365:
366:                    // The Activity Name Figure
367:                    WrapLabel synActivityNameFigure0 = new WrapLabel();
368:                    synActivityNameFigure0.setText("<...>");
369:                    this .add(synActivityNameFigure0);
370:                    setFigureSynActivityNameFigure(synActivityNameFigure0);
371:
372:                    // The Postcondition Compartment
373:                    RectangleFigure syncActivityPostconditionFigure0 = new RectangleFigure();
374:                    syncActivityPostconditionFigure0.setFill(true);
375:                    syncActivityPostconditionFigure0.setFillXOR(false);
376:                    syncActivityPostconditionFigure0.setOutline(true);
377:                    syncActivityPostconditionFigure0.setOutlineXOR(false);
378:                    syncActivityPostconditionFigure0.setLineWidth(1);
379:                    syncActivityPostconditionFigure0
380:                            .setLineStyle(Graphics.LINE_SOLID);
381:                    this .add(syncActivityPostconditionFigure0);
382:                    setFigureSyncActivityPostconditionFigure(syncActivityPostconditionFigure0);
383:                }
384:
385:                /**
386:                 * @generated
387:                 */
388:                private WrapLabel fSynActivityNameFigure;
389:
390:                /**
391:                 * @generated
392:                 */
393:                public WrapLabel getFigureSynActivityNameFigure() {
394:                    return fSynActivityNameFigure;
395:                }
396:
397:                /**
398:                 * @generated
399:                 */
400:                private void setFigureSynActivityNameFigure(WrapLabel fig) {
401:                    fSynActivityNameFigure = fig;
402:                }
403:
404:                /**
405:                 * @generated
406:                 */
407:                private RectangleFigure fSyncActivityPreconditionFigure;
408:
409:                /**
410:                 * @generated
411:                 */
412:                public RectangleFigure getFigureSyncActivityPreconditionFigure() {
413:                    return fSyncActivityPreconditionFigure;
414:                }
415:
416:                /**
417:                 * @generated
418:                 */
419:                private void setFigureSyncActivityPreconditionFigure(
420:                        RectangleFigure fig) {
421:                    fSyncActivityPreconditionFigure = fig;
422:                }
423:
424:                /**
425:                 * @generated
426:                 */
427:                private RectangleFigure fSyncActivityPostconditionFigure;
428:
429:                /**
430:                 * @generated
431:                 */
432:                public RectangleFigure getFigureSyncActivityPostconditionFigure() {
433:                    return fSyncActivityPostconditionFigure;
434:                }
435:
436:                /**
437:                 * @generated
438:                 */
439:                private void setFigureSyncActivityPostconditionFigure(
440:                        RectangleFigure fig) {
441:                    fSyncActivityPostconditionFigure = 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.