Source Code Cross Referenced for UserLayoutNodeDescription.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » layout » node » 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 » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal.layout.node 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright 2002 The JA-SIG Collaborative.  All rights reserved.
002:         *  See license distributed with this file and
003:         *  available online at http://www.uportal.org/license.html
004:         */
005:
006:        package org.jasig.portal.layout.node;
007:
008:        import org.jasig.portal.PortalException;
009:        import org.jasig.portal.layout.dlm.Constants;
010:        import org.w3c.dom.Document;
011:        import org.w3c.dom.Element;
012:
013:        /**
014:         * An class describing common features of user layout nodes,
015:         * that is channels and folders
016:         *
017:         * @author Peter Kharchenko  {@link <a href="mailto:pkharchenko@interactivebusiness.com"">pkharchenko@interactivebusiness.com"</a>}
018:         * @version 1.0
019:         */
020:        public abstract class UserLayoutNodeDescription implements 
021:                IUserLayoutNodeDescription {
022:            protected String id = null;
023:            protected String name = null;
024:            protected boolean immutable = false;
025:            protected boolean unremovable = false;
026:            protected boolean hidden = false;
027:            protected boolean deleteAllowed = true; // used in DLM
028:            protected boolean editAllowed = true; // used in DLM
029:            protected boolean moveAllowed = true; // used in DLM
030:            protected boolean addChildAllowed = true; // used in DLM
031:            protected double precedence = 0.0; // used in DLM
032:
033:            public UserLayoutNodeDescription() {
034:            };
035:
036:            public UserLayoutNodeDescription(IUserLayoutNodeDescription d) {
037:                this .id = d.getId();
038:                this .name = d.getName();
039:                this .immutable = d.isImmutable();
040:                this .unremovable = d.isUnremovable();
041:                this .hidden = d.isHidden();
042:            }
043:
044:            UserLayoutNodeDescription(Element xmlNode) throws PortalException {
045:                // standard Node attributes
046:                this .setId(xmlNode.getAttribute("ID"));
047:                this .setName(xmlNode.getAttribute("name"));
048:                this .setUnremovable((new Boolean(xmlNode
049:                        .getAttribute("unremovable"))).booleanValue());
050:                this .setImmutable((new Boolean(xmlNode
051:                        .getAttribute("immutable"))).booleanValue());
052:
053:                if (xmlNode.getAttribute(Constants.ATT_DELETE_ALLOWED).equals(
054:                        "false"))
055:                    this .setDeleteAllowed(false);
056:
057:                if (xmlNode.getAttribute(Constants.ATT_MOVE_ALLOWED).equals(
058:                        "false"))
059:                    this .setMoveAllowed(false);
060:
061:                if (xmlNode.getAttribute(Constants.ATT_EDIT_ALLOWED).equals(
062:                        "false"))
063:                    this .setEditAllowed(false);
064:
065:                if (xmlNode.getAttribute(Constants.ATT_ADD_CHILD_ALLOWED)
066:                        .equals("false"))
067:                    this .setAddChildAllowed(false);
068:
069:                String precedence = xmlNode
070:                        .getAttribute(Constants.ATT_PRECEDENCE);
071:
072:                if (!precedence.equals("")) {
073:                    try {
074:                        this .setPrecedence(Double.parseDouble(precedence));
075:                    } catch (NumberFormatException nfe) {
076:                        // if format is invalid leave it as default
077:                    }
078:                }
079:            }
080:
081:            /**
082:             * Returns the precedence value for this node. The precedence is 0.0 for
083:             * a user owned node and the value of the node's owning fragment's
084:             * precedence for a node incorporated from another fragment. Added by SCT
085:             * for DLM.
086:             */
087:            public double getPrecedence() {
088:                return this .precedence;
089:            }
090:
091:            /**
092:             * Set the precedence of a node. See getPrecedence for more information.
093:             * Added by SCT for DLM.
094:             */
095:            public void setPrecedence(double setting) {
096:                this .precedence = setting;
097:            }
098:
099:            /**
100:             * Returns true if the node can be moved. Added by SCT for DLM.
101:             */
102:            public boolean isMoveAllowed() {
103:                return this .moveAllowed;
104:            }
105:
106:            /**
107:             * Set whether a node can be moved or not. Added by SCT for DLM.
108:             */
109:            public void setMoveAllowed(boolean setting) {
110:                this .moveAllowed = setting;
111:            }
112:
113:            /**
114:             * Returns true if the node can be deleted. Added by SCT for DLM.
115:             */
116:            public boolean isDeleteAllowed() {
117:                return this .deleteAllowed;
118:            }
119:
120:            /**
121:             * Set whether a node can be deleted or not. Added by SCT for DLM.
122:             */
123:            public void setDeleteAllowed(boolean setting) {
124:                this .deleteAllowed = setting;
125:            }
126:
127:            /**
128:             * Returns true if the node can be edited. Added by SCT for DLM.
129:             */
130:            public boolean isEditAllowed() {
131:                return this .editAllowed;
132:            }
133:
134:            /**
135:             * Set whether a node can be edited or not. Added by SCT for DLM.
136:             */
137:            public void setEditAllowed(boolean setting) {
138:                this .editAllowed = setting;
139:            }
140:
141:            /**
142:             * Returns true if a child node may be added to the node. Added by SCT for DLM.
143:             */
144:            public boolean isAddChildAllowed() {
145:                return this .addChildAllowed;
146:            }
147:
148:            /**
149:             * Set whether or not child nodes can be added to this node.
150:             * Added by SCT for DLM.
151:             */
152:            public void setAddChildAllowed(boolean setting) {
153:                this .addChildAllowed = setting;
154:            }
155:
156:            /**
157:             * Returns a node Id.
158:             * The Id has to be unique in the entire user layout document.
159:             *
160:             * @return a <code>String</code> value
161:             */
162:            public String getId() {
163:                return this .id;
164:            }
165:
166:            /**
167:             * Set a new node Id.
168:             * The Id has to be unique in the entire user layout document.
169:             *
170:             */
171:            public void setId(String id) {
172:                this .id = id;
173:            }
174:
175:            /**
176:             * Determine a name associated with this node.
177:             *
178:             * @return a folder/channel name.
179:             */
180:            public String getName() {
181:                return this .name;
182:            }
183:
184:            public void setName(String name) {
185:                this .name = name;
186:            }
187:
188:            public boolean isUnremovable() {
189:                return this .unremovable;
190:            }
191:
192:            public void setUnremovable(boolean setting) {
193:                this .unremovable = setting;
194:            }
195:
196:            public boolean isImmutable() {
197:                return this .immutable;
198:            }
199:
200:            public void setImmutable(boolean setting) {
201:                this .immutable = setting;
202:            }
203:
204:            public boolean isHidden() {
205:                return this .hidden;
206:            }
207:
208:            public void setHidden(boolean setting) {
209:                this .hidden = setting;
210:            }
211:
212:            /**
213:             * Returns a type of the node, could be FOLDER or CHANNEL integer constant.
214:             *
215:             * @return a type
216:             */
217:            public abstract int getType();
218:
219:            /**
220:             * Creates a <code>org.w3c.dom.Element</code> representation of the current node.
221:             *
222:             * @param root a <code>Document</code> for which the <code>Element</code> should be created.
223:             * @return a <code>Element</code> value
224:             */
225:            public abstract Element getXML(Document root);
226:
227:            /**
228:             * Add all of common node attributes to the <code>Element</code>.
229:             *
230:             * @param node an <code>Element</code> value
231:             */
232:            public void addNodeAttributes(Element node) {
233:                node.setAttribute("ID", this .getId());
234:                node.setAttribute("name", this .getName());
235:                node.setAttribute("unremovable", (new Boolean(this 
236:                        .isUnremovable())).toString());
237:                node.setAttribute("immutable",
238:                        (new Boolean(this .isImmutable())).toString());
239:                node.setAttribute("hidden", (new Boolean(this .isHidden()))
240:                        .toString());
241:
242:                if (!this .isDeleteAllowed())
243:                    node.setAttributeNS(Constants.NS_URI,
244:                            Constants.ATT_DELETE_ALLOWED, "false");
245:                if (!this .isMoveAllowed())
246:                    node.setAttributeNS(Constants.NS_URI,
247:                            Constants.ATT_MOVE_ALLOWED, "false");
248:                if (!this .isEditAllowed())
249:                    node.setAttributeNS(Constants.NS_URI,
250:                            Constants.ATT_EDIT_ALLOWED, "false");
251:                if (!this .isAddChildAllowed())
252:                    node.setAttributeNS(Constants.NS_URI,
253:                            Constants.ATT_ADD_CHILD_ALLOWED, "false");
254:                if (this .getPrecedence() != 0.0)
255:                    node.setAttributeNS(Constants.NS_URI,
256:                            Constants.ATT_PRECEDENCE, Double.toString(this 
257:                                    .getPrecedence()));
258:            }
259:
260:            /**
261:             * A factory method to create a <code>UserLayoutNodeDescription</code> instance,
262:             * based on the information provided in the user layout <code>Element</code>.
263:             *
264:             * @param xmlNode a user layout DTD folder/channel <code>Element</code> value
265:             * @return an <code>UserLayoutNodeDescription</code> value
266:             * @exception PortalException if the xml passed is somehow invalid.
267:             */
268:            public static UserLayoutNodeDescription createUserLayoutNodeDescription(
269:                    Element xmlNode) throws PortalException {
270:                // is this a folder or a channel ?
271:                String nodeName = xmlNode.getNodeName();
272:                if (nodeName.equals("channel")) {
273:                    return new UserLayoutChannelDescription(xmlNode);
274:                } else if (nodeName.equals("folder")) {
275:                    return new UserLayoutFolderDescription(xmlNode);
276:                } else {
277:                    throw new PortalException("Given XML element '" + nodeName
278:                            + "' is neither folder nor channel");
279:                }
280:            }
281:
282:            public String toString() {
283:                return "[" + id + "," + name + "]";
284:            }
285:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.