Source Code Cross Referenced for ConsolePageHelper.java in  » Workflow-Engines » JFolder » org » jfolder » console » base » 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 » JFolder » org.jfolder.console.base 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JFolder, Copyright 2001-2006 Gary Steinmetz
003:         *
004:         * Distributable under LGPL license.
005:         * See terms of license at gnu.org.
006:         */
007:
008:        package org.jfolder.console.base;
009:
010:        //base classes
011:
012:        //project specific classes
013:        import org.jfolder.common.UnexpectedSystemException;
014:        import org.jfolder.common.tagging.ConceptTagCharacteristic;
015:        import org.jfolder.common.tagging.ConceptTagCharacteristicHolder;
016:        import org.jfolder.common.tagging.ConceptTagConstraint;
017:        import org.jfolder.common.tagging.ConceptTagConstraintHolder;
018:        import org.jfolder.common.tagging.ConceptTagMenuBranch;
019:        import org.jfolder.common.tagging.ConceptTagMenuOption;
020:        import org.jfolder.common.tagging.ConceptTagPreferences;
021:        import org.jfolder.common.tagging.ConceptTagSetHolder;
022:        import org.jfolder.common.tagging.StudioConceptTagCreParInfoContextHolder;
023:        import org.jfolder.common.web.template.ConsoleParameterContext;
024:        import org.jfolder.common.web.template.ConsoleTemplateContext;
025:        import org.jfolder.common.web.template.ConsoleTemplateFunctionsContext;
026:        import org.jfolder.common.web.template.MenuBranch;
027:        import org.jfolder.common.web.template.MenuLeaf;
028:        import org.jfolder.common.web.template.SubmitActionContext;
029:
030:        //other classes
031:
032:        public class ConsolePageHelper {
033:
034:            //
035:            private ConsolePageHelper() {
036:            }
037:
038:            //
039:            public final static boolean isConstraintHolderEmpty(
040:                    ConceptTagConstraintHolder inCtconh) {
041:                //
042:                boolean outValue = true;
043:
044:                if (inCtconh != null) {
045:                    //
046:                    ConceptTagConstraintHolder attrsCtconh = inCtconh
047:                            .getAttributes();
048:                    outValue &= isConstraintHolderEmpty(attrsCtconh);
049:                    //
050:                    ConceptTagConstraintHolder styleCtconh = inCtconh
051:                            .getStyles();
052:                    outValue &= isConstraintHolderEmpty(styleCtconh);
053:                    //
054:                    //
055:                    for (int i = 0; i < inCtconh.getConstraintCount(); i++) {
056:                        ConceptTagConstraint nextCtcon = inCtconh
057:                                .getConstraint(i);
058:                        outValue &= isConstraintEmpty(nextCtcon);
059:                    }
060:                    //
061:                    outValue &= isConstraintEmpty(inCtconh
062:                            .getUndefinedConstraint());
063:
064:                    //
065:                    ConceptTagCharacteristicHolder ctcharh = inCtconh
066:                            .getCharacteristicHolder();
067:                    outValue &= !ctcharh.getParentMessageHolder()
068:                            .isErrorPresent();
069:                } else {
070:                    outValue = true;
071:                }
072:
073:                return outValue;
074:            }
075:
076:            //
077:            public final static boolean isConstraintEmpty(
078:                    ConceptTagConstraint inCtcon) {
079:                //
080:                boolean outValue = true;
081:
082:                if (inCtcon != null) {
083:                    //
084:                    ConceptTagCharacteristic ctchar = inCtcon
085:                            .getCharacteristic();
086:                    //
087:                    //
088:                    if (inCtcon.getMinimumLength() > 0) {
089:                        outValue &= false;
090:                    } else if (inCtcon.getMaximumLength() > 0) {
091:                        outValue &= false;
092:                    } else if (inCtcon.isLengthUnbounded()) {
093:                        outValue &= false;
094:                    } else if (ctchar.getValueLength() > 0) {
095:                        outValue &= false;
096:                    } else {
097:                        //
098:                    }
099:
100:                    //
101:                    outValue &= !ctchar.getParentMessageHolder()
102:                            .isErrorPresent();
103:                } else {
104:                    outValue = true;
105:                }
106:
107:                return outValue;
108:            }
109:
110:            //
111:            //
112:            //
113:            //
114:            //
115:            //
116:            //
117:            //
118:            //
119:            //
120:            //
121:            //
122:            //
123:            //
124:            public final static MenuBranch constructMenu(
125:                    ConceptTagConstraint inCtcon, ConceptTagMenuBranch inCtmb,
126:                    ConceptTagSetHolder inCtsh, String inCode, int inIndex,
127:                    String inAction, String inSubAction,
128:                    ConsoleTemplateContext inCpc) {
129:
130:                MenuBranch outValue = null;
131:
132:                outValue = MenuBranch.newInstance("Root");
133:
134:                constructMenu(outValue, inCtcon, inCtmb, inCtsh, inCode,
135:                        inIndex, inAction, inSubAction, inCpc);
136:
137:                return outValue;
138:            }
139:
140:            private final static void constructMenu(MenuBranch inMb,
141:                    ConceptTagConstraint inCtcon, ConceptTagMenuBranch inCtmb,
142:                    ConceptTagSetHolder inCtsh, String inCode, int inIndex,
143:                    String inFirstAction, String inSecondAction,
144:                    ConsoleTemplateContext inCpc) {
145:
146:                for (int i = 0; i < inCtmb.getChildNodeCount(); i++) {
147:                    if (inCtmb.isChildNodeBranch(i)) {
148:                        ConceptTagMenuBranch nextCtmb = inCtmb
149:                                .getChildNodeAsBranch(i);
150:                        String branchName = nextCtmb.getName();
151:                        MenuBranch nextBranch = MenuBranch
152:                                .newInstance(branchName);
153:                        inMb.add(nextBranch);
154:                        constructMenu(nextBranch, inCtcon, nextCtmb, inCtsh,
155:                                inCode, inIndex, inFirstAction, inSecondAction,
156:                                inCpc);
157:                    } else if (inCtmb.isChildNodeOption(i)) {
158:                        ConceptTagMenuOption nextCtmo = inCtmb
159:                                .getChildNodeAsOption(i);
160:                        String leafName = getConceptTagLabel(nextCtmo
161:                                .getNamespace(), nextCtmo.getName(), inCtsh);
162:                        //String leafName = "Change This";
163:
164:                        SubmitActionContext sac = SubmitActionContext
165:                                .newInstance(inCpc);
166:                        initializeCreateConceptTag(sac, true, nextCtmo
167:                                .getNamespace(), nextCtmo.getName(),
168:                                inFirstAction, inSecondAction, inCode, inIndex);
169:
170:                        MenuLeaf nextLeaf = MenuLeaf.newInstance(leafName, sac
171:                                .submitActionCall(true));
172:                        inMb.add(nextLeaf);
173:                    } else {
174:                        UnexpectedSystemException.unknownState();
175:                    }
176:                }
177:            }
178:
179:            public final static void initializeCreateConceptTag(
180:                    SubmitActionContext inSac, boolean inUseQuotes,
181:                    String inCtNs, String inCtName,
182:                    String inUnquotedFirstAction, String inSecondAction,
183:                    String inCode, int inIndex) {
184:                //
185:                //
186:                inSac.addAction(ConsoleParameterContext.FIRST_INPUT,
187:                        inUnquotedFirstAction);
188:                if (inSecondAction != null) {
189:                    inSac.addAction(ConsoleParameterContext.SECOND_INPUT,
190:                            ConsoleTemplateFunctionsContext.singleQuotes(
191:                                    inSecondAction, inUseQuotes));
192:                }
193:                //
194:                inSac.addParameter(ConsoleParameterContext.FIRST_INPUT,
195:                        ConsoleTemplateFunctionsContext.singleQuotes(inCode,
196:                                inUseQuotes));
197:                inSac.addParameter(ConsoleParameterContext.SECOND_INPUT,
198:                        ConsoleTemplateFunctionsContext.singleQuotes(inIndex
199:                                + "", inUseQuotes));
200:                //
201:                if (inCtNs != null) {
202:                    inSac.addParameter(ConsoleParameterContext.THIRD_INPUT,
203:                            ConsoleTemplateFunctionsContext.singleQuotes(
204:                                    inCtNs, inUseQuotes));
205:                } else {
206:                    inSac.addParameter(ConsoleParameterContext.THIRD_INPUT,
207:                            ConsoleTemplateFunctionsContext.singleQuotes("",
208:                                    inUseQuotes));
209:                }
210:                inSac.addParameter(ConsoleParameterContext.FOURTH_INPUT,
211:                        ConsoleTemplateFunctionsContext.singleQuotes(inCtName,
212:                                inUseQuotes));
213:            }
214:
215:            //protected final static String createConceptTagSac()
216:
217:            private final static String getConceptTagLabel(String inNs,
218:                    String inN, ConceptTagSetHolder inCtsh) {
219:
220:                String outValue = null;
221:
222:                if (inCtsh.isConceptTagSetClassPresent(inNs, inN)) {
223:                    String tagClass = inCtsh.getConceptTagClassAsString(inNs,
224:                            inN);
225:                    outValue = inCtsh.getTypeTitle(tagClass);
226:                } else {
227:                    outValue = "Unknown";
228:                }
229:
230:                return outValue;
231:            }
232:
233:            //////////////////////////////////////////////////////////////////
234:            public final static MenuBranch constructMenu(
235:                    ConceptTagMenuBranch inCtmb, ConceptTagSetHolder inCtsh,
236:                    ConsoleTemplateContext inCpc, ConceptTagPreferences inCtp) {
237:
238:                MenuBranch outValue = null;
239:
240:                outValue = MenuBranch.newInstance("Root");
241:
242:                constructMenu(outValue, inCtmb, inCtsh, inCpc, inCtp);
243:
244:                return outValue;
245:            }
246:
247:            private final static void constructMenu(MenuBranch inMb,
248:                    ConceptTagMenuBranch inCtmb, ConceptTagSetHolder inCtsh,
249:                    ConsoleTemplateContext inCpc, ConceptTagPreferences inCtp) {
250:
251:                for (int i = 0; i < inCtmb.getChildNodeCount(); i++) {
252:                    //
253:                    if (inCtmb.isChildNodeBranch(i)) {
254:                        //
255:                        ConceptTagMenuBranch nextCtmb = inCtmb
256:                                .getChildNodeAsBranch(i);
257:                        String branchName = nextCtmb.getName();
258:                        MenuBranch nextBranch = MenuBranch
259:                                .newInstance(branchName);
260:                        inMb.add(nextBranch);
261:                        constructMenu(nextBranch, nextCtmb, inCtsh, inCpc,
262:                                inCtp);
263:                    } else if (inCtmb.isChildNodeOption(i)) {
264:                        //
265:                        ConceptTagMenuOption nextCtmo = inCtmb
266:                                .getChildNodeAsOption(i);
267:                        String leafName = getConceptTagLabel(nextCtmo
268:                                .getNamespace(), nextCtmo.getName(), inCtsh);
269:                        //
270:                        //String leafName = "Change This";
271:                        //SubmitActionContext sac =
272:                        //    SubmitActionContext.newInstance(inCpc);
273:                        //initializeCreateConceptTag(
274:                        //    sac, true, nextCtmo.getNamespace(), nextCtmo.getName(),
275:                        //    inFirstAction, inSecondAction, inCode, inIndex);
276:                        StudioConceptTagCreParInfoContextHolder localScpch = inCtp
277:                                .getCreationParameters();
278:                        //
279:                        //
280:                        String nextCtNs = nextCtmo.getNamespace();
281:                        String nextCtName = nextCtmo.getName();
282:                        //
283:                        int nextScpchIndex = -1;
284:
285:                        if (localScpch.isConstraintHeirarchyPresent(nextCtNs,
286:                                nextCtName, new String[0])) {
287:                            //
288:                            nextScpchIndex = localScpch.getIndex(nextCtNs,
289:                                    nextCtName, new String[0]);
290:                        }
291:
292:                        MenuLeaf nextLeaf = null;
293:
294:                        if (nextCtNs != null) {
295:                            nextLeaf = MenuLeaf.newInstance(leafName,
296:                                    "studioSelectConceptTag('" + nextCtNs
297:                                            + "', '" + nextCtName + "', "
298:                                            + nextScpchIndex + ")");
299:                        } else {
300:                            nextLeaf = MenuLeaf.newInstance(leafName,
301:                                    "studioSelectConceptTag(null, '"
302:                                            + nextCtName + "', "
303:                                            + nextScpchIndex + ")");
304:                        }
305:                        //sac.submitActionCall());
306:                        inMb.add(nextLeaf);
307:                    } else {
308:                        UnexpectedSystemException.unknownState();
309:                    }
310:                }
311:            }
312:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.