|
From: <ls...@us...> - 2007-07-07 12:38:29
|
Revision: 3354
http://jnode.svn.sourceforge.net/jnode/?rev=3354&view=rev
Author: lsantha
Date: 2007-07-07 05:38:26 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/src/classpath/java/java/awt/Component.java
trunk/core/src/classpath/java/java/awt/Container.java
trunk/core/src/classpath/java/java/awt/Dialog.java
trunk/core/src/classpath/java/java/awt/EventQueue.java
trunk/core/src/classpath/java/java/awt/Font.java
trunk/core/src/classpath/java/java/awt/FontMetrics.java
trunk/core/src/classpath/java/java/awt/GraphicsConfiguration.java
trunk/core/src/classpath/java/java/awt/PopupMenu.java
trunk/core/src/classpath/java/java/awt/Toolkit.java
trunk/core/src/classpath/java/java/awt/Window.java
trunk/core/src/classpath/java/java/awt/event/MouseEvent.java
trunk/core/src/classpath/java/java/awt/font/GraphicAttribute.java
trunk/core/src/classpath/java/java/awt/font/TextAttribute.java
trunk/core/src/classpath/java/java/awt/font/TransformAttribute.java
trunk/core/src/classpath/java/java/awt/geom/AffineTransform.java
trunk/core/src/classpath/java/java/awt/geom/GeneralPath.java
Modified: trunk/core/src/classpath/java/java/awt/Component.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Component.java 2007-07-07 12:37:26 UTC (rev 3353)
+++ trunk/core/src/classpath/java/java/awt/Component.java 2007-07-07 12:38:26 UTC (rev 3354)
@@ -6095,7 +6095,274 @@
peer.hide();
}
}
-
+
+ //jnode openjdk
+ /**
+ * Enumeration of the common ways the baseline of a component can
+ * change as the size changes. The baseline resize behavior is
+ * primarily for layout managers that need to know how the
+ * position of the baseline changes as the component size changes.
+ * In general the baseline resize behavior will be valid for sizes
+ * greater than or equal to the minimum size (the actual minimum
+ * size; not a developer specified minimum size). For sizes
+ * smaller than the minimum size the baseline may change in a way
+ * other than the baseline resize behavior indicates. Similarly,
+ * as the size approaches <code>Integer.MAX_VALUE</code> and/or
+ * <code>Short.MAX_VALUE</code> the baseline may change in a way
+ * other than the baseline resize behavior indicates.
+ *
+ * @see #getBaselineResizeBehavior
+ * @see #getBaseline(int,int)
+ * @since 1.6
+ */
+ public enum BaselineResizeBehavior {
+ /**
+ * Indicates the baseline remains fixed relative to the
+ * y-origin. That is, <code>getBaseline</code> returns
+ * the same value regardless of the height or width. For example, a
+ * <code>JLabel</code> containing non-empty text with a
+ * vertical alignment of <code>TOP</code> should have a
+ * baseline type of <code>CONSTANT_ASCENT</code>.
+ */
+ CONSTANT_ASCENT,
+
+ /**
+ * Indicates the baseline remains fixed relative to the height
+ * and does not change as the width is varied. That is, for
+ * any height H the difference between H and
+ * <code>getBaseline(w, H)</code> is the same. For example, a
+ * <code>JLabel</code> containing non-empty text with a
+ * vertical alignment of <code>BOTTOM</code> should have a
+ * baseline type of <code>CONSTANT_DESCENT</code>.
+ */
+ CONSTANT_DESCENT,
+
+ /**
+ * Indicates the baseline remains a fixed distance from
+ * the center of the component. That is, for any height H the
+ * difference between <code>getBaseline(w, H)</code> and
+ * <code>H / 2</code> is the same (plus or minus one depending upon
+ * rounding error).
+ * <p>
+ * Because of possible rounding errors it is recommended
+ * you ask for the baseline with two consecutive heights and use
+ * the return value to determine if you need to pad calculations
+ * by 1. The following shows how to calculate the baseline for
+ * any height:
+ * <pre>
+ * Dimension preferredSize = component.getPreferredSize();
+ * int baseline = getBaseline(preferredSize.width,
+ * preferredSize.height);
+ * int nextBaseline = getBaseline(preferredSize.width,
+ * preferredSize.height + 1);
+ * // Amount to add to height when calculating where baseline
+ * // lands for a particular height:
+ * int padding = 0;
+ * // Where the baseline is relative to the mid point
+ * int baselineOffset = baseline - height / 2;
+ * if (preferredSize.height % 2 == 0 &&
+ * baseline != nextBaseline) {
+ * padding = 1;
+ * }
+ * else if (preferredSize.height % 2 == 1 &&
+ * baseline == nextBaseline) {
+ * baselineOffset--;
+ * padding = 1;
+ * }
+ * // The following calculates where the baseline lands for
+ * // the height z:
+ * int calculatedBaseline = (z + padding) / 2 + baselineOffset;
+ * </pre>
+ */
+ CENTER_OFFSET,
+
+ /**
+ * Indicates the baseline resize behavior can not be expressed using
+ * any of the other constants. This may also indicate the baseline
+ * varies with the width of the component. This is also returned
+ * by components that do not have a baseline.
+ */
+ OTHER
+ }
+
+ /**
+ * Returns the baseline. The baseline is measured from the top of
+ * the component. This method is primarily meant for
+ * <code>LayoutManager</code>s to align components along their
+ * baseline. A return value less than 0 indicates this component
+ * does not have a reasonable baseline and that
+ * <code>LayoutManager</code>s should not align this component on
+ * its baseline.
+ * <p>
+ * The default implementation returns -1. Subclasses that support
+ * baseline should override appropriately. If a value >= 0 is
+ * returned, then the component has a valid baseline for any
+ * size >= the minimum size and <code>getBaselineResizeBehavior</code>
+ * can be used to determine how the baseline changes with size.
+ *
+ * @param width the width to get the baseline for
+ * @param height the height to get the baseline for
+ * @return the baseline or < 0 indicating there is no reasonable
+ * baseline
+ * @throws IllegalArgumentException if width or height is < 0
+ * @see #getBaselineResizeBehavior
+ * @see java.awt.FontMetrics
+ * @since 1.6
+ */
+ public int getBaseline(int width, int height) {
+ if (width < 0 || height < 0) {
+ throw new IllegalArgumentException(
+ "Width and height must be >= 0");
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the <code>Window</code> ancestor of the component.
+ * @return Window ancestor of the component or component by itself if it is Window;
+ * null, if component is not a part of window hierarchy
+ */
+ Window getContainingWindow() {
+ return getContainingWindow(this);
+ }
+ /**
+ * Returns the <code>Window</code> ancestor of the component <code>comp</code>.
+ * @return Window ancestor of the component or component by itself if it is Window;
+ * null, if component is not a part of window hierarchy
+ */
+ static Window getContainingWindow(Component comp) {
+ while (comp != null && !(comp instanceof Window)) {
+ comp = comp.getParent();
+ }
+
+ return (Window)comp;
+ }
+
+ /**
+ * Translates absolute coordinates into coordinates in the coordinate
+ * space of this component.
+ */
+ Point pointRelativeToComponent(Point absolute) {
+ Point compCoords = getLocationOnScreen();
+ return new Point(absolute.x - compCoords.x,
+ absolute.y - compCoords.y);
+ }
+
+ /**
+ * Returns an enum indicating how the baseline of the component
+ * changes as the size changes. This method is primarily meant for
+ * layout managers and GUI builders.
+ * <p>
+ * The default implementation returns
+ * <code>BaselineResizeBehavior.OTHER</code>. Subclasses that have a
+ * baseline should override appropriately. Subclasses should
+ * never return <code>null</code>; if the baseline can not be
+ * calculated return <code>BaselineResizeBehavior.OTHER</code>. Callers
+ * should first ask for the baseline using
+ * <code>getBaseline</code> and if a value >= 0 is returned use
+ * this method. It is acceptable for this method to return a
+ * value other than <code>BaselineResizeBehavior.OTHER</code> even if
+ * <code>getBaseline</code> returns a value less than 0.
+ *
+ * @return an enum indicating how the baseline changes as the component
+ * size changes
+ * @see #getBaseline(int, int)
+ * @since 1.6
+ */
+ public BaselineResizeBehavior getBaselineResizeBehavior() {
+ return BaselineResizeBehavior.OTHER;
+ }
+
+ /**
+ * Returns the position of the mouse pointer in this <code>Component</code>'s
+ * coordinate space if the <code>Component</code> is directly under the mouse
+ * pointer, otherwise returns <code>null</code>.
+ * If the <code>Component</code> is not showing on the screen, this method
+ * returns <code>null</code> even if the mouse pointer is above the area
+ * where the <code>Component</code> would be displayed.
+ * If the <code>Component</code> is partially or fully obscured by other
+ * <code>Component</code>s or native windows, this method returns a non-null
+ * value only if the mouse pointer is located above the unobscured part of the
+ * <code>Component</code>.
+ * <p>
+ * For <code>Container</code>s it returns a non-null value if the mouse is
+ * above the <code>Container</code> itself or above any of its descendants.
+ * Use {@link Container#getMousePosition(boolean)} if you need to exclude children.
+ * <p>
+ * Sometimes the exact mouse coordinates are not important, and the only thing
+ * that matters is whether a specific <code>Component</code> is under the mouse
+ * pointer. If the return value of this method is <code>null</code>, mouse
+ * pointer is not directly above the <code>Component</code>.
+ *
+ * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true
+ * @see #isShowing
+ * @see Container#getMousePosition
+ * @return mouse coordinates relative to this <code>Component</code>, or null
+ * @since 1.5
+ */
+ public Point getMousePosition() throws HeadlessException {
+ if (GraphicsEnvironment.isHeadless()) {
+ throw new HeadlessException();
+ }
+
+ PointerInfo pi = (PointerInfo)java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ return MouseInfo.getPointerInfo();
+ }
+ }
+ );
+
+ synchronized (getTreeLock()) {
+ Component inTheSameWindow = findUnderMouseInWindow(pi);
+ if (!isSameOrAncestorOf(inTheSameWindow, true)) {
+ return null;
+ }
+ return pointRelativeToComponent(pi.getLocation());
+ }
+ }
+ /**
+ * Assuming that mouse location is stored in PointerInfo passed
+ * to this method, it finds a Component that is in the same
+ * Window as this Component and is located under the mouse pointer.
+ * If no such Component exists, null is returned.
+ * NOTE: this method should be called under the protection of
+ * tree lock, as it is done in Component.getMousePosition() and
+ * Container.getMousePosition(boolean).
+ */
+ Component findUnderMouseInWindow(PointerInfo pi) {
+ if (!isShowing()) {
+ return null;
+ }
+ Window win = getContainingWindow();
+ if (!Toolkit.getDefaultToolkit().getMouseInfoPeer().isWindowUnderMouse(win)) {
+ return null;
+ }
+ final boolean INCLUDE_DISABLED = true;
+ Point relativeToWindow = win.pointRelativeToComponent(pi.getLocation());
+ Component inTheSameWindow = win.findComponentAt(relativeToWindow.x,
+ relativeToWindow.y,
+ INCLUDE_DISABLED);
+ return inTheSameWindow;
+ }
+
+ boolean isSameOrAncestorOf(Component comp, boolean allowChildren) {
+ return this == comp || (allowChildren && isParentOf(comp));
+ }
+ /**
+ * Check if this component is the child of this container or its children.
+ * Note: this function acquires treeLock
+ * Note: this function traverses children tree only in one Window.
+ * @param comp a component in test, must not be null
+ */
+ private boolean isParentOf(Component comp) {
+ synchronized(getTreeLock()) {
+ while (comp != null && comp != this && !(comp instanceof Window)) {
+ comp = comp.getParent();
+ }
+ return (comp == this);
+ }
+ }
/**
* This class provides accessibility support for subclasses of container.
*
Modified: trunk/core/src/classpath/java/java/awt/Container.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Container.java 2007-07-07 12:37:26 UTC (rev 3353)
+++ trunk/core/src/classpath/java/java/awt/Container.java 2007-07-07 12:38:26 UTC (rev 3354)
@@ -2338,4 +2338,124 @@
}
} // class AccessibleContainerHandler
} // class AccessibleAWTContainer
+
+ //jnode openjdk
+
+ /**
+ * Returns the position of the mouse pointer in this <code>Container</code>'s
+ * coordinate space if the <code>Container</code> is under the mouse pointer,
+ * otherwise returns <code>null</code>.
+ * This method is similar to {@link Component#getMousePosition()} with the exception
+ * that it can take the <code>Container</code>'s children into account.
+ * If <code>allowChildren</code> is <code>false</code>, this method will return
+ * a non-null value only if the mouse pointer is above the <code>Container</code>
+ * directly, not above the part obscured by children.
+ * If <code>allowChildren</code> is <code>true</code>, this method returns
+ * a non-null value if the mouse pointer is above <code>Container</code> or any
+ * of its descendants.
+ *
+ * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true
+ * @param allowChildren true if children should be taken into account
+ * @see Component#getMousePosition
+ * @return mouse coordinates relative to this <code>Component</code>, or null
+ * @since 1.5
+ */
+ public Point getMousePosition(boolean allowChildren) throws HeadlessException {
+ if (GraphicsEnvironment.isHeadless()) {
+ throw new HeadlessException();
+ }
+ PointerInfo pi = (PointerInfo)java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ return MouseInfo.getPointerInfo();
+ }
+ }
+ );
+ synchronized (getTreeLock()) {
+ Component inTheSameWindow = findUnderMouseInWindow(pi);
+ if (isSameOrAncestorOf(inTheSameWindow, allowChildren)) {
+ return pointRelativeToComponent(pi.getLocation());
+ }
+ return null;
+ }
+ }
+
+
+
+ /**
+ * Private version of findComponentAt which has a controllable
+ * behavior. Setting 'ignoreEnabled' to 'false' bypasses disabled
+ * Components during the search. This behavior is used by the
+ * lightweight cursor support in sun.awt.GlobalCursorManager.
+ * The cursor code calls this function directly via native code.
+ *
+ * The addition of this feature is temporary, pending the
+ * adoption of new, public API which exports this feature.
+ */
+ final Component findComponentAt(int x, int y, boolean ignoreEnabled)
+ {
+ if (isRecursivelyVisible()){
+ return findComponentAtImpl(x, y, ignoreEnabled);
+ }
+ return null;
+ }
+
+ /**
+ * Determines whether this component will be displayed on the screen.
+ * @return <code>true</code> if the component and all of its ancestors
+ * until a toplevel window or null parent are visible,
+ * <code>false</code> otherwise
+ */
+ boolean isRecursivelyVisible() {
+ return visible && (parent == null || parent.isRecursivelyVisible());
+ }
+
+ final Component findComponentAtImpl(int x, int y, boolean ignoreEnabled){
+ if (!(contains(x, y) && visible && (ignoreEnabled || enabled))) {
+ return null;
+ }
+ int ncomponents = this.ncomponents;
+ Component component[] = this.component;
+
+ // Two passes: see comment in sun.awt.SunGraphicsCallback
+ for (int i = 0 ; i < ncomponents ; i++) {
+ Component comp = component[i];
+ if (comp != null &&
+ !(comp.peer instanceof LightweightPeer)) {
+ if (comp instanceof Container) {
+ comp = ((Container)comp).findComponentAtImpl(x - comp.x,
+ y - comp.y,
+ ignoreEnabled);
+ } else {
+ comp = comp.locate(x - comp.x, y - comp.y);
+ }
+ if (comp != null && comp.visible &&
+ (ignoreEnabled || comp.enabled))
+ {
+ return comp;
+ }
+ }
+ }
+ for (int i = 0 ; i < ncomponents ; i++) {
+ Component comp = component[i];
+ if (comp != null &&
+ comp.peer instanceof LightweightPeer) {
+ if (comp instanceof Container) {
+ comp = ((Container)comp).findComponentAtImpl(x - comp.x,
+ y - comp.y,
+ ignoreEnabled);
+ } else {
+ comp = comp.locate(x - comp.x, y - comp.y);
+ }
+ if (comp != null && comp.visible &&
+ (ignoreEnabled || comp.enabled))
+ {
+ return comp;
+ }
+ }
+ }
+ return this;
+ }
+
+
} // class Container
Modified: trunk/core/src/classpath/java/java/awt/Dialog.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Dialog.java 2007-07-07 12:37:26 UTC (rev 3353)
+++ trunk/core/src/classpath/java/java/awt/Dialog.java 2007-07-07 12:38:26 UTC (rev 3354)
@@ -552,4 +552,113 @@
{
return next_dialog_number++;
}
+
+ //jnode openjdk
+/**
+ * Modal dialogs block all input to some top-level windows.
+ * Whether a particular window is blocked depends on dialog's type
+ * of modality; this is called the "scope of blocking". The
+ * <code>ModalityType</code> enum specifies modal types and their
+ * associated scopes.
+ *
+ * @see Dialog#getModalityType
+ * @see Dialog#setModalityType
+ * @see Toolkit#isModalityTypeSupported
+ *
+ * @since 1.6
+ */
+ public static enum ModalityType {
+ /**
+ * <code>MODELESS</code> dialog doesn't block any top-level windows.
+ */
+ MODELESS,
+ /**
+ * A <code>DOCUMENT_MODAL</code> dialog blocks input to all top-level windows
+ * from the same document except those from its own child hierarchy.
+ * A document is a top-level window without an owner. It may contain child
+ * windows that, together with the top-level window are treated as a single
+ * solid document. Since every top-level window must belong to some
+ * document, its root can be found as the top-nearest window without an owner.
+ */
+ DOCUMENT_MODAL,
+ /**
+ * An <code>APPLICATION_MODAL</code> dialog blocks all top-level windows
+ * from the same Java application except those from its own child hierarchy.
+ * If there are several applets launched in a browser, they can be
+ * treated either as separate applications or a single one. This behavior
+ * is implementation-dependent.
+ */
+ APPLICATION_MODAL,
+ /**
+ * A <code>TOOLKIT_MODAL</code> dialog blocks all top-level windows run
+ * from the same toolkit except those from its own child hierarchy. If there
+ * are several applets launched in a browser, all of them run with the same
+ * toolkit; thus, a toolkit-modal dialog displayed by an applet may affect
+ * other applets and all windows of the browser instance which embeds the
+ * Java runtime environment for this toolkit.
+ * Special <code>AWTPermission</code> "toolkitModality" must be granted to use
+ * toolkit-modal dialogs. If a <code>TOOLKIT_MODAL</code> dialog is being created
+ * and this permission is not granted, a <code>SecurityException</code> will be
+ * thrown, and no dialog will be created. If a modality type is being changed
+ * to <code>TOOLKIT_MODAL</code> and this permission is not granted, a
+ * <code>SecurityException</code> will be thrown, and the modality type will
+ * be left unchanged.
+ */
+ TOOLKIT_MODAL
+ };
+
+ /**
+ * Default modality type for modal dialogs. The default modality type is
+ * <code>APPLICATION_MODAL</code>. Calling the oldstyle <code>setModal(true)</code>
+ * is equal to <code>setModalityType(DEFAULT_MODALITY_TYPE)</code>.
+ *
+ * @see java.awt.Dialog.ModalityType
+ * @see java.awt.Dialog#setModal
+ *
+ * @since 1.6
+ */
+ public final static ModalityType DEFAULT_MODALITY_TYPE = ModalityType.APPLICATION_MODAL;
+
+ /**
+ * Any top-level window can be marked not to be blocked by modal
+ * dialogs. This is called "modal exclusion". This enum specifies
+ * the possible modal exclusion types.
+ *
+ * @see Window#getModalExclusionType
+ * @see Window#setModalExclusionType
+ * @see Toolkit#isModalExclusionTypeSupported
+ *
+ * @since 1.6
+ */
+ public static enum ModalExclusionType {
+ /**
+ * No modal exclusion.
+ */
+ NO_EXCLUDE,
+ /**
+ * <code>APPLICATION_EXCLUDE</code> indicates that a top-level window
+ * won't be blocked by any application-modal dialogs. Also, it isn't
+ * blocked by document-modal dialogs from outside of its child hierarchy.
+ */
+ APPLICATION_EXCLUDE,
+ /**
+ * <code>TOOLKIT_EXCLUDE</code> indicates that a top-level window
+ * won't be blocked by application-modal or toolkit-modal dialogs. Also,
+ * it isn't blocked by document-modal dialogs from outside of its
+ * child hierarchy.
+ * The "toolkitModality" <code>AWTPermission</code> must be granted
+ * for this exclusion. If an exclusion property is being changed to
+ * <code>TOOLKIT_EXCLUDE</code> and this permission is not granted, a
+ * <code>SecurityEcxeption</code> will be thrown, and the exclusion
+ * property will be left unchanged.
+ */
+ TOOLKIT_EXCLUDE
+ };
+
+ /**
+ * @since 1.6
+ */
+ private final static ModalExclusionType DEFAULT_MODAL_EXCLUSION_TYPE =
+ ModalExclusionType.APPLICATION_EXCLUDE;
+
}
Modified: trunk/core/src/classpath/java/java/awt/EventQueue.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/EventQueue.java 2007-07-07 12:37:26 UTC (rev 3353)
+++ trunk/core/src/classpath/java/java/awt/EventQueue.java 2007-07-07 12:38:26 UTC (rev 3354)
@@ -49,6 +49,7 @@
import java.awt.peer.ComponentPeer;
import java.awt.peer.LightweightPeer;
import java.lang.reflect.InvocationTargetException;
+import java.lang.ref.WeakReference;
import java.util.EmptyStackException;
/* Written using on-line Java 2 Platform Standard Edition v1.3 API
@@ -665,4 +666,46 @@
return System.currentTimeMillis();
return eq.lastWhen;
}
+
+ //jnode openjdk
+ static void setCurrentEventAndMostRecentTime(AWTEvent e) {
+ Toolkit.getEventQueue().setCurrentEventAndMostRecentTimeImpl(e);
+ }
+ private synchronized void setCurrentEventAndMostRecentTimeImpl(AWTEvent e)
+ {
+ if (Thread.currentThread() != dispatchThread) {
+ return;
+ }
+
+ currentEvent = e;
+
+ // This series of 'instanceof' checks should be replaced with a
+ // polymorphic type (for example, an interface which declares a
+ // getWhen() method). However, this would require us to make such
+ // a type public, or to place it in sun.awt. Both of these approaches
+ // have been frowned upon. So for now, we hack.
+ //
+ // In tiger, we will probably give timestamps to all events, so this
+ // will no longer be an issue.
+ long mostRecentEventTime2 = Long.MIN_VALUE;
+ if (e instanceof InputEvent) {
+ InputEvent ie = (InputEvent)e;
+ mostRecentEventTime2 = ie.getWhen();
+ } else if (e instanceof InputMethodEvent) {
+ InputMethodEvent ime = (InputMethodEvent)e;
+ mostRecentEventTime2 = ime.getWhen();
+ } else if (e instanceof ActionEvent) {
+ ActionEvent ae = (ActionEvent)e;
+ mostRecentEventTime2 = ae.getWhen();
+ } else if (e instanceof InvocationEvent) {
+ InvocationEvent ie = (InvocationEvent)e;
+ mostRecentEventTime2 = ie.getWhen();
+ }
+ mostRecentEventTime = Math.max(mostRecentEventTime, mostRecentEventTime2);
+ }
+ /*
+ * The time stamp of the last dispatched InputEvent or ActionEvent.
+ */
+ private long mostRecentEventTime = System.currentTimeMillis();
+
}
Modified: trunk/core/src/classpath/java/java/awt/Font.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Font.java 2007-07-07 12:37:26 UTC (rev 3353)
+++ trunk/core/src/classpath/java/java/awt/Font.java 2007-07-07 12:38:26 UTC (rev 3354)
@@ -61,6 +61,31 @@
import java.util.Locale;
import java.util.Map;
import java.util.StringTokenizer;
+import sun.font.Font2DHandle;
+import sun.font.AttributeValues;
+import static sun.font.EAttribute.EFONT;
+import static sun.font.EAttribute.EFAMILY;
+import static sun.font.EAttribute.EWEIGHT;
+import static sun.font.EAttribute.EWIDTH;
+import static sun.font.EAttribute.EPOSTURE;
+import static sun.font.EAttribute.ESIZE;
+import static sun.font.EAttribute.ETRANSFORM;
+import static sun.font.EAttribute.ESUPERSCRIPT;
+import static sun.font.EAttribute.ETRACKING;
+import static sun.font.EAttribute.ECHAR_REPLACEMENT;
+import static sun.font.EAttribute.EFOREGROUND;
+import static sun.font.EAttribute.EBACKGROUND;
+import static sun.font.EAttribute.EUNDERLINE;
+import static sun.font.EAttribute.ESTRIKETHROUGH;
+import static sun.font.EAttribute.ERUN_DIRECTION;
+import static sun.font.EAttribute.EBIDI_EMBEDDING;
+import static sun.font.EAttribute.EJUSTIFICATION;
+import static sun.font.EAttribute.EINPUT_METHOD_HIGHLIGHT;
+import static sun.font.EAttribute.EINPUT_METHOD_UNDERLINE;
+import static sun.font.EAttribute.ESWAP_COLORS;
+import static sun.font.EAttribute.ENUMERIC_SHAPING;
+import static sun.font.EAttribute.EKERNING;
+import static sun.font.EAttribute.ELIGATURES;
/**
* This class represents a windowing system font.
@@ -103,7 +128,49 @@
public static final int HANGING_BASELINE = 2;
- /**
+ //jnode openjdk
+ /**
+ * A String constant for the canonical family name of the
+ * logical font "Dialog". It is useful in Font construction
+ * to provide compile-time verification of the name.
+ * @since 1.6
+ */
+ public static final String DIALOG = "Dialog";
+
+ /**
+ * A String constant for the canonical family name of the
+ * logical font "DialogInput". It is useful in Font construction
+ * to provide compile-time verification of the name.
+ * @since 1.6
+ */
+ public static final String DIALOG_INPUT = "DialogInput";
+
+ /**
+ * A String constant for the canonical family name of the
+ * logical font "SansSerif". It is useful in Font construction
+ * to provide compile-time verification of the name.
+ * @since 1.6
+ */
+ public static final String SANS_SERIF = "SansSerif";
+
+ /**
+ * A String constant for the canonical family name of the
+ * logical font "Serif". It is useful in Font construction
+ * to provide compile-time verification of the name.
+ * @since 1.6
+ */
+ public static final String SERIF = "Serif";
+
+ /**
+ * A String constant for the canonical family name of the
+ * logical font "Monospaced". It is useful in Font construction
+ * to provide compile-time verification of the name.
+ * @since 1.6
+ */
+ public static final String MONOSPACED = "Monospaced";
+
+
+ /**
* Indicates to <code>createFont</code> that the supplied font data
* is in TrueType format.
*
@@ -1376,4 +1443,161 @@
peer = getPeerFromToolkit(name, attrs);
}
+
+ //jnode openjdk
+ /**
+ * Return true if this Font contains attributes that require extra
+ * layout processing.
+ * @return true if the font has layout attributes
+ * @since 1.6
+ */
+ public boolean hasLayoutAttributes() {
+ return hasLayoutAttributes;
+ }
+ private transient boolean hasLayoutAttributes;
+ private transient long pData; // native JDK1.1 font pointer
+ private transient Font2DHandle font2DHandle;
+
+ private transient AttributeValues values;
+
+ /*
+ * This is true if the font transform is not identity. It
+ * is used to avoid unnecessary instantiation of an AffineTransform.
+ */
+ private transient boolean nonIdentityTx;
+
+ /*
+ * If the origin of a Font is a created font then this attribute
+ * must be set on all derived fonts too.
+ */
+ private transient boolean createdFont = false;
+ /**
+ * Creates a new <code>Font</code> from the specified <code>font</code>.
+ * This constructor is intended for use by subclasses.
+ * @param font from which to create this <code>Font</code>.
+ * @throws NullPointerException if <code>font</code> is null
+ * @since 1.6
+ */
+ protected Font(Font font) {
+ if (font.values != null) {
+ initFromValues(font.getAttributeValues().clone());
+ } else {
+ this.name = font.name;
+ this.style = font.style;
+ this.size = font.size;
+ this.pointSize = font.pointSize;
+ }
+ this.font2DHandle = font.font2DHandle;
+ this.createdFont = font.createdFont;
+ }
+
+ /**
+ * Initialize the standard Font fields from the values object.
+ */
+ private void initFromValues(AttributeValues values) {
+ this.values = values;
+ values.defineAll(PRIMARY_MASK); // for 1.5 streaming compatibility
+
+ this.name = values.getFamily();
+ this.pointSize = values.getSize();
+ this.size = (int)(values.getSize() + 0.5);
+ if (values.getWeight() >= 2f) this.style |= BOLD; // not == 2f
+ if (values.getPosture() >= .2f) this.style |= ITALIC; // not == .2f
+
+ this.nonIdentityTx = values.anyNonDefault(EXTRA_MASK);
+ this.hasLayoutAttributes = values.anyNonDefault(LAYOUT_MASK);
+ }
+
+ /**
+ * Return the AttributeValues object associated with this
+ * font. Most of the time, the internal object is null.
+ * If required, it will be created from the 'standard'
+ * state on the font. Only non-default values will be
+ * set in the AttributeValues object.
+ *
+ * <p>Since the AttributeValues object is mutable, and it
+ * is cached in the font, care must be taken to ensure that
+ * it is not mutated.
+ */
+ private AttributeValues getAttributeValues() {
+ if (values == null) {
+ values = new AttributeValues();
+ values.setFamily(name);
+ values.setSize(pointSize); // expects the float value.
+
+ if ((style & BOLD) != 0) {
+ values.setWeight(2); // WEIGHT_BOLD
+ }
+
+ if ((style & ITALIC) != 0) {
+ values.setPosture(.2f); // POSTURE_OBLIQUE
+ }
+ values.defineAll(PRIMARY_MASK); // for streaming compatibility
+ }
+
+ return values;
+ }
+
+ /**
+ * Font recognizes all attributes except FONT.
+ */
+ private static final int RECOGNIZED_MASK = AttributeValues.MASK_ALL
+ & ~AttributeValues.getMask(EFONT);
+
+ /**
+ * These attributes are considered primary by the FONT attribute.
+ */
+ private static final int PRIMARY_MASK =
+ AttributeValues.getMask(EFAMILY, EWEIGHT, EWIDTH, EPOSTURE, ESIZE,
+ ETRANSFORM, ESUPERSCRIPT, ETRACKING);
+
+ /**
+ * These attributes are considered secondary by the FONT attribute.
+ */
+ private static final int SECONDARY_MASK =
+ RECOGNIZED_MASK & ~PRIMARY_MASK;
+
+ /**
+ * These attributes are handled by layout.
+ */
+ private static final int LAYOUT_MASK =
+ AttributeValues.getMask(ECHAR_REPLACEMENT, EFOREGROUND, EBACKGROUND,
+ EUNDERLINE, ESTRIKETHROUGH, ERUN_DIRECTION,
+ EBIDI_EMBEDDING, EJUSTIFICATION,
+ EINPUT_METHOD_HIGHLIGHT, EINPUT_METHOD_UNDERLINE,
+ ESWAP_COLORS, ENUMERIC_SHAPING, EKERNING,
+ ELIGATURES, ETRACKING);
+
+ private static final int EXTRA_MASK =
+ AttributeValues.getMask(ETRANSFORM, ESUPERSCRIPT, EWIDTH);
+
+
+ /**
+ * Checks if this <code>Font</code> has a glyph for the specified
+ * character.
+ *
+ * @param codePoint the character (Unicode code point) for which a glyph
+ * is needed.
+ * @return <code>true</code> if this <code>Font</code> has a glyph for the
+ * character; <code>false</code> otherwise.
+ * @throws IllegalArgumentException if the code point is not a valid Unicode
+ * code point.
+ * @see Character#isValidCodePoint(int)
+ * @since 1.5
+ */
+ public boolean canDisplay(int codePoint) {
+ /*
+ if (!Character.isValidCodePoint(codePoint)) {
+ throw new IllegalArgumentException("invalid code point: " +
+ Integer.toHexString(codePoint));
+ }
+ return getFont2D().canDisplay(codePoint);
+ */
+ if (!Character.isValidCodePoint(codePoint)) {
+ throw new IllegalArgumentException("invalid code point: " +
+ Integer.toHexString(codePoint));
+ }
+ return canDisplay((char) codePoint);
+ }
+
}
Modified: trunk/core/src/classpath/java/java/awt/FontMetrics.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/FontMetrics.java 2007-07-07 12:37:26 UTC (rev 3353)
+++ trunk/core/src/classpath/java/java/awt/FontMetrics.java 2007-07-07 12:38:26 UTC (rev 3354)
@@ -445,4 +445,23 @@
{
return font.hasUniformLineMetrics();
}
+
+ //jnode openjdk
+ /**
+ * Gets the <code>FontRenderContext</code> used by this
+ * <code>FontMetrics</code> object to measure text.
+ * <p>
+ * Note that methods in this class which take a <code>Graphics</code>
+ * parameter measure text using the <code>FontRenderContext</code>
+ * of that <code>Graphics</code> object, and not this
+ * <code>FontRenderContext</code>
+ * @return the <code>FontRenderContext</code> used by this
+ * <code>FontMetrics</code> object.
+ * @since 1.6
+ */
+ public FontRenderContext getFontRenderContext() {
+ return DEFAULT_FRC;
+ }
+ private static final FontRenderContext
+ DEFAULT_FRC = new FontRenderContext(null, false, false);
}
Modified: trunk/core/src/classpath/java/java/awt/GraphicsConfiguration.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/GraphicsConfiguration.java 2007-07-07 12:37:26 UTC (rev 3353)
+++ trunk/core/src/classpath/java/java/awt/GraphicsConfiguration.java 2007-07-07 12:38:26 UTC (rev 3354)
@@ -44,6 +44,7 @@
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.VolatileImage;
+import java.awt.image.WritableRaster;
/**
* This class describes the configuration of various graphics devices, such
@@ -101,19 +102,83 @@
*/
public abstract BufferedImage createCompatibleImage(int w, int h);
- /**
- * Returns a buffered volatile image optimized to this device, so that
- * blitting can be supported in the buffered image. Because the buffer is
- * volatile, it can be optimized by native graphics accelerators.
- *
- * @param w the width of the buffer
- * @param h the height of the buffer
- * @return the buffered image, or null if none is supported
- * @see Component#createVolatileImage(int, int)
- * @since 1.4
- */
- public abstract VolatileImage createCompatibleVolatileImage(int w, int h);
+ //jnode openjdk
+ /**
+ * Returns a {@link VolatileImage} with a data layout and color model
+ * compatible with this <code>GraphicsConfiguration</code>.
+ * The returned <code>VolatileImage</code>
+ * may have data that is stored optimally for the underlying graphics
+ * device and may therefore benefit from platform-specific rendering
+ * acceleration.
+ * @param width the width of the returned <code>VolatileImage</code>
+ * @param height the height of the returned <code>VolatileImage</code>
+ * @return a <code>VolatileImage</code> whose data layout and color
+ * model is compatible with this <code>GraphicsConfiguration</code>.
+ * @see Component#createVolatileImage(int, int)
+ * @since 1.4
+ */
+ public VolatileImage createCompatibleVolatileImage(int width, int height) {
+ VolatileImage vi = null;
+ try {
+ vi = createCompatibleVolatileImage(width, height,
+ null, Transparency.OPAQUE);
+ } catch (AWTException e) {
+ // shouldn't happen: we're passing in null caps
+ assert false;
+ }
+ return vi;
+ }
+ /**
+ * Returns a {@link VolatileImage} with a data layout and color model
+ * compatible with this <code>GraphicsConfiguration</code>.
+ * The returned <code>VolatileImage</code>
+ * may have data that is stored optimally for the underlying graphics
+ * device and may therefore benefit from platform-specific rendering
+ * acceleration.
+ * @param width the width of the returned <code>VolatileImage</code>
+ * @param height the height of the returned <code>VolatileImage</code>
+ * @param transparency the specified transparency mode
+ * @return a <code>VolatileImage</code> whose data layout and color
+ * model is compatible with this <code>GraphicsConfiguration</code>.
+ * @throws IllegalArgumentException if the transparency is not a valid value
+ * @see Transparency#OPAQUE
+ * @see Transparency#BITMASK
+ * @see Transparency#TRANSLUCENT
+ * @see Component#createVolatileImage(int, int)
+ * @since 1.5
+ */
+ public VolatileImage createCompatibleVolatileImage(int width, int height,
+ int transparency)
+ {
+ VolatileImage vi = null;
+ try {
+ vi = createCompatibleVolatileImage(width, height, null, transparency);
+ } catch (AWTException e) {
+ // shouldn't happen: we're passing in null caps
+ assert false;
+ }
+ return vi;
+ }
+
+ public VolatileImage createCompatibleVolatileImage(int width, int height,
+ ImageCapabilities caps, int transparency) throws AWTException
+ {
+ return null;
+ /*
+ VolatileImage vi =
+ new SunVolatileImage(this, width, height, transparency, caps);
+ if (caps != null && caps.isAccelerated() &&
+ !vi.getCapabilities().isAccelerated())
+ {
+ throw new AWTException("Supplied image capabilities could not " +
+ "be met by this graphics configuration.");
+ }
+ return vi;
+ */
+ }
+
+
/**
* Returns a buffered volatile image optimized to this device, and with the
* given capabilities, so that blitting can be supported in the buffered
@@ -134,37 +199,42 @@
throw new AWTException("not implemented");
}
- /**
- * Returns a buffered volatile image optimized to this device, and
- * with the given transparency. Because the buffer is volatile, it
- * can be optimized by native graphics accelerators.
- *
- * @param width the width of the buffer
- * @param height the height of the buffer
- * @param transparency the transparency value for the buffer
- * @return the buffered image, or null if none is supported
- * @since 1.5
- */
- public abstract VolatileImage createCompatibleVolatileImage(int width,
- int height,
- int transparency);
+ /**
+ * Returns a <code>BufferedImage</code> that supports the specified
+ * transparency and has a data layout and color model
+ * compatible with this <code>GraphicsConfiguration</code>. This
+ * method has nothing to do with memory-mapping
+ * a device. The returned <code>BufferedImage</code> has a layout and
+ * color model that can be optimally blitted to a device
+ * with this <code>GraphicsConfiguration</code>.
+ * @param width the width of the returned <code>BufferedImage</code>
+ * @param height the height of the returned <code>BufferedImage</code>
+ * @param transparency the specified transparency mode
+ * @return a <code>BufferedImage</code> whose data layout and color
+ * model is compatible with this <code>GraphicsConfiguration</code>
+ * and also supports the specified transparency.
+ * @throws IllegalArgumentException if the transparency is not a valid value
+ * @see Transparency#OPAQUE
+ * @see Transparency#BITMASK
+ * @see Transparency#TRANSLUCENT
+ */
+ public BufferedImage createCompatibleImage(int width, int height,
+ int transparency)
+ {
+ if (getColorModel().getTransparency() == transparency) {
+ return createCompatibleImage(width, height);
+ }
+ ColorModel cm = getColorModel(transparency);
+ if (cm == null) {
+ throw new IllegalArgumentException("Unknown transparency: " +
+ transparency);
+ }
+ WritableRaster wr = cm.createCompatibleWritableRaster(width, height);
+ return new BufferedImage(cm, wr, cm.isAlphaPremultiplied(), null);
+ }
+
/**
- * Returns a buffered image optimized to this device, and with the specified
- * transparency, so that blitting can be supported in the buffered image.
- *
- * @param w the width of the buffer
- * @param h the height of the buffer
- * @param transparency the transparency of the buffer
- * @return the buffered image, or null if none is supported
- * @see Transparency#OPAQUE
- * @see Transparency#BITMASK
- * @see Transparency#TRANSLUCENT
- */
- public abstract BufferedImage createCompatibleImage(int w, int h,
- int transparency);
-
- /**
* Gets the color model of the corresponding device.
*
* @return the color model
@@ -247,4 +317,5 @@
imageCapabilities = new ImageCapabilities(false);
return imageCapabilities;
}
+
} // class GraphicsConfiguration
Modified: trunk/core/src/classpath/java/java/awt/PopupMenu.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/PopupMenu.java 2007-07-07 12:37:26 UTC (rev 3353)
+++ trunk/core/src/classpath/java/java/awt/PopupMenu.java 2007-07-07 12:38:26 UTC (rev 3354)
@@ -62,6 +62,8 @@
// Serialization Constant
private static final long serialVersionUID = - 4620452533522760060L;
+ //jnode openjdk
+ transient boolean isTrayIconPopup = false;
/*************************************************************************/
Modified: trunk/core/src/classpath/java/java/awt/Toolkit.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Toolkit.java 2007-07-07 12:37:26 UTC (rev 3353)
+++ trunk/core/src/classpath/java/java/awt/Toolkit.java 2007-07-07 12:38:26 UTC (rev 3354)
@@ -81,6 +81,7 @@
import java.awt.peer.TextAreaPeer;
import java.awt.peer.TextFieldPeer;
import java.awt.peer.WindowPeer;
+import java.awt.peer.DesktopPeer;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.File;
@@ -1414,4 +1415,78 @@
}
+ //jnode openjdk
+ private static boolean loaded = false;
+ static void loadLibraries() {
+ /*
+ if (!loaded) {
+ java.security.AccessController.doPrivileged(
+ new sun.security.action.LoadLibraryAction("awt"));
+ loaded = true;
+ }
+ */
+ }
+
+ /* Accessor method for use by AWT package routines. */
+ static EventQueue getEventQueue() {
+ return getDefaultToolkit().getSystemEventQueueImpl();
+ }
+
+ /*
+ * This method notifies any AWTEventListeners that an event
+ * is about to be dispatched.
+ *
+ * @param theEvent the event which will be dispatched.
+ */
+ void notifyAWTEventListeners(AWTEvent theEvent) {
+ // This is a workaround for headless toolkits. It would be
+ // better to override this method but it is declared package private.
+ // "this instanceof" syntax defeats polymorphism.
+ // --mm, 03/03/00
+ if (this instanceof sun.awt.HeadlessToolkit) {
+ ((sun.awt.HeadlessToolkit)this).getUnderlyingToolkit()
+ .notifyAWTEventListeners(theEvent);
+ return;
+ }
+
+ AWTEventListener eventListener = this.eventListener;
+ if (eventListener != null) {
+ eventListener.eventDispatched(theEvent);
+ }
+ }
+ private AWTEventListener eventListener = null;
+
+ /**
+ * Returns whether the given modal exclusion type is supported by this
+ * toolkit. If an unsupported modal exclusion type property is set on a window,
+ * then <code>Dialog.ModalExclusionType.NO_EXCLUDE</code> is used instead.
+ *
+ * @param modalExclusionType modal exclusion type to be checked for support by this toolkit
+ *
+ * @return <code>true</code>, if current toolkit supports given modal exclusion
+ * type, <code>false</code> otherwise
+ *
+ * @see java.awt.Dialog.ModalExclusionType
+ * @see java.awt.Window#getModalExclusionType
+ * @see java.awt.Window#setModalExclusionType
+ *
+ * @since 1.6
+ */
+ public abstract boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType modalExclusionType);
+
+ /**
+ * Creates this toolkit's implementation of the <code>Desktop</code>
+ * using the specified peer interface.
+ * @param target the desktop to be implemented
+ * @return this toolkit's implementation of the <code>Desktop</code>
+ * @exception HeadlessException if GraphicsEnvironment.isHeadless()
+ * returns true
+ * @see java.awt.GraphicsEnvironment#isHeadless
+ * @see java.awt.Desktop
+ * @see java.awt.peer.DesktopPeer
+ * @since 1.6
+ */
+ protected abstract DesktopPeer createDesktopPeer(Desktop target)
+ throws HeadlessException;
+
} // class Toolkit
Modified: trunk/core/src/classpath/java/java/awt/Window.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/Window.java 2007-07-07 12:37:26 UTC (rev 3353)
+++ trunk/core/src/classpath/java/java/awt/Window.java 2007-07-07 12:38:26 UTC (rev 3354)
@@ -54,12 +54,16 @@
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Vector;
+import java.util.Arrays;
+import java.util.ArrayList;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleState;
import javax.accessibility.AccessibleStateSet;
+import sun.security.util.SecurityConstants;
+import sun.awt.AppContext;
/**
* This class represents a top-level window with no decorations.
@@ -1343,4 +1347,214 @@
{
return next_window_number++;
}
+
+ //jnode openjdk
+
+ /**
+ * Specifies the modal exclusion type for this window. If a window is modal
+ * excluded, it is not blocked by some modal dialogs. See {@link
+ * java.awt.Dialog.ModalExclusionType Dialog.ModalExclusionType} for
+ * possible modal exclusion types.
+ * <p>
+ * If the given type is not supported, <code>NO_EXCLUDE</code> is used.
+ * <p>
+ * Note: changing the modal exclusion type for a visible window may have no
+ * effect until it is hidden and then shown again.
+ *
+ * @param exclusionType the modal exclusion type for this window; a <code>null</code>
+ * value is equivivalent to {@link Dialog.ModalExclusionType#NO_EXCLUDE
+ * NO_EXCLUDE}
+ * @throws SecurityException if the calling thread does not have permission
+ * to set the modal exclusion property to the window with the given
+ * <code>exclusionType</code>
+ * @see java.awt.Dialog.ModalExclusionType
+ * @see java.awt.Window#getModalExclusionType
+ * @see java.awt.Toolkit#isModalExclusionTypeSupported
+ *
+ * @since 1.6
+ */
+ public void setModalExclusionType(Dialog.ModalExclusionType exclusionType) {
+ if (exclusionType == null) {
+ exclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
+ }
+ if (!Toolkit.getDefaultToolkit().isModalExclusionTypeSupported(exclusionType)) {
+ exclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
+ }
+ if (modalExclusionType == exclusionType) {
+ return;
+ }
+ if (exclusionType == Dialog.ModalExclusionType.TOOLKIT_EXCLUDE) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(SecurityConstants.TOOLKIT_MODALITY_PERMISSION);
+ }
+ }
+ modalExclusionType = exclusionType;
+
+ // if we want on-fly changes, we need to uncomment the lines below
+ // and override the method in Dialog to use modalShow() instead
+ // of updateChildrenBlocking()
+ /*
+ if (isModalBlocked()) {
+ modalBlocker.unblockWindow(this);
+ }
+ Dialog.checkShouldBeBlocked(this);
+ updateChildrenBlocking();
+ */
+ }
+ /**
+ * @serial
+ *
+ * @see java.awt.Dialog.ModalExclusionType
+ * @see #getModalExclusionType
+ * @see #setModalExclusionType
+ *
+ * @since 1.6
+ */
+ Dialog.ModalExclusionType modalExclusionType;
+
+ /**
+ * Returns the modal exclusion type of this window.
+ *
+ * @return the modal exclusion type of this window
+ *
+ * @see java.awt.Dialog.ModalExclusionType
+ * @see java.awt.Window#setModalExclusionType
+ *
+ * @since 1.6
+ */
+ public Dialog.ModalExclusionType getModalExclusionType() {
+ return modalExclusionType;
+ }
+
+ /**
+ * Determines whether this component will be displayed on the screen.
+ * @return <code>true</code> if the component and all of its ancestors
+ * until a toplevel window are visible, <code>false</code> otherwise
+ */
+ boolean isRecursivelyVisible() {
+ // 5079694 fix: for a toplevel to be displayed, its parent doesn't have to be visible.
+ // We're overriding isRecursivelyVisible to implement this policy.
+ return visible;
+ }
+
+ /**
+ * Returns an array of all {@code Window}s created by this application
+ * that have no owner. They include {@code Frame}s and ownerless
+ * {@code Dialog}s and {@code Window}s.
+ * If called from an applet, the array includes only the {@code Window}s
+ * accessible by that applet.
+ * <p>
+ * <b>Warning:</b> this method may return system created windows, such
+ * as a print dialog. Applications should not assume the existence of
+ * these dialogs, nor should an application assume anything about these
+ * dialogs such as component positions, <code>LayoutManager</code>s
+ * or serialization.
+ *
+ * @see Frame#getFrames
+ * @see Window#getWindows()
+ *
+ * @since 1.6
+ */
+ public static Window[] getOwnerlessWindows() {
+ Window[] allWindows = Window.getWindows();
+
+ int ownerlessCount = 0;
+ for (Window w : allWindows) {
+ if (w.getOwner() == null) {
+ ownerlessCount++;
+ }
+ }
+
+ Window[] ownerless = new Window[ownerlessCount];
+ int c = 0;
+ for (Window w : allWindows) {
+ if (w.getOwner() == null) {
+ ownerless[c++] = w;
+ }
+ }
+
+ return ownerless;
+ }
+
+ /**
+ * Returns an array of all {@code Window}s, both owned and ownerless,
+ * created by this application.
+ * If called from an applet, the array includes only the {@code Window}s
+ * accessible by that applet.
+ * <p>
+ * <b>Warning:</b> this method may return system created windows, such
+ * as a print dialog. Applications should not assume the existence of
+ * these dialogs, nor should an application assume anything about these
+ * dialogs such as component positions, <code>LayoutManager</code>s
+ * or serialization.
+ *
+ * @see Frame#getFrames
+ * @see Window#getOwnerlessWindows
+ *
+ * @since 1.6
+ */
+ public static Window[] getWindows() {
+ return getWindows(AppContext.getAppContext());
+ }
+
+ private static Window[] getWindows(AppContext appContext) {
+ synchronized (Window.class) {
+ Window realCopy[];
+ Vector<WeakReference<Window>> windowList =
+ (Vector<WeakReference<Window>>)appContext.get(Window.class);
+ if (windowList != null) {
+ int fullSize = windowList.size();
+ int realSize = 0;
+ Window fullCopy[] = new Window[fullSize];
+ for (int i = 0; i < fullSize; i++) {
+ Window w = windowList.get(i).get();
+ if (w != null) {
+ fullCopy[realSize++] = w;
+ }
+ }
+ if (fullSize != realSize) {
+ realCopy = Arrays.copyOf(fullCopy, realSize);
+ } else {
+ realCopy = fullCopy;
+ }
+ } else {
+ realCopy = new Window[0];
+ }
+ return realCopy;
+ }
+ }
+
+ /**
+ * Returns the sequence of images to be displayed as the icon for this window.
+ * <p>
+ * This method returns a copy of the internally stored list, so all operations
+ * on the returned object will not affect the window's behavior.
+ *
+ * @return the copy of icon images' list for this window, or
+ * empty list if this window doesn't have icon images.
+ * @see #setIconImages
+ * @see #setIconImage(Image)
+ * @since 1.6
+ */
+ public java.util.List<Image> getIconImages() {
+ java.util.List<Image> icons = this.icons;
+ if (icons == null || icons.size() == 0) {
+ return new ArrayList<Image>();
+ }
+ return new ArrayList<Image>(icons);
+ }
+
+ /**
+ * {@code icons} is the graphical way we can
+ * represent the frames and dialogs.
+ * {@code Window} can't display icon but it's
+ * being inherited by owned {@code Dialog}s.
+ *
+ * @serial
+ * @see #getIconImages
+ * @see #setIconImages(List<? extends Image>)
+ */
+ transient java.util.List<Image> icons;
+
}
\ No newline at end of file
Modified: trunk/core/src/classpath/java/java/awt/event/MouseEvent.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/event/MouseEvent.java 2007-07-07 12:37:26 UTC (rev 3353)
+++ trunk/core/src/classpath/java/java/awt/event/MouseEvent.java 2007-07-07 12:38:26 UTC (rev 3354)
@@ -432,4 +432,249 @@
modifiersEx = EventModifier.extend(modifiers) & EventModifier.NEW_MASK;
}
}
+
+ //jndoe openjdk
+ /**
+ * Returns the absolute horizontal x position of the event.
+ * In a virtual device multi-screen environment in which the
+ * desktop area could span multiple physical screen devices,
+ * this coordinate is relative to the virtual coordinate system.
+ * Otherwise, this coordinate is relative to the coordinate system
+ * associated with the Component's GraphicsConfiguration.
+ *
+ * @return x an integer indicating absolute horizontal position.
+ *
+ * @see java.awt.GraphicsConfiguration
+ * @since 1.6
+ */
+ public int getXOnScreen() {
+ return xAbs;
+ }
+
+ /**
+ * Returns the absolute vertical y position of the event.
+ * In a virtual device multi-screen environment in which the
+ * desktop area could span multiple physical screen devices,
+ * this coordinate is relative to the virtual coordinate system.
+ * Otherwise, this coordinate is relative to the coordinate system
+ * associated with the Component's GraphicsConfiguration.
+ *
+ * @return y an integer indicating absolute vertical position.
+ *
+ * @see java.awt.GraphicsConfiguration
+ * @since 1.6
+ */
+ public int getYOnScreen() {
+ return yAbs;
+ }
+ /**
+ * The mouse event's x absolute coordinate.
+ * In a virtual device multi-screen environment in which the
+ * desktop area could span multiple physical screen devices,
+ * this coordinate is relative to th...
[truncated message content] |