Source Code Cross Referenced for RcthConstraintBuilderConsoleMacroTag.java in  » Workflow-Engines » JFolder » org » jfolder » console » macro » v1 » 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.macro.v1 
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.macro.v1;
009:
010:        //base classes
011:        import java.util.ArrayList;
012:        import java.util.HashMap;
013:
014:        //project specific classes
015:        import org.jfolder.common.UnexpectedSystemException;
016:        import org.jfolder.common.tagging.AppraiseConceptTagContext;
017:        import org.jfolder.common.tagging.CompoundConceptTagConstraintContext;
018:        import org.jfolder.common.tagging.ConceptTag;
019:        import org.jfolder.common.tagging.ConceptTagCharacteristic;
020:        import org.jfolder.common.tagging.ConceptTagCharacteristicHolder;
021:        import org.jfolder.common.tagging.ConceptTagConstraint;
022:        import org.jfolder.common.tagging.ConceptTagConstraintHolder;
023:        import org.jfolder.common.tagging.ConceptTagConstraintTemplate;
024:        import org.jfolder.common.tagging.ConceptTagHelper;
025:        import org.jfolder.common.tagging.ConceptTagMenuBranch;
026:        import org.jfolder.common.tagging.ConceptTagPreferences;
027:        import org.jfolder.common.tagging.ConceptTagSetHolder;
028:        import org.jfolder.common.tagging.DynamicConceptTagConstraintContext;
029:        import org.jfolder.common.tagging.InitializeConceptTagContext;
030:        import org.jfolder.common.tagging.RootConceptTagHolder;
031:        import org.jfolder.common.tagging.StaticConceptTagConstraintContext;
032:        import org.jfolder.common.tagging.StudioConceptTagInstanceInfoContext;
033:        import org.jfolder.common.tagging.StudioConceptTagTypeInfoContext;
034:        import org.jfolder.common.utils.misc.CommonSeparators;
035:        import org.jfolder.common.utils.misc.MiscHelper;
036:        import org.jfolder.common.utils.xml.XMLHelper;
037:        import org.jfolder.common.web.template.ConsoleTemplateContext;
038:        import org.jfolder.common.web.template.ConsoleTemplateSession;
039:        import org.jfolder.common.web.template.PageSetupContext;
040:        import org.jfolder.common.web.template.RcthConstraintBuilder;
041:        import org.jfolder.common.web.template.RcthConstraintBuilderDirectiveStep;
042:        import org.jfolder.common.web.template.SubmitActionContext;
043:        import org.jfolder.console.macro.ConsoleMacro;
044:        import org.jfolder.console.macro.ConsoleMacroTag;
045:        import org.jfolder.console.macro.ConsoleMacroTagHelper;
046:        import org.jfolder.console.macro.IterativeConsoleMacroTag;
047:
048:        //other classes
049:
050:        public class RcthConstraintBuilderConsoleMacroTag implements 
051:                IterativeConsoleMacroTag {
052:
053:            //handle, limit, items
054:
055:            //characteristics
056:            private ConceptTagCharacteristic handleCtchar = null;
057:            //private ConceptTagCharacteristic limitCtchar = null;
058:            private ConceptTagCharacteristic itemCtchar = null;
059:
060:            //handle details
061:            private final static String HANDLE_CTCON = "handle";
062:            private final static String HANDLE_TITLE = "Handle";
063:            private final static String HANDLE_SHORT_DESCRIPTION = "Handle";
064:
065:            ////limit details
066:            //private final static String LIMIT_CTCON = "limit";
067:            //private final static String LIMIT_TITLE = "Limit";
068:            //private final static String LIMIT_SHORT_DESCRIPTION = "Limit";
069:
070:            //item details
071:            private final static String ITEM_CTCON = "item";
072:            private final static String ITEM_TITLE = "Item";
073:            private final static String ITEM_SHORT_DESCRIPTION = "Item";
074:            //
075:            //ct-namespace of item details
076:            private final static String ITEM_CTCON_CT_NAMESPACE_CTCTEMP = "ct-namespace";
077:            private final static String ITEM_CTCON_CT_NAMESPACE_TITLE = "Ct Namespace";
078:            private final static String ITEM_CTCON_CT_NAMESPACE_SHORT_DESCRIPTION = "Ct Namespace";
079:            //
080:            //ct-name of item details
081:            private final static String ITEM_CTCON_CT_NAME_CTCTEMP = "ct-name";
082:            private final static String ITEM_CTCON_CT_NAME_TITLE = "Ct Name";
083:            private final static String ITEM_CTCON_CT_NAME_SHORT_DESCRIPTION = "Ct Name";
084:            //
085:            //text of item details
086:            private final static String ITEM_CTCON_TEXT_CTCTEMP = "text";
087:            private final static String ITEM_CTCON_TEXT_TITLE = "Text";
088:            private final static String ITEM_CTCON_TEXT_SHORT_DESCRIPTION = "Text";
089:
090:            ///////////////////////////////////
091:
092:            public void initialize(InitializeConceptTagContext inIctc) {
093:
094:                //
095:                ConceptTagConstraintHolder rootCtconh = ConceptTagConstraintHolder
096:                        .newInstance(inIctc);
097:
098:                //constrain "handle"
099:                ConceptTagConstraint handleCtcon = ConceptTagConstraint
100:                        .newInstance(HANDLE_CTCON, rootCtconh);
101:                handleCtcon.setTitle(HANDLE_TITLE);
102:                handleCtcon.setShortDescription(HANDLE_SHORT_DESCRIPTION);
103:                //
104:                StaticConceptTagConstraintContext handleSctcc = StaticConceptTagConstraintContext
105:                        .newInstance(handleCtcon);
106:
107:                ////constrain "limit"
108:                //ConceptTagConstraint limitCtcon =
109:                //    ConceptTagConstraint.newInstance(LIMIT_CTCON, rootCtconh);
110:                //limitCtcon.setTitle(LIMIT_TITLE);
111:                //limitCtcon.setShortDescription(LIMIT_SHORT_DESCRIPTION);
112:                ////
113:                //StaticConceptTagConstraintContext limitSctcc =
114:                //    StaticConceptTagConstraintContext.newInstance(limitCtcon);
115:
116:                //constrain "item"
117:                ConceptTagConstraint itemCtcon = ConceptTagConstraint
118:                        .newInstance(ITEM_CTCON, rootCtconh);
119:                itemCtcon.setTitle(ITEM_TITLE);
120:                itemCtcon.setShortDescription(ITEM_SHORT_DESCRIPTION);
121:                //
122:                CompoundConceptTagConstraintContext itemCctcc = CompoundConceptTagConstraintContext
123:                        .newInstance(itemCtcon);
124:                //
125:                //
126:                //constrain "ct-namespace" of "item"
127:                ConceptTagConstraintTemplate itemCtconCtNamespaceCtctemp = ConceptTagConstraintTemplate
128:                        .newInstance(ITEM_CTCON_CT_NAMESPACE_CTCTEMP, itemCctcc);
129:                //
130:                StaticConceptTagConstraintContext itemCtconCtNamespaceSctcc = StaticConceptTagConstraintContext
131:                        .newInstance(itemCtconCtNamespaceCtctemp);
132:                //
133:                //
134:                //constrain "ct-name" of "item"
135:                ConceptTagConstraintTemplate itemCtconCtNameCtctemp = ConceptTagConstraintTemplate
136:                        .newInstance(ITEM_CTCON_CT_NAME_CTCTEMP, itemCctcc);
137:                //
138:                StaticConceptTagConstraintContext itemCtconCtNameSctcc = StaticConceptTagConstraintContext
139:                        .newInstance(itemCtconCtNameCtctemp);
140:                //
141:                //
142:                //constrain "text" of "item"
143:                ConceptTagConstraintTemplate itemCtconTextCtctemp = ConceptTagConstraintTemplate
144:                        .newInstance(ITEM_CTCON_TEXT_CTCTEMP, itemCctcc);
145:                //
146:                StaticConceptTagConstraintContext itemCtconTextSctcc = StaticConceptTagConstraintContext
147:                        .newInstance(itemCtconTextCtctemp);
148:
149:                //
150:                inIctc.initialize();
151:
152:                //
153:                this .handleCtchar = handleCtcon.getCharacteristic();
154:                this .itemCtchar = itemCtcon.getCharacteristic();
155:            }
156:
157:            //
158:            public void appraise(AppraiseConceptTagContext inCtic) {
159:                if (inCtic instanceof  StudioConceptTagInstanceInfoContext) {
160:                    StudioConceptTagInstanceInfoContext sctiic = (StudioConceptTagInstanceInfoContext) inCtic;
161:                    sctiic.setInstanceTitle("Rcth Constraint Builder");
162:                    sctiic.setInstanceDescription("Rcth Constraint Builder");
163:                } else if (inCtic instanceof  StudioConceptTagTypeInfoContext) {
164:                    StudioConceptTagTypeInfoContext scttic = (StudioConceptTagTypeInfoContext) inCtic;
165:                    scttic.setTypeTitle("Rcth Constraint Builder");
166:                    scttic.setTypeDescription("Rcth Constraint Builder");
167:                }
168:            }
169:
170:            //
171:            public final static RcthConstraintBuilderConsoleMacroTag newInstance(
172:                    ConceptTagCharacteristic inCtchar,
173:                    ConceptTagConstraint inCtcon, String inHandle) {
174:                //
175:                RcthConstraintBuilderConsoleMacroTag outValue = null;
176:
177:                outValue = new RcthConstraintBuilderConsoleMacroTag();
178:                //
179:                ConceptTagCharacteristicHolder nextCtcharh = inCtchar.addValue(
180:                        inCtchar.getValueLength(), outValue, true);
181:                //
182:                ConceptTagCharacteristic handleCtchar = nextCtcharh
183:                        .registerCharacteristic(HANDLE_CTCON);
184:                handleCtchar.addValue(0, inHandle);
185:                //
186:                ConceptTagCharacteristic parentCtchar = inCtcon
187:                        .getCharacteristic();
188:                //
189:                ConceptTagCharacteristic itemCtchar = nextCtcharh
190:                        .registerCharacteristic(ITEM_CTCON);
191:                //
192:                for (int i = 0; i < parentCtchar.getValueLength(); i++) {
193:                    //
194:                    ConceptTagCharacteristicHolder nextItemCtcharh = itemCtchar
195:                            .createRegisteredHolder(i, true);
196:                    //
197:                    ConceptTagCharacteristic nextCtNamespaceCtchar = nextItemCtcharh
198:                            .registerCharacteristic(ITEM_CTCON_CT_NAMESPACE_CTCTEMP);
199:                    ConceptTagCharacteristic nextCtNameCtchar = nextItemCtcharh
200:                            .registerCharacteristic(ITEM_CTCON_CT_NAME_CTCTEMP);
201:                    ConceptTagCharacteristic nextTextCtchar = nextItemCtcharh
202:                            .registerCharacteristic(ITEM_CTCON_TEXT_CTCTEMP);
203:                    //
204:                    if (parentCtchar.isStatic(i, null)) {
205:                        //
206:                        nextTextCtchar.addValue(0, parentCtchar
207:                                .getValueAsString(i, null));
208:                    } else if (parentCtchar.isHolderWithConceptTag(i, null)) {
209:                        //
210:                        ConceptTag nextCt = parentCtchar.getValueAsConceptTag(
211:                                i, null);
212:                        ConceptTagPreferences nextCtp = parentCtchar
213:                                .getPreferences();
214:                        ConceptTagSetHolder nextCtsh = nextCtp.getSetHolder();
215:                        //
216:                        String nextCtNamespace = nextCtsh
217:                                .getConceptTagNamespace(nextCt.getClass()
218:                                        .getName());
219:                        String nextCtName = nextCtsh.getConceptTagName(nextCt
220:                                .getClass().getName());
221:                        //
222:                        if (nextCtNamespace != null) {
223:                            //
224:                            nextCtNamespaceCtchar.addValue(0, nextCtNamespace);
225:                        }
226:                        nextCtNameCtchar.addValue(0, nextCtName);
227:                    } else if (parentCtchar.isHolderWithoutConceptTag(i, null)) {
228:                        //
229:                        //do nothing
230:                    } else {
231:                        throw UnexpectedSystemException.unknownState();
232:                    }
233:                }
234:
235:                return outValue;
236:            }
237:
238:            //public final static GoToConsoleMacroTag newInstance(
239:            //    ConceptTagCharacteristic inCtchar, String inId) {
240:            //    //
241:            //    GoToConsoleMacroTag outValue = null;
242:            //    
243:            //    outValue = new GoToConsoleMacroTag();
244:            //    //
245:            //    ConceptTagCharacteristicHolder nextCtcharh = inCtchar.addValue(
246:            //        inCtchar.getValueLength(), outValue, true);
247:            //    //
248:            //    ConceptTagCharacteristic nextIdCtchar =
249:            //        nextCtcharh.registerCharacteristic(ID_CTCON);
250:            //    nextIdCtchar.addValue(0, inId);
251:            //    //
252:            //    
253:            //    return outValue;
254:            //}
255:            //
256:            public void generateMacroCommands(PageSetupContext inPsc,
257:                    ConsoleTemplateSession inCts, RootConceptTagHolder inRcth,
258:                    HashMap inVars, String inFromHandle,
259:                    String inAliasFromHandle, String inSourcePage,
260:                    String inDestinationPage) {
261:                //
262:                String studioEditTargetId = this .handleCtchar.getValueAsString(
263:                        0, null);
264:                //inPsc.setStudioEditTargetId(studioEditTargetId);
265:                //
266:                ConceptTagConstraint localCtcon = inRcth
267:                        .getConstraint(studioEditTargetId);
268:                //
269:                ConceptTagCharacteristic localCtchar = localCtcon
270:                        .getCharacteristic();
271:                //
272:                //
273:                //
274:                RcthConstraintBuilder localRcb = inPsc.getStudioMacroEdit();
275:                //inPsc.setStudioMacroEdit(getNextActionType(inRcth));
276:                //String id = this.idCtchar.getValueAsString(0, null);
277:                //id = ConsoleMacroTagHelper.replaceEnvVars(id, inVars);
278:                ////
279:                //inPsc.addMacroCommand(getGoToCall(id));
280:                if (inPsc.isStudioMacroEditDirectivePresent()) {
281:                    //
282:                    ArrayList localDirectives = inPsc
283:                            .getStudioMacroEditDirective();
284:                    for (int i = 0; i < localDirectives.size(); i++) {
285:                        //
286:                        RcthConstraintBuilderDirectiveStep nextRcbds = (RcthConstraintBuilderDirectiveStep) localDirectives
287:                                .get(i);
288:                        ArrayList nextActions = nextRcbds.getActions(false);
289:                        for (int j = 0; j < nextActions.size(); j++) {
290:                            String nextAction = ((String) nextActions.get(j));
291:                            inPsc.addMacroCommand(nextAction);
292:                        }
293:                    }
294:                    //inPsc.addMacroCommand("macroAlert('entity found')");
295:                } else if (inPsc.isStudioMacroEditParentDirectivePresent()) {
296:                    //
297:                    ArrayList localDirectives = inPsc
298:                            .getStudioMacroEditParentDirective();
299:                    for (int i = 0; i < localDirectives.size(); i++) {
300:                        //
301:                        RcthConstraintBuilderDirectiveStep nextRcbds = (RcthConstraintBuilderDirectiveStep) localDirectives
302:                                .get(i);
303:                        ArrayList nextActions = nextRcbds.getActions(true);
304:                        for (int j = 0; j < nextActions.size(); j++) {
305:                            String nextAction = ((String) nextActions.get(j));
306:                            inPsc.addMacroCommand(nextAction);
307:                        }
308:                    }
309:                    //inPsc.addMacroCommand("macroAlert('entity found')");
310:                } else {
311:                    MiscHelper.println("RcthConBu constraint = "
312:                            + localRcb.getTargetConstraint());
313:                    MiscHelper.println("RcthConBu index = "
314:                            + localRcb.getTargetIndex());
315:                    ConceptTagConstraintHolder localCtCtconh = ConceptTagHelper
316:                            .getNearestConceptTag(localCtcon.getPreferences()
317:                                    .getRootHolder(), localRcb
318:                                    .getTargetConstraint(), new StringBuffer());
319:                    MiscHelper.println("RcthConBu PARENT-CT = "
320:                            + localCtCtconh.getCharacteristicHolder()
321:                                    .getConceptTag());
322:                    throw UnexpectedSystemException.unknownState();
323:                }
324:                //
325:                //
326:                //
327:                //
328:                if (inPsc.isStudioMacroEditPresent()) {
329:                    //
330:                    //RcthConstraintBuilder localRcb =
331:                    //    ((RcthConstraintBuilder)inPsc.getStudioMacroEdit());
332:                    //
333:                    //
334:                    inPsc.addMacroCommand("closeOpenTagMenus('', false)");
335:                    //
336:                    //
337:                    ArrayList studioSelectionActions = generateStudioSelectionCommands(
338:                            localRcb, inCts);
339:                    for (int i = 0; i < studioSelectionActions.size(); i++) {
340:                        String nextAction = ((String) studioSelectionActions
341:                                .get(i));
342:                        inPsc.addMacroCommand(nextAction);
343:                    }
344:                    //
345:                    //
346:                    //
347:                    SubmitActionContext localSac = localRcb
348:                            .generateSubmitActionContext(ConsoleMacroTagHelper
349:                                    .replaceEnvVars(inSourcePage, inVars),
350:                                    ConsoleMacroTagHelper.replaceEnvVars(
351:                                            inFromHandle, inVars),
352:                                    ConsoleMacroTagHelper.replaceEnvVars(
353:                                            inAliasFromHandle, inVars));
354:                    //inPsc.addMacroCommand(
355:                    //    "macroAlert('"
356:                    //        + XMLHelper.fromStringToJSCData(
357:                    //            localSac.submitActionCall(false))
358:                    //        + "')");
359:                    inPsc.addMacroCommand(localSac.submitActionCall(false));
360:                    //inActions.add(localSac.submitActionCall(false));
361:                    //inParentActions.add(localSac.submitActionCall(false));
362:                }
363:                //inPsc.addMacroCommand("macroAlert('RcthConstraintBuilder called')");
364:            }
365:
366:            //
367:            public boolean isCommandFinished(RootConceptTagHolder inRcth) {
368:                //
369:                boolean outValue = false;
370:
371:                //
372:                RcthConstraintBuilder localRcb = getNextActionType(inRcth);
373:                outValue = !(localRcb.isDeleteAction()
374:                        || localRcb.isInsertAction() || localRcb
375:                        .isReplaceAction());
376:
377:                return outValue;
378:            }
379:
380:            //
381:            public void loadRcthConstraintBuilderIfPresent(
382:                    PageSetupContext inPsc, RootConceptTagHolder inRcth) {
383:                //
384:            }
385:
386:            //
387:            public RcthConstraintBuilder getNextActionType(
388:                    RootConceptTagHolder inRcth) {
389:                //
390:                RcthConstraintBuilder outValue = null;
391:                //
392:                String studioEditTargetId = this .handleCtchar.getValueAsString(
393:                        0, null);
394:                //inPsc.setStudioEditTargetId(studioEditTargetId);
395:                //
396:                ConceptTagConstraint localCtcon = inRcth
397:                        .getConstraint(studioEditTargetId);
398:                //
399:                ConceptTagCharacteristic localCtchar = localCtcon
400:                        .getCharacteristic();
401:                //
402:                ConceptTagPreferences localCtp = localCtchar.getPreferences();
403:                ConceptTagSetHolder localCtsh = localCtp.getSetHolder();
404:                //
405:                int targetIndex = 0;
406:                boolean deleteAction = false;
407:                boolean insertAction = false;
408:                boolean replaceAction = false;
409:                String ctNamespace = null;
410:                String ctName = null;
411:                String text = null;
412:                //
413:                for (int i = 0; i < this .itemCtchar.getValueLength(); i++) {
414:                    //
415:                    ConceptTagCharacteristicHolder nextItemCtcharh = this .itemCtchar
416:                            .getValueAsHolder(i, null);
417:                    //
418:                    String nextCtNamespace = null;
419:                    ConceptTagCharacteristic nextCtNamespaceCtchar = nextItemCtcharh
420:                            .getCharacteristic(ITEM_CTCON_CT_NAMESPACE_CTCTEMP);
421:                    if (nextCtNamespaceCtchar.getValueLength() > 0) {
422:                        nextCtNamespace = nextCtNamespaceCtchar
423:                                .getValueAsString(0, null);
424:                    }
425:                    //
426:                    String nextCtName = null;
427:                    ConceptTagCharacteristic nextCtNameCtchar = nextItemCtcharh
428:                            .getCharacteristic(ITEM_CTCON_CT_NAME_CTCTEMP);
429:                    if (nextCtNameCtchar.getValueLength() > 0) {
430:                        nextCtName = nextCtNameCtchar.getValueAsString(0, null);
431:                    }
432:                    //
433:                    String nextText = null;
434:                    ConceptTagCharacteristic nextTextCtchar = nextItemCtcharh
435:                            .getCharacteristic(ITEM_CTCON_TEXT_CTCTEMP);
436:                    if (nextTextCtchar.getValueLength() > 0) {
437:                        nextText = nextTextCtchar.getValueAsString(0, null);
438:                    }
439:                    //
440:                    if (i > (localCtchar.getValueLength() - 1)) {
441:                        insertAction = true;
442:                        targetIndex = i;
443:                        ctNamespace = nextCtNamespace;
444:                        ctName = nextCtName;
445:                        text = nextText;
446:                        break;
447:                    }
448:                    //
449:                    boolean considerReplace = false;
450:                    if (localCtchar.isStatic(i, null) && nextText != null) {
451:                        //
452:                        considerReplace = !nextText.equals(localCtchar
453:                                .getValueAsString(i, null));
454:                        //
455:                        if (considerReplace) {
456:                            MiscHelper
457:                                    .println("RcthConBuildCmt mismatch goal = '"
458:                                            + nextText + "'");
459:                            MiscHelper
460:                                    .println("RcthConBuildCmt mismatch goal.length() = '"
461:                                            + nextText.length() + "'");
462:                            MiscHelper
463:                                    .println("RcthConBuildCmt mismatch curr = '"
464:                                            + localCtchar.getValueAsString(i,
465:                                                    null) + "'");
466:                            MiscHelper
467:                                    .println("RcthConBuildCmt mismatch curr.length() = '"
468:                                            + localCtchar.getValueAsString(i,
469:                                                    null).length() + "'");
470:                        }
471:                    } else if (localCtchar.isHolderWithoutConceptTag(i, null)
472:                            && (nextCtNamespace == null && nextCtName == null && nextText == null)) {
473:                        //
474:                        considerReplace = false;
475:                    } else if (localCtchar.isHolderWithConceptTag(i, null)
476:                            && (nextCtName != null)) {
477:                        //
478:                        String nextTestConceptTagClass = localCtchar
479:                                .getValueAsConceptTag(i, null).getClass()
480:                                .getName();
481:                        String nextTestCtNamespace = localCtsh
482:                                .getConceptTagNamespace(nextTestConceptTagClass);
483:                        String nextTestCtName = localCtsh
484:                                .getConceptTagName(nextTestConceptTagClass);
485:                        //
486:                        if (nextCtNamespace != null
487:                                && nextTestCtNamespace != null) {
488:                            //
489:                            considerReplace = !(nextCtNamespace
490:                                    .equals(nextTestCtNamespace) && nextCtName
491:                                    .equals(nextTestCtName));
492:                        } else if (nextCtNamespace == null
493:                                && nextTestCtNamespace == null) {
494:                            //
495:                            considerReplace = !(nextCtName
496:                                    .equals(nextTestCtName));
497:                        } else {
498:                            considerReplace = true;
499:                        }
500:                    } else {
501:                        considerReplace = true;
502:                    }
503:                    //
504:                    if (considerReplace) {
505:                        replaceAction = true;
506:                        targetIndex = i;
507:                        ctNamespace = nextCtNamespace;
508:                        ctName = nextCtName;
509:                        text = nextText;
510:                        break;
511:                    }
512:                }
513:                //
514:                if (!replaceAction && !insertAction) {
515:                    if (localCtchar.getValueLength() > this .itemCtchar
516:                            .getValueLength()) {
517:                        //
518:                        deleteAction = true;
519:                        targetIndex = this .itemCtchar.getValueLength();
520:                    }
521:                }
522:                //
523:                //
524:                //
525:                //
526:                outValue = RcthConstraintBuilder.newInstance(
527:                        studioEditTargetId, targetIndex, deleteAction,
528:                        insertAction, replaceAction, ctNamespace, ctName, text);
529:                //
530:                return outValue;
531:            }
532:
533:            //
534:            //protected final static String getGoToCall(String inId) {
535:            //    
536:            //    StringBuffer outValue = new StringBuffer();
537:            //    
538:            //    outValue.append("macroGoTo('" + inId + "')");
539:            //    
540:            //    return outValue.toString();
541:            //}
542:            //
543:            //
544:            //
545:            //
546:            //
547:            //
548:            //
549:            //
550:            //
551:            //
552:            //
553:            //
554:            //
555:            //
556:            //
557:            //
558:            private final static ArrayList generateStudioSelectionCommands(
559:                    RcthConstraintBuilder inRcb, ConsoleTemplateSession inCts) {
560:                //
561:                ArrayList outValue = new ArrayList();
562:
563:                //
564:                PageSetupContext localPsc = inCts.getPageSetupContext();
565:                //
566:                if (inRcb.isReplaceAction() || inRcb.isInsertAction()) {
567:                    //
568:                    if (inRcb.getText() != null) {
569:                        generateStaticCommands(outValue, inRcb.getText());
570:                    } else if (inRcb.getCtName() != null) {
571:                        //
572:                        String localCtId = "(main),[DONT_RECORD_THIS_BRANCH],"
573:                                + "(CREATION_OF_CONCEPT_TAG),"
574:                                + "CONSOLE_CREATION_STRUCTURE_7_4,[TABLE_BUTTON],"
575:                                + "BUTTON__NEXT_TEXT_VALUE";
576:                        //
577:                        outValue.add("macroGoTo('" + localCtId + "')");
578:                        outValue.add("macroClickImage()");
579:                        outValue.add("macroClick('" + localCtId + "')");
580:                        //
581:                        generateDynamicCommands(outValue, inCts, inRcb
582:                                .getCtNamespace(), inRcb.getCtName(), localPsc
583:                                .getStudioUsabilityId());
584:                    } else {
585:                        outValue
586:                                .add("macroGoTo('"
587:                                        + "(main),[DONT_RECORD_THIS_BRANCH],"
588:                                        + "(CREATION_OF_CONCEPT_TAG),"
589:                                        + "CONSOLE_CREATION_STRUCTURE_7_5,[TABLE_BUTTON],"
590:                                        + "BUTTON__NEXT_TEXT_VALUE" + "')");
591:                        outValue.add("macroClickImage()");
592:                    }
593:                }
594:
595:                return outValue;
596:            }
597:
598:            //
599:            //
600:            //
601:            private final static void generateStaticCommands(ArrayList inList,
602:                    String inValue) {
603:                //
604:                //
605:                final int STATIC_SECTION_INDEX = 2;
606:                //try {
607:                //String value = this.valueCtchar.getValueAsString(0, null);
608:                String value = XMLHelper.fromStringToJSCData(inValue);
609:                //
610:                //text box (1)
611:                //
612:                prepareCalls(
613:                        inList,
614:                        ConsoleTemplateContext
615:                                .singleQuotes("(main),[DONT_RECORD_THIS_BRANCH],(CREATION_OF_CONCEPT_TAG)"
616:                                        + ",CONSOLE_CREATION_STRUCTURE_1_"
617:                                        + STATIC_SECTION_INDEX),
618:                        ConsoleTemplateContext
619:                                .singleQuotes("(main),[DONT_RECORD_THIS_BRANCH],(CREATION_OF_CONCEPT_TAG)"
620:                                        + ",CONSOLE_CREATION_STRUCTURE_1_"
621:                                        + STATIC_SECTION_INDEX
622:                                        + ",[TEXT_BOX]"
623:                                        + ",TEXT_BOX__NEXT_TEXT_VALUE"), null,
624:                        ConsoleTemplateContext.singleQuotes(value), false);
625:                //
626:                //text area (2)
627:                //
628:                prepareCalls(
629:                        inList,
630:                        ConsoleTemplateContext
631:                                .singleQuotes("(main),[DONT_RECORD_THIS_BRANCH],(CREATION_OF_CONCEPT_TAG)"
632:                                        + ",CONSOLE_CREATION_STRUCTURE_2_"
633:                                        + STATIC_SECTION_INDEX),
634:                        ConsoleTemplateContext
635:                                .singleQuotes("(main),[DONT_RECORD_THIS_BRANCH],(CREATION_OF_CONCEPT_TAG)"
636:                                        + ",CONSOLE_CREATION_STRUCTURE_2_"
637:                                        + STATIC_SECTION_INDEX
638:                                        + ",[TEXT_AREA]"
639:                                        + ",TEXT_AREA__NEXT_TEXT_VALUE"), null,
640:                        ConsoleTemplateContext.singleQuotes(value), false);
641:                //
642:                //inclusive (3)
643:                //
644:                prepareCalls(
645:                        inList,
646:                        ConsoleTemplateContext
647:                                .singleQuotes("(main),[DONT_RECORD_THIS_BRANCH],(CREATION_OF_CONCEPT_TAG)"
648:                                        + ",CONSOLE_CREATION_STRUCTURE_3_"
649:                                        + STATIC_SECTION_INDEX),
650:                        ConsoleTemplateContext
651:                                .singleQuotes("(main),[DONT_RECORD_THIS_BRANCH],(CREATION_OF_CONCEPT_TAG)"
652:                                        + ",CONSOLE_CREATION_STRUCTURE_3_"
653:                                        + STATIC_SECTION_INDEX
654:                                        + ",[DROP_DOWN_BOX]"
655:                                        + ",DROP_DOWN_BOX__INCLUSIVE_VALUE"),
656:                        ConsoleTemplateContext
657:                                .singleQuotes("(main),[DONT_RECORD_THIS_BRANCH],(CREATION_OF_CONCEPT_TAG)"
658:                                        + ",CONSOLE_CREATION_STRUCTURE_3_"
659:                                        + STATIC_SECTION_INDEX
660:                                        + ",[TEXT_BOX]"
661:                                        + ",DROP_DOWN_BOX__INCLUSIVE_OTHER_VALUE"),
662:                        ConsoleTemplateContext.singleQuotes(value), true);
663:                //
664:                //exclusive (4)
665:                //
666:                prepareCalls(
667:                        inList,
668:                        ConsoleTemplateContext
669:                                .singleQuotes("(main),[DONT_RECORD_THIS_BRANCH],(CREATION_OF_CONCEPT_TAG)"
670:                                        + ",CONSOLE_CREATION_STRUCTURE_4_"
671:                                        + STATIC_SECTION_INDEX),
672:                        ConsoleTemplateContext
673:                                .singleQuotes("(main),[DONT_RECORD_THIS_BRANCH],(CREATION_OF_CONCEPT_TAG)"
674:                                        + ",CONSOLE_CREATION_STRUCTURE_4_"
675:                                        + STATIC_SECTION_INDEX
676:                                        + ",[DROP_DOWN_BOX]"
677:                                        + ",DROP_DOWN_BOX__EXCLUSIVE_VALUE"),
678:                        null, ConsoleTemplateContext.singleQuotes(value), true);
679:                //}
680:                //catch (IOException ioe) {
681:                //    throw new UnexpectedSystemException(ioe);
682:                //}
683:                //
684:                //
685:                //
686:                inList
687:                        .add("macroGoTo('"
688:                                + "(main),[DONT_RECORD_THIS_BRANCH],(CREATION_OF_CONCEPT_TAG),"
689:                                + "CONSOLE_CREATION_STRUCTURE_7_3,[TABLE_BUTTON],"
690:                                + "BUTTON__NEXT_TEXT_VALUE" + "')");
691:                inList.add("macroClickImage()");
692:            }
693:
694:            private final static void prepareCalls(ArrayList inList,
695:                    String inSectionId, String inTargetId,
696:                    String inAlternateTargetId, String inValue,
697:                    boolean inCheckAvailability) {
698:                //
699:                //macroGoToIfAvailable(
700:                //  inSectionId, inTargetId, inAlternateTarget,
701:                //  inValue, inCheckAvailibility)
702:                //macroClickIfOpen(inSource)
703:                //macroChangeValueIfAvailable(
704:                //  inSectionId, inTargetId, inAlternateTarget,
705:                //  inValue, inCheckAvailibility)
706:                //
707:                inList.add("macroGoToIfAvailable(" + inSectionId + ", "
708:                        + inTargetId + ", " + inAlternateTargetId + ", "
709:                        + inValue + ", " + inCheckAvailability + ")");
710:                inList.add("macroClickIfOpen(" + inSectionId + ")");
711:                inList.add("macroChangeValueIfAvailable(" + inSectionId + ", "
712:                        + inTargetId + ", " + inAlternateTargetId + ", "
713:                        + inValue + ", " + inCheckAvailability + ")");
714:            }
715:
716:            //
717:            //
718:            //
719:            private final static void generateDynamicCommands(ArrayList inList,
720:                    ConsoleTemplateSession inCts, String inCtNs,
721:                    String inCtName, String inMenuId) {
722:                //
723:                //String launchPointId =
724:                //    this.launchPointIdCtchar.getValueAsString(0, null);
725:                //launchPointId = ConsoleMacroTagHelper.replaceEnvVars(
726:                //    launchPointId, inVars);
727:                //
728:                //String menuId = this.menuIdCtchar.getValueAsString(0, null);
729:                //menuId = ConsoleMacroTagHelper.replaceEnvVars(menuId, inVars);
730:                //
731:                //for (int i = 0; i < this.traverseCtchar.getValueLength(); i++) {
732:                //    String nextTraversePart =
733:                //        this.traverseCtchar.getValueAsString(i, null);
734:                //    traverse.add(nextTraversePart);
735:                //}
736:                //
737:                //String ctNs = null;
738:                //if (this.ctNsCtchar.getValueLength() > 0) {
739:                //    ctNs = this.ctNsCtchar.getValueAsString(0, null);
740:                //}
741:                //
742:                //String ctName = null;
743:                //if (this.ctNameCtchar.getValueLength() > 0) {
744:                //    ctName = this.ctNameCtchar.getValueAsString(0, null);
745:                //}
746:                //
747:                //if (inCtNs != null) {
748:                //}
749:                //
750:                //if (ctNs == null && ctName == null) {
751:                //
752:                //inPsc.addMacroCommand("macroGoTo('" + launchPointId + "')");
753:                //inPsc.addMacroCommand("macroClickImage()");
754:                //if (inCtNs != null) {
755:                //    inPsc.addMacroCommand(
756:                //        ConsoleTemplateContext.getLaunchPointAction(
757:                //            inMenuId, false,
758:                //            ConsoleTemplateContext.getPageComponent(launchPointId)));
759:                //}
760:                //else {
761:                //    inPsc.addMacroCommand(
762:                //        ConsoleTemplateContext.getLaunchPointAction(
763:                //            inMenuId, true,
764:                //            ConsoleTemplateContext.getPageComponent(launchPointId)));
765:                //}
766:                //
767:                ArrayList traverse = new ArrayList();
768:                for (int i = 0; i < inCts.getMenuCount(); i++) {
769:                    //
770:                    String nextTl = ConsoleTemplateSession
771:                            .getToggleLinkFromArrayList(inCts
772:                                    .getMenuToggleLink(i));
773:                    //
774:                    if (nextTl.equals(inMenuId)) {
775:                        Object nextObj = inCts.getMenuConceptTagBranch(i);
776:                        ConceptTagMenuBranch nextCtmb = ((ConceptTagMenuBranch) nextObj);
777:                        nextCtmb.seekConceptTagLocation(traverse, inCtNs,
778:                                inCtName);
779:                    }
780:                }
781:                generateMenuSelectionCommands(inList, inCts, traverse, inMenuId);
782:            }
783:
784:            public final static void generateMenuSelectionCommands(
785:                    ArrayList inList, ConsoleTemplateSession inCts,
786:                    ArrayList inTraverse, String inMenuId) {
787:                //
788:                String currentBaseId = inMenuId;
789:                String nextTraverseStep = null;
790:                //String actualSourceId = null;
791:                for (int i = 0; i < inTraverse.size(); i++) {
792:                    //
793:                    nextTraverseStep = ((String) inTraverse.get(i));
794:                    //
795:                    String nextTargetId = currentBaseId
796:                            + CommonSeparators.TOGGLE_LINK_SEPARATOR
797:                            + ConsoleTemplateSession.getMenuItemPartName()
798:                            + CommonSeparators.TOGGLE_LINK_SEPARATOR
799:                            + nextTraverseStep;
800:                    //
801:                    String nextMenuId = currentBaseId
802:                            + CommonSeparators.TOGGLE_LINK_SEPARATOR
803:                            + nextTraverseStep;
804:                    //
805:                    if (i < (inTraverse.size() - 1)) {
806:                        //
807:                        String nextTargetObj = ConsoleTemplateContext
808:                                .getPageComponent(nextTargetId);
809:                        //
810:                        inList.add("macroGoTo('" + nextTargetId + "')");
811:                        inList.add("macroClickImage()");
812:                        inList.add("renderMenuNode('" + nextMenuId
813:                                + "', getTrueOffsetTop(" + nextTargetObj
814:                                + "), getTrueOffsetLeft(" + nextTargetObj
815:                                + ") + " + nextTargetObj + ".offsetWidth, 0)");
816:                        //
817:                        currentBaseId = nextMenuId;
818:                    }
819:                }
820:                //
821:                inList.add("macroGoTo('" + currentBaseId
822:                        + CommonSeparators.TOGGLE_LINK_SEPARATOR
823:                        + ConsoleTemplateSession.getMenuItemPartName()
824:                        + CommonSeparators.TOGGLE_LINK_SEPARATOR
825:                        + nextTraverseStep + "')");
826:                inList.add("macroClickImage()");
827:                //}
828:                //else {
829:                //    throw UnexpectedSystemException.unknownState();
830:                //}
831:
832:                //String id = this.idCtchar.getValueAsString(0, null);
833:                ////
834:                //String value = this.valueCtchar.getValueAsString(0, null);
835:                ////
836:                //inPsc.addMacroCommand("macroGoTo('" + id + "')");
837:                //inPsc.addMacroCommand("macroClickImage()");
838:                //inPsc.addMacroCommand(
839:                //    "macroChangeValue('" + id + "', '" + value + "')");
840:                //inPsc.addMacroCommand("macroAlert('ChangeFormValue Not Impl')");
841:                //macroChangeValue(inSource, inValue)
842:            }
843:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.