Source Code Cross Referenced for FlowEditorPaletteFactory.java in  » Workflow-Engines » OpenWFE » org » openwfe » gpe » 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 » OpenWFE » org.openwfe.gpe 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.openwfe.gpe;
002:
003:        import java.util.ArrayList;
004:
005:        import java.util.List;
006:
007:        import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
008:        import org.eclipse.gef.palette.MarqueeToolEntry;
009:        import org.eclipse.gef.palette.PaletteContainer;
010:        import org.eclipse.gef.palette.PaletteDrawer;
011:        import org.eclipse.gef.palette.PaletteEntry;
012:        import org.eclipse.gef.palette.PaletteGroup;
013:        import org.eclipse.gef.palette.PaletteRoot;
014:        import org.eclipse.gef.palette.PaletteSeparator;
015:        import org.eclipse.gef.palette.SelectionToolEntry;
016:        import org.eclipse.gef.palette.ToolEntry;
017:        import org.eclipse.gef.requests.SimpleFactory;
018:
019:        import org.eclipse.jface.resource.ImageDescriptor;
020:
021:        import org.openwfe.gpe.model.AndComposite;
022:        import org.openwfe.gpe.model.CaseComposite;
023:        import org.openwfe.gpe.model.ConcurrenceComposite;
024:        import org.openwfe.gpe.model.ConcurrentIteratorElement;
025:        import org.openwfe.gpe.model.DefinedComposite;
026:        import org.openwfe.gpe.model.DefinedElement;
027:        import org.openwfe.gpe.model.EqualsElement;
028:        import org.openwfe.gpe.model.GreaterElement;
029:        import org.openwfe.gpe.model.IfComposite;
030:        import org.openwfe.gpe.model.IncElement;
031:        import org.openwfe.gpe.model.IteratorElement;
032:        import org.openwfe.gpe.model.LesserElement;
033:        import org.openwfe.gpe.model.LogElement;
034:        import org.openwfe.gpe.model.NotElement;
035:        import org.openwfe.gpe.model.OrComposite;
036:        import org.openwfe.gpe.model.ParticipantElement;
037:        import org.openwfe.gpe.model.RestoreElement;
038:        import org.openwfe.gpe.model.SaveElement;
039:        import org.openwfe.gpe.model.SequenceComposite;
040:        import org.openwfe.gpe.model.SetElement;
041:        import org.openwfe.gpe.model.SubProcessElement;
042:        import org.openwfe.gpe.model.UndefinedElement;
043:        import org.openwfe.gpe.model.UnsetElement;
044:        import org.openwfe.gpe.model.WhenComposite;
045:        import org.openwfe.gpe.model.WorkflowElement;
046:
047:        /**
048:         * Handles the creation of the palette for the Flow Editor.
049:         * it creates the palette and the drawers in which they are stored
050:         */
051:        public class FlowEditorPaletteFactory {
052:
053:            private static List createCategories(PaletteRoot root) {
054:                List categories = new ArrayList();
055:                categories.add(createControlGroup(root));
056:                categories.add(createComponentsDrawer());
057:                categories.add(createBooleanDrawer());
058:                categories.add(createLogicalDrawer());
059:                categories.add(createSetAndDefineDrawer());
060:                categories.add(createTestDrawer());
061:                categories.add(createIteratorDrawer());
062:                categories.add(createSaveAndRestoreDrawer());
063:                categories.add(createIncAndLogDrawer());
064:                return categories;
065:            }
066:
067:            private static PaletteContainer createComponentsDrawer() {
068:
069:                PaletteDrawer drawer = new PaletteDrawer("Main Components",
070:                        null);
071:                PaletteDrawer booleanDrawer = new PaletteDrawer(
072:                        "Boolean Elements", null);
073:
074:                List entries = new ArrayList();
075:                List booleanEntries = new ArrayList();
076:
077:                CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
078:                        "Flow", "Create a Flow", WorkflowElement.class,
079:                        new SimpleFactory(WorkflowElement.class),
080:                        ImageDescriptor.createFromFile(FlowPlugin.class,
081:                                "images/start16.gif"), ImageDescriptor
082:                                .createFromFile(FlowPlugin.class,
083:                                        "images/start16.gif"));
084:                entries.add(combined);
085:                PaletteSeparator sep = new PaletteSeparator();
086:                entries.add(sep);
087:
088:                combined = new CombinedTemplateCreationEntry("Sequence",
089:                        "Create a Sequential FlowElement",
090:                        SequenceComposite.class, new SimpleFactory(
091:                                SequenceComposite.class), ImageDescriptor
092:                                .createFromFile(FlowPlugin.class,
093:                                        "images/sequence16.gif"),
094:                        ImageDescriptor.createFromFile(FlowPlugin.class,
095:                                "images/sequence16.gif"));
096:                entries.add(combined);
097:
098:                combined = new CombinedTemplateCreationEntry("Concurrence",
099:                        "Create a  Parallel FlowElement",
100:                        ConcurrenceComposite.class, new SimpleFactory(
101:                                ConcurrenceComposite.class), ImageDescriptor
102:                                .createFromFile(FlowPlugin.class,
103:                                        "images/parallel16.gif"),
104:                        ImageDescriptor.createFromFile(FlowPlugin.class,
105:                                "images/parallel16.gif"));
106:                //combined.setVisible(false);
107:                entries.add(combined);
108:
109:                PaletteSeparator sep2 = new PaletteSeparator();
110:                entries.add(sep2);
111:
112:                combined = new CombinedTemplateCreationEntry("Participant",
113:                        "Create a  Participant FlowElement",
114:                        ParticipantElement.class, new SimpleFactory(
115:                                ParticipantElement.class), ImageDescriptor
116:                                .createFromFile(FlowPlugin.class,
117:                                        "images/buddy16.gif"), ImageDescriptor
118:                                .createFromFile(FlowPlugin.class,
119:                                        "images/buddy16.gif"));
120:                entries.add(combined);
121:
122:                PaletteSeparator sep3 = new PaletteSeparator();
123:                entries.add(sep3);
124:
125:                combined = new CombinedTemplateCreationEntry("Definition",
126:                        "Create a Subprocess-Definition",
127:                        DefinedComposite.class, new SimpleFactory(
128:                                DefinedComposite.class), ImageDescriptor
129:                                .createFromFile(FlowPlugin.class,
130:                                        "images/definition.gif"),
131:                        ImageDescriptor.createFromFile(FlowPlugin.class,
132:                                "images/definition.gif"));
133:                entries.add(combined);
134:
135:                combined = new CombinedTemplateCreationEntry("SubProcess",
136:                        "Create a SubProcessElement", SubProcessElement.class,
137:                        new SimpleFactory(SubProcessElement.class),
138:                        ImageDescriptor.createFromFile(FlowPlugin.class,
139:                                "images/sub.gif"), ImageDescriptor
140:                                .createFromFile(FlowPlugin.class,
141:                                        "images/sub.gif"));
142:                entries.add(combined);
143:                drawer.addAll(entries);
144:
145:                return drawer;
146:            }
147:
148:            private static PaletteContainer createBooleanDrawer() {
149:
150:                PaletteDrawer booleanDrawer = new PaletteDrawer(
151:                        "Compare Elements", null);
152:
153:                List booleanEntries = new ArrayList();
154:
155:                CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
156:                        "Greater", "Create a GreaterElement",
157:                        GreaterElement.class, new SimpleFactory(
158:                                GreaterElement.class), ImageDescriptor
159:                                .createFromFile(FlowPlugin.class,
160:                                        "images/greater.gif"), ImageDescriptor
161:                                .createFromFile(FlowPlugin.class,
162:                                        "images/greater.gif"));
163:                booleanEntries.add(combined);
164:
165:                combined = new CombinedTemplateCreationEntry("Lesser",
166:                        "Create a LesserElement", LesserElement.class,
167:                        new SimpleFactory(LesserElement.class), ImageDescriptor
168:                                .createFromFile(FlowPlugin.class,
169:                                        "images/lesser.gif"), ImageDescriptor
170:                                .createFromFile(FlowPlugin.class,
171:                                        "images/lesser.gif"));
172:                booleanEntries.add(combined);
173:
174:                combined = new CombinedTemplateCreationEntry("Equals",
175:                        "Create an EqualsElement", EqualsElement.class,
176:                        new SimpleFactory(EqualsElement.class), ImageDescriptor
177:                                .createFromFile(FlowPlugin.class,
178:                                        "images/equals.gif"), ImageDescriptor
179:                                .createFromFile(FlowPlugin.class,
180:                                        "images/equals.gif"));
181:                booleanEntries.add(combined);
182:
183:                combined = new CombinedTemplateCreationEntry("Not",
184:                        "Create a NotElement", NotElement.class,
185:                        new SimpleFactory(NotElement.class), ImageDescriptor
186:                                .createFromFile(FlowPlugin.class,
187:                                        "images/not16.gif"), ImageDescriptor
188:                                .createFromFile(FlowPlugin.class,
189:                                        "images/not16.gif"));
190:                booleanEntries.add(combined);
191:
192:                booleanDrawer.addAll(booleanEntries);
193:                booleanDrawer
194:                        .setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED);
195:                return booleanDrawer;
196:            }
197:
198:            private static PaletteContainer createLogicalDrawer() {
199:
200:                PaletteDrawer logicalDrawer = new PaletteDrawer(
201:                        "Boolean Elements", null);
202:
203:                List logicalEntries = new ArrayList();
204:
205:                CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
206:                        "Or", "Create an OrExpression", OrComposite.class,
207:                        new SimpleFactory(OrComposite.class), ImageDescriptor
208:                                .createFromFile(FlowPlugin.class,
209:                                        "images/or.gif"), ImageDescriptor
210:                                .createFromFile(FlowPlugin.class,
211:                                        "images/or.gif"));
212:                logicalEntries.add(combined);
213:
214:                combined = new CombinedTemplateCreationEntry("And",
215:                        "Create an AndExpression", AndComposite.class,
216:                        new SimpleFactory(AndComposite.class), ImageDescriptor
217:                                .createFromFile(FlowPlugin.class,
218:                                        "images/and.gif"), ImageDescriptor
219:                                .createFromFile(FlowPlugin.class,
220:                                        "images/and.gif"));
221:                logicalEntries.add(combined);
222:
223:                logicalDrawer.addAll(logicalEntries);
224:                logicalDrawer
225:                        .setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED);
226:                return logicalDrawer;
227:            }
228:
229:            private static PaletteContainer createSetAndDefineDrawer() {
230:
231:                PaletteDrawer setAndDefineDrawer = new PaletteDrawer(
232:                        "Set & Define", null);
233:
234:                List setAndDefineEntries = new ArrayList();
235:
236:                CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
237:                        "Set", "Create a SetElement", SetElement.class,
238:                        new SimpleFactory(SetElement.class), ImageDescriptor
239:                                .createFromFile(FlowPlugin.class,
240:                                        "images/set16.gif"), ImageDescriptor
241:                                .createFromFile(FlowPlugin.class,
242:                                        "images/set16.gif"));
243:                setAndDefineEntries.add(combined);
244:
245:                combined = new CombinedTemplateCreationEntry("Unset",
246:                        "Create a UnsetElement", UnsetElement.class,
247:                        new SimpleFactory(UnsetElement.class), ImageDescriptor
248:                                .createFromFile(FlowPlugin.class,
249:                                        "images/unset16.gif"), ImageDescriptor
250:                                .createFromFile(FlowPlugin.class,
251:                                        "images/unset16.gif"));
252:                setAndDefineEntries.add(combined);
253:
254:                PaletteSeparator sep = new PaletteSeparator();
255:                setAndDefineEntries.add(sep);
256:
257:                combined = new CombinedTemplateCreationEntry("Defined",
258:                        "Create a DefinedElement", DefinedElement.class,
259:                        new SimpleFactory(DefinedElement.class),
260:                        ImageDescriptor.createFromFile(FlowPlugin.class,
261:                                "images/defined.gif"), ImageDescriptor
262:                                .createFromFile(FlowPlugin.class,
263:                                        "images/defined.gif"));
264:                setAndDefineEntries.add(combined);
265:
266:                combined = new CombinedTemplateCreationEntry("Undefined",
267:                        "Create an UndefinedElement", UndefinedElement.class,
268:                        new SimpleFactory(UndefinedElement.class),
269:                        ImageDescriptor.createFromFile(FlowPlugin.class,
270:                                "images/undefined.gif"), ImageDescriptor
271:                                .createFromFile(FlowPlugin.class,
272:                                        "images/undefined.gif"));
273:                setAndDefineEntries.add(combined);
274:
275:                setAndDefineDrawer.addAll(setAndDefineEntries);
276:                setAndDefineDrawer
277:                        .setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED);
278:                return setAndDefineDrawer;
279:            }
280:
281:            private static PaletteContainer createTestDrawer() {
282:
283:                PaletteDrawer testDrawer = new PaletteDrawer("Test Elements",
284:                        null);
285:
286:                List testEntries = new ArrayList();
287:
288:                CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
289:                        "Case", "Create a CaseElement", CaseComposite.class,
290:                        new SimpleFactory(CaseComposite.class), ImageDescriptor
291:                                .createFromFile(FlowPlugin.class,
292:                                        "images/case16.gif"), ImageDescriptor
293:                                .createFromFile(FlowPlugin.class,
294:                                        "images/case16.gif"));
295:                testEntries.add(combined);
296:
297:                combined = new CombinedTemplateCreationEntry("When",
298:                        "Create a WhenElement", WhenComposite.class,
299:                        new SimpleFactory(WhenComposite.class), ImageDescriptor
300:                                .createFromFile(FlowPlugin.class,
301:                                        "images/case16.gif"), ImageDescriptor
302:                                .createFromFile(FlowPlugin.class,
303:                                        "images/case16.gif"));
304:                testEntries.add(combined);
305:
306:                combined = new CombinedTemplateCreationEntry("If",
307:                        "Create an IfElement", IfComposite.class,
308:                        new SimpleFactory(IfComposite.class), ImageDescriptor
309:                                .createFromFile(FlowPlugin.class,
310:                                        "images/case16.gif"), ImageDescriptor
311:                                .createFromFile(FlowPlugin.class,
312:                                        "images/case16.gif"));
313:                testEntries.add(combined);
314:
315:                testDrawer.addAll(testEntries);
316:                testDrawer.setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED);
317:                return testDrawer;
318:            }
319:
320:            private static PaletteContainer createSaveAndRestoreDrawer() {
321:
322:                PaletteDrawer saveAndRestoreDrawer = new PaletteDrawer(
323:                        "Save & Restore", null);
324:
325:                List saveAndRestoreEntries = new ArrayList();
326:
327:                CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
328:                        "Save", "Create a SaveElement", SaveElement.class,
329:                        new SimpleFactory(SaveElement.class), ImageDescriptor
330:                                .createFromFile(FlowPlugin.class,
331:                                        "images/save16.gif"), ImageDescriptor
332:                                .createFromFile(FlowPlugin.class,
333:                                        "images/save16.gif"));
334:                saveAndRestoreEntries.add(combined);
335:
336:                combined = new CombinedTemplateCreationEntry("Restore",
337:                        "Create a RestoreElement", RestoreElement.class,
338:                        new SimpleFactory(RestoreElement.class),
339:                        ImageDescriptor.createFromFile(FlowPlugin.class,
340:                                "images/restore16.gif"), ImageDescriptor
341:                                .createFromFile(FlowPlugin.class,
342:                                        "images/restore16.gif"));
343:                saveAndRestoreEntries.add(combined);
344:
345:                saveAndRestoreDrawer.addAll(saveAndRestoreEntries);
346:                saveAndRestoreDrawer
347:                        .setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED);
348:                return saveAndRestoreDrawer;
349:            }
350:
351:            private static PaletteContainer createIteratorDrawer() {
352:
353:                PaletteDrawer iteratorDrawer = new PaletteDrawer("Iterator",
354:                        null);
355:
356:                List iteratorEntries = new ArrayList();
357:
358:                CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
359:                        "Iterator", "Create an IteratorElement",
360:                        IteratorElement.class, new SimpleFactory(
361:                                IteratorElement.class), ImageDescriptor
362:                                .createFromFile(FlowPlugin.class,
363:                                        "images/iterator16.gif"),
364:                        ImageDescriptor.createFromFile(FlowPlugin.class,
365:                                "images/iterator16.gif"));
366:                iteratorEntries.add(combined);
367:
368:                combined = new CombinedTemplateCreationEntry(
369:                        "Concurrent-Iterator",
370:                        "Create a Concurrent-IteratorElement",
371:                        ConcurrentIteratorElement.class, new SimpleFactory(
372:                                ConcurrentIteratorElement.class),
373:                        ImageDescriptor.createFromFile(FlowPlugin.class,
374:                                "images/iterator16.gif"), ImageDescriptor
375:                                .createFromFile(FlowPlugin.class,
376:                                        "images/iterator16.gif"));
377:                iteratorEntries.add(combined);
378:
379:                iteratorDrawer.addAll(iteratorEntries);
380:                iteratorDrawer
381:                        .setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED);
382:                return iteratorDrawer;
383:            }
384:
385:            private static PaletteContainer createIncAndLogDrawer() {
386:
387:                PaletteDrawer incAndLogDrawer = new PaletteDrawer("Inc & Log",
388:                        null);
389:
390:                List incAndLogEntries = new ArrayList();
391:
392:                CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
393:                        "Increment", "Create an IncrementElement",
394:                        IncElement.class, new SimpleFactory(IncElement.class),
395:                        ImageDescriptor.createFromFile(FlowPlugin.class,
396:                                "images/inc16.gif"), ImageDescriptor
397:                                .createFromFile(FlowPlugin.class,
398:                                        "images/inc16.gif"));
399:                incAndLogEntries.add(combined);
400:
401:                combined = new CombinedTemplateCreationEntry("Log",
402:                        "Create a Log", LogElement.class, new SimpleFactory(
403:                                LogElement.class), ImageDescriptor
404:                                .createFromFile(FlowPlugin.class,
405:                                        "images/log.gif"), ImageDescriptor
406:                                .createFromFile(FlowPlugin.class,
407:                                        "images/log.gif"));
408:                incAndLogEntries.add(combined);
409:
410:                incAndLogDrawer.addAll(incAndLogEntries);
411:                //incAndLogDrawer.setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED);
412:                return incAndLogDrawer;
413:            }
414:
415:            private static PaletteContainer createControlGroup(PaletteRoot root) {
416:                PaletteGroup controlGroup = new PaletteGroup("Control Group");
417:
418:                List entries = new ArrayList();
419:
420:                ToolEntry tool = new SelectionToolEntry();
421:                entries.add(tool);
422:                root.setDefaultEntry(tool);
423:
424:                tool = new MarqueeToolEntry();
425:                entries.add(tool);
426:
427:                PaletteSeparator sep = new PaletteSeparator(
428:                        "org.openwfe.gpe.flowplugin.sep2");
429:                sep
430:                        .setUserModificationPermission(PaletteEntry.PERMISSION_NO_MODIFICATION);
431:                entries.add(sep);
432:                controlGroup.addAll(entries);
433:                return controlGroup;
434:            }
435:
436:            /**
437:             * Creates the PaletteRoot and adds all Palette elements.
438:             * @return the root
439:             */
440:            public static PaletteRoot createPalette() {
441:                PaletteRoot flowPalette = new PaletteRoot();
442:                flowPalette.addAll(createCategories(flowPalette));
443:                return flowPalette;
444:            }
445:
446:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.