Source Code Cross Referenced for FxSelectListItem.java in  » J2EE » fleXive » com » flexive » shared » structure » 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.structure 
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.structure;
034:
035:        import com.flexive.shared.ObjectWithColor;
036:        import com.flexive.shared.SelectableObjectWithLabel;
037:        import com.flexive.shared.security.ACL;
038:        import com.flexive.shared.security.LifeCycleInfo;
039:        import com.flexive.shared.value.FxString;
040:
041:        import java.io.Serializable;
042:
043:        /**
044:         * Items for select lists
045:         *
046:         * @author Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
047:         */
048:        public class FxSelectListItem implements  Serializable,
049:                SelectableObjectWithLabel, ObjectWithColor {
050:            private static final long serialVersionUID = -235396490388474264L;
051:
052:            protected long id;
053:            protected ACL acl;
054:            protected FxSelectList list;
055:            protected FxSelectListItem parentItem;
056:            protected long parentItemId;
057:            protected FxString label;
058:            protected String data;
059:            protected String color;
060:            protected long iconId;
061:            protected int iconVer;
062:            protected int iconQuality;
063:            protected LifeCycleInfo lifeCycleInfo;
064:
065:            public static final FxSelectListItem EMPTY = new FxSelectListItem(
066:                    -1, null, null, -1, new FxString("-"), "", "", -11, 1, 1,
067:                    null);
068:
069:            /**
070:             * Internal(!) Constructor to be used while loading from storage
071:             *
072:             * @param id            id
073:             * @param acl           the items acl
074:             * @param list          the list this item belongs to
075:             * @param parentItemId  parent item id if >= 0
076:             * @param label         this items label
077:             * @param data          optional data
078:             * @param color         color for display
079:             * @param iconId        id of icon (binary reference)
080:             * @param iconVer       version of icon (binary reference)
081:             * @param iconQuality   quality of icon (binary reference)
082:             * @param lifeCycleInfo life cycle
083:             */
084:            public FxSelectListItem(long id, ACL acl, FxSelectList list,
085:                    long parentItemId, FxString label, String data,
086:                    String color, long iconId, int iconVer, int iconQuality,
087:                    LifeCycleInfo lifeCycleInfo) {
088:                this .id = id;
089:                this .acl = acl;
090:                this .list = list;
091:                this .parentItemId = parentItemId;
092:                this .parentItem = null;
093:                this .label = label;
094:                this .data = data;
095:                if (this .data == null)
096:                    this .data = "";
097:                this .color = color;
098:                this .iconId = iconId;
099:                this .iconVer = iconVer;
100:                this .iconQuality = iconQuality;
101:                this .lifeCycleInfo = lifeCycleInfo;
102:                if (list != null)
103:                    list.getItemMap().put(this .id, this );
104:            }
105:
106:            /**
107:             * Creates a new in-memory select list item. Not suitable for select lists that should
108:             * be stored in the database.
109:             *
110:             * @param id    the new select list item ID, possible some external ID
111:             * @param list  the select list this item should be added to
112:             * @param parentItemId  the parent item ID, if any
113:             * @param label the select item label
114:             */
115:            public FxSelectListItem(long id, FxSelectList list,
116:                    long parentItemId, FxString label) {
117:                this (id, null, list, parentItemId, label, null, null, -1, -1,
118:                        -1, null);
119:            }
120:
121:            /**
122:             * Internal method to synchronize/load parent items
123:             *
124:             * @param env environment
125:             */
126:            protected void _synchronize(FxEnvironment env) {
127:                try {
128:                    if (this .parentItemId >= 0)
129:                        this .parentItem = env
130:                                .getSelectListItem(this .parentItemId);
131:                } catch (Exception e) {
132:                    this .parentItemId = -1;
133:                }
134:            }
135:
136:            /**
137:             * Update this items list (internally used when creating new lists to have a valid id)
138:             *
139:             * @param list new list with a valid id
140:             */
141:            protected void _updateList(FxSelectList list) {
142:                this .list = list;
143:            }
144:
145:            /**
146:             * Get the internal id
147:             *
148:             * @return internal id
149:             */
150:            public long getId() {
151:                return id;
152:            }
153:
154:            /**
155:             * Get the ACL for this item.
156:             * This ACL is treated in a special way:
157:             * The only relevant permissions are create and delete for adding and removing entries, all items are readable
158:             * and editable (to allow saving set items) by default
159:             *
160:             * @return ACL for this item
161:             */
162:            public ACL getAcl() {
163:                return acl;
164:            }
165:
166:            /**
167:             * Is this item used as the "empty" item?
168:             *
169:             * @return if this is the "empty" item
170:             */
171:            public boolean isEmpty() {
172:                return list == null;
173:            }
174:
175:            /**
176:             * Get the list this item belongs to
177:             *
178:             * @return list this item belongs to
179:             */
180:            public FxSelectList getList() {
181:                return list;
182:            }
183:
184:            /**
185:             * Does a parent item exist for this item?
186:             *
187:             * @return parent item exists
188:             */
189:            public boolean hasParentItem() {
190:                return parentItemId >= 0;
191:            }
192:
193:            /**
194:             * Get the parent item of this item (check existance with hasParentItem() first!)
195:             *
196:             * @return parent item of this item
197:             */
198:            public FxSelectListItem getParentItem() {
199:                return parentItem;
200:            }
201:
202:            /**
203:             * Get label
204:             *
205:             * @return label
206:             */
207:            public FxString getLabel() {
208:                return label;
209:            }
210:
211:            /**
212:             * Get optional data assigned to this item
213:             *
214:             * @return optional data assigned to this item
215:             */
216:            public String getData() {
217:                return data;
218:            }
219:
220:            /**
221:             * Get the color to display for this item
222:             *
223:             * @return color to display for this item
224:             */
225:            public String getColor() {
226:                return color;
227:            }
228:
229:            /**
230:             * Id of icon used for user interfaces (reference to binaries, internal field!)
231:             *
232:             * @return id of icon used for user interfaces (reference to binaries, internal field!)
233:             */
234:            public long getIconId() {
235:                return iconId;
236:            }
237:
238:            /**
239:             * Version of icon used for user interfaces (reference to binaries, internal field!)
240:             *
241:             * @return version of icon used for user interfaces (reference to binaries, internal field!)
242:             */
243:            public int getIconVer() {
244:                return iconVer;
245:            }
246:
247:            /**
248:             * Quality of icon used for user interfaces (reference to binaries, internal field!)
249:             *
250:             * @return quality of icon used for user interfaces (reference to binaries, internal field!)
251:             */
252:            public int getIconQuality() {
253:                return iconQuality;
254:            }
255:
256:            /**
257:             * Get this items lifecycle info
258:             *
259:             * @return lifecycle info
260:             */
261:            public LifeCycleInfo getLifeCycleInfo() {
262:                return lifeCycleInfo;
263:            }
264:
265:            /**
266:             * Get this FxSelectListItem as editable
267:             *
268:             * @return FxSelectListItemEdit
269:             */
270:            public FxSelectListItemEdit asEditable() {
271:                return new FxSelectListItemEdit(this );
272:            }
273:
274:            /**
275:             * {@inheritDoc}
276:             */
277:            @Override
278:            public String toString() {
279:                if (getData() != null)
280:                    return getData();
281:                else
282:                    return super.toString();
283:            }
284:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.