Back to index

im-sdk  12.3.91
IIIMComponent.java
Go to the documentation of this file.
00001 /*
00002 Copyright 1990-2001 Sun Microsystems, Inc. All Rights Reserved.
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a
00005 copy of this software and associated documentation files (the
00006 "Software"), to deal in the Software without restriction, including
00007 without limitation the rights to use, copy, modify, merge, publish,
00008 distribute, sublicense, and/or sell copies of the Software, and to
00009 permit persons to whom the Software is furnished to do so, subject to
00010 the following conditions: The above copyright notice and this
00011 permission notice shall be included in all copies or substantial
00012 portions of the Software.
00013 
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00016 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00017 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00018 IN NO EVENT SHALL THE OPEN GROUP OR SUN MICROSYSTEMS, INC. BE LIABLE
00019 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00020 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
00021 THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE EVEN IF
00022 ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
00023 
00024 
00025 Except as contained in this notice, the names of The Open Group and/or
00026 Sun Microsystems, Inc. shall not be used in advertising or otherwise to
00027 promote the sale, use or other dealings in this Software without prior
00028 written authorization from The Open Group and/or Sun Microsystems,
00029 Inc., as applicable.
00030 
00031 
00032 X Window System is a trademark of The Open Group
00033 
00034 OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
00035 logo, LBX, X Window System, and Xinerama are trademarks of the Open
00036 Group. All other trademarks and registered trademarks mentioned herein
00037 are the property of their respective owners. No right, title or
00038 interest in or to any trademark, service mark, logo or trade name of
00039 Sun Microsystems, Inc. or its licensors is granted.
00040 
00041 */
00042 
00043 package com.sun.iiim;
00044 
00045 import java.lang.Character.Subset;
00046 import java.util.Locale;
00047 import java.awt.AWTEvent;
00048 import java.awt.Component;
00049 import java.awt.im.InputContext;
00050 import java.net.URL;
00051 import javax.swing.ImageIcon;
00052 
00053 import java.awt.im.spi.InputMethodContext;
00054 
00055 import sun.awt.im.InputMethodAdapter;
00056 import sun.awt.im.iiimp.*;
00057 
00064 public abstract class IIIMComponent extends InputMethodAdapter
00065        implements IIIMListener {
00066 
00067     private Manager manager;
00068 
00069     protected void dispatchActionEvent(IIIMActionEvent e) {
00070        if (manager == null) {
00071            manager = Manager.getInstance();
00072        }
00073 
00074        manager.dispatchActionEvent(e);
00075     }
00076 
00084     protected void dispatchAuxEvent(IIIMAuxEvent e) {
00085        if (auxProxy != null) {
00086            auxProxy.dispatchAuxEvent(e);
00087            return;
00088        } 
00089 
00090        if (manager == null) {
00091            manager = Manager.getInstance();
00092        }
00093 
00094        manager.dispatchAuxEvent(e);
00095     }
00096 
00104     protected void dispatchPreeditEvent(IIIMPreeditEvent e) {
00105        if (manager == null) {
00106            manager = Manager.getInstance();
00107        }
00108 
00109        manager.dispatchPreeditEvent(e);
00110     }
00111 
00119     protected void dispatchCommittedEvent(IIIMCommittedEvent e) {
00120        if (manager == null) {
00121            manager = Manager.getInstance();
00122        }
00123 
00124        manager.dispatchCommittedEvent(e);
00125     }
00126 
00134     protected void dispatchLookupEvent(IIIMLookupEvent e) {
00135        if (manager == null) {
00136            manager = Manager.getInstance();
00137        }
00138 
00139        manager.dispatchLookupEvent(e);
00140     }
00141 
00149     protected void dispatchStatusEvent(IIIMStatusEvent e) {
00150        if (manager == null) {
00151            manager = Manager.getInstance();
00152        }
00153 
00154        manager.dispatchStatusEvent(e);
00155     }
00156 
00157     //
00158     
00159     protected void markProcessedUpperListener(IIIMEvent e, IIIMListener l) {
00160        if (manager == null) {
00161            manager = Manager.getInstance();
00162        }
00163 
00164        manager.markProcessedUpperListener(e, l);
00165     }
00166 
00167     protected InputContext getInputContext() {
00168        if (manager == null) {
00169            manager = Manager.getInstance();
00170        }
00171 
00172        Component c = getClientComponent();
00173        if (c != null)
00174            return c.getInputContext();
00175 
00176        return null;
00177     }
00178 
00184     public Component getClientComponent() {
00185        if (manager == null) {
00186            manager = Manager.getInstance();
00187        }
00188        
00189        return manager.getClientComponent();
00190     }
00191 
00192     public ImageIcon getImageIcon(String name) {
00193        if (auxProxy != null) {
00194            return AuxProxy.getLoader().getImageIcon(name);
00195        }
00196        return Manager.getLoader().getImageIcon(name);
00197     }
00198 
00199     public String getString(String name) {
00200        if (auxProxy != null) {
00201            return AuxProxy.getLoader().getString(name);
00202        }
00203        return Manager.getLoader().getString(name);
00204     }
00205 
00206     public URL getURL(String name) {
00207        if (auxProxy != null) {
00208            return AuxProxy.getLoader().getURL(name);
00209        }
00210        return Manager.getLoader().getURL(name);
00211     }
00212 
00213     // IIIMEventListener
00214     public void dispatchEvent(IIIMEvent e) {
00215     }
00216 
00217     public boolean setLocale(Locale locale) {
00218        return true;
00219     }
00220 
00221     public void setCharacterSubsets(Subset[] subsets) {
00222     }
00223 
00224     public void dispatchEvent(AWTEvent event) {
00225     }
00226 
00227     public void activate() {
00228     }
00229 
00230     public void deactivate(boolean isTemporary) {
00231     }
00232 
00233     public void removeNotify() {
00234     }
00235 
00236     public void endComposition() {
00237     }
00238 
00239     public void dispose() {
00240     }
00241 
00242     public Object getControlObject() {
00243        return null;
00244     }
00245 
00246     public Locale getLocale() {
00247        return Locale.getDefault();
00248     }
00249 
00250     public void setInputMethodContext(InputMethodContext context) {
00251     }
00252 
00253     public void setCompositionEnabled(boolean enable) {
00254     }
00255 
00256     public boolean isCompositionEnabled() {
00257        return false;
00258     }
00259 
00260     public void hideWindows() {
00261     }
00262 
00263     protected AuxProxy auxProxy;
00264 
00265     public void setProxy(AuxProxy proxy) {
00266        auxProxy = proxy;
00267     }
00268 
00269 }