Source Code Cross Referenced for FxTreeNodeEdit.java in  » J2EE » fleXive » com » flexive » shared » tree » 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 » fleXive » com.flexive.shared.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***************************************************************
002:         *  This file is part of the [fleXive](R) project.
003:         *
004:         *  Copyright (c) 1999-2008
005:         *  UCS - unique computing solutions gmbh (http://www.ucs.at)
006:         *  All rights reserved
007:         *
008:         *  The [fleXive](R) project is free software; you can redistribute
009:         *  it and/or modify it under the terms of the GNU General Public
010:         *  License as published by the Free Software Foundation;
011:         *  either version 2 of the License, or (at your option) any
012:         *  later version.
013:         *
014:         *  The GNU General Public License can be found at
015:         *  http://www.gnu.org/copyleft/gpl.html.
016:         *  A copy is found in the textfile GPL.txt and important notices to the
017:         *  license from the author are found in LICENSE.txt distributed with
018:         *  these libraries.
019:         *
020:         *  This library is distributed in the hope that it will be useful,
021:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
022:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
023:         *  GNU General Public License for more details.
024:         *
025:         *  For further information about UCS - unique computing solutions gmbh,
026:         *  please see the company website: http://www.ucs.at
027:         *
028:         *  For further information about [fleXive](R), please see the
029:         *  project website: http://www.flexive.org
030:         *
031:         *
032:         *  This copyright notice MUST APPEAR in all copies of the file!
033:         ***************************************************************/package com.flexive.shared.tree;
034:
035:        import com.flexive.shared.content.FxPK;
036:        import com.flexive.shared.security.ACL;
037:        import com.flexive.shared.value.FxString;
038:
039:        import java.io.Serializable;
040:        import java.util.ArrayList;
041:        import java.util.List;
042:
043:        /**
044:         * Editable tree node.
045:         * Make a tree node editable by invoking its <code>#asEditable()</Code> method
046:         *
047:         * @author Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
048:         * @see FxTreeNode#asEditable()
049:         */
050:        public class FxTreeNodeEdit extends FxTreeNode implements  Serializable {
051:            private static final long serialVersionUID = -2399817258615361847L;
052:
053:            private boolean isNew;
054:            private FxTreeMode originalMode;
055:            private String newName;
056:            private boolean activateWithChildren = false;
057:
058:            /**
059:             * Ctor
060:             *
061:             * @param node the tree node to make editable
062:             */
063:            public FxTreeNodeEdit(FxTreeNode node) {
064:                super (node.getMode(), node.getId(), node.getParentNodeId(),
065:                        node.getReference(), node.getACLId(), node.getName(),
066:                        node.getPath(), node.getLabel(), node.getPosition(),
067:                        node.getChildren(), node.getChildIds(),
068:                        node.getDepth(), node.getTotalChildCount(), node
069:                                .getDirectChildCount(), node.isLeaf(), node
070:                                .isDirty(), node.getModifiedAt(), node
071:                                .getTemplate(), true, true, true, true, true);
072:                this .isNew = false;
073:                this .newName = node.getName();
074:                this .originalMode = node.getMode();
075:                this .parentNodeId = node.getParentNodeId();
076:            }
077:
078:            /**
079:             * Create a new editable node that will be the child of the passed node.
080:             * Some assumptions are made: the ACL of the new node is the one of the parent node and the calling user has full access to the referenced content
081:             *
082:             * @param parentNode parent node
083:             * @return editable node
084:             */
085:            public static FxTreeNodeEdit createNewChildNode(
086:                    FxTreeNode parentNode) {
087:                FxTreeNodeEdit edit = new FxTreeNode(parentNode.getMode(),
088:                        (System.currentTimeMillis() * -1), parentNode.getId(),
089:                        FxPK.createNewPK(), parentNode.getACLId(), "", "",
090:                        new FxString(parentNode.getLabel().isMultiLanguage(),
091:                                ""), Integer.MAX_VALUE,
092:                        new ArrayList<FxTreeNode>(0), new ArrayList<Long>(0),
093:                        0, 0, 0, true, true, System.currentTimeMillis(), "",
094:                        true, true, true, true, true).asEditable();
095:                edit.isNew = true;
096:                return edit;
097:            }
098:
099:            /**
100:             * Create a new node with the given name
101:             *
102:             * @param name name of the node
103:             * @return editable tree node
104:             */
105:            public static FxTreeNodeEdit createNew(String name) {
106:                FxTreeNodeEdit edit = new FxTreeNode(FxTreeMode.Edit, (System
107:                        .currentTimeMillis() * -1), ROOT_NODE, FxPK
108:                        .createNewPK(), ACL.Category.INSTANCE.getDefaultId(),
109:                        name, "", new FxString(false, name), Integer.MAX_VALUE,
110:                        new ArrayList<FxTreeNode>(0), new ArrayList<Long>(0),
111:                        0, 0, 0, true, true, System.currentTimeMillis(), "",
112:                        true, true, true, true, true).asEditable();
113:                edit.isNew = true;
114:                return edit;
115:            }
116:
117:            /**
118:             * Is this editable tree node for a new or an already existing node?
119:             *
120:             * @return if this editable tree node is for a new or an already existing node
121:             */
122:            public boolean isNew() {
123:                return isNew;
124:            }
125:
126:            /**
127:             * Set the referenced content
128:             *
129:             * @param reference referenced content
130:             * @return this
131:             */
132:            public FxTreeNodeEdit setReference(FxPK reference) {
133:                this .reference = reference;
134:                return this ;
135:            }
136:
137:            /**
138:             * Clear the reference, setting it to <code>null</code>
139:             *
140:             * @return this
141:             */
142:            public FxTreeNodeEdit clearReference() {
143:                this .reference = null;
144:                return this ;
145:            }
146:
147:            /**
148:             * If the mode was altered, this method will return the original mode
149:             *
150:             * @return original mode
151:             */
152:            public FxTreeMode getOriginalMode() {
153:                return originalMode;
154:            }
155:
156:            /**
157:             * Prepare this node for activation
158:             *
159:             * @param includeChildren activate all children as well?
160:             * @return this
161:             */
162:            public FxTreeNodeEdit activate(boolean includeChildren) {
163:                this .activate = true;
164:                this .activateWithChildren = includeChildren;
165:                return this ;
166:            }
167:
168:            /**
169:             * Activate with children?
170:             *
171:             * @return activate with children?
172:             */
173:            public boolean isActivateWithChildren() {
174:                return activateWithChildren;
175:            }
176:
177:            /**
178:             * Assign a list of children
179:             *
180:             * @param children list of children
181:             * @return this
182:             */
183:            public FxTreeNodeEdit setChildren(List<FxTreeNode> children) {
184:                this .children = children;
185:                return this ;
186:            }
187:
188:            /**
189:             * Set the label
190:             *
191:             * @param label label
192:             * @return this
193:             */
194:            public synchronized FxTreeNodeEdit setLabel(FxString label) {
195:                this .label = label;
196:                return this ;
197:            }
198:
199:            /**
200:             * Set the name
201:             *
202:             * @param name name
203:             * @return this
204:             */
205:            public FxTreeNodeEdit setName(String name) {
206:                this .newName = name;
207:                return this ;
208:            }
209:
210:            /**
211:             * Set the id of the parent node
212:             *
213:             * @param parentNodeId id of the parent node
214:             * @return this
215:             */
216:            public FxTreeNodeEdit setParentNodeId(long parentNodeId) {
217:                this .parentNodeId = parentNodeId;
218:                return this ;
219:            }
220:
221:            /**
222:             * {@inheritDoc}
223:             */
224:            @Override
225:            public String getName() {
226:                return newName;
227:            }
228:
229:            /**
230:             * Set the tree mode
231:             *
232:             * @param mode tree mode
233:             * @return this
234:             */
235:            public FxTreeNodeEdit setMode(FxTreeMode mode) {
236:                this .mode = mode;
237:                return this ;
238:            }
239:
240:            /**
241:             * Set this nodes position
242:             *
243:             * @param position new position
244:             * @return this
245:             */
246:            public FxTreeNodeEdit setPosition(int position) {
247:                this .position = position;
248:                return this ;
249:            }
250:
251:            /**
252:             * {@inheritDoc}
253:             */
254:            @Override
255:            public String getTemplate() {
256:                if (this .template == null)
257:                    return super .getTemplate();
258:                return template;
259:            }
260:
261:            /**
262:             * Set the template
263:             *
264:             * @param template template
265:             */
266:            public void setTemplate(String template) {
267:                this.template = template;
268:            }
269:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.