KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icesoft > icefaces > samples > showcase > navigation > TreeNavigation


1 /*
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * "The contents of this file are subject to the Mozilla Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
11  * License for the specific language governing rights and limitations under
12  * the License.
13  *
14  * The Original Code is ICEfaces 1.5 open source software code, released
15  * November 5, 2006. The Initial Developer of the Original Code is ICEsoft
16  * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
17  * 2004-2006 ICEsoft Technologies Canada, Corp. All Rights Reserved.
18  *
19  * Contributor(s): _____________________.
20  *
21  * Alternatively, the contents of this file may be used under the terms of
22  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"
23  * License), in which case the provisions of the LGPL License are
24  * applicable instead of those above. If you wish to allow use of your
25  * version of this file only under the terms of the LGPL License and not to
26  * allow others to use your version of this file under the MPL, indicate
27  * your decision by deleting the provisions above and replace them with
28  * the notice and other provisions required by the LGPL License. If you do
29  * not delete the provisions above, a recipient may use your version of
30  * this file under either the MPL or the LGPL License."
31  *
32  */

33
34 package com.icesoft.icefaces.samples.showcase.navigation;
35
36 import com.icesoft.faces.component.tree.Tree;
37 import com.icesoft.icefaces.samples.showcase.util.StyleBean;
38
39 import javax.faces.application.Application;
40 import javax.faces.context.FacesContext;
41 import javax.swing.tree.DefaultMutableTreeNode JavaDoc;
42 import javax.swing.tree.DefaultTreeModel JavaDoc;
43 import java.util.Enumeration JavaDoc;
44
45 /**
46  * <p>The TreeNavigation class is the backing bean for the showcase navigation
47  * tree on the left hand side of the application. Each node in the tree is made
48  * up of a PageContent which is responsible for the navigation action when a
49  * tree node is selected.</p>
50  * <p/>
51  * <p>When the Tree component binding takes place the tree nodes are initialized
52  * and the tree is built. Any addition to the tree navigation must be made to
53  * this class.</p>
54  *
55  * @since 0.3.0
56  */

57 public class TreeNavigation {
58
59     // binding to component
60
private Tree treeComponent;
61
62     // bound to components value attribute
63
private DefaultTreeModel JavaDoc model;
64
65     // root node of tree, for delayed construction
66
private DefaultMutableTreeNode JavaDoc rootTreeNode;
67
68     // map of all navigation backing beans.
69
private NavigationBean navigationBean;
70
71     // initialization flag
72
private boolean isInitiated;
73
74     // folder icons for branch nodes
75
private String JavaDoc themeBranchContractedIcon;
76     private String JavaDoc themeBranchExpandedIcon;
77
78     /**
79      * Default constructor of the tree. The root node of the tree is created at
80      * this point.
81      */

82     public TreeNavigation() {
83         // build root node so that children can be attached
84
PageContentBean rootObject = new PageContentBean();
85         rootObject
86                 .setMenuDisplayText("menuDisplayText.componentSuiteMenuGroup");
87         rootObject.setMenuContentTitle(
88                 "submenuContentTitle.componentSuiteMenuGroup");
89         rootObject.setMenuContentInclusionFile("./content/splashComponents.jspx");
90         rootObject.setTemplateName("splashComponentsPanel");
91         rootObject.setNavigationSelection(navigationBean);
92         rootObject.setPageContent(true);
93         rootTreeNode = new DefaultMutableTreeNode JavaDoc(rootObject);
94         rootObject.setWrapper(rootTreeNode);
95
96         model = new DefaultTreeModel JavaDoc(rootTreeNode);
97
98         // StyleBean binding
99
Application application =
100                 FacesContext.getCurrentInstance().getApplication();
101         StyleBean styleBean =
102                 ((StyleBean) application.createValueBinding("#{styleBean}").
103                         getValue(FacesContext.getCurrentInstance()));
104
105         // provide StyleBean with reference to the tree navigation for folder icon updates
106
styleBean.registerTree(this);
107
108         // xp folders (default theme)
109
themeBranchContractedIcon = StyleBean.XP_BRANCH_CONTRACTED_ICON;
110         themeBranchExpandedIcon = StyleBean.XP_BRANCH_EXPANDED_ICON;
111     }
112
113     /**
114      * Iterates over each node in the navigation tree and sets the icon based on
115      * the current theme. This is necessary for the change to register with the
116      * component.
117      *
118      * @param currentStyle the theme on which the folder icons are based
119      */

120     public void refreshIcons(String JavaDoc currentStyle) {
121
122         // set the folder icon based on the StyleBean theme
123
if (currentStyle.equals("xp")) {
124             themeBranchContractedIcon = StyleBean.XP_BRANCH_CONTRACTED_ICON;
125             themeBranchExpandedIcon = StyleBean.XP_BRANCH_EXPANDED_ICON;
126         } else if (currentStyle.equals("royale")) {
127             themeBranchContractedIcon = StyleBean.ROYALE_BRANCH_CONTRACTED_ICON;
128             themeBranchExpandedIcon = StyleBean.ROYALE_BRANCH_EXPANDED_ICON;
129         }
130         // invalid theme
131
else {
132             return;
133         }
134
135         // get each tree node for iteration
136
Enumeration JavaDoc enumTree = rootTreeNode.depthFirstEnumeration();
137         PageContentBean temp = null;
138
139         // set the icon on each tree node
140
while (enumTree.hasMoreElements()) {
141             temp = ((PageContentBean) ((DefaultMutableTreeNode JavaDoc) enumTree
142                     .nextElement()).getUserObject());
143
144             if (temp != null) {
145                 temp.setBranchContractedIcon(themeBranchContractedIcon);
146                 temp.setBranchExpandedIcon(themeBranchExpandedIcon);
147             }
148         }
149     }
150
151     /**
152      * Utility method to build the entire navigation tree.
153      */

154     private void init() {
155         // set init flag
156
isInitiated = true;
157
158         if (rootTreeNode != null) {
159
160             // get the navigation bean from the faces context
161
FacesContext facesContext = FacesContext.getCurrentInstance();
162             Object JavaDoc navigationObject =
163                     facesContext.getApplication()
164                             .createValueBinding("#{navigation}")
165                             .getValue(facesContext);
166
167
168             if (navigationObject != null &&
169                 navigationObject instanceof NavigationBean) {
170
171                 // set bean callback for root
172
PageContentBean branchObject =
173                         (PageContentBean) rootTreeNode.getUserObject();
174
175                 // assign the initialized navigation bean, so that we can enable panel navigation
176
navigationBean = (NavigationBean) navigationObject;
177
178                 // set this node as the default page to view
179
navigationBean.setSelectedPanel(
180                         (PageContentBean) rootTreeNode.getUserObject());
181                 branchObject.setNavigationSelection(navigationBean);
182
183                 /**
184                  * Generate the backing bean for each tree node and put it all together
185                  */

186
187                 // theme menu item
188
branchObject = new PageContentBean();
189                 branchObject.setMenuDisplayText(
190                         "submenuDisplayText.themesSubmenuItem");
191                 branchObject.setMenuContentTitle(
192                         "submenuContentTitle.themesSubmenuItem");
193                 branchObject.setMenuContentInclusionFile("./content/splashThemes.jspx");
194                 branchObject.setTemplateName("splashThemesPanel");
195                 branchObject.setNavigationSelection(navigationBean);
196                 DefaultMutableTreeNode JavaDoc branchNode =
197                         new DefaultMutableTreeNode JavaDoc(branchObject);
198                 branchObject.setLeaf(
199                         true); // leaf nodes must be explicitly set - support lazy loading
200
branchObject.setWrapper(branchNode);
201                 // finally add the new custom component branch
202
rootTreeNode.add(branchNode);
203
204                 // Component menu item
205
branchObject = new PageContentBean();
206                 branchObject.setMenuDisplayText(
207                         "menuDisplayText.componentsMenuGroup");
208                 branchObject.setMenuContentTitle(
209                         "submenuContentTitle.componentsMenuGroup");
210                 branchObject.setTemplateName("splashComponentsPanel");
211                 branchObject.setNavigationSelection(navigationBean);
212                 branchObject.setPageContent(false);
213                 branchNode = new DefaultMutableTreeNode JavaDoc(branchObject);
214                 branchObject.setWrapper(branchNode);
215                 // finally add the new custom component branch
216
rootTreeNode.add(branchNode);
217
218                 // component menu -> Text Entry
219
branchObject = new PageContentBean();
220                 branchObject.setMenuDisplayText(
221                         "submenuDisplayText.textFieldsSubmenuItem");
222                 branchObject.setMenuContentTitle(
223                         "submenuContentTitle.textFieldsSubmenuItem");
224                 branchObject.setMenuContentInclusionFile("./components/textFields.jspx");
225                 branchObject.setTemplateName("textFieldsContentPanel");
226                 branchObject.setNavigationSelection(navigationBean);
227                 DefaultMutableTreeNode JavaDoc leafNode =
228                         new DefaultMutableTreeNode JavaDoc(branchObject);
229                 branchObject.setWrapper(leafNode);
230                 branchObject.setLeaf(true);
231                 // finally add the new custom component branch
232
branchNode.add(leafNode);
233
234                 // component menu -> Selection
235
branchObject = new PageContentBean();
236                 branchObject.setMenuDisplayText(
237                         "submenuDisplayText.selectionTagsSubmenuItem");
238                 branchObject.setMenuContentTitle(
239                         "submenuContentTitle.selectionTagsSubmenuItem");
240                 branchObject.setMenuContentInclusionFile("./components/selectionTags.jspx");
241                 branchObject.setTemplateName("selectionTagsContentPanel");
242                 branchObject.setNavigationSelection(navigationBean);
243                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
244                 branchObject.setWrapper(leafNode);
245                 branchObject.setLeaf(true);
246                 // finally add the new custom component branch
247
branchNode.add(leafNode);
248
249                 // component menu -> Button & Links
250
branchObject = new PageContentBean();
251                 branchObject.setMenuDisplayText(
252                         "submenuDisplayText.buttonsAndLinksSubmenuItem");
253                 branchObject.setMenuContentTitle(
254                         "submenuContentTitle.buttonsAndLinksSubmenuItem");
255                 branchObject.setMenuContentInclusionFile("./components/buttonsAndLinks.jspx");
256                 branchObject.setTemplateName("buttonsAndLinksContentPanel");
257                 branchObject.setNavigationSelection(navigationBean);
258                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
259                 branchObject.setWrapper(leafNode);
260                 branchObject.setLeaf(true);
261                 // finally add the new custom component branch
262
branchNode.add(leafNode);
263
264                 // component menu -> Auto Complete
265
branchObject = new PageContentBean();
266                 branchObject.setMenuDisplayText(
267                         "submenuDisplayText.autoCompleteSubmenuItem");
268                 branchObject.setMenuContentTitle(
269                         "submenuContentTitle.autoCompleteSubmenuItem");
270                 branchObject.setMenuContentInclusionFile("./components/autoComplete.jspx");
271                 branchObject.setTemplateName("autoCompleteContentPanel");
272                 branchObject.setNavigationSelection(navigationBean);
273                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
274                 branchObject.setWrapper(leafNode);
275                 branchObject.setLeaf(true);
276                 // finally add the new custom component branch
277
branchNode.add(leafNode);
278
279                 // component menu -> Drag and Drop
280
branchObject = new PageContentBean();
281                 branchObject.setMenuDisplayText(
282                         "submenuDisplayText.dragDropSubmenuItem");
283                 branchObject.setMenuContentTitle(
284                         "submenuContentTitle.dragDropSubmenuItem");
285                 branchObject.setMenuContentInclusionFile("./components/dragDrop.jspx");
286                 branchObject.setTemplateName("dragDropContentPanel");
287                 branchObject.setNavigationSelection(navigationBean);
288                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
289                 branchObject.setWrapper(leafNode);
290                 branchObject.setLeaf(true);
291                 // finally add the new custom component branch
292
branchNode.add(leafNode);
293
294                 // component menu -> Calendar
295
branchObject = new PageContentBean();
296                 branchObject.setMenuDisplayText(
297                         "submenuDisplayText.selectInputDateComponentSubmenuItem");
298                 branchObject.setMenuContentTitle(
299                         "submenuContentTitle.selectInputDateComponentSubmenuItem");
300                 branchObject.setMenuContentInclusionFile("./components/selectInputDate.jspx");
301                 branchObject.setTemplateName("selectInputDateContentPanel");
302                 branchObject.setNavigationSelection(navigationBean);
303                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
304                 branchObject.setWrapper(leafNode);
305                 branchObject.setLeaf(true);
306                 // finally add the new custom component branch
307
branchNode.add(leafNode);
308
309                 // component menu -> Tree
310
branchObject = new PageContentBean();
311                 branchObject.setMenuDisplayText(
312                         "submenuDisplayText.treeComponentSubmenuItem");
313                 branchObject.setMenuContentTitle(
314                         "submenuContentTitle.treeComponentSubmenuItem");
315                 branchObject.setMenuContentInclusionFile("./components/tree.jspx");
316                 branchObject.setTemplateName("treeContentPanel");
317                 branchObject.setNavigationSelection(navigationBean);
318                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
319                 branchObject.setWrapper(leafNode);
320                 branchObject.setLeaf(true);
321                 // finally add the new custom component branch
322
branchNode.add(leafNode);
323
324                 // component menu -> MenuBar
325
branchObject = new PageContentBean();
326                 branchObject.setMenuDisplayText(
327                         "submenuDisplayText.menuBarSubmenuItem");
328                 branchObject.setMenuContentTitle(
329                         "submenuContentTitle.menuBarSubmenuItem");
330                 branchObject.setMenuContentInclusionFile("./components/menuBar.jspx");
331                 branchObject.setTemplateName("menuBarContentPanel");
332                 branchObject.setNavigationSelection(navigationBean);
333                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
334                 branchObject.setWrapper(leafNode);
335                 branchObject.setLeaf(true);
336                 // finally add the new custom component branch
337
branchNode.add(leafNode);
338
339                 //component menu -> Effects
340
branchObject = new PageContentBean();
341                 branchObject.setMenuDisplayText(
342                         "submenuDisplayText.effectsSubmenuItem");
343                 branchObject.setMenuContentTitle(
344                         "submenuContentTitle.effectsSubmenuItem");
345                 branchObject.setMenuContentInclusionFile("./components/effects.jspx");
346                 branchObject.setTemplateName("effectsContentPanel");
347                 branchObject.setNavigationSelection(navigationBean);
348                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
349                 branchObject.setWrapper(leafNode);
350                 branchObject.setLeaf(true);
351                 // finally add the new custom component branch
352
branchNode.add(leafNode);
353
354                 //component menu -> Connection Status
355
branchObject = new PageContentBean();
356                 branchObject.setMenuDisplayText(
357                         "submenuDisplayText.connectionStatusSubmenuItem");
358                 branchObject.setMenuContentTitle(
359                         "submenuContentTitle.connectionStatusSubmenuItem");
360                 branchObject.setMenuContentInclusionFile("./components/connectionStatus.jspx");
361                 branchObject.setTemplateName("connectionStatusContentPanel");
362                 branchObject.setNavigationSelection(navigationBean);
363                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
364                 branchObject.setWrapper(leafNode);
365                 branchObject.setLeaf(true);
366                 // finally add the new custom component branch
367
branchNode.add(leafNode);
368
369                 // component menu -> Table
370
branchObject = new PageContentBean();
371                 branchObject.setExpanded(false);
372                 branchObject.setMenuDisplayText(
373                         "submenuDisplayText.tableComponentSubmenuItem");
374                 branchObject.setMenuContentTitle(
375                         "submenuContentTitle.tableComponentSubmenuItem");
376                 branchObject.setTemplateName("splashTablesPanel");
377                 branchObject.setNavigationSelection(navigationBean);
378                 branchObject.setPageContent(false);
379                 DefaultMutableTreeNode JavaDoc branchNode2 =
380                         new DefaultMutableTreeNode JavaDoc(branchObject);
381                 branchObject.setWrapper(branchNode2);
382                 // finally add the new custom component branch
383
branchNode.add(branchNode2);
384
385                 // component menu -> Table -> Table
386
branchObject = new PageContentBean();
387                 branchObject.setMenuDisplayText(
388                         "submenuDisplayText.tableComponentSubmenuItem");
389                 branchObject.setMenuContentTitle(
390                         "submenuContentTitle.tableComponentSubmenuItem");
391                 branchObject.setMenuContentInclusionFile("./components/table.jspx");
392                 branchObject.setTemplateName("tableContentPanel");
393                 branchObject.setNavigationSelection(navigationBean);
394                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
395                 branchObject.setWrapper(leafNode);
396                 branchObject.setLeaf(true);
397                 // finally add the new custom component branch
398
branchNode2.add(leafNode);
399
400                 // component menu -> Table -> Columns
401
branchObject = new PageContentBean();
402                 branchObject.setMenuDisplayText(
403                         "submenuDisplayText.columnsComponentSubmenuItem");
404                 branchObject.setMenuContentTitle(
405                         "submenuContentTitle.columnsComponentSubmenuItem");
406                 branchObject.setMenuContentInclusionFile("./components/tableColumns.jspx");
407                 branchObject.setTemplateName("columnsContentPanel");
408                 branchObject.setNavigationSelection(navigationBean);
409                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
410                 branchObject.setWrapper(leafNode);
411                 branchObject.setLeaf(true);
412                 // finally add the new custom component branch
413
branchNode2.add(leafNode);
414
415                 // component menu -> Table -> Sortable Header
416
branchObject = new PageContentBean();
417                 branchObject.setMenuDisplayText(
418                         "submenuDisplayText.dataSortHeaderComponentSubmenuItem");
419                 branchObject.setMenuContentTitle(
420                         "submenuContentTitle.dataSortHeaderComponentSubmenuItem");
421                 branchObject.setMenuContentInclusionFile("./components/commandSortHeader.jspx");
422                 branchObject.setTemplateName("commandSortHeaderContentPanel");
423                 branchObject.setNavigationSelection(navigationBean);
424                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
425                 branchObject.setWrapper(leafNode);
426                 branchObject.setLeaf(true);
427                 // finally add the new custom component branch
428
branchNode2.add(leafNode);
429
430                 // component menu -> Table -> Data Header
431
branchObject = new PageContentBean();
432                 branchObject.setMenuDisplayText(
433                         "submenuDisplayText.dataScrollerComponentSubmenuItem");
434                 branchObject.setMenuContentTitle(
435                         "submenuContentTitle.dataScrollerComponentSubmenuItem");
436                 branchObject.setMenuContentInclusionFile("./components/dataPaginator.jspx");
437                 branchObject.setTemplateName("tablePaginatorContentPanel");
438                 branchObject.setNavigationSelection(navigationBean);
439                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
440                 branchObject.setWrapper(leafNode);
441                 branchObject.setLeaf(true);
442                 // finally add the new custom component branch
443
branchNode2.add(leafNode);
444
445                 // component menu -> Table -> TableExpandable
446
branchObject = new PageContentBean();
447                 branchObject.setMenuDisplayText(
448                         "submenuDisplayText.tableExpandableComponentSubmenuItem");
449                 branchObject.setMenuContentTitle(
450                         "submenuContentTitle.tableExpandableComponentSubmenuItem");
451                 branchObject.setMenuContentInclusionFile("./components/tableExpandable.jspx");
452                 branchObject.setTemplateName("tableExpandableContentPanel");
453                 branchObject.setNavigationSelection(navigationBean);
454                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
455                 branchObject.setWrapper(leafNode);
456                 branchObject.setLeaf(true);
457                 // finally add the new custom component branch
458
branchNode2.add(leafNode);
459
460                 // component menu -> Table -> TableRowSelec5tion
461
branchObject = new PageContentBean();
462                 branchObject.setMenuDisplayText(
463                         "submenuDisplayText.tableRowSelectionComponentSubmenuItem");
464                 branchObject.setMenuContentTitle(
465                         "submenuContentTitle.tableRowSelectionComponentSubmenuItem");
466                 branchObject.setMenuContentInclusionFile("./components/tableRowSelection.jspx");
467                 branchObject.setTemplateName("tableRowSelectionContentPanel");
468                 branchObject.setNavigationSelection(navigationBean);
469                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
470                 branchObject.setWrapper(leafNode);
471                 branchObject.setLeaf(true);
472                 // finally add the new custom component branch
473
branchNode2.add(leafNode);
474
475                 // component menu -> Progress Indicator
476
branchObject = new PageContentBean();
477                 branchObject.setMenuDisplayText(
478                         "submenuDisplayText.outputProgressComponentSubmenuItem");
479                 branchObject.setMenuContentTitle(
480                         "submenuContentTitle.outputProgressComponentSubmenuItem");
481                 branchObject.setMenuContentInclusionFile("./components/outputProgress.jspx");
482                 branchObject.setTemplateName("outputProgressContentPanel");
483                 branchObject.setNavigationSelection(navigationBean);
484                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
485                 branchObject.setWrapper(leafNode);
486                 branchObject.setLeaf(true);
487                 // finally add the new custom component branch
488
branchNode.add(leafNode);
489
490                 // component menu -> File Upload
491
branchObject = new PageContentBean();
492                 branchObject.setMenuDisplayText(
493                         "submenuDisplayText.inputFileComponentSubmenuItem");
494                 branchObject.setMenuContentTitle(
495                         "submenuContentTitle.inputFileComponentSubmenuItem");
496                 branchObject.setMenuContentInclusionFile("./components/inputFile.jspx");
497                 branchObject.setTemplateName("inputFileContentPanel");
498                 branchObject.setNavigationSelection(navigationBean);
499                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
500                 branchObject.setWrapper(leafNode);
501                 branchObject.setLeaf(true);
502                 // finally add the new custom component branch
503
branchNode.add(leafNode);
504
505                 // component menu -> Chart
506
branchObject = new PageContentBean();
507                 branchObject.setExpanded(false);
508                 branchObject.setMenuDisplayText(
509                         "submenuDisplayText.chartComponentSubmenuItem");
510                 branchObject.setMenuContentTitle(
511                         "submenuContentTitle.chartComponentSubmenuItem");
512                 branchObject.setTemplateName("splashChartsPanel");
513                 branchObject.setNavigationSelection(navigationBean);
514                 branchObject.setPageContent(false);
515                 DefaultMutableTreeNode JavaDoc branchNode3 =
516                         new DefaultMutableTreeNode JavaDoc(branchObject);
517                 branchObject.setWrapper(branchNode3);
518                 // finally add the new custom component branch
519
branchNode.add(branchNode3);
520
521                 // component menu -> Chart -> Chart
522
branchObject = new PageContentBean();
523                 branchObject.setMenuDisplayText(
524                         "submenuDisplayText.chartComponentSubmenuItem");
525                 branchObject.setMenuContentTitle(
526                         "submenuContentTitle.chartComponentSubmenuItem");
527                 branchObject.setMenuContentInclusionFile("./components/outputChart/chart.jspx");
528                 branchObject.setTemplateName("chartPanel");
529                 branchObject.setNavigationSelection(navigationBean);
530                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
531                 branchObject.setWrapper(leafNode);
532                 branchObject.setLeaf(true);
533                 // finally add the new custom component branch
534
branchNode3.add(leafNode);
535
536                 // component menu -> Chart -> Dynamic Chart
537
branchObject = new PageContentBean();
538                 branchObject.setMenuDisplayText(
539                         "submenuDisplayText.dynamicChartComponentSubmenuItem");
540                 branchObject.setMenuContentTitle(
541                         "submenuContentTitle.dynamicChartComponentSubmenuItem");
542                 branchObject.setMenuContentInclusionFile("./components/outputChart/dynamicChart.jspx");
543                 branchObject.setTemplateName("dynamicChartPanel");
544                 branchObject.setNavigationSelection(navigationBean);
545                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
546                 branchObject.setWrapper(leafNode);
547                 branchObject.setLeaf(true);
548                 // finally add the new custom component branch
549
branchNode3.add(leafNode);
550
551                 // component menu -> Chart -> Combined Chart
552
branchObject = new PageContentBean();
553                 branchObject.setMenuDisplayText(
554                         "submenuDisplayText.combinedChartComponentSubmenuItem");
555                 branchObject.setMenuContentTitle(
556                         "submenuContentTitle.combinedChartComponentSubmenuItem");
557                 branchObject.setMenuContentInclusionFile("./components/outputChart/combinedChart.jspx");
558                 branchObject.setTemplateName("combinedChartPanel");
559                 branchObject.setNavigationSelection(navigationBean);
560                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
561                 branchObject.setWrapper(leafNode);
562                 branchObject.setLeaf(true);
563                 // finally add the new custom component branch
564
branchNode3.add(leafNode);
565
566                 // Layout Panels menu item
567
branchObject = new PageContentBean();
568                 branchObject.setMenuDisplayText(
569                         "submenuDisplayText.layoutPanelMenuGroup");
570                 branchObject.setMenuContentTitle(
571                         "submenuContentTitle.layoutPanelMenuGroup");
572                 branchObject.setTemplateName("splashLayoutsPanelsPanel");
573                 branchObject.setNavigationSelection(navigationBean);
574                 branchObject.setPageContent(false);
575                 branchNode = new DefaultMutableTreeNode JavaDoc(branchObject);
576                 branchObject.setWrapper(branchNode);
577                 // finally add the new custom component branch
578
rootTreeNode.add(branchNode);
579
580                 // Layout Panels menu -> Border Panel
581
branchObject = new PageContentBean();
582                 branchObject.setMenuDisplayText(
583                         "submenuDisplayText.borderLayoutComponentSubmenuItem");
584                 branchObject.setMenuContentTitle(
585                         "submenuContentTitle.borderLayoutComponentSubmenuItem");
586                 branchObject.setMenuContentInclusionFile("./layoutPanels/panelBorder.jspx");
587                 branchObject.setTemplateName("panelBorderContentPanel");
588                 branchObject.setNavigationSelection(navigationBean);
589                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
590                 branchObject.setWrapper(leafNode);
591                 branchObject.setLeaf(true);
592                 // finally add the new custom component branch
593
branchNode.add(leafNode);
594
595                 // component menu -> Collapsible Panel
596
branchObject = new PageContentBean();
597                 branchObject.setMenuDisplayText(
598                         "submenuDisplayText.collapsiblePanelItem");
599                 branchObject.setMenuContentTitle(
600                         "submenuContentTitle.collapsiblePanelItem");
601                 branchObject.setMenuContentInclusionFile("./layoutPanels/panelCollapsible.jspx");
602                 branchObject.setTemplateName("collapsiblePanel");
603                 branchObject.setNavigationSelection(navigationBean);
604                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
605                 branchObject.setWrapper(leafNode);
606                 branchObject.setLeaf(true);
607                 // finally add the new custom component branch
608
branchNode.add(leafNode);
609                 
610                 //component menu -> Popup Panel
611
branchObject = new PageContentBean();
612                 branchObject.setMenuDisplayText(
613                         "submenuDisplayText.panelPopupSubmenuItem");
614                 branchObject.setMenuContentTitle(
615                         "submenuContentTitle.panelPopupSubmenuItem");
616                 branchObject.setMenuContentInclusionFile("./layoutPanels/panelPopup.jspx");
617                 branchObject.setTemplateName("panelPopupContentPanel");
618                 branchObject.setNavigationSelection(navigationBean);
619                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
620                 branchObject.setWrapper(leafNode);
621                 branchObject.setLeaf(true);
622                 // finally add the new custom component branch
623
branchNode.add(leafNode);
624
625                 // component menu -> positioned Panel
626
branchObject = new PageContentBean();
627                 branchObject.setMenuDisplayText(
628                         "submenuDisplayText.positionedPanelItem");
629                 branchObject.setMenuContentTitle(
630                         "submenuContentTitle.positionedPanelItem");
631                 branchObject.setMenuContentInclusionFile("./layoutPanels/positionedPanel.jspx");
632                 branchObject.setTemplateName("positionPanel");
633                 branchObject.setNavigationSelection(navigationBean);
634                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
635                 branchObject.setWrapper(leafNode);
636                 branchObject.setLeaf(true);
637                 // finally add the new custom component branch
638
branchNode.add(leafNode);
639                 
640
641                 // component menu -> Panel Series
642
branchObject = new PageContentBean();
643                 branchObject.setMenuDisplayText(
644                         "submenuDisplayText.listSubmenuItem");
645                 branchObject.setMenuContentTitle(
646                         "submenuContentTitle.listSubmenuItem");
647                 branchObject.setMenuContentInclusionFile("./layoutPanels/panelSeries.jspx");
648                 branchObject.setTemplateName("listContentPanel");
649                 branchObject.setNavigationSelection(navigationBean);
650                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
651                 branchObject.setWrapper(leafNode);
652                 branchObject.setLeaf(true);
653                 // finally add the new custom component branch
654
branchNode.add(leafNode);
655                
656                 // Layout Panels menu -> Panel stack
657
branchObject = new PageContentBean();
658                 branchObject.setMenuDisplayText(
659                         "submenuDisplayText.panelStackComponentSubmenuItem");
660                 branchObject.setMenuContentTitle(
661                         "submenuContentTitle.panelStackComponentSubmenuItem");
662                 branchObject.setMenuContentInclusionFile("./layoutPanels/panelStack.jspx");
663                 branchObject.setTemplateName("panelStackContentPanel");
664                 branchObject.setNavigationSelection(navigationBean);
665                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
666                 branchObject.setWrapper(leafNode);
667                 branchObject.setLeaf(true);
668                 // finally add the new custom component branch
669
branchNode.add(leafNode);
670
671                 // Layout Panels menu -> Tab Set Panel
672
branchObject = new PageContentBean();
673                 branchObject.setMenuDisplayText(
674                         "submenuDisplayText.tabbedComponentSubmenuItem");
675                 branchObject.setMenuContentTitle(
676                         "submenuContentTitle.tabbedComponentSubmenuItem");
677                 branchObject.setMenuContentInclusionFile("./layoutPanels/panelTabSet.jspx");
678                 branchObject.setTemplateName("tabbedPaneContentPanel");
679                 branchObject.setNavigationSelection(navigationBean);
680                 leafNode = new DefaultMutableTreeNode JavaDoc(branchObject);
681                 branchObject.setWrapper(leafNode);
682                 branchObject.setLeaf(true);
683                 // finally add the new custom component branch
684
branchNode.add(leafNode);
685             }
686
687         }
688
689     }
690
691     /**
692      * Gets the default tree model. This model is needed for the value
693      * attribute of the tree component.
694      *
695      * @return default tree model used by the navigation tree
696      */

697     public DefaultTreeModel JavaDoc getModel() {
698         return model;
699     }
700
701     /**
702      * Sets the default tree model.
703      *
704      * @param model new default tree model
705      */

706     public void setModel(DefaultTreeModel JavaDoc model) {
707         this.model = model;
708     }
709
710     /**
711      * Gets the tree component binding.
712      *
713      * @return tree component binding
714      */

715     public Tree getTreeComponent() {
716         return treeComponent;
717     }
718
719     /**
720      * Sets the tree component binding.
721      *
722      * @param treeComponent tree component to bind to
723      */

724     public void setTreeComponent(Tree treeComponent) {
725         this.treeComponent = treeComponent;
726         if (!isInitiated) {
727             init();
728         }
729     }
730 }
Popular Tags