Source Code Cross Referenced for PaletteDescriptor.java in  » Workflow-Engines » OSWorkflow » com » opensymphony » workflow » loader » 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 » OSWorkflow » com.opensymphony.workflow.loader 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.opensymphony.workflow.loader;
002:
003:        import java.io.PrintWriter;
004:        import java.util.ArrayList;
005:        import java.util.List;
006:
007:        import org.w3c.dom.Element;
008:        import com.opensymphony.workflow.designer.swing.EnhancedResourceBundle;
009:
010:        /**
011:         * @author jackflit
012:         * Date: 2003-11-21
013:         */
014:        public class PaletteDescriptor extends AbstractDescriptor {
015:            protected List statusList = new ArrayList();
016:            protected List joinList = new ArrayList();
017:            protected List preList = new ArrayList();
018:            protected List permissionList = new ArrayList();
019:            protected List resultList = new ArrayList();
020:            protected List validatorList = new ArrayList();
021:            protected List registerList = new ArrayList();
022:            protected List triggerList = new ArrayList();
023:            protected List argtypeList = new ArrayList();
024:            protected String defaultOldStatus = null;
025:            protected String defaultNextStatus = null;
026:            private EnhancedResourceBundle bundle;
027:
028:            public PaletteDescriptor(Element root, EnhancedResourceBundle bundle) {
029:                this .bundle = bundle;
030:                init(root);
031:            }
032:
033:            public ConfigConditionDescriptor[] getJoinConditions() {
034:                ConfigConditionDescriptor[] config = new ConfigConditionDescriptor[joinList
035:                        .size()];
036:                joinList.toArray(config);
037:                return config;
038:            }
039:
040:            public ConfigFunctionDescriptor[] getPreFunctions() {
041:                ConfigFunctionDescriptor[] array = new ConfigFunctionDescriptor[preList
042:                        .size()];
043:                preList.toArray(array);
044:                return array;
045:            }
046:
047:            public PermissionConditionDescriptor[] getPermissionConditions() {
048:                PermissionConditionDescriptor[] array = new PermissionConditionDescriptor[permissionList
049:                        .size()];
050:                permissionList.toArray(array);
051:                return array;
052:            }
053:
054:            public ConfigConditionDescriptor[] getResultConditions() {
055:                ConfigConditionDescriptor[] config = new ConfigConditionDescriptor[resultList
056:                        .size()];
057:                resultList.toArray(config);
058:                return config;
059:            }
060:
061:            public ConfigRegisterDescriptor[] getRegisters() {
062:                // workflow registers
063:                ConfigRegisterDescriptor[] config = new ConfigRegisterDescriptor[registerList
064:                        .size()];
065:                registerList.toArray(config);
066:                return config;
067:            }
068:
069:            public ConfigValidatorDescriptor[] getValidators() {
070:                ConfigValidatorDescriptor[] config = new ConfigValidatorDescriptor[validatorList
071:                        .size()];
072:                validatorList.toArray(config);
073:                return config;
074:            }
075:
076:            public ConfigFunctionDescriptor[] getTriggerFunctions() {
077:                ConfigFunctionDescriptor[] config = new ConfigFunctionDescriptor[triggerList
078:                        .size()];
079:                triggerList.toArray(config);
080:                return config;
081:            }
082:
083:            public String[] getStatusNames() {
084:                String[] names = new String[statusList.size()];
085:
086:                for (int i = 0; i < names.length; i++) {
087:                    StatusDescriptor status = (StatusDescriptor) statusList
088:                            .get(i);
089:                    names[i] = status.getName();
090:                }
091:                return names;
092:            }
093:
094:            public ConfigConditionDescriptor getJoinCondition(String name) {
095:                if (name == null) {
096:                    return null;
097:                }
098:                for (int i = 0; i < joinList.size(); i++) {
099:                    ConfigConditionDescriptor join = (ConfigConditionDescriptor) joinList
100:                            .get(i);
101:                    if (name.equals(join.getName())) {
102:                        return join;
103:                    }
104:                }
105:                return null;
106:            }
107:
108:            public ConfigFunctionDescriptor getPrefunction(String name) {
109:                if (name == null) {
110:                    return null;
111:                }
112:                for (int i = 0; i < preList.size(); i++) {
113:                    ConfigFunctionDescriptor pre = (ConfigFunctionDescriptor) preList
114:                            .get(i);
115:                    if (name.equals(pre.getName())) {
116:                        return pre;
117:                    }
118:                }
119:                return null;
120:            }
121:
122:            public PermissionConditionDescriptor getPermissionCondition(
123:                    String name) {
124:                if (name == null) {
125:                    return null;
126:                }
127:                for (int i = 0; i < permissionList.size(); i++) {
128:                    PermissionConditionDescriptor perm = (PermissionConditionDescriptor) permissionList
129:                            .get(i);
130:                    if (name.equals(perm.getName())) {
131:                        return perm;
132:                    }
133:                }
134:                return null;
135:            }
136:
137:            public ConfigConditionDescriptor getResultCondition(String name) {
138:                if (name == null) {
139:                    return null;
140:                }
141:                for (int i = 0; i < joinList.size(); i++) {
142:                    ConfigConditionDescriptor result = (ConfigConditionDescriptor) resultList
143:                            .get(i);
144:                    if (name.equals(result.getName())) {
145:                        return result;
146:                    }
147:                }
148:                return null;
149:            }
150:
151:            public ConfigFunctionDescriptor getTriggerFunction(String name) {
152:                if (name == null)
153:                    return null;
154:                for (int i = 0; i < triggerList.size(); i++) {
155:                    ConfigFunctionDescriptor function = (ConfigFunctionDescriptor) triggerList
156:                            .get(i);
157:                    if (name.equals(function.getName()))
158:                        return function;
159:                }
160:                return null;
161:            }
162:
163:            public ConfigRegisterDescriptor getRegister(String name) {
164:                if (name == null)
165:                    return null;
166:                for (int i = 0; i < registerList.size(); i++) {
167:                    ConfigRegisterDescriptor reg = (ConfigRegisterDescriptor) registerList
168:                            .get(i);
169:                    if (name.equals(reg.getVariableName()))
170:                        return reg;
171:                }
172:                return null;
173:            }
174:
175:            public ArgType getArgType(String name) {
176:                if (name == null)
177:                    return null;
178:                for (int i = 0; i < argtypeList.size(); i++) {
179:                    ArgType type = (ArgType) argtypeList.get(i);
180:                    if (name.equals(type.getName()))
181:                        return type;
182:                }
183:                return null;
184:            }
185:
186:            public String getDefaultOldStatus() {
187:                return defaultOldStatus;
188:            }
189:
190:            public String getDefaultNextStatus() {
191:                return defaultNextStatus;
192:            }
193:
194:            public void writeXML(PrintWriter writer, int indent) {
195:                throw new UnsupportedOperationException();
196:            }
197:
198:            protected void init(Element root) {
199:                // argtypes
200:                Element a = XMLUtil.getChildElement(root, "argtypes");
201:                if (a != null) {
202:                    List types = XMLUtil.getChildElements(a, "argtype");
203:                    for (int i = 0; i < types.size(); i++) {
204:                        Element argtype = (Element) types.get(i);
205:                        String sClass = argtype.getAttribute("class");
206:                        if (sClass != null) {
207:                            ArgType argImpl = null;
208:                            try {
209:                                argImpl = (ArgType) Class.forName(sClass)
210:                                        .newInstance();
211:                                if ((argImpl != null)
212:                                        && (argImpl.init(argtype))) {
213:                                    argtypeList.add(argImpl);
214:                                }
215:                            } catch (Exception e) {
216:                                e.printStackTrace();
217:                            }
218:                        }
219:                    }
220:                }
221:
222:                // joinconditions
223:                Element s = XMLUtil.getChildElement(root, "statusvalues");
224:                defaultNextStatus = s.getAttribute("default-next");
225:                defaultOldStatus = s.getAttribute("default-old");
226:                List l = XMLUtil.getChildElements(s, "status");
227:                for (int i = 0; i < l.size(); i++) {
228:                    Element status = (Element) l.get(i);
229:                    StatusDescriptor statusDescriptor = new StatusDescriptor(
230:                            status);
231:                    statusDescriptor.setParent(this );
232:                    statusList.add(statusDescriptor);
233:                }
234:                Element j = XMLUtil.getChildElement(root, "joinconditions");
235:                if (j != null) {
236:                    List joins = XMLUtil.getChildElements(j, "condition");
237:                    for (int i = 0; i < joins.size(); i++) {
238:                        Element condition = (Element) joins.get(i);
239:                        ConfigConditionDescriptor jcd = new ConfigConditionDescriptor(
240:                                this , condition);
241:                        jcd.setDescription(bundle.getString(jcd.getName()
242:                                + ".long"));
243:                        jcd.setDisplayName(bundle.getString(jcd.getName()));
244:                        jcd.setParent(this );
245:                        joinList.add(jcd);
246:                    }
247:                }
248:
249:                // prefunctions
250:                Element p = XMLUtil.getChildElement(root, "functions");
251:                if (p != null) {
252:                    List functions = XMLUtil.getChildElements(p, "function");
253:                    for (int i = 0; i < functions.size(); i++) {
254:                        Element function = (Element) functions.get(i);
255:                        ConfigFunctionDescriptor pd = new ConfigFunctionDescriptor(
256:                                this , function);
257:                        pd.setDescription(bundle.getString(pd.getName()
258:                                + ".long"));
259:                        pd.setDisplayName(bundle.getString(pd.getName()));
260:                        pd.setParent(this );
261:                        preList.add(pd);
262:                    }
263:                }
264:
265:                // permissionconditions
266:                Element pm = XMLUtil.getChildElement(root,
267:                        "permissionconditions");
268:                if (pm != null) {
269:                    List joins = XMLUtil.getChildElements(pm, "condition");
270:                    for (int i = 0; i < joins.size(); i++) {
271:                        Element condition = (Element) joins.get(i);
272:                        PermissionConditionDescriptor pcd = new PermissionConditionDescriptor(
273:                                this , condition);
274:                        pcd.setDescription(bundle.getString(pcd.getName()
275:                                + ".long"));
276:                        pcd.setDisplayName(bundle.getString(pcd.getName()));
277:                        pcd.setParent(this );
278:                        permissionList.add(pcd);
279:                    }
280:                }
281:
282:                // resultconditions
283:                Element r = XMLUtil.getChildElement(root, "resultconditions");
284:                if (r != null) {
285:                    List conditions = XMLUtil.getChildElements(r, "condition");
286:                    for (int i = 0; i < conditions.size(); i++) {
287:                        Element condition = (Element) conditions.get(i);
288:                        ConfigConditionDescriptor rcd = new ConfigConditionDescriptor(
289:                                this , condition);
290:                        rcd.setDescription(bundle.getString(rcd.getName()
291:                                + ".long"));
292:                        rcd.setDisplayName(bundle.getString(rcd.getName()));
293:                        rcd.setParent(this );
294:                        resultList.add(rcd);
295:                    }
296:                }
297:
298:                // registers
299:                Element rr = XMLUtil.getChildElement(root, "registers");
300:                if (rr != null) {
301:                    List registers = XMLUtil.getChildElements(rr, "register");
302:                    for (int i = 0; i < registers.size(); i++) {
303:                        Element register = (Element) registers.get(i);
304:                        ConfigRegisterDescriptor rd = new ConfigRegisterDescriptor(
305:                                this , register);
306:                        rd.setDescription(bundle.getString(rd.getName()
307:                                + ".long"));
308:                        rd.setVariableName(bundle.getString(rd.getName()));
309:                        rd.setParent(this );
310:                        registerList.add(rd);
311:                    }
312:                }
313:
314:                // trigger-functions
315:                Element tf = XMLUtil.getChildElement(root, "triggerfunctions");
316:                if (tf != null) {
317:                    List functions = XMLUtil.getChildElements(tf, "function");
318:                    for (int i = 0; i < functions.size(); i++) {
319:                        Element function = (Element) functions.get(i);
320:                        ConfigFunctionDescriptor pd = new ConfigFunctionDescriptor(
321:                                this , function);
322:                        pd.setDescription(bundle.getString(pd.getName()
323:                                + ".long"));
324:                        pd.setDisplayName(bundle.getString(pd.getName()));
325:                        pd.setParent(this );
326:                        triggerList.add(pd);
327:                    }
328:                }
329:
330:                // validators
331:                Element vl = XMLUtil.getChildElement(root, "validators");
332:                if (vl != null) {
333:                    List validators = XMLUtil.getChildElements(vl, "validator");
334:                    for (int i = 0; i < validators.size(); i++) {
335:                        Element validator = (Element) validators.get(i);
336:                        ConfigValidatorDescriptor vd = new ConfigValidatorDescriptor(
337:                                this , validator);
338:                        vd.setDescription(bundle.getString(vd.getName()
339:                                + ".long"));
340:                        vd.setName(bundle.getString(vd.getName()));
341:                        vd.setParent(this );
342:                        validatorList.add(vd);
343:                    }
344:                }
345:
346:            }
347:
348:            public EnhancedResourceBundle getBundle() {
349:                return bundle;
350:            }
351:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.