Source Code Cross Referenced for HoSwingInputField.java in  » J2EE » WiSerFramework » de » ug2t » channel » ho » client » swing » 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 » J2EE » WiSerFramework » de.ug2t.channel.ho.client.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // @@
002:        // @@
003:        /*
004:         * Wi.Ser Framework
005:         *
006:         * LGPL Version: 1.8.1, 20-September-2007  
007:         * Copyright (C) 2005-2006 Dirk von der Weiden <dvdw@imail.de>
008:         *
009:         * This library is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU Lesser General Public
011:         * License as published by the Free Software Foundation; either
012:         * version 2 of the License, or (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library located in LGPL.txt in the 
021:         * license directory; if not, write to the 
022:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023:         * Boston, MA  02111-1307, USA.
024:         * 
025:         * If this agreement does not cover your requirements, please contact us
026:         * via email to get detailed information about the commercial license 
027:         * or our service offerings!
028:         *
029:         */
030:        // @@
031:        package de.ug2t.channel.ho.client.swing;
032:
033:        import java.awt.event.*;
034:
035:        import javax.swing.*;
036:        import javax.swing.text.*;
037:
038:        import de.ug2t.kernel.*;
039:        import de.ug2t.unifiedGui.interfaces.*;
040:
041:        public final class HoSwingInputField extends HoSwingComponent implements 
042:                IUnInputField, IUnSyncComponent {
043:            protected JTextField pdm_swingObj = null;
044:            private int pem_maxLen = 0;
045:            private int pem_maxSize = 0;
046:            protected char[] pdm_validSigns = null;
047:
048:            class MyTextField extends JTextField {
049:                public MyTextField() {
050:                    super ();
051:                }
052:
053:                public MyTextField(int arg0) {
054:                    super (arg0);
055:                }
056:
057:                public MyTextField(String arg0) {
058:                    super (arg0);
059:                }
060:
061:                public MyTextField(String arg0, int arg1) {
062:                    super (arg0, arg1);
063:                }
064:
065:                public MyTextField(Document arg0, String arg1, int arg2) {
066:                    super (arg0, arg1, arg2);
067:                }
068:
069:                protected void processKeyEvent(KeyEvent arg0) {
070:                    try {
071:                        char l_char = arg0.getKeyChar();
072:
073:                        if (HoSwingInputField.this .pdm_validSigns != null) {
074:                            for (int i = 0; i < HoSwingInputField.this .pdm_validSigns.length; i++)
075:                                if (HoSwingInputField.this .pdm_validSigns[i] == l_char) {
076:                                    super .processKeyEvent(arg0);
077:                                    return;
078:                                }
079:                            arg0.consume();
080:                        }
081:                        super .processKeyEvent(arg0);
082:                    } catch (Exception e) {
083:                        KeLog.pcmf_log("ug2t",
084:                                "error while dispatching key events", this ,
085:                                KeLog.DEBUG);
086:                    }
087:                }
088:            }
089:
090:            public HoSwingInputField(String xName, int xSize, int xLen,
091:                    String xValue, boolean xPwd, IUnApplication xAppl)
092:                    throws Exception {
093:                super (xName, xAppl);
094:
095:                if (xPwd)
096:                    this .pdm_swingObj = new JPasswordField(xValue, xSize);
097:                else
098:                    this .pdm_swingObj = new MyTextField(xValue, xSize);
099:
100:                super .pdm_realSwingCmp = this .pdm_swingObj;
101:
102:                this .pcmf_setLocalValue(xValue);
103:                this .pem_maxLen = xLen;
104:                this .pem_maxSize = xSize;
105:                this .pdm_swingObj.setMinimumSize(this .pdm_swingObj
106:                        .getPreferredSize());
107:
108:                ((HoSwingClient) xAppl).pcmf_addKeyDispatcher(this );
109:
110:                FocusListener l_f = new FocusAdapter() {
111:                    public void focusLost(FocusEvent ev) {
112:                        try {
113:                            if (HoSwingInputField.this .pcmf_isSynced())
114:                                return;
115:
116:                            String l_objName = HoSwingInputField.this 
117:                                    .pcmf_getObjName();
118:
119:                            // Lokale Listener aufrufen
120:                            HoSwingInputField.this 
121:                                    .pcmf_setLocalValue(HoSwingInputField.this .pdm_swingObj
122:                                            .getText());
123:                            HoSwingInputField.this .pcmf_setRefresh();
124:                            HoSwingInputField.this .pcmf_dispatchEvent();
125:
126:                            if (HoSwingInputField.this .pem_session
127:                                    .pcmf_isDisabled())
128:                                return;
129:
130:                            // Werte setzen um diese zum Server zu übertragen
131:                            ((HoSwingPage) HoSwingInputField.this 
132:                                    .pcmf_getAppl().pcmf_getActive())
133:                                    .pcmf_setSubmitValue(l_objName,
134:                                            HoSwingInputField.this 
135:                                                    .pcmf_getValue().toString());
136:                            HoSwingInputField.this .pcmf_addSyncedWidgets(
137:                                    (HoSwingPage) HoSwingInputField.this 
138:                                            .pcmf_getAppl().pcmf_getActive(),
139:                                    HoSwingInputField.this );
140:                            if (HoSwingInputField.this .pcmf_getUnComponent()
141:                                    .pcmf_isSubmit() == true)
142:                                ((HoSwingPage) HoSwingInputField.this 
143:                                        .pcmf_getAppl().pcmf_getActive())
144:                                        .pcmf_submit();
145:                        } catch (Exception e) {
146:                            KeLog.pcmf_logException("ug2t", this , e);
147:                        }
148:                        ;
149:                    };
150:                };
151:                this .pdm_swingObj.addFocusListener(l_f);
152:
153:                return;
154:            };
155:
156:            public int pcmf_getMaxLen() {
157:                return (pem_maxLen);
158:            };
159:
160:            public int pcmf_getSize() {
161:                return (pem_maxSize);
162:            };
163:
164:            public boolean pcmf_isPwd() {
165:                return (this .pdm_swingObj instanceof  JPasswordField);
166:            }
167:
168:            public void pcmf_setValue(Object xValue) {
169:                this .pdm_swingObj.setText(xValue.toString());
170:                this .pcmf_setLocalValue(xValue);
171:
172:                return;
173:            };
174:
175:            public void pcmf_setReadOnly(boolean xReadOnly) {
176:                this .pdm_swingObj.setEditable(!xReadOnly);
177:            }
178:
179:            public boolean pcmf_isReadOnly() {
180:                return (!this .pdm_swingObj.isEditable());
181:            }
182:
183:            private int pem_talign = IUnInputField.TEXT_ALIGN_WEST;
184:
185:            public void pcmf_setTextAlign(int xAlign) {
186:                if (IUnInputField.TEXT_ALIGN_EAST == xAlign)
187:                    this .pdm_swingObj.setHorizontalAlignment(JTextField.RIGHT);
188:                else if (IUnInputField.TEXT_ALIGN_CENTER == xAlign)
189:                    this .pdm_swingObj.setHorizontalAlignment(JTextField.CENTER);
190:                else
191:                    this .pdm_swingObj.setHorizontalAlignment(JTextField.LEFT);
192:
193:                this .pem_talign = xAlign;
194:            }
195:
196:            public int pcmf_getTextAlign() {
197:                return (this .pem_talign);
198:            }
199:
200:            private int pem_syncCnt = 0;
201:
202:            public Object pcmf_getValueToSync() {
203:                return (this .pdm_swingObj.getText());
204:            }
205:
206:            public void pcmf_setSynced() {
207:                this .pem_syncCnt++;
208:            }
209:
210:            public void pcmf_unSync() {
211:                this .pem_syncCnt--;
212:                if (this .pem_syncCnt < 0)
213:                    this .pem_syncCnt = 0;
214:            }
215:
216:            public boolean pcmf_isSynced() {
217:                if (this .pem_syncCnt == 0)
218:                    return (false);
219:                else
220:                    return (true);
221:            }
222:
223:            public void pcmf_setSelectionIntervall(int xBegin, int xLen) {
224:                this .pdm_swingObj.select(xBegin, xBegin + xLen);
225:            }
226:
227:            public void pcmf_setCaretPosition(int xPos) {
228:                this 
229:                        .pcmf_setSelectionInterval(new SelectionInterval(xPos,
230:                                xPos));
231:            }
232:
233:            public void pcmf_setSelectionInterval(SelectionInterval xIntervall) {
234:                throw (new UnsupportedOperationException());
235:            }
236:
237:            public void pcmf_setSelected() {
238:                this .pdm_swingObj.select(0, this .pdm_swingObj.getText()
239:                        .length());
240:            }
241:
242:            public void pcmf_unSelect() {
243:                this .pdm_swingObj.select(0, 0);
244:            }
245:
246:            public void pcmf_setInputFilter(String xSigns) {
247:                this .pdm_validSigns = xSigns.toCharArray();
248:            }
249:
250:            public void pcmf_removeInputFilter() {
251:                this .pdm_validSigns = null;
252:            }
253:
254:            public String pcmf_getInputFilter() {
255:                return (new String(this.pdm_validSigns));
256:            }
257:        };
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.