Home » apache-harmony-6.0-src-r917296-snapshot » org.apache.harmony.awt » [javadoc | source]

    1   /*
    2    *  Licensed to the Apache Software Foundation (ASF) under one or more
    3    *  contributor license agreements.  See the NOTICE file distributed with
    4    *  this work for additional information regarding copyright ownership.
    5    *  The ASF licenses this file to You under the Apache License, Version 2.0
    6    *  (the "License"); you may not use this file except in compliance with
    7    *  the License.  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    *  Unless required by applicable law or agreed to in writing, software
   12    *  distributed under the License is distributed on an "AS IS" BASIS,
   13    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    */
   17   /**
   18    * @author Pavel Dolgov
   19    */
   20   package org.apache.harmony.awt;
   21   
   22   import java.awt.Component;
   23   import java.awt.Container;
   24   import java.awt.Dialog;
   25   import java.awt.Dimension;
   26   import java.awt.Image;
   27   import java.awt.Insets;
   28   import java.awt.Point;
   29   import java.awt.Rectangle;
   30   import java.awt.Window;
   31   import java.awt.Choice;
   32   import java.lang.reflect.InvocationTargetException;
   33   
   34   import org.apache.harmony.awt.gl.MultiRectArea;
   35   import org.apache.harmony.awt.text.TextFieldKit;
   36   import org.apache.harmony.awt.text.TextKit;
   37   import org.apache.harmony.awt.wtk.NativeWindow;
   38   
   39   
   40   /**
   41    *  The accessor to AWT private API
   42    */
   43   public abstract class ComponentInternals {
   44   
   45       /**
   46        * @return the ComponentInternals instance to serve the requests
   47        */
   48       public static ComponentInternals getComponentInternals() {
   49           return ContextStorage.getComponentInternals();
   50       }
   51   
   52       /**
   53        * This method must be called by AWT to establish the connection
   54        * @param internals - implementation of ComponentInternals created by AWT
   55        */
   56       public static void setComponentInternals(ComponentInternals internals) {
   57           ContextStorage.setComponentInternals(internals);
   58       }
   59   
   60       /**
   61        * The accessor to native resource connected to a component.
   62        * It returns non-<code>null</code> value only if component
   63        * already has the native resource
   64        */
   65       public abstract NativeWindow getNativeWindow(Component component);
   66   
   67       /**
   68        * Connect Window object to existing native resource
   69        * @param nativeWindowId - id of native window to attach
   70        * @return Window object with special behaviour that
   71        * restricts manupulation with that window
   72        */
   73       public abstract Window attachNativeWindow(long nativeWindowId);
   74   
   75       /**
   76        * Start mouse grab in "client" mode.
   77        * All mouse events in AWT components will be reported as usual,
   78        * mouse events that occured outside of AWT components will be sent to
   79        * the window passed as grabWindow parameter. When mouse grab is canceled
   80        * (because of click in non-AWT window or by task switching)
   81        * the whenCanceled callback is called
   82        *
   83        * @param grabWindow - window that will own the grab
   84        * @param whenCanceled - callback called when grab is canceled by user's action
   85        */
   86       public abstract void startMouseGrab(Window grabWindow, Runnable whenCanceled);
   87   
   88       /**
   89        * End mouse grab and resume normal processing of mouse events
   90        */
   91       public abstract void endMouseGrab();
   92   
   93       /**
   94        * Set the <code>popup</code> flag of the window to true.
   95        * This window won't be controlled by window manager on Linux.
   96        * Call this method before the window is shown first time
   97        * @param window - the window that should become popup one
   98        */
   99       public abstract void makePopup(Window window);
  100   
  101       /**
  102        * This method must be called by Graphics at the beginning of drawImage()
  103        * to store image drawing parameters (defined by application developer) in component
  104        *
  105        * @param comp - component that draws the image
  106        * @param image - image to be drawn
  107        * @param destLocation - location of the image upon the component's surface. Never null.
  108        * @param destSize - size of the component's area to be filled with the image.
  109        *                  Equals to null if size parameters omitted in drawImage.
  110        * @param source - area of the image to be drawn on the component.
  111        *                  Equals to null if src parameters omitted in drawImage.
  112        */
  113       public abstract void onDrawImage(Component comp, Image image, Point destLocation,
  114               Dimension destSize, Rectangle source);
  115   
  116       /**
  117        * Sets system's caret position.
  118        * This method should be called by text component to synchronize our caret position
  119        * with system's caret position.
  120        * @param x
  121        * @param y
  122        */
  123       public abstract void setCaretPos(Component c, int x, int y);
  124   
  125       /**
  126        * NEVER USE IT. FORGET IT. IT DOES NOT EXIST.
  127        * See Toolkit.unsafeInvokeAndWait(Runnable).
  128        *
  129        * Accessor for Toolkit.unsafeInvokeAndWait(Runnable) method.
  130        * For use in exceptional cases only.
  131        * Read comments for Toolkit.unsafeInvokeAndWait(Runnable) before use.
  132        */
  133       public abstract void unsafeInvokeAndWait(Runnable runnable)
  134               throws InterruptedException, InvocationTargetException;
  135   
  136       public abstract TextKit getTextKit(Component comp);
  137   
  138       public abstract void setTextKit(Component comp, TextKit kit);
  139   
  140       public abstract TextFieldKit getTextFieldKit(Component comp);
  141   
  142       public abstract void setTextFieldKit(Component comp, TextFieldKit kit);
  143   
  144       /**
  145        * Terminate event dispatch thread, completely destroy AWT context.<br>
  146        * Intended for multi-context mode, in single-context mode does nothing.
  147        *
  148        */
  149       public abstract void shutdown();
  150   
  151       /**
  152        * Sets mouse events preprocessor for event queue
  153        */
  154       public abstract void setMouseEventPreprocessor(MouseEventPreprocessor preprocessor);
  155   
  156       /**
  157        * Create customized Choice using style
  158        */
  159       public abstract Choice createCustomChoice(ChoiceStyle style);
  160   
  161       public abstract Insets getNativeInsets(Window w);
  162   
  163       /**
  164        * Region to be repainted (could be null). Use this in overridden repaint()
  165        */
  166       public abstract MultiRectArea getRepaintRegion(Component c);
  167   
  168       public abstract MultiRectArea subtractPendingRepaintRegion(Component c, MultiRectArea mra);
  169   
  170       /**
  171        * Returns true if the window was at least once painted due to native paint events
  172        */
  173       public abstract boolean wasPainted(Window w);
  174   
  175       /**
  176        * The component's region hidden behind top-level windows
  177        * (belonging to both this Java app and all other apps), and behind
  178        * heavyweight components overlapping with passed component
  179        */
  180       public abstract MultiRectArea getObscuredRegion(Component c);
  181       
  182       /**
  183        * An accessor to Container.addObscuredRegions() method
  184        * @see java.awt.Container#addObscuredRegions(MultiRectArea, Component)
  185        */
  186       public abstract void addObscuredRegions(MultiRectArea mra, Component c,
  187                                               Container container);
  188       
  189       /**
  190        * Makes it possible to call protected Toolkit.setDesktopProperty()
  191        * method from any class outside of java.awt package
  192        */
  193       public abstract void setDesktopProperty(String name, Object value);
  194       
  195       /**
  196        * Makes it possible to start/stop dialog modal loop
  197        * from anywhere outside of java.awt package
  198        */
  199       public abstract void runModalLoop(Dialog dlg);
  200       public abstract void endModalLoop(Dialog dlg);
  201       
  202       /**
  203        * Sets component's visible flag only
  204        * (the component is not actually shown/hidden)
  205        */
  206       public abstract void setVisibleFlag(Component comp, boolean visible);
  207       
  208   }

Home » apache-harmony-6.0-src-r917296-snapshot » org.apache.harmony.awt » [javadoc | source]