Source Code Cross Referenced for FxGroupEdit.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.exceptions.FxInvalidParameterException;
036:        import com.flexive.shared.value.FxString;
037:        import org.apache.commons.lang.StringUtils;
038:
039:        import java.util.List;
040:
041:        /**
042:         * FxGroup used for structure editing
043:         *
044:         * @author Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
045:         */
046:        public class FxGroupEdit extends FxGroup {
047:
048:            private static final long serialVersionUID = -889437501601209068L;
049:            private boolean isNew;
050:            private GroupMode mode = GroupMode.AnyOf;
051:            private int defaultMultiplicity = 1;
052:
053:            /**
054:             * Make an editable instance of an existing group
055:             *
056:             * @param group existing group
057:             */
058:            public FxGroupEdit(FxGroup group) {
059:                super (group.getId(), group.getName(), group.getLabel().copy(),
060:                        group.getHint().copy(), group
061:                                .mayOverrideBaseMultiplicity(),
062:                        new FxMultiplicity(group.getMultiplicity()),
063:                        FxStructureOption.cloneOptions(group.options));
064:                this .isNew = false;
065:            }
066:
067:            /**
068:             * Create a clone of an existing group with a new name
069:             *
070:             * @param base    group to clone
071:             * @param newName new name to assign
072:             * @return FxGroupEdit
073:             */
074:            public static FxGroupEdit createNew(FxGroup base, String newName) {
075:                FxGroupEdit ret = new FxGroupEdit(base).setName(newName);
076:                ret.isNew = true;
077:                return ret;
078:            }
079:
080:            /**
081:             * Constructor
082:             *
083:             * @param name                     group name
084:             * @param description              description
085:             * @param hint                     hint message
086:             * @param overrideBaseMultiplicity allow base multiplicity override?
087:             * @param multiplicity             multiplicity
088:             */
089:            private FxGroupEdit(String name, FxString description,
090:                    FxString hint, boolean overrideBaseMultiplicity,
091:                    FxMultiplicity multiplicity) {
092:                super (-1, name, description, hint, overrideBaseMultiplicity,
093:                        multiplicity, FxStructureOption.getEmptyOptionList(2));
094:                setName(name);
095:                isNew = true;
096:            }
097:
098:            /**
099:             * Create a new FxGroupEdit instance
100:             *
101:             * @param name                     group name
102:             * @param description              description
103:             * @param hint                     hint message
104:             * @param overrideBaseMultiplicity allow base multiplicity override?
105:             * @param multiplicity             multiplicity
106:             * @return FxGroupEdit
107:             */
108:            public static FxGroupEdit createNew(String name,
109:                    FxString description, FxString hint,
110:                    boolean overrideBaseMultiplicity,
111:                    FxMultiplicity multiplicity) {
112:                return new FxGroupEdit(name, description, hint,
113:                        overrideBaseMultiplicity, multiplicity).setName(name);
114:            }
115:
116:            /**
117:             * Is this a new group
118:             *
119:             * @return if this is a new group
120:             */
121:            public boolean isNew() {
122:                return isNew;
123:            }
124:
125:            /**
126:             * Set the name for the group
127:             *
128:             * @param name group name
129:             * @return this
130:             * @throws com.flexive.shared.exceptions.FxRuntimeException
131:             *          on errors
132:             */
133:            public FxGroupEdit setName(String name) {
134:                if (StringUtils.isEmpty(name))
135:                    throw new FxInvalidParameterException("NAME",
136:                            "ex.general.parameter.empty", "name")
137:                            .asRuntimeException();
138:                name = name.trim().toUpperCase();
139:                this .name = name;
140:                return this ;
141:            }
142:
143:            /**
144:             * Set the group mode. Only possible for new groups to reflect it to the new assignment
145:             *
146:             * @param mode group mode
147:             * @return this
148:             * @throws FxInvalidParameterException if group is not new
149:             */
150:            public FxGroupEdit setAssignmentGroupMode(GroupMode mode)
151:                    throws FxInvalidParameterException {
152:                if (!isNew())
153:                    throw new FxInvalidParameterException("mode",
154:                            "ex.structure.group.notAllowed.mode");
155:                this .mode = mode;
156:                return this ;
157:            }
158:
159:            /**
160:             * Get the group mode if this GroupEdit is for a new group and assignment is to be created
161:             *
162:             * @return group mode
163:             */
164:            public GroupMode getAssignmentGroupMode() {
165:                return mode;
166:            }
167:
168:            /**
169:             * Set the label
170:             *
171:             * @param label the label
172:             * @return this
173:             */
174:            public FxGroupEdit setLabel(FxString label) {
175:                this .label = label;
176:                return this ;
177:            }
178:
179:            /**
180:             * Set the hint message
181:             *
182:             * @param hint hint message
183:             * @return this
184:             */
185:            public FxGroupEdit setHint(FxString hint) {
186:                this .hint = hint;
187:                return this ;
188:            }
189:
190:            /**
191:             * Set the multiplicity
192:             *
193:             * @param multiplicity multiplicity
194:             * @return this
195:             */
196:            public FxGroupEdit setMultiplicity(FxMultiplicity multiplicity) {
197:                this .multiplicity = multiplicity;
198:                return this ;
199:            }
200:
201:            /**
202:             * May the base multiplicity be overridden?
203:             *
204:             * @param overrideMultiplicity may the base multiplicity be overridden?
205:             * @return this
206:             */
207:            public FxGroupEdit setOverrideMultiplicity(
208:                    boolean overrideMultiplicity) {
209:                this .overrideMultiplicity = overrideMultiplicity;
210:                return this ;
211:            }
212:
213:            /**
214:             * Set an option
215:             *
216:             * @param key          option key
217:             * @param overrideable is the option overrideable from assignments?
218:             * @param value        value of the option
219:             * @return the group itself, useful for chained calls
220:             */
221:            public FxGroupEdit setOption(String key, boolean overrideable,
222:                    String value) {
223:                FxStructureOption.setOption(options, key, overrideable, value);
224:                return this ;
225:            }
226:
227:            /**
228:             * Set a boolean option
229:             *
230:             * @param key          option key
231:             * @param overrideable is the option overrideable from assignments?
232:             * @param value        value of the option
233:             * @return the group itself, useful for chained calls
234:             */
235:            public FxGroupEdit setOption(String key, boolean overrideable,
236:                    boolean value) {
237:                FxStructureOption.setOption(options, key, overrideable, value);
238:                return this ;
239:            }
240:
241:            /**
242:             * Get a (unmodifiable) list of all options set for this group
243:             *
244:             * @return (unmodifiable) list of all options set for this group
245:             */
246:            public List<FxStructureOption> getOptions() {
247:                return FxStructureOption.getUnmodifieableOptions(options);
248:            }
249:
250:            /**
251:             * Clear an option entry
252:             *
253:             * @param key option name
254:             */
255:            public void clearOption(String key) {
256:                FxStructureOption.clearOption(options, key);
257:            }
258:
259:            /**
260:             * <b>This value set will only be used when creating a new property and will be set for the created assignment!</b>
261:             * Set the default multiplicity (used i.e. in user interfaces editors and determines the amount of values that will
262:             * be initialized when creating an empty element).
263:             * <p/>
264:             * If the set value is &lt; min or &gt; max multiplicity of this assignment it will
265:             * be auto adjusted to the next valid value without throwing an exception
266:             *
267:             * @param defaultMultiplicity the default multiplicity
268:             * @return this
269:             */
270:            public FxGroupEdit setAssignmentDefaultMultiplicity(
271:                    int defaultMultiplicity) {
272:                this .defaultMultiplicity = defaultMultiplicity;
273:                return this ;
274:            }
275:
276:            /**
277:             * Get the created assignments default multiplicity
278:             *
279:             * @return default multiplicity
280:             */
281:            public int getAssignmentDefaultMultiplicity() {
282:                return defaultMultiplicity;
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.