Source Code Cross Referenced for ConfigurationEditorPanel.java in  » Net » Terracotta » org » terracotta » dso » editors » 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 » Net » Terracotta » org.terracotta.dso.editors 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003:         * notice. All rights reserved.
004:         */
005:        package org.terracotta.dso.editors;
006:
007:        import org.apache.xmlbeans.SchemaProperty;
008:        import org.apache.xmlbeans.SchemaStringEnumEntry;
009:        import org.apache.xmlbeans.SchemaType;
010:        import org.apache.xmlbeans.XmlObject;
011:        import org.eclipse.core.resources.IProject;
012:        import org.eclipse.swt.events.DisposeEvent;
013:        import org.eclipse.swt.events.DisposeListener;
014:        import org.eclipse.swt.layout.FillLayout;
015:        import org.eclipse.swt.widgets.Button;
016:        import org.eclipse.swt.widgets.Combo;
017:        import org.eclipse.swt.widgets.Composite;
018:        import org.eclipse.swt.widgets.Spinner;
019:        import org.eclipse.swt.widgets.Text;
020:        import org.terracotta.dso.IConfigurationListener;
021:        import org.terracotta.dso.TcPlugin;
022:        import org.terracotta.dso.editors.xmlbeans.XmlBooleanToggle;
023:        import org.terracotta.dso.editors.xmlbeans.XmlIntegerField;
024:        import org.terracotta.dso.editors.xmlbeans.XmlIntegerSpinner;
025:        import org.terracotta.dso.editors.xmlbeans.XmlObjectStructureChangeEvent;
026:        import org.terracotta.dso.editors.xmlbeans.XmlObjectStructureListener;
027:        import org.terracotta.dso.editors.xmlbeans.XmlStringEnumCombo;
028:        import org.terracotta.dso.editors.xmlbeans.XmlStringField;
029:        import org.terracotta.ui.util.AbstractSWTPanel;
030:        import org.terracotta.ui.util.SWTUtil;
031:
032:        import java.util.ArrayList;
033:
034:        import javax.xml.namespace.QName;
035:
036:        public abstract class ConfigurationEditorPanel extends AbstractSWTPanel
037:                implements  IConfigurationListener, DisposeListener {
038:            private transient ArrayList<XmlObjectStructureListener> m_listenerList;
039:            private transient XmlObjectStructureChangeEvent m_changeEvent;
040:
041:            public ConfigurationEditorPanel(Composite parent, int style) {
042:                super (parent, style);
043:                setLayout(new FillLayout());
044:                addDisposeListener(this );
045:                TcPlugin.getDefault().addConfigurationListener(this );
046:            }
047:
048:            public static void ensureXmlObject(Composite comp) {
049:                ConfigurationEditorPanel parent = (ConfigurationEditorPanel) SWTUtil
050:                        .getAncestorOfClass(ConfigurationEditorPanel.class,
051:                                comp);
052:
053:                if (parent != null) {
054:                    parent.ensureXmlObject();
055:                }
056:            }
057:
058:            public void ensureXmlObject() {
059:                ConfigurationEditorPanel parent = (ConfigurationEditorPanel) SWTUtil
060:                        .getAncestorOfClass(ConfigurationEditorPanel.class,
061:                                this );
062:
063:                if (parent != null) {
064:                    parent.ensureXmlObject();
065:                }
066:            }
067:
068:            private ConfigurationEditorRoot getConfigurationEditorRoot() {
069:                if (this  instanceof  ConfigurationEditorRoot) {
070:                    return (ConfigurationEditorRoot) this ;
071:                } else {
072:                    return (ConfigurationEditorRoot) SWTUtil
073:                            .getAncestorOfClass(ConfigurationEditorRoot.class,
074:                                    this );
075:                }
076:            }
077:
078:            public IProject getProject() {
079:                return getConfigurationEditorRoot().getProject();
080:            }
081:
082:            public synchronized void addXmlObjectStructureListener(
083:                    XmlObjectStructureListener listener) {
084:                if (listener != null) {
085:                    if (m_listenerList == null) {
086:                        m_listenerList = new ArrayList<XmlObjectStructureListener>();
087:                    }
088:                    m_listenerList.add(listener);
089:                }
090:            }
091:
092:            public synchronized void removeXmlObjectStructureListener(
093:                    XmlObjectStructureListener listener) {
094:                if (listener != null) {
095:                    if (m_listenerList != null) {
096:                        m_listenerList.remove(listener);
097:                    }
098:                }
099:            }
100:
101:            private XmlObjectStructureChangeEvent getChangeEvent(
102:                    XmlObject source) {
103:                if (m_changeEvent == null) {
104:                    m_changeEvent = new XmlObjectStructureChangeEvent(source);
105:                } else {
106:                    m_changeEvent.setXmlObject(source);
107:                }
108:
109:                return m_changeEvent;
110:            }
111:
112:            private XmlObjectStructureListener[] getListenerArray() {
113:                return m_listenerList
114:                        .toArray(new XmlObjectStructureListener[0]);
115:            }
116:
117:            protected void fireXmlObjectStructureChanged(
118:                    XmlObjectStructureChangeEvent e) {
119:                if (m_listenerList != null) {
120:                    XmlObjectStructureListener[] listeners = getListenerArray();
121:
122:                    for (int i = 0; i < listeners.length; i++) {
123:                        listeners[i].structureChanged(e);
124:                    }
125:                }
126:            }
127:
128:            protected void fireXmlObjectStructureChanged(XmlObject source) {
129:                fireXmlObjectStructureChanged(getChangeEvent(source));
130:            }
131:
132:            protected int parseInt(String s) {
133:                try {
134:                    return Integer.parseInt(s);
135:                } catch (Exception e) {
136:                    return 0;
137:                }
138:            }
139:
140:            private static SchemaType getParentSchemaType(Class parentType)
141:                    throws Exception {
142:                return (SchemaType) parentType.getField("type").get(null);
143:            }
144:
145:            private static SchemaProperty getSchemaProperty(Class parentType,
146:                    String elementName) throws Exception {
147:                QName qname = QName.valueOf(elementName);
148:                SchemaType type = getParentSchemaType(parentType);
149:                SchemaProperty property = type.getElementProperty(qname);
150:                if (property == null)
151:                    property = type.getAttributeProperty(qname);
152:                return property;
153:            }
154:
155:            private static SchemaType getPropertySchemaType(Class parentType,
156:                    String elementName) throws Exception {
157:                return getSchemaProperty(parentType, elementName).getType();
158:            }
159:
160:            static String[] getListDefaults(Class parentType, String elementName) {
161:                try {
162:                    SchemaStringEnumEntry[] enumEntries = getPropertySchemaType(
163:                            parentType, elementName).getStringEnumEntries();
164:                    String[] values = new String[enumEntries.length];
165:                    for (int i = 0; i < enumEntries.length; i++) {
166:                        values[i] = enumEntries[i].getString();
167:                    }
168:                    return values;
169:                } catch (Exception e) {
170:                    return new String[0];
171:                }
172:            }
173:
174:            void initStringField(Text field, Class parentType, String fieldName) {
175:                XmlStringField xmlField = new XmlStringField(field);
176:                field.setData(xmlField);
177:                xmlField.init(parentType, fieldName);
178:            }
179:
180:            void initIntegerField(Text field, Class parentType, String fieldName) {
181:                XmlIntegerField xmlField = new XmlIntegerField(field);
182:                field.setData(xmlField);
183:                xmlField.init(parentType, fieldName);
184:            }
185:
186:            void initBooleanField(Button field, Class parentType,
187:                    String fieldName) {
188:                XmlBooleanToggle xmlField = new XmlBooleanToggle(field);
189:                field.setData(xmlField);
190:                xmlField.init(parentType, fieldName);
191:            }
192:
193:            void initIntegerSpinnerField(Spinner field, Class parentType,
194:                    String fieldName) {
195:                XmlIntegerSpinner xmlField = new XmlIntegerSpinner(field);
196:                field.setData(xmlField);
197:                xmlField.init(parentType, fieldName);
198:            }
199:
200:            void initStringEnumCombo(Combo field, Class parentType,
201:                    String fieldName) {
202:                XmlStringEnumCombo xmlField = new XmlStringEnumCombo(field);
203:                field.setData(xmlField);
204:                xmlField.init(parentType, fieldName);
205:            }
206:
207:            public void widgetDisposed(DisposeEvent e) {
208:                TcPlugin.getDefault().removeConfigurationListener(this );
209:            }
210:
211:            void fireServerChanged(int index) {
212:                TcPlugin.getDefault().fireServerChanged(getProject(), index);
213:            }
214:
215:            void fireServersChanged() {
216:                TcPlugin.getDefault().fireServersChanged(getProject());
217:            }
218:
219:            void fireRootChanged(int index) {
220:                TcPlugin.getDefault().fireRootChanged(getProject(), index);
221:            }
222:
223:            void fireRootsChanged() {
224:                TcPlugin.getDefault().fireRootsChanged(getProject());
225:            }
226:
227:            void fireDistributedMethodsChanged() {
228:                TcPlugin.getDefault().fireDistributedMethodsChanged(
229:                        getProject());
230:            }
231:
232:            void fireDistributedMethodChanged(int index) {
233:                TcPlugin.getDefault().fireDistributedMethodChanged(
234:                        getProject(), index);
235:            }
236:
237:            void fireBootClassesChanged() {
238:                TcPlugin.getDefault().fireBootClassesChanged(getProject());
239:            }
240:
241:            void fireBootClassChanged(int index) {
242:                TcPlugin.getDefault().fireBootClassChanged(getProject(), index);
243:            }
244:
245:            void fireTransientFieldsChanged() {
246:                TcPlugin.getDefault().fireTransientFieldsChanged(getProject());
247:            }
248:
249:            void fireTransientFieldChanged(int index) {
250:                TcPlugin.getDefault().fireTransientFieldChanged(getProject(),
251:                        index);
252:            }
253:
254:            void fireNamedLockChanged(int index) {
255:                TcPlugin.getDefault().fireNamedLockChanged(getProject(), index);
256:            }
257:
258:            void fireNamedLocksChanged() {
259:                TcPlugin.getDefault().fireNamedLocksChanged(getProject());
260:            }
261:
262:            void fireAutolockChanged(int index) {
263:                try {
264:                    TcPlugin.getDefault().fireAutolockChanged(getProject(),
265:                            index);
266:                } catch (Throwable t) {
267:                    t.printStackTrace();
268:                }
269:            }
270:
271:            void fireAutolocksChanged() {
272:                TcPlugin.getDefault().fireAutolocksChanged(getProject());
273:            }
274:
275:            void fireIncludeRuleChanged(int index) {
276:                TcPlugin.getDefault().fireIncludeRuleChanged(getProject(),
277:                        index);
278:            }
279:
280:            void fireIncludeRulesChanged() {
281:                TcPlugin.getDefault().fireIncludeRulesChanged(getProject());
282:            }
283:
284:            void fireExcludeRuleChanged(int index) {
285:                TcPlugin.getDefault().fireExcludeRuleChanged(getProject(),
286:                        index);
287:            }
288:
289:            void fireExcludeRulesChanged() {
290:                TcPlugin.getDefault().fireExcludeRulesChanged(getProject());
291:            }
292:
293:            void fireInstrumentationRulesChanged() {
294:                TcPlugin.getDefault().fireInstrumentationRulesChanged(
295:                        getProject());
296:            }
297:
298:            void fireClientChanged() {
299:                TcPlugin.getDefault().fireClientChanged(getProject());
300:            }
301:
302:            void fireModuleRepoChanged(int index) {
303:                TcPlugin.getDefault()
304:                        .fireModuleRepoChanged(getProject(), index);
305:            }
306:
307:            void fireModuleReposChanged() {
308:                TcPlugin.getDefault().fireModuleReposChanged(getProject());
309:            }
310:
311:            void fireModuleChanged(int index) {
312:                TcPlugin.getDefault().fireModuleChanged(getProject(), index);
313:            }
314:
315:            void fireModulesChanged() {
316:                TcPlugin.getDefault().fireModulesChanged(getProject());
317:            }
318:
319:            // IConfigurationListener
320:
321:            public void configurationChanged(IProject project) {/**/
322:            }
323:
324:            public void serverChanged(IProject project, int index) {/**/
325:            }
326:
327:            public void serversChanged(IProject project) {/**/
328:            }
329:
330:            public void rootChanged(IProject project, int index) {/**/
331:            }
332:
333:            public void rootsChanged(IProject project) {/**/
334:            }
335:
336:            public void distributedMethodsChanged(IProject project) {/**/
337:            }
338:
339:            public void distributedMethodChanged(IProject project, int index) {/**/
340:            }
341:
342:            public void bootClassesChanged(IProject project) {/**/
343:            }
344:
345:            public void bootClassChanged(IProject project, int index) {/**/
346:            }
347:
348:            public void transientFieldsChanged(IProject project) {/**/
349:            }
350:
351:            public void transientFieldChanged(IProject project, int index) {/**/
352:            }
353:
354:            public void namedLockChanged(IProject project, int index) {/**/
355:            }
356:
357:            public void namedLocksChanged(IProject project) {/**/
358:            }
359:
360:            public void autolockChanged(IProject project, int index) {/**/
361:            }
362:
363:            public void autolocksChanged(IProject project) {/**/
364:            }
365:
366:            public void includeRuleChanged(IProject project, int index) {/**/
367:            }
368:
369:            public void includeRulesChanged(IProject project) {/**/
370:            }
371:
372:            public void excludeRuleChanged(IProject project, int index) {/**/
373:            }
374:
375:            public void excludeRulesChanged(IProject project) {/**/
376:            }
377:
378:            public void instrumentationRulesChanged(IProject project) {/**/
379:            }
380:
381:            public void clientChanged(IProject project) {/**/
382:            }
383:
384:            public void moduleReposChanged(IProject project) {/**/
385:            }
386:
387:            public void moduleRepoChanged(IProject project, int index) {/**/
388:            }
389:
390:            public void moduleChanged(IProject project, int index) {/**/
391:            }
392:
393:            public void modulesChanged(IProject project) {/**/
394:            }
395:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.