Source Code Cross Referenced for WidgetInfo.java in  » XML-UI » xmlgui » org » beryl » 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 » XML UI » xmlgui » org.beryl.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Beryl - A web platform based on XML, XSLT and Java
003:         * This file is part of the Beryl XML GUI
004:         *
005:         * Copyright (C) 2004 Wenzel Jakob <wazlaf@tigris.org>
006:         *
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU Lesser General Public
009:         * License as published by the Free Software Foundation; either
010:         * version 2.1 of the License, or (at your option) any later version.
011:
012:         * This program is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this program; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-3107  USA
020:         */
021:
022:        package org.beryl.gui;
023:
024:        import java.util.ArrayList;
025:        import java.util.List;
026:
027:        /**
028:         * The WidgetInfo class reveals a widget's available
029:         * properties, presets and events
030:         */
031:
032:        public class WidgetInfo {
033:            private boolean supportsAnchor = true;
034:            private ArrayList properties = null;
035:            private ArrayList presets = null;
036:            private ArrayList events = null;
037:            private Class clazz = null;
038:            private String className = null;
039:
040:            public class PropertyEntry {
041:                public String propertyName;
042:                public String propertyType;
043:                public Object defaultValue;
044:                public String className;
045:
046:                public PropertyEntry() {
047:                    className = WidgetInfo.this .className;
048:                }
049:
050:                public String getDescription() {
051:                    return InternationalizationManager.getString("xmlgui."
052:                            + className + ".property." + propertyName);
053:                }
054:
055:                public String toString() {
056:                    return propertyName + " (" + getDescription() + ")";
057:                }
058:            };
059:
060:            public class PresetEntry {
061:                public String presetName;
062:                public String className;
063:
064:                public PresetEntry() {
065:                    className = WidgetInfo.this .className;
066:                }
067:
068:                public String getDescription() {
069:                    return InternationalizationManager.getString("xmlgui."
070:                            + className + ".preset." + presetName);
071:                }
072:
073:                public String toString() {
074:                    return presetName + " (" + getDescription() + ")";
075:                }
076:            };
077:
078:            public class EventEntry {
079:                public String eventName;
080:                public String className;
081:
082:                public EventEntry() {
083:                    className = WidgetInfo.this .className;
084:                }
085:
086:                public String getDescription() {
087:                    return InternationalizationManager.getString("xmlgui."
088:                            + className + ".event." + eventName);
089:                }
090:
091:                public String toString() {
092:                    return eventName + " (" + getDescription() + ")";
093:                }
094:            };
095:
096:            public WidgetInfo(Class clazz) {
097:                this .clazz = clazz;
098:                properties = new ArrayList();
099:                presets = new ArrayList();
100:                events = new ArrayList();
101:
102:                String fullName = clazz.getName();
103:                className = fullName.substring(fullName.lastIndexOf('.') + 1);
104:            }
105:
106:            public WidgetInfo(Class clazz, WidgetInfo parentInfo) {
107:                this (clazz);
108:
109:                /* Inherit properties */
110:                properties.addAll(parentInfo.getPropertyEntries());
111:                /* Inherit events */
112:                events.addAll(parentInfo.getEventEntries());
113:                /* Presets are not inherited */
114:            }
115:
116:            public List getPropertyEntries() {
117:                return properties;
118:            }
119:
120:            public List getPresetEntries() {
121:                return presets;
122:            }
123:
124:            public PropertyEntry getPropertyEntry(String propertyName)
125:                    throws GUIException {
126:                for (int i = 0; i < properties.size(); i++) {
127:                    PropertyEntry entry = (PropertyEntry) properties.get(i);
128:                    if (entry.propertyName.equals(propertyName))
129:                        return entry;
130:                }
131:                throw new GUIException("No property named [" + propertyName
132:                        + "] could be found for class [" + clazz.getName()
133:                        + "]");
134:            }
135:
136:            public EventEntry getEventEntry(String eventName)
137:                    throws GUIException {
138:                for (int i = 0; i < events.size(); i++) {
139:                    EventEntry entry = (EventEntry) events.get(i);
140:                    if (entry.eventName.equals(eventName))
141:                        return entry;
142:                }
143:                throw new GUIException("No event named [" + eventName
144:                        + "] could be found for class [" + clazz.getName()
145:                        + "]");
146:            }
147:
148:            public List getEventEntries() {
149:                return events;
150:            }
151:
152:            public void addPreset(String presetName) {
153:                PresetEntry entry = new PresetEntry();
154:                entry.presetName = presetName;
155:                presets.add(entry);
156:            }
157:
158:            public void addEvent(String eventName) {
159:                EventEntry entry = new EventEntry();
160:                entry.eventName = eventName;
161:                events.add(entry);
162:            }
163:
164:            public void addProperty(String propertyName, String propertyType) {
165:                addProperty(propertyName, propertyType, null);
166:            }
167:
168:            public void removeProperty(String propertyName) {
169:                for (int i = 0; i < properties.size(); i++) {
170:                    PropertyEntry entry = (PropertyEntry) properties.get(i);
171:                    if (entry.propertyName.equals(propertyName)) {
172:                        properties.remove(i);
173:                        return;
174:                    }
175:                }
176:            }
177:
178:            public void addProperty(String propertyName, String propertyType,
179:                    Object defaultValue) {
180:                PropertyEntry info = new PropertyEntry();
181:                info.propertyName = propertyName;
182:                info.propertyType = propertyType;
183:                info.defaultValue = defaultValue;
184:                properties.add(info);
185:            }
186:
187:            public String getDescription() {
188:                return InternationalizationManager.getString("xmlgui."
189:                        + className);
190:            }
191:
192:            public Class getWidgetClass() {
193:                return clazz;
194:            }
195:
196:            public boolean getSupportsAnchor() {
197:                return supportsAnchor;
198:            }
199:
200:            public void setSupportsAnchor(boolean supportsAnchor) {
201:                this.supportsAnchor = supportsAnchor;
202:            }
203:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.