Source Code Cross Referenced for UserPreferences.java in  » Portal » stringbeans-3.5 » com » nabhinc » portal » model » 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 » Portal » stringbeans 3.5 » com.nabhinc.portal.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * (C) Copyright 2000 - 2006 Nabh Information Systems, Inc. 
003:         * 
004:         * This program is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU General Public License 
006:         * as published by the Free Software Foundation; either version 2
007:         * of the License, or (at your option) any later version.
008:         * 
009:         * This program is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of 
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
012:         * GNU General Public License for more details.
013:         * 
014:         * You should have received a copy of the GNU General Public License
015:         * along with this program; if not, write to the Free Software 
016:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
017:         * 
018:         */
019:        package com.nabhinc.portal.model;
020:
021:        import java.util.ArrayList;
022:        import java.util.List;
023:        import java.util.Locale;
024:
025:        import javax.xml.bind.Unmarshaller;
026:        import javax.xml.bind.annotation.XmlAttribute;
027:        import javax.xml.bind.annotation.XmlElement;
028:        import javax.xml.bind.annotation.XmlRootElement;
029:        import javax.xml.bind.annotation.XmlTransient;
030:
031:        import com.nabhinc.util.StringUtil;
032:
033:        /**
034:         * 
035:         *
036:         * @author Padmanabh Dabke
037:         * (c) 2006 Nabh Information Systems, Inc. All Rights Reserved.
038:         */
039:        @XmlRootElement(name="user-preferences")
040:        public class UserPreferences {
041:
042:            public static class PortletPreferenceEntry {
043:                public String name = null;
044:                public String[] values = null;
045:
046:                public PortletPreferenceEntry() {
047:                }
048:
049:                public PortletPreferenceEntry(String n, String[] v) {
050:                    this .name = n;
051:                    this .values = v;
052:                }
053:            }
054:
055:            public static class PortletPreference {
056:                public String portletWindowId = null;
057:                public List<PortletPreferenceEntry> prefList = new ArrayList<PortletPreferenceEntry>();
058:            }
059:
060:            @XmlAttribute(name="name")
061:            private String name = null;
062:
063:            @XmlElement(name="preferred-lang")
064:            private String preferredLang = null;
065:
066:            @XmlElement(name="preferred-country")
067:            private String preferredCountry = null;
068:
069:            @XmlElement(name="timezone")
070:            private String timezone = null;
071:
072:            @XmlElement(name="show-name")
073:            private boolean showName = false;
074:
075:            @XmlElement(name="show-email")
076:            private boolean showEmail = false;
077:
078:            @XmlElement(name="portlet-preference")
079:            private List<PortletPreference> preferenceList = new ArrayList<PortletPreference>();
080:
081:            private transient Locale preferredLocale = null;
082:
083:            @XmlTransient
084:            public Locale getPreferredLocale() {
085:                return this .preferredLocale;
086:            }
087:
088:            public void setPreferredLocale(Locale l) {
089:                if (l == null) {
090:                    this .preferredLang = null;
091:                    this .preferredCountry = null;
092:                    this .preferredLocale = null;
093:                } else {
094:                    this .preferredCountry = l.getCountry();
095:                    this .preferredLang = l.getLanguage();
096:                    this .preferredLocale = l;
097:                }
098:            }
099:
100:            @XmlTransient
101:            public String getName() {
102:                return this .name;
103:            }
104:
105:            public void setName(String n) {
106:                this .name = n;
107:            }
108:
109:            @XmlTransient
110:            public String getPreferredCountry() {
111:                return preferredCountry;
112:            }
113:
114:            public void setPreferredCountry(String preferredCountry) {
115:                this .preferredCountry = preferredCountry;
116:            }
117:
118:            @XmlTransient
119:            public String getPreferredLang() {
120:                return preferredLang;
121:            }
122:
123:            public void setPreferredLang(String preferredLang) {
124:                this .preferredLang = preferredLang;
125:            }
126:
127:            @XmlTransient
128:            public boolean isShowEmail() {
129:                return showEmail;
130:            }
131:
132:            public void setShowEmail(boolean showEmail) {
133:                this .showEmail = showEmail;
134:            }
135:
136:            @XmlTransient
137:            public boolean isShowName() {
138:                return showName;
139:            }
140:
141:            public void setShowName(boolean showName) {
142:                this .showName = showName;
143:            }
144:
145:            /**
146:             * Returns Timezone ID
147:             * @return String representing the timezone ID.
148:             */
149:            @XmlTransient
150:            public String getTimezone() {
151:                return timezone;
152:            }
153:
154:            public void setTimezone(String timezone) {
155:                this .timezone = timezone;
156:            }
157:
158:            public void afterUnmarshal(Unmarshaller um, Object parent) {
159:                if (this .preferredLang != null) {
160:                    if (StringUtil.isNullOrEmpty(preferredCountry))
161:                        this .preferredLocale = new Locale(this .preferredLang);
162:                    else
163:                        this .preferredLocale = new Locale(this .preferredLang,
164:                                this .preferredCountry);
165:                }
166:            }
167:
168:            public void addPortletPreference(PortletPreference pref) {
169:                // Delete old one
170:                removePortletPreference(pref.portletWindowId);
171:                this .preferenceList.add(pref);
172:            }
173:
174:            public void removePortletPreference(String windowId) {
175:                for (int i = 0; i < this .preferenceList.size(); i++) {
176:                    if (this .preferenceList.get(i).portletWindowId
177:                            .equals(windowId)) {
178:                        this .preferenceList.remove(i);
179:                        return;
180:                    }
181:                }
182:            }
183:
184:            public PortletPreference getPortletPreference(String windowId) {
185:                for (int i = 0; i < this.preferenceList.size(); i++) {
186:                    if (this.preferenceList.get(i).portletWindowId
187:                            .equals(windowId)) {
188:                        return this.preferenceList.get(i);
189:                    }
190:                }
191:                return null;
192:            }
193:
194:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.