Source Code Cross Referenced for GroupImpl.java in  » Development » ivatamasks » com » ivata » mask » group » 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 » Development » ivatamasks » com.ivata.mask.group 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2001 - 2005 ivata limited.
003:         * All rights reserved.
004:         * -----------------------------------------------------------------------------
005:         * ivata masks may be redistributed under the GNU General Public
006:         * License as published by the Free Software Foundation;
007:         * version 2 of the License.
008:         *
009:         * These programs are free software; you can redistribute them and/or
010:         * modify them under the terms of the GNU General Public License
011:         * as published by the Free Software Foundation; version 2 of the License.
012:         *
013:         * These programs are distributed in the hope that they will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016:         *
017:         * See the GNU General Public License in the file LICENSE.txt for more
018:         * details.
019:         *
020:         * If you would like a copy of the GNU General Public License write to
021:         *
022:         * Free Software Foundation, Inc.
023:         * 59 Temple Place - Suite 330
024:         * Boston, MA 02111-1307, USA.
025:         *
026:         *
027:         * To arrange commercial support and licensing, contact ivata at
028:         *                  http://www.ivata.com/contact.jsp
029:         * -----------------------------------------------------------------------------
030:         * $Log: GroupImpl.java,v $
031:         * Revision 1.11  2005/10/11 18:55:29  colinmacleod
032:         * Fixed some checkstyle and javadoc issues.
033:         *
034:         * Revision 1.10  2005/10/03 10:17:24  colinmacleod
035:         * Fixed some style and javadoc issues.
036:         *
037:         * Revision 1.9  2005/10/02 14:06:32  colinmacleod
038:         * Added/improved log4j logging.
039:         *
040:         * Revision 1.8  2005/09/14 12:51:52  colinmacleod
041:         * Added serialVersionUID.
042:         *
043:         * Revision 1.7  2005/04/11 12:27:02  colinmacleod
044:         * Added preliminary support for filters.
045:         * Added FieldValueConvertor factor interface
046:         * to split off value convertors for reuse.
047:         *
048:         * Revision 1.6  2005/04/09 18:04:15  colinmacleod
049:         * Changed copyright text to GPL v2 explicitly.
050:         *
051:         * Revision 1.5  2005/03/10 10:20:53  colinmacleod
052:         * Now implements Serializable.
053:         *
054:         * Revision 1.4  2005/01/19 12:38:05  colinmacleod
055:         * Changed Id --> Name.
056:         *
057:         * Revision 1.3  2005/01/06 22:13:22  colinmacleod
058:         * Moved up a version number.
059:         * Changed copyright notices to 2005.
060:         * Updated the documentation:
061:         *   - started working on multiproject:site docu.
062:         *   - changed the logo.
063:         * Added checkstyle and fixed LOADS of style issues.
064:         * Added separate thirdparty subproject.
065:         * Added struts (in web), util and webgui (in webtheme) from ivata op.
066:         *
067:         * Revision 1.2  2004/12/30 20:15:14  colinmacleod
068:         * Moved first and last fields up to Group from Mask.
069:         *
070:         * Revision 1.1  2004/12/29 20:07:08  colinmacleod
071:         * Renamed subproject masks to mask.
072:         *
073:         * Revision 1.1.1.1  2004/05/16 20:40:32  colinmacleod
074:         * Ready for 0.1 release
075:         * -----------------------------------------------------------------------------
076:         */
077:        package com.ivata.mask.group;
078:
079:        import org.apache.log4j.Logger;
080:
081:        import java.io.Serializable;
082:        import java.util.ArrayList;
083:        import java.util.Collections;
084:        import java.util.HashMap;
085:        import java.util.HashSet;
086:        import java.util.List;
087:        import java.util.Map;
088:        import java.util.Set;
089:        import java.util.Vector;
090:
091:        import com.ivata.mask.field.Field;
092:        import com.ivata.mask.filter.Filter;
093:
094:        /**
095:         * Implementation of {@link Group}defining a group of masks which share common
096:         * field definitions and other characteristics.
097:         *
098:         * @since ivata masks 0.1 (2004-02-26)
099:         * @author Colin MacLeod
100:         * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
101:         */
102:        public class GroupImpl implements  Group, Serializable {
103:            /**
104:             * Logger for this class.
105:             */
106:            private static final Logger logger = Logger
107:                    .getLogger(GroupImpl.class);
108:
109:            /**
110:             * Serialization version (for <code>Serializable</code> interface).
111:             */
112:            private static final long serialVersionUID = 1L;
113:
114:            /**
115:             * Implementation of <code>getAllExcludedFieldNames()</code>.
116:             *
117:             * @param instance
118:             *            instance for which to get the excluded fields.
119:             * @return list of all excluded field ids, as a <code>List</code> of
120:             *         <code>String</code> instances.
121:             * @see #getAllExcludedFieldNames()
122:             */
123:            protected static Set getAllExcludedFieldNames(final Group instance) {
124:                if (logger.isDebugEnabled()) {
125:                    logger.debug("getAllExcludedFieldNames(Group instance = "
126:                            + instance + ") - start");
127:                }
128:
129:                Set excluded = new HashSet();
130:                Group parent = instance.getParent();
131:                if (parent != null) {
132:                    excluded.addAll(getAllExcludedFieldNames(parent));
133:                }
134:                excluded.removeAll(instance.getIncludedFieldNames());
135:                excluded.addAll(instance.getExcludedFieldNames());
136:
137:                if (logger.isDebugEnabled()) {
138:                    logger
139:                            .debug("getAllExcludedFieldNames - end - return value = "
140:                                    + excluded);
141:                }
142:                return excluded;
143:            }
144:
145:            /**
146:             * Implementation of <code>getAllFirstFieldNames()</code>.
147:             *
148:             * @param instance
149:             *            instance for which to get the first fields.
150:             * @return list of all first field ids, as a <code>List</code> of
151:             *         <code>String</code> instances.
152:             * @see #getAllFirstFieldNames()
153:             */
154:            protected static List getAllFirstFieldNames(final Group instance) {
155:                if (logger.isDebugEnabled()) {
156:                    logger.debug("getAllFirstFieldNames(Group instance = "
157:                            + instance + ") - start");
158:                }
159:
160:                List firstFieldNames = new ArrayList();
161:                Group parent = instance.getParent();
162:                if ((parent != null)
163:                        && !instance.isParentFirstFieldNamesReplaced()) {
164:                    firstFieldNames.addAll(getAllFirstFieldNames(parent));
165:                }
166:                // add in the first fields at this level
167:                firstFieldNames.addAll(instance.getFirstFieldNames());
168:                // remove everything explicitly excluded at this level
169:                firstFieldNames.removeAll(instance.getExcludedFieldNames());
170:
171:                if (logger.isDebugEnabled()) {
172:                    logger
173:                            .debug("getAllFirstFieldNames(Group) - end - return value = "
174:                                    + firstFieldNames);
175:                }
176:                return firstFieldNames;
177:            }
178:
179:            /**
180:             * Implementation of <code>getAllLastFieldNames()</code>.
181:             *
182:             * @param instance
183:             *            instance for which to get the last fields.
184:             * @return list of all last field ids, as a <code>List</code> of
185:             *         <code>String</code> instances.
186:             * @see #getAllLastFieldNames()
187:             */
188:            protected static List getAllLastFieldNames(final Group instance) {
189:                if (logger.isDebugEnabled()) {
190:                    logger.debug("getAllLastFieldNames(Group instance = "
191:                            + instance + ") - start");
192:                }
193:
194:                List lastFieldNames = new ArrayList();
195:                Group parent = instance.getParent();
196:                if ((parent != null)
197:                        && !instance.isParentLastFieldNamesReplaced()) {
198:                    lastFieldNames.addAll(getAllLastFieldNames(parent));
199:                }
200:                // add in the last fields at this level
201:                lastFieldNames.addAll(instance.getLastFieldNames());
202:                // remove everything explicitly excluded at this level
203:                lastFieldNames.removeAll(instance.getExcludedFieldNames());
204:
205:                if (logger.isDebugEnabled()) {
206:                    logger
207:                            .debug("getAllLastFieldNames(Group) - end - return value = "
208:                                    + lastFieldNames);
209:                }
210:                return lastFieldNames;
211:            }
212:
213:            /**
214:             * <p>
215:             * If <code>true</code>, only the values in this mask will be displayed.
216:             * Otherwise, input fields are displayed.
217:             * </p>
218:             */
219:            private Boolean displayOnly = null;
220:            /**
221:             * Field names to be excluded from this group of definitions.
222:             */
223:            private Set excludedFieldNames = new HashSet();
224:            /**
225:             * Default field definitions, referenced by name. These can be
226:             * altered/overridden.
227:             */
228:            private Map fields = new HashMap();
229:            /**
230:             * <copyDoc>Refer to {@link Group#getFilters}.</copyDoc>
231:             */
232:            private List filters = new Vector();
233:            /**
234:             * Names of fields which should come last, in the order in which they should
235:             * appear.
236:             */
237:            private List firstFieldNames = new ArrayList();
238:            /**
239:             * Field names to be included from this group of definitions. This is used
240:             * to explicitly override a field which was excluded higher up the group
241:             * hierarchy.
242:             */
243:            private Set includedFieldNames = new HashSet();
244:            /**
245:             * Names of fields which should come last, in the order in which they should
246:             * appear.
247:             */
248:            private List lastFieldNames = new ArrayList();
249:            /**
250:             * Identifier for this group. This should be unique as it is used to
251:             * identify the group.
252:             */
253:            private String name;
254:            /**
255:             * Group which this group of masks/fields extends.
256:             */
257:            private Group parent;
258:            /**
259:             * If <code>false</code>, then the parent first field name list is
260:             * extended by the names in this mask, otherwise it is relaced.
261:             */
262:            private boolean parentFirstFieldNamesReplaced = false;
263:            /**
264:             * If <code>false</code>, then the parent last field name list is
265:             * extended by the names in this mask, otherwise it is relaced.
266:             */
267:            private boolean parentLastFieldNamesReplaced = false;
268:
269:            /**
270:             * Create a group with no parent.
271:             *
272:             * @param nameParam
273:             *            unique identifier for this group.
274:             */
275:            public GroupImpl(final String nameParam) {
276:                this .name = nameParam;
277:            }
278:
279:            /**
280:             * Create a mask with the specified parent.
281:             *
282:             * @param nameParam
283:             *            unique identifier for this group.
284:             * @param parentParam
285:             *            group which this group extends.
286:             */
287:            public GroupImpl(final String nameParam, final Group parentParam) {
288:                this .name = nameParam;
289:                this .parent = parentParam;
290:            }
291:
292:            /**
293:             * Add the name of a field to exclude from this mask group.
294:             *
295:             * @param nameParam
296:             *            unique identifier for the field which should be excluded.
297:             * @see #getExcludedFieldNames
298:             */
299:            public final void addExcludedFieldName(final String nameParam) {
300:                if (logger.isDebugEnabled()) {
301:                    logger.debug("addExcludedFieldName(String nameParam = "
302:                            + nameParam + ") - start");
303:                }
304:
305:                excludedFieldNames.add(nameParam);
306:
307:                if (logger.isDebugEnabled()) {
308:                    logger.debug("addExcludedFieldName(String) - end");
309:                }
310:            }
311:
312:            /**
313:             * Add a field definition to this group.
314:             *
315:             * @param fieldParam
316:             *            field definition to add to this mask group.
317:             */
318:            public final void addField(final Field fieldParam) {
319:                if (logger.isDebugEnabled()) {
320:                    logger.debug("addField(Field fieldParam = " + fieldParam
321:                            + ") - start");
322:                }
323:
324:                fields.put(fieldParam.getName(), fieldParam);
325:
326:                if (logger.isDebugEnabled()) {
327:                    logger.debug("addField(Field) - end");
328:                }
329:            }
330:
331:            /**
332:             * Add a filter to the list.
333:             *
334:             * @param filterParam filter to be added.
335:             * @see Group#getFilters.
336:             */
337:            public final void addFilter(final Filter filterParam) {
338:                if (logger.isDebugEnabled()) {
339:                    logger.debug("addFilter(Filter filterParam = "
340:                            + filterParam + ") - start");
341:                }
342:
343:                filters.add(filterParam);
344:
345:                if (logger.isDebugEnabled()) {
346:                    logger.debug("addFilter(Filter) - end");
347:                }
348:            }
349:
350:            /**
351:             * Add the identifier for one of the first fields in the mask.
352:             *
353:             * @param nameParam
354:             *            unique identifier for the field which should appear at the
355:             *            start of the mask group.
356:             * @see #getFirstFieldNames
357:             */
358:            public final void addFirstFieldName(final String nameParam) {
359:                if (logger.isDebugEnabled()) {
360:                    logger.debug("addFirstFieldName(String nameParam = "
361:                            + nameParam + ") - start");
362:                }
363:
364:                firstFieldNames.add(nameParam);
365:
366:                if (logger.isDebugEnabled()) {
367:                    logger.debug("addFirstFieldName(String) - end");
368:                }
369:            }
370:
371:            /**
372:             * Add the name of an included field.
373:             *
374:             * @param nameParam
375:             *            unique identifier for the field which should appear in the
376:             *            mask group, overriding parent excluded fields.
377:             * @see #getIncludedFieldNames()
378:             */
379:            public final void addIncludedFieldName(final String nameParam) {
380:                if (logger.isDebugEnabled()) {
381:                    logger.debug("addIncludedFieldName(String nameParam = "
382:                            + nameParam + ") - start");
383:                }
384:
385:                includedFieldNames.add(nameParam);
386:
387:                if (logger.isDebugEnabled()) {
388:                    logger.debug("addIncludedFieldName(String) - end");
389:                }
390:            }
391:
392:            /**
393:             * Add the identifier for one of the last fields in the mask.
394:             *
395:             * @param nameParam
396:             *            unique identifier for the field which should appear at the end
397:             *            of the mask group.
398:             * @see #getLastFieldNames
399:             */
400:            public final void addLastFieldName(final String nameParam) {
401:                if (logger.isDebugEnabled()) {
402:                    logger.debug("addLastFieldName(String nameParam = "
403:                            + nameParam + ") - start");
404:                }
405:
406:                lastFieldNames.add(nameParam);
407:
408:                if (logger.isDebugEnabled()) {
409:                    logger.debug("addLastFieldName(String) - end");
410:                }
411:            }
412:
413:            /**
414:             * Get the field names of all fields which have been excluded from this and
415:             * its parents.
416:             * <p>
417:             * <b>Note: </b> This will include fields which were explicitly included,
418:             * even if a parent class excluded them before.
419:             * </p>
420:             *
421:             * @return list of all excluded field names, as a <code>Set</code> of
422:             *         <code>String</code> instances.
423:             */
424:            public final Set getAllExcludedFieldNames() {
425:                if (logger.isDebugEnabled()) {
426:                    logger.debug("getAllExcludedFieldNames() - start");
427:                }
428:
429:                Set returnSet = Collections
430:                        .unmodifiableSet(getAllExcludedFieldNames(this ));
431:                if (logger.isDebugEnabled()) {
432:                    logger
433:                            .debug("getAllExcludedFieldNames() - end - return value = "
434:                                    + returnSet);
435:                }
436:                return returnSet;
437:            }
438:
439:            /**
440:             * <p>
441:             * Get the field identifiers of all fields which should appear at the start
442:             * of the group/mask, including those defined by its parent.
443:             * </p>
444:             *
445:             * @return list of all first field ids, as a <code>List</code> of
446:             *         <code>String</code> instances.
447:             * @see #getFirstFieldNames
448:             */
449:            public final List getAllFirstFieldNames() {
450:                if (logger.isDebugEnabled()) {
451:                    logger.debug("getAllFirstFieldNames() - start");
452:                }
453:
454:                List returnList = Collections
455:                        .unmodifiableList(getAllFirstFieldNames(this ));
456:                if (logger.isDebugEnabled()) {
457:                    logger
458:                            .debug("getAllFirstFieldNames() - end - return value = "
459:                                    + returnList);
460:                }
461:                return returnList;
462:            }
463:
464:            /**
465:             * <p>
466:             * Get the field identifiers of all fields which should appear at the end of
467:             * the group/mask, including those defined by its parent.
468:             * </p>
469:             *
470:             * @return list of all last field ids, as a <code>List</code> of
471:             *         <code>String</code> instances.
472:             * @see #getFirstFieldNames
473:             */
474:            public final List getAllLastFieldNames() {
475:                if (logger.isDebugEnabled()) {
476:                    logger.debug("getAllLastFieldNames() - start");
477:                }
478:
479:                List returnList = Collections
480:                        .unmodifiableList(getAllLastFieldNames(this ));
481:                if (logger.isDebugEnabled()) {
482:                    logger
483:                            .debug("getAllLastFieldNames() - end - return value = "
484:                                    + returnList);
485:                }
486:                return returnList;
487:            }
488:
489:            /**
490:             * <p>
491:             * Get the field ids which have been explicitly excluded from this group.
492:             * </p>
493:             *
494:             * @return the field ids which have been explicitly excluded from this group
495:             *         (not including those excluded by parent groups).
496:             */
497:            public final Set getExcludedFieldNames() {
498:                if (logger.isDebugEnabled()) {
499:                    logger.debug("getExcludedFieldNames() - start");
500:                }
501:
502:                Set returnSet = Collections.unmodifiableSet(excludedFieldNames);
503:                if (logger.isDebugEnabled()) {
504:                    logger
505:                            .debug("getExcludedFieldNames() - end - return value = "
506:                                    + returnSet);
507:                }
508:                return returnSet;
509:            }
510:
511:            /**
512:             * <p>
513:             * Default field definitions. These can be altered/overridden.
514:             * </p>
515:             *
516:             * @param nameParam
517:             *            name of the field to be returned.
518:             * @return read-only copy of the fields.
519:             */
520:            public final Field getField(final String nameParam) {
521:                if (logger.isDebugEnabled()) {
522:                    logger.debug("getField(String nameParam = " + nameParam
523:                            + ") - start");
524:                }
525:
526:                Field field = (Field) fields.get(nameParam);
527:                if ((field == null) && (parent != null)) {
528:                    Field returnField = parent.getField(nameParam);
529:                    if (logger.isDebugEnabled()) {
530:                        logger.debug("getField(String) - end - return value = "
531:                                + returnField);
532:                    }
533:                    return returnField;
534:                }
535:
536:                if (logger.isDebugEnabled()) {
537:                    logger.debug("getField(String) - end - return value = "
538:                            + field);
539:                }
540:                return field;
541:            }
542:
543:            /**
544:             * <copyDoc>Refer to {@link Group#getFilters}.</copyDoc>
545:             * @return <copyDoc>Refer to {@link Group#getFilters}.</copyDoc>
546:             */
547:            public List getFilters() {
548:                if (logger.isDebugEnabled()) {
549:                    logger.debug("getFilters() - start");
550:                }
551:
552:                if (logger.isDebugEnabled()) {
553:                    logger.debug("getFilters() - end - return value = "
554:                            + filters);
555:                }
556:                return filters;
557:            }
558:
559:            /**
560:             * <p>
561:             * Get the ids of all fields which should appear at the start of masks in
562:             * this group. For an input mask this usually means the fields will appear
563:             * at the top of the page; for a list the fields will appear at the left of
564:             * the list.
565:             * </p>
566:             * <p>
567:             * <b>Note </b> that all these fields do not need to be present in all masks
568:             * of this group (some value objects may not have all the fields listed).
569:             * Those fields which are listed and present in the value object will appear
570:             * at the start, in the order given.
571:             * </p>
572:             *
573:             * @return list containing string identifiers of fields which should appear
574:             *         first in the mask.
575:             */
576:            public final List getFirstFieldNames() {
577:                if (logger.isDebugEnabled()) {
578:                    logger.debug("getFirstFieldNames() - start");
579:                }
580:
581:                List returnList = Collections.unmodifiableList(firstFieldNames);
582:                if (logger.isDebugEnabled()) {
583:                    logger.debug("getFirstFieldNames() - end - return value = "
584:                            + returnList);
585:                }
586:                return returnList;
587:            }
588:
589:            /**
590:             * By explicitly including fields in a mask, you can override fields
591:             * excluded by one of its parents.
592:             *
593:             * @return fields explicitly included (overridden) in this mask.
594:             */
595:            public final Set getIncludedFieldNames() {
596:                if (logger.isDebugEnabled()) {
597:                    logger.debug("getIncludedFieldNames() - start");
598:                }
599:
600:                Set returnSet = Collections.unmodifiableSet(includedFieldNames);
601:                if (logger.isDebugEnabled()) {
602:                    logger
603:                            .debug("getIncludedFieldNames() - end - return value = "
604:                                    + returnSet);
605:                }
606:                return returnSet;
607:            }
608:
609:            /**
610:             * <p>
611:             * Get the ids of all fields which should appear at the end of masks in this
612:             * group. For an input mask this usually means the fields will appear at the
613:             * bottom of the page; for a list the fields will appear at the right of the
614:             * list.
615:             * </p>
616:             * <p>
617:             * <b>Note </b> that all these fields do not need to be present in all masks
618:             * of this group (some value objects may not have all the fields listed).
619:             * Those fields which are listed and present in the value object will appear
620:             * at the end, in the order given.
621:             * </p>
622:             *
623:             * @return list containing string identifiers of fields which should appear
624:             *         last in the mask.
625:             */
626:            public final List getLastFieldNames() {
627:                if (logger.isDebugEnabled()) {
628:                    logger.debug("getLastFieldNames() - start");
629:                }
630:
631:                List returnList = Collections.unmodifiableList(lastFieldNames);
632:                if (logger.isDebugEnabled()) {
633:                    logger.debug("getLastFieldNames() - end - return value = "
634:                            + returnList);
635:                }
636:                return returnList;
637:            }
638:
639:            /**
640:             * <copyDoc>Refer to {@link Group#getName}.</copyDoc>
641:             *
642:             * @return unique identifier of this group.
643:             */
644:            public final String getName() {
645:                if (logger.isDebugEnabled()) {
646:                    logger.debug("getName() - start");
647:                }
648:
649:                if (logger.isDebugEnabled()) {
650:                    logger.debug("getName() - end - return value = " + name);
651:                }
652:                return name;
653:            }
654:
655:            /**
656:             * <p>
657:             * Get the parent of this group, if any.
658:             * </p>
659:             *
660:             * <p>
661:             * Each group or mask can define a parent, from which it can inherit field
662:             * definitions and group/mask properties.
663:             * </p>
664:             *
665:             * @return parent of this group, or <code>null</code> if this is a
666:             *         top-level group.
667:             */
668:            public final Group getParent() {
669:                if (logger.isDebugEnabled()) {
670:                    logger.debug("getParent() - start");
671:                }
672:
673:                if (logger.isDebugEnabled()) {
674:                    logger
675:                            .debug("getParent() - end - return value = "
676:                                    + parent);
677:                }
678:                return parent;
679:            }
680:
681:            /**
682:             * <p>
683:             * If <code>true</code>, only the values in this mask will be displayed.
684:             * Otherwise, input fields are displayed.
685:             * </p>
686:             *
687:             * <p>
688:             * This setting is inherited. If it is not set in a group directly, the
689:             * value for the group's parent is taken.
690:             * </p>
691:             *
692:             * @return whether or not the mask should only display field values.
693:             */
694:            public final boolean isDisplayOnly() {
695:                if (logger.isDebugEnabled()) {
696:                    logger.debug("isDisplayOnly() - start");
697:                }
698:
699:                // if a value was set in this instance directly, use that.
700:                if (displayOnly != null) {
701:                    boolean returnboolean = displayOnly.booleanValue();
702:                    if (logger.isDebugEnabled()) {
703:                        logger.debug("isDisplayOnly() - end - return value = "
704:                                + returnboolean);
705:                    }
706:                    return returnboolean;
707:                }
708:                // if there is a parent, inherit the setting from there
709:                if (parent != null) {
710:                    boolean returnboolean = parent.isDisplayOnly();
711:                    if (logger.isDebugEnabled()) {
712:                        logger.debug("isDisplayOnly() - end - return value = "
713:                                + returnboolean);
714:                    }
715:                    return returnboolean;
716:                }
717:                // if there is no parent and the setting is null, default to false
718:
719:                if (logger.isDebugEnabled()) {
720:                    logger
721:                            .debug("isDisplayOnly() - end - return value = " + false);
722:                }
723:                return false;
724:            }
725:
726:            /**
727:             * <p>
728:             * When first field identifiers are defined for a group, normally these are
729:             * appended to the list of all parent group first field identifiers, i.e.
730:             * the list returned by calling
731:             * {@link #getFirstFieldNames getFirstFieldNames} on the parent group.
732:             * </p>
733:             * <p>
734:             * This is the standard, default behavior when this method returns
735:             * <code>false</code>. However, if this method returns <code>true</code>,
736:             * then the first field identifiers in this group override (replace) the
737:             * list returned by the group's parents.
738:             * </p>
739:             *
740:             * @return <code>true</code> if this group replaces the list of first
741:             *         field ids defined by parent groups, otherwise <code>false</code>
742:             *         if this group's list will be appended to that of its parents.
743:             * @see #getFirstFieldNames
744:             */
745:            public final boolean isParentFirstFieldNamesReplaced() {
746:                if (logger.isDebugEnabled()) {
747:                    logger.debug("isParentFirstFieldNamesReplaced() - start");
748:                }
749:
750:                if (logger.isDebugEnabled()) {
751:                    logger
752:                            .debug("isParentFirstFieldNamesReplaced - end - return value = "
753:                                    + parentFirstFieldNamesReplaced);
754:                }
755:                return parentFirstFieldNamesReplaced;
756:            }
757:
758:            /**
759:             * <p>
760:             * When last field identifiers are defined for a group, normally these are
761:             * appended to the list of all parent group last field identifiers, i.e. the
762:             * list returned by calling
763:             * {@link #getLastFieldNames getLastFieldNames}on the parent group.
764:             * </p>
765:             * <p>
766:             * This is the standard, default behavior when this method returns
767:             * <code>false</code>. However, if this method returns <code>true</code>,
768:             * then the last field identifiers in this group override (replace) the list
769:             * returned by the group's parents.
770:             * </p>
771:             *
772:             * @return <code>true</code> if this group replaces the list of last field
773:             *         ids defined by parent groups, otherwise <code>false</code> if
774:             *         this group's list will be appended to that of its parents.
775:             * @see #getLastFieldNames
776:             */
777:            public final boolean isParentLastFieldNamesReplaced() {
778:                if (logger.isDebugEnabled()) {
779:                    logger.debug("isParentLastFieldNamesReplaced() - start");
780:                }
781:
782:                if (logger.isDebugEnabled()) {
783:                    logger
784:                            .debug("isParentLastFieldNamesReplaced() - end - return value = "
785:                                    + parentLastFieldNamesReplaced);
786:                }
787:                return parentLastFieldNamesReplaced;
788:            }
789:
790:            /**
791:             * <p>
792:             * If <code>true</code>, only the values in this mask will be displayed.
793:             * Otherwise, input fields are displayed.
794:             * </p>
795:             *
796:             * <p>
797:             * This setting is inherited. If it is not set in a group directly, the
798:             * value for the group's parent is taken.
799:             * </p>
800:             *
801:             * @param b
802:             *            if <code>true</code> field values are just displayed and
803:             *            cannot be changed.
804:             * @see #isDisplayOnly
805:             */
806:            public final void setDisplayOnly(final boolean b) {
807:                if (logger.isDebugEnabled()) {
808:                    logger.debug("setDisplayOnly(boolean b = " + b
809:                            + ") - start");
810:                }
811:
812:                displayOnly = new Boolean(b);
813:
814:                if (logger.isDebugEnabled()) {
815:                    logger.debug("setDisplayOnly(boolean) - end");
816:                }
817:            }
818:
819:            /**
820:             * Set whether or not the first field name list of parent mask groups should
821:             * be replaced.
822:             *
823:             * @param parentFirstFieldNamesReplacedParam
824:             *            <code>true</code> if parent first field ids should be
825:             *            replaced (ignored), otherwise <code>false</code>.
826:             * @see #isParentFirstFieldNamesReplaced()
827:             */
828:            public final void setParentFirstFieldNamesReplaced(
829:                    final boolean parentFirstFieldNamesReplacedParam) {
830:                if (logger.isDebugEnabled()) {
831:                    logger.debug("setParentFirstFieldNamesReplaced("
832:                            + "boolean parentFirstFieldNamesReplacedParam = "
833:                            + parentFirstFieldNamesReplacedParam + ") - start");
834:                }
835:
836:                parentFirstFieldNamesReplaced = parentFirstFieldNamesReplacedParam;
837:
838:                if (logger.isDebugEnabled()) {
839:                    logger
840:                            .debug("setParentFirstFieldNamesReplaced(boolean) - end");
841:                }
842:            }
843:
844:            /**
845:             * Set whether or not the last field name list of parent mask groups should
846:             * be replaced.
847:             *
848:             * @param parentLastFieldNamesReplacedParam
849:             *            <code>true</code> if parent last field ids should be
850:             *            replaced (ignored), otherwise <code>false</code>.
851:             * @see #isParentLastFieldNamesReplaced()
852:             */
853:            public final void setParentLastFieldNamesReplaced(
854:                    final boolean parentLastFieldNamesReplacedParam) {
855:                if (logger.isDebugEnabled()) {
856:                    logger.debug("setParentLastFieldNamesReplaced("
857:                            + "boolean parentLastFieldNamesReplacedParam = "
858:                            + parentLastFieldNamesReplacedParam + ") - start");
859:                }
860:
861:                parentLastFieldNamesReplaced = parentLastFieldNamesReplacedParam;
862:
863:                if (logger.isDebugEnabled()) {
864:                    logger
865:                            .debug("setParentLastFieldNamesReplaced(boolean) - end");
866:                }
867:            }
868:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.