Source Code Cross Referenced for InputMethodEvent.java in  » Apache-Harmony-Java-SE » java-package » java » awt » event » 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 » Apache Harmony Java SE » java package » java.awt.event 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:        /**
018:         * @author Michael Danilov
019:         * @version $Revision$
020:         */package java.awt.event;
021:
022:        import java.awt.AWTEvent;
023:        import java.awt.Component;
024:        import java.awt.font.TextHitInfo;
025:        import java.text.AttributedCharacterIterator;
026:
027:        import org.apache.harmony.awt.internal.nls.Messages;
028:
029:        public class InputMethodEvent extends AWTEvent {
030:
031:            private static final long serialVersionUID = 4727190874778922661L;
032:
033:            public static final int INPUT_METHOD_FIRST = 1100;
034:
035:            public static final int INPUT_METHOD_TEXT_CHANGED = 1100;
036:
037:            public static final int CARET_POSITION_CHANGED = 1101;
038:
039:            public static final int INPUT_METHOD_LAST = 1101;
040:
041:            private AttributedCharacterIterator text;
042:            private TextHitInfo visiblePosition;
043:            private TextHitInfo caret;
044:            private int committedCharacterCount;
045:            private long when;
046:
047:            public InputMethodEvent(Component src, int id, TextHitInfo caret,
048:                    TextHitInfo visiblePos) {
049:                this (src, id, null, 0, caret, visiblePos);
050:            }
051:
052:            public InputMethodEvent(Component src, int id,
053:                    AttributedCharacterIterator text, int commitedCharCount,
054:                    TextHitInfo caret, TextHitInfo visiblePos) {
055:                this (src, id, 0l, text, commitedCharCount, caret, visiblePos);
056:            }
057:
058:            public InputMethodEvent(Component src, int id, long when,
059:                    AttributedCharacterIterator text,
060:                    int committedCharacterCount, TextHitInfo caret,
061:                    TextHitInfo visiblePos) {
062:                super (src, id);
063:
064:                if ((id < INPUT_METHOD_FIRST) || (id > INPUT_METHOD_LAST)) {
065:                    // awt.18E=Wrong event id
066:                    throw new IllegalArgumentException(Messages
067:                            .getString("awt.18E")); //$NON-NLS-1$
068:                }
069:                if ((id == CARET_POSITION_CHANGED) && (text != null)) {
070:                    // awt.18F=Text must be null for CARET_POSITION_CHANGED
071:                    throw new IllegalArgumentException(Messages
072:                            .getString("awt.18F")); //$NON-NLS-1$
073:                }
074:                if ((text != null)
075:                        && ((committedCharacterCount < 0) || (committedCharacterCount > (text
076:                                .getEndIndex() - text.getBeginIndex())))) {
077:                    // awt.190=Wrong committedCharacterCount
078:                    throw new IllegalArgumentException(Messages
079:                            .getString("awt.190")); //$NON-NLS-1$
080:                }
081:
082:                this .when = when;
083:                this .text = text;
084:                this .caret = caret;
085:                this .visiblePosition = visiblePos;
086:                this .committedCharacterCount = committedCharacterCount;
087:            }
088:
089:            public TextHitInfo getCaret() {
090:                return caret;
091:            }
092:
093:            public int getCommittedCharacterCount() {
094:                return committedCharacterCount;
095:            }
096:
097:            public AttributedCharacterIterator getText() {
098:                return text;
099:            }
100:
101:            public TextHitInfo getVisiblePosition() {
102:                return visiblePosition;
103:            }
104:
105:            public long getWhen() {
106:                return when;
107:            }
108:
109:            @Override
110:            public void consume() {
111:                super .consume();
112:            }
113:
114:            @Override
115:            public boolean isConsumed() {
116:                return super .isConsumed();
117:            }
118:
119:            @Override
120:            public String paramString() {
121:                /* The format is based on 1.5 release behavior 
122:                 * which can be revealed by the following code:
123:                 * 
124:                 * InputMethodEvent e = new InputMethodEvent(new Component(){},
125:                 *          InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
126:                 *          TextHitInfo.leading(1), TextHitInfo.trailing(2));
127:                 * System.out.println(e);
128:                 */
129:                String typeString = null;
130:
131:                switch (id) {
132:                case INPUT_METHOD_TEXT_CHANGED:
133:                    typeString = "INPUT_METHOD_TEXT_CHANGED"; //$NON-NLS-1$
134:                    break;
135:                case CARET_POSITION_CHANGED:
136:                    typeString = "CARET_POSITION_CHANGED"; //$NON-NLS-1$
137:                    break;
138:                default:
139:                    typeString = "unknown type"; //$NON-NLS-1$
140:                }
141:
142:                return typeString + ",text=" + text + //$NON-NLS-1$
143:                        ",commitedCharCount="
144:                        + committedCharacterCount
145:                        + //$NON-NLS-1$
146:                        ",caret=" + caret
147:                        + ",visiblePosition=" + visiblePosition; //$NON-NLS-1$ //$NON-NLS-2$
148:            }
149:
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.