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 import sun.awt.im.InputMethodAdapter;
00053 import sun.awt.im.iiimp.*;
00054 
00061 public abstract class IIIMComponent extends InputMethodAdapter
00062        implements IIIMListener {
00063 
00064     private Manager manager;
00065 
00066     protected void dispatchActionEvent(IIIMActionEvent e) {
00067        if (manager == null) {
00068            manager = Manager.getInstance();
00069        }
00070 
00071        manager.dispatchActionEvent(e);
00072     }
00073 
00081     protected void dispatchAuxEvent(IIIMAuxEvent e) {
00082        if (auxProxy != null) {
00083            auxProxy.dispatchAuxEvent(e);
00084            return;
00085        } 
00086 
00087        if (manager == null) {
00088            manager = Manager.getInstance();
00089        }
00090 
00091        manager.dispatchAuxEvent(e);
00092     }
00093 
00101     protected void dispatchPreeditEvent(IIIMPreeditEvent e) {
00102        if (manager == null) {
00103            manager = Manager.getInstance();
00104        }
00105 
00106        manager.dispatchPreeditEvent(e);
00107     }
00108 
00116     protected void dispatchCommittedEvent(IIIMCommittedEvent e) {
00117        if (manager == null) {
00118            manager = Manager.getInstance();
00119        }
00120 
00121        manager.dispatchCommittedEvent(e);
00122     }
00123 
00131     protected void dispatchLookupEvent(IIIMLookupEvent e) {
00132        if (manager == null) {
00133            manager = Manager.getInstance();
00134        }
00135 
00136        manager.dispatchLookupEvent(e);
00137     }
00138 
00146     protected void dispatchStatusEvent(IIIMStatusEvent e) {
00147        if (manager == null) {
00148            manager = Manager.getInstance();
00149        }
00150 
00151        manager.dispatchStatusEvent(e);
00152     }
00153 
00154     //
00155     
00156     protected void markProcessedUpperListener(IIIMEvent e, IIIMListener l) {
00157        if (manager == null) {
00158            manager = Manager.getInstance();
00159        }
00160 
00161        manager.markProcessedUpperListener(e, l);
00162     }
00163 
00164     protected InputContext getInputContext() {
00165        if (manager == null) {
00166            manager = Manager.getInstance();
00167        }
00168 
00169        Component c = getClientComponent();
00170        if (c != null)
00171            return c.getInputContext();
00172 
00173        return null;
00174     }
00175 
00181     public Component getClientComponent() {
00182        if (manager == null) {
00183            manager = Manager.getInstance();
00184        }
00185        
00186        return manager.getClientComponent();
00187     }
00188 
00189     public ImageIcon getImageIcon(String name) {
00190        if (auxProxy != null) {
00191            return AuxProxy.getLoader().getImageIcon(name);
00192        }
00193        return Manager.getLoader().getImageIcon(name);
00194     }
00195 
00196     public String getString(String name) {
00197        if (auxProxy != null) {
00198            return AuxProxy.getLoader().getString(name);
00199        }
00200        return Manager.getLoader().getString(name);
00201     }
00202 
00203     public URL getURL(String name) {
00204        if (auxProxy != null) {
00205            return AuxProxy.getLoader().getURL(name);
00206        }
00207        return Manager.getLoader().getURL(name);
00208     }
00209 
00210     // IIIMEventListener
00211     public void dispatchEvent(IIIMEvent e) {
00212     }
00213 
00214     public boolean setLocale(Locale locale) {
00215        return true;
00216     }
00217 
00218     public void setCharacterSubsets(Subset[] subsets) {
00219     }
00220 
00221     public void dispatchEvent(AWTEvent event) {
00222     }
00223 
00224     public void activate() {
00225     }
00226 
00227     public void deactivate(boolean isTemporary) {
00228     }
00229 
00230     public void removeNotify() {
00231     }
00232 
00233     public void endComposition() {
00234     }
00235 
00236     public void dispose() {
00237     }
00238 
00239     public Object getControlObject() {
00240        return null;
00241     }
00242 
00243     protected AuxProxy auxProxy;
00244 
00245     public void setProxy(AuxProxy proxy) {
00246        auxProxy = proxy;
00247     }
00248 
00249 }