Source Code Cross Referenced for XTableModelHelper.java in  » XML-UI » XUI » net » xoetrope » builder » editor » helper » 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 » XML UI » XUI » net.xoetrope.builder.editor.helper 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.xoetrope.builder.editor.helper;
002:
003:        import net.xoetrope.xui.XProjectManager;
004:        import net.xoetrope.xui.data.XBaseModel;
005:        import net.xoetrope.xui.data.XModel;
006:
007:        /**
008:         * A utility class to help construct a HTML like table structure
009:         * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
010:         * @version $Revision: 1.4 $
011:         */
012:        public class XTableModelHelper {
013:            public XTableModelHelper() {
014:            }
015:
016:            /**
017:             * Creates a new dataset within the model with the specified name. The new
018:             * XModel is appended to the root and returned
019:             * @param name The name to be given to the new XModel
020:             * @return The newly created XModel
021:             */
022:            public static XModel createDataSet(String name) {
023:                return createDataSet(name, XProjectManager.getModel());
024:            }
025:
026:            public static XModel createDataSet(String name, XModel model) {
027:                XModel dset = (XModel) model.get(name);
028:                if (dset == null) {
029:                    dset = new XBaseModel();
030:                    dset.setId(name);
031:                    dset.setTagName("dataset");
032:                    model.append(dset);
033:                }
034:                return dset;
035:            }
036:
037:            public static XModel createDataItem(String name, String value,
038:                    XModel model) {
039:                XBaseModel child = new XBaseModel();
040:                child.setTagName("data");
041:                child.setId(name);
042:                child.setAttribValue(XBaseModel.VALUE_ATTRIBUTE, value);
043:                model.append(child);
044:                return child;
045:            }
046:
047:            /**
048:             * Checks that the base Datasets node exists within the model and if not
049:             * creates one. The newly created XModel is returned.
050:             * @return The newly created XModel
051:             */
052:            private static XModel getDatasetsNode() {
053:                XModel dsets = null;
054:                XModel root = XProjectManager.getModel();
055:                if (root.getNumChildren() == 0) {
056:                    dsets = (XModel) root.get("base");
057:                    root.setId("Datasets");
058:                    root.setTagName("Datasets");
059:                }
060:                return dsets;
061:            }
062:
063:            /**
064:             * Adds a new table XModel node to the model node
065:             * The XModel which will have the newly created table XModel
066:             * appended to it
067:             * @param model The XModel which will have the newly created model appended
068:             * to it
069:             * @param name The name of the new XModel
070:             * @return The newly created table XModel
071:             */
072:            public static XModel createTable(XModel model, String name) {
073:                XBaseModel base = (XBaseModel) XProjectManager.getModel();
074:
075:                XBaseModel table = new XBaseModel();
076:                table.setTagName("table");
077:                table.setId("items");
078:                model.append(table);
079:
080:                return table;
081:            }
082:
083:            /**
084:             * Creates a new 'th' node and returns it
085:             * @param model The model which will have the newly created XModel appended to
086:             * it
087:             * @return The newly created th node
088:             */
089:            public static XModel addHeader(XModel model) {
090:                XBaseModel heading = new XBaseModel();
091:                heading.setTagName("th");
092:                model.append(heading);
093:                return heading;
094:            }
095:
096:            /**
097:             * Add a new 'tr' node to the passed XModel
098:             * @param model The model which will have the newly created XModel appended to
099:             * it
100:             * @return The newly created th node
101:             */
102:            public static XModel addRow(XModel model) {
103:                XBaseModel row = new XBaseModel();
104:                row.setTagName("tr");
105:                model.append(row);
106:                return row;
107:            }
108:
109:            /**
110:             * Add data to the specified model.
111:             * @param model The node which we are adding the data to
112:             * @param name The name of the new data item
113:             * @param value The value of the new data item
114:             * @return The newly created data item
115:             */
116:            public static XModel addData(XModel model, String name, String value) {
117:                XBaseModel item = new XBaseModel();
118:                item.setTagName("td");
119:                item.setId(name);
120:                item.set(value);
121:                model.append(item);
122:                return item;
123:            }
124:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.