Source Code Cross Referenced for AbstractGUI.java in  » Content-Management-System » contelligent » de » finix » contelligent » client » gui » 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 » Content Management System » contelligent » de.finix.contelligent.client.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2006 C:1 Financial Services GmbH
003:         *
004:         * This software is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License Version 2.1, as published by the Free Software Foundation.
007:         *
008:         * This software is distributed in the hope that it will be useful,
009:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
010:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011:         * Lesser General Public License for more details.
012:         *
013:         * You should have received a copy of the GNU Lesser General Public
014:         * License along with this library; if not, write to the Free Software
015:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016:         */
017:
018:        package de.finix.contelligent.client.gui;
019:
020:        import java.util.Iterator;
021:        import java.util.List;
022:        import java.util.Map;
023:        import java.util.Vector;
024:
025:        import javax.swing.ImageIcon;
026:
027:        import de.finix.contelligent.client.base.ContelligentComponent;
028:        import de.finix.contelligent.client.base.category.ContelligentCategory;
029:        import de.finix.contelligent.client.base.category.ContelligentCategoryManager;
030:        import de.finix.contelligent.client.base.resource.ContelligentResource;
031:        import de.finix.contelligent.client.base.resource.ContelligentResourceReference;
032:        import de.finix.contelligent.client.i18n.Resources;
033:
034:        public abstract class AbstractGUI implements  GUI {
035:
036:            private boolean root = false;
037:
038:            private View view;
039:
040:            private String configuration;
041:
042:            private ContelligentComponent component;
043:
044:            private Map resourceCategoryMap = null;
045:
046:            private int resourceMode;
047:
048:            private String resourceIdentifier, fallbackResourceIdentifier;
049:
050:            private List<String> defaultedCategories;
051:
052:            // XXX could be abstract, but many GUIs just do nothing here...
053:            public void init() {
054:            }
055:
056:            public boolean hidesSubcomponents() {
057:                return false;
058:            }
059:
060:            public void setView(View view) {
061:                this .view = view;
062:            }
063:
064:            public View getView() {
065:                return view;
066:            }
067:
068:            public String getConfiguration() {
069:                return configuration;
070:            }
071:
072:            public void setConfiguration(String configuration) {
073:                this .configuration = configuration;
074:            }
075:
076:            public GUIConfigurationEditor getGUIConfigurationEditor() {
077:                return new DefaultGUIConfigurationEditor();
078:            }
079:
080:            public void setComponent(ContelligentComponent component) {
081:                this .component = component;
082:            }
083:
084:            public ContelligentComponent getComponent() {
085:                return component;
086:            }
087:
088:            public ImageIcon getIcon() {
089:                return Resources.genericGUI;
090:            }
091:
092:            public boolean isCategorySensitive() {
093:                return false;
094:            }
095:
096:            public void setResourceCategoryMap(Map resourceCategoryMap) {
097:                this .resourceCategoryMap = resourceCategoryMap;
098:            }
099:
100:            public Map getResourceCategoryMap() {
101:                return resourceCategoryMap;
102:            }
103:
104:            public void setResourceMode(int resourceMode) {
105:                this .resourceMode = resourceMode;
106:            }
107:
108:            public int getResourceMode() {
109:                return resourceMode;
110:            }
111:
112:            public boolean isResourceDefined() {
113:                return (getResource() != null);
114:            }
115:
116:            public boolean isResourceSupported() {
117:                Map categoryMap = getResourceCategoryMap();
118:                if (categoryMap == null) {
119:                    return true;
120:                }
121:                List categories = getSensitiveCategories();
122:                if (categories == null) {
123:                    return true;
124:                }
125:                Iterator i = categories.iterator();
126:                while (i.hasNext()) {
127:                    ContelligentCategory contelligentCategory = (ContelligentCategory) i
128:                            .next();
129:                    if (categoryMap.containsKey(contelligentCategory.getName())) {
130:                        return contelligentCategory
131:                                .isValueSupported((String) categoryMap
132:                                        .get(contelligentCategory.getName()));
133:                    }
134:                }
135:                return true;
136:            }
137:
138:            public String getUnsupportedCategory() {
139:                Map categoryMap = getResourceCategoryMap();
140:                List categories = getSensitiveCategories();
141:                Iterator i = categories.iterator();
142:                while (i.hasNext()) {
143:                    ContelligentCategory contelligentCategory = (ContelligentCategory) i
144:                            .next();
145:                    String name = contelligentCategory.getName();
146:                    String value = (String) categoryMap.get(name);
147:                    if (categoryMap.containsKey(name)
148:                            && !contelligentCategory.isValueSupported(value)) {
149:                        return name;
150:                    }
151:                }
152:                return null;
153:            }
154:
155:            public String getUnsupportedCategoryValue() {
156:                Map categoryMap = getResourceCategoryMap();
157:                List categories = getSensitiveCategories();
158:                Iterator i = categories.iterator();
159:                while (i.hasNext()) {
160:                    ContelligentCategory contelligentCategory = (ContelligentCategory) i
161:                            .next();
162:                    String name = contelligentCategory.getName();
163:                    String value = (String) categoryMap.get(name);
164:                    if (categoryMap.containsKey(name)
165:                            && !contelligentCategory.isValueSupported(value)) {
166:                        return value;
167:                    }
168:                }
169:                return null;
170:            }
171:
172:            public boolean isResourceInherited() {
173:                if (getResourceMode() == GUI.TEMPLATE) {
174:                    return (getComponent().getTemplate(getResourceIdentifier()) instanceof  ContelligentResourceReference);
175:                } else {
176:                    return (getComponent().getResource(getResourceIdentifier()) instanceof  ContelligentResourceReference);
177:                }
178:            }
179:
180:            public Map getResourceMap() {
181:                if (getResourceMode() == GUI.TEMPLATE) {
182:                    return (getComponent().getTemplateMap());
183:                } else {
184:                    return (getComponent().getResourceMap());
185:                }
186:            }
187:
188:            public ContelligentResource getResource() {
189:                if (getResourceMode() == GUI.TEMPLATE) {
190:                    Object object = getComponent().getTemplate(
191:                            getResourceIdentifier());
192:                    if (object instanceof  ContelligentResourceReference) {
193:                        return ((ContelligentResourceReference) object)
194:                                .getResource();
195:                    } else {
196:                        return ((ContelligentResource) object);
197:                    }
198:                } else {
199:                    Object object = getComponent().getResource(
200:                            getResourceIdentifier());
201:                    if (object instanceof  ContelligentResourceReference) {
202:                        return ((ContelligentResourceReference) object)
203:                                .getResource();
204:                    } else {
205:                        return ((ContelligentResource) object);
206:                    }
207:                }
208:            }
209:
210:            public void setResource(ContelligentResource resource) {
211:                if (getResourceMode() == GUI.TEMPLATE) {
212:                    getComponent().setTemplate(resource);
213:                    getComponent().completeTemplateMap();
214:                } else {
215:                    getComponent().setResource(resource);
216:                    getComponent().completeResourceMap();
217:                }
218:            }
219:
220:            public String getContraints() {
221:                return getResource().getConstraints();
222:            }
223:
224:            public String getResourceIdentifier() {
225:                if (resourceIdentifier == null) {
226:                    if (getResourceMode() == GUI.TEMPLATE) {
227:                        resourceIdentifier = ContelligentCategoryManager
228:                                .createUniqueCategoryIdentifier(getComponent()
229:                                        .getTemplateCategories(),
230:                                        getResourceCategoryMap());
231:                    } else {
232:                        resourceIdentifier = ContelligentCategoryManager
233:                                .createUniqueCategoryIdentifier(getComponent()
234:                                        .getContentCategories(),
235:                                        getResourceCategoryMap());
236:                    }
237:                }
238:                return resourceIdentifier;
239:            }
240:
241:            /**
242:             * Categories for which a value was specified but to which we are not
243:             * sensitive
244:             */
245:            public List<String> getDefaultedCategoryNames() {
246:                if (defaultedCategories == null) {
247:                    defaultedCategories = new Vector<String>();
248:                    if (getResourceCategoryMap() == null) {
249:                        return defaultedCategories;
250:                    }
251:                    List<ContelligentCategory> definedCategories;
252:                    if (getResourceMode() == GUI.TEMPLATE) {
253:                        definedCategories = getComponent()
254:                                .getTemplateCategories();
255:                    } else {
256:                        definedCategories = getComponent()
257:                                .getContentCategories();
258:                    }
259:                    List<String> definedNames = new Vector<String>();
260:                    Iterator it = definedCategories.iterator();
261:                    while (it.hasNext()) {
262:                        String category = ((ContelligentCategory) it.next())
263:                                .getName();
264:                        definedNames.add(category);
265:                    }
266:                    it = getResourceCategoryMap().keySet().iterator();
267:                    while (it.hasNext()) {
268:                        String specifiedCategoryName = (String) it.next();
269:                        if (!definedNames.contains(specifiedCategoryName)) {
270:                            defaultedCategories.add(specifiedCategoryName);
271:                        }
272:                    }
273:                }
274:                return defaultedCategories;
275:            }
276:
277:            public String getFallbackResourceIdentifier() {
278:                if (fallbackResourceIdentifier == null) {
279:                    if (isResourceInherited()) {
280:                        if (getResourceMode() == GUI.TEMPLATE) {
281:                            ContelligentResourceReference reference = (ContelligentResourceReference) getComponent()
282:                                    .getTemplate(getResourceIdentifier());
283:                            fallbackResourceIdentifier = reference
284:                                    .getFallbackIdentifier();
285:                        } else {
286:                            ContelligentResourceReference reference = (ContelligentResourceReference) getComponent()
287:                                    .getResource(getResourceIdentifier());
288:                            fallbackResourceIdentifier = reference
289:                                    .getFallbackIdentifier();
290:                        }
291:                    } else {
292:                        fallbackResourceIdentifier = getResourceIdentifier();
293:                    }
294:                }
295:                return fallbackResourceIdentifier;
296:            }
297:
298:            public List<ContelligentCategory> getSensitiveCategories() {
299:                if (getResourceMode() == GUI.TEMPLATE) {
300:                    return getComponent().getTemplateCategories();
301:                } else {
302:                    return getComponent().getContentCategories();
303:                }
304:            }
305:
306:            public void setCategories(List<ContelligentCategory> categories) {
307:                if (getResourceMode() == GUI.TEMPLATE) {
308:                    getComponent().setTemplateCategories(categories);
309:                } else {
310:                    getComponent().setContentCategories(categories);
311:                }
312:            }
313:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.