Source Code Cross Referenced for LongAttributeEditor.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:        // LongAttributeEditor.java
002:        // $Id: LongAttributeEditor.java,v 1.7 2000/08/16 21:37:27 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.TextComponent;
010:        import java.awt.TextField;
011:
012:        import java.awt.event.InputEvent;
013:        import java.awt.event.KeyAdapter;
014:        import java.awt.event.KeyEvent;
015:
016:        import java.util.Properties;
017:
018:        import org.w3c.tools.resources.Attribute;
019:
020:        import org.w3c.jigsaw.admin.RemoteAccessException;
021:        import org.w3c.jigsaw.admin.RemoteResource;
022:
023:        import org.w3c.jigadm.RemoteResourceWrapper;
024:
025:        public class LongAttributeEditor extends AttributeEditor {
026:
027:            class LongListener extends KeyAdapter {
028:
029:                // filter the non-numeric char
030:                public void keyPressed(KeyEvent ke) {
031:                    if (ke.getKeyCode() == KeyEvent.VK_DELETE
032:                            || ke.getKeyCode() == KeyEvent.VK_BACK_SPACE
033:                            || ke.getKeyCode() == KeyEvent.VK_UP
034:                            || ke.getKeyCode() == KeyEvent.VK_DOWN
035:                            || ke.getKeyCode() == KeyEvent.VK_LEFT
036:                            || ke.getKeyCode() == KeyEvent.VK_RIGHT)
037:                        return;
038:                    if (!(ke.getKeyChar() >= '0' && ke.getKeyChar() <= '9')) {
039:                        ke.consume();
040:                    }
041:                }
042:            }
043:
044:            private String origs;
045:            TextField widget;
046:
047:            /**
048:             * Tells if the edited value has changed
049:             * @return true if the value changed.
050:             */
051:
052:            public boolean hasChanged() {
053:                return !origs.equals(widget.getText());
054:            }
055:
056:            /**
057:             * set the current value to be the original value, ie: changed
058:             * must return <strong>false</strong> after a reset.
059:             */
060:
061:            public void clearChanged() {
062:                origs = widget.getText();
063:            }
064:
065:            /**
066:             * reset the changes (if any)
067:             */
068:
069:            public void resetChanges() {
070:                widget.setText(origs);
071:            }
072:
073:            /**
074:             * Get the current value of the edited value
075:             * @return an object or <strong>null</strong> if the object was not
076:             * initialized
077:             */
078:
079:            public Object getValue() {
080:                return new Long(Long.parseLong(widget.getText()));
081:            }
082:
083:            /**
084:             * Set the value of the edited value
085:             * @param o the new value.
086:             */
087:
088:            public void setValue(Object o) {
089:                widget.setText(o.toString());
090:            }
091:
092:            /**
093:             * get the Component created by the editor.
094:             * @return a Component
095:             */
096:
097:            public Component getComponent() {
098:                return widget;
099:            }
100:
101:            /**
102:             * Initialize the editor
103:             * @param w the ResourceWrapper father of the attribute
104:             * @param a the Attribute we are editing
105:             * @param o the value of the above attribute
106:             * @param p some Properties, used to fine-tune the editor
107:             * @exception RemoteAccessException if a remote access error occurs.
108:             */
109:
110:            public void initialize(RemoteResourceWrapper w, Attribute a,
111:                    Object o, Properties p) throws RemoteAccessException {
112:                RemoteResource r = w.getResource();
113:                if (o == null) {
114:                    String v = null;
115:                    // FIXME
116:                    v = (String) r.getValue(a.getName());
117:
118:                    if (v == null)
119:                        if (a.getDefault() != null)
120:                            v = a.getDefault().toString();
121:                    if (v != null) {
122:                        origs = v;
123:                        widget.setText(origs);
124:                    }
125:                } else {
126:                    origs = o.toString();
127:                }
128:                widget.setText(origs);
129:            }
130:
131:            public LongAttributeEditor() {
132:                widget = new TextField();
133:                widget.addKeyListener(new LongListener());
134:                origs = "";
135:            }
136:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.