Source Code Cross Referenced for StringChoiceEditor.java in  » Web-Server » Jigsaw » org » w3c » jigadm » 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 » Web Server » Jigsaw » org.w3c.jigadm.editors 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // StringChoiceEditor.java
002:        // $Id: StringChoiceEditor.java,v 1.6 2000/08/16 21:37:28 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1997.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.jigadm.editors;
007:
008:        import java.awt.Component;
009:        import java.awt.Dimension;
010:
011:        import java.awt.event.TextEvent;
012:        import java.awt.event.TextListener;
013:
014:        import java.util.Hashtable;
015:        import java.util.Properties;
016:
017:        import org.w3c.tools.resources.Attribute;
018:
019:        import org.w3c.jigadm.RemoteResourceWrapper;
020:
021:        import org.w3c.jigsaw.admin.RemoteAccessException;
022:
023:        import org.w3c.tools.widgets.StringChoice;
024:
025:        /**
026:         * An editor for StringChoice attributes.  
027:         * @author Benoit Mahe <bmahe@sophia.inria.fr>
028:         */
029:
030:        public class StringChoiceEditor extends AttributeEditor {
031:
032:            class StringChoiceComponent extends StringChoice implements 
033:                    TextListener {
034:
035:                EditorFeeder feeder = null;
036:                StringChoiceEditor editor = null;
037:
038:                //TextListener
039:                public void textValueChanged(TextEvent e) {
040:                    editor.setModified();
041:                }
042:
043:                StringChoiceComponent(StringChoiceEditor editor,
044:                        String selected, EditorFeeder feeder) {
045:                    super ();
046:                    addTextListener(this );
047:                    this .editor = editor;
048:                    this .feeder = feeder;
049:                    setText(selected);
050:                    removeAll();
051:                    String items[] = feeder.getDefaultItems();
052:                    addItems(items);
053:                }
054:            }
055:
056:            /**
057:             * Properties - The feeder's class name.
058:             */
059:            public static final String FEEDER_CLASS_P = "feeder.class";
060:
061:            protected boolean hasChanged = false;
062:            protected String oldvalue = null;
063:            protected StringChoiceComponent comp = null;
064:
065:            protected Dimension getPopupSize() {
066:                return new Dimension(400, 160);
067:            }
068:
069:            protected void createComponent(EditorFeeder feeder, String selected) {
070:                if (comp == null)
071:                    comp = new StringChoiceComponent(this , selected, feeder);
072:            }
073:
074:            protected void setModified() {
075:                hasChanged = true;
076:            }
077:
078:            /**
079:             * Tells if the edited value has changed
080:             * @return true if the value changed.
081:             */
082:            public boolean hasChanged() {
083:                return hasChanged;
084:            }
085:
086:            /**
087:             * set the current value to be the original value, ie: changed
088:             * must return <strong>false</strong> after a reset.
089:             */
090:            public void clearChanged() {
091:                hasChanged = false;
092:            }
093:
094:            /**
095:             * reset the changes (if any)
096:             */
097:            public void resetChanges() {
098:                hasChanged = false;
099:                comp.setText(oldvalue);
100:            }
101:
102:            /**
103:             * Get the current value of the edited value
104:             * @return an object or <strong>null</strong> if the object was not
105:             * initialized
106:             */
107:            public Object getValue() {
108:                return comp.getText();
109:            }
110:
111:            /**
112:             * Set the value of the edited value
113:             * @param o the new value.
114:             */
115:            public void setValue(Object o) {
116:                this .oldvalue = (String) o;
117:                comp.setText(oldvalue);
118:            }
119:
120:            /**
121:             * get the Component created by the editor.
122:             * @return a Component
123:             */
124:            public Component getComponent() {
125:                return comp;
126:            }
127:
128:            /**
129:             * Initialize the editor
130:             * @param w the ResourceWrapper father of the attribute
131:             * @param a the Attribute we are editing
132:             * @param o the value of the above attribute
133:             * @param p some Properties, used to fine-tune the editor
134:             * @exception RemoteAccessException if a remote access error occurs.
135:             */
136:            public void initialize(RemoteResourceWrapper w, Attribute a,
137:                    Object o, Properties p) throws RemoteAccessException {
138:                // Get the feeder class fromproperties:
139:                EditorFeeder feeder = null;
140:                String feederClass = null;
141:
142:                feederClass = (String) p.get(FEEDER_CLASS_P);
143:                if (feederClass == null)
144:                    throw new RuntimeException(
145:                            "StringChoiceEditor mis-configuration:"
146:                                    + FEEDER_CLASS_P + " property undefined.");
147:                try {
148:                    Class c = Class.forName(feederClass);
149:                    feeder = (EditorFeeder) c.newInstance();
150:                    feeder.initialize(w, p);
151:                } catch (Exception ex) {
152:                    ex.printStackTrace();
153:                    throw new RuntimeException(
154:                            "StringChoiceEditor mis-configured: "
155:                                    + " unable to instantiate " + feederClass
156:                                    + ".");
157:                }
158:                createComponent(feeder, (String) o);
159:                oldvalue = (String) o;
160:            }
161:
162:            public StringChoiceEditor() {
163:                super();
164:            }
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.