Source Code Cross Referenced for InputMethodHighlight.java in  » 6.0-JDK-Modules » j2me » java » awt » im » 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 » 6.0 JDK Modules » j2me » java.awt.im 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)InputMethodHighlight.java	1.19 03/01/23
003:         *
004:         * Copyright  1990-2006 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation. 
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt). 
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA 
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions. 
025:         */
026:
027:        package java.awt.im;
028:
029:        import java.util.Map;
030:
031:        /**
032:         * An InputMethodHighlight is used to describe the highlight
033:         * attributes of text being composed.
034:         * The description can be at two levels:
035:         * at the abstract level it specifies the conversion state and whether the
036:         * text is selected; at the concrete level it specifies style attributes used
037:         * to render the highlight.
038:         * An InputMethodHighlight must provide the description at the
039:         * abstract level; it may or may not provide the description at the concrete
040:         * level.
041:         * If no concrete style is provided, a renderer should use
042:         * {@link java.awt.Toolkit#mapInputMethodHighlight} to map to a concrete style.
043:         * <p>
044:         * The abstract description consists of three fields: <code>selected</code>,
045:         * <code>state</code>, and <code>variation</code>.
046:         * <code>selected</code> indicates whether the text range is the one that the
047:         * input method is currently working on, for example, the segment for which
048:         * conversion candidates are currently shown in a menu.
049:         * <code>state</code> represents the conversion state. State values are defined
050:         * by the input method framework and should be distinguished in all
051:         * mappings from abstract to concrete styles. Currently defined state values
052:         * are raw (unconverted) and converted.
053:         * These state values are recommended for use before and after the
054:         * main conversion step of text composition, say, before and after kana->kanji
055:         * or pinyin->hanzi conversion.
056:         * The <code>variation</code> field allows input methods to express additional
057:         * information about the conversion results. 
058:         * <p>
059:         * 
060:         * InputMethodHighlight instances are typically used as attribute values
061:         * returned from AttributedCharacterIterator for the INPUT_METHOD_HIGHLIGHT
062:         * attribute. They may be wrapped into {@link java.text.Annotation Annotation}
063:         * instances to indicate separate text segments.
064:         *
065:         * @version 	1.19, 01/23/03
066:         * @see java.text.AttributedCharacterIterator
067:         * @since 1.2
068:         */
069:
070:        public class InputMethodHighlight {
071:
072:            /**
073:             * Constant for the raw text state.
074:             */
075:            public final static int RAW_TEXT = 0;
076:
077:            /**
078:             * Constant for the converted text state.
079:             */
080:            public final static int CONVERTED_TEXT = 1;
081:
082:            /**
083:             * Constant for the default highlight for unselected raw text.
084:             */
085:            public final static InputMethodHighlight UNSELECTED_RAW_TEXT_HIGHLIGHT = new InputMethodHighlight(
086:                    false, RAW_TEXT);
087:
088:            /**
089:             * Constant for the default highlight for selected raw text.
090:             */
091:            public final static InputMethodHighlight SELECTED_RAW_TEXT_HIGHLIGHT = new InputMethodHighlight(
092:                    true, RAW_TEXT);
093:
094:            /**
095:             * Constant for the default highlight for unselected converted text.
096:             */
097:            public final static InputMethodHighlight UNSELECTED_CONVERTED_TEXT_HIGHLIGHT = new InputMethodHighlight(
098:                    false, CONVERTED_TEXT);
099:
100:            /**
101:             * Constant for the default highlight for selected converted text.
102:             */
103:            public final static InputMethodHighlight SELECTED_CONVERTED_TEXT_HIGHLIGHT = new InputMethodHighlight(
104:                    true, CONVERTED_TEXT);
105:
106:            /**
107:             * Constructs an input method highlight record.
108:             * The variation is set to 0, the style to null.
109:             * @param selected Whether the text range is selected
110:             * @param state The conversion state for the text range - RAW_TEXT or CONVERTED_TEXT
111:             * @see InputMethodHighlight#RAW_TEXT
112:             * @see InputMethodHighlight#CONVERTED_TEXT
113:             * @exception IllegalArgumentException if a state other than RAW_TEXT or CONVERTED_TEXT is given
114:             */
115:            public InputMethodHighlight(boolean selected, int state) {
116:                this (selected, state, 0);
117:            }
118:
119:            /**
120:             * Constructs an input method highlight record.
121:             * The style is set to null.
122:             * @param selected Whether the text range is selected
123:             * @param state The conversion state for the text range - RAW_TEXT or CONVERTED_TEXT
124:             * @param variation The style variation for the text range
125:             * @see InputMethodHighlight#RAW_TEXT
126:             * @see InputMethodHighlight#CONVERTED_TEXT
127:             * @exception IllegalArgumentException if a state other than RAW_TEXT or CONVERTED_TEXT is given
128:             */
129:            public InputMethodHighlight(boolean selected, int state,
130:                    int variation) {
131:                this .selected = selected;
132:                if (!(state == RAW_TEXT || state == CONVERTED_TEXT)) {
133:                    throw new IllegalArgumentException(
134:                            "unknown input method highlight state");
135:                }
136:                this .state = state;
137:                this .variation = variation;
138:            }
139:
140:            /**
141:             * Constructs an input method highlight record.
142:             * The style attributes map provided must be unmodifiable.
143:             * @param selected whether the text range is selected
144:             * @param state the conversion state for the text range - RAW_TEXT or CONVERTED_TEXT
145:             * @param variation the variation for the text range
146:             * @param style the rendering style attributes for the text range, or null
147:             * @see InputMethodHighlight#RAW_TEXT
148:             * @see InputMethodHighlight#CONVERTED_TEXT
149:             * @exception IllegalArgumentException if a state other than RAW_TEXT or CONVERTED_TEXT is given
150:             * @since 1.3
151:             */
152:            /*
153:             public InputMethodHighlight(boolean selected, int state, int variation, Map style) {
154:             this.selected = selected;
155:             if (!(state == RAW_TEXT || state == CONVERTED_TEXT)) {
156:             throw new IllegalArgumentException("unknown input method highlight state");
157:             }
158:             this.state = state;
159:             this.variation = variation;
160:             this.style = style;
161:             }
162:             */
163:
164:            /**
165:             * Returns whether the text range is selected.
166:             */
167:            public boolean isSelected() {
168:                return selected;
169:            }
170:
171:            /**
172:             * Returns the conversion state of the text range.
173:             * @return The conversion state for the text range - RAW_TEXT or CONVERTED_TEXT.
174:             * @see InputMethodHighlight#RAW_TEXT
175:             * @see InputMethodHighlight#CONVERTED_TEXT
176:             */
177:            public int getState() {
178:                return state;
179:            }
180:
181:            /**
182:             * Returns the variation of the text range.
183:             */
184:            public int getVariation() {
185:                return variation;
186:            }
187:
188:            /**
189:             * Returns the rendering style attributes for the text range, or null.
190:             * @since 1.3
191:             */
192:            /*
193:             public Map getStyle() {
194:             return style;
195:             }
196:             */
197:
198:            private boolean selected;
199:            private int state;
200:            private int variation;
201:            private Map style;
202:
203:        };
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.