Source Code Cross Referenced for PortletPreferencesType.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » api » portlet » dd » 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 » IDE Netbeans » visualweb.api.designer » org.netbeans.modules.visualweb.api.portlet.dd 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:        /**
042:         *	This generated bean class PortletPreferencesType
043:         *	matches the schema element 'portlet-preferencesType'.
044:         *  The root bean class is PortletApp
045:         *
046:         *	===============================================================
047:         *	
048:         *				Portlet persistent preference store.
049:         *				Used in: portlet
050:         *				
051:         *	===============================================================
052:         *	Generated on Tue Apr 26 19:08:25 MDT 2005
053:         * @Generated
054:         */package org.netbeans.modules.visualweb.api.portlet.dd;
055:
056:        public class PortletPreferencesType
057:                implements 
058:                org.netbeans.modules.visualweb.api.portlet.dd.PortletPreferencesTypeInterface,
059:                org.netbeans.modules.visualweb.api.portlet.dd.CommonBean {
060:            public static final String ID = "Id"; // NOI18N
061:            public static final String PREFERENCE = "Preference"; // NOI18N
062:            public static final String PREFERENCES_VALIDATOR = "PreferencesValidator"; // NOI18N
063:
064:            private java.lang.String _Id;
065:            private java.util.List _Preference = new java.util.ArrayList(); // List<PreferenceType>
066:            private java.lang.String _PreferencesValidator;
067:
068:            /**
069:             * Normal starting point constructor.
070:             */
071:            public PortletPreferencesType() {
072:            }
073:
074:            /**
075:             * Deep copy
076:             */
077:            public PortletPreferencesType(
078:                    org.netbeans.modules.visualweb.api.portlet.dd.PortletPreferencesType source) {
079:                this (source, false);
080:            }
081:
082:            /**
083:             * Deep copy
084:             * @param justData just copy the XML relevant data
085:             */
086:            public PortletPreferencesType(
087:                    org.netbeans.modules.visualweb.api.portlet.dd.PortletPreferencesType source,
088:                    boolean justData) {
089:                _Id = source._Id;
090:                for (java.util.Iterator it = source._Preference.iterator(); it
091:                        .hasNext();) {
092:                    org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType srcElement = (org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType) it
093:                            .next();
094:                    _Preference.add((srcElement == null) ? null
095:                            : newPreferenceType(srcElement, justData));
096:                }
097:                _PreferencesValidator = source._PreferencesValidator;
098:            }
099:
100:            // This attribute is optional
101:            public void setId(java.lang.String value) {
102:                _Id = value;
103:            }
104:
105:            public java.lang.String getId() {
106:                return _Id;
107:            }
108:
109:            // This attribute is an array, possibly empty
110:            public void setPreference(
111:                    org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType[] value) {
112:                if (value == null)
113:                    value = new PreferenceType[0];
114:                _Preference.clear();
115:                ((java.util.ArrayList) _Preference)
116:                        .ensureCapacity(value.length);
117:                for (int i = 0; i < value.length; ++i) {
118:                    _Preference.add(value[i]);
119:                }
120:            }
121:
122:            public void setPreference(
123:                    int index,
124:                    org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType value) {
125:                _Preference.set(index, value);
126:            }
127:
128:            public org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType[] getPreference() {
129:                PreferenceType[] arr = new PreferenceType[_Preference.size()];
130:                return (PreferenceType[]) _Preference.toArray(arr);
131:            }
132:
133:            public java.util.List fetchPreferenceList() {
134:                return _Preference;
135:            }
136:
137:            public org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType getPreference(
138:                    int index) {
139:                return (PreferenceType) _Preference.get(index);
140:            }
141:
142:            // Return the number of preference
143:            public int sizePreference() {
144:                return _Preference.size();
145:            }
146:
147:            public int addPreference(
148:                    org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType value) {
149:                _Preference.add(value);
150:                int positionOfNewItem = _Preference.size() - 1;
151:                return positionOfNewItem;
152:            }
153:
154:            /**
155:             * Search from the end looking for @param value, and then remove it.
156:             */
157:            public int removePreference(
158:                    org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType value) {
159:                int pos = _Preference.indexOf(value);
160:                if (pos >= 0) {
161:                    _Preference.remove(pos);
162:                }
163:                return pos;
164:            }
165:
166:            // This attribute is optional
167:            public void setPreferencesValidator(java.lang.String value) {
168:                _PreferencesValidator = value;
169:            }
170:
171:            public java.lang.String getPreferencesValidator() {
172:                return _PreferencesValidator;
173:            }
174:
175:            /**
176:             * Create a new bean using it's default constructor.
177:             * This does not add it to any bean graph.
178:             */
179:            public org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType newPreferenceType() {
180:                return new org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType();
181:            }
182:
183:            /**
184:             * Create a new bean, copying from another one.
185:             * This does not add it to any bean graph.
186:             */
187:            public org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType newPreferenceType(
188:                    PreferenceType source, boolean justData) {
189:                return new org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType(
190:                        source, justData);
191:            }
192:
193:            public void writeNode(java.io.Writer out)
194:                    throws java.io.IOException {
195:                String myName;
196:                myName = "portlet-preferencesType";
197:                writeNode(out, myName, ""); // NOI18N
198:            }
199:
200:            public void writeNode(java.io.Writer out, String nodeName,
201:                    String indent) throws java.io.IOException {
202:                writeNode(out, nodeName, null, indent, new java.util.HashMap());
203:            }
204:
205:            /**
206:             * It's not recommended to call this method directly.
207:             */
208:            public void writeNode(java.io.Writer out, String nodeName,
209:                    String namespace, String indent, java.util.Map namespaceMap)
210:                    throws java.io.IOException {
211:                out.write(indent);
212:                out.write("<");
213:                if (namespace != null) {
214:                    out.write((String) namespaceMap.get(namespace));
215:                    out.write(":");
216:                }
217:                out.write(nodeName);
218:                // id is an attribute with namespace http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
219:                if (_Id != null) {
220:                    out.write(" id='");
221:                    org.netbeans.modules.visualweb.api.portlet.dd.PortletApp
222:                            .writeXML(out, _Id, true);
223:                    out.write("'"); // NOI18N
224:                }
225:                out.write(">\n");
226:                String nextIndent = indent + "	";
227:                for (java.util.Iterator it = _Preference.iterator(); it
228:                        .hasNext();) {
229:                    org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType element = (org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType) it
230:                            .next();
231:                    if (element != null) {
232:                        element.writeNode(out, "preference", null, nextIndent,
233:                                namespaceMap);
234:                    }
235:                }
236:                if (_PreferencesValidator != null) {
237:                    out.write(nextIndent);
238:                    out.write("<preferences-validator"); // NOI18N
239:                    out.write(">"); // NOI18N
240:                    org.netbeans.modules.visualweb.api.portlet.dd.PortletApp
241:                            .writeXML(out, _PreferencesValidator, false);
242:                    out.write("</preferences-validator>\n"); // NOI18N
243:                }
244:                out.write(indent);
245:                out.write("</");
246:                if (namespace != null) {
247:                    out.write((String) namespaceMap.get(namespace));
248:                    out.write(":");
249:                }
250:                out.write(nodeName);
251:                out.write(">\n");
252:            }
253:
254:            public void readNode(org.w3c.dom.Node node) {
255:                readNode(node, new java.util.HashMap());
256:            }
257:
258:            public void readNode(org.w3c.dom.Node node,
259:                    java.util.Map namespacePrefixes) {
260:                if (node.hasAttributes()) {
261:                    org.w3c.dom.NamedNodeMap attrs = node.getAttributes();
262:                    org.w3c.dom.Attr attr;
263:                    java.lang.String attrValue;
264:                    boolean firstNamespaceDef = true;
265:                    for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
266:                        attr = (org.w3c.dom.Attr) attrs.item(attrNum);
267:                        String attrName = attr.getName();
268:                        if (attrName.startsWith("xmlns:")) {
269:                            if (firstNamespaceDef) {
270:                                firstNamespaceDef = false;
271:                                // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
272:                                namespacePrefixes = new java.util.HashMap(
273:                                        namespacePrefixes);
274:                            }
275:                            String attrNSPrefix = attrName.substring(6,
276:                                    attrName.length());
277:                            namespacePrefixes
278:                                    .put(attrNSPrefix, attr.getValue());
279:                        }
280:                    }
281:                    attr = (org.w3c.dom.Attr) attrs.getNamedItem("id");
282:                    if (attr != null) {
283:                        attrValue = attr.getValue();
284:                        _Id = attrValue;
285:                    }
286:                }
287:                org.w3c.dom.NodeList children = node.getChildNodes();
288:                for (int i = 0, size = children.getLength(); i < size; ++i) {
289:                    org.w3c.dom.Node childNode = children.item(i);
290:                    String childNodeName = (childNode.getLocalName() == null ? childNode
291:                            .getNodeName().intern()
292:                            : childNode.getLocalName().intern());
293:                    String childNodeValue = "";
294:                    if (childNode.getFirstChild() != null) {
295:                        childNodeValue = childNode.getFirstChild()
296:                                .getNodeValue();
297:                    }
298:                    if (childNodeName == "preference") {
299:                        PreferenceType aPreference = newPreferenceType();
300:                        aPreference.readNode(childNode, namespacePrefixes);
301:                        _Preference.add(aPreference);
302:                    } else if (childNodeName == "preferences-validator") {
303:                        _PreferencesValidator = childNodeValue;
304:                    } else {
305:                        // Found extra unrecognized childNode
306:                    }
307:                }
308:            }
309:
310:            public void validate()
311:                    throws org.netbeans.modules.visualweb.api.portlet.dd.PortletApp.ValidateException {
312:                boolean restrictionFailure = false;
313:                boolean restrictionPassed = false;
314:                // Validating property id
315:                // Validating property preference
316:                for (int _index = 0; _index < sizePreference(); ++_index) {
317:                    org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType element = getPreference(_index);
318:                    if (element != null) {
319:                        element.validate();
320:                    }
321:                }
322:                // Validating property preferencesValidator
323:            }
324:
325:            public void changePropertyByName(String name, Object value) {
326:                if (name == null)
327:                    return;
328:                name = name.intern();
329:                if (name == "id")
330:                    setId((java.lang.String) value);
331:                else if (name == "preference")
332:                    addPreference((PreferenceType) value);
333:                else if (name == "preference[]")
334:                    setPreference((PreferenceType[]) value);
335:                else if (name == "preferencesValidator")
336:                    setPreferencesValidator((java.lang.String) value);
337:                else
338:                    throw new IllegalArgumentException(
339:                            name
340:                                    + " is not a valid property name for PortletPreferencesType");
341:            }
342:
343:            public Object fetchPropertyByName(String name) {
344:                if (name == "id")
345:                    return getId();
346:                if (name == "preference[]")
347:                    return getPreference();
348:                if (name == "preferencesValidator")
349:                    return getPreferencesValidator();
350:                throw new IllegalArgumentException(
351:                        name
352:                                + " is not a valid property name for PortletPreferencesType");
353:            }
354:
355:            public String nameSelf() {
356:                return "PortletPreferencesType";
357:            }
358:
359:            public String nameChild(Object childObj) {
360:                return nameChild(childObj, false, false);
361:            }
362:
363:            /**
364:             * @param childObj  The child object to search for
365:             * @param returnSchemaName  Whether or not the schema name should be returned or the property name
366:             * @return null if not found
367:             */
368:            public String nameChild(Object childObj, boolean returnConstName,
369:                    boolean returnSchemaName) {
370:                return nameChild(childObj, returnConstName, returnSchemaName,
371:                        false);
372:            }
373:
374:            /**
375:             * @param childObj  The child object to search for
376:             * @param returnSchemaName  Whether or not the schema name should be returned or the property name
377:             * @return null if not found
378:             */
379:            public String nameChild(Object childObj, boolean returnConstName,
380:                    boolean returnSchemaName, boolean returnXPathName) {
381:                if (childObj instanceof  java.lang.String) {
382:                    java.lang.String child = (java.lang.String) childObj;
383:                    if (child == _Id) {
384:                        if (returnConstName) {
385:                            return ID;
386:                        } else if (returnSchemaName) {
387:                            return "id";
388:                        } else if (returnXPathName) {
389:                            return "@id";
390:                        } else {
391:                            return "Id";
392:                        }
393:                    }
394:                    if (child == _PreferencesValidator) {
395:                        if (returnConstName) {
396:                            return PREFERENCES_VALIDATOR;
397:                        } else if (returnSchemaName) {
398:                            return "preferences-validator";
399:                        } else if (returnXPathName) {
400:                            return "preferences-validator";
401:                        } else {
402:                            return "PreferencesValidator";
403:                        }
404:                    }
405:                }
406:                if (childObj instanceof  PreferenceType) {
407:                    PreferenceType child = (PreferenceType) childObj;
408:                    int index = 0;
409:                    for (java.util.Iterator it = _Preference.iterator(); it
410:                            .hasNext();) {
411:                        org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType element = (org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType) it
412:                                .next();
413:                        if (child == element) {
414:                            if (returnConstName) {
415:                                return PREFERENCE;
416:                            } else if (returnSchemaName) {
417:                                return "preference";
418:                            } else if (returnXPathName) {
419:                                return "preference[position()=" + index + "]";
420:                            } else {
421:                                return "Preference."
422:                                        + Integer.toHexString(index);
423:                            }
424:                        }
425:                        ++index;
426:                    }
427:                }
428:                return null;
429:            }
430:
431:            /**
432:             * Return an array of all of the properties that are beans and are set.
433:             */
434:            public org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[] childBeans(
435:                    boolean recursive) {
436:                java.util.List children = new java.util.LinkedList();
437:                childBeans(recursive, children);
438:                org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[] result = new org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[children
439:                        .size()];
440:                return (org.netbeans.modules.visualweb.api.portlet.dd.CommonBean[]) children
441:                        .toArray(result);
442:            }
443:
444:            /**
445:             * Put all child beans into the beans list.
446:             */
447:            public void childBeans(boolean recursive, java.util.List beans) {
448:                for (java.util.Iterator it = _Preference.iterator(); it
449:                        .hasNext();) {
450:                    org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType element = (org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType) it
451:                            .next();
452:                    if (element != null) {
453:                        if (recursive) {
454:                            element.childBeans(true, beans);
455:                        }
456:                        beans.add(element);
457:                    }
458:                }
459:            }
460:
461:            public boolean equals(Object o) {
462:                return o instanceof  org.netbeans.modules.visualweb.api.portlet.dd.PortletPreferencesType
463:                        && equals((org.netbeans.modules.visualweb.api.portlet.dd.PortletPreferencesType) o);
464:            }
465:
466:            public boolean equals(
467:                    org.netbeans.modules.visualweb.api.portlet.dd.PortletPreferencesType inst) {
468:                if (inst == this ) {
469:                    return true;
470:                }
471:                if (inst == null) {
472:                    return false;
473:                }
474:                if (!(_Id == null ? inst._Id == null : _Id.equals(inst._Id))) {
475:                    return false;
476:                }
477:                if (sizePreference() != inst.sizePreference())
478:                    return false;
479:                // Compare every element.
480:                for (java.util.Iterator it = _Preference.iterator(), it2 = inst._Preference
481:                        .iterator(); it.hasNext() && it2.hasNext();) {
482:                    org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType element = (org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType) it
483:                            .next();
484:                    org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType element2 = (org.netbeans.modules.visualweb.api.portlet.dd.PreferenceType) it2
485:                            .next();
486:                    if (!(element == null ? element2 == null : element
487:                            .equals(element2))) {
488:                        return false;
489:                    }
490:                }
491:                if (!(_PreferencesValidator == null ? inst._PreferencesValidator == null
492:                        : _PreferencesValidator
493:                                .equals(inst._PreferencesValidator))) {
494:                    return false;
495:                }
496:                return true;
497:            }
498:
499:            public int hashCode() {
500:                int result = 17;
501:                result = 37 * result + (_Id == null ? 0 : _Id.hashCode());
502:                result = 37 * result
503:                        + (_Preference == null ? 0 : _Preference.hashCode());
504:                result = 37
505:                        * result
506:                        + (_PreferencesValidator == null ? 0
507:                                : _PreferencesValidator.hashCode());
508:                return result;
509:            }
510:
511:            public String toString() {
512:                java.io.StringWriter sw = new java.io.StringWriter();
513:                try {
514:                    writeNode(sw);
515:                } catch (java.io.IOException e) {
516:                    // How can we actually get an IOException on a StringWriter?
517:                    throw new RuntimeException(e);
518:                }
519:                return sw.toString();
520:            }
521:
522:        }
w___ww.___ja___v__a__2__s_.___co__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.