Source Code Cross Referenced for RenderConsolePageContextHelper.java in  » Workflow-Engines » JFolder » org » jfolder » console » base » context » 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.context 
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.context;
009:
010:        //base classes
011:        import java.io.IOException;
012:        import java.util.ArrayList;
013:        import java.util.HashMap;
014:        import java.util.HashSet;
015:
016:        //project specific classes
017:        import org.jfolder.common.UnexpectedSystemException;
018:        import org.jfolder.common.web.template.ConsoleParameterContext;
019:        import org.jfolder.common.web.template.ConsoleTemplateParameters;
020:        import org.jfolder.common.web.template.SubmitActionContext;
021:        import org.jfolder.common.web.template.SubmitActionParameters;
022:        import org.jfolder.console.base.BaseRcthStudioServlet;
023:        import org.jfolder.console.base.ConsolePageContext;
024:        import org.jfolder.console.config.ConsoleConfig;
025:        import org.jfolder.console.config.ConsoleConfigTagPreferencesHelper;
026:
027:        //other classes
028:
029:        public abstract class RenderConsolePageContextHelper {
030:
031:            //
032:            protected final static int AREA__TOP = BaseRcthStudioServlet.AREA__TOP;
033:            protected final static int AREA__LEFT = BaseRcthStudioServlet.AREA__LEFT;
034:            protected final static int AREA__CENTER = BaseRcthStudioServlet.AREA__CENTER;
035:            protected final static int AREA__RIGHT = BaseRcthStudioServlet.AREA__RIGHT;
036:            //
037:            protected final static int AREA__MINIMUM_SIZE = BaseRcthStudioServlet.AREA__MINIMUM_SIZE;
038:
039:            //
040:            protected final static int FIRST_INDEX = 0;
041:
042:            protected RenderConsolePageContextHelper() {
043:            }
044:
045:            public void render(ConsolePageContext inCpc, ConsoleConfig inCc)
046:                    throws IOException {
047:
048:                //
049:                boolean leftSecInUse = (inCc.getLeftSectionPaneCount() > 0);
050:                boolean centerSecInUse = (inCc.getCenterSectionPaneCount() > 0);
051:                boolean rightSecInUse = (inCc.getRightSectionPaneCount() > 0);
052:
053:                //
054:                if (leftSecInUse && centerSecInUse && rightSecInUse) {
055:                    //
056:                    ConfigInstanceForLeftRightContext.newInstance(this , inCpc,
057:                            inCc, AREA__TOP, FIRST_INDEX);
058:                } else if (leftSecInUse && centerSecInUse && !rightSecInUse) {
059:                    //
060:                    ConfigInstanceForLeftRightContext.newInstance(this , inCpc,
061:                            inCc, AREA__TOP, FIRST_INDEX);
062:                } else if (leftSecInUse && !centerSecInUse && rightSecInUse) {
063:                    //
064:                    ConfigInstanceForLeftRightContext.newInstance(this , inCpc,
065:                            inCc, AREA__TOP, FIRST_INDEX);
066:                } else if (leftSecInUse && !centerSecInUse && !rightSecInUse) {
067:                    //
068:                    if (inCc.getLeftSectionPaneCount() > 1) {
069:                        ConfigInstanceForLeftRightContext.newInstance(this ,
070:                                inCpc, inCc,
071:                                RenderConsolePageContextHelper.AREA__LEFT,
072:                                RenderConsolePageContextHelper.FIRST_INDEX);
073:                    } else {
074:                        renderSubPane(inCpc, inCc.getLeftSectionPaneContext(0),
075:                                inCc, AREA__LEFT, FIRST_INDEX);
076:                    }
077:                } else if (!leftSecInUse && centerSecInUse && rightSecInUse) {
078:                    //
079:                    ConfigInstanceForLeftRightContext.newInstance(this , inCpc,
080:                            inCc, AREA__TOP, FIRST_INDEX);
081:                } else if (!leftSecInUse && centerSecInUse && !rightSecInUse) {
082:                    //
083:                    if (inCc.getCenterSectionPaneCount() > 1) {
084:                        ConfigInstanceForUpDownContext.newInstance(this , inCpc,
085:                                inCc,
086:                                RenderConsolePageContextHelper.AREA__CENTER,
087:                                RenderConsolePageContextHelper.FIRST_INDEX);
088:                    } else {
089:                        renderSubPane(inCpc, inCc
090:                                .getCenterSectionPaneContext(0), inCc,
091:                                AREA__CENTER, FIRST_INDEX);
092:                    }
093:                } else if (!leftSecInUse && !centerSecInUse && rightSecInUse) {
094:                    //
095:                    if (inCc.getRightSectionPaneCount() > 1) {
096:                        ConfigInstanceForLeftRightContext.newInstance(this ,
097:                                inCpc, inCc,
098:                                RenderConsolePageContextHelper.AREA__RIGHT,
099:                                RenderConsolePageContextHelper.FIRST_INDEX);
100:                    } else {
101:                        renderSubPane(inCpc,
102:                                inCc.getRightSectionPaneContext(0), inCc,
103:                                AREA__RIGHT, FIRST_INDEX);
104:                    }
105:                } else if (!leftSecInUse && !centerSecInUse && !rightSecInUse) {
106:                    //
107:                } else {
108:                    throw UnexpectedSystemException.unknownState();
109:                }
110:            }
111:
112:            protected void renderSubPane(ConsolePageContext inCpc,
113:                    String inContext, ConsoleConfig inCc, int inSection,
114:                    int inIndex) throws IOException {
115:
116:                HashMap mainProps = getAllMainProperties(inCc);
117:                HashMap contextProps = null;
118:                if (inSection == AREA__LEFT) {
119:                    contextProps = getAllLeftSectionPaneProperties(inCc,
120:                            inIndex);
121:                } else if (inSection == AREA__CENTER) {
122:                    contextProps = getAllCenterSectionPaneProperties(inCc,
123:                            inIndex);
124:                } else if (inSection == AREA__RIGHT) {
125:                    contextProps = getAllRightSectionPaneProperties(inCc,
126:                            inIndex);
127:                } else {
128:                    throw UnexpectedSystemException.unknownState();
129:                }
130:
131:                //
132:                ArrayList barIconUrls = new ArrayList();
133:                ArrayList barIconLabels = new ArrayList();
134:                ArrayList barIconSacs = new ArrayList();
135:
136:                //
137:                initializeActions(barIconUrls, barIconLabels, barIconSacs,
138:                        inCc, inSection, inIndex, inCpc);
139:
140:                if (renderCustomSubPane(inCpc, inContext, inCc, inSection,
141:                        inIndex)) {
142:                    //
143:                } else if (inContext
144:                        .equals(ConsoleConfigTagPreferencesHelper.CONTEXT__CONCEPT_TAG_TREE)) {
145:                    //
146:
147:                    int width = getContextWidth(contextProps);
148:                    int height = getContextHeight(contextProps);
149:
150:                    BasePaneRcthTreeConsolePageContext.newInstance(inCpc,
151:                            (width / inCpc.getColumnWidth()), height, 50, 50,
152:                            convertToStringList(barIconUrls),
153:                            convertToStringList(barIconLabels),
154:                            convertToSacList(barIconSacs));
155:                } else if (inContext
156:                        .equals(ConsoleConfigTagPreferencesHelper.CONTEXT__CONCEPT_TAG_EDIT)) {
157:                    //
158:
159:                    int width = getContextWidth(contextProps);
160:                    int height = getContextHeight(contextProps);
161:
162:                    BasePaneRcthEditConsolePageContext.newInstance(inCpc,
163:                            (width / inCpc.getColumnWidth()), height, 50, 50,
164:                            convertToStringList(barIconUrls),
165:                            convertToStringList(barIconLabels),
166:                            convertToSacList(barIconSacs));
167:                } else if (inContext
168:                        .equals(ConsoleConfigTagPreferencesHelper.CONTEXT__CONCEPT_TAG_TEXT)) {
169:                    //
170:
171:                    int width = getContextWidth(contextProps);
172:                    int height = getContextHeight(contextProps);
173:
174:                    BasePaneRcthTextConsolePageContext.newInstance(inCpc,
175:                            (width / inCpc.getColumnWidth()), height, 50, 50,
176:                            convertToStringList(barIconUrls),
177:                            convertToStringList(barIconLabels),
178:                            convertToSacList(barIconSacs));
179:                } else {
180:                    throw new UnexpectedSystemException("Context '" + inContext
181:                            + "' could not be processed");
182:                }
183:
184:            }
185:
186:            //
187:            private boolean isPaneMinimumWidth(ConsoleConfig inCc,
188:                    int inSection, int inIndex) {
189:                //
190:                boolean outValue = false;
191:
192:                String widthString = null;
193:
194:                if (inSection == AREA__LEFT) {
195:                    int widthIndex = inCc.getLeftSectionPanePropertyIndex(
196:                            inIndex,
197:                            ConsoleConfigTagPreferencesHelper.PROP_NAME__WIDTH);
198:                    widthString = inCc.getLeftSectionPanePropertyValue(inIndex,
199:                            widthIndex);
200:                } else if (inSection == AREA__CENTER) {
201:                    int widthIndex = inCc.getCenterSectionPanePropertyIndex(
202:                            inIndex,
203:                            ConsoleConfigTagPreferencesHelper.PROP_NAME__WIDTH);
204:                    widthString = inCc.getCenterSectionPanePropertyValue(
205:                            inIndex, widthIndex);
206:                } else if (inSection == AREA__RIGHT) {
207:                    int widthIndex = inCc.getRightSectionPanePropertyIndex(
208:                            inIndex,
209:                            ConsoleConfigTagPreferencesHelper.PROP_NAME__WIDTH);
210:                    widthString = inCc.getRightSectionPanePropertyValue(
211:                            inIndex, widthIndex);
212:                } else {
213:                    throw new UnexpectedSystemException("Unknown Section '"
214:                            + inSection + "'");
215:                }
216:
217:                outValue = (Integer.parseInt(widthString) <= AREA__MINIMUM_SIZE);
218:
219:                return outValue;
220:            }
221:
222:            private boolean isPaneMinimumHeight(ConsoleConfig inCc,
223:                    int inSection, int inIndex) {
224:                //
225:                boolean outValue = false;
226:
227:                String heightString = null;
228:
229:                if (inSection == AREA__LEFT) {
230:                    int heightIndex = inCc
231:                            .getLeftSectionPanePropertyIndex(
232:                                    inIndex,
233:                                    ConsoleConfigTagPreferencesHelper.PROP_NAME__HEIGHT);
234:                    heightString = inCc.getLeftSectionPanePropertyValue(
235:                            inIndex, heightIndex);
236:                } else if (inSection == AREA__CENTER) {
237:                    int heightIndex = inCc
238:                            .getCenterSectionPanePropertyIndex(
239:                                    inIndex,
240:                                    ConsoleConfigTagPreferencesHelper.PROP_NAME__HEIGHT);
241:                    heightString = inCc.getCenterSectionPanePropertyValue(
242:                            inIndex, heightIndex);
243:                } else if (inSection == AREA__RIGHT) {
244:                    int heightIndex = inCc
245:                            .getRightSectionPanePropertyIndex(
246:                                    inIndex,
247:                                    ConsoleConfigTagPreferencesHelper.PROP_NAME__HEIGHT);
248:                    heightString = inCc.getRightSectionPanePropertyValue(
249:                            inIndex, heightIndex);
250:                } else {
251:                    throw new UnexpectedSystemException("Unknown Section '"
252:                            + inSection + "'");
253:                }
254:
255:                outValue = (Integer.parseInt(heightString) <= AREA__MINIMUM_SIZE);
256:
257:                return outValue;
258:            }
259:
260:            //
261:            protected void initializeActions(ArrayList inUrls,
262:                    ArrayList inLabels, ArrayList inActions,
263:                    ConsoleConfig inCc, int inSection, int inIndex,
264:                    ConsolePageContext inCpc) {
265:                //
266:
267:                //
268:                int totalPanes = inCc.getLeftSectionPaneCount()
269:                        + inCc.getCenterSectionPaneCount()
270:                        + inCc.getRightSectionPaneCount();
271:
272:                //
273:                boolean currentPaneAtMinimumWidth = isPaneMinimumWidth(inCc,
274:                        inSection, inIndex);
275:                boolean currentPaneAtMinimumHeight = isPaneMinimumHeight(inCc,
276:                        inSection, inIndex);
277:                //
278:                boolean lowestCenterPaneAtMinimumHeight = false;
279:                if (inCc.getCenterSectionPaneCount() > 0) {
280:                    lowestCenterPaneAtMinimumHeight = isPaneMinimumHeight(inCc,
281:                            AREA__CENTER,
282:                            (inCc.getCenterSectionPaneCount() - 1));
283:                }
284:
285:                if (totalPanes > 1) {
286:
287:                    //
288:                    createRemove(inCpc, inSection, inIndex, inUrls, inLabels,
289:                            inActions);
290:                }
291:
292:                //
293:                createStretchHorizontally(inCpc, inSection, inIndex, inUrls,
294:                        inLabels, inActions);
295:
296:                //
297:                createStretchVertically(inCpc, inSection, inIndex, inUrls,
298:                        inLabels, inActions);
299:
300:                if (inSection == AREA__LEFT) {
301:
302:                    //
303:                    if (!currentPaneAtMinimumWidth) {
304:                        createShrinkHorizontally(inCpc, inSection, inIndex,
305:                                inUrls, inLabels, inActions);
306:                    }
307:
308:                    //
309:                    if (!currentPaneAtMinimumHeight
310:                            && !lowestCenterPaneAtMinimumHeight) {
311:                        createShrinkVertically(inCpc, inSection, inIndex,
312:                                inUrls, inLabels, inActions);
313:                    }
314:
315:                    //
316:                    if (inIndex > 0) {
317:                        createSwapLeft(inCpc, inSection, inIndex, inUrls,
318:                                inLabels, inActions);
319:                    }
320:
321:                    //
322:                    if (inIndex < (inCc.getLeftSectionPaneCount() - 1)) {
323:                        createSwapRight(inCpc, inSection, inIndex, inUrls,
324:                                inLabels, inActions);
325:                    }
326:
327:                    createMoveCenter(inCpc, inSection, inIndex, inUrls,
328:                            inLabels, inActions);
329:                    createMoveRight(inCpc, inSection, inIndex, inUrls,
330:                            inLabels, inActions);
331:                } else if (inSection == AREA__CENTER) {
332:
333:                    //
334:                    if (!currentPaneAtMinimumWidth) {
335:                        createShrinkHorizontally(inCpc, inSection, inIndex,
336:                                inUrls, inLabels, inActions);
337:                    }
338:
339:                    //
340:                    if (!currentPaneAtMinimumHeight) {
341:                        createShrinkVertically(inCpc, inSection, inIndex,
342:                                inUrls, inLabels, inActions);
343:                    }
344:
345:                    //
346:                    if (inIndex > 0) {
347:                        createSwapUp(inCpc, inSection, inIndex, inUrls,
348:                                inLabels, inActions);
349:                    }
350:
351:                    //
352:                    if (inIndex < (inCc.getCenterSectionPaneCount() - 1)) {
353:                        createSwapDown(inCpc, inSection, inIndex, inUrls,
354:                                inLabels, inActions);
355:                    }
356:
357:                    //
358:                    createMoveLeft(inCpc, inSection, inIndex, inUrls, inLabels,
359:                            inActions);
360:                    createMoveRight(inCpc, inSection, inIndex, inUrls,
361:                            inLabels, inActions);
362:                } else if (inSection == AREA__RIGHT) {
363:
364:                    //
365:                    if (!currentPaneAtMinimumWidth) {
366:                        createShrinkHorizontally(inCpc, inSection, inIndex,
367:                                inUrls, inLabels, inActions);
368:                    }
369:
370:                    //
371:                    if (!currentPaneAtMinimumHeight
372:                            && !lowestCenterPaneAtMinimumHeight) {
373:                        createShrinkVertically(inCpc, inSection, inIndex,
374:                                inUrls, inLabels, inActions);
375:                    }
376:
377:                    //
378:                    if (inIndex > 0) {
379:                        createSwapLeft(inCpc, inSection, inIndex, inUrls,
380:                                inLabels, inActions);
381:                    }
382:
383:                    //
384:                    if (inIndex < (inCc.getRightSectionPaneCount() - 1)) {
385:                        createSwapRight(inCpc, inSection, inIndex, inUrls,
386:                                inLabels, inActions);
387:                    }
388:
389:                    createMoveLeft(inCpc, inSection, inIndex, inUrls, inLabels,
390:                            inActions);
391:                    createMoveCenter(inCpc, inSection, inIndex, inUrls,
392:                            inLabels, inActions);
393:                } else {
394:                    throw new UnexpectedSystemException("Unknown Section '"
395:                            + inSection + "'");
396:                }
397:            }
398:
399:            //
400:            private final static void createStretchHorizontally(
401:                    ConsolePageContext inCpc, int inSection, int inIndex,
402:                    ArrayList inUrls, ArrayList inLabels, ArrayList inActions) {
403:
404:                //
405:                //
406:                createGeneralAction(
407:                        inCpc,
408:                        inSection,
409:                        inIndex,
410:                        inUrls,
411:                        inLabels,
412:                        inActions,
413:                        ConsoleTemplateParameters.GIF_PANE_STRETCH_HORIZONTALLY,
414:                        "Stretch Horizontally",
415:                        SubmitActionParameters.STRETCH_PANE_HORIZONTALLY);
416:            }
417:
418:            private final static void createStretchVertically(
419:                    ConsolePageContext inCpc, int inSection, int inIndex,
420:                    ArrayList inUrls, ArrayList inLabels, ArrayList inActions) {
421:
422:                //
423:                //
424:                createGeneralAction(inCpc, inSection, inIndex, inUrls,
425:                        inLabels, inActions,
426:                        ConsoleTemplateParameters.GIF_PANE_STRETCH_VERTICALLY,
427:                        "Stretch Vertically",
428:                        SubmitActionParameters.STRETCH_PANE_VERTICALLY);
429:            }
430:
431:            //
432:            private final static void createShrinkHorizontally(
433:                    ConsolePageContext inCpc, int inSection, int inIndex,
434:                    ArrayList inUrls, ArrayList inLabels, ArrayList inActions) {
435:
436:                //
437:                //
438:                createGeneralAction(inCpc, inSection, inIndex, inUrls,
439:                        inLabels, inActions,
440:                        ConsoleTemplateParameters.GIF_PANE_SHRINK_HORIZONTALLY,
441:                        "Shrink Horizontally",
442:                        SubmitActionParameters.SHRINK_PANE_HORIZONTALLY);
443:            }
444:
445:            private final static void createShrinkVertically(
446:                    ConsolePageContext inCpc, int inSection, int inIndex,
447:                    ArrayList inUrls, ArrayList inLabels, ArrayList inActions) {
448:
449:                //
450:                //
451:                createGeneralAction(inCpc, inSection, inIndex, inUrls,
452:                        inLabels, inActions,
453:                        ConsoleTemplateParameters.GIF_PANE_SHRINK_VERTICALLY,
454:                        "Shrink Vertically",
455:                        SubmitActionParameters.SHRINK_PANE_VERTICALLY);
456:            }
457:
458:            //
459:            private final static void createRemove(ConsolePageContext inCpc,
460:                    int inSection, int inIndex, ArrayList inUrls,
461:                    ArrayList inLabels, ArrayList inActions) {
462:
463:                //
464:                //
465:                createGeneralAction(inCpc, inSection, inIndex, inUrls,
466:                        inLabels, inActions,
467:                        ConsoleTemplateParameters.GIF_PANE_REMOVE, "Remove",
468:                        SubmitActionParameters.REMOVE_PANE);
469:            }
470:
471:            //
472:            private final static void createSwapUp(ConsolePageContext inCpc,
473:                    int inSection, int inIndex, ArrayList inUrls,
474:                    ArrayList inLabels, ArrayList inActions) {
475:
476:                //
477:                //
478:                createGeneralAction(inCpc, inSection, inIndex, inUrls,
479:                        inLabels, inActions,
480:                        ConsoleTemplateParameters.GIF_PANE_SWAP_UP, "Swap Up",
481:                        SubmitActionParameters.SWAP_UP);
482:            }
483:
484:            private final static void createSwapDown(ConsolePageContext inCpc,
485:                    int inSection, int inIndex, ArrayList inUrls,
486:                    ArrayList inLabels, ArrayList inActions) {
487:
488:                //
489:                //
490:                createGeneralAction(inCpc, inSection, inIndex, inUrls,
491:                        inLabels, inActions,
492:                        ConsoleTemplateParameters.GIF_PANE_SWAP_DOWN,
493:                        "Swap Down", SubmitActionParameters.SWAP_DOWN);
494:            }
495:
496:            private final static void createSwapLeft(ConsolePageContext inCpc,
497:                    int inSection, int inIndex, ArrayList inUrls,
498:                    ArrayList inLabels, ArrayList inActions) {
499:
500:                //
501:                //
502:                createGeneralAction(inCpc, inSection, inIndex, inUrls,
503:                        inLabels, inActions,
504:                        ConsoleTemplateParameters.GIF_PANE_SWAP_LEFT,
505:                        "Swap Left", SubmitActionParameters.SWAP_LEFT);
506:            }
507:
508:            private final static void createSwapRight(ConsolePageContext inCpc,
509:                    int inSection, int inIndex, ArrayList inUrls,
510:                    ArrayList inLabels, ArrayList inActions) {
511:
512:                //
513:                //
514:                createGeneralAction(inCpc, inSection, inIndex, inUrls,
515:                        inLabels, inActions,
516:                        ConsoleTemplateParameters.GIF_PANE_SWAP_RIGHT,
517:                        "Swap Right", SubmitActionParameters.SWAP_RIGHT);
518:            }
519:
520:            private final static void createMoveLeft(ConsolePageContext inCpc,
521:                    int inSection, int inIndex, ArrayList inUrls,
522:                    ArrayList inLabels, ArrayList inActions) {
523:                //
524:                createGeneralAction(
525:                        inCpc,
526:                        inSection,
527:                        inIndex,
528:                        inUrls,
529:                        inLabels,
530:                        inActions,
531:                        ConsoleTemplateParameters.GIF_PANE_MOVE_TO_LEFT_SECTION,
532:                        "Move To Left",
533:                        SubmitActionParameters.MOVE_TO_LEFT_SECTION);
534:            }
535:
536:            private final static void createMoveCenter(
537:                    ConsolePageContext inCpc, int inSection, int inIndex,
538:                    ArrayList inUrls, ArrayList inLabels, ArrayList inActions) {
539:                //
540:                createGeneralAction(
541:                        inCpc,
542:                        inSection,
543:                        inIndex,
544:                        inUrls,
545:                        inLabels,
546:                        inActions,
547:                        ConsoleTemplateParameters.GIF_PANE_MOVE_TO_CENTER_SECTION,
548:                        "Move To Center",
549:                        SubmitActionParameters.MOVE_TO_CENTER_SECTION);
550:            }
551:
552:            private final static void createMoveRight(ConsolePageContext inCpc,
553:                    int inSection, int inIndex, ArrayList inUrls,
554:                    ArrayList inLabels, ArrayList inActions) {
555:                //
556:                createGeneralAction(
557:                        inCpc,
558:                        inSection,
559:                        inIndex,
560:                        inUrls,
561:                        inLabels,
562:                        inActions,
563:                        ConsoleTemplateParameters.GIF_PANE_MOVE_TO_RIGHT_SECTION,
564:                        "Move To Right",
565:                        SubmitActionParameters.MOVE_TO_RIGHT_SECTION);
566:            }
567:
568:            private final static void createGeneralAction(
569:                    ConsolePageContext inCpc, int inSection, int inIndex,
570:                    ArrayList inUrls, ArrayList inLabels, ArrayList inActions,
571:                    String inUrl, String inLabel, String inSubAction) {
572:                //
573:
574:                //
575:                //
576:                SubmitActionContext moveToSectionSac = SubmitActionContext
577:                        .newInstance(inCpc);
578:                //
579:                moveToSectionSac
580:                        .addAction(
581:                                ConsoleParameterContext.FIRST_INPUT,
582:                                inCpc
583:                                        .singleQuotes(SubmitActionParameters.UPDATE_CONSOLE_CONFIG));
584:                moveToSectionSac.addAction(
585:                        ConsoleParameterContext.SECOND_INPUT, inCpc
586:                                .singleQuotes(inSubAction));
587:                //
588:                addLocation(inCpc, moveToSectionSac, inSection, inIndex);
589:                //
590:                inUrls.add(inUrl);
591:                inLabels.add(inLabel);
592:                inActions.add(moveToSectionSac);
593:            }
594:
595:            //
596:            private final static void addLocation(ConsolePageContext inCpc,
597:                    SubmitActionContext inSac, int inSection, int inIndex) {
598:                //
599:                String sectionValue = inCpc.singleQuotes(inSection + "");
600:                String indexValue = inCpc.singleQuotes(inIndex + "");
601:                //
602:                inSac.addParameter(inSac.FIRST_INPUT, sectionValue);
603:                inSac.addParameter(inSac.SECOND_INPUT, indexValue);
604:            }
605:
606:            protected abstract boolean renderCustomSubPane(
607:                    ConsolePageContext inCpc, String inContext,
608:                    ConsoleConfig inCc, int inSection, int inIndex)
609:                    throws IOException;
610:
611:            //
612:            //
613:            //
614:            //
615:            //
616:            //
617:            //
618:            //
619:            //
620:            //
621:            //
622:            //
623:            //
624:            //
625:            //
626:            protected final static int getContextWidth(HashMap inHm) {
627:
628:                int outValue = 0;
629:
630:                String s = ((String) inHm
631:                        .get(ConsoleConfigTagPreferencesHelper.PROP_NAME__WIDTH));
632:
633:                outValue = Integer.parseInt(s);
634:
635:                return outValue;
636:            }
637:
638:            protected final static int getContextHeight(HashMap inHm) {
639:
640:                int outValue = 0;
641:
642:                String s = ((String) inHm
643:                        .get(ConsoleConfigTagPreferencesHelper.PROP_NAME__HEIGHT));
644:
645:                outValue = Integer.parseInt(s);
646:
647:                return outValue;
648:            }
649:
650:            //
651:            protected final static HashSet getAllContextNamesInUse(
652:                    ConsoleConfig inCc) {
653:
654:                HashSet outValue = new HashSet();
655:
656:                //
657:                for (int i = 0; i < inCc.getLeftSectionPaneCount(); i++) {
658:                    outValue.add(inCc.getLeftSectionPaneContext(i));
659:                }
660:                //
661:                for (int i = 0; i < inCc.getCenterSectionPaneCount(); i++) {
662:                    outValue.add(inCc.getCenterSectionPaneContext(i));
663:                }
664:                //
665:                for (int i = 0; i < inCc.getRightSectionPaneCount(); i++) {
666:                    outValue.add(inCc.getRightSectionPaneContext(i));
667:                }
668:
669:                return outValue;
670:            }
671:
672:            //
673:            protected final static HashMap getAllMainProperties(
674:                    ConsoleConfig inCc) {
675:
676:                HashMap outValue = new HashMap();
677:
678:                for (int i = 0; i < inCc.getMainPropertyCount(); i++) {
679:                    //
680:                    String nextName = inCc.getMainPropertyName(i);
681:                    String nextValue = inCc.getMainPropertyValue(i);
682:                    //
683:                    outValue.put(nextName, nextValue);
684:                }
685:
686:                return outValue;
687:            }
688:
689:            //
690:            protected final static HashMap getAllLeftSectionPaneProperties(
691:                    ConsoleConfig inCc, int inIndex) {
692:                //
693:
694:                return BaseRcthStudioServlet.getAllLeftSectionPaneProperties(
695:                        inCc, inIndex);
696:
697:            }
698:
699:            //
700:            protected final static HashMap getAllCenterSectionPaneProperties(
701:                    ConsoleConfig inCc, int inIndex) {
702:                //
703:                return BaseRcthStudioServlet.getAllCenterSectionPaneProperties(
704:                        inCc, inIndex);
705:            }
706:
707:            //
708:            protected final static HashMap getAllRightSectionPaneProperties(
709:                    ConsoleConfig inCc, int inIndex) {
710:                //
711:                return BaseRcthStudioServlet.getAllRightSectionPaneProperties(
712:                        inCc, inIndex);
713:            }
714:
715:            protected final static String[] convertToStringList(ArrayList inL) {
716:
717:                String outValue[] = new String[inL.size()];
718:
719:                for (int i = 0; i < inL.size(); i++) {
720:                    String nextValue = (String) inL.get(i);
721:                    outValue[i] = nextValue;
722:                }
723:
724:                return outValue;
725:            }
726:
727:            protected final static SubmitActionContext[] convertToSacList(
728:                    ArrayList inL) {
729:
730:                SubmitActionContext outValue[] = new SubmitActionContext[inL
731:                        .size()];
732:
733:                for (int i = 0; i < inL.size(); i++) {
734:                    SubmitActionContext nextValue = (SubmitActionContext) inL
735:                            .get(i);
736:                    outValue[i] = nextValue;
737:                }
738:
739:                return outValue;
740:            }
741:
742:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.