Source Code Cross Referenced for StudioConceptTagUsabilityContext.java in  » Workflow-Engines » JFolder » org » jfolder » common » tagging » 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.common.tagging 
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.common.tagging;
009:
010:        //base classes
011:        import java.io.IOException;
012:        import java.util.ArrayList;
013:        import java.util.HashMap;
014:        import java.util.Iterator;
015:
016:        //project specific classes
017:        import org.jfolder.common.StandardDataTypes;
018:        import org.jfolder.common.utils.misc.CommonSeparators;
019:        import org.jfolder.common.web.template.ConsoleParameterContext;
020:        import org.jfolder.common.web.template.ConsoleTemplateContext;
021:        import org.jfolder.common.web.template.CreationParameterContext;
022:        import org.jfolder.common.web.template.SubmitActionContext;
023:        import org.jfolder.common.web.template.SubmitActionParameters;
024:
025:        //other classes
026:
027:        public class StudioConceptTagUsabilityContext {
028:
029:            //
030:            private HashMap variableSpheresMap = null;
031:            private ArrayList variableSpheresList = null;
032:            //
033:            private ArrayList conceptTagSelection = null;
034:            private ArrayList constraintSac = null;
035:
036:            protected StudioConceptTagUsabilityContext() {
037:                //
038:                this .variableSpheresMap = new HashMap();
039:                this .variableSpheresList = new ArrayList();
040:                //
041:                this .conceptTagSelection = new ArrayList();
042:                this .constraintSac = new ArrayList();
043:            }
044:
045:            protected void declareVariableSphere(String inParentHandle,
046:                    int inIndex, HashMap inVariables) {
047:                //
048:                String actualHandle = null;
049:                Object o[] = new Object[3];
050:                if (inIndex != -1) {
051:                    actualHandle = inParentHandle
052:                            + CommonSeparators.HANDLE_SEPARATOR + inIndex;
053:                    //
054:                    o[0] = inParentHandle;
055:                    o[1] = new Integer(inIndex);
056:                    o[2] = inVariables;
057:                } else {
058:                    actualHandle = inParentHandle;
059:                    //
060:                    o[0] = inParentHandle;
061:                    o[1] = null;
062:                    o[2] = inVariables;
063:                }
064:                //
065:                //
066:                if (this .variableSpheresList.contains(actualHandle)) {
067:                    this .variableSpheresMap.put(actualHandle, o);
068:                } else {
069:                    this .variableSpheresMap.put(actualHandle, o);
070:                    this .variableSpheresList.add(actualHandle);
071:                }
072:                //
073:            }
074:
075:            public int getVariableSphereCount() {
076:                return this .variableSpheresList.size();
077:            }
078:
079:            public String getVariableSphereConstraint(int inIndex) {
080:
081:                String outValue = null;
082:
083:                Object o[] = getVariableSphere(inIndex);
084:                outValue = ((String) o[0]);
085:
086:                return outValue;
087:            }
088:
089:            public boolean isVariableSphereIndexPresent(int inIndex) {
090:
091:                boolean outValue = false;
092:
093:                Object o[] = getVariableSphere(inIndex);
094:                outValue = (o[1] != null);
095:
096:                return outValue;
097:            }
098:
099:            public int getVariableSphereIndex(int inIndex) {
100:
101:                int outValue = 0;
102:
103:                Object o[] = getVariableSphere(inIndex);
104:                Integer index = ((Integer) o[1]);
105:                outValue = index.intValue();
106:
107:                return outValue;
108:            }
109:
110:            public String getVariableSphereContents(int inIndex, String inType) {
111:
112:                String outValue = null;
113:
114:                ArrayList variableList = new ArrayList();
115:
116:                //
117:                Class compareType = StandardDataTypes.getActualClass(inType);
118:                //
119:                Object o[] = getVariableSphere(inIndex);
120:                HashMap vars = ((HashMap) o[2]);
121:                Iterator iter = vars.keySet().iterator();
122:                while (iter.hasNext()) {
123:                    String nextVarName = ((String) iter.next());
124:                    ValueAndClassForConceptTag nextVarVac = ((ValueAndClassForConceptTag) vars
125:                            .get(nextVarName));
126:                    if (compareType
127:                            .isAssignableFrom(nextVarVac.getValueClass())) {
128:                        variableList.add(nextVarName);
129:                    }
130:                }
131:                //
132:                //if (variableList.size() == 0) {
133:                //    variableList.add("UnknownVariable");
134:                //}
135:                //
136:                String variables[] = ((String[]) variableList
137:                        .toArray(new String[0]));
138:                if (variables.length == 0) {
139:                    variables = getUnknownVariableList();
140:                }
141:                outValue = CreationParameterContext.prepareItems(variables);
142:
143:                return outValue;
144:            }
145:
146:            private Object[] getVariableSphere(int inIndex) {
147:
148:                Object outValue[] = null;
149:
150:                String handle = ((String) this .variableSpheresList.get(inIndex));
151:                outValue = ((Object[]) this .variableSpheresMap.get(handle));
152:
153:                return outValue;
154:            }
155:
156:            //
157:            public final static String[] getUnknownVariableList() {
158:                return (new String[] { "UnknownVariable" });
159:            }
160:
161:            //
162:            public int registerConceptTagSelector(
163:                    DynamicConceptTagValidator inDctv) {
164:
165:                int outValue = 0;
166:
167:                if (this .conceptTagSelection.contains(inDctv)) {
168:                    outValue = this .conceptTagSelection.indexOf(inDctv);
169:                } else {
170:                    outValue = this .conceptTagSelection.size();
171:                    this .conceptTagSelection.add(inDctv);
172:                }
173:
174:                return outValue;
175:            }
176:
177:            public int getConceptTagSelectorCount() {
178:                return this .conceptTagSelection.size();
179:            }
180:
181:            public String getConceptTagSelector(int inIndex,
182:                    ConceptTagPreferences inCtp) {
183:
184:                String outValue = null;
185:
186:                Object o = this .conceptTagSelection.get(inIndex);
187:                DynamicConceptTagValidator dctv = ((DynamicConceptTagValidator) o);
188:
189:                outValue = ConceptTagMenuBranch.generateInitializationCode(
190:                        inCtp.getMenuBase(), inCtp.getSetHolder(), dctv);
191:
192:                return outValue;
193:            }
194:
195:            public DynamicConceptTagValidator getConceptTagSelectorAsValidator(
196:                    int inIndex) {
197:
198:                DynamicConceptTagValidator outValue = null;
199:
200:                Object o = this .conceptTagSelection.get(inIndex);
201:                outValue = ((DynamicConceptTagValidator) o);
202:
203:                return outValue;
204:            }
205:
206:            //
207:            public int registerConstraintSac(ConceptTagConstraint inCtcon) {
208:
209:                int outValue = 0;
210:
211:                CreationParameterContext cpc = createEditCpc(inCtcon);
212:                if (this .constraintSac.contains(cpc)) {
213:                    outValue = this .constraintSac.indexOf(cpc);
214:                } else {
215:                    outValue = this .constraintSac.size();
216:                    this .constraintSac.add(cpc);
217:                }
218:
219:                return outValue;
220:            }
221:
222:            public int getConstraintSacCount() {
223:                return this .constraintSac.size();
224:            }
225:
226:            public CreationParameterContext getConstraintSac(int inIndex) {
227:
228:                CreationParameterContext outValue = null;
229:
230:                Object o = this .constraintSac.get(inIndex);
231:                outValue = ((CreationParameterContext) o);
232:
233:                return outValue;
234:            }
235:
236:            private final static CreationParameterContext createEditCpc(
237:                    ConceptTagConstraintOrTemplate inCtcot) {
238:                //
239:                CreationParameterContext outValue = null;
240:
241:                //
242:                //
243:                SubmitActionContext createSac = SubmitActionContext
244:                        .newInstance("studioFromPage", "studioHandle",
245:                                "studioAliasHandle");
246:                ////
247:                //SubmitActionContext compoundSac =
248:                //    SubmitActionContext.newInstance(this);
249:                ////
250:                //inCreateSac.addAction(
251:                //    inCreateSac.FIRST_INPUT, inCreateOrUpdateAction);
252:                //inCreateSac.addAction(
253:                //    inCreateSac.SECOND_INPUT,
254:                //    singleQuotes(SubmitActionParameters.TEXT));
255:                createSac.addAction(ConsoleParameterContext.FIRST_INPUT,
256:                        "studioConstraintSacAction");
257:                createSac.addAction(ConsoleParameterContext.SECOND_INPUT,
258:                        ConsoleTemplateContext
259:                                .singleQuotes(SubmitActionParameters.TEXT));
260:                ////
261:                //inLabel, inCreateSac, true, true);
262:                //
263:                //
264:                //outValue.addInputAsHiddenBox(
265:                //    ConsoleParameterContext.SECOND_INPUT, ("" + 0));
266:                //    outValue.SECOND_INPUT, ("" + inIndex));
267:                //
268:                //
269:                outValue = CreationParameterContext.newInstance(
270:                        "'Studio Edit'", createSac
271:                                .submitActionCall(true, false), true, true,
272:                        false);
273:
274:                //
275:                //
276:                outValue
277:                        .addUnformattedInput(
278:                                ConsoleParameterContext.FIRST_INPUT,
279:                                ConsoleTemplateContext
280:                                        .singleQuotes(CreationParameterContext.TYPE_HIDDEN_BOX),
281:                                null, "studioConstraintSacHandle", null, null);
282:                //outValue.addInputAsHiddenBox(
283:                //    ConsoleParameterContext.FIRST_INPUT, "@$0");
284:                //    outValue.FIRST_INPUT, inParentHandle);
285:                outValue
286:                        .addUnformattedInput(
287:                                ConsoleParameterContext.SECOND_INPUT,
288:                                ConsoleTemplateContext
289:                                        .singleQuotes(CreationParameterContext.TYPE_HIDDEN_BOX),
290:                                null, "studioConstraintSacIndex", null, null);
291:                //
292:                boolean canBeDynamic = inCtcot.isDynamicContextPresent();
293:                boolean canBeCompound = inCtcot.isCompoundContextPresent();
294:                boolean canBeStatic = inCtcot.isStaticContextPresent();
295:
296:                //
297:                if (canBeStatic) {
298:                    StaticConceptTagConstraintContext sctcc = inCtcot
299:                            .getStaticConstraintContext();
300:                    //
301:                    if (sctcc.getEntrySetLength() > 0
302:                            && sctcc.isEntrySetExclusive()) {
303:                        //
304:                        String listLabels[] = new String[sctcc
305:                                .getEntrySetLength()];
306:                        String listValues[] = new String[sctcc
307:                                .getEntrySetLength()];
308:                        //
309:                        for (int i = 0; i < sctcc.getEntrySetLength(); i++) {
310:                            listLabels[i] = sctcc.getEntryDescription(i);
311:                            listValues[i] = sctcc.getEntryValue(i);
312:                        }
313:                        //
314:                        outValue.addInputAsExclusive(
315:                                ConsoleParameterContext.THIRD_INPUT,
316:                                "String Value", listValues, listLabels);
317:                    } else if (sctcc.getEntrySetLength() > 0
318:                            && !sctcc.isEntrySetExclusive()) {
319:                        //
320:                        String listLabels[] = new String[sctcc
321:                                .getEntrySetLength()];
322:                        String listValues[] = new String[sctcc
323:                                .getEntrySetLength()];
324:                        //
325:                        for (int i = 0; i < sctcc.getEntrySetLength(); i++) {
326:                            listLabels[i] = sctcc.getEntryDescription(i);
327:                            listValues[i] = sctcc.getEntryValue(i);
328:                        }
329:                        //
330:                        outValue.addInputAsInclusive(
331:                                ConsoleParameterContext.THIRD_INPUT,
332:                                "String Value", listValues, listLabels,
333:                                "(Your Text Here)");
334:                    } else if (sctcc.isMultiLine()) {
335:                        //
336:                        outValue.addInputAsTextArea(
337:                                ConsoleParameterContext.THIRD_INPUT,
338:                                "String Value", "(Your Text Here)");
339:                    } else {
340:                        //
341:                        outValue.addInputAsTextBox(
342:                                ConsoleParameterContext.THIRD_INPUT,
343:                                "String Value", "(Your Text Here)");
344:                    }
345:                    //
346:                    //
347:                    //
348:
349:                    outValue.addInputAsButton(
350:                            ConsoleParameterContext.FOURTH_INPUT, "Use String",
351:                            "eval(renderConceptTagCreationAction)");
352:                    //createSac.submitActionCall(true, false));
353:                    //    CreationParameterContext.getCreationSubmit(
354:                    //        inCreateSac, true, 6));
355:                } else {
356:                    //
357:                    //dummy field
358:                    outValue.addInputAsHiddenBox(
359:                            ConsoleParameterContext.THIRD_INPUT, "");
360:                    outValue.addInputAsHiddenBox(
361:                            ConsoleParameterContext.FOURTH_INPUT, "");
362:                }
363:
364:                //
365:                if (canBeDynamic) {
366:                    outValue.addInputAsButton(
367:                            ConsoleParameterContext.FIFTH_INPUT, "Tag Value",
368:                            "renderMenuNode(getStudioUsabilityId(), getTrueOffsetTop(this),"
369:                                    + " getTrueOffsetLeft(this), 0);");
370:                    //    getLaunchPointAction(inMenuId, false));
371:                } else {
372:                    //
373:                    //dummy field
374:                    outValue.addInputAsHiddenBox(
375:                            ConsoleParameterContext.FIFTH_INPUT, "");
376:                }
377:
378:                //
379:                if (canBeCompound) {
380:                    //
381:                    //SubmitActionContext sacUseDefaultCompound =
382:                    //    SubmitActionContext.newInstance(
383:                    //        "studioFromPage", "studioHandle", "studioAliasHandle");
384:                    //
385:                    //sacUseDefaultCompound.addAction(
386:                    //    ConsoleParameterContext.FIRST_INPUT,
387:                    //    "studioConstraintSacAction");
388:                    //sacUseDefaultCompound.addAction(
389:                    //    ConsoleParameterContext.SECOND_INPUT,
390:                    //    ConsoleTemplateContext.singleQuotes(
391:                    //        SubmitActionParameters.COMPOUND));
392:                    //
393:                    //sacUseDefaultCompound.addParameter(
394:                    //    ConsoleParameterContext.FIRST_INPUT,
395:                    //    "studioConstraintSacHandle");
396:                    //sacUseDefaultCompound.addParameter(
397:                    //    ConsoleParameterContext.SECOND_INPUT,
398:                    //    "studioConstraintSacIndex");
399:                    //
400:                    outValue.addInputAsButton(
401:                            ConsoleParameterContext.SIXTH_INPUT,
402:                            "Compound Value", "studioSelectCompound()");
403:                } else {
404:                    //
405:                    //dummy field
406:                    outValue.addInputAsHiddenBox(
407:                            ConsoleParameterContext.SIXTH_INPUT, "");
408:                }
409:
410:                return outValue;
411:            }
412:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.