Source Code Cross Referenced for TreeController.java in  » J2EE » Sofia » com » salmonllc » examples » example5 » 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 » J2EE » Sofia » com.salmonllc.examples.example5 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.salmonllc.examples.example5;
002:
003:        //The Salmon Open Framework for Internet Applications (SOFIA)
004:        //Copyright (C) 1999 - 2002, Salmon LLC
005:        //
006:        //This program is free software; you can redistribute it and/or
007:        //modify it under the terms of the GNU General Public License version 2
008:        //as published by the Free Software Foundation; 
009:        //
010:        //This program is distributed in the hope that it will be useful,
011:        //but WITHOUT ANY WARRANTY; without even the implied warranty of
012:        //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013:        //GNU General Public License for more details.
014:        //
015:        //You should have received a copy of the GNU General Public License
016:        //along with this program; if not, write to the Free Software
017:        //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
018:        //
019:        //For more information please visit http://www.salmonllc.com
020:
021:        import com.salmonllc.html.HtmlText;
022:        import com.salmonllc.html.events.PageEvent;
023:        import com.salmonllc.html.events.PageListener;
024:        import com.salmonllc.html.treeControl.TreeBuffer;
025:        import com.salmonllc.jsp.JspController;
026:        import com.salmonllc.properties.Props;
027:        import com.salmonllc.util.MessageLog;
028:
029:        public class TreeController extends JspController implements 
030:                PageListener {
031:
032:            public com.salmonllc.html.HtmlText _returnToHomePageText;
033:            public com.salmonllc.html.HtmlText _sourceList;
034:            public com.salmonllc.html.HtmlTreeControl _tree1;
035:            public com.salmonllc.html.HtmlCheckBox _showGridLines;
036:            public com.salmonllc.html.HtmlCheckBox _showPrice;
037:            private ProductCategoryModel _mod;
038:            private boolean _priceShowing = false;
039:
040:            public static final String ALIGN_RIGHT = "RIGHT";
041:            public static final String ALIGN_LEFT = "LEFT";
042:
043:            public void initialize() throws Exception {
044:                addPageListener(this );
045:
046:                //Populate the tree and get the internal buffer		
047:                _mod = new ProductCategoryModel(getApplicationName());
048:                _mod.populateTree(_tree1);
049:
050:            }
051:
052:            public void pageRequested(PageEvent p) throws Exception {
053:
054:            }
055:
056:            public void pageRequestEnd(PageEvent p) throws Exception {
057:            }
058:
059:            public void pageSubmitEnd(PageEvent p) {
060:                //check the value of the check box. 
061:                //Depending on what it is change the theme for the tree to show or hide the border.
062:                String value = _showGridLines.getValue();
063:                String theme = _tree1.getTheme();
064:                if (theme != null && value.equals("0"))
065:                    _tree1.setTheme(null);
066:                else if (theme == null && value.equals("1"))
067:                    _tree1.setTheme("BorderBox");
068:
069:                value = _showPrice.getValue();
070:
071:                if (value.equals("0"))
072:                    removeTreeComponents();
073:                else {
074:                    try {
075:                        addTreeComponents();
076:                    } catch (Exception ex) {
077:                        MessageLog.writeErrorMessage(
078:                                "Error adding tree components", ex, this );
079:                    }
080:                }
081:            }
082:
083:            public void pageSubmitted(PageEvent p) {
084:
085:            }
086:
087:            /**
088:             * Remove the headers and extra columns from the tree
089:             */
090:            private void removeTreeComponents() {
091:                if (!_priceShowing)
092:                    return;
093:                _priceShowing = false;
094:                TreeBuffer tb = _tree1.getTreeBuffer();
095:                tb.resetHeaders();
096:                tb.resetNodeComponents();
097:            }
098:
099:            /**
100:             * Add headers and extra columns to the tree
101:             * @throws Exception
102:             */
103:            private void addTreeComponents() throws Exception {
104:                if (_priceShowing)
105:                    return;
106:
107:                _priceShowing = true;
108:                TreeBuffer tb = _tree1.getTreeBuffer();
109:
110:                //add some headings to the tree
111:                tb.addHeaderComponent(new HtmlText("Product Category/Name",
112:                        HtmlText.FONT_TABLE_HEADING, this ), ALIGN_LEFT, "50%");
113:                tb.addHeaderComponent(new HtmlText("Price",
114:                        HtmlText.FONT_TABLE_HEADING, this ), ALIGN_RIGHT, "10%");
115:                tb.addHeaderComponent(new HtmlText("Quantity",
116:                        HtmlText.FONT_TABLE_HEADING, this ), ALIGN_RIGHT, "10%");
117:
118:                //add some components for the price and quantity
119:                HtmlText t = new HtmlText("", Props.TREE_NODE_FONT, this );
120:                t.setExpression(_mod,
121:                        ProductCategoryModel.PRODUCT_CATEGORY_PRICE,
122:                        "$###,###.99");
123:                tb.addNodeComponent(t);
124:
125:                t = new HtmlText("", Props.TREE_NODE_FONT, this);
126:                t.setExpression(_mod,
127:                        ProductCategoryModel.PRODUCT_CATEGORY_QUANTITY);
128:                tb.addNodeComponent(t);
129:
130:            }
131:
132:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.