< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/macosx/CInputMethod.java

Print this page


   1 /*
   2  * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 368     /**
 369         * Returns a control object from this input method, or null. A
 370      * control object provides methods that control the behavior of the
 371      * input method or obtain information from the input method. The type
 372      * of the object is an input method specific class. Clients have to
 373      * compare the result against known input method control object
 374      * classes and cast to the appropriate class to invoke the methods
 375      * provided.
 376      * <p>
 377      * This method is called by
 378      * {@link java.awt.im.InputContext#getInputMethodControlObject InputContext.getInputMethodControlObject}.
 379      *
 380      * @return a control object from this input method, or null
 381      */
 382     public Object getControlObject() {
 383         return null;
 384     }
 385 
 386     // java.awt.Toolkit#getNativeContainer() is not available
 387     //    from this package

 388     private LWComponentPeer<?, ?> getNearestNativePeer(Component comp) {
 389         if (comp==null)
 390             return null;
 391 
 392         ComponentPeer peer = comp.getPeer();
 393         if (peer==null)
 394             return null;
 395 
 396         while (peer instanceof java.awt.peer.LightweightPeer) {
 397             comp = comp.getParent();
 398             if (comp==null)
 399                 return null;
 400             peer = comp.getPeer();
 401             if (peer==null)
 402                 return null;
 403         }
 404 
 405         if (peer instanceof LWComponentPeer)
 406             return (LWComponentPeer)peer;
 407 


   1 /*
   2  * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 368     /**
 369         * Returns a control object from this input method, or null. A
 370      * control object provides methods that control the behavior of the
 371      * input method or obtain information from the input method. The type
 372      * of the object is an input method specific class. Clients have to
 373      * compare the result against known input method control object
 374      * classes and cast to the appropriate class to invoke the methods
 375      * provided.
 376      * <p>
 377      * This method is called by
 378      * {@link java.awt.im.InputContext#getInputMethodControlObject InputContext.getInputMethodControlObject}.
 379      *
 380      * @return a control object from this input method, or null
 381      */
 382     public Object getControlObject() {
 383         return null;
 384     }
 385 
 386     // java.awt.Toolkit#getNativeContainer() is not available
 387     //    from this package
 388     @SuppressWarnings("deprecation")
 389     private LWComponentPeer<?, ?> getNearestNativePeer(Component comp) {
 390         if (comp==null)
 391             return null;
 392 
 393         ComponentPeer peer = comp.getPeer();
 394         if (peer==null)
 395             return null;
 396 
 397         while (peer instanceof java.awt.peer.LightweightPeer) {
 398             comp = comp.getParent();
 399             if (comp==null)
 400                 return null;
 401             peer = comp.getPeer();
 402             if (peer==null)
 403                 return null;
 404         }
 405 
 406         if (peer instanceof LWComponentPeer)
 407             return (LWComponentPeer)peer;
 408 


< prev index next >