You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(97) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(127) |
Feb
(34) |
Mar
(16) |
Apr
(26) |
May
(55) |
Jun
(107) |
Jul
(36) |
Aug
(72) |
Sep
(90) |
Oct
(41) |
Nov
(27) |
Dec
(13) |
| 2008 |
Jan
(37) |
Feb
(39) |
Mar
(98) |
Apr
(115) |
May
(134) |
Jun
(120) |
Jul
(86) |
Aug
(149) |
Sep
(68) |
Oct
(66) |
Nov
(104) |
Dec
(49) |
| 2009 |
Jan
(131) |
Feb
(132) |
Mar
(125) |
Apr
(172) |
May
(161) |
Jun
(43) |
Jul
(47) |
Aug
(38) |
Sep
(18) |
Oct
(6) |
Nov
(1) |
Dec
(15) |
| 2010 |
Jan
(21) |
Feb
(8) |
Mar
(10) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(4) |
| 2011 |
Jan
(23) |
Feb
(10) |
Mar
(13) |
Apr
(3) |
May
|
Jun
(19) |
Jul
(11) |
Aug
(22) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(12) |
| 2012 |
Jan
(3) |
Feb
(4) |
Mar
(7) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(30) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(8) |
| 2013 |
Jan
(3) |
Feb
(40) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(12) |
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
|
From: <ls...@us...> - 2007-07-26 12:54:23
|
Revision: 3368
http://jnode.svn.sourceforge.net/jnode/?rev=3368&view=rev
Author: lsantha
Date: 2007-07-26 05:54:20 -0700 (Thu, 26 Jul 2007)
Log Message:
-----------
Progress with isolates.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2007-07-26 12:53:43 UTC (rev 3367)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2007-07-26 12:54:20 UTC (rev 3368)
@@ -31,6 +31,7 @@
import org.jnode.driver.console.spi.ConsoleOutputStream;
import org.jnode.driver.textscreen.TextScreen;
import org.jnode.system.event.FocusEvent;
+import org.jnode.vm.isolate.VmIsolate;
/**
* @author Ewout Prangsma (ep...@us...)
@@ -68,7 +69,9 @@
private final boolean claimSystemOutErrIn;
- /**
+ private VmIsolate myIsolate;
+
+ /**
* @param mgr
* @param name
* @param screen
@@ -84,7 +87,8 @@
this.savedErr = this.err = new PrintStream(new ConsoleOutputStream(
this, 0x04));
this.claimSystemOutErrIn = ((options & ConsoleManager.CreateOptions.NO_SYSTEM_OUT_ERR_IN) == 0);
- }
+ this.myIsolate = VmIsolate.currentIsolate();
+ }
/**
* Clear the console
@@ -320,13 +324,17 @@
super.focusGained(event);
syncScreen();
if (claimSystemOutErrIn) {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- System.setOut(savedOut);
- System.setErr(savedErr);
- return null;
- }
- });
+ myIsolate.invokeAndWait(new Runnable() {
+ public void run() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ System.setOut(savedOut);
+ System.setErr(savedErr);
+ return null;
+ }
+ });
+ }
+ });
}
}
@@ -335,8 +343,12 @@
*/
public void focusLost(FocusEvent event) {
if (claimSystemOutErrIn) {
- savedOut = System.out;
- savedErr = System.err;
+ myIsolate.invokeAndWait(new Runnable() {
+ public void run() {
+ savedOut = System.out;
+ savedErr = System.err;
+ }
+ });
}
super.focusLost(event);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-26 12:53:45
|
Revision: 3367
http://jnode.svn.sourceforge.net/jnode/?rev=3367&view=rev
Author: lsantha
Date: 2007-07-26 05:53:43 -0700 (Thu, 26 Jul 2007)
Log Message:
-----------
Progress with isolates.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsole.java
Modified: trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsole.java 2007-07-26 12:52:44 UTC (rev 3366)
+++ trunk/core/src/driver/org/jnode/driver/console/spi/AbstractConsole.java 2007-07-26 12:53:43 UTC (rev 3367)
@@ -32,6 +32,8 @@
import org.jnode.driver.input.PointerEvent;
import org.jnode.driver.input.PointerListener;
import org.jnode.system.event.FocusEvent;
+import org.jnode.util.QueueProcessorThread;
+import org.jnode.util.QueueProcessor;
/**
* @author epr
@@ -59,6 +61,7 @@
public AbstractConsole(ConsoleManager mgr, String name) {
this.mgr = mgr;
this.consoleName = name;
+ this.keyboardEventProcessor.start();
}
/**
@@ -180,7 +183,7 @@
*/
public void keyPressed(KeyboardEvent event) {
if (isFocused()) {
- dispatchKeyboardEvent(event);
+ keyboardEventProcessor.getQueue().add(event);
}
}
@@ -190,7 +193,7 @@
*/
public void keyReleased(KeyboardEvent event) {
if (isFocused()) {
- dispatchKeyboardEvent(event);
+ keyboardEventProcessor.getQueue().add(event);
}
}
@@ -208,6 +211,12 @@
public void focusLost(FocusEvent event) {
}
+ private QueueProcessorThread<KeyboardEvent> keyboardEventProcessor = new QueueProcessorThread<KeyboardEvent>("console-keyboard-event-processor", new QueueProcessor<KeyboardEvent>() {
+ public void process(KeyboardEvent event) throws Exception {
+ dispatchKeyboardEvent(event);
+ }
+ });
+
/**
* Dispatch a given keyboard event to all known listeners.
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-26 12:52:47
|
Revision: 3366
http://jnode.svn.sourceforge.net/jnode/?rev=3366&view=rev
Author: lsantha
Date: 2007-07-26 05:52:44 -0700 (Thu, 26 Jul 2007)
Log Message:
-----------
Progress with isolates.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/util/SizeUnit.java
Modified: trunk/core/src/core/org/jnode/util/SizeUnit.java
===================================================================
--- trunk/core/src/core/org/jnode/util/SizeUnit.java 2007-07-26 11:02:26 UTC (rev 3365)
+++ trunk/core/src/core/org/jnode/util/SizeUnit.java 2007-07-26 12:52:44 UTC (rev 3366)
@@ -1,7 +1,9 @@
package org.jnode.util;
import java.math.BigInteger;
+import org.jnode.vm.annotation.SharedStatics;
+@SharedStatics
public enum SizeUnit {
B(1l, "B"),
K(1024l, "K"),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-26 11:02:59
|
Revision: 3365
http://jnode.svn.sourceforge.net/jnode/?rev=3365&view=rev
Author: lsantha
Date: 2007-07-26 04:02:26 -0700 (Thu, 26 Jul 2007)
Log Message:
-----------
Progress with isolates.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
Modified: trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2007-07-26 09:39:03 UTC (rev 3364)
+++ trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2007-07-26 11:02:26 UTC (rev 3365)
@@ -26,6 +26,7 @@
import java.io.PrintStream;
import java.lang.reflect.Method;
import java.util.Properties;
+import java.util.Vector;
import javax.isolate.Isolate;
import javax.isolate.IsolateStartupException;
@@ -35,6 +36,8 @@
import org.jnode.naming.InitialNaming;
import org.jnode.plugin.PluginManager;
import org.jnode.util.BootableHashMap;
+import org.jnode.util.QueueProcessor;
+import org.jnode.util.QueueProcessorThread;
import org.jnode.vm.Unsafe;
import org.jnode.vm.Vm;
import org.jnode.vm.VmArchitecture;
@@ -120,6 +123,7 @@
*
* @author Ewout Prangsma (ep...@us...)
*/
+ @SharedStatics
private enum State {
CREATED, STARTING, STARTED, EXITED, TERMINATED
}
@@ -199,7 +203,7 @@
/**
* Is the current thread running in the root isolate
*/
- public final static boolean isRoot() {
+ public static boolean isRoot() {
VmIsolate result = IsolatedStaticData.current;
if (result != null) {
return (result == StaticData.getRoot());
@@ -210,7 +214,7 @@
/**
* Is the current thread running in the root isolate
*/
- public final static VmIsolate getRoot() {
+ public static VmIsolate getRoot() {
return StaticData.getRoot();
}
@@ -219,7 +223,7 @@
*
* @return
*/
- public final static VmIsolate currentIsolate() {
+ public static VmIsolate currentIsolate() {
VmIsolate result = IsolatedStaticData.current;
if (result == null) {
result = StaticData.getRoot();
@@ -422,11 +426,70 @@
mainThread.start();
}
+ private Vector<Runnable> taskList = new Vector<Runnable>();
+ private final Object taskSync = new Object();
+ private Thread executorThread;
+
+ public void invokeAndWait(final Runnable task){
+ if(this == StaticData.rootIsolate){
+ task.run();
+ return;
+ }
+
+ synchronized(taskSync){
+ taskList.add(task);
+ taskSync.notifyAll();
+ }
+
+ synchronized(task){
+ while(taskList.contains(task)){
+ try {
+ task.wait();
+ }catch(InterruptedException e){
+ //
+ }
+ }
+ }
+ }
+
+ private class TaskExecutor implements Runnable{
+ public void run() {
+ //while(!VmIsolate.this.hasTerminated()){
+ do {
+ Runnable task = null;
+ synchronized(taskSync){
+ try {
+ while(taskList.isEmpty()){
+ taskSync.wait();
+ }
+ try {
+ task = taskList.get(0);
+ task.run();
+ taskList.remove(0);
+ } catch(Throwable t){
+ System.err.println("Error during task execution, dropping task");
+ t.printStackTrace();
+ taskList.remove(0);
+ }
+ }catch(InterruptedException ie){
+ //
+ }
+ }
+ if(task != null)
+ synchronized(task){
+ task.notifyAll();
+ }
+ } while(!hasExited());
+ //} while(true);
+ }
+ }
+
/**
* Run this isolate. This method is called from IsolateThread.
*/
@PrivilegedActionPragma
final void run(IsolateThread thread) {
+ VmIsolate o_current = IsolatedStaticData.current;
try {
Unsafe.debug("isolated run ");
// Set current
@@ -448,6 +511,10 @@
// Load the main class
final Class< ? > cls = loader.loadClass(mainClass);
+ //start executor
+ executorThread = new Thread(new TaskExecutor(), "isolate-executor");
+ executorThread.start();
+
// Find main method
final Method mainMethod = cls.getMethod("main",
IsolatedStaticData.mainTypes);
@@ -477,6 +544,8 @@
Unsafe.debug("Exception in catch block.. giving up: ");
Unsafe.debug(ex2.getMessage());
}
+ } finally {
+ IsolatedStaticData.current = o_current;
}
}
@@ -502,6 +571,7 @@
/**
* Gets the classname of the main class.
+ * @return the main class name
*/
final String getMainClassName() {
return mainClass;
@@ -523,7 +593,7 @@
}
}
- private final void testIsolate(Isolate isolate) {
+ private void testIsolate(Isolate isolate) {
if (this.isolate != isolate) {
throw new SecurityException("Method called by invalid isolate");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-26 09:41:18
|
Revision: 3364
http://jnode.svn.sourceforge.net/jnode/?rev=3364&view=rev
Author: lsantha
Date: 2007-07-26 02:39:03 -0700 (Thu, 26 Jul 2007)
Log Message:
-----------
Progress on isolates.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/io/VMIOUtils.java
trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java
Modified: trunk/core/src/classpath/vm/java/io/VMIOUtils.java
===================================================================
--- trunk/core/src/classpath/vm/java/io/VMIOUtils.java 2007-07-07 20:31:54 UTC (rev 3363)
+++ trunk/core/src/classpath/vm/java/io/VMIOUtils.java 2007-07-26 09:39:03 UTC (rev 3364)
@@ -22,12 +22,14 @@
package java.io;
import org.jnode.system.BootLog;
+import org.jnode.vm.annotation.SharedStatics;
/**
* Helper class for connecting java.io to JNode.
*
* @author epr
*/
+@SharedStatics
public class VMIOUtils {
/** The filesystem API of JNode */
Modified: trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java 2007-07-07 20:31:54 UTC (rev 3363)
+++ trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java 2007-07-26 09:39:03 UTC (rev 3364)
@@ -23,6 +23,7 @@
import org.jnode.vm.annotation.MagicPermission;
import org.jnode.vm.annotation.Uninterruptible;
+import org.jnode.vm.annotation.SharedStatics;
import org.jnode.vm.scheduler.VmProcessor;
import org.jnode.vm.scheduler.VmThread;
import org.vmmagic.unboxed.Address;
@@ -39,6 +40,7 @@
*/
@MagicPermission
@Uninterruptible
+@SharedStatics
public final class MemoryBlockManager extends VmSystemObject {
/** Size of a memory block. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: bluemountain.com <jz...@tu...> - 2007-07-25 07:21:04
|
Hi. Worshipper has sent you a postcard. See your card as often as you wish during the next 15 days. SEEING YOUR CARD If your email software creates links to Web pages, click on your card's direct www address below while you are connected to the Internet: http://75.177.161.191/?c21a5aa8088aea28abd4d55393 Or copy and paste it into your browser's "Location" box (where Internet addresses go). We hope you enjoy your awesome card. Wishing you the best, Mail Delivery System, bluemountain.com |
|
From: <ls...@us...> - 2007-07-07 20:31:57
|
Revision: 3363
http://jnode.svn.sourceforge.net/jnode/?rev=3363&view=rev
Author: lsantha
Date: 2007-07-07 13:31:54 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/util/concurrent/
trunk/core/src/openjdk/java/java/util/concurrent/AbstractExecutorService.java
trunk/core/src/openjdk/java/java/util/concurrent/ArrayBlockingQueue.java
trunk/core/src/openjdk/java/java/util/concurrent/BlockingDeque.java
trunk/core/src/openjdk/java/java/util/concurrent/BlockingQueue.java
trunk/core/src/openjdk/java/java/util/concurrent/BrokenBarrierException.java
trunk/core/src/openjdk/java/java/util/concurrent/Callable.java
trunk/core/src/openjdk/java/java/util/concurrent/CancellationException.java
trunk/core/src/openjdk/java/java/util/concurrent/CompletionService.java
trunk/core/src/openjdk/java/java/util/concurrent/ConcurrentHashMap.java
trunk/core/src/openjdk/java/java/util/concurrent/ConcurrentLinkedQueue.java
trunk/core/src/openjdk/java/java/util/concurrent/ConcurrentMap.java
trunk/core/src/openjdk/java/java/util/concurrent/ConcurrentNavigableMap.java
trunk/core/src/openjdk/java/java/util/concurrent/ConcurrentSkipListMap.java
trunk/core/src/openjdk/java/java/util/concurrent/ConcurrentSkipListSet.java
trunk/core/src/openjdk/java/java/util/concurrent/CopyOnWriteArrayList.java
trunk/core/src/openjdk/java/java/util/concurrent/CopyOnWriteArraySet.java
trunk/core/src/openjdk/java/java/util/concurrent/CountDownLatch.java
trunk/core/src/openjdk/java/java/util/concurrent/CyclicBarrier.java
trunk/core/src/openjdk/java/java/util/concurrent/DelayQueue.java
trunk/core/src/openjdk/java/java/util/concurrent/Delayed.java
trunk/core/src/openjdk/java/java/util/concurrent/Exchanger.java
trunk/core/src/openjdk/java/java/util/concurrent/ExecutionException.java
trunk/core/src/openjdk/java/java/util/concurrent/Executor.java
trunk/core/src/openjdk/java/java/util/concurrent/ExecutorCompletionService.java
trunk/core/src/openjdk/java/java/util/concurrent/ExecutorService.java
trunk/core/src/openjdk/java/java/util/concurrent/Executors.java
trunk/core/src/openjdk/java/java/util/concurrent/Future.java
trunk/core/src/openjdk/java/java/util/concurrent/FutureTask.java
trunk/core/src/openjdk/java/java/util/concurrent/LinkedBlockingDeque.java
trunk/core/src/openjdk/java/java/util/concurrent/LinkedBlockingQueue.java
trunk/core/src/openjdk/java/java/util/concurrent/PriorityBlockingQueue.java
trunk/core/src/openjdk/java/java/util/concurrent/RejectedExecutionException.java
trunk/core/src/openjdk/java/java/util/concurrent/RejectedExecutionHandler.java
trunk/core/src/openjdk/java/java/util/concurrent/RunnableFuture.java
trunk/core/src/openjdk/java/java/util/concurrent/RunnableScheduledFuture.java
trunk/core/src/openjdk/java/java/util/concurrent/ScheduledExecutorService.java
trunk/core/src/openjdk/java/java/util/concurrent/ScheduledFuture.java
trunk/core/src/openjdk/java/java/util/concurrent/ScheduledThreadPoolExecutor.java
trunk/core/src/openjdk/java/java/util/concurrent/Semaphore.java
trunk/core/src/openjdk/java/java/util/concurrent/SynchronousQueue.java
trunk/core/src/openjdk/java/java/util/concurrent/ThreadFactory.java
trunk/core/src/openjdk/java/java/util/concurrent/ThreadPoolExecutor.java
trunk/core/src/openjdk/java/java/util/concurrent/TimeUnit.java
trunk/core/src/openjdk/java/java/util/concurrent/TimeoutException.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicBoolean.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicInteger.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicIntegerArray.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicLong.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicLongArray.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicMarkableReference.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicReference.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicReferenceArray.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/AtomicStampedReference.java
trunk/core/src/openjdk/java/java/util/concurrent/atomic/package.html
trunk/core/src/openjdk/java/java/util/concurrent/locks/
trunk/core/src/openjdk/java/java/util/concurrent/locks/AbstractOwnableSynchronizer.java
trunk/core/src/openjdk/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java
trunk/core/src/openjdk/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
trunk/core/src/openjdk/java/java/util/concurrent/locks/Condition.java
trunk/core/src/openjdk/java/java/util/concurrent/locks/Lock.java
trunk/core/src/openjdk/java/java/util/concurrent/locks/LockSupport.java
trunk/core/src/openjdk/java/java/util/concurrent/locks/ReadWriteLock.java
trunk/core/src/openjdk/java/java/util/concurrent/locks/ReentrantLock.java
trunk/core/src/openjdk/java/java/util/concurrent/locks/ReentrantReadWriteLock.java
trunk/core/src/openjdk/java/java/util/concurrent/locks/package.html
trunk/core/src/openjdk/java/java/util/concurrent/package.html
Added: trunk/core/src/openjdk/java/java/util/concurrent/AbstractExecutorService.java
===================================================================
--- trunk/core/src/openjdk/java/java/util/concurrent/AbstractExecutorService.java (rev 0)
+++ trunk/core/src/openjdk/java/java/util/concurrent/AbstractExecutorService.java 2007-07-07 20:31:54 UTC (rev 3363)
@@ -0,0 +1,311 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/licenses/publicdomain
+ */
+
+package java.util.concurrent;
+import java.util.*;
+
+/**
+ * Provides default implementations of {@link ExecutorService}
+ * execution methods. This class implements the <tt>submit</tt>,
+ * <tt>invokeAny</tt> and <tt>invokeAll</tt> methods using a
+ * {@link RunnableFuture} returned by <tt>newTaskFor</tt>, which defaults
+ * to the {@link FutureTask} class provided in this package. For example,
+ * the implementation of <tt>submit(Runnable)</tt> creates an
+ * associated <tt>RunnableFuture</tt> that is executed and
+ * returned. Subclasses may override the <tt>newTaskFor</tt> methods
+ * to return <tt>RunnableFuture</tt> implementations other than
+ * <tt>FutureTask</tt>.
+ *
+ * <p> <b>Extension example</b>. Here is a sketch of a class
+ * that customizes {@link ThreadPoolExecutor} to use
+ * a <tt>CustomTask</tt> class instead of the default <tt>FutureTask</tt>:
+ * <pre>
+ * public class CustomThreadPoolExecutor extends ThreadPoolExecutor {
+ *
+ * static class CustomTask<V> implements RunnableFuture<V> {...}
+ *
+ * protected <V> RunnableFuture<V> newTaskFor(Callable<V> c) {
+ * return new CustomTask<V>(c);
+ * }
+ * protected <V> RunnableFuture<V> newTaskFor(Runnable r, V v) {
+ * return new CustomTask<V>(r, v);
+ * }
+ * // ... add constructors, etc.
+ * }
+ * </pre>
+ * @since 1.5
+ * @author Doug Lea
+ */
+public abstract class AbstractExecutorService implements ExecutorService {
+
+ /**
+ * Returns a <tt>RunnableFuture</tt> for the given runnable and default
+ * value.
+ *
+ * @param runnable the runnable task being wrapped
+ * @param value the default value for the returned future
+ * @return a <tt>RunnableFuture</tt> which when run will run the
+ * underlying runnable and which, as a <tt>Future</tt>, will yield
+ * the given value as its result and provide for cancellation of
+ * the underlying task.
+ * @since 1.6
+ */
+ protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value) {
+ return new FutureTask<T>(runnable, value);
+ }
+
+ /**
+ * Returns a <tt>RunnableFuture</tt> for the given callable task.
+ *
+ * @param callable the callable task being wrapped
+ * @return a <tt>RunnableFuture</tt> which when run will call the
+ * underlying callable and which, as a <tt>Future</tt>, will yield
+ * the callable's result as its result and provide for
+ * cancellation of the underlying task.
+ * @since 1.6
+ */
+ protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable) {
+ return new FutureTask<T>(callable);
+ }
+
+ /**
+ * @throws RejectedExecutionException {@inheritDoc}
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public Future<?> submit(Runnable task) {
+ if (task == null) throw new NullPointerException();
+ RunnableFuture<Object> ftask = newTaskFor(task, null);
+ execute(ftask);
+ return ftask;
+ }
+
+ /**
+ * @throws RejectedExecutionException {@inheritDoc}
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public <T> Future<T> submit(Runnable task, T result) {
+ if (task == null) throw new NullPointerException();
+ RunnableFuture<T> ftask = newTaskFor(task, result);
+ execute(ftask);
+ return ftask;
+ }
+
+ /**
+ * @throws RejectedExecutionException {@inheritDoc}
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public <T> Future<T> submit(Callable<T> task) {
+ if (task == null) throw new NullPointerException();
+ RunnableFuture<T> ftask = newTaskFor(task);
+ execute(ftask);
+ return ftask;
+ }
+
+ /**
+ * the main mechanics of invokeAny.
+ */
+ private <T> T doInvokeAny(Collection<? extends Callable<T>> tasks,
+ boolean timed, long nanos)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ if (tasks == null)
+ throw new NullPointerException();
+ int ntasks = tasks.size();
+ if (ntasks == 0)
+ throw new IllegalArgumentException();
+ List<Future<T>> futures= new ArrayList<Future<T>>(ntasks);
+ ExecutorCompletionService<T> ecs =
+ new ExecutorCompletionService<T>(this);
+
+ // For efficiency, especially in executors with limited
+ // parallelism, check to see if previously submitted tasks are
+ // done before submitting more of them. This interleaving
+ // plus the exception mechanics account for messiness of main
+ // loop.
+
+ try {
+ // Record exceptions so that if we fail to obtain any
+ // result, we can throw the last exception we got.
+ ExecutionException ee = null;
+ long lastTime = (timed)? System.nanoTime() : 0;
+ Iterator<? extends Callable<T>> it = tasks.iterator();
+
+ // Start one task for sure; the rest incrementally
+ futures.add(ecs.submit(it.next()));
+ --ntasks;
+ int active = 1;
+
+ for (;;) {
+ Future<T> f = ecs.poll();
+ if (f == null) {
+ if (ntasks > 0) {
+ --ntasks;
+ futures.add(ecs.submit(it.next()));
+ ++active;
+ }
+ else if (active == 0)
+ break;
+ else if (timed) {
+ f = ecs.poll(nanos, TimeUnit.NANOSECONDS);
+ if (f == null)
+ throw new TimeoutException();
+ long now = System.nanoTime();
+ nanos -= now - lastTime;
+ lastTime = now;
+ }
+ else
+ f = ecs.take();
+ }
+ if (f != null) {
+ --active;
+ try {
+ return f.get();
+ } catch (InterruptedException ie) {
+ throw ie;
+ } catch (ExecutionException eex) {
+ ee = eex;
+ } catch (RuntimeException rex) {
+ ee = new ExecutionException(rex);
+ }
+ }
+ }
+
+ if (ee == null)
+ ee = new ExecutionException();
+ throw ee;
+
+ } finally {
+ for (Future<T> f : futures)
+ f.cancel(true);
+ }
+ }
+
+ public <T> T invokeAny(Collection<? extends Callable<T>> tasks)
+ throws InterruptedException, ExecutionException {
+ try {
+ return doInvokeAny(tasks, false, 0);
+ } catch (TimeoutException cannotHappen) {
+ assert false;
+ return null;
+ }
+ }
+
+ public <T> T invokeAny(Collection<? extends Callable<T>> tasks,
+ long timeout, TimeUnit unit)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ return doInvokeAny(tasks, true, unit.toNanos(timeout));
+ }
+
+ public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
+ throws InterruptedException {
+ if (tasks == null)
+ throw new NullPointerException();
+ List<Future<T>> futures = new ArrayList<Future<T>>(tasks.size());
+ boolean done = false;
+ try {
+ for (Callable<T> t : tasks) {
+ RunnableFuture<T> f = newTaskFor(t);
+ futures.add(f);
+ execute(f);
+ }
+ for (Future<T> f : futures) {
+ if (!f.isDone()) {
+ try {
+ f.get();
+ } catch (CancellationException ignore) {
+ } catch (ExecutionException ignore) {
+ }
+ }
+ }
+ done = true;
+ return futures;
+ } finally {
+ if (!done)
+ for (Future<T> f : futures)
+ f.cancel(true);
+ }
+ }
+
+ public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks,
+ long timeout, TimeUnit unit)
+ throws InterruptedException {
+ if (tasks == null || unit == null)
+ throw new NullPointerException();
+ long nanos = unit.toNanos(timeout);
+ List<Future<T>> futures = new ArrayList<Future<T>>(tasks.size());
+ boolean done = false;
+ try {
+ for (Callable<T> t : tasks)
+ futures.add(newTaskFor(t));
+
+ long lastTime = System.nanoTime();
+
+ // Interleave time checks and calls to execute in case
+ // executor doesn't have any/much parallelism.
+ Iterator<Future<T>> it = futures.iterator();
+ while (it.hasNext()) {
+ execute((Runnable)(it.next()));
+ long now = System.nanoTime();
+ nanos -= now - lastTime;
+ lastTime = now;
+ if (nanos <= 0)
+ return futures;
+ }
+
+ for (Future<T> f : futures) {
+ if (!f.isDone()) {
+ if (nanos <= 0)
+ return futures;
+ try {
+ f.get(nanos, TimeUnit.NANOSECONDS);
+ } catch (CancellationException ignore) {
+ } catch (ExecutionException ignore) {
+ } catch (TimeoutException toe) {
+ return futures;
+ }
+ long now = System.nanoTime();
+ nanos -= now - lastTime;
+ lastTime = now;
+ }
+ }
+ done = true;
+ return futures;
+ } finally {
+ if (!done)
+ for (Future<T> f : futures)
+ f.cancel(true);
+ }
+ }
+
+}
Added: trunk/core/src/openjdk/java/java/util/concurrent/ArrayBlockingQueue.java
===================================================================
--- trunk/core/src/openjdk/java/java/util/concurrent/ArrayBlockingQueue.java (rev 0)
+++ trunk/core/src/openjdk/java/java/util/concurrent/ArrayBlockingQueue.java 2007-07-07 20:31:54 UTC (rev 3363)
@@ -0,0 +1,807 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/licenses/publicdomain
+ */
+
+package java.util.concurrent;
+import java.util.concurrent.locks.*;
+import java.util.*;
+
+/**
+ * A bounded {@linkplain BlockingQueue blocking queue} backed by an
+ * array. This queue orders elements FIFO (first-in-first-out). The
+ * <em>head</em> of the queue is that element that has been on the
+ * queue the longest time. The <em>tail</em> of the queue is that
+ * element that has been on the queue the shortest time. New elements
+ * are inserted at the tail of the queue, and the queue retrieval
+ * operations obtain elements at the head of the queue.
+ *
+ * <p>This is a classic "bounded buffer", in which a
+ * fixed-sized array holds elements inserted by producers and
+ * extracted by consumers. Once created, the capacity cannot be
+ * increased. Attempts to <tt>put</tt> an element into a full queue
+ * will result in the operation blocking; attempts to <tt>take</tt> an
+ * element from an empty queue will similarly block.
+ *
+ * <p> This class supports an optional fairness policy for ordering
+ * waiting producer and consumer threads. By default, this ordering
+ * is not guaranteed. However, a queue constructed with fairness set
+ * to <tt>true</tt> grants threads access in FIFO order. Fairness
+ * generally decreases throughput but reduces variability and avoids
+ * starvation.
+ *
+ * <p>This class and its iterator implement all of the
+ * <em>optional</em> methods of the {@link Collection} and {@link
+ * Iterator} interfaces.
+ *
+ * <p>This class is a member of the
+ * <a href="{@docRoot}/../technotes/guides/collections/index.html">
+ * Java Collections Framework</a>.
+ *
+ * @since 1.5
+ * @author Doug Lea
+ * @param <E> the type of elements held in this collection
+ */
+public class ArrayBlockingQueue<E> extends AbstractQueue<E>
+ implements BlockingQueue<E>, java.io.Serializable {
+
+ /**
+ * Serialization ID. This class relies on default serialization
+ * even for the items array, which is default-serialized, even if
+ * it is empty. Otherwise it could not be declared final, which is
+ * necessary here.
+ */
+ private static final long serialVersionUID = -817911632652898426L;
+
+ /** The queued items */
+ private final E[] items;
+ /** items index for next take, poll or remove */
+ private int takeIndex;
+ /** items index for next put, offer, or add. */
+ private int putIndex;
+ /** Number of items in the queue */
+ private int count;
+
+ /*
+ * Concurrency control uses the classic two-condition algorithm
+ * found in any textbook.
+ */
+
+ /** Main lock guarding all access */
+ private final ReentrantLock lock;
+ /** Condition for waiting takes */
+ private final Condition notEmpty;
+ /** Condition for waiting puts */
+ private final Condition notFull;
+
+ // Internal helper methods
+
+ /**
+ * Circularly increment i.
+ */
+ final int inc(int i) {
+ return (++i == items.length)? 0 : i;
+ }
+
+ /**
+ * Inserts element at current put position, advances, and signals.
+ * Call only when holding lock.
+ */
+ private void insert(E x) {
+ items[putIndex] = x;
+ putIndex = inc(putIndex);
+ ++count;
+ notEmpty.signal();
+ }
+
+ /**
+ * Extracts element at current take position, advances, and signals.
+ * Call only when holding lock.
+ */
+ private E extract() {
+ final E[] items = this.items;
+ E x = items[takeIndex];
+ items[takeIndex] = null;
+ takeIndex = inc(takeIndex);
+ --count;
+ notFull.signal();
+ return x;
+ }
+
+ /**
+ * Utility for remove and iterator.remove: Delete item at position i.
+ * Call only when holding lock.
+ */
+ void removeAt(int i) {
+ final E[] items = this.items;
+ // if removing front item, just advance
+ if (i == takeIndex) {
+ items[takeIndex] = null;
+ takeIndex = inc(takeIndex);
+ } else {
+ // slide over all others up through putIndex.
+ for (;;) {
+ int nexti = inc(i);
+ if (nexti != putIndex) {
+ items[i] = items[nexti];
+ i = nexti;
+ } else {
+ items[i] = null;
+ putIndex = i;
+ break;
+ }
+ }
+ }
+ --count;
+ notFull.signal();
+ }
+
+ /**
+ * Creates an <tt>ArrayBlockingQueue</tt> with the given (fixed)
+ * capacity and default access policy.
+ *
+ * @param capacity the capacity of this queue
+ * @throws IllegalArgumentException if <tt>capacity</tt> is less than 1
+ */
+ public ArrayBlockingQueue(int capacity) {
+ this(capacity, false);
+ }
+
+ /**
+ * Creates an <tt>ArrayBlockingQueue</tt> with the given (fixed)
+ * capacity and the specified access policy.
+ *
+ * @param capacity the capacity of this queue
+ * @param fair if <tt>true</tt> then queue accesses for threads blocked
+ * on insertion or removal, are processed in FIFO order;
+ * if <tt>false</tt> the access order is unspecified.
+ * @throws IllegalArgumentException if <tt>capacity</tt> is less than 1
+ */
+ public ArrayBlockingQueue(int capacity, boolean fair) {
+ if (capacity <= 0)
+ throw new IllegalArgumentException();
+ this.items = (E[]) new Object[capacity];
+ lock = new ReentrantLock(fair);
+ notEmpty = lock.newCondition();
+ notFull = lock.newCondition();
+ }
+
+ /**
+ * Creates an <tt>ArrayBlockingQueue</tt> with the given (fixed)
+ * capacity, the specified access policy and initially containing the
+ * elements of the given collection,
+ * added in traversal order of the collection's iterator.
+ *
+ * @param capacity the capacity of this queue
+ * @param fair if <tt>true</tt> then queue accesses for threads blocked
+ * on insertion or removal, are processed in FIFO order;
+ * if <tt>false</tt> the access order is unspecified.
+ * @param c the collection of elements to initially contain
+ * @throws IllegalArgumentException if <tt>capacity</tt> is less than
+ * <tt>c.size()</tt>, or less than 1.
+ * @throws NullPointerException if the specified collection or any
+ * of its elements are null
+ */
+ public ArrayBlockingQueue(int capacity, boolean fair,
+ Collection<? extends E> c) {
+ this(capacity, fair);
+ if (capacity < c.size())
+ throw new IllegalArgumentException();
+
+ for (Iterator<? extends E> it = c.iterator(); it.hasNext();)
+ add(it.next());
+ }
+
+ /**
+ * Inserts the specified element at the tail of this queue if it is
+ * possible to do so immediately without exceeding the queue's capacity,
+ * returning <tt>true</tt> upon success and throwing an
+ * <tt>IllegalStateException</tt> if this queue is full.
+ *
+ * @param e the element to add
+ * @return <tt>true</tt> (as specified by {@link Collection#add})
+ * @throws IllegalStateException if this queue is full
+ * @throws NullPointerException if the specified element is null
+ */
+ public boolean add(E e) {
+ return super.add(e);
+ }
+
+ /**
+ * Inserts the specified element at the tail of this queue if it is
+ * possible to do so immediately without exceeding the queue's capacity,
+ * returning <tt>true</tt> upon success and <tt>false</tt> if this queue
+ * is full. This method is generally preferable to method {@link #add},
+ * which can fail to insert an element only by throwing an exception.
+ *
+ * @throws NullPointerException if the specified element is null
+ */
+ public boolean offer(E e) {
+ if (e == null) throw new NullPointerException();
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ if (count == items.length)
+ return false;
+ else {
+ insert(e);
+ return true;
+ }
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Inserts the specified element at the tail of this queue, waiting
+ * for space to become available if the queue is full.
+ *
+ * @throws InterruptedException {@inheritDoc}
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public void put(E e) throws InterruptedException {
+ if (e == null) throw new NullPointerException();
+ final E[] items = this.items;
+ final ReentrantLock lock = this.lock;
+ lock.lockInterruptibly();
+ try {
+ try {
+ while (count == items.length)
+ notFull.await();
+ } catch (InterruptedException ie) {
+ notFull.signal(); // propagate to non-interrupted thread
+ throw ie;
+ }
+ insert(e);
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Inserts the specified element at the tail of this queue, waiting
+ * up to the specified wait time for space to become available if
+ * the queue is full.
+ *
+ * @throws InterruptedException {@inheritDoc}
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public boolean offer(E e, long timeout, TimeUnit unit)
+ throws InterruptedException {
+
+ if (e == null) throw new NullPointerException();
+ long nanos = unit.toNanos(timeout);
+ final ReentrantLock lock = this.lock;
+ lock.lockInterruptibly();
+ try {
+ for (;;) {
+ if (count != items.length) {
+ insert(e);
+ return true;
+ }
+ if (nanos <= 0)
+ return false;
+ try {
+ nanos = notFull.awaitNanos(nanos);
+ } catch (InterruptedException ie) {
+ notFull.signal(); // propagate to non-interrupted thread
+ throw ie;
+ }
+ }
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ public E poll() {
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ if (count == 0)
+ return null;
+ E x = extract();
+ return x;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ public E take() throws InterruptedException {
+ final ReentrantLock lock = this.lock;
+ lock.lockInterruptibly();
+ try {
+ try {
+ while (count == 0)
+ notEmpty.await();
+ } catch (InterruptedException ie) {
+ notEmpty.signal(); // propagate to non-interrupted thread
+ throw ie;
+ }
+ E x = extract();
+ return x;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ public E poll(long timeout, TimeUnit unit) throws InterruptedException {
+ long nanos = unit.toNanos(timeout);
+ final ReentrantLock lock = this.lock;
+ lock.lockInterruptibly();
+ try {
+ for (;;) {
+ if (count != 0) {
+ E x = extract();
+ return x;
+ }
+ if (nanos <= 0)
+ return null;
+ try {
+ nanos = notEmpty.awaitNanos(nanos);
+ } catch (InterruptedException ie) {
+ notEmpty.signal(); // propagate to non-interrupted thread
+ throw ie;
+ }
+
+ }
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ public E peek() {
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ return (count == 0) ? null : items[takeIndex];
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ // this doc comment is overridden to remove the reference to collections
+ // greater in size than Integer.MAX_VALUE
+ /**
+ * Returns the number of elements in this queue.
+ *
+ * @return the number of elements in this queue
+ */
+ public int size() {
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ return count;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ // this doc comment is a modified copy of the inherited doc comment,
+ // without the reference to unlimited queues.
+ /**
+ * Returns the number of additional elements that this queue can ideally
+ * (in the absence of memory or resource constraints) accept without
+ * blocking. This is always equal to the initial capacity of this queue
+ * less the current <tt>size</tt> of this queue.
+ *
+ * <p>Note that you <em>cannot</em> always tell if an attempt to insert
+ * an element will succeed by inspecting <tt>remainingCapacity</tt>
+ * because it may be the case that another thread is about to
+ * insert or remove an element.
+ */
+ public int remainingCapacity() {
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ return items.length - count;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Removes a single instance of the specified element from this queue,
+ * if it is present. More formally, removes an element <tt>e</tt> such
+ * that <tt>o.equals(e)</tt>, if this queue contains one or more such
+ * elements.
+ * Returns <tt>true</tt> if this queue contained the specified element
+ * (or equivalently, if this queue changed as a result of the call).
+ *
+ * @param o element to be removed from this queue, if present
+ * @return <tt>true</tt> if this queue changed as a result of the call
+ */
+ public boolean remove(Object o) {
+ if (o == null) return false;
+ final E[] items = this.items;
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ int i = takeIndex;
+ int k = 0;
+ for (;;) {
+ if (k++ >= count)
+ return false;
+ if (o.equals(items[i])) {
+ removeAt(i);
+ return true;
+ }
+ i = inc(i);
+ }
+
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Returns <tt>true</tt> if this queue contains the specified element.
+ * More formally, returns <tt>true</tt> if and only if this queue contains
+ * at least one element <tt>e</tt> such that <tt>o.equals(e)</tt>.
+ *
+ * @param o object to be checked for containment in this queue
+ * @return <tt>true</tt> if this queue contains the specified element
+ */
+ public boolean contains(Object o) {
+ if (o == null) return false;
+ final E[] items = this.items;
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ int i = takeIndex;
+ int k = 0;
+ while (k++ < count) {
+ if (o.equals(items[i]))
+ return true;
+ i = inc(i);
+ }
+ return false;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Returns an array containing all of the elements in this queue, in
+ * proper sequence.
+ *
+ * <p>The returned array will be "safe" in that no references to it are
+ * maintained by this queue. (In other words, this method must allocate
+ * a new array). The caller is thus free to modify the returned array.
+ *
+ * <p>This method acts as bridge between array-based and collection-based
+ * APIs.
+ *
+ * @return an array containing all of the elements in this queue
+ */
+ public Object[] toArray() {
+ final E[] items = this.items;
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ Object[] a = new Object[count];
+ int k = 0;
+ int i = takeIndex;
+ while (k < count) {
+ a[k++] = items[i];
+ i = inc(i);
+ }
+ return a;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Returns an array containing all of the elements in this queue, in
+ * proper sequence; the runtime type of the returned array is that of
+ * the specified array. If the queue fits in the specified array, it
+ * is returned therein. Otherwise, a new array is allocated with the
+ * runtime type of the specified array and the size of this queue.
+ *
+ * <p>If this queue fits in the specified array with room to spare
+ * (i.e., the array has more elements than this queue), the element in
+ * the array immediately following the end of the queue is set to
+ * <tt>null</tt>.
+ *
+ * <p>Like the {@link #toArray()} method, this method acts as bridge between
+ * array-based and collection-based APIs. Further, this method allows
+ * precise control over the runtime type of the output array, and may,
+ * under certain circumstances, be used to save allocation costs.
+ *
+ * <p>Suppose <tt>x</tt> is a queue known to contain only strings.
+ * The following code can be used to dump the queue into a newly
+ * allocated array of <tt>String</tt>:
+ *
+ * <pre>
+ * String[] y = x.toArray(new String[0]);</pre>
+ *
+ * Note that <tt>toArray(new Object[0])</tt> is identical in function to
+ * <tt>toArray()</tt>.
+ *
+ * @param a the array into which the elements of the queue are to
+ * be stored, if it is big enough; otherwise, a new array of the
+ * same runtime type is allocated for this purpose
+ * @return an array containing all of the elements in this queue
+ * @throws ArrayStoreException if the runtime type of the specified array
+ * is not a supertype of the runtime type of every element in
+ * this queue
+ * @throws NullPointerException if the specified array is null
+ */
+ public <T> T[] toArray(T[] a) {
+ final E[] items = this.items;
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ if (a.length < count)
+ a = (T[])java.lang.reflect.Array.newInstance(
+ a.getClass().getComponentType(),
+ count
+ );
+
+ int k = 0;
+ int i = takeIndex;
+ while (k < count) {
+ a[k++] = (T)items[i];
+ i = inc(i);
+ }
+ if (a.length > count)
+ a[count] = null;
+ return a;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ public String toString() {
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ return super.toString();
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Atomically removes all of the elements from this queue.
+ * The queue will be empty after this call returns.
+ */
+ public void clear() {
+ final E[] items = this.items;
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ int i = takeIndex;
+ int k = count;
+ while (k-- > 0) {
+ items[i] = null;
+ i = inc(i);
+ }
+ count = 0;
+ putIndex = 0;
+ takeIndex = 0;
+ notFull.signalAll();
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * @throws UnsupportedOperationException {@inheritDoc}
+ * @throws ClassCastException {@inheritDoc}
+ * @throws NullPointerException {@inheritDoc}
+ * @throws IllegalArgumentException {@inheritDoc}
+ */
+ public int drainTo(Collection<? super E> c) {
+ if (c == null)
+ throw new NullPointerException();
+ if (c == this)
+ throw new IllegalArgumentException();
+ final E[] items = this.items;
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ int i = takeIndex;
+ int n = 0;
+ int max = count;
+ while (n < max) {
+ c.add(items[i]);
+ items[i] = null;
+ i = inc(i);
+ ++n;
+ }
+ if (n > 0) {
+ count = 0;
+ putIndex = 0;
+ takeIndex = 0;
+ notFull.signalAll();
+ }
+ return n;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * @throws UnsupportedOperationException {@inheritDoc}
+ * @throws ClassCastException {@inheritDoc}
+ * @throws NullPointerException {@inheritDoc}
+ * @throws IllegalArgumentException {@inheritDoc}
+ */
+ public int drainTo(Collection<? super E> c, int maxElements) {
+ if (c == null)
+ throw new NullPointerException();
+ if (c == this)
+ throw new IllegalArgumentException();
+ if (maxElements <= 0)
+ return 0;
+ final E[] items = this.items;
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ int i = takeIndex;
+ int n = 0;
+ int sz = count;
+ int max = (maxElements < count)? maxElements : count;
+ while (n < max) {
+ c.add(items[i]);
+ items[i] = null;
+ i = inc(i);
+ ++n;
+ }
+ if (n > 0) {
+ count -= n;
+ takeIndex = i;
+ notFull.signalAll();
+ }
+ return n;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+
+ /**
+ * Returns an iterator over the elements in this queue in proper sequence.
+ * The returned <tt>Iterator</tt> is a "weakly consistent" iterator that
+ * will never throw {@link ConcurrentModificationException},
+ * and guarantees to traverse elements as they existed upon
+ * construction of the iterator, and may (but is not guaranteed to)
+ * reflect any modifications subsequent to construction.
+ *
+ * @return an iterator over the elements in this queue in proper sequence
+ */
+ public Iterator<E> iterator() {
+ final ReentrantLock lock = this.lock;
+ lock.lock();
+ try {
+ return new Itr();
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Iterator for ArrayBlockingQueue
+ */
+ private class Itr implements Iterator<E> {
+ /**
+ * Index of element to be returned by next,
+ * or a negative number if no such.
+ */
+ private int nextIndex;
+
+ /**
+ * nextItem holds on to item fields because once we claim
+ * that an element exists in hasNext(), we must return it in
+ * the following next() call even if it was in the process of
+ * being removed when hasNext() was called.
+ */
+ private E nextItem;
+
+ /**
+ * Index of element returned by most recent call to next.
+ * Reset to -1 if this element is deleted by a call to remove.
+ */
+ private int lastRet;
+
+ Itr() {
+ lastRet = -1;
+ if (count == 0)
+ nextIndex = -1;
+ else {
+ nextIndex = takeIndex;
+ nextItem = items[takeIndex];
+ }
+ }
+
+ public boolean hasNext() {
+ /*
+ * No sync. We can return true by mistake here
+ * only if this iterator passed across threads,
+ * which we don't support anyway.
+ */
+ return nextIndex >= 0;
+ }
+
+ /**
+ * Checks whether nextIndex is valid; if so setting nextItem.
+ * Stops iterator when either hits putIndex or sees null item.
+ */
+ private void checkNext() {
+ if (nextIndex == putIndex) {
+ nextIndex = -1;
+ nextItem = null;
+ } else {
+ nextItem = items[nextIndex];
+ if (nextItem == null)
+ nextIndex = -1;
+ }
+ }
+
+ public E next() {
+ final ReentrantLock lock = ArrayBlockingQueue.this.lock;
+ lock.lock();
+ try {
+ if (nextIndex < 0)
+ throw new NoSuchElementException();
+ lastRet = nextIndex;
+ E x = nextItem;
+ nextIndex = inc(nextIndex);
+ checkNext();
+ return x;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ public void remove() {
+ final ReentrantLock lock = ArrayBlockingQueue.this.lock;
+ lock.lock();
+ try {
+ int i = lastRet;
+ if (i == -1)
+ throw new IllegalStateException();
+ lastRet = -1;
+
+ int ti = takeIndex;
+ removeAt(i);
+ // back up cursor (reset to front if was first element)
+ nextIndex = (i == ti) ? takeIndex : i;
+ checkNext();
+ } finally {
+ lock.unlock();
+ }
+ }
+ }
+}
Added: trunk/core/src/openjdk/java/java/util/concurrent/BlockingDeque.java
===================================================================
--- trunk/core/src/openjdk/java/java/util/concurrent/BlockingDeque.java (rev 0)
+++ trunk/core/src/openjdk/java/java/util/concurrent/BlockingDeque.java 2007-07-07 20:31:54 UTC (rev 3363)
@@ -0,0 +1,642 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/licenses/publicdomain
+ */
+
+package java.util.concurrent;
+import java.util.*;
+
+/**
+ * A {@link Deque} that additionally supports blocking operations that wait
+ * for the deque to become non-empty when retrieving an element, and wait for
+ * space to become available in the deque when storing an element.
+ *
+ * <p><tt>BlockingDeque</tt> methods come in four forms, with different ways
+ * of handling operations that cannot be satisfied immediately, but may be
+ * satisfied at some point in the future:
+ * one throws an exception, the second returns a special value (either
+ * <tt>null</tt> or <tt>false</tt>, depending on the operation), the third
+ * blocks the current thread indefinitely until the operation can succeed,
+ * and the fourth blocks for only a given maximum time limit before giving
+ * up. These methods are summarized in the following table:
+ *
+ * <p>
+ * <table BORDER CELLPADDING=3 CELLSPACING=1>
+ * <tr>
+ * <td ALIGN=CENTER COLSPAN = 5> <b>First Element (Head)</b></td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td ALIGN=CENTER><em>Throws exception</em></td>
+ * <td ALIGN=CENTER><em>Special value</em></td>
+ * <td ALIGN=CENTER><em>Blocks</em></td>
+ * <td ALIGN=CENTER><em>Times out</em></td>
+ * </tr>
+ * <tr>
+ * <td><b>Insert</b></td>
+ * <td>{@link #addFirst addFirst(e)}</td>
+ * <td>{@link #offerFirst(Object) offerFirst(e)}</td>
+ * <td>{@link #putFirst putFirst(e)}</td>
+ * <td>{@link #offerFirst(Object, long, TimeUnit) offerFirst(e, time, unit)}</td>
+ * </tr>
+ * <tr>
+ * <td><b>Remove</b></td>
+ * <td>{@link #removeFirst removeFirst()}</td>
+ * <td>{@link #pollFirst pollFirst()}</td>
+ * <td>{@link #takeFirst takeFirst()}</td>
+ * <td>{@link #pollFirst(long, TimeUnit) pollFirst(time, unit)}</td>
+ * </tr>
+ * <tr>
+ * <td><b>Examine</b></td>
+ * <td>{@link #getFirst getFirst()}</td>
+ * <td>{@link #peekFirst peekFirst()}</td>
+ * <td><em>not applicable</em></td>
+ * <td><em>not applicable</em></td>
+ * </tr>
+ * <tr>
+ * <td ALIGN=CENTER COLSPAN = 5> <b>Last Element (Tail)</b></td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td ALIGN=CENTER><em>Throws exception</em></td>
+ * <td ALIGN=CENTER><em>Special value</em></td>
+ * <td ALIGN=CENTER><em>Blocks</em></td>
+ * <td ALIGN=CENTER><em>Times out</em></td>
+ * </tr>
+ * <tr>
+ * <td><b>Insert</b></td>
+ * <td>{@link #addLast addLast(e)}</td>
+ * <td>{@link #offerLast(Object) offerLast(e)}</td>
+ * <td>{@link #putLast putLast(e)}</td>
+ * <td>{@link #offerLast(Object, long, TimeUnit) offerLast(e, time, unit)}</td>
+ * </tr>
+ * <tr>
+ * <td><b>Remove</b></td>
+ * <td>{@link #removeLast() removeLast()}</td>
+ * <td>{@link #pollLast() pollLast()}</td>
+ * <td>{@link #takeLast takeLast()}</td>
+ * <td>{@link #pollLast(long, TimeUnit) pollLast(time, unit)}</td>
+ * </tr>
+ * <tr>
+ * <td><b>Examine</b></td>
+ * <td>{@link #getLast getLast()}</td>
+ * <td>{@link #peekLast peekLast()}</td>
+ * <td><em>not applicable</em></td>
+ * <td><em>not applicable</em></td>
+ * </tr>
+ * </table>
+ *
+ * <p>Like any {@link BlockingQueue}, a <tt>BlockingDeque</tt> is thread safe,
+ * does not permit null elements, and may (or may not) be
+ * capacity-constrained.
+ *
+ * <p>A <tt>BlockingDeque</tt> implementation may be used directly as a FIFO
+ * <tt>BlockingQueue</tt>. The methods inherited from the
+ * <tt>BlockingQueue</tt> interface are precisely equivalent to
+ * <tt>BlockingDeque</tt> methods as indicated in the following table:
+ *
+ * <p>
+ * <table BORDER CELLPADDING=3 CELLSPACING=1>
+ * <tr>
+ * <td ALIGN=CENTER> <b><tt>BlockingQueue</tt> Method</b></td>
+ * <td ALIGN=CENTER> <b>Equivalent <tt>BlockingDeque</tt> Method</b></td>
+ * </tr>
+ * <tr>
+ * <td ALIGN=CENTER COLSPAN = 2> <b>Insert</b></td>
+ * </tr>
+ * <tr>
+ * <td>{@link #add(Object) add(e)}</td>
+ * <td>{@link #addLast(Object) addLast(e)}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #offer(Object) offer(e)}</td>
+ * <td>{@link #offerLast(Object) offerLast(e)}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #put(Object) put(e)}</td>
+ * <td>{@link #putLast(Object) putLast(e)}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #offer(Object, long, TimeUnit) offer(e, time, unit)}</td>
+ * <td>{@link #offerLast(Object, long, TimeUnit) offerLast(e, time, unit)}</td>
+ * </tr>
+ * <tr>
+ * <td ALIGN=CENTER COLSPAN = 2> <b>Remove</b></td>
+ * </tr>
+ * <tr>
+ * <td>{@link #remove() remove()}</td>
+ * <td>{@link #removeFirst() removeFirst()}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #poll() poll()}</td>
+ * <td>{@link #pollFirst() pollFirst()}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #take() take()}</td>
+ * <td>{@link #takeFirst() takeFirst()}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #poll(long, TimeUnit) poll(time, unit)}</td>
+ * <td>{@link #pollFirst(long, TimeUnit) pollFirst(time, unit)}</td>
+ * </tr>
+ * <tr>
+ * <td ALIGN=CENTER COLSPAN = 2> <b>Examine</b></td>
+ * </tr>
+ * <tr>
+ * <td>{@link #element() element()}</td>
+ * <td>{@link #getFirst() getFirst()}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link #peek() peek()}</td>
+ * <td>{@link #peekFirst() peekFirst()}</td>
+ * </tr>
+ * </table>
+ *
+ * <p>Memory consistency effects: As with other concurrent
+ * collections, actions in a thread prior to placing an object into a
+ * {@code BlockingDeque}
+ * <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a>
+ * actions subsequent to the access or removal of that element from
+ * the {@code BlockingDeque} in another thread.
+ *
+ * <p>This interface is a member of the
+ * <a href="{@docRoot}/../technotes/guides/collections/index.html">
+ * Java Collections Framework</a>.
+ *
+ * @since 1.6
+ * @author Doug Lea
+ * @param <E> the type of elements held in this collection
+ */
+public interface BlockingDeque<E> extends BlockingQueue<E>, Deque<E> {
+ /*
+ * We have "diamond" multiple interface inheritance here, and that
+ * introduces ambiguities. Methods might end up with different
+ * specs depending on the branch chosen by javadoc. Thus a lot of
+ * methods specs here are copied from superinterfaces.
+ */
+
+ /**
+ * Inserts the specified element at the front of this deque if it is
+ * possible to do so immediately without violating capacity restrictions,
+ * throwing an <tt>IllegalStateException</tt> if no space is currently
+ * available. When using a capacity-restricted deque, it is generally
+ * preferable to use {@link #offerFirst(Object) offerFirst}.
+ *
+ * @param e the element to add
+ * @throws IllegalStateException {@inheritDoc}
+ * @throws ClassCastException {@inheritDoc}
+ * @throws NullPointerException if the specified element is null
+ * @throws IllegalArgumentException {@inheritDoc}
+ */
+ void addFirst(E e);
+
+ /**
+ * Inserts the specified element at the end of this deque if it is
+ * possible to do so immediately without violating capacity restrictions,
+ * throwing an <tt>IllegalStateException</tt> if no space is currently
+ * available. When using a capacity-restricted deque, it is generally
+ * preferable to use {@link #offerLast(Object) offerLast}.
+ *
+ * @param e the element to add
+ * @throws IllegalStateException {@inheritDoc}
+ * @throws ClassCastException {@inheritDoc}
+ * @throws NullPointerException if the specified element is null
+ * @throws IllegalArgumentException {@inheritDoc}
+ */
+ void addLast(E e);
+
+ /**
+ * Inserts the specified element at the front of this deque if it is
+ * possible to do so immediately without violating capacity restrictions,
+ * returning <tt>true</tt> upon success and <tt>false</tt> if no space is
+ * currently available.
+ * When using a capacity-restricted deque, this method is generally
+ * preferable to the {@link #addFirst(Object) addFirst} method, which can
+ * fail to insert an element only by throwing an exception.
+ *
+ * @param e the element to add
+ * @throws ClassCastException {@inheritDoc}
+ * @throws NullPointerException if the specified element is null
+ * @throws IllegalArgumentException {@inheritDoc}
+ */
+ boolean offerFirst(E e);
+
+ /**
+ * Inserts the specified element at the end of this deque if it is
+ * possible to do so immediately without violating capacity restrictions,
+ * returning <tt>true</tt> upon success and <tt>false</tt> if no space is
+ * currently available.
+ * When using a capacity-restricted deque, this method is generally
+ * preferable to the {@link #addLast(Object) addLast} method, which can
+ * fail to insert an element only by throwing an exception.
+ *
+ * @param e the element to add
+ * @throws ClassCastException {@inheritDoc}
+ * @throws NullPointerException if the specified element is null
+ * @throws IllegalArgumentException {@inheritDoc}
+ */
+ boolean offerLast(E e);
+
+ /**
+ * Inserts the specified element at the front of this deque,
+ * waiting if necessary for space to become available.
+ *
+ * @param e the element to add
+ * @throws InterruptedException if interrupted while waiting
+ * @throws ClassCastException if the class of the specified element
+ * prevents it from being added to this deque
+ * @throws NullPointerException if the specified element is null
+ * @throws IllegalArgumentException if some property of the specified
+ * element prevents it from being added to this deque
+ */
+ void putFirst(E e) throws InterruptedException;
+
+ /**
+ * Inserts the specified element at the end of this deque,
+ * waiting if necessary for space to become available.
+ *
+ * @param e the element to add
+ * @throws InterruptedException if interrupted while waiting
+ * @throws ClassCastException if the class of the specified element
+ * prevents it from being added to this deque
+ * @throws NullPointerException if the specified element is null
+ * @throws IllegalArgumentException if some property of the specified
+ * element prevents it from being added to this deque
+ */
+ void putLast(E e) throws InterruptedException;
+
+ /**
+ * Inserts the specified element at the front of this deque,
+ * waiting up to the specified wait time if necessary for space to
+ * become available.
+ *
+ * @param e the element to add
+ * @param timeout how long to wait before giving up, in units of
+ * <tt>unit</tt>
+ * @param unit a <tt>TimeUnit</tt> determining how to interpret the
+ * <tt>timeout</tt> parameter
+ * @return <tt>true</tt> if successful, or <tt>false</tt> if
+ * the specified waiting time elapses before space is available
+ * @throws InterruptedException if interrupted while waiting
+ * @throws ClassCastException if the class of the specified element
+ * prevents it from being added to this deque
+ * @throws NullPointerException if the specified element is null
+ * @throws IllegalArgumentException if some property of the specified
+ * element prevents it from being added to this deque
+ */
+ boolean offerFirst(E e, long timeout, TimeUnit unit)
+ throws InterruptedException;
+
+ /**
+ * Inserts the specified element at the end of this deque,
+ * waiting up to the specified wait time if necessary for space to
+ * become available.
+ *
+ * @param e the element to add
+ * @param timeout how long to wait before giving up, in units of
+ * <tt>unit</tt>
+ * @param unit a <tt>TimeUnit</tt> determining how to interpret the
+ * <tt>timeout</tt> parameter
+ * @return <tt>true</tt> if successful, or <tt>false</tt> if
+ * the specified waiting time elapses before space is available
+ * @throws InterruptedException if interrupted while waiting
+ * @throws ClassCastException if the class of the specified element
+ * prevents it from being added to this deque
+ * @throws NullPointerException if the specified element is null
+ * @throws IllegalArgumentException if some property of the specified
+ * element prevents it from being added to this deque
+ */
+ boolean offerLast(E e, long timeout, TimeUnit unit)
+ throws InterruptedException;
+
+ /**
+ * Retrieves and removes the first element of this deque, waiting
+ * if necessary until an element becomes available.
+ *
+ * @return the head of this deque
+ * @throws InterruptedExcepti...
[truncated message content] |
|
From: <ls...@us...> - 2007-07-07 20:30:28
|
Revision: 3362
http://jnode.svn.sourceforge.net/jnode/?rev=3362&view=rev
Author: lsantha
Date: 2007-07-07 13:30:27 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/java/java/util/concurrent/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-07 13:06:07
|
Revision: 3361
http://jnode.svn.sourceforge.net/jnode/?rev=3361&view=rev
Author: lsantha
Date: 2007-07-07 06:06:05 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/icedtea/sun/awt/
trunk/core/src/icedtea/sun/awt/DebugHelper.java
trunk/core/src/icedtea/sun/dc/
trunk/core/src/icedtea/sun/dc/path/
trunk/core/src/icedtea/sun/dc/path/FastPathProducer.java
trunk/core/src/icedtea/sun/dc/path/PathConsumer.java
trunk/core/src/icedtea/sun/dc/path/PathException.java
trunk/core/src/icedtea/sun/dc/pr/
trunk/core/src/icedtea/sun/dc/pr/PRException.java
trunk/core/src/icedtea/sun/dc/pr/PathDasher.java
trunk/core/src/icedtea/sun/dc/pr/PathStroker.java
trunk/core/src/icedtea/sun/dc/pr/Rasterizer.java
Added: trunk/core/src/icedtea/sun/awt/DebugHelper.java
===================================================================
--- trunk/core/src/icedtea/sun/awt/DebugHelper.java (rev 0)
+++ trunk/core/src/icedtea/sun/awt/DebugHelper.java 2007-07-07 13:06:05 UTC (rev 3361)
@@ -0,0 +1,84 @@
+/*
+* @(#)DebugHelper.java.m4 1.11 07/05/05
+*
+* Copyright 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation. Sun designates this
+* particular file as subject to the "Classpath" exception as provided
+* by Sun in the LICENSE file that accompanied this code.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+* CA 95054 USA or visit www.sun.com if you need additional information or
+* have any questions.
+*/
+
+/*
+ * This class is produced by using the m4 preprocessor to produce
+ * a .java file containing debug or release versions of the
+ * DebugHelper class.
+ */
+
+package sun.awt;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+public abstract class DebugHelper {
+ static {
+ NativeLibLoader.loadLibraries();
+ }
+
+ /* name the DebugHelper member var must be declared as */
+ protected static final String DBG_FIELD_NAME = "dbg";
+ protected static final String DBG_ON_FIELD_NAME = "on";
+
+
+/* RELEASE RELEASE RELEASE RELEASE RELEASE RELEASE RELEASE RELEASE */
+ public static final boolean on = false;
+ private static final DebugHelper dbgStub = new DebugHelperStub();
+
+ static void init() {
+ // nothing to do in release mode
+ }
+
+ public static final DebugHelper create(Class classToDebug) {
+ return dbgStub;
+ }
+/* RELEASE RELEASE RELEASE RELEASE RELEASE RELEASE RELEASE RELEASE */
+
+
+ public abstract void setAssertOn(boolean enabled);
+ public abstract void setTraceOn(boolean enabled);
+ public abstract void setDebugOn(boolean enabled);
+ public abstract void println(Object object);
+ public abstract void print(Object object);
+ public abstract void printStackTrace();
+ public abstract void assertion(boolean expr);
+ public abstract void assertion(boolean expr, String msg);
+}
+
+final class DebugHelperStub extends DebugHelper
+{
+ /* stub methods for production builds */
+ public void setAssertOn(boolean enabled) {}
+ public void setTraceOn(boolean enabled) {}
+ public void setDebugOn(boolean enabled) {}
+ public void println(Object object) {}
+ public void print(Object object) {}
+ public void printStackTrace() {}
+ public void assertion(boolean expr) {}
+ public void assertion(boolean expr, String msg) {}
+}
Added: trunk/core/src/icedtea/sun/dc/path/FastPathProducer.java
===================================================================
--- trunk/core/src/icedtea/sun/dc/path/FastPathProducer.java (rev 0)
+++ trunk/core/src/icedtea/sun/dc/path/FastPathProducer.java 2007-07-07 13:06:05 UTC (rev 3361)
@@ -0,0 +1,56 @@
+/* FastPathProducer.java -- stub file.
+ Copyright (C) 2007 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package sun.dc.path;
+
+import sun.java2d.pipe.ShapeSpanIterator;
+
+public class FastPathProducer {
+
+ public void sendTo(ShapeSpanIterator iterator) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void sendTo(PathConsumer adapter) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: trunk/core/src/icedtea/sun/dc/path/PathConsumer.java
===================================================================
--- trunk/core/src/icedtea/sun/dc/path/PathConsumer.java (rev 0)
+++ trunk/core/src/icedtea/sun/dc/path/PathConsumer.java 2007-07-07 13:06:05 UTC (rev 3361)
@@ -0,0 +1,60 @@
+/* PathConsumer.java -- stub file.
+ Copyright (C) 2007 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package sun.dc.path;
+
+public interface PathConsumer {
+
+ void beginPath();
+
+ void beginSubpath(float mx, float my);
+
+ void appendLine(float f, float g);
+
+ void appendQuadratic(float f, float g, float h, float i);
+
+ void appendCubic(float f, float g, float h, float i, float j, float k);
+
+ void closedSubpath();
+
+ void endPath() throws PathException;
+
+ void dispose();
+
+ PathConsumer getConsumer();
+
+}
Added: trunk/core/src/icedtea/sun/dc/path/PathException.java
===================================================================
--- trunk/core/src/icedtea/sun/dc/path/PathException.java (rev 0)
+++ trunk/core/src/icedtea/sun/dc/path/PathException.java 2007-07-07 13:06:05 UTC (rev 3361)
@@ -0,0 +1,42 @@
+/* PathException.java -- stub file.
+ Copyright (C) 2007 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package sun.dc.path;
+
+public class PathException extends Exception {
+
+}
Added: trunk/core/src/icedtea/sun/dc/pr/PRException.java
===================================================================
--- trunk/core/src/icedtea/sun/dc/pr/PRException.java (rev 0)
+++ trunk/core/src/icedtea/sun/dc/pr/PRException.java 2007-07-07 13:06:05 UTC (rev 3361)
@@ -0,0 +1,42 @@
+/* PRException.java -- stub file.
+ Copyright (C) 2007 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package sun.dc.pr;
+
+public class PRException extends Exception {
+
+}
Added: trunk/core/src/icedtea/sun/dc/pr/PathDasher.java
===================================================================
--- trunk/core/src/icedtea/sun/dc/pr/PathDasher.java (rev 0)
+++ trunk/core/src/icedtea/sun/dc/pr/PathDasher.java 2007-07-07 13:06:05 UTC (rev 3361)
@@ -0,0 +1,115 @@
+/* PathDasher.java -- stub file.
+ Copyright (C) 2007 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package sun.dc.pr;
+
+import sun.dc.path.PathConsumer;
+
+public class PathDasher implements PathConsumer {
+
+ public PathDasher(PathStroker stroker) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated constructor stub
+ }
+
+ public void setDash(float[] dash, float dash_phase) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setDashT4(Object object) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void dispose() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void appendCubic(float f, float g, float h, float i, float j, float k) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void appendLine(float f, float g) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void appendQuadratic(float f, float g, float h, float i) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void beginPath() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void beginSubpath(float mx, float my) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void closedSubpath() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void endPath() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public PathConsumer getConsumer() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: trunk/core/src/icedtea/sun/dc/pr/PathStroker.java
===================================================================
--- trunk/core/src/icedtea/sun/dc/pr/PathStroker.java (rev 0)
+++ trunk/core/src/icedtea/sun/dc/pr/PathStroker.java 2007-07-07 13:06:05 UTC (rev 3361)
@@ -0,0 +1,133 @@
+/* PathStroker.java -- stub file.
+ Copyright (C) 2007 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package sun.dc.pr;
+
+import sun.dc.path.PathConsumer;
+
+public class PathStroker implements PathConsumer {
+
+ public PathStroker(PathConsumer consumer) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated constructor stub
+ }
+
+ public void setPenDiameter(float width) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setPenT4(Object object) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setCaps(int i) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setCorners(int i, float miterlimit) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void dispose() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void appendCubic(float f, float g, float h, float i, float j, float k) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void appendLine(float f, float g) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void appendQuadratic(float f, float g, float h, float i) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void beginPath() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void beginSubpath(float mx, float my) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void closedSubpath() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void endPath() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setPenFitting(float penUnits, int minPenUnits) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public PathConsumer getConsumer() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: trunk/core/src/icedtea/sun/dc/pr/Rasterizer.java
===================================================================
--- trunk/core/src/icedtea/sun/dc/pr/Rasterizer.java (rev 0)
+++ trunk/core/src/icedtea/sun/dc/pr/Rasterizer.java 2007-07-07 13:06:05 UTC (rev 3361)
@@ -0,0 +1,180 @@
+/* Rasterizer.java -- stub file.
+ Copyright (C) 2007 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package sun.dc.pr;
+
+public class Rasterizer {
+
+ public static final int BUTT = 0;
+ public static final int ROUND = 0;
+ public static final int SQUARE = 0;
+ public static final int MITER = 0;
+ public static final int BEVEL = 0;
+ public static final int TILE_IS_GENERAL = 0;
+ public static final String STROKE = null;
+ public static final String EOFILL = null;
+ public static final String NZFILL = null;
+ public static int TILE_SIZE;
+ public static int TILE_IS_ALL_0;
+
+ public void getAlphaBox(int[] abox) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setOutputArea(int i, int j, int k, int l) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public int getTileState() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void nextTile() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void reset() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void writeAlpha(byte[] alpha, int xstride, int ystride, int offset) throws InterruptedException {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setPenDiameter(float minPenSizeAA) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setUsage(String stroke2) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setPenT4(float[] matrix) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setPenFitting(float penUnits, int minPenUnitsAA) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setCaps(int i) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setCorners(int i, float miterLimit) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setDash(float[] dashes, float dashPhase) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setDashT4(float[] matrix) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void beginPath() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void beginSubpath(float mx, float my) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void appendLine(float f, float g) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void appendQuadratic(float f, float g, float h, float i) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void appendCubic(float f, float g, float h, float i, float j, float k) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void closedSubpath() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void endPath() throws PRException {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-07 12:59:25
|
Revision: 3360
http://jnode.svn.sourceforge.net/jnode/?rev=3360&view=rev
Author: lsantha
Date: 2007-07-07 05:59:24 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/descriptors/org.classpath.ext.xml
Modified: trunk/core/descriptors/org.classpath.ext.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.xml 2007-07-07 12:53:45 UTC (rev 3359)
+++ trunk/core/descriptors/org.classpath.ext.xml 2007-07-07 12:59:24 UTC (rev 3360)
@@ -53,6 +53,32 @@
<export name="javax.swing.undo.*"/>
<export name="org.ietf.jgss.*"/>
+
+ <export name="com.sun.java.swing.plaf.windows.DesktopProperty"/>
+ <export name="com.sun.swing.internal.plaf.basic.resources.*"/>
+ <export name="com.sun.swing.internal.plaf.metal.resources.*"/>
+ <export name="com.sun.swing.internal.plaf.synth.resources.*"/>
+ <export name="sun.awt.*"/>
+ <export name="sun.awt.im.*"/>
+ <export name="sun.awt.image.*"/>
+ <export name="sun.awt.datatransfer.*"/>
+ <export name="sun.awt.dnd.*"/>
+ <export name="sun.awt.geom.*"/>
+ <export name="sun.awt.shell.*"/>
+ <export name="sun.font.*"/>
+ <export name="sun.java2d.*"/>
+ <export name="sun.java2d.loops.*"/>
+ <export name="sun.java2d.pipe.*"/>
+ <export name="sun.print.*"/>
+ <export name="sun.swing.*"/>
+ <export name="sun.swing.icon.*"/>
+ <export name="sun.swing.plaf.synth.*"/>
+ <export name="sun.swing.plaf.windows.*"/>
+ <export name="sun.swing.table.*"/>
+ <export name="sun.swing.text.*"/>
+ <export name="sun.swing.text.html.*"/>
+
+
</library>
</runtime>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-07 12:53:46
|
Revision: 3359
http://jnode.svn.sourceforge.net/jnode/?rev=3359&view=rev
Author: lsantha
Date: 2007-07-07 05:53:45 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingJFramePeer.java
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingJFramePeer.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingJFramePeer.java 2007-07-07 12:52:37 UTC (rev 3358)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingJFramePeer.java 2007-07-07 12:53:45 UTC (rev 3359)
@@ -146,6 +146,22 @@
}
}
+ @Override
+ public void paint(Graphics g) {
+ super.paint(g);
+ if (target != null) {
+ target.paint(g);
+ }
+ }
+
+ @Override
+ public void update(Graphics g) {
+ super.update(g);
+ if (target != null) {
+ target.update(g);
+ }
+ }
+
private final class ContentPane extends JComponent {
private awtT target;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-07 12:52:39
|
Revision: 3358
http://jnode.svn.sourceforge.net/jnode/?rev=3358&view=rev
Author: lsantha
Date: 2007-07-07 05:52:37 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/java/java/awt/RenderingHints.java
trunk/core/src/classpath/java/java/awt/font/FontRenderContext.java
Deleted: trunk/core/src/classpath/java/java/awt/RenderingHints.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/RenderingHints.java 2007-07-07 12:47:46 UTC (rev 3357)
+++ trunk/core/src/classpath/java/java/awt/RenderingHints.java 2007-07-07 12:52:37 UTC (rev 3358)
@@ -1,804 +0,0 @@
-/* RenderingHints.java --
- Copyright (C) 2000, 2001, 2002, 2004, 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A collection of (key, value) items that provide 'hints' for the
- * {@link java.awt.Graphics2D} rendering pipeline. Because these
- * items are hints only, they may be ignored by a particular
- * {@link java.awt.Graphics2D} implementation.
- *
- * @author Rolf W. Rasmussen (ro...@ii...)
- * @author Eric Blake (eb...@em...)
- */
-public class RenderingHints
- implements Map<Object,Object>, Cloneable
-{
- /**
- * The base class used to represent keys.
- */
- public abstract static class Key
- {
- private final int key;
-
- /**
- * Creates a new key.
- *
- * @param privateKey the private key.
- */
- protected Key(int privateKey)
- {
- key = privateKey;
- }
-
- /**
- * Returns <code>true</code> if the specified value is compatible with
- * this key, and <code>false</code> otherwise.
- *
- * @param value the value (<code>null</code> permitted).
- *
- * @return A boolean.
- */
- public abstract boolean isCompatibleValue(Object value);
-
- /**
- * Returns the private key for this instance.
- *
- * @return The private key.
- */
- protected final int intKey()
- {
- return key;
- }
-
- /**
- * Returns a hash code for the key.
- *
- * @return A hash code.
- */
- public final int hashCode()
- {
- return System.identityHashCode(this);
- }
-
- /**
- * Checks this key for equality with an arbitrary object.
- *
- * @param other the object (<code>null</code> permitted)
- *
- * @return A boolean.
- */
- public final boolean equals(Object other)
- {
- return this == other;
- }
- } // class Key
-
- private static final class KeyImpl extends Key
- {
- final String description;
- final Object v1;
- final Object v2;
- final Object v3;
-
- KeyImpl(int privateKey, String description,
- Object v1, Object v2, Object v3)
- {
- super(privateKey);
- this.description = description;
- this.v1 = v1;
- this.v2 = v2;
- this.v3 = v3;
- }
-
- /**
- * Returns <code>true</code> if the specified value is compatible with
- * this key, and <code>false</code> otherwise.
- *
- * @param value the value (<code>null</code> permitted).
- *
- * @return A boolean.
- */
- public boolean isCompatibleValue(Object value)
- {
- return value == v1 || value == v2 || value == v3;
- }
-
- /**
- * Returns a string representation of the key.
- *
- * @return A string.
- */
- public String toString()
- {
- return description;
- }
- } // class KeyImpl
-
- private HashMap hintMap = new HashMap();
-
- /**
- * A key for the 'antialiasing' hint. Permitted values are:
- * <p>
- * <table>
- * <tr>
- * <td>{@link #VALUE_ANTIALIAS_OFF}</td>
- * <td>Render without antialiasing (better speed).</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_ANTIALIAS_ON}</td>
- * <td>Render with antialiasing (better quality).</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_ANTIALIAS_DEFAULT}</td>
- * <td>Use the default value for antialiasing.</td>
- * </tr>
- * </table>
- */
- public static final Key KEY_ANTIALIASING;
-
- /**
- * This value is for use with the {@link #KEY_ANTIALIASING} key.
- */
- public static final Object VALUE_ANTIALIAS_ON
- = "Antialiased rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_ANTIALIASING} key.
- */
- public static final Object VALUE_ANTIALIAS_OFF
- = "Nonantialiased rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_ANTIALIASING} key.
- */
- public static final Object VALUE_ANTIALIAS_DEFAULT
- = "Default antialiasing rendering mode";
-
- /**
- * A key for the 'rendering' hint. Permitted values are:
- * <p>
- * <table>
- * <tr>
- * <td>{@link #VALUE_RENDER_SPEED}</td>
- * <td>Prefer speed over quality when rendering.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_RENDER_QUALITY}</td>
- * <td>Prefer quality over speed when rendering.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_RENDER_DEFAULT}</td>
- * <td>Use the default value for quality vs. speed when rendering.</td>
- * </tr>
- * </table>
- */
- public static final Key KEY_RENDERING;
-
- /**
- * This value is for use with the {@link #KEY_RENDERING} key.
- */
- public static final Object VALUE_RENDER_SPEED
- = "Fastest rendering methods";
-
- /**
- * This value is for use with the {@link #KEY_RENDERING} key.
- */
- public static final Object VALUE_RENDER_QUALITY
- = "Highest quality rendering methods";
-
- /**
- * This value is for use with the {@link #KEY_RENDERING} key.
- */
- public static final Object VALUE_RENDER_DEFAULT
- = "Default rendering methods";
-
- /**
- * A key for the 'dithering' hint. Permitted values are:
- * <p>
- * <table>
- * <tr>
- * <td>{@link #VALUE_DITHER_DISABLE}</td>
- * <td>Disable dithering.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_DITHER_ENABLE}</td>
- * <td>Enable dithering.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_DITHER_DEFAULT}</td>
- * <td>Use the default value for dithering.</td>
- * </tr>
- * </table>
- */
- public static final Key KEY_DITHERING;
-
- /**
- * This value is for use with the {@link #KEY_DITHERING} key.
- */
- public static final Object VALUE_DITHER_DISABLE
- = "Nondithered rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_DITHERING} key.
- */
- public static final Object VALUE_DITHER_ENABLE
- = "Dithered rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_DITHERING} key.
- */
- public static final Object VALUE_DITHER_DEFAULT
- = "Default dithering mode";
-
- /**
- * A key for the 'text antialiasing' hint. Permitted values are:
- * <p>
- * <table>
- * <tr>
- * <td>{@link #VALUE_TEXT_ANTIALIAS_ON}</td>
- * <td>Render text with antialiasing (better quality usually).</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_TEXT_ANTIALIAS_OFF}</td>
- * <td>Render test without antialiasing (better speed).</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_TEXT_ANTIALIAS_DEFAULT}</td>
- * <td>Use the default value for text antialiasing.</td>
- * </tr>
- * </table>
- */
- public static final Key KEY_TEXT_ANTIALIASING;
-
- /**
- * This value is for use with the {@link #KEY_TEXT_ANTIALIASING} key.
- */
- public static final Object VALUE_TEXT_ANTIALIAS_ON
- = "Antialiased text mode";
-
- /**
- * This value is for use with the {@link #KEY_TEXT_ANTIALIASING} key.
- */
- public static final Object VALUE_TEXT_ANTIALIAS_OFF
- = "Nonantialiased text mode";
-
- /**
- * This value is for use with the {@link #KEY_TEXT_ANTIALIASING} key.
- */
- public static final Object VALUE_TEXT_ANTIALIAS_DEFAULT
- = "Default antialiasing text mode";
-
- /**
- * A key for the 'fractional metrics' hint. Permitted values are:
- * <p>
- * <table>
- * <tr>
- * <td>{@link #VALUE_FRACTIONALMETRICS_OFF}</td>
- * <td>Render text with fractional metrics off.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_FRACTIONALMETRICS_ON}</td>
- * <td>Render text with fractional metrics on.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_FRACTIONALMETRICS_DEFAULT}</td>
- * <td>Use the default value for fractional metrics.</td>
- * </tr>
- * </table>
- */
- public static final Key KEY_FRACTIONALMETRICS;
-
- /**
- * This value is for use with the {@link #KEY_FRACTIONALMETRICS} key.
- */
- public static final Object VALUE_FRACTIONALMETRICS_OFF
- = "Integer text metrics mode";
-
- /**
- * This value is for use with the {@link #KEY_FRACTIONALMETRICS} key.
- */
- public static final Object VALUE_FRACTIONALMETRICS_ON
- = "Fractional text metrics mode";
-
- /**
- * This value is for use with the {@link #KEY_FRACTIONALMETRICS} key.
- */
- public static final Object VALUE_FRACTIONALMETRICS_DEFAULT
- = "Default fractional text metrics mode";
-
- /**
- * A key for the 'interpolation' hint. Permitted values are:
- * <p>
- * <table>
- * <tr>
- * <td>{@link #VALUE_INTERPOLATION_NEAREST_NEIGHBOR}</td>
- * <td>Use nearest neighbour interpolation.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_INTERPOLATION_BILINEAR}</td>
- * <td>Use bilinear interpolation.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_INTERPOLATION_BICUBIC}</td>
- * <td>Use bicubic interpolation.</td>
- * </tr>
- * </table>
- */
- public static final Key KEY_INTERPOLATION;
-
- /**
- * This value is for use with the {@link #KEY_INTERPOLATION} key.
- */
- public static final Object VALUE_INTERPOLATION_NEAREST_NEIGHBOR
- = "Nearest Neighbor image interpolation mode";
-
- /**
- * This value is for use with the {@link #KEY_INTERPOLATION} key.
- */
- public static final Object VALUE_INTERPOLATION_BILINEAR
- = "Bilinear image interpolation mode";
-
- /**
- * This value is for use with the {@link #KEY_INTERPOLATION} key.
- */
- public static final Object VALUE_INTERPOLATION_BICUBIC
- = "Bicubic image interpolation mode";
-
- /**
- * A key for the 'alpha interpolation' hint. Permitted values are:
- * <p>
- * <table>
- * <tr>
- * <td>{@link #VALUE_ALPHA_INTERPOLATION_SPEED}</td>
- * <td>Prefer speed over quality.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_ALPHA_INTERPOLATION_QUALITY}</td>
- * <td>Prefer quality over speed.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_ALPHA_INTERPOLATION_DEFAULT}</td>
- * <td>Use the default setting.</td>
- * </tr>
- * </table>
- */
- public static final Key KEY_ALPHA_INTERPOLATION;
-
- /**
- * This value is for use with the {@link #KEY_ALPHA_INTERPOLATION} key.
- */
- public static final Object VALUE_ALPHA_INTERPOLATION_SPEED
- = "Fastest alpha blending methods";
-
- /**
- * This value is for use with the {@link #KEY_ALPHA_INTERPOLATION} key.
- */
- public static final Object VALUE_ALPHA_INTERPOLATION_QUALITY
- = "Highest quality alpha blending methods";
-
- /**
- * This value is for use with the {@link #KEY_ALPHA_INTERPOLATION} key.
- */
- public static final Object VALUE_ALPHA_INTERPOLATION_DEFAULT
- = "Default alpha blending methods";
-
- /**
- * A key for the 'color rendering' hint. Permitted values are:
- * <p>
- * <table>
- * <tr>
- * <td>{@link #VALUE_COLOR_RENDER_SPEED}</td>
- * <td>Prefer speed over quality.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_COLOR_RENDER_QUALITY}</td>
- * <td>Prefer quality over speed.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_COLOR_RENDER_DEFAULT}</td>
- * <td>Use the default setting.</td>
- * </tr>
- * </table>
- */
- public static final Key KEY_COLOR_RENDERING;
-
- /**
- * This value is for use with the {@link #KEY_COLOR_RENDERING} key.
- */
- public static final Object VALUE_COLOR_RENDER_SPEED
- = "Fastest color rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_COLOR_RENDERING} key.
- */
- public static final Object VALUE_COLOR_RENDER_QUALITY
- = "Highest quality color rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_COLOR_RENDERING} key.
- */
- public static final Object VALUE_COLOR_RENDER_DEFAULT
- = "Default color rendering mode";
-
- /**
- * A key for the 'stroke control' hint. Permitted values are:
- * <p>
- * <table>
- * <tr>
- * <td>{@link #VALUE_STROKE_DEFAULT}</td>
- * <td>Use the default setting.</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_STROKE_NORMALIZE}</td>
- * <td>XXX</td>
- * </tr>
- * <tr>
- * <td>{@link #VALUE_STROKE_PURE}</td>
- * <td>XXX</td>
- * </tr>
- * </table>
- */
- public static final Key KEY_STROKE_CONTROL;
-
- /**
- * This value is for use with the {@link #KEY_STROKE_CONTROL} key.
- */
- public static final Object VALUE_STROKE_DEFAULT
- = "Default stroke normalization";
-
- /**
- * This value is for use with the {@link #KEY_STROKE_CONTROL} key.
- */
- public static final Object VALUE_STROKE_NORMALIZE
- = "Normalize strokes for consistent rendering";
-
- /**
- * This value is for use with the {@link #KEY_STROKE_CONTROL} key.
- */
- public static final Object VALUE_STROKE_PURE
- = "Pure stroke conversion for accurate paths";
-
- static
- {
- KEY_ANTIALIASING = new KeyImpl(1, "Global antialiasing enable key",
- VALUE_ANTIALIAS_ON,
- VALUE_ANTIALIAS_OFF,
- VALUE_ANTIALIAS_DEFAULT);
- KEY_RENDERING = new KeyImpl(2, "Global rendering quality key",
- VALUE_RENDER_SPEED,
- VALUE_RENDER_QUALITY,
- VALUE_RENDER_DEFAULT);
- KEY_DITHERING = new KeyImpl(3, "Dithering quality key",
- VALUE_DITHER_DISABLE,
- VALUE_DITHER_ENABLE,
- VALUE_DITHER_DEFAULT);
- KEY_TEXT_ANTIALIASING
- = new KeyImpl(4, "Text-specific antialiasing enable key",
- VALUE_TEXT_ANTIALIAS_ON,
- VALUE_TEXT_ANTIALIAS_OFF,
- VALUE_TEXT_ANTIALIAS_DEFAULT);
- KEY_FRACTIONALMETRICS = new KeyImpl(5, "Fractional metrics enable key",
- VALUE_FRACTIONALMETRICS_OFF,
- VALUE_FRACTIONALMETRICS_ON,
- VALUE_FRACTIONALMETRICS_DEFAULT);
- KEY_INTERPOLATION = new KeyImpl(6, "Image interpolation method key",
- VALUE_INTERPOLATION_NEAREST_NEIGHBOR,
- VALUE_INTERPOLATION_BILINEAR,
- VALUE_INTERPOLATION_BICUBIC);
- KEY_ALPHA_INTERPOLATION
- = new KeyImpl(7, "Alpha blending interpolation method key",
- VALUE_ALPHA_INTERPOLATION_SPEED,
- VALUE_ALPHA_INTERPOLATION_QUALITY,
- VALUE_ALPHA_INTERPOLATION_DEFAULT);
- KEY_COLOR_RENDERING = new KeyImpl(8, "Color rendering quality key",
- VALUE_COLOR_RENDER_SPEED,
- VALUE_COLOR_RENDER_QUALITY,
- VALUE_COLOR_RENDER_DEFAULT);
- KEY_STROKE_CONTROL = new KeyImpl(9, "Stroke normalization control key",
- VALUE_STROKE_DEFAULT,
- VALUE_STROKE_NORMALIZE,
- VALUE_STROKE_PURE);
- }
-
- /**
- * Creates a new collection of hints containing all the (key, value) pairs
- * in the specified map.
- *
- * @param init a map containing a collection of hints (<code>null</code>
- * permitted).
- */
- public RenderingHints(Map<Key,?> init)
- {
- if (init != null)
- putAll(init);
- }
-
- /**
- * Creates a new collection containing a single (key, value) pair.
- *
- * @param key the key.
- * @param value the value.
- */
- public RenderingHints(Key key, Object value)
- {
- put(key, value);
- }
-
- /**
- * Returns the number of hints in the collection.
- *
- * @return The number of hints.
- */
- public int size()
- {
- return hintMap.size();
- }
-
- /**
- * Returns <code>true</code> if there are no hints in the collection,
- * and <code>false</code> otherwise.
- *
- * @return A boolean.
- */
- public boolean isEmpty()
- {
- return hintMap.isEmpty();
- }
-
- /**
- * Returns <code>true</code> if the collection of hints contains the
- * specified key, and <code>false</code> otherwise.
- *
- * @param key the key (<code>null</code> not permitted).
- *
- * @return A boolean.
- *
- * @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @throws ClassCastException if <code>key</code> is not a {@link Key}.
- */
- public boolean containsKey(Object key)
- {
- if (key == null)
- throw new NullPointerException();
- // don't remove the cast, it is necessary to throw the required exception
- return hintMap.containsKey((Key) key);
- }
-
- /**
- * Returns <code>true</code> if the collection of hints contains the
- * specified value, and <code>false</code> otherwise.
- *
- * @param value the value.
- *
- * @return A boolean.
- */
- public boolean containsValue(Object value)
- {
- return hintMap.containsValue(value);
- }
-
- /**
- * Returns the value associated with the specified key, or <code>null</code>
- * if there is no value defined for the key.
- *
- * @param key the key (<code>null</code> permitted).
- *
- * @return The value (possibly <code>null</code>).
- *
- * @throws ClassCastException if <code>key</code> is not a {@link Key}.
- *
- * @see #containsKey(Object)
- */
- public Object get(Object key)
- {
- // don't remove the cast, it is necessary to throw the required exception
- return hintMap.get((Key) key);
- }
-
- /**
- * Adds a (key, value) pair to the collection of hints (if the
- * collection already contains the specified key, then the
- * value is updated).
- *
- * @param key the key.
- * @param value the value.
- *
- * @return the previous value of the key or <code>null</code> if the key
- * didn't have a value yet.
- */
- public Object put(Object key, Object value)
- {
- if (key == null || value == null)
- throw new NullPointerException();
- if (! ((Key) key).isCompatibleValue(value))
- throw new IllegalArgumentException();
- return hintMap.put(key, value);
- }
-
- /**
- * Adds all the hints from a collection to this collection.
- *
- * @param hints the hint collection.
- */
- public void add(RenderingHints hints)
- {
- hintMap.putAll(hints);
- }
-
- /**
- * Clears all the hints from this collection.
- */
- public void clear()
- {
- hintMap.clear();
- }
-
- /**
- * Removes a hint from the collection.
- *
- * @param key the key.
- *
- * @return The value that was associated with the key, or <code>null</code> if
- * the key was not part of the collection
- *
- * @throws ClassCastException if the key is not a subclass of
- * {@link RenderingHints.Key}.
- */
- public Object remove(Object key)
- {
- // don't remove the (Key) cast, it is necessary to throw the exception
- // required by the spec
- return hintMap.remove((Key) key);
- }
-
- /**
- * Adds a collection of (key, value) pairs to the collection.
- *
- * @param m a map containing (key, value) items.
- *
- * @throws ClassCastException if the map contains a key that is not
- * a subclass of {@link RenderingHints.Key}.
- * @throws IllegalArgumentException if the map contains a value that is
- * not compatible with its key.
- */
- public void putAll(Map<?,?> m)
- {
- // preprocess map to generate appropriate exceptions
- Iterator iterator = m.keySet().iterator();
- while (iterator.hasNext())
- {
- Key key = (Key) iterator.next();
- if (!key.isCompatibleValue(m.get(key)))
- throw new IllegalArgumentException();
- }
- // map is OK, update
- hintMap.putAll(m);
- }
-
- /**
- * Returns a set containing the keys from this collection.
- *
- * @return A set of keys.
- */
- public Set<Object> keySet()
- {
- return hintMap.keySet();
- }
-
- /**
- * Returns a collection of the values from this hint collection. The
- * collection is backed by the <code>RenderingHints</code> instance,
- * so updates to one will affect the other.
- *
- * @return A collection of values.
- */
- public Collection<Object> values()
- {
- return hintMap.values();
- }
-
- /**
- * Returns a set of entries from the collection.
- *
- * @return A set of entries.
- */
- public Set<Map.Entry<Object,Object>> entrySet()
- {
- return Collections.unmodifiableSet(hintMap.entrySet());
- }
-
- /**
- * Checks this collection for equality with an arbitrary object.
- *
- * @param o the object (<code>null</code> permitted)
- *
- * @return A boolean.
- */
- public boolean equals(Object o)
- {
- return hintMap.equals(o);
- }
-
- /**
- * Returns a hash code for the collection of hints.
- *
- * @return A hash code.
- */
- public int hashCode()
- {
- return hintMap.hashCode();
- }
-
- /**
- * Creates a clone of this instance.
- *
- * @return A clone.
- */
- public Object clone()
- {
- try
- {
- RenderingHints copy = (RenderingHints) super.clone();
- copy.hintMap = (HashMap) hintMap.clone();
- return copy;
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-
- /**
- * Returns a string representation of this instance.
- *
- * @return A string.
- */
- public String toString()
- {
- return hintMap.toString();
- }
-} // class RenderingHints
Deleted: trunk/core/src/classpath/java/java/awt/font/FontRenderContext.java
===================================================================
--- trunk/core/src/classpath/java/java/awt/font/FontRenderContext.java 2007-07-07 12:47:46 UTC (rev 3357)
+++ trunk/core/src/classpath/java/java/awt/font/FontRenderContext.java 2007-07-07 12:52:37 UTC (rev 3358)
@@ -1,138 +0,0 @@
-/* FontRenderContext.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.awt.geom.AffineTransform;
-
-/**
- * @author Michael Koch
- */
-public class FontRenderContext
-{
- private AffineTransform affineTransform;
- private boolean isAntiAliased;
- private boolean usesFractionalMetrics;
-
- /**
- * Construct a new <code>FontRenderContext</code>.
- */
- protected FontRenderContext()
- {
- // Do nothing here.
- }
-
- /**
- * Construct a new <code>FontRenderContext</code>.
- */
- public FontRenderContext (AffineTransform tx, boolean isAntiAliased,
- boolean usesFractionalMetrics)
- {
- if (tx != null
- && !tx.isIdentity ())
- {
- this.affineTransform = new AffineTransform (tx);
- }
-
- this.isAntiAliased = isAntiAliased;
- this.usesFractionalMetrics = usesFractionalMetrics;
- }
-
- public boolean equals (Object obj)
- {
- if (! (obj instanceof FontRenderContext))
- return false;
-
- return equals ((FontRenderContext) obj);
- }
-
- public boolean equals (FontRenderContext rhs)
- {
- if (rhs == null)
- return false;
-
- if (affineTransform == null && rhs.affineTransform != null
- || affineTransform != null && rhs.affineTransform == null)
- return false;
-
- return ((affineTransform == rhs.affineTransform
- || affineTransform.equals (rhs.getTransform ()))
- && isAntiAliased == rhs.isAntiAliased ()
- && usesFractionalMetrics == rhs.usesFractionalMetrics ());
- }
-
-
- /**
- * Retrieves the affine transform for scaling typographical points
- * to raster pixels.
- *
- * @return a clone of the transform object.
- */
- public AffineTransform getTransform ()
- {
- if (affineTransform == null)
- return new AffineTransform ();
- else
- return new AffineTransform (affineTransform);
- }
-
-
- /**
- * Returns the hash code of the font render context.
- */
- public int hashCode ()
- {
- int code = ( isAntiAliased ? 1 : 0 ) + ( usesFractionalMetrics ? 2 : 0 );
-
- if( affineTransform != null && !affineTransform.isIdentity() )
- code ^= affineTransform.hashCode();
-
- return code;
- }
-
- public boolean isAntiAliased ()
- {
- return isAntiAliased;
- }
-
- public boolean usesFractionalMetrics ()
- {
- return usesFractionalMetrics;
- }
-}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-07 12:47:49
|
Revision: 3357
http://jnode.svn.sourceforge.net/jnode/?rev=3357&view=rev
Author: lsantha
Date: 2007-07-07 05:47:46 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/src/classpath/gnu/gnu/java/awt/peer/headless/HeadlessToolkit.java
Modified: trunk/core/src/classpath/gnu/gnu/java/awt/peer/headless/HeadlessToolkit.java
===================================================================
--- trunk/core/src/classpath/gnu/gnu/java/awt/peer/headless/HeadlessToolkit.java 2007-07-07 12:47:28 UTC (rev 3356)
+++ trunk/core/src/classpath/gnu/gnu/java/awt/peer/headless/HeadlessToolkit.java 2007-07-07 12:47:46 UTC (rev 3357)
@@ -43,36 +43,7 @@
import gnu.java.awt.peer.ClasspathFontPeer;
import gnu.java.awt.peer.EmbeddedWindowPeer;
-import java.awt.AWTException;
-import java.awt.Button;
-import java.awt.Canvas;
-import java.awt.Checkbox;
-import java.awt.CheckboxMenuItem;
-import java.awt.Choice;
-import java.awt.Dialog;
-import java.awt.Dimension;
-import java.awt.EventQueue;
-import java.awt.FileDialog;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Frame;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.awt.HeadlessException;
-import java.awt.Image;
-import java.awt.Label;
-import java.awt.List;
-import java.awt.Menu;
-import java.awt.MenuBar;
-import java.awt.MenuItem;
-import java.awt.Panel;
-import java.awt.PopupMenu;
-import java.awt.PrintJob;
-import java.awt.ScrollPane;
-import java.awt.Scrollbar;
-import java.awt.TextArea;
-import java.awt.TextField;
-import java.awt.Window;
+import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.peer.DragSourceContextPeer;
@@ -102,6 +73,7 @@
import java.awt.peer.TextAreaPeer;
import java.awt.peer.TextFieldPeer;
import java.awt.peer.WindowPeer;
+import java.awt.peer.DesktopPeer;
import java.io.InputStream;
import java.net.URL;
import java.util.Map;
@@ -368,4 +340,13 @@
return graphicsEnv;
}
+
+ public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType modalExclusionType) {
+ return false;
+ }
+
+
+ protected DesktopPeer createDesktopPeer(Desktop target) throws HeadlessException {
+ throw new HeadlessException();
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-07 12:47:29
|
Revision: 3356
http://jnode.svn.sourceforge.net/jnode/?rev=3356&view=rev
Author: lsantha
Date: 2007-07-07 05:47:28 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/gui/src/awt/org/jnode/awt/JNodeToolkit.java
Modified: trunk/gui/src/awt/org/jnode/awt/JNodeToolkit.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/JNodeToolkit.java 2007-07-07 12:46:16 UTC (rev 3355)
+++ trunk/gui/src/awt/org/jnode/awt/JNodeToolkit.java 2007-07-07 12:47:28 UTC (rev 3356)
@@ -27,21 +27,7 @@
import gnu.java.awt.peer.EmbeddedWindowPeer;
import gnu.java.security.action.GetPropertyAction;
-import java.awt.AWTError;
-import java.awt.AWTException;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.EventQueue;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Frame;
-import java.awt.Graphics;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.awt.Image;
-import java.awt.PrintJob;
-import java.awt.Toolkit;
+import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.im.InputMethodHighlight;
import java.awt.image.BufferedImage;
@@ -52,6 +38,7 @@
import java.awt.image.VolatileImage;
import java.awt.peer.FontPeer;
import java.awt.peer.RobotPeer;
+import java.awt.peer.DesktopPeer;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
@@ -963,4 +950,16 @@
return size() > max_entries;
}
}
+
+
+ public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType modalExclusionType) {
+ //todo implementit
+ return false;
+ }
+
+
+ protected DesktopPeer createDesktopPeer(Desktop target) throws HeadlessException {
+ //todo implementit
+ return null;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-07 12:46:21
|
Revision: 3355
http://jnode.svn.sourceforge.net/jnode/?rev=3355&view=rev
Author: lsantha
Date: 2007-07-07 05:46:16 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/com/com/sun/java/
trunk/core/src/openjdk/com/com/sun/java/swing/
trunk/core/src/openjdk/com/com/sun/java/swing/plaf/
trunk/core/src/openjdk/com/com/sun/java/swing/plaf/windows/
trunk/core/src/openjdk/com/com/sun/java/swing/plaf/windows/DesktopProperty.java
trunk/core/src/openjdk/com/com/sun/swing/
trunk/core/src/openjdk/com/com/sun/swing/internal/
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_de.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_es.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_it.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/resources/
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/resources/metal.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/resources/metal_de.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/resources/metal_es.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/resources/metal_fr.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/resources/metal_it.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/resources/metal_ja.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/resources/
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/resources/synth.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/resources/synth_de.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/resources/synth_es.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/resources/synth_fr.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/resources/synth_it.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/resources/synth_ja.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/resources/synth_sv.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties
trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties
trunk/core/src/openjdk/java/java/awt/
trunk/core/src/openjdk/java/java/awt/Desktop.java
trunk/core/src/openjdk/java/java/awt/GradientPaintContext.java
trunk/core/src/openjdk/java/java/awt/LinearGradientPaint.java
trunk/core/src/openjdk/java/java/awt/LinearGradientPaintContext.java
trunk/core/src/openjdk/java/java/awt/MultipleGradientPaint.java
trunk/core/src/openjdk/java/java/awt/MultipleGradientPaintContext.java
trunk/core/src/openjdk/java/java/awt/RadialGradientPaint.java
trunk/core/src/openjdk/java/java/awt/RadialGradientPaintContext.java
trunk/core/src/openjdk/java/java/awt/RenderingHints.java
trunk/core/src/openjdk/java/java/awt/SystemTray.java
trunk/core/src/openjdk/java/java/awt/TrayIcon.java
trunk/core/src/openjdk/java/java/awt/font/
trunk/core/src/openjdk/java/java/awt/font/FontRenderContext.java
trunk/core/src/openjdk/java/java/awt/font/LayoutPath.java
trunk/core/src/openjdk/java/java/awt/geom/
trunk/core/src/openjdk/java/java/awt/geom/Path2D.java
trunk/core/src/openjdk/java/java/awt/peer/
trunk/core/src/openjdk/java/java/awt/peer/DesktopPeer.java
trunk/core/src/openjdk/java/java/awt/peer/KeyboardFocusManagerPeer.java
trunk/core/src/openjdk/java/java/awt/peer/SystemTrayPeer.java
trunk/core/src/openjdk/java/java/awt/peer/TrayIconPeer.java
trunk/core/src/openjdk/javax/javax/swing/
trunk/core/src/openjdk/javax/javax/swing/DefaultRowSorter.java
trunk/core/src/openjdk/javax/javax/swing/DropMode.java
trunk/core/src/openjdk/javax/javax/swing/LayoutStyle.java
trunk/core/src/openjdk/javax/javax/swing/RowFilter.java
trunk/core/src/openjdk/javax/javax/swing/RowSorter.java
trunk/core/src/openjdk/javax/javax/swing/SortOrder.java
trunk/core/src/openjdk/javax/javax/swing/event/
trunk/core/src/openjdk/javax/javax/swing/event/RowSorterEvent.java
trunk/core/src/openjdk/javax/javax/swing/event/RowSorterListener.java
trunk/core/src/openjdk/javax/javax/swing/plaf.zip
trunk/core/src/openjdk/javax/javax/swing/table/
trunk/core/src/openjdk/javax/javax/swing/table/TableRowSorter.java
trunk/core/src/openjdk/javax/javax/swing/table/TableStringConverter.java
trunk/core/src/openjdk/sun/sun/awt/AWTAutoShutdown.java
trunk/core/src/openjdk/sun/sun/awt/AWTSecurityManager.java
trunk/core/src/openjdk/sun/sun/awt/AppContext.java
trunk/core/src/openjdk/sun/sun/awt/ComponentAccessor.java
trunk/core/src/openjdk/sun/sun/awt/ComponentFactory.java
trunk/core/src/openjdk/sun/sun/awt/ConstrainableGraphics.java
trunk/core/src/openjdk/sun/sun/awt/DefaultMouseInfoPeer.java
trunk/core/src/openjdk/sun/sun/awt/DesktopBrowse.java
trunk/core/src/openjdk/sun/sun/awt/DisplayChangedListener.java
trunk/core/src/openjdk/sun/sun/awt/FontConfiguration.java
trunk/core/src/openjdk/sun/sun/awt/FontDescriptor.java
trunk/core/src/openjdk/sun/sun/awt/GlobalCursorManager.java
trunk/core/src/openjdk/sun/sun/awt/HeadlessToolkit.java
trunk/core/src/openjdk/sun/sun/awt/InputMethodSupport.java
trunk/core/src/openjdk/sun/sun/awt/KeyboardFocusManagerPeerImpl.java
trunk/core/src/openjdk/sun/sun/awt/ModalityEvent.java
trunk/core/src/openjdk/sun/sun/awt/ModalityListener.java
trunk/core/src/openjdk/sun/sun/awt/NativeLibLoader.java
trunk/core/src/openjdk/sun/sun/awt/PeerEvent.java
trunk/core/src/openjdk/sun/sun/awt/SunDisplayChanger.java
trunk/core/src/openjdk/sun/sun/awt/SunHints.java
trunk/core/src/openjdk/sun/sun/awt/SunToolkit.java
trunk/core/src/openjdk/sun/sun/awt/UngrabEvent.java
trunk/core/src/openjdk/sun/sun/awt/WindowClosingListener.java
trunk/core/src/openjdk/sun/sun/awt/WindowClosingSupport.java
trunk/core/src/openjdk/sun/sun/awt/datatransfer/
trunk/core/src/openjdk/sun/sun/awt/datatransfer/ClipboardTransferable.java
trunk/core/src/openjdk/sun/sun/awt/datatransfer/DataTransferer.java
trunk/core/src/openjdk/sun/sun/awt/datatransfer/SunClipboard.java
trunk/core/src/openjdk/sun/sun/awt/datatransfer/ToolkitThreadBlockedHandler.java
trunk/core/src/openjdk/sun/sun/awt/datatransfer/TransferableProxy.java
trunk/core/src/openjdk/sun/sun/awt/dnd/
trunk/core/src/openjdk/sun/sun/awt/dnd/SunDragSourceContextPeer.java
trunk/core/src/openjdk/sun/sun/awt/dnd/SunDropTargetContextPeer.java
trunk/core/src/openjdk/sun/sun/awt/dnd/SunDropTargetEvent.java
trunk/core/src/openjdk/sun/sun/awt/geom/
trunk/core/src/openjdk/sun/sun/awt/geom/AreaOp.java
trunk/core/src/openjdk/sun/sun/awt/geom/ChainEnd.java
trunk/core/src/openjdk/sun/sun/awt/geom/Crossings.java
trunk/core/src/openjdk/sun/sun/awt/geom/Curve.java
trunk/core/src/openjdk/sun/sun/awt/geom/CurveLink.java
trunk/core/src/openjdk/sun/sun/awt/geom/Edge.java
trunk/core/src/openjdk/sun/sun/awt/geom/Order0.java
trunk/core/src/openjdk/sun/sun/awt/geom/Order1.java
trunk/core/src/openjdk/sun/sun/awt/geom/Order2.java
trunk/core/src/openjdk/sun/sun/awt/geom/Order3.java
trunk/core/src/openjdk/sun/sun/awt/im/
trunk/core/src/openjdk/sun/sun/awt/im/CompositionArea.java
trunk/core/src/openjdk/sun/sun/awt/im/CompositionAreaHandler.java
trunk/core/src/openjdk/sun/sun/awt/im/InputContext.java
trunk/core/src/openjdk/sun/sun/awt/im/InputMethodAdapter.java
trunk/core/src/openjdk/sun/sun/awt/im/InputMethodContext.java
trunk/core/src/openjdk/sun/sun/awt/im/InputMethodJFrame.java
trunk/core/src/openjdk/sun/sun/awt/im/InputMethodLocator.java
trunk/core/src/openjdk/sun/sun/awt/im/InputMethodManager.java
trunk/core/src/openjdk/sun/sun/awt/im/InputMethodPopupMenu.java
trunk/core/src/openjdk/sun/sun/awt/im/InputMethodWindow.java
trunk/core/src/openjdk/sun/sun/awt/im/SimpleInputMethodWindow.java
trunk/core/src/openjdk/sun/sun/awt/image/
trunk/core/src/openjdk/sun/sun/awt/image/BadDepthException.java
trunk/core/src/openjdk/sun/sun/awt/image/BufImgSurfaceData.java
trunk/core/src/openjdk/sun/sun/awt/image/BufImgSurfaceManager.java
trunk/core/src/openjdk/sun/sun/awt/image/BufferedImageDevice.java
trunk/core/src/openjdk/sun/sun/awt/image/BufferedImageGraphicsConfig.java
trunk/core/src/openjdk/sun/sun/awt/image/ByteArrayImageSource.java
trunk/core/src/openjdk/sun/sun/awt/image/ByteBandedRaster.java
trunk/core/src/openjdk/sun/sun/awt/image/ByteComponentRaster.java
trunk/core/src/openjdk/sun/sun/awt/image/ByteInterleavedRaster.java
trunk/core/src/openjdk/sun/sun/awt/image/BytePackedRaster.java
trunk/core/src/openjdk/sun/sun/awt/image/DataBufferNative.java
trunk/core/src/openjdk/sun/sun/awt/image/FileImageSource.java
trunk/core/src/openjdk/sun/sun/awt/image/GifImageDecoder.java
trunk/core/src/openjdk/sun/sun/awt/image/ImageAccessException.java
trunk/core/src/openjdk/sun/sun/awt/image/ImageConsumerQueue.java
trunk/core/src/openjdk/sun/sun/awt/image/ImageDecoder.java
trunk/core/src/openjdk/sun/sun/awt/image/ImageFetchable.java
trunk/core/src/openjdk/sun/sun/awt/image/ImageFetcher.java
trunk/core/src/openjdk/sun/sun/awt/image/ImageFormatException.java
trunk/core/src/openjdk/sun/sun/awt/image/ImageRepresentation.java
trunk/core/src/openjdk/sun/sun/awt/image/ImageWatched.java
trunk/core/src/openjdk/sun/sun/awt/image/ImagingLib.java
trunk/core/src/openjdk/sun/sun/awt/image/InputStreamImageSource.java
trunk/core/src/openjdk/sun/sun/awt/image/IntegerComponentRaster.java
trunk/core/src/openjdk/sun/sun/awt/image/IntegerInterleavedRaster.java
trunk/core/src/openjdk/sun/sun/awt/image/JPEGImageDecoder.java
trunk/core/src/openjdk/sun/sun/awt/image/NativeLibLoader.java
trunk/core/src/openjdk/sun/sun/awt/image/OffScreenImage.java
trunk/core/src/openjdk/sun/sun/awt/image/OffScreenImageSource.java
trunk/core/src/openjdk/sun/sun/awt/image/PNGImageDecoder.java
trunk/core/src/openjdk/sun/sun/awt/image/PixelConverter.java
trunk/core/src/openjdk/sun/sun/awt/image/ShortBandedRaster.java
trunk/core/src/openjdk/sun/sun/awt/image/ShortComponentRaster.java
trunk/core/src/openjdk/sun/sun/awt/image/ShortInterleavedRaster.java
trunk/core/src/openjdk/sun/sun/awt/image/SunWritableRaster.java
trunk/core/src/openjdk/sun/sun/awt/image/SurfaceManager.java
trunk/core/src/openjdk/sun/sun/awt/image/ToolkitImage.java
trunk/core/src/openjdk/sun/sun/awt/image/URLImageSource.java
trunk/core/src/openjdk/sun/sun/awt/image/WritableRasterNative.java
trunk/core/src/openjdk/sun/sun/awt/image/XbmImageDecoder.java
trunk/core/src/openjdk/sun/sun/awt/shell/
trunk/core/src/openjdk/sun/sun/awt/shell/DefaultShellFolder.java
trunk/core/src/openjdk/sun/sun/awt/shell/ShellFolder.java
trunk/core/src/openjdk/sun/sun/awt/shell/ShellFolderColumnInfo.java
trunk/core/src/openjdk/sun/sun/awt/shell/ShellFolderManager.java
trunk/core/src/openjdk/sun/sun/font/
trunk/core/src/openjdk/sun/sun/font/AttributeMap.java
trunk/core/src/openjdk/sun/sun/font/AttributeValues.java
trunk/core/src/openjdk/sun/sun/font/BidiUtils.java
trunk/core/src/openjdk/sun/sun/font/CMap.java
trunk/core/src/openjdk/sun/sun/font/CharToGlyphMapper.java
trunk/core/src/openjdk/sun/sun/font/CompositeFont.java
trunk/core/src/openjdk/sun/sun/font/CompositeFontDescriptor.java
trunk/core/src/openjdk/sun/sun/font/CompositeGlyphMapper.java
trunk/core/src/openjdk/sun/sun/font/CompositeStrike.java
trunk/core/src/openjdk/sun/sun/font/CoreMetrics.java
trunk/core/src/openjdk/sun/sun/font/Decoration.java
trunk/core/src/openjdk/sun/sun/font/DelegatingShape.java
trunk/core/src/openjdk/sun/sun/font/EAttribute.java
trunk/core/src/openjdk/sun/sun/font/ExtendedTextLabel.java
trunk/core/src/openjdk/sun/sun/font/ExtendedTextSourceLabel.java
trunk/core/src/openjdk/sun/sun/font/FileFont.java
trunk/core/src/openjdk/sun/sun/font/FileFontStrike.java
trunk/core/src/openjdk/sun/sun/font/Font2D.java
trunk/core/src/openjdk/sun/sun/font/Font2DHandle.java
trunk/core/src/openjdk/sun/sun/font/FontDesignMetrics.java
trunk/core/src/openjdk/sun/sun/font/FontFamily.java
trunk/core/src/openjdk/sun/sun/font/FontLineMetrics.java
trunk/core/src/openjdk/sun/sun/font/FontManager.java
trunk/core/src/openjdk/sun/sun/font/FontResolver.java
trunk/core/src/openjdk/sun/sun/font/FontRunIterator.java
trunk/core/src/openjdk/sun/sun/font/FontStrike.java
trunk/core/src/openjdk/sun/sun/font/FontStrikeDesc.java
trunk/core/src/openjdk/sun/sun/font/FontStrikeDisposer.java
trunk/core/src/openjdk/sun/sun/font/GlyphLayout.java
trunk/core/src/openjdk/sun/sun/font/GlyphList.java
trunk/core/src/openjdk/sun/sun/font/GraphicComponent.java
trunk/core/src/openjdk/sun/sun/font/LayoutPathImpl.java
trunk/core/src/openjdk/sun/sun/font/NativeFont.java
trunk/core/src/openjdk/sun/sun/font/NativeGlyphMapper.java
trunk/core/src/openjdk/sun/sun/font/NativeStrike.java
trunk/core/src/openjdk/sun/sun/font/NativeStrikeDisposer.java
trunk/core/src/openjdk/sun/sun/font/PhysicalFont.java
trunk/core/src/openjdk/sun/sun/font/PhysicalStrike.java
trunk/core/src/openjdk/sun/sun/font/Script.java
trunk/core/src/openjdk/sun/sun/font/ScriptRun.java
trunk/core/src/openjdk/sun/sun/font/ScriptRunData.java
trunk/core/src/openjdk/sun/sun/font/StandardGlyphVector.java
trunk/core/src/openjdk/sun/sun/font/StandardTextSource.java
trunk/core/src/openjdk/sun/sun/font/StrikeCache.java
trunk/core/src/openjdk/sun/sun/font/StrikeMetrics.java
trunk/core/src/openjdk/sun/sun/font/SunLayoutEngine.java
trunk/core/src/openjdk/sun/sun/font/TextLabel.java
trunk/core/src/openjdk/sun/sun/font/TextLabelFactory.java
trunk/core/src/openjdk/sun/sun/font/TextLineComponent.java
trunk/core/src/openjdk/sun/sun/font/TextRecord.java
trunk/core/src/openjdk/sun/sun/font/TextSource.java
trunk/core/src/openjdk/sun/sun/font/TextSourceLabel.java
trunk/core/src/openjdk/sun/sun/font/TrueTypeFont.java
trunk/core/src/openjdk/sun/sun/font/TrueTypeGlyphMapper.java
trunk/core/src/openjdk/sun/sun/font/Type1Font.java
trunk/core/src/openjdk/sun/sun/font/Type1GlyphMapper.java
trunk/core/src/openjdk/sun/sun/font/Underline.java
trunk/core/src/openjdk/sun/sun/font/XMap.java
trunk/core/src/openjdk/sun/sun/java2d/
trunk/core/src/openjdk/sun/sun/java2d/DefaultDisposerRecord.java
trunk/core/src/openjdk/sun/sun/java2d/Disposer.java
trunk/core/src/openjdk/sun/sun/java2d/DisposerRecord.java
trunk/core/src/openjdk/sun/sun/java2d/DisposerTarget.java
trunk/core/src/openjdk/sun/sun/java2d/FontSupport.java
trunk/core/src/openjdk/sun/sun/java2d/HeadlessGraphicsEnvironment.java
trunk/core/src/openjdk/sun/sun/java2d/InvalidPipeException.java
trunk/core/src/openjdk/sun/sun/java2d/NullSurfaceData.java
trunk/core/src/openjdk/sun/sun/java2d/StateTrackable.java
trunk/core/src/openjdk/sun/sun/java2d/StateTrackableDelegate.java
trunk/core/src/openjdk/sun/sun/java2d/StateTracker.java
trunk/core/src/openjdk/sun/sun/java2d/SunCompositeContext.java
trunk/core/src/openjdk/sun/sun/java2d/SunGraphics2D.java
trunk/core/src/openjdk/sun/sun/java2d/SunGraphicsEnvironment.java
trunk/core/src/openjdk/sun/sun/java2d/SurfaceData.java
trunk/core/src/openjdk/sun/sun/java2d/SurfaceDataProxy.java
trunk/core/src/openjdk/sun/sun/java2d/loops/
trunk/core/src/openjdk/sun/sun/java2d/loops/Blit.java
trunk/core/src/openjdk/sun/sun/java2d/loops/BlitBg.java
trunk/core/src/openjdk/sun/sun/java2d/loops/CompositeType.java
trunk/core/src/openjdk/sun/sun/java2d/loops/CustomComponent.java
trunk/core/src/openjdk/sun/sun/java2d/loops/DrawGlyphList.java
trunk/core/src/openjdk/sun/sun/java2d/loops/DrawGlyphListAA.java
trunk/core/src/openjdk/sun/sun/java2d/loops/DrawGlyphListLCD.java
trunk/core/src/openjdk/sun/sun/java2d/loops/DrawLine.java
trunk/core/src/openjdk/sun/sun/java2d/loops/DrawPath.java
trunk/core/src/openjdk/sun/sun/java2d/loops/DrawPolygons.java
trunk/core/src/openjdk/sun/sun/java2d/loops/DrawRect.java
trunk/core/src/openjdk/sun/sun/java2d/loops/FillPath.java
trunk/core/src/openjdk/sun/sun/java2d/loops/FillRect.java
trunk/core/src/openjdk/sun/sun/java2d/loops/FillSpans.java
trunk/core/src/openjdk/sun/sun/java2d/loops/FontInfo.java
trunk/core/src/openjdk/sun/sun/java2d/loops/GeneralRenderer.java
trunk/core/src/openjdk/sun/sun/java2d/loops/GraphicsPrimitive.java
trunk/core/src/openjdk/sun/sun/java2d/loops/GraphicsPrimitiveMgr.java
trunk/core/src/openjdk/sun/sun/java2d/loops/GraphicsPrimitiveProxy.java
trunk/core/src/openjdk/sun/sun/java2d/loops/MaskBlit.java
trunk/core/src/openjdk/sun/sun/java2d/loops/MaskFill.java
trunk/core/src/openjdk/sun/sun/java2d/loops/ProcessPath.java
trunk/core/src/openjdk/sun/sun/java2d/loops/RenderCache.java
trunk/core/src/openjdk/sun/sun/java2d/loops/RenderLoops.java
trunk/core/src/openjdk/sun/sun/java2d/loops/ScaledBlit.java
trunk/core/src/openjdk/sun/sun/java2d/loops/SurfaceType.java
trunk/core/src/openjdk/sun/sun/java2d/loops/TransformBlit.java
trunk/core/src/openjdk/sun/sun/java2d/loops/TransformHelper.java
trunk/core/src/openjdk/sun/sun/java2d/loops/XORComposite.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/
trunk/core/src/openjdk/sun/sun/java2d/pipe/AATextRenderer.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/AlphaColorPipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/AlphaPaintPipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/BufferedOpCodes.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/CompositePipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/DrawImage.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/DrawImagePipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/DuctusRenderer.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/DuctusShapeRenderer.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/GeneralCompositePipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/GlyphListLoopPipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/GlyphListPipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/LCDTextRenderer.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/LoopPipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/NullPipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/OutlineTextRenderer.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/PixelDrawPipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/PixelFillPipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/PixelToShapeConverter.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/Region.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/RegionClipSpanIterator.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/RegionIterator.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/RegionSpanIterator.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/RenderBuffer.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/RenderQueue.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/ShapeDrawPipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/ShapeSpanIterator.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/SolidTextRenderer.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/SpanClipRenderer.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/SpanIterator.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/SpanShapeRenderer.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/TextPipe.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/TextRenderer.java
trunk/core/src/openjdk/sun/sun/java2d/pipe/ValidatePipe.java
trunk/core/src/openjdk/sun/sun/print/
trunk/core/src/openjdk/sun/sun/print/ProxyGraphics.java
trunk/core/src/openjdk/sun/sun/print/ProxyPrintGraphics.java
trunk/core/src/openjdk/sun/sun/swing/
trunk/core/src/openjdk/sun/sun/swing/AccessibleMethod.java
trunk/core/src/openjdk/sun/sun/swing/AccumulativeRunnable.java
trunk/core/src/openjdk/sun/sun/swing/BakedArrayList.java
trunk/core/src/openjdk/sun/sun/swing/CachedPainter.java
trunk/core/src/openjdk/sun/sun/swing/DefaultLayoutStyle.java
trunk/core/src/openjdk/sun/sun/swing/DefaultLookup.java
trunk/core/src/openjdk/sun/sun/swing/FilePane.java
trunk/core/src/openjdk/sun/sun/swing/ImageCache.java
trunk/core/src/openjdk/sun/sun/swing/ImageIconUIResource.java
trunk/core/src/openjdk/sun/sun/swing/MenuItemCheckIconFactory.java
trunk/core/src/openjdk/sun/sun/swing/PrintColorUIResource.java
trunk/core/src/openjdk/sun/sun/swing/PrintingStatus.java
trunk/core/src/openjdk/sun/sun/swing/StringUIClientPropertyKey.java
trunk/core/src/openjdk/sun/sun/swing/SwingLazyValue.java
trunk/core/src/openjdk/sun/sun/swing/SwingUtilities2.java
trunk/core/src/openjdk/sun/sun/swing/UIAction.java
trunk/core/src/openjdk/sun/sun/swing/UIClientPropertyKey.java
trunk/core/src/openjdk/sun/sun/swing/WindowsPlacesBar.java
trunk/core/src/openjdk/sun/sun/swing/icon/
trunk/core/src/openjdk/sun/sun/swing/icon/SortArrowIcon.java
trunk/core/src/openjdk/sun/sun/swing/plaf/
trunk/core/src/openjdk/sun/sun/swing/plaf/synth/
trunk/core/src/openjdk/sun/sun/swing/plaf/synth/DefaultSynthStyle.java
trunk/core/src/openjdk/sun/sun/swing/plaf/synth/Paint9Painter.java
trunk/core/src/openjdk/sun/sun/swing/plaf/synth/StyleAssociation.java
trunk/core/src/openjdk/sun/sun/swing/plaf/synth/SynthFileChooserUI.java
trunk/core/src/openjdk/sun/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
trunk/core/src/openjdk/sun/sun/swing/plaf/synth/SynthIcon.java
trunk/core/src/openjdk/sun/sun/swing/plaf/synth/SynthUI.java
trunk/core/src/openjdk/sun/sun/swing/plaf/windows/
trunk/core/src/openjdk/sun/sun/swing/plaf/windows/ClassicSortArrowIcon.java
trunk/core/src/openjdk/sun/sun/swing/table/
trunk/core/src/openjdk/sun/sun/swing/table/DefaultTableCellHeaderRenderer.java
trunk/core/src/openjdk/sun/sun/swing/text/
trunk/core/src/openjdk/sun/sun/swing/text/CompoundPrintable.java
trunk/core/src/openjdk/sun/sun/swing/text/CountingPrintable.java
trunk/core/src/openjdk/sun/sun/swing/text/TextComponentPrintable.java
trunk/core/src/openjdk/sun/sun/swing/text/html/
trunk/core/src/openjdk/sun/sun/swing/text/html/FrameEditorPaneTag.java
trunk/core/src/openjdk/sun/sun/text/CodePointIterator.java
trunk/core/src/openjdk/vm/sun/awt/
trunk/core/src/openjdk/vm/sun/awt/NativeSunToolkit.java
Added: trunk/core/src/openjdk/com/com/sun/java/swing/plaf/windows/DesktopProperty.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/java/swing/plaf/windows/DesktopProperty.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/java/swing/plaf/windows/DesktopProperty.java 2007-07-07 12:46:16 UTC (rev 3355)
@@ -0,0 +1,305 @@
+/*
+ * Copyright 2001-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package com.sun.java.swing.plaf.windows;
+
+import java.awt.*;
+import java.beans.*;
+import java.lang.ref.*;
+import javax.swing.*;
+import javax.swing.plaf.*;
+
+/**
+ * Wrapper for a value from the desktop. The value is lazily looked up, and
+ * can be accessed using the <code>UIManager.ActiveValue</code> method
+ * <code>createValue</code>. If the underlying desktop property changes this
+ * will force the UIs to update all known Frames. You can invoke
+ * <code>invalidate</code> to force the value to be fetched again.
+ *
+ * @version @(#)DesktopProperty.java 1.16 07/05/05
+ */
+// NOTE: Don't rely on this class staying in this location. It is likely
+// to move to a different package in the future.
+public class DesktopProperty implements UIDefaults.ActiveValue {
+ /**
+ * Indicates if an updateUI call is pending.
+ */
+ private static boolean updatePending;
+
+ /**
+ * ReferenceQueue of unreferenced WeakPCLs.
+ */
+ private static ReferenceQueue queue;
+
+
+ /**
+ * PropertyChangeListener attached to the Toolkit.
+ */
+ private WeakPCL pcl;
+ /**
+ * Key used to lookup value from desktop.
+ */
+ private String key;
+ /**
+ * Value to return.
+ */
+ private Object value;
+ /**
+ * Fallback value in case we get null from desktop.
+ */
+ private Object fallback;
+
+ /**
+ * Toolkit.
+ */
+ private Toolkit toolkit;
+
+
+ static {
+ queue = new ReferenceQueue();
+ }
+
+ /**
+ * Cleans up any lingering state held by unrefeernced
+ * DesktopProperties.
+ */
+ static void flushUnreferencedProperties() {
+ WeakPCL pcl;
+
+ while ((pcl = (WeakPCL)queue.poll()) != null) {
+ pcl.dispose();
+ }
+ }
+
+
+ /**
+ * Sets whether or not an updateUI call is pending.
+ */
+ private static synchronized void setUpdatePending(boolean update) {
+ updatePending = update;
+ }
+
+ /**
+ * Returns true if a UI update is pending.
+ */
+ private static synchronized boolean isUpdatePending() {
+ return updatePending;
+ }
+
+ /**
+ * Updates the UIs of all the known Frames.
+ */
+ private static void updateAllUIs() {
+ // Check if the current UI is WindowsLookAndfeel and flush the XP style map.
+ // Note: Change the package test if this class is moved to a different package.
+ Class uiClass = UIManager.getLookAndFeel().getClass();
+ if (uiClass.getPackage().equals(DesktopProperty.class.getPackage())) {
+ //jnode XPStyle.invalidateStyle();
+ }
+ Frame appFrames[] = Frame.getFrames();
+ for (int j=0; j < appFrames.length; j++) {
+ updateWindowUI(appFrames[j]);
+ }
+ }
+
+ /**
+ * Updates the UI of the passed in window and all its children.
+ */
+ private static void updateWindowUI(Window window) {
+ SwingUtilities.updateComponentTreeUI(window);
+ Window ownedWins[] = window.getOwnedWindows();
+ for (int i=0; i < ownedWins.length; i++) {
+ updateWindowUI(ownedWins[i]);
+ }
+ }
+
+
+ /**
+ * Creates a DesktopProperty.
+ *
+ * @param key Key used in looking up desktop value.
+ * @param fallback Value used if desktop property is null.
+ * @param toolkit Toolkit used to fetch property from, can be null
+ * in which default will be used.
+ */
+ public DesktopProperty(String key, Object fallback, Toolkit toolkit) {
+ this.key = key;
+ this.fallback = fallback;
+ this.toolkit = toolkit;
+ // The only sure fire way to clear our references is to create a
+ // Thread and wait for a reference to be added to the queue.
+ // Because it is so rare that you will actually change the look
+ // and feel, this stepped is forgoed and a middle ground of
+ // flushing references from the constructor is instead done.
+ // The implication is that once one DesktopProperty is created
+ // there will most likely be n (number of DesktopProperties created
+ // by the LookAndFeel) WeakPCLs around, but this number will not
+ // grow past n.
+ flushUnreferencedProperties();
+ }
+
+ /**
+ * UIManager.LazyValue method, returns the value from the desktop
+ * or the fallback value if the desktop value is null.
+ */
+ public Object createValue(UIDefaults table) {
+ if (value == null) {
+ value = configureValue(getValueFromDesktop());
+ if (value == null) {
+ value = configureValue(getDefaultValue());
+ }
+ }
+ return value;
+ }
+
+ /**
+ * Returns the value from the desktop.
+ */
+ protected Object getValueFromDesktop() {
+ if (this.toolkit == null) {
+ this.toolkit = Toolkit.getDefaultToolkit();
+ }
+ Object value = toolkit.getDesktopProperty(getKey());
+ pcl = new WeakPCL(this, toolkit, getKey(), UIManager.getLookAndFeel());
+ toolkit.addPropertyChangeListener(getKey(), pcl);
+ return value;
+ }
+
+ /**
+ * Returns the value to use if the desktop property is null.
+ */
+ protected Object getDefaultValue() {
+ return fallback;
+ }
+
+ /**
+ * Invalidates the current value.
+ *
+ * @param laf the LookAndFeel this DesktopProperty was created with
+ */
+ public void invalidate(LookAndFeel laf) {
+ invalidate();
+ }
+
+ /**
+ * Invalides the current value so that the next invocation of
+ * <code>createValue</code> will ask for the property again.
+ */
+ public void invalidate() {
+ if (pcl != null) {
+ toolkit.removePropertyChangeListener(getKey(), pcl);
+ toolkit = null;
+ pcl = null;
+ value = null;
+ }
+ }
+
+ /**
+ * Requests that all components in the GUI hierarchy be updated
+ * to reflect dynamic changes in this look&feel. This update occurs
+ * by uninstalling and re-installing the UI objects. Requests are
+ * batched and collapsed into a single update pass because often
+ * many desktop properties will change at once.
+ */
+ protected void updateUI() {
+ if (!isUpdatePending()) {
+ setUpdatePending(true);
+ Runnable uiUpdater = new Runnable() {
+ public void run() {
+ updateAllUIs();
+ setUpdatePending(false);
+ }
+ };
+ SwingUtilities.invokeLater(uiUpdater);
+ }
+ }
+
+ /**
+ * Configures the value as appropriate for a defaults property in
+ * the UIDefaults table.
+ */
+ protected Object configureValue(Object value) {
+ if (value != null) {
+ if (value instanceof Color) {
+ return new ColorUIResource((Color)value);
+ }
+ else if (value instanceof Font) {
+ return new FontUIResource((Font)value);
+ }
+ else if (value instanceof UIDefaults.LazyValue) {
+ value = ((UIDefaults.LazyValue)value).createValue(null);
+ }
+ else if (value instanceof UIDefaults.ActiveValue) {
+ value = ((UIDefaults.ActiveValue)value).createValue(null);
+ }
+ }
+ return value;
+ }
+
+ /**
+ * Returns the key used to lookup the desktop properties value.
+ */
+ protected String getKey() {
+ return key;
+ }
+
+
+
+ /**
+ * As there is typically only one Toolkit, the PropertyChangeListener
+ * is handled via a WeakReference so as not to pin down the
+ * DesktopProperty.
+ */
+ private static class WeakPCL extends WeakReference
+ implements PropertyChangeListener {
+ private Toolkit kit;
+ private String key;
+ private LookAndFeel laf;
+
+ WeakPCL(Object target, Toolkit kit, String key, LookAndFeel laf) {
+ super(target, queue);
+ this.kit = kit;
+ this.key = key;
+ this.laf = laf;
+ }
+
+ public void propertyChange(PropertyChangeEvent pce) {
+ DesktopProperty property = (DesktopProperty)get();
+
+ if (property == null || laf != UIManager.getLookAndFeel()) {
+ // The property was GC'ed, we're no longer interested in
+ // PropertyChanges, remove the listener.
+ dispose();
+ }
+ else {
+ property.invalidate(laf);
+ property.updateUI();
+ }
+ }
+
+ void dispose() {
+ kit.removePropertyChangeListener(key, this);
+ }
+ }
+}
Added: trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic.properties
===================================================================
--- trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic.properties (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic.properties 2007-07-07 12:46:16 UTC (rev 3355)
@@ -0,0 +1,210 @@
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, the following components need this for support:
+#
+# ColorChooser
+# FileChooser
+# OptionPane
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# MNEMONIC NOTE:
+# Many of strings in this file are used by widgets that have a
+# mnemonic, for example:
+# ColorChooser.rgbNameText=RGB
+# ColorChooser.rgbMnemonic=71
+# ColorChooser.rgbDisplayedMnemonicIndex=1
+# Indicates that the tab in the ColorChooser for RGB colors will have
+# the text 'RGB', further the mnemonic character will be 'g' and that
+# a decoration will be provided under the 'G'. This will typically
+# look like: RGB
+# -
+# 71 corresponds to the decimal value of the VK constant defined
+# in java/awt/KeyEvent.java. VK_G is defined as:
+#
+# public static final int VK_G = 0x47;
+#
+# 0x47 is a hex number and needs to be converted to decimal.
+# A simple way to calculate this for a-z is to add 64 to the index of
+# the letter in the alphabet. As 'a' is in the 1st letter the mnemonic
+# for 'a' is 65, 'b' is 66...
+#
+# The xxDisplayedMnemonicIndex is used to indicate the index of the
+# character that should be underlined in the String, with 0
+# corresponding to the first character in the String.
+#
+# One important thing to remember is that the mnemonic MUST exist in
+# the String, if it does not exist you should add text that makes it
+# exist. This will typically take the form 'XXXX (M)' where M is the
+# character for the mnemonic.
+#
+# 1.22 11/17/05
+# @author Steve Wilson
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescriptionText=Generic File
+FileChooser.directoryDescriptionText=Directory
+FileChooser.newFolderErrorText=Error creating new folder
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilterText=All Files
+FileChooser.cancelButtonText=Cancel
+FileChooser.cancelButtonMnemonic=67
+FileChooser.saveButtonText=Save
+FileChooser.saveButtonMnemonic=83
+FileChooser.openButtonText=Open
+FileChooser.openButtonMnemonic=79
+FileChooser.saveDialogTitleText=Save
+FileChooser.openDialogTitleText=Open
+FileChooser.updateButtonText=Update
+FileChooser.updateButtonMnemonic=85
+FileChooser.helpButtonText=Help
+FileChooser.helpButtonMnemonic=72
+FileChooser.directoryOpenButtonText=Open
+FileChooser.directoryOpenButtonMnemonic=79
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# These strings are platform dependent not look and feel dependent.
+FileChooser.win32.newFolder=New Folder
+FileChooser.win32.newFolder.subsequent=New Folder ({0})
+FileChooser.other.newFolder=NewFolder
+FileChooser.other.newFolder.subsequent=NewFolder.{0}
+
+
+## file chooser tooltips ###
+FileChooser.cancelButtonToolTipText=Abort file chooser dialog
+FileChooser.saveButtonToolTipText=Save selected file
+FileChooser.openButtonToolTipText=Open selected file
+FileChooser.updateButtonToolTipText=Update directory listing
+FileChooser.helpButtonToolTipText=FileChooser help
+FileChooser.directoryOpenButtonToolTipText=Open selected directory
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.previewText=Preview
+ColorChooser.okText=OK
+ColorChooser.cancelText=Cancel
+ColorChooser.resetText=Reset
+# VK_XXX constant for 'ColorChooser.resetText' button to make mnemonic
+ColorChooser.resetMnemonic=82
+ColorChooser.sampleText=Sample Text Sample Text
+ColorChooser.swatchesNameText=Swatches
+ColorChooser.swatchesMnemonic=83
+ColorChooser.swatchesDisplayedMnemonicIndex=0
+ColorChooser.swatchesRecentText=Recent:
+ColorChooser.hsbNameText=HSB
+# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
+# constant, and an index into the text to render the mnemonic as. The
+# mnemonic is xxxMnemonic and the index of the character to underline is
+# xxxDisplayedMnemonicIndex.
+ColorChooser.hsbMnemonic=72
+ColorChooser.hsbDisplayedMnemonicIndex=0
+ColorChooser.hsbHueText=H
+ColorChooser.hsbSaturationText=S
+ColorChooser.hsbBrightnessText=B
+ColorChooser.hsbRedText=R
+ColorChooser.hsbGreenText=G
+ColorChooser.hsbBlueText=B
+ColorChooser.rgbNameText=RGB
+ColorChooser.rgbMnemonic=71
+ColorChooser.rgbDisplayedMnemonicIndex=1
+ColorChooser.rgbRedText=Red
+ColorChooser.rgbRedMnemonic=68
+ColorChooser.rgbGreenText=Green
+ColorChooser.rgbGreenMnemonic=78
+ColorChooser.rgbBlueText=Blue
+ColorChooser.rgbBlueMnemonic=66
+
+############ OPTION PANE STRINGS #############
+# Mnemonic keys correspond to KeyEvent.VK_XXX constant
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButtonText=Yes
+OptionPane.yesButtonMnemonic=89
+OptionPane.noButtonText=No
+OptionPane.noButtonMnemonic=78
+OptionPane.okButtonText=OK
+OptionPane.okButtonMnemonic=0
+OptionPane.cancelButtonText=Cancel
+OptionPane.cancelButtonMnemonic=0
+OptionPane.titleText=Select an Option
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialogTitle=Input
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialogTitle=Message
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgressText=Printing
+PrintingDialog.titleAbortingText=Printing (Aborting)
+
+PrintingDialog.contentInitialText=Printing in progress...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgressText=Printed page {0}...
+
+PrintingDialog.contentAbortingText=Printing aborting...
+
+PrintingDialog.abortButtonText=Abort
+PrintingDialog.abortButtonMnemonic=65
+PrintingDialog.abortButtonDisplayedMnemonicIndex=0
+PrintingDialog.abortButtonToolTipText=Abort Printing
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Minimize
+InternalFrame.maxButtonToolTip=Maximize
+InternalFrame.restoreButtonToolTip=Restore
+InternalFrame.closeButtonToolTip=Close
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButtonText=Restore
+InternalFrameTitlePane.moveButtonText=Move
+InternalFrameTitlePane.sizeButtonText=Size
+InternalFrameTitlePane.minimizeButtonText=Minimize
+InternalFrameTitlePane.maximizeButtonText=Maximize
+InternalFrameTitlePane.closeButtonText=Close
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButtonText=Submit Query
+FormView.resetButtonText=Reset
+FormView.browseFileButtonText=Browse...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChangeText=style change
+AbstractDocument.additionText=addition
+AbstractDocument.deletionText=deletion
+AbstractDocument.undoText=Undo
+AbstractDocument.redoText=Redo
+
+############ Abstract Button Strings ############
+AbstractButton.clickText=click
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undoText=Undo
+AbstractUndoableEdit.redoText=Redo
+
+############ Combo Box Strings ############
+ComboBox.togglePopupText=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progressText=Progress...
+
+############ Split Pane Strings ############
+SplitPane.leftButtonText=left button
+SplitPane.rightButtonText=right button
+# Used for Isindex
+IsindexView.prompt=This is a searchable index. Enter search keywords:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Iconify
+InternalFrameTitlePane.maximizeButtonAccessibleName=Maximize
+InternalFrameTitlePane.closeButtonAccessibleName=Close
Added: trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_de.properties
===================================================================
--- trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_de.properties (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_de.properties 2007-07-07 12:46:16 UTC (rev 3355)
@@ -0,0 +1,210 @@
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, the following components need this for support:
+#
+# ColorChooser
+# FileChooser
+# OptionPane
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# MNEMONIC NOTE:
+# Many of strings in this file are used by widgets that have a
+# mnemonic, for example:
+# ColorChooser.rgbNameText=RGB
+# ColorChooser.rgbMnemonic=71
+# ColorChooser.rgbDisplayedMnemonicIndex=1
+# Indicates that the tab in the ColorChooser for RGB colors will have
+# the text 'RGB', further the mnemonic character will be 'g' and that
+# a decoration will be provided under the 'G'. This will typically
+# look like: RGB
+# -
+# 71 corresponds to the decimal value of the VK constant defined
+# in java/awt/KeyEvent.java. VK_G is defined as:
+#
+# public static final int VK_G = 0x47;
+#
+# 0x47 is a hex number and needs to be converted to decimal.
+# A simple way to calculate this for a-z is to add 64 to the index of
+# the letter in the alphabet. As 'a' is in the 1st letter the mnemonic
+# for 'a' is 65, 'b' is 66...
+#
+# The xxDisplayedMnemonicIndex is used to indicate the index of the
+# character that should be underlined in the String, with 0
+# corresponding to the first character in the String.
+#
+# One important thing to remember is that the mnemonic MUST exist in
+# the String, if it does not exist you should add text that makes it
+# exist. This will typically take the form 'XXXX (M)' where M is the
+# character for the mnemonic.
+#
+# 1.25 04/18/06
+# @author Steve Wilson
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescriptionText=Allgemeine Datei
+FileChooser.directoryDescriptionText=Verzeichnis
+FileChooser.newFolderErrorText=Fehler beim Erstellen eines neuen Ordners
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilterText=Alle Dateien
+FileChooser.cancelButtonText=Abbrechen
+FileChooser.cancelButtonMnemonic=65
+FileChooser.saveButtonText=Speichern
+FileChooser.saveButtonMnemonic=83
+FileChooser.openButtonText=\u00d6ffnen
+FileChooser.openButtonMnemonic=70
+FileChooser.saveDialogTitleText=Speichern
+FileChooser.openDialogTitleText=\u00d6ffnen
+FileChooser.updateButtonText=Aktualisieren
+FileChooser.updateButtonMnemonic=75
+FileChooser.helpButtonText=Hilfe
+FileChooser.helpButtonMnemonic=72
+FileChooser.directoryOpenButtonText=\u00d6ffnen
+FileChooser.directoryOpenButtonMnemonic=69
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# These strings are platform dependent not look and feel dependent.
+FileChooser.win32.newFolder=Neuer Ordner
+FileChooser.win32.newFolder.subsequent=Neuer Ordner ({0})
+FileChooser.other.newFolder=Neuer Ordner
+FileChooser.other.newFolder.subsequent=Neuer Ordner.{0}
+
+
+## file chooser tooltips ###
+FileChooser.cancelButtonToolTipText=Dialogfeld f\u00fcr Dateiauswahl abbrechen
+FileChooser.saveButtonToolTipText=Ausgew\u00e4hlte Datei speichern
+FileChooser.openButtonToolTipText=Ausgew\u00e4hlte Datei \u00f6ffnen
+FileChooser.updateButtonToolTipText=Verzeichnisliste aktualisieren
+FileChooser.helpButtonToolTipText=Hilfe f\u00fcr Dateiauswahl
+FileChooser.directoryOpenButtonToolTipText=Markiertes Verzeichnis \u00f6ffnen
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.previewText=Vorschau
+ColorChooser.okText=OK
+ColorChooser.cancelText=Abbrechen
+ColorChooser.resetText=Zur\u00fccksetzen
+# VK_XXX constant for 'ColorChooser.resetText' button to make mnemonic
+ColorChooser.resetMnemonic=90
+ColorChooser.sampleText=Beispieltext Beispieltext
+ColorChooser.swatchesNameText=Muster
+ColorChooser.swatchesMnemonic=77
+ColorChooser.swatchesDisplayedMnemonicIndex=0
+ColorChooser.swatchesRecentText=Aktuell:
+ColorChooser.hsbNameText=HSB
+# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
+# constant, and an index into the text to render the mnemonic as. The
+# mnemonic is xxxMnemonic and the index of the character to underline is
+# xxxDisplayedMnemonicIndex.
+ColorChooser.hsbMnemonic=72
+ColorChooser.hsbDisplayedMnemonicIndex=0
+ColorChooser.hsbHueText=H
+ColorChooser.hsbSaturationText=S
+ColorChooser.hsbBrightnessText=B
+ColorChooser.hsbRedText=R
+ColorChooser.hsbGreenText=G
+ColorChooser.hsbBlueText=B
+ColorChooser.rgbNameText=RGB
+ColorChooser.rgbMnemonic=71
+ColorChooser.rgbDisplayedMnemonicIndex=1
+ColorChooser.rgbRedText=Rot
+ColorChooser.rgbRedMnemonic=82
+ColorChooser.rgbGreenText=Gr\u00fcn
+ColorChooser.rgbGreenMnemonic=78
+ColorChooser.rgbBlueText=Blau
+ColorChooser.rgbBlueMnemonic=66
+
+############ OPTION PANE STRINGS #############
+# Mnemonic keys correspond to KeyEvent.VK_XXX constant
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButtonText=Ja
+OptionPane.yesButtonMnemonic=74
+OptionPane.noButtonText=Nein
+OptionPane.noButtonMnemonic=78
+OptionPane.okButtonText=OK
+OptionPane.okButtonMnemonic=79
+OptionPane.cancelButtonText=Abbrechen
+OptionPane.cancelButtonMnemonic=65
+OptionPane.titleText=W\u00e4hlen Sie eine Option aus
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialogTitle=Eingabe
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialogTitle=Nachricht
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgressText=Drucken
+PrintingDialog.titleAbortingText=Drucken (Abbruch)
+
+PrintingDialog.contentInitialText=Druckvorgang l\u00e4uft...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgressText=Seite {0} wurde gedruckt...
+
+PrintingDialog.contentAbortingText=Druckvorgang wird abgebrochen...
+
+PrintingDialog.abortButtonText=Abbrechen
+PrintingDialog.abortButtonMnemonic=66
+PrintingDialog.abortButtonDisplayedMnemonicIndex=1
+PrintingDialog.abortButtonToolTipText=Druckvorgang abbrechen
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Minimieren
+InternalFrame.maxButtonToolTip=Maximieren
+InternalFrame.restoreButtonToolTip=Wiederherstellen
+InternalFrame.closeButtonToolTip=Schlie\u00dfen
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButtonText=Wiederherstellen
+InternalFrameTitlePane.moveButtonText=Verschieben
+InternalFrameTitlePane.sizeButtonText=Gr\u00f6\u00dfe
+InternalFrameTitlePane.minimizeButtonText=Minimieren
+InternalFrameTitlePane.maximizeButtonText=Maximieren
+InternalFrameTitlePane.closeButtonText=Schlie\u00dfen
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButtonText=Abfrage senden
+FormView.resetButtonText=Zur\u00fccksetzen
+FormView.browseFileButtonText=Durchsuchen...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChangeText=Formatvorlagen\u00e4nderung
+AbstractDocument.additionText=Hinzuf\u00fcgen
+AbstractDocument.deletionText=L\u00f6schen
+AbstractDocument.undoText=R\u00fcckg\u00e4ngig
+AbstractDocument.redoText=Wiederherstellen
+
+############ Abstract Button Strings ############
+AbstractButton.clickText=Klicken
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undoText=R\u00fcckg\u00e4ngig
+AbstractUndoableEdit.redoText=Wiederherstellen
+
+############ Combo Box Strings ############
+ComboBox.togglePopupText=Popup umschalten
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progressText=Fortschritt...
+
+############ Split Pane Strings ############
+SplitPane.leftButtonText=linke Taste
+SplitPane.rightButtonText=rechte Taste
+# Used for Isindex
+IsindexView.prompt=Dieser Index kann durchsucht werden. Geben Sie ein Schlagwort ein:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Als Symbol darstellen
+InternalFrameTitlePane.maximizeButtonAccessibleName=Maximieren
+InternalFrameTitlePane.closeButtonAccessibleName=Schlie\u00dfen
Added: trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_es.properties
===================================================================
--- trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_es.properties (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/swing/internal/plaf/basic/resources/basic_es.properties 2007-07-07 12:46:16 UTC (rev 3355)
@@ -0,0 +1,210 @@
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, the following components need this for support:
+#
+# ColorChooser
+# FileChooser
+# OptionPane
+#
+# When this file is read in, the strings are put into the
+# defaults table. This is an implementation detail of the current
+# workings of Swing. DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# MNEMONIC NOTE:
+# Many of strings in this file are used by widgets that have a
+# mnemonic, for example:
+# ColorChooser.rgbNameText=RGB
+# ColorChooser.rgbMnemonic=71
+# ColorChooser.rgbDisplayedMnemonicIndex=1
+# Indicates that the tab in the ColorChooser for RGB colors will have
+# the text 'RGB', further the mnemonic character will be 'g' and that
+# a decoration will be provided under the 'G'. This will typically
+# look like: RGB
+# -
+# 71 corresponds to the decimal value of the VK constant defined
+# in java/awt/KeyEvent.java. VK_G is defined as:
+#
+# public static final int VK_G = 0x47;
+#
+# 0x47 is a hex number and needs to be converted to decimal.
+# A simple way to calculate this for a-z is to add 64 to the index of
+# the letter in the alphabet. As 'a' is in the 1st letter the mnemonic
+# for 'a' is 65, 'b' is 66...
+#
+# The xxDisplayedMnemonicIndex is used to indicate the index of the
+# character that should be underlined in the String, with 0
+# corresponding to the first character in the String.
+#
+# One important thing to remember is that the mnemonic MUST exist in
+# the String, if it does not exist you should add text that makes it
+# exist. This will typically take the form 'XXXX (M)' where M is the
+# character for the mnemonic.
+#
+# 1.21 04/18/06
+# @author Steve Wilson
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescriptionText=Archivo gen\u00e9rico
+FileChooser.directoryDescriptionText=Directorio
+FileChooser.newFolderErrorText=Error al crear una nueva carpeta
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilterText=Todos los archivos
+FileChooser.cancelButtonText=Cancelar
+FileChooser.cancelButtonMnemonic=67
+FileChooser.saveButtonText=Guardar
+FileChooser.saveButtonMnemonic=71
+FileChooser.openButtonText=Abrir
+FileChooser.openButtonMnemonic=65
+FileChooser.saveDialogTitleText=Guardar
+FileChooser.openDialogTitleText=Abrir
+FileChooser.updateButtonText=Actualizar
+FileChooser.updateButtonMnemonic=84
+FileChooser.helpButtonText=Ayuda
+FileChooser.helpButtonMnemonic=89
+FileChooser.directoryOpenButtonText=Abrir
+FileChooser.directoryOpenButtonMnemonic=82
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# These strings are platform dependent not look and feel dependent.
+FileChooser.win32.newFolder=Carpeta nueva
+FileChooser.win32.newFolder.subsequent=Carpeta nueva ({0})
+FileChooser.other.newFolder=Carpeta nueva
+FileChooser.other.newFolder.subsequent=Carpeta nueva.{0}
+
+
+## file chooser tooltips ###
+FileChooser.cancelButtonToolTipText=Cuadro de di\u00e1logo para cancelar elector de archivo
+FileChooser.saveButtonToolTipText=Guardar archivo seleccionado
+FileChooser.openButtonToolTipText=Abrir archivo seleccionado
+FileChooser.updateButtonToolTipText=Actualizar lista de directorios
+FileChooser.helpButtonToolTipText=Ayuda elector de archivos
+FileChooser.directoryOpenButtonToolTipText=Abrir directorio seleccionado
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.previewText=Vista previa
+ColorChooser.okText=Aceptar
+ColorChooser.cancelText=Cancelar
+ColorChooser.resetText=Restablecer
+# VK_XXX constant for 'ColorChooser.resetText' button to make mnemonic
+ColorChooser.resetMnemonic=82
+ColorChooser.sampleText=Texto de ejemplo Texto de ejemplo
+ColorChooser.swatchesNameText=Muestras
+ColorChooser.swatchesMnemonic=77
+ColorChooser.swatchesDisplayedMnemonicIndex=0
+ColorChooser.swatchesRecentText=Reciente:
+ColorChooser.hsbNameText=HSB
+# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
+# constant, and an index into the text to render the mnemonic as. The
+# mnemonic is xxxMnemonic and the index of the character to underline is
+# xxxDisplayedMnemonicIndex.
+ColorChooser.hsbMnemonic=72
+ColorChooser.hsbDisplayedMnemonicIndex=0
+ColorChooser.hsbHueText=H
+ColorChooser.hsbSaturationText=S
+ColorChooser.hsbBrightnessText=B
+ColorChooser.hsbRedText=R
+ColorChooser.hsbGreenText=V
+ColorChooser.hsbBlueText=A
+ColorChooser.rgbNameText=RGB
+ColorChooser.rgbMnemonic=71
+ColorChooser.rgbDisplayedMnemonicIndex=1
+ColorChooser.rgbRedText=Rojo
+ColorChooser.rgbRedMnemonic=74
+ColorChooser.rgbGreenText=Verde
+ColorChooser.rgbGreenMnemonic=86
+ColorChooser.rgbBlueText=Azul
+ColorChooser.rgbBlueMnemonic=76
+
+############ OPTION PANE STRINGS #############
+# Mnemonic keys correspond to KeyEvent.VK_XXX constant
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButtonText=S\u00ed
+OptionPane.yesButtonMnemonic=83
+OptionPane.noButtonText=No
+OptionPane.noButtonMnemonic=78
+OptionPane.okButtonText=Aceptar
+OptionPane.okButtonMnemonic=0
+OptionPane.cancelButtonText=Cancelar
+OptionPane.cancelButtonMnemonic=0
+OptionPane.titleText=Seleccionar una opci\u00f3n
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialogTitle=Entrada
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialogTitle=Mensaje
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgressText=Impresi\u00f3n
+PrintingDialog.titleAbortingText=Impresi\u00f3n (cancelaci\u00f3n)
+
+PrintingDialog.contentInitialText=Impresi\u00f3n en curso...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgressText=P\u00e1gina impresa {0}...
+
+PrintingDialog.contentAbortingText=Cancelando la impresi\u00f3n...
+
+PrintingDialog.abortButtonText=Cancelar
+PrintingDialog.abortButtonMnemonic=67
+PrintingDialog.abortButtonDisplayedMnemonicIndex=0
+PrintingDialog.abortButtonToolTipText=Cancelar la impresi\u00f3n
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Minimizar
+InternalFrame.maxButtonToolTip=Maximizar
+InternalFrame.restoreButtonToolTip=Restaurar
+InternalFrame.closeButtonToolTip=Cerrar
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButtonText=Restaurar
+InternalFrameTitlePane.moveButtonText=Mover
+InternalFrameTitlePane.sizeButtonText=Tama\u00f1o
+InternalFrameTitlePane.minimizeButtonText=Minimizar
+InternalFrameTitlePane.maximizeButtonText=Maximizar
+InternalFrameTitlePane.closeButtonText=Cerrar
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButtonText=Enviar consulta
+FormView.resetButtonText=Restablecer
+FormView.browseFileButtonText=Examinar...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChangeText=cambio de estilo
+AbstractDocument.additionText=adici\u00f3n
+AbstractDocument.deletionText=supresi\u00f3n
+AbstractDocument.undoText=Deshacer
+AbstractDocument.redoText=Rehacer
+
+############ Abstract Button Strings ############
+AbstractButton.clickText=hacer clic
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undoTe...
[truncated message content] |
|
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] |
|
From: <ls...@us...> - 2007-07-07 12:37:31
|
Revision: 3353
http://jnode.svn.sourceforge.net/jnode/?rev=3353&view=rev
Author: lsantha
Date: 2007-07-07 05:37:26 -0700 (Sat, 07 Jul 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/src/classpath/javax/javax/swing/JComponent.java
trunk/core/src/classpath/javax/javax/swing/JDesktopPane.java
trunk/core/src/classpath/javax/javax/swing/JEditorPane.java
trunk/core/src/classpath/javax/javax/swing/JInternalFrame.java
trunk/core/src/classpath/javax/javax/swing/JList.java
trunk/core/src/classpath/javax/javax/swing/JTabbedPane.java
trunk/core/src/classpath/javax/javax/swing/JTable.java
trunk/core/src/classpath/javax/javax/swing/JTree.java
trunk/core/src/classpath/javax/javax/swing/LookAndFeel.java
trunk/core/src/classpath/javax/javax/swing/TransferHandler.java
trunk/core/src/classpath/javax/javax/swing/UIDefaults.java
trunk/core/src/classpath/javax/javax/swing/border/AbstractBorder.java
trunk/core/src/classpath/javax/javax/swing/plaf/ComponentUI.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicComboBoxUI.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicComboPopup.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicDirectoryModel.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicGraphicsUtils.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicListUI.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicLookAndFeel.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicMenuItemUI.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicScrollBarUI.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicScrollPaneUI.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicSliderUI.java
trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicSplitPaneUI.java
trunk/core/src/classpath/javax/javax/swing/text/DefaultCaret.java
trunk/core/src/classpath/javax/javax/swing/text/DefaultEditorKit.java
trunk/core/src/classpath/javax/javax/swing/text/JTextComponent.java
Modified: trunk/core/src/classpath/javax/javax/swing/JComponent.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/JComponent.java 2007-07-06 11:09:17 UTC (rev 3352)
+++ trunk/core/src/classpath/javax/javax/swing/JComponent.java 2007-07-07 12:37:26 UTC (rev 3353)
@@ -3796,4 +3796,169 @@
+ propertyName);
}
}
+
+ //jnode openjdk
+ /**
+ * Calculates a custom drop location for this type of component,
+ * representing where a drop at the given point should insert data.
+ * <code>null</code> is returned if this component doesn't calculate
+ * custom drop locations. In this case, <code>TransferHandler</code>
+ * will provide a default <code>DropLocation</code> containing just
+ * the point.
+ *
+ * @param p the point to calculate a drop location for
+ * @return the drop location, or <code>null</code>
+ */
+ TransferHandler.DropLocation dropLocationForPoint(Point p) {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if the current painting operation on this
+ * component is part of a <code>print</code> operation. This method is
+ * useful when you want to customize what you print versus what you show
+ * on the screen.
+ * <p>
+ * You can detect changes in the value of this property by listening for
+ * property change events on this component with name
+ * <code>"paintingForPrint"</code>.
+ * <p>
+ * Note: This method provides complimentary functionality to that provided
+ * by other high level Swing printing APIs. However, it deals strictly with
+ * painting and should not be confused as providing information on higher
+ * level print processes. For example, a {@link javax.swing.JTable#print()}
+ * operation doesn't necessarily result in a continuous rendering of the
+ * full component, and the return value of this method can change multiple
+ * times during that operation. It is even possible for the component to be
+ * painted to the screen while the printing process is ongoing. In such a
+ * case, the return value of this method is <code>true</code> when, and only
+ * when, the table is being painted as part of the printing process.
+ *
+ * @return true if the current painting operation on this component
+ * is part of a print operation
+ * @see #print
+ * @since 1.6
+ */
+ public final boolean isPaintingForPrint() {
+ return getFlag(IS_PRINTING);
+ }
+ private void setFlag(int aFlag, boolean aValue) {
+ if(aValue) {
+ flags |= (1 << aFlag);
+ } else {
+ flags &= ~(1 << aFlag);
+ }
+ }
+ private boolean getFlag(int aFlag) {
+ int mask = (1 << aFlag);
+ return ((flags & mask) == mask);
+ }
+ private int flags;
+
+ /** Private flags **/
+ private static final int IS_DOUBLE_BUFFERED = 0;
+ private static final int ANCESTOR_USING_BUFFER = 1;
+ private static final int IS_PAINTING_TILE = 2;
+ private static final int IS_OPAQUE = 3;
+ private static final int KEY_EVENTS_ENABLED = 4;
+ private static final int FOCUS_INPUTMAP_CREATED = 5;
+ private static final int ANCESTOR_INPUTMAP_CREATED = 6;
+ private static final int WIF_INPUTMAP_CREATED = 7;
+ private static final int ACTIONMAP_CREATED = 8;
+ private static final int CREATED_DOUBLE_BUFFER = 9;
+ // bit 10 is free
+ private static final int IS_PRINTING = 11;
+ private static final int IS_PRINTING_ALL = 12;
+ private static final int IS_REPAINTING = 13;
+ /** Bits 14-21 are used to handle nested writeObject calls. **/
+ private static final int WRITE_OBJ_COUNTER_FIRST = 14;
+ private static final int RESERVED_1 = 15;
+ private static final int RESERVED_2 = 16;
+ private static final int RESERVED_3 = 17;
+ private static final int RESERVED_4 = 18;
+ private static final int RESERVED_5 = 19;
+ private static final int RESERVED_6 = 20;
+ private static final int WRITE_OBJ_COUNTER_LAST = 21;
+
+ private static final int REQUEST_FOCUS_DISABLED = 22;
+ private static final int INHERITS_POPUP_MENU = 23;
+ private static final int OPAQUE_SET = 24;
+ private static final int AUTOSCROLLS_SET = 25;
+ private static final int FOCUS_TRAVERSAL_KEYS_FORWARD_SET = 26;
+ private static final int FOCUS_TRAVERSAL_KEYS_BACKWARD_SET = 27;
+ private static final int REVALIDATE_RUNNABLE_SCHEDULED = 28;
+
+ /**
+ * 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>
+ * This method calls into the <code>ComponentUI</code> method of the
+ * same name. If this component does not have a <code>ComponentUI</code>
+ * -1 will be returned. 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.
+ *
+ * @throws IllegalArgumentException {@inheritDoc}
+ * @see #getBaselineResizeBehavior
+ * @see java.awt.FontMetrics
+ * @since 1.6
+ */
+ public int getBaseline(int width, int height) {
+ // check size.
+ super.getBaseline(width, height);
+ if (ui != null) {
+ return ui.getBaseline(this, width, height);
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the preferred location to display the popup menu in this
+ * component's coordinate system. It is up to the look and feel to
+ * honor this property, some may choose to ignore it.
+ * If {@code null}, the look and feel will choose a suitable location.
+ *
+ * @param event the {@code MouseEvent} that triggered the popup to be
+ * shown, or {@code null} if the popup is not being shown as the
+ * result of a mouse event
+ * @return location to display the {@code JPopupMenu}, or {@code null}
+ * @since 1.5
+ */
+ public Point getPopupLocation(MouseEvent event) {
+ return null;
+ }
+
+ /**
+ * 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>
+ * This method calls into the <code>ComponentUI</code> method of
+ * the same name. If this component does not have a
+ * <code>ComponentUI</code>
+ * <code>BaselineResizeBehavior.OTHER</code> will be
+ * returned. 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.
+ *
+ * @see #getBaseline(int, int)
+ * @since 1.6
+ */
+ public BaselineResizeBehavior getBaselineResizeBehavior() {
+ if (ui != null) {
+ return ui.getBaselineResizeBehavior(this);
+ }
+ return BaselineResizeBehavior.OTHER;
+ }
}
Modified: trunk/core/src/classpath/javax/javax/swing/JDesktopPane.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/JDesktopPane.java 2007-07-06 11:09:17 UTC (rev 3352)
+++ trunk/core/src/classpath/javax/javax/swing/JDesktopPane.java 2007-07-07 12:37:26 UTC (rev 3353)
@@ -381,4 +381,50 @@
super.setUIProperty(propertyName, value);
}
}
+
+ //jnode openjdk
+ /**
+ * Selects the next <code>JInternalFrame</code> in this desktop pane.
+ *
+ * @param forward a boolean indicating which direction to select in;
+ * <code>true</code> for forward, <code>false</code> for
+ * backward
+ * @return the JInternalFrame that was selected or <code>null</code>
+ * if nothing was selected
+ * @since 1.6
+ */
+ public JInternalFrame selectFrame(boolean forward) {
+ JInternalFrame selectedFrame = getSelectedFrame();
+ JInternalFrame frameToSelect = getNextFrame(selectedFrame, forward);
+ if (frameToSelect == null) {
+ return null;
+ }
+ // Maintain navigation traversal order until an
+ // external stack change, such as a click on a frame.
+ setComponentOrderCheckingEnabled(false);
+ if (forward && selectedFrame != null) {
+ selectedFrame.moveToBack(); // For Windows MDI fidelity.
+ }
+ try { frameToSelect.setSelected(true);
+ } catch (PropertyVetoException pve) {}
+ setComponentOrderCheckingEnabled(true);
+ return frameToSelect;
+ }
+
+ /*
+ * Sets whether component order checking is enabled.
+ * @param enable a boolean value, where <code>true</code> means
+ * a change in component order will cause a change in the keyboard
+ * navigation order.
+ * @since 1.6
+ */
+ void setComponentOrderCheckingEnabled(boolean enable) {
+ componentOrderCheckingEnabled = enable;
+ }
+ private boolean componentOrderCheckingEnabled = true;
+
+ private JInternalFrame getNextFrame(JInternalFrame f, boolean forward) {
+ return null;
+ }
+
}
Modified: trunk/core/src/classpath/javax/javax/swing/JEditorPane.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/JEditorPane.java 2007-07-06 11:09:17 UTC (rev 3352)
+++ trunk/core/src/classpath/javax/javax/swing/JEditorPane.java 2007-07-07 12:37:26 UTC (rev 3353)
@@ -1219,4 +1219,32 @@
{
return (HyperlinkListener[]) getListeners(HyperlinkListener.class);
}
+
+ //jnode openjdk
+ /**
+ * Key for a client property used to indicate whether
+ * the default font and foreground color from the component are
+ * used if a font or foreground color is not specified in the styled
+ * text.
+ * <p>
+ * The default varies based on the look and feel;
+ * to enable it set the client {@link #putClientProperty property} with
+ * this name to <code>Boolean.TRUE</code>.
+ *
+ * @since 1.5
+ */
+ public static final String HONOR_DISPLAY_PROPERTIES = "JEditorPane.honorDisplayProperties";
+
+ /**
+ * Key for a client property used to indicate whether
+ * <a href="http://www.w3.org/TR/CSS21/syndata.html#length-units">
+ * w3c compliant</a> length units are used for html rendering.
+ * <p>
+ * By default this is not enabled; to enable
+ * it set the client {@link #putClientProperty property} with this name
+ * to <code>Boolean.TRUE</code>.
+ *
+ * @since 1.5
+ */
+ public static final String W3C_LENGTH_UNITS = "JEditorPane.w3cLengthUnits";
}
Modified: trunk/core/src/classpath/javax/javax/swing/JInternalFrame.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/JInternalFrame.java 2007-07-06 11:09:17 UTC (rev 3352)
+++ trunk/core/src/classpath/javax/javax/swing/JInternalFrame.java 2007-07-07 12:37:26 UTC (rev 3353)
@@ -38,14 +38,7 @@
package javax.swing;
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Graphics;
-import java.awt.IllegalComponentStateException;
-import java.awt.KeyboardFocusManager;
-import java.awt.LayoutManager;
-import java.awt.Rectangle;
+import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyVetoException;
@@ -1817,4 +1810,18 @@
{
super.fireVetoableChange(name, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
}
+
+ /**
+ * Returns the last <code>Cursor</code> that was set by the
+ * <code>setCursor</code> method that is not a resizable
+ * <code>Cursor</code>.
+ *
+ * @return the last non-resizable <code>Cursor</code>
+ * @since 1.6
+ */
+ public Cursor getLastCursor() {
+ return lastCursor;
+ }
+
+ private Cursor lastCursor;
}
Modified: trunk/core/src/classpath/javax/javax/swing/JList.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/JList.java 2007-07-06 11:09:17 UTC (rev 3352)
+++ trunk/core/src/classpath/javax/javax/swing/JList.java 2007-07-07 12:37:26 UTC (rev 3353)
@@ -120,7 +120,106 @@
public class JList extends JComponent implements Accessible, Scrollable
{
+ //jnode openjdk
+ /**
+ * A subclass of <code>TransferHandler.DropLocation</code> representing
+ * a drop location for a <code>JList</code>.
+ *
+ * @see #getDropLocation
+ * @since 1.6
+ */
+ public static final class DropLocation extends TransferHandler.DropLocation {
+ private final int index;
+ private final boolean isInsert;
+ private DropLocation(Point p, int index, boolean isInsert) {
+ super(p);
+ this.index = index;
+ this.isInsert = isInsert;
+ }
+
+ /**
+ * Returns the index where dropped data should be placed in the
+ * list. Interpretation of the value depends on the drop mode set on
+ * the associated component. If the drop mode is either
+ * <code>DropMode.USE_SELECTION</code> or <code>DropMode.ON</code>,
+ * the return value is an index of a row in the list. If the drop mode is
+ * <code>DropMode.INSERT</code>, the return value refers to the index
+ * where the data should be inserted. If the drop mode is
+ * <code>DropMode.ON_OR_INSERT</code>, the value of
+ * <code>isInsert()</code> indicates whether the index is an index
+ * of a row, or an insert index.
+ * <p>
+ * <code>-1</code> indicates that the drop occurred over empty space,
+ * and no index could be calculated.
+ *
+ * @return the drop index
+ */
+ public int getIndex() {
+ return index;
+ }
+
+ /**
+ * Returns whether or not this location represents an insert
+ * location.
+ *
+ * @return whether or not this is an insert location
+ */
+ public boolean isInsert() {
+ return isInsert;
+ }
+
+ /**
+ * Returns a string representation of this drop location.
+ * This method is intended to be used for debugging purposes,
+ * and the content and format of the returned string may vary
+ * between implementations.
+ *
+ * @return a string representation of this drop location
+ */
+ public String toString() {
+ return getClass().getName()
+ + "[dropPoint=" + getDropPoint() + ","
+ + "index=" + index + ","
+ + "insert=" + isInsert + "]";
+ }
+ }
+
+ /**
+ * Returns the location that this component should visually indicate
+ * as the drop location during a DnD operation over the component,
+ * or {@code null} if no location is to currently be shown.
+ * <p>
+ * This method is not meant for querying the drop location
+ * from a {@code TransferHandler}, as the drop location is only
+ * set after the {@code TransferHandler}'s <code>canImport</code>
+ * has returned and has allowed for the location to be shown.
+ * <p>
+ * When this property changes, a property change event with
+ * name "dropLocation" is fired by the component.
+ * <p>
+ * By default, responsibility for listening for changes to this property
+ * and indicating the drop location visually lies with the list's
+ * {@code ListUI}, which may paint it directly and/or install a cell
+ * renderer to do so. Developers wishing to implement custom drop location
+ * painting and/or replace the default cell renderer, may need to honor
+ * this property.
+ *
+ * @return the drop location
+ * @see #setDropMode
+ * @see TransferHandler#canImport(TransferHandler.TransferSupport)
+ * @since 1.6
+ */
+ public final DropLocation getDropLocation() {
+ return dropLocation;
+ }
+
+ /**
+ * The drop location.
+ */
+ private transient DropLocation dropLocation;
+
+
/**
* Provides accessibility support for <code>JList</code>.
*/
Modified: trunk/core/src/classpath/javax/javax/swing/JTabbedPane.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/JTabbedPane.java 2007-07-06 11:09:17 UTC (rev 3352)
+++ trunk/core/src/classpath/javax/javax/swing/JTabbedPane.java 2007-07-07 12:37:26 UTC (rev 3353)
@@ -1723,4 +1723,87 @@
return accessibleContext;
}
+
+ //jnode openjdk
+ /**
+ * Returns the tab component at <code>index</code>.
+ *
+ * @param index the index of the item being queried
+ * @return the tab component at <code>index</code>
+ * @exception IndexOutOfBoundsException if index is out of range
+ * (index < 0 || index >= tab count)
+ *
+ * @see #setTabComponentAt
+ * @since 1.6
+ */
+ public Component getTabComponentAt(int index) {
+ //return pages.get(index).tabComponent;
+ return null;
+ }
+
+ /**
+ * Returns the index of the tab for the specified tab component.
+ * Returns -1 if there is no tab for this tab component.
+ *
+ * @param tabComponent the tab component for the tab
+ * @return the first tab which matches this tab component, or -1
+ * if there is no tab for this tab component
+ * @see #setTabComponentAt
+ * @see #getTabComponentAt
+ * @since 1.6
+ */
+ public int indexOfTabComponent(Component tabComponent) {
+ for(int i = 0; i < getTabCount(); i++) {
+ Component c = getTabComponentAt(i);
+ if (c == tabComponent) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Sets the component that is responsible for rendering the
+ * title for the specified tab. A null value means
+ * <code>JTabbedPane</code> will render the title and/or icon for
+ * the specified tab. A non-null value means the component will
+ * render the title and <code>JTabbedPane</code> will not render
+ * the title and/or icon.
+ * <p>
+ * Note: The component must not be one that the developer has
+ * already added to the tabbed pane.
+ *
+ * @param index the tab index where the component should be set
+ * @param component the component to render the title for the
+ * specified tab
+ * @exception IndexOutOfBoundsException if index is out of range
+ * (index < 0 || index >= tab count)
+ * @exception IllegalArgumentException if component has already been
+ * added to this <code>JTabbedPane</code>
+ *
+ * @see #getTabComponentAt
+ * @beaninfo
+ * preferred: true
+ * attribute: visualUpdate true
+ * description: The tab component at the specified tab index.
+ * @since 1.6
+ */
+ public void setTabComponentAt(int index, Component component) {
+ /*
+ if (component != null && indexOfComponent(component) != -1) {
+ throw new IllegalArgumentException("Component is already added to this JTabbedPane");
+ }
+ Component oldValue = getTabComponentAt(index);
+ if (component != oldValue) {
+ int tabComponentIndex = indexOfTabComponent(component);
+ if (tabComponentIndex != -1) {
+ setTabComponentAt(tabComponentIndex, null);
+ }
+ pages.get(index).tabComponent = component;
+ firePropertyChange("indexForTabComponent", -1, index);
+ }
+ */
+ }
+
+
}
Modified: trunk/core/src/classpath/javax/javax/swing/JTable.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/JTable.java 2007-07-06 11:09:17 UTC (rev 3352)
+++ trunk/core/src/classpath/javax/javax/swing/JTable.java 2007-07-07 12:37:26 UTC (rev 3353)
@@ -75,6 +75,7 @@
import javax.swing.event.TableColumnModelListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
+import javax.swing.event.RowSorterEvent;
import javax.swing.plaf.TableUI;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableColumnModel;
@@ -85,6 +86,7 @@
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
+import sun.swing.SwingUtilities2;
/**
* The table component, displaying information, organized in rows and columns.
@@ -100,6 +102,104 @@
implements TableModelListener, Scrollable, TableColumnModelListener,
ListSelectionListener, CellEditorListener, Accessible
{
+ //jnode openjdk
+ /**
+ * A subclass of <code>TransferHandler.DropLocation</code> representing
+ * a drop location for a <code>JTable</code>.
+ *
+ * @see #getDropLocation
+ * @since 1.6
+ */
+ public static final class DropLocation extends TransferHandler.DropLocation {
+ private final int row;
+ private final int col;
+ private final boolean isInsertRow;
+ private final boolean isInsertCol;
+
+ private DropLocation(Point p, int row, int col,
+ boolean isInsertRow, boolean isInsertCol) {
+
+ super(p);
+ this.row = row;
+ this.col = col;
+ this.isInsertRow = isInsertRow;
+ this.isInsertCol = isInsertCol;
+ }
+
+ /**
+ * Returns the row index where a dropped item should be placed in the
+ * table. Interpretation of the value depends on the return of
+ * <code>isInsertRow()</code>. If that method returns
+ * <code>true</code> this value indicates the index where a new
+ * row should be inserted. Otherwise, it represents the value
+ * of an existing row on which the data was dropped. This index is
+ * in terms of the view.
+ * <p>
+ * <code>-1</code> indicates that the drop occurred over empty space,
+ * and no row could be calculated.
+ *
+ * @return the drop row
+ */
+ public int getRow() {
+ return row;
+ }
+
+ /**
+ * Returns the column index where a dropped item should be placed in the
+ * table. Interpretation of the value depends on the return of
+ * <code>isInsertColumn()</code>. If that method returns
+ * <code>true</code> this value indicates the index where a new
+ * column should be inserted. Otherwise, it represents the value
+ * of an existing column on which the data was dropped. This index is
+ * in terms of the view.
+ * <p>
+ * <code>-1</code> indicates that the drop occurred over empty space,
+ * and no column could be calculated.
+ *
+ * @return the drop row
+ */
+ public int getColumn() {
+ return col;
+ }
+
+ /**
+ * Returns whether or not this location represents an insert
+ * of a row.
+ *
+ * @return whether or not this is an insert row
+ */
+ public boolean isInsertRow() {
+ return isInsertRow;
+ }
+
+ /**
+ * Returns whether or not this location represents an insert
+ * of a column.
+ *
+ * @return whether or not this is an insert column
+ */
+ public boolean isInsertColumn() {
+ return isInsertCol;
+ }
+
+ /**
+ * Returns a string representation of this drop location.
+ * This method is intended to be used for debugging purposes,
+ * and the content and format of the returned string may vary
+ * between implementations.
+ *
+ * @return a string representation of this drop location
+ */
+ public String toString() {
+ return getClass().getName()
+ + "[dropPoint=" + getDropPoint() + ","
+ + "row=" + row + ","
+ + "column=" + col + ","
+ + "insertRow=" + isInsertRow + ","
+ + "insertColumn=" + isInsertCol + "]";
+ }
+ }
+
/**
* Provides accessibility support for <code>JTable</code>.
*
@@ -5154,4 +5254,79 @@
super.setUIProperty(propertyName, value);
}
}
-}
+
+ //jnode openjdk
+ /**
+ * Returns the object responsible for sorting.
+ *
+ * @return the object responsible for sorting
+ * @since 1.6
+ */
+ public RowSorter<? extends TableModel> getRowSorter() {
+ //return (sortManager != null) ? sortManager.sorter : null;
+ return null;
+ }
+ /**
+ * Information used in sorting.
+ */
+ //private transient SortManager sortManager;
+
+ /**
+ * Sets the <code>RowSorter</code>. <code>RowSorter</code> is used
+ * to provide sorting and filtering to a <code>JTable</code>.
+ * <p>
+ * This method clears the selection and resets any variable row heights.
+ * <p>
+ * If the underlying model of the <code>RowSorter</code> differs from
+ * that of this <code>JTable</code> undefined behavior will result.
+ *
+ * @param sorter the <code>RowSorter</code>; <code>null</code> turns
+ * sorting off
+ * @see javax.swing.table.TableRowSorter
+ * @since 1.6
+ */
+ public void setRowSorter(RowSorter<? extends TableModel> sorter) {
+ /*
+ RowSorter<? extends TableModel> oldRowSorter = null;
+ if (sortManager != null) {
+ oldRowSorter = sortManager.sorter;
+ sortManager.dispose();
+ sortManager = null;
+ }
+ rowModel = null;
+ clearSelectionAndLeadAnchor();
+ if (sorter != null) {
+ sortManager = new SortManager(sorter);
+ }
+ resizeAndRepaint();
+ firePropertyChange("sorter", oldRowSorter, sorter);
+ */
+ }
+
+ /**
+ * Returns the location that this component should visually indicate
+ * as the drop location during a DnD operation over the component,
+ * or {@code null} if no location is to currently be shown.
+ * <p>
+ * This method is not meant for querying the drop location
+ * from a {@code TransferHandler}, as the drop location is only
+ * set after the {@code TransferHandler}'s <code>canImport</code>
+ * has returned and has allowed for the location to be shown.
+ * <p>
+ * When this property changes, a property change event with
+ * name "dropLocation" is fired by the component.
+ *
+ * @return the drop location
+ * @see #setDropMode
+ * @see TransferHandler#canImport(TransferHandler.TransferSupport)
+ * @since 1.6
+ */
+ public final DropLocation getDropLocation() {
+ return dropLocation;
+ }
+ /**
+ * The drop location.
+ */
+ private transient DropLocation dropLocation;
+
+}
\ No newline at end of file
Modified: trunk/core/src/classpath/javax/javax/swing/JTree.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/JTree.java 2007-07-06 11:09:17 UTC (rev 3352)
+++ trunk/core/src/classpath/javax/javax/swing/JTree.java 2007-07-07 12:37:26 UTC (rev 3353)
@@ -86,6 +86,106 @@
public class JTree extends JComponent implements Scrollable, Accessible
{
+ //jnode openjdk
+ /**
+ * A subclass of <code>TransferHandler.DropLocation</code> representing
+ * a drop location for a <code>JTree</code>.
+ *
+ * @see #getDropLocation
+ * @since 1.6
+ */
+ public static final class DropLocation extends TransferHandler.DropLocation {
+ private final TreePath path;
+ private final int index;
+
+ private DropLocation(Point p, TreePath path, int index) {
+ super(p);
+ this.path = path;
+ this.index = index;
+ }
+
+ /**
+ * Returns the index where the dropped data should be inserted
+ * with respect to the path returned by <code>getPath()</code>.
+ * <p>
+ * For drop modes <code>DropMode.USE_SELECTION</code> and
+ * <code>DropMode.ON</code>, this index is unimportant (and it will
+ * always be <code>-1</code>) as the only interesting data is the
+ * path over which the drop operation occurred.
+ * <p>
+ * For drop mode <code>DropMode.INSERT</code>, this index
+ * indicates the index at which the data should be inserted into
+ * the parent path represented by <code>getPath()</code>.
+ * <code>-1</code> indicates that the drop occurred over the
+ * parent itself, and in most cases should be treated as inserting
+ * into either the beginning or the end of the parent's list of
+ * children.
+ * <p>
+ * For <code>DropMode.ON_OR_INSERT</code>, this value will be
+ * an insert index, as described above, or <code>-1</code> if
+ * the drop occurred over the path itself.
+ *
+ * @return the child index
+ * @see #getPath
+ */
+ public int getChildIndex() {
+ return index;
+ }
+
+ /**
+ * Returns the path where dropped data should be placed in the
+ * tree.
+ * <p>
+ * Interpretation of this value depends on the drop mode set on the
+ * component. If the drop mode is <code>DropMode.USE_SELECTION</code>
+ * or <code>DropMode.ON</code>, the return value is the path in the
+ * tree over which the data has been (or will be) dropped.
+ * <code>null</code> indicates that the drop is over empty space,
+ * not associated with a particular path.
+ * <p>
+ * If the drop mode is <code>DropMode.INSERT</code>, the return value
+ * refers to the path that should become the parent of the new data,
+ * in which case <code>getChildIndex()</code> indicates where the
+ * new item should be inserted into this parent path. A
+ * <code>null</code> path indicates that no parent path has been
+ * determined, which can happen for multiple reasons:
+ * <ul>
+ * <li>The tree has no model
+ * <li>There is no root in the tree
+ * <li>The root is collapsed
+ * <li>The root is a leaf node
+ * </ul>
+ * It is up to the developer to decide if and how they wish to handle
+ * the <code>null</code> case.
+ * <p>
+ * If the drop mode is <code>DropMode.ON_OR_INSERT</code>,
+ * <code>getChildIndex</code> can be used to determine whether the
+ * drop is on top of the path itself (<code>-1</code>) or the index
+ * at which it should be inserted into the path (values other than
+ * <code>-1</code>).
+ *
+ * @return the drop path
+ * @see #getChildIndex
+ */
+ public TreePath getPath() {
+ return path;
+ }
+
+ /**
+ * Returns a string representation of this drop location.
+ * This method is intended to be used for debugging purposes,
+ * and the content and format of the returned string may vary
+ * between implementations.
+ *
+ * @return a string representation of this drop location
+ */
+ public String toString() {
+ return getClass().getName()
+ + "[dropPoint=" + getDropPoint() + ","
+ + "path=" + path + ","
+ + "childIndex=" + index + "]";
+ }
+ }
/**
* This class implements accessibility support for the JTree class. It
* provides an implementation of the Java Accessibility API appropriate
@@ -3183,4 +3283,31 @@
super.setUIProperty(propertyName, value);
}
}
+ //jnode openjdk
+ /**
+ * Returns the location that this component should visually indicate
+ * as the drop location during a DnD operation over the component,
+ * or {@code null} if no location is to currently be shown.
+ * <p>
+ * This method is not meant for querying the drop location
+ * from a {@code TransferHandler}, as the drop location is only
+ * set after the {@code TransferHandler}'s <code>canImport</code>
+ * has returned and has allowed for the location to be shown.
+ * <p>
+ * When this property changes, a property change event with
+ * name "dropLocation" is fired by the component.
+ *
+ * @return the drop location
+ * @see #setDropMode
+ * @see TransferHandler#canImport(TransferHandler.TransferSupport)
+ * @since 1.6
+ */
+ public final DropLocation getDropLocation() {
+ return dropLocation;
+ }
+ /**
+ * The drop location.
+ */
+ private transient DropLocation dropLocation;
+
}
Modified: trunk/core/src/classpath/javax/javax/swing/LookAndFeel.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/LookAndFeel.java 2007-07-06 11:09:17 UTC (rev 3352)
+++ trunk/core/src/classpath/javax/javax/swing/LookAndFeel.java 2007-07-07 12:37:26 UTC (rev 3353)
@@ -51,6 +51,8 @@
import javax.swing.plaf.UIResource;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.text.JTextComponent;
+import sun.swing.DefaultLayoutStyle;
+import sun.swing.ImageIconUIResource;
/**
* A <i>look-and-feel</i> controls most aspects of the appearance and
@@ -430,4 +432,73 @@
{
c.setUIProperty(propertyName, value);
}
+
+ //jnode openjdk
+ /**
+ * Returns the <code>LayoutStyle</code> for this look
+ * and feel. This never returns {@code null}.
+ * <p>
+ * You generally don't use the <code>LayoutStyle</code> from
+ * the look and feel, instead use the <code>LayoutStyle</code>
+ * method <code>getInstance</code>.
+ *
+ * @see LayoutStyle#getInstance
+ * @return the <code>LayoutStyle</code> for this look and feel
+ * @since 1.6
+ */
+ public LayoutStyle getLayoutStyle() {
+ return DefaultLayoutStyle.getInstance();
+ }
+ /**
+ * Returns an <code>Icon</code> with a disabled appearance.
+ * This method is used to generate a disabled <code>Icon</code> when
+ * one has not been specified. For example, if you create a
+ * <code>JButton</code> and only specify an <code>Icon</code> via
+ * <code>setIcon</code> this method will be called to generate the
+ * disabled <code>Icon</code>. If {@code null} is passed as
+ * <code>icon</code> this method returns {@code null}.
+ * <p>
+ * Some look and feels might not render the disabled {@code Icon}, in which
+ * case they will ignore this.
+ *
+ * @param component {@code JComponent} that will display the {@code Icon},
+ * may be {@code null}
+ * @param icon {@code Icon} to generate the disabled icon from
+ * @return disabled {@code Icon}, or {@code null} if a suitable
+ * {@code Icon} can not be generated
+ * @since 1.5
+ */
+ public Icon getDisabledIcon(JComponent component, Icon icon) {
+ if (icon instanceof ImageIcon) {
+ return new ImageIconUIResource(GrayFilter.
+ createDisabledImage(((ImageIcon)icon).getImage()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns an <code>Icon</code> for use by disabled
+ * components that are also selected. This method is used to generate an
+ * <code>Icon</code> for components that are in both the disabled and
+ * selected states but do not have a specific <code>Icon</code> for this
+ * state. For example, if you create a <code>JButton</code> and only
+ * specify an <code>Icon</code> via <code>setIcon</code> this method
+ * will be called to generate the disabled and selected
+ * <code>Icon</code>. If {@code null} is passed as <code>icon</code> this
+ * methods returns {@code null}.
+ * <p>
+ * Some look and feels might not render the disabled and selected
+ * {@code Icon}, in which case they will ignore this.
+ *
+ * @param component {@code JComponent} that will display the {@code Icon},
+ * may be {@code null}
+ * @param icon {@code Icon} to generate disabled and selected icon from
+ * @return disabled and selected icon, or {@code null} if a suitable
+ * {@code Icon} can not be generated.
+ * @since 1.5
+ */
+ public Icon getDisabledSelectedIcon(JComponent component, Icon icon) {
+ return getDisabledIcon(component, icon);
+ }
+
}
Modified: trunk/core/src/classpath/javax/javax/swing/TransferHandler.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/TransferHandler.java 2007-07-06 11:09:17 UTC (rev 3352)
+++ trunk/core/src/classpath/javax/javax/swing/TransferHandler.java 2007-07-07 12:37:26 UTC (rev 3353)
@@ -40,7 +40,11 @@
import gnu.classpath.NotImplementedException;
-import java.awt.Toolkit;
+import java.awt.*;
+import java.awt.dnd.DropTargetEvent;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.dnd.DnDConstants;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
@@ -54,10 +58,511 @@
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Method;
+import javax.swing.text.JTextComponent;
+import sun.reflect.misc.MethodUtil;
+import sun.swing.SwingUtilities2;
+import sun.awt.AppContext;
+import sun.swing.*;
+
public class TransferHandler implements Serializable
{
+ //jnode openjdk
+ /**
+ * Represents a location where dropped data should be inserted.
+ * This is a base class that only encapsulates a point.
+ * Components supporting drop may provide subclasses of this
+ * containing more information.
+ * <p>
+ * Developers typically shouldn't create instances of, or extend, this
+ * class. Instead, these are something provided by the DnD
+ * implementation by <code>TransferSupport</code> instances and by
+ * components with a <code>getDropLocation()</code> method.
+ *
+ * @see javax.swing.TransferHandler.TransferSupport#getDropLocation
+ * @since 1.6
+ */
+ public static class DropLocation {
+ private final Point dropPoint;
+ /**
+ * Constructs a drop location for the given point.
+ *
+ * @param dropPoint the drop point, representing the mouse's
+ * current location within the component.
+ * @throws IllegalArgumentException if the point
+ * is <code>null</code>
+ */
+ protected DropLocation(Point dropPoint) {
+ if (dropPoint == null) {
+ throw new IllegalArgumentException("Point cannot be null");
+ }
+
+ this.dropPoint = new Point(dropPoint);
+ }
+
+ /**
+ * Returns the drop point, representing the mouse's
+ * current location within the component.
+ *
+ * @return the drop point.
+ */
+ public final Point getDropPoint() {
+ return new Point(dropPoint);
+ }
+
+ /**
+ * Returns a string representation of this drop location.
+ * This method is intended to be used for debugging purposes,
+ * and the content and format of the returned string may vary
+ * between implementations.
+ *
+ * @return a string representation of this drop location
+ */
+ public String toString() {
+ return getClass().getName() + "[dropPoint=" + dropPoint + "]";
+ }
+ };
+ /**
+ * This class encapsulates all relevant details of a clipboard
+ * or drag and drop transfer, and also allows for customizing
+ * aspects of the drag and drop experience.
+ * <p>
+ * The main purpose of this class is to provide the information
+ * needed by a developer to determine the suitability of a
+ * transfer or to import the data contained within. But it also
+ * doubles as a controller for customizing properties during drag
+ * and drop, such as whether or not to show the drop location,
+ * and which drop action to use.
+ * <p>
+ * Developers typically need not create instances of this
+ * class. Instead, they are something provided by the DnD
+ * implementation to certain methods in <code>TransferHandler</code>.
+ *
+ * @see #canImport(TransferHandler.TransferSupport)
+ * @see #importData(TransferHandler.TransferSupport)
+ * @since 1.6
+ */
+ public final static class TransferSupport {
+ private boolean isDrop;
+ private Component component;
+
+ private boolean showDropLocationIsSet;
+ private boolean showDropLocation;
+
+ private int dropAction = -1;
+
+ /**
+ * The source is a {@code DropTargetDragEvent} or
+ * {@code DropTargetDropEvent} for drops,
+ * and a {@code Transferable} otherwise
+ */
+ private Object source;
+
+ private DropLocation dropLocation;
+
+ /**
+ * Create a <code>TransferSupport</code> with <code>isDrop()</code>
+ * <code>true</code> for the given component, event, and index.
+ *
+ * @param component the target component
+ * @param event a <code>DropTargetEvent</code>
+ */
+ private TransferSupport(Component component,
+ DropTargetEvent event) {
+
+ isDrop = true;
+ setDNDVariables(component, event);
+ }
+
+ /**
+ * Create a <code>TransferSupport</code> with <code>isDrop()</code>
+ * <code>false</code> for the given component and
+ * <code>Transferable</code>.
+ *
+ * @param component the target component
+ * @param transferable the transferable
+ * @throws NullPointerException if either parameter
+ * is <code>null</code>
+ */
+ public TransferSupport(Component component, Transferable transferable) {
+ if (component == null) {
+ throw new NullPointerException("component is null");
+ }
+
+ if (transferable == null) {
+ throw new NullPointerException("transferable is null");
+ }
+
+ isDrop = false;
+ this.component = component;
+ this.source = transferable;
+ }
+
+ /**
+ * Allows for a single instance to be reused during DnD.
+ *
+ * @param component the target component
+ * @param event a <code>DropTargetEvent</code>
+ */
+ private void setDNDVariables(Component component,
+ DropTargetEvent event) {
+
+ assert isDrop;
+
+ this.component = component;
+ this.source = event;
+ dropLocation = null;
+ dropAction = -1;
+ showDropLocationIsSet = false;
+
+ if (source == null) {
+ return;
+ }
+
+ assert source instanceof DropTargetDragEvent ||
+ source instanceof DropTargetDropEvent;
+
+ Point p = source instanceof DropTargetDragEvent
+ ? ((DropTargetDragEvent)source).getLocation()
+ : ((DropTargetDropEvent)source).getLocation();
+
+ if (component instanceof JTextComponent) {
+ try {
+ AccessibleMethod method
+ = new AccessibleMethod(JTextComponent.class,
+ "dropLocationForPoint",
+ Point.class);
+
+ dropLocation =
+ (DropLocation)method.invokeNoChecked(component, p);
+ } catch (NoSuchMethodException e) {
+ throw new AssertionError(
+ "Couldn't locate method JTextComponent.dropLocationForPoint");
+ }
+ } else if (component instanceof JComponent) {
+ dropLocation = ((JComponent)component).dropLocationForPoint(p);
+ }
+
+ /*
+ * The drop location may be null at this point if the component
+ * doesn't return custom drop locations. In this case, a point-only
+ * drop location will be created lazily when requested.
+ */
+ }
+
+ /**
+ * Returns whether or not this <code>TransferSupport</code>
+ * represents a drop operation.
+ *
+ * @return <code>true</code> if this is a drop operation,
+ * <code>false</code> otherwise.
+ */
+ public boolean isDrop() {
+ return isDrop;
+ }
+
+ /**
+ * Returns the target component of this transfer.
+ *
+ * @return the target component
+ */
+ public Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Checks that this is a drop and throws an
+ * {@code IllegalStateException} if it isn't.
+ *
+ * @throws IllegalStateException if {@code isDrop} is false.
+ */
+ private void assureIsDrop() {
+ if (!isDrop) {
+ throw new IllegalStateException("Not a drop");
+ }
+ }
+
+ /**
+ * Returns the current (non-{@code null}) drop location for the component,
+ * when this {@code TransferSupport} represents a drop.
+ * <p>
+ * Note: For components with built-in drop support, this location
+ * will be a subclass of {@code DropLocation} of the same type
+ * returned by that component's {@code getDropLocation} method.
+ * <p>
+ * This method is only for use with drag and drop transfers.
+ * Calling it when {@code isDrop()} is {@code false} results
+ * in an {@code IllegalStateException}.
+ *
+ * @return the drop location
+ * @throws IllegalStateException if this is not a drop
+ * @see #isDrop
+ */
+ public DropLocation getDropLocation() {
+ assureIsDrop();
+
+ if (dropLocation == null) {
+ /*
+ * component didn't give us a custom drop location,
+ * so lazily create a point-only location
+ */
+ Point p = source instanceof DropTargetDragEvent
+ ? ((DropTargetDragEvent)source).getLocation()
+ : ((DropTargetDropEvent)source).getLocation();
+
+ dropLocation = new DropLocation(p);
+ }
+
+ return dropLocation;
+ }
+
+ /**
+ * Sets whether or not the drop location should be visually indicated
+ * for the transfer - which must represent a drop. This is applicable to
+ * those components that automatically
+ * show the drop location when appropriate during a drag and drop
+ * operation). By default, the drop location is shown only when the
+ * {@code TransferHandler} has said it can accept the import represented
+ * by this {@code TransferSupport}. With this method you can force the
+ * drop location to always be shown, or always not be shown.
+ * <p>
+ * This method is only for use with drag and drop transfers.
+ * Calling it when {@code isDrop()} is {@code false} results
+ * in an {@code IllegalStateException}.
+ *
+ * @param showDropLocation whether or not to indicate the drop location
+ * @throws IllegalStateException if this is not a drop
+ * @see #isDrop
+ */
+ public void setShowDropLocation(boolean showDropLocation) {
+ assureIsDrop();
+
+ this.showDropLocation = showDropLocation;
+ this.showDropLocationIsSet = true;
+ }
+
+ /**
+ * Sets the drop action for the transfer - which must represent a drop
+ * - to the given action,
+ * instead of the default user drop action. The action must be
+ * supported by the source's drop actions, and must be one
+ * of {@code COPY}, {@code MOVE} or {@code LINK}.
+ * <p>
+ * This method is only for use with drag and drop transfers.
+ * Calling it when {@code isDrop()} is {@code false} results
+ * in an {@code IllegalStateException}.
+ *
+ * @param dropAction the drop action
+ * @throws IllegalStateException if this is not a drop
+ * @throws IllegalArgumentException if an invalid action is specified
+ * @see #getDropAction
+ * @see #getUserDropAction
+ * @see #getSourceDropActions
+ * @see #isDrop
+ */
+ public void setDropAction(int dropAction) {
+ assureIsDrop();
+
+ int action = dropAction & getSourceDropActions();
+
+ if (!(action == COPY || action == MOVE || action == LINK)) {
+ throw new IllegalArgumentException("unsupported drop action: " + dropAction);
+ }
+
+ this.dropAction = dropAction;
+ }
+
+ /**
+ * Returns the action chosen for the drop, when this
+ * {@code TransferSupport} represents a drop.
+ * <p>
+ * Unless explicitly chosen by way of {@code setDropAction},
+ * this returns the user drop action provided by
+ * {@code getUserDropAction}.
+ * <p>
+ * You may wish to query this in {@code TransferHandler}'s
+ * {@code importData} method to customize processing based
+ * on the action.
+ * <p>
+ * This method is only for use with drag and drop transfers.
+ * Calling it when {@code isDrop()} is {@code false} results
+ * in an {@code IllegalStateException}.
+ *
+ * @return the action chosen for the drop
+ * @throws IllegalStateException if this is not a drop
+ * @see #setDropAction
+ * @see #getUserDropAction
+ * @see #isDrop
+ */
+ public int getDropAction() {
+ return dropAction == -1 ? getUserDropAction() : dropAction;
+ }
+
+ /**
+ * Returns the user drop action for the drop, when this
+ * {@code TransferSupport} represents a drop.
+ * <p>
+ * The user drop action is chosen for a drop as described in the
+ * documentation for {@link java.awt.dnd.DropTargetDragEvent} and
+ * {@link java.awt.dnd.DropTargetDropEvent}. A different action
+ * may be chosen as the drop action by way of the {@code setDropAction}
+ * method.
+ * <p>
+ * You may wish to query this in {@code TransferHandler}'s
+ * {@code canImport} method when determining the suitability of a
+ * drop or when deciding on a drop action to explicitly choose.
+ * <p>
+ * This method is only for use with drag and drop transfers.
+ * Calling it when {@code isDrop()} is {@code false} results
+ * in an {@code IllegalStateException}.
+ *
+ * @return the user drop action
+ * @throws IllegalStateException if this is not a drop
+ * @see #setDropAction
+ * @see #getDropAction
+ * @see #isDrop
+ */
+ public int getUserDropAction() {
+ assureIsDrop();
+
+ return (source instanceof DropTargetDragEvent)
+ ? ((DropTargetDragEvent)source).getDropAction()
+ : ((DropTargetDropEvent)source).getDropAction();
+ }
+
+ /**
+ * Returns the drag source's supported drop actions, when this
+ * {@code TransferSupport} represents a drop.
+ * <p>
+ * The source actions represent the set of actions supported by the
+ * source of this transfer, and are represented as some bitwise-OR
+ * combination of {@code COPY}, {@code MOVE} and {@code LINK}.
+ * You may wish to query this in {@code TransferHandler}'s
+ * {@code canImport} method when determining the suitability of a drop
+ * or when deciding on a drop action to explicitly choose. To determine
+ * if a particular action is supported by the source, bitwise-AND
+ * the action with the source drop actions, and then compare the result
+ * against the original action. For example:
+ * <pre>
+ * boolean copySupported = (COPY & getSourceDropActions()) == COPY;
+ * </pre>
+ * <p>
+ * This method is only for use with drag and drop transfers.
+ * Calling it when {@code isDrop()} is {@code false} results
+ * in an {@code IllegalStateException}.
+ *
+ * @return the drag source's supported drop actions
+ * @throws IllegalStateException if this is not a drop
+ * @see #isDrop
+ */
+ public int getSourceDropActions() {
+ assureIsDrop();
+
+ return (source instanceof DropTargetDragEvent)
+ ? ((DropTargetDragEvent)source).getSourceActions()
+ : ((DropTargetDropEvent)source).getSourceActions();
+ }
+
+ /**
+ * Returns the data flavors for this transfer.
+ *
+ * @return the data flavors for this transfer
+ */
+ public DataFlavor[] getDataFlavors() {
+ if (isDrop) {
+ if (source instanceof DropTargetDragEvent) {
+ return ((DropTargetDragEvent)source).getCurrentDataFlavors();
+ } else {
+ return ((DropTargetDropEvent)source).getCurrentDataFlavors();
+ }
+ }
+
+ return ((Transferable)source).getTransferDataFlavors();
+ }
+
+ /**
+ * Returns whether or not the given data flavor is supported.
+ *
+ * @param df the <code>DataFlavor</code> to test
+ * @return whether or not the given flavor is supported.
+ */
+ public boolean isDataFlavorSupported(DataFlavor df) {
+ if (isDrop) {
+ if (source instanceof DropTargetDragEvent) {
+ return ((DropTargetDragEvent)source).isDataFlavorSupported(df);
+ } else {
+ return ((DropTargetDropEvent)source).isDataFlavorSupported(df);
+ }
+ }
+
+ return ((Transferable)source).isDataFlavorSupported(df);
+ }
+
+ /**
+ * Returns the <code>Transferable</code> associated with this transfer.
+ * <p>
+ * Note: Unless it is necessary to fetch the <code>Transferable</code>
+ * directly, use one of the other methods on this class to inquire about
+ * the transfer. This may perform better than fetching the
+ * <code>Transferable</code> and asking it directly.
+ *
+ * @return the <code>Transferable</code> associated with this transfer
+ */
+ public Transferable getTransferable() {
+ if (isDrop) {
+ if (source instanceof DropTargetDragEvent) {
+ return ((DropTargetDragEvent)source).getTransferable();
+ } else {
+ return ((DropTargetDropEvent)source).getTransferable();
+ }
+ }
+
+ return (Transferable)source;
+ }
+ }
+
+ /**
+ * An <code>int</code> representing a "link" transfer action.
+ * This value is used to specify that data should be linked in a drag
+ * and drop operation.
+ *
+ * @see java.awt.dnd.DnDConstants#ACTION_LINK
+ * @since 1.6
+ */
+ public static final int LINK = DnDConstants.ACTION_LINK;
+
+ /**
+ * Causes a transfer to occur from a clipboard or a drag and
+ * drop operation. The <code>Transferable</code> to be
+ * imported and the component to transfer to are contained
+ * within the <code>TransferSupport</code>.
+ * <p>
+ * While the drag and drop implementation calls {@code canImport}
+ * to determine the suitability of a transfer before calling this
+ * method, the implementation of paste does not. As such, it cannot
+ * be assumed that the transfer is acceptable upon a call to
+ * this method for paste. It is recommended that {@code canImport} be
+ * explicitly called to cover this case.
+ * <p>
+ * Note: The <code>TransferSupport</code> object passed to this method...
[truncated message content] |
|
From: <ls...@us...> - 2007-07-06 11:09:18
|
Revision: 3352
http://jnode.svn.sourceforge.net/jnode/?rev=3352&view=rev
Author: lsantha
Date: 2007-07-06 04:09:17 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/io/File.java
Added: trunk/core/src/openjdk/java/java/io/File.java
===================================================================
--- trunk/core/src/openjdk/java/java/io/File.java (rev 0)
+++ trunk/core/src/openjdk/java/java/io/File.java 2007-07-06 11:09:17 UTC (rev 3352)
@@ -0,0 +1,1967 @@
+/*
+ * Copyright 1994-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.io;
+
+import java.net.URI;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Hashtable;
+import java.util.Random;
+import java.security.AccessController;
+import java.security.AccessControlException;
+import sun.security.action.GetPropertyAction;
+
+
+/**
+ * An abstract representation of file and directory pathnames.
+ *
+ * <p> User interfaces and operating systems use system-dependent <em>pathname
+ * strings</em> to name files and directories. This class presents an
+ * abstract, system-independent view of hierarchical pathnames. An
+ * <em>abstract pathname</em> has two components:
+ *
+ * <ol>
+ * <li> An optional system-dependent <em>prefix</em> string,
+ * such as a disk-drive specifier, <code>"/"</code> for the UNIX root
+ * directory, or <code>"\\\\"</code> for a Microsoft Windows UNC pathname, and
+ * <li> A sequence of zero or more string <em>names</em>.
+ * </ol>
+ *
+ * The first name in an abstract pathname may be a directory name or, in the
+ * case of Microsoft Windows UNC pathnames, a hostname. Each subsequent name
+ * in an abstract pathname denotes a directory; the last name may denote
+ * either a directory or a file. The <em>empty</em> abstract pathname has no
+ * prefix and an empty name sequence.
+ *
+ * <p> The conversion of a pathname string to or from an abstract pathname is
+ * inherently system-dependent. When an abstract pathname is converted into a
+ * pathname string, each name is separated from the next by a single copy of
+ * the default <em>separator character</em>. The default name-separator
+ * character is defined by the system property <code>file.separator</code>, and
+ * is made available in the public static fields <code>{@link
+ * #separator}</code> and <code>{@link #separatorChar}</code> of this class.
+ * When a pathname string is converted into an abstract pathname, the names
+ * within it may be separated by the default name-separator character or by any
+ * other name-separator character that is supported by the underlying system.
+ *
+ * <p> A pathname, whether abstract or in string form, may be either
+ * <em>absolute</em> or <em>relative</em>. An absolute pathname is complete in
+ * that no other information is required in order to locate the file that it
+ * denotes. A relative pathname, in contrast, must be interpreted in terms of
+ * information taken from some other pathname. By default the classes in the
+ * <code>java.io</code> package always resolve relative pathnames against the
+ * current user directory. This directory is named by the system property
+ * <code>user.dir</code>, and is typically the directory in which the Java
+ * virtual machine was invoked.
+ *
+ * <p> The <em>parent</em> of an abstract pathname may be obtained by invoking
+ * the {@link #getParent} method of this class and consists of the pathname's
+ * prefix and each name in the pathname's name sequence except for the last.
+ * Each directory's absolute pathname is an ancestor of any <tt>File</tt>
+ * object with an absolute abstract pathname which begins with the directory's
+ * absolute pathname. For example, the directory denoted by the abstract
+ * pathname <tt>"/usr"</tt> is an ancestor of the directory denoted by the
+ * pathname <tt>"/usr/local/bin"</tt>.
+ *
+ * <p> The prefix concept is used to handle root directories on UNIX platforms,
+ * and drive specifiers, root directories and UNC pathnames on Microsoft Windows platforms,
+ * as follows:
+ *
+ * <ul>
+ *
+ * <li> For UNIX platforms, the prefix of an absolute pathname is always
+ * <code>"/"</code>. Relative pathnames have no prefix. The abstract pathname
+ * denoting the root directory has the prefix <code>"/"</code> and an empty
+ * name sequence.
+ *
+ * <li> For Microsoft Windows platforms, the prefix of a pathname that contains a drive
+ * specifier consists of the drive letter followed by <code>":"</code> and
+ * possibly followed by <code>"\\"</code> if the pathname is absolute. The
+ * prefix of a UNC pathname is <code>"\\\\"</code>; the hostname and the share
+ * name are the first two names in the name sequence. A relative pathname that
+ * does not specify a drive has no prefix.
+ *
+ * </ul>
+ *
+ * <p> Instances of this class may or may not denote an actual file-system
+ * object such as a file or a directory. If it does denote such an object
+ * then that object resides in a <i>partition</i>. A partition is an
+ * operating system-specific portion of storage for a file system. A single
+ * storage device (e.g. a physical disk-drive, flash memory, CD-ROM) may
+ * contain multiple partitions. The object, if any, will reside on the
+ * partition <a name="partName">named</a> by some ancestor of the absolute
+ * form of this pathname.
+ *
+ * <p> A file system may implement restrictions to certain operations on the
+ * actual file-system object, such as reading, writing, and executing. These
+ * restrictions are collectively known as <i>access permissions</i>. The file
+ * system may have multiple sets of access permissions on a single object.
+ * For example, one set may apply to the object's <i>owner</i>, and another
+ * may apply to all other users. The access permissions on an object may
+ * cause some methods in this class to fail.
+ *
+ * <p> Instances of the <code>File</code> class are immutable; that is, once
+ * created, the abstract pathname represented by a <code>File</code> object
+ * will never change.
+ *
+ * @version 1.147, 05/05/07
+ * @author unascribed
+ * @since JDK1.0
+ */
+
+public class File
+ implements Serializable, Comparable<File>
+{
+
+ /**
+ * The FileSystem object representing the platform's local file system.
+ */
+ static private FileSystem fs = FileSystem.getFileSystem();
+
+ /**
+ * This abstract pathname's normalized pathname string. A normalized
+ * pathname string uses the default name-separator character and does not
+ * contain any duplicate or redundant separators.
+ *
+ * @serial
+ */
+ private String path;
+
+ /**
+ * The length of this abstract pathname's prefix, or zero if it has no
+ * prefix.
+ */
+ private transient int prefixLength;
+
+ /**
+ * Returns the length of this abstract pathname's prefix.
+ * For use by FileSystem classes.
+ */
+ int getPrefixLength() {
+ return prefixLength;
+ }
+
+ /**
+ * The system-dependent default name-separator character. This field is
+ * initialized to contain the first character of the value of the system
+ * property <code>file.separator</code>. On UNIX systems the value of this
+ * field is <code>'/'</code>; on Microsoft Windows systems it is <code>'\\'</code>.
+ *
+ * @see java.lang.System#getProperty(java.lang.String)
+ */
+ public static final char separatorChar = fs.getSeparator();
+
+ /**
+ * The system-dependent default name-separator character, represented as a
+ * string for convenience. This string contains a single character, namely
+ * <code>{@link #separatorChar}</code>.
+ */
+ public static final String separator = "" + separatorChar;
+
+ /**
+ * The system-dependent path-separator character. This field is
+ * initialized to contain the first character of the value of the system
+ * property <code>path.separator</code>. This character is used to
+ * separate filenames in a sequence of files given as a <em>path list</em>.
+ * On UNIX systems, this character is <code>':'</code>; on Microsoft Windows systems it
+ * is <code>';'</code>.
+ *
+ * @see java.lang.System#getProperty(java.lang.String)
+ */
+ public static final char pathSeparatorChar = fs.getPathSeparator();
+
+ /**
+ * The system-dependent path-separator character, represented as a string
+ * for convenience. This string contains a single character, namely
+ * <code>{@link #pathSeparatorChar}</code>.
+ */
+ public static final String pathSeparator = "" + pathSeparatorChar;
+
+
+ /* -- Constructors -- */
+
+ /**
+ * Internal constructor for already-normalized pathname strings.
+ */
+ private File(String pathname, int prefixLength) {
+ this.path = pathname;
+ this.prefixLength = prefixLength;
+ }
+
+ /**
+ * Internal constructor for already-normalized pathname strings.
+ * The parameter order is used to disambiguate this method from the
+ * public(File, String) constructor.
+ */
+ private File(String child, File parent) {
+ assert parent.path != null;
+ assert (!parent.path.equals(""));
+ this.path = fs.resolve(parent.path, child);
+ this.prefixLength = parent.prefixLength;
+ }
+
+ /**
+ * Creates a new <code>File</code> instance by converting the given
+ * pathname string into an abstract pathname. If the given string is
+ * the empty string, then the result is the empty abstract pathname.
+ *
+ * @param pathname A pathname string
+ * @throws NullPointerException
+ * If the <code>pathname</code> argument is <code>null</code>
+ */
+ public File(String pathname) {
+ if (pathname == null) {
+ throw new NullPointerException();
+ }
+ this.path = fs.normalize(pathname);
+ this.prefixLength = fs.prefixLength(this.path);
+ }
+
+ /* Note: The two-argument File constructors do not interpret an empty
+ parent abstract pathname as the current user directory. An empty parent
+ instead causes the child to be resolved against the system-dependent
+ directory defined by the FileSystem.getDefaultParent method. On Unix
+ this default is "/", while on Microsoft Windows it is "\\". This is required for
+ compatibility with the original behavior of this class. */
+
+ /**
+ * Creates a new <code>File</code> instance from a parent pathname string
+ * and a child pathname string.
+ *
+ * <p> If <code>parent</code> is <code>null</code> then the new
+ * <code>File</code> instance is created as if by invoking the
+ * single-argument <code>File</code> constructor on the given
+ * <code>child</code> pathname string.
+ *
+ * <p> Otherwise the <code>parent</code> pathname string is taken to denote
+ * a directory, and the <code>child</code> pathname string is taken to
+ * denote either a directory or a file. If the <code>child</code> pathname
+ * string is absolute then it is converted into a relative pathname in a
+ * system-dependent way. If <code>parent</code> is the empty string then
+ * the new <code>File</code> instance is created by converting
+ * <code>child</code> into an abstract pathname and resolving the result
+ * against a system-dependent default directory. Otherwise each pathname
+ * string is converted into an abstract pathname and the child abstract
+ * pathname is resolved against the parent.
+ *
+ * @param parent The parent pathname string
+ * @param child The child pathname string
+ * @throws NullPointerException
+ * If <code>child</code> is <code>null</code>
+ */
+ public File(String parent, String child) {
+ if (child == null) {
+ throw new NullPointerException();
+ }
+ if (parent != null) {
+ if (parent.equals("")) {
+ this.path = fs.resolve(fs.getDefaultParent(),
+ fs.normalize(child));
+ } else {
+ this.path = fs.resolve(fs.normalize(parent),
+ fs.normalize(child));
+ }
+ } else {
+ this.path = fs.normalize(child);
+ }
+ this.prefixLength = fs.prefixLength(this.path);
+ }
+
+ /**
+ * Creates a new <code>File</code> instance from a parent abstract
+ * pathname and a child pathname string.
+ *
+ * <p> If <code>parent</code> is <code>null</code> then the new
+ * <code>File</code> instance is created as if by invoking the
+ * single-argument <code>File</code> constructor on the given
+ * <code>child</code> pathname string.
+ *
+ * <p> Otherwise the <code>parent</code> abstract pathname is taken to
+ * denote a directory, and the <code>child</code> pathname string is taken
+ * to denote either a directory or a file. If the <code>child</code>
+ * pathname string is absolute then it is converted into a relative
+ * pathname in a system-dependent way. If <code>parent</code> is the empty
+ * abstract pathname then the new <code>File</code> instance is created by
+ * converting <code>child</code> into an abstract pathname and resolving
+ * the result against a system-dependent default directory. Otherwise each
+ * pathname string is converted into an abstract pathname and the child
+ * abstract pathname is resolved against the parent.
+ *
+ * @param parent The parent abstract pathname
+ * @param child The child pathname string
+ * @throws NullPointerException
+ * If <code>child</code> is <code>null</code>
+ */
+ public File(File parent, String child) {
+ if (child == null) {
+ throw new NullPointerException();
+ }
+ if (parent != null) {
+ if (parent.path.equals("")) {
+ this.path = fs.resolve(fs.getDefaultParent(),
+ fs.normalize(child));
+ } else {
+ this.path = fs.resolve(parent.path,
+ fs.normalize(child));
+ }
+ } else {
+ this.path = fs.normalize(child);
+ }
+ this.prefixLength = fs.prefixLength(this.path);
+ }
+
+ /**
+ * Creates a new <tt>File</tt> instance by converting the given
+ * <tt>file:</tt> URI into an abstract pathname.
+ *
+ * <p> The exact form of a <tt>file:</tt> URI is system-dependent, hence
+ * the transformation performed by this constructor is also
+ * system-dependent.
+ *
+ * <p> For a given abstract pathname <i>f</i> it is guaranteed that
+ *
+ * <blockquote><tt>
+ * new File(</tt><i> f</i><tt>.{@link #toURI() toURI}()).equals(</tt><i> f</i><tt>.{@link #getAbsoluteFile() getAbsoluteFile}())
+ * </tt></blockquote>
+ *
+ * so long as the original abstract pathname, the URI, and the new abstract
+ * pathname are all created in (possibly different invocations of) the same
+ * Java virtual machine. This relationship typically does not hold,
+ * however, when a <tt>file:</tt> URI that is created in a virtual machine
+ * on one operating system is converted into an abstract pathname in a
+ * virtual machine on a different operating system.
+ *
+ * @param uri
+ * An absolute, hierarchical URI with a scheme equal to
+ * <tt>"file"</tt>, a non-empty path component, and undefined
+ * authority, query, and fragment components
+ *
+ * @throws NullPointerException
+ * If <tt>uri</tt> is <tt>null</tt>
+ *
+ * @throws IllegalArgumentException
+ * If the preconditions on the parameter do not hold
+ *
+ * @see #toURI()
+ * @see java.net.URI
+ * @since 1.4
+ */
+ public File(URI uri) {
+
+ // Check our many preconditions
+ if (!uri.isAbsolute())
+ throw new IllegalArgumentException("URI is not absolute");
+ if (uri.isOpaque())
+ throw new IllegalArgumentException("URI is not hierarchical");
+ String scheme = uri.getScheme();
+ if ((scheme == null) || !scheme.equalsIgnoreCase("file"))
+ throw new IllegalArgumentException("URI scheme is not \"file\"");
+ if (uri.getAuthority() != null)
+ throw new IllegalArgumentException("URI has an authority component");
+ if (uri.getFragment() != null)
+ throw new IllegalArgumentException("URI has a fragment component");
+ if (uri.getQuery() != null)
+ throw new IllegalArgumentException("URI has a query component");
+ String p = uri.getPath();
+ if (p.equals(""))
+ throw new IllegalArgumentException("URI path component is empty");
+
+ // Okay, now initialize
+ p = fs.fromURIPath(p);
+ if (File.separatorChar != '/')
+ p = p.replace('/', File.separatorChar);
+ this.path = fs.normalize(p);
+ this.prefixLength = fs.prefixLength(this.path);
+ }
+
+
+ /* -- Path-component accessors -- */
+
+ /**
+ * Returns the name of the file or directory denoted by this abstract
+ * pathname. This is just the last name in the pathname's name
+ * sequence. If the pathname's name sequence is empty, then the empty
+ * string is returned.
+ *
+ * @return The name of the file or directory denoted by this abstract
+ * pathname, or the empty string if this pathname's name sequence
+ * is empty
+ */
+ public String getName() {
+ int index = path.lastIndexOf(separatorChar);
+ if (index < prefixLength) return path.substring(prefixLength);
+ return path.substring(index + 1);
+ }
+
+ /**
+ * Returns the pathname string of this abstract pathname's parent, or
+ * <code>null</code> if this pathname does not name a parent directory.
+ *
+ * <p> The <em>parent</em> of an abstract pathname consists of the
+ * pathname's prefix, if any, and each name in the pathname's name
+ * sequence except for the last. If the name sequence is empty then
+ * the pathname does not name a parent directory.
+ *
+ * @return The pathname string of the parent directory named by this
+ * abstract pathname, or <code>null</code> if this pathname
+ * does not name a parent
+ */
+ public String getParent() {
+ int index = path.lastIndexOf(separatorChar);
+ if (index < prefixLength) {
+ if ((prefixLength > 0) && (path.length() > prefixLength))
+ return path.substring(0, prefixLength);
+ return null;
+ }
+ return path.substring(0, index);
+ }
+
+ /**
+ * Returns the abstract pathname of this abstract pathname's parent,
+ * or <code>null</code> if this pathname does not name a parent
+ * directory.
+ *
+ * <p> The <em>parent</em> of an abstract pathname consists of the
+ * pathname's prefix, if any, and each name in the pathname's name
+ * sequence except for the last. If the name sequence is empty then
+ * the pathname does not name a parent directory.
+ *
+ * @return The abstract pathname of the parent directory named by this
+ * abstract pathname, or <code>null</code> if this pathname
+ * does not name a parent
+ *
+ * @since 1.2
+ */
+ public File getParentFile() {
+ String p = this.getParent();
+ if (p == null) return null;
+ return new File(p, this.prefixLength);
+ }
+
+ /**
+ * Converts this abstract pathname into a pathname string. The resulting
+ * string uses the {@link #separator default name-separator character} to
+ * separate the names in the name sequence.
+ *
+ * @return The string form of this abstract pathname
+ */
+ public String getPath() {
+ return path;
+ }
+
+
+ /* -- Path operations -- */
+
+ /**
+ * Tests whether this abstract pathname is absolute. The definition of
+ * absolute pathname is system dependent. On UNIX systems, a pathname is
+ * absolute if its prefix is <code>"/"</code>. On Microsoft Windows systems, a
+ * pathname is absolute if its prefix is a drive specifier followed by
+ * <code>"\\"</code>, or if its prefix is <code>"\\\\"</code>.
+ *
+ * @return <code>true</code> if this abstract pathname is absolute,
+ * <code>false</code> otherwise
+ */
+ public boolean isAbsolute() {
+ return fs.isAbsolute(this);
+ }
+
+ /**
+ * Returns the absolute pathname string of this abstract pathname.
+ *
+ * <p> If this abstract pathname is already absolute, then the pathname
+ * string is simply returned as if by the <code>{@link #getPath}</code>
+ * method. If this abstract pathname is the empty abstract pathname then
+ * the pathname string of the current user directory, which is named by the
+ * system property <code>user.dir</code>, is returned. Otherwise this
+ * pathname is resolved in a system-dependent way. On UNIX systems, a
+ * relative pathname is made absolute by resolving it against the current
+ * user directory. On Microsoft Windows systems, a relative pathname is made absolute
+ * by resolving it against the current directory of the drive named by the
+ * pathname, if any; if not, it is resolved against the current user
+ * directory.
+ *
+ * @return The absolute pathname string denoting the same file or
+ * directory as this abstract pathname
+ *
+ * @throws SecurityException
+ * If a required system property value cannot be accessed.
+ *
+ * @see java.io.File#isAbsolute()
+ */
+ public String getAbsolutePath() {
+ return fs.resolve(this);
+ }
+
+ /**
+ * Returns the absolute form of this abstract pathname. Equivalent to
+ * <code>new File(this.{@link #getAbsolutePath})</code>.
+ *
+ * @return The absolute abstract pathname denoting the same file or
+ * directory as this abstract pathname
+ *
+ * @throws SecurityException
+ * If a required system property value cannot be accessed.
+ *
+ * @since 1.2
+ */
+ public File getAbsoluteFile() {
+ String absPath = getAbsolutePath();
+ return new File(absPath, fs.prefixLength(absPath));
+ }
+
+ /**
+ * Returns the canonical pathname string of this abstract pathname.
+ *
+ * <p> A canonical pathname is both absolute and unique. The precise
+ * definition of canonical form is system-dependent. This method first
+ * converts this pathname to absolute form if necessary, as if by invoking the
+ * {@link #getAbsolutePath} method, and then maps it to its unique form in a
+ * system-dependent way. This typically involves removing redundant names
+ * such as <tt>"."</tt> and <tt>".."</tt> from the pathname, resolving
+ * symbolic links (on UNIX platforms), and converting drive letters to a
+ * standard case (on Microsoft Windows platforms).
+ *
+ * <p> Every pathname that denotes an existing file or directory has a
+ * unique canonical form. Every pathname that denotes a nonexistent file
+ * or directory also has a unique canonical form. The canonical form of
+ * the pathname of a nonexistent file or directory may be different from
+ * the canonical form of the same pathname after the file or directory is
+ * created. Similarly, the canonical form of the pathname of an existing
+ * file or directory may be different from the canonical form of the same
+ * pathname after the file or directory is deleted.
+ *
+ * @return The canonical pathname string denoting the same file or
+ * directory as this abstract pathname
+ *
+ * @throws IOException
+ * If an I/O error occurs, which is possible because the
+ * construction of the canonical pathname may require
+ * filesystem queries
+ *
+ * @throws SecurityException
+ * If a required system property value cannot be accessed, or
+ * if a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead}</code> method denies
+ * read access to the file
+ *
+ * @since JDK1.1
+ */
+ public String getCanonicalPath() throws IOException {
+ return fs.canonicalize(fs.resolve(this));
+ }
+
+ /**
+ * Returns the canonical form of this abstract pathname. Equivalent to
+ * <code>new File(this.{@link #getCanonicalPath})</code>.
+ *
+ * @return The canonical pathname string denoting the same file or
+ * directory as this abstract pathname
+ *
+ * @throws IOException
+ * If an I/O error occurs, which is possible because the
+ * construction of the canonical pathname may require
+ * filesystem queries
+ *
+ * @throws SecurityException
+ * If a required system property value cannot be accessed, or
+ * if a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead}</code> method denies
+ * read access to the file
+ *
+ * @since 1.2
+ */
+ public File getCanonicalFile() throws IOException {
+ String canonPath = getCanonicalPath();
+ return new File(canonPath, fs.prefixLength(canonPath));
+ }
+
+ private static String slashify(String path, boolean isDirectory) {
+ String p = path;
+ if (File.separatorChar != '/')
+ p = p.replace(File.separatorChar, '/');
+ if (!p.startsWith("/"))
+ p = "/" + p;
+ if (!p.endsWith("/") && isDirectory)
+ p = p + "/";
+ return p;
+ }
+
+ /**
+ * Converts this abstract pathname into a <code>file:</code> URL. The
+ * exact form of the URL is system-dependent. If it can be determined that
+ * the file denoted by this abstract pathname is a directory, then the
+ * resulting URL will end with a slash.
+ *
+ * @return A URL object representing the equivalent file URL
+ *
+ * @throws MalformedURLException
+ * If the path cannot be parsed as a URL
+ *
+ * @see #toURI()
+ * @see java.net.URI
+ * @see java.net.URI#toURL()
+ * @see java.net.URL
+ * @since 1.2
+ *
+ * @deprecated This method does not automatically escape characters that
+ * are illegal in URLs. It is recommended that new code convert an
+ * abstract pathname into a URL by first converting it into a URI, via the
+ * {@link #toURI() toURI} method, and then converting the URI into a URL
+ * via the {@link java.net.URI#toURL() URI.toURL} method.
+ */
+ @Deprecated
+ public URL toURL() throws MalformedURLException {
+ return new URL("file", "", slashify(getAbsolutePath(), isDirectory()));
+ }
+
+ /**
+ * Constructs a <tt>file:</tt> URI that represents this abstract pathname.
+ *
+ * <p> The exact form of the URI is system-dependent. If it can be
+ * determined that the file denoted by this abstract pathname is a
+ * directory, then the resulting URI will end with a slash.
+ *
+ * <p> For a given abstract pathname <i>f</i>, it is guaranteed that
+ *
+ * <blockquote><tt>
+ * new {@link #File(java.net.URI) File}(</tt><i> f</i><tt>.toURI()).equals(</tt><i> f</i><tt>.{@link #getAbsoluteFile() getAbsoluteFile}())
+ * </tt></blockquote>
+ *
+ * so long as the original abstract pathname, the URI, and the new abstract
+ * pathname are all created in (possibly different invocations of) the same
+ * Java virtual machine. Due to the system-dependent nature of abstract
+ * pathnames, however, this relationship typically does not hold when a
+ * <tt>file:</tt> URI that is created in a virtual machine on one operating
+ * system is converted into an abstract pathname in a virtual machine on a
+ * different operating system.
+ *
+ * @return An absolute, hierarchical URI with a scheme equal to
+ * <tt>"file"</tt>, a path representing this abstract pathname,
+ * and undefined authority, query, and fragment components
+ * @throws SecurityException If a required system property value cannot
+ * be accessed.
+ *
+ * @see #File(java.net.URI)
+ * @see java.net.URI
+ * @see java.net.URI#toURL()
+ * @since 1.4
+ */
+ public URI toURI() {
+ try {
+ File f = getAbsoluteFile();
+ String sp = slashify(f.getPath(), f.isDirectory());
+ if (sp.startsWith("//"))
+ sp = "//" + sp;
+ return new URI("file", null, sp, null);
+ } catch (URISyntaxException x) {
+ throw new Error(x); // Can't happen
+ }
+ }
+
+
+ /* -- Attribute accessors -- */
+
+ /**
+ * Tests whether the application can read the file denoted by this
+ * abstract pathname.
+ *
+ * @return <code>true</code> if and only if the file specified by this
+ * abstract pathname exists <em>and</em> can be read by the
+ * application; <code>false</code> otherwise
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * method denies read access to the file
+ */
+ public boolean canRead() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkRead(path);
+ }
+ return fs.checkAccess(this, FileSystem.ACCESS_READ);
+ }
+
+ /**
+ * Tests whether the application can modify the file denoted by this
+ * abstract pathname.
+ *
+ * @return <code>true</code> if and only if the file system actually
+ * contains a file denoted by this abstract pathname <em>and</em>
+ * the application is allowed to write to the file;
+ * <code>false</code> otherwise.
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * method denies write access to the file
+ */
+ public boolean canWrite() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkWrite(path);
+ }
+ return fs.checkAccess(this, FileSystem.ACCESS_WRITE);
+ }
+
+ /**
+ * Tests whether the file or directory denoted by this abstract pathname
+ * exists.
+ *
+ * @return <code>true</code> if and only if the file or directory denoted
+ * by this abstract pathname exists; <code>false</code> otherwise
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * method denies read access to the file or directory
+ */
+ public boolean exists() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkRead(path);
+ }
+ return ((fs.getBooleanAttributes(this) & FileSystem.BA_EXISTS) != 0);
+ }
+
+ /**
+ * Tests whether the file denoted by this abstract pathname is a
+ * directory.
+ *
+ * @return <code>true</code> if and only if the file denoted by this
+ * abstract pathname exists <em>and</em> is a directory;
+ * <code>false</code> otherwise
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * method denies read access to the file
+ */
+ public boolean isDirectory() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkRead(path);
+ }
+ return ((fs.getBooleanAttributes(this) & FileSystem.BA_DIRECTORY)
+ != 0);
+ }
+
+ /**
+ * Tests whether the file denoted by this abstract pathname is a normal
+ * file. A file is <em>normal</em> if it is not a directory and, in
+ * addition, satisfies other system-dependent criteria. Any non-directory
+ * file created by a Java application is guaranteed to be a normal file.
+ *
+ * @return <code>true</code> if and only if the file denoted by this
+ * abstract pathname exists <em>and</em> is a normal file;
+ * <code>false</code> otherwise
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * method denies read access to the file
+ */
+ public boolean isFile() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkRead(path);
+ }
+ return ((fs.getBooleanAttributes(this) & FileSystem.BA_REGULAR) != 0);
+ }
+
+ /**
+ * Tests whether the file named by this abstract pathname is a hidden
+ * file. The exact definition of <em>hidden</em> is system-dependent. On
+ * UNIX systems, a file is considered to be hidden if its name begins with
+ * a period character (<code>'.'</code>). On Microsoft Windows systems, a file is
+ * considered to be hidden if it has been marked as such in the filesystem.
+ *
+ * @return <code>true</code> if and only if the file denoted by this
+ * abstract pathname is hidden according to the conventions of the
+ * underlying platform
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * method denies read access to the file
+ *
+ * @since 1.2
+ */
+ public boolean isHidden() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkRead(path);
+ }
+ return ((fs.getBooleanAttributes(this) & FileSystem.BA_HIDDEN) != 0);
+ }
+
+ /**
+ * Returns the time that the file denoted by this abstract pathname was
+ * last modified.
+ *
+ * @return A <code>long</code> value representing the time the file was
+ * last modified, measured in milliseconds since the epoch
+ * (00:00:00 GMT, January 1, 1970), or <code>0L</code> if the
+ * file does not exist or if an I/O error occurs
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * method denies read access to the file
+ */
+ public long lastModified() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkRead(path);
+ }
+ return fs.getLastModifiedTime(this);
+ }
+
+ /**
+ * Returns the length of the file denoted by this abstract pathname.
+ * The return value is unspecified if this pathname denotes a directory.
+ *
+ * @return The length, in bytes, of the file denoted by this abstract
+ * pathname, or <code>0L</code> if the file does not exist. Some
+ * operating systems may return <code>0L</code> for pathnames
+ * denoting system-dependent entities such as devices or pipes.
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * method denies read access to the file
+ */
+ public long length() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkRead(path);
+ }
+ return fs.getLength(this);
+ }
+
+
+ /* -- File operations -- */
+
+ /**
+ * Atomically creates a new, empty file named by this abstract pathname if
+ * and only if a file with this name does not yet exist. The check for the
+ * existence of the file and the creation of the file if it does not exist
+ * are a single operation that is atomic with respect to all other
+ * filesystem activities that might affect the file.
+ * <P>
+ * Note: this method should <i>not</i> be used for file-locking, as
+ * the resulting protocol cannot be made to work reliably. The
+ * {@link java.nio.channels.FileLock FileLock}
+ * facility should be used instead.
+ *
+ * @return <code>true</code> if the named file does not exist and was
+ * successfully created; <code>false</code> if the named file
+ * already exists
+ *
+ * @throws IOException
+ * If an I/O error occurred
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * method denies write access to the file
+ *
+ * @since 1.2
+ */
+ public boolean createNewFile() throws IOException {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) security.checkWrite(path);
+ return fs.createFileExclusively(path);
+ }
+
+ /**
+ * Deletes the file or directory denoted by this abstract pathname. If
+ * this pathname denotes a directory, then the directory must be empty in
+ * order to be deleted.
+ *
+ * @return <code>true</code> if and only if the file or directory is
+ * successfully deleted; <code>false</code> otherwise
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkDelete}</code> method denies
+ * delete access to the file
+ */
+ public boolean delete() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkDelete(path);
+ }
+ return fs.delete(this);
+ }
+
+ /**
+ * Requests that the file or directory denoted by this abstract
+ * pathname be deleted when the virtual machine terminates.
+ * Files (or directories) are deleted in the reverse order that
+ * they are registered. Invoking this method to delete a file or
+ * directory that is already registered for deletion has no effect.
+ * Deletion will be attempted only for normal termination of the
+ * virtual machine, as defined by the Java Language Specification.
+ *
+ * <p> Once deletion has been requested, it is not possible to cancel the
+ * request. This method should therefore be used with care.
+ *
+ * <P>
+ * Note: this method should <i>not</i> be used for file-locking, as
+ * the resulting protocol cannot be made to work reliably. The
+ * {@link java.nio.channels.FileLock FileLock}
+ * facility should be used instead.
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkDelete}</code> method denies
+ * delete access to the file
+ *
+ * @see #delete
+ *
+ * @since 1.2
+ */
+ public void deleteOnExit() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkDelete(path);
+ }
+ DeleteOnExitHook.add(path);
+ }
+
+ /**
+ * Returns an array of strings naming the files and directories in the
+ * directory denoted by this abstract pathname.
+ *
+ * <p> If this abstract pathname does not denote a directory, then this
+ * method returns {@code null}. Otherwise an array of strings is
+ * returned, one for each file or directory in the directory. Names
+ * denoting the directory itself and the directory's parent directory are
+ * not included in the result. Each string is a file name rather than a
+ * complete path.
+ *
+ * <p> There is no guarantee that the name strings in the resulting array
+ * will appear in any specific order; they are not, in particular,
+ * guaranteed to appear in alphabetical order.
+ *
+ * @return An array of strings naming the files and directories in the
+ * directory denoted by this abstract pathname. The array will be
+ * empty if the directory is empty. Returns {@code null} if
+ * this abstract pathname does not denote a directory, or if an
+ * I/O error occurs.
+ *
+ * @throws SecurityException
+ * If a security manager exists and its {@link
+ * SecurityManager#checkRead(String)} method denies read access to
+ * the directory
+ */
+ public String[] list() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkRead(path);
+ }
+ return fs.list(this);
+ }
+
+ /**
+ * Returns an array of strings naming the files and directories in the
+ * directory denoted by this abstract pathname that satisfy the specified
+ * filter. The behavior of this method is the same as that of the
+ * {@link #list()} method, except that the strings in the returned array
+ * must satisfy the filter. If the given {@code filter} is {@code null}
+ * then all names are accepted. Otherwise, a name satisfies the filter if
+ * and only if the value {@code true} results when the {@link
+ * FilenameFilter#accept FilenameFilter.accept(File, String)} method
+ * of the filter is invoked on this abstract pathname and the name of a
+ * file or directory in the directory that it denotes.
+ *
+ * @param filter
+ * A filename filter
+ *
+ * @return An array of strings naming the files and directories in the
+ * directory denoted by this abstract pathname that were accepted
+ * by the given {@code filter}. The array will be empty if the
+ * directory is empty or if no names were accepted by the filter.
+ * Returns {@code null} if this abstract pathname does not denote
+ * a directory, or if an I/O error occurs.
+ *
+ * @throws SecurityException
+ * If a security manager exists and its {@link
+ * SecurityManager#checkRead(String)} method denies read access to
+ * the directory
+ */
+ public String[] list(FilenameFilter filter) {
+ String names[] = list();
+ if ((names == null) || (filter == null)) {
+ return names;
+ }
+ ArrayList v = new ArrayList();
+ for (int i = 0 ; i < names.length ; i++) {
+ if (filter.accept(this, names[i])) {
+ v.add(names[i]);
+ }
+ }
+ return (String[])(v.toArray(new String[v.size()]));
+ }
+
+ /**
+ * Returns an array of abstract pathnames denoting the files in the
+ * directory denoted by this abstract pathname.
+ *
+ * <p> If this abstract pathname does not denote a directory, then this
+ * method returns {@code null}. Otherwise an array of {@code File} objects
+ * is returned, one for each file or directory in the directory. Pathnames
+ * denoting the directory itself and the directory's parent directory are
+ * not included in the result. Each resulting abstract pathname is
+ * constructed from this abstract pathname using the {@link #File(File,
+ * String) File(File, String)} constructor. Therefore if this
+ * pathname is absolute then each resulting pathname is absolute; if this
+ * pathname is relative then each resulting pathname will be relative to
+ * the same directory.
+ *
+ * <p> There is no guarantee that the name strings in the resulting array
+ * will appear in any specific order; they are not, in particular,
+ * guaranteed to appear in alphabetical order.
+ *
+ * @return An array of abstract pathnames denoting the files and
+ * directories in the directory denoted by this abstract pathname.
+ * The array will be empty if the directory is empty. Returns
+ * {@code null} if this abstract pathname does not denote a
+ * directory, or if an I/O error occurs.
+ *
+ * @throws SecurityException
+ * If a security manager exists and its {@link
+ * SecurityManager#checkRead(String)} method denies read access to
+ * the directory
+ *
+ * @since 1.2
+ */
+ public File[] listFiles() {
+ String[] ss = list();
+ if (ss == null) return null;
+ int n = ss.length;
+ File[] fs = new File[n];
+ for (int i = 0; i < n; i++) {
+ fs[i] = new File(ss[i], this);
+ }
+ return fs;
+ }
+
+ /**
+ * Returns an array of abstract pathnames denoting the files and
+ * directories in the directory denoted by this abstract pathname that
+ * satisfy the specified filter. The behavior of this method is the same
+ * as that of the {@link #listFiles()} method, except that the pathnames in
+ * the returned array must satisfy the filter. If the given {@code filter}
+ * is {@code null} then all pathnames are accepted. Otherwise, a pathname
+ * satisfies the filter if and only if the value {@code true} results when
+ * the {@link FilenameFilter#accept
+ * FilenameFilter.accept(File, String)} method of the filter is
+ * invoked on this abstract pathname and the name of a file or directory in
+ * the directory that it denotes.
+ *
+ * @param filter
+ * A filename filter
+ *
+ * @return An array of abstract pathnames denoting the files and
+ * directories in the directory denoted by this abstract pathname.
+ * The array will be empty if the directory is empty. Returns
+ * {@code null} if this abstract pathname does not denote a
+ * directory, or if an I/O error occurs.
+ *
+ * @throws SecurityException
+ * If a security manager exists and its {@link
+ * SecurityManager#checkRead(String)} method denies read access to
+ * the directory
+ *
+ * @since 1.2
+ */
+ public File[] listFiles(FilenameFilter filter) {
+ String ss[] = list();
+ if (ss == null) return null;
+ ArrayList<File> files = new ArrayList<File>();
+ for (String s : ss)
+ if ((filter == null) || filter.accept(this, s))
+ files.add(new File(s, this));
+ return files.toArray(new File[files.size()]);
+ }
+
+ /**
+ * Returns an array of abstract pathnames denoting the files and
+ * directories in the directory denoted by this abstract pathname that
+ * satisfy the specified filter. The behavior of this method is the same
+ * as that of the {@link #listFiles()} method, except that the pathnames in
+ * the returned array must satisfy the filter. If the given {@code filter}
+ * is {@code null} then all pathnames are accepted. Otherwise, a pathname
+ * satisfies the filter if and only if the value {@code true} results when
+ * the {@link FileFilter#accept FileFilter.accept(File)} method of the
+ * filter is invoked on the pathname.
+ *
+ * @param filter
+ * A file filter
+ *
+ * @return An array of abstract pathnames denoting the files and
+ * directories in the directory denoted by this abstract pathname.
+ * The array will be empty if the directory is empty. Returns
+ * {@code null} if this abstract pathname does not denote a
+ * directory, or if an I/O error occurs.
+ *
+ * @throws SecurityException
+ * If a security manager exists and its {@link
+ * SecurityManager#checkRead(String)} method denies read access to
+ * the directory
+ *
+ * @since 1.2
+ */
+ public File[] listFiles(FileFilter filter) {
+ String ss[] = list();
+ if (ss == null) return null;
+ ArrayList<File> files = new ArrayList<File>();
+ for (String s : ss) {
+ File f = new File(s, this);
+ if ((filter == null) || filter.accept(f))
+ files.add(f);
+ }
+ return files.toArray(new File[files.size()]);
+ }
+
+ /**
+ * Creates the directory named by this abstract pathname.
+ *
+ * @return <code>true</code> if and only if the directory was
+ * created; <code>false</code> otherwise
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * method does not permit the named directory to be created
+ */
+ public boolean mkdir() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkWrite(path);
+ }
+ return fs.createDirectory(this);
+ }
+
+ /**
+ * Creates the directory named by this abstract pathname, including any
+ * necessary but nonexistent parent directories. Note that if this
+ * operation fails it may have succeeded in creating some of the necessary
+ * parent directories.
+ *
+ * @return <code>true</code> if and only if the directory was created,
+ * along with all necessary parent directories; <code>false</code>
+ * otherwise
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * method does not permit verification of the existence of the
+ * named directory and all necessary parent directories; or if
+ * the <code>{@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * method does not permit the named directory and all necessary
+ * parent directories to be created
+ */
+ public boolean mkdirs() {
+ if (exists()) {
+ return false;
+ }
+ if (mkdir()) {
+ return true;
+ }
+ File canonFile = null;
+ try {
+ canonFile = getCanonicalFile();
+ } catch (IOException e) {
+ return false;
+ }
+
+ File parent = canonFile.getParentFile();
+ return (parent != null && (parent.mkdirs() || parent.exists()) &&
+ canonFile.mkdir());
+ }
+
+ /**
+ * Renames the file denoted by this abstract pathname.
+ *
+ * <p> Many aspects of the behavior of this method are inherently
+ * platform-dependent: The rename operation might not be able to move a
+ * file from one filesystem to another, it might not be atomic, and it
+ * might not succeed if a file with the destination abstract pathname
+ * already exists. The return value should always be checked to make sure
+ * that the rename operation was successful.
+ *
+ * @param dest The new abstract pathname for the named file
+ *
+ * @return <code>true</code> if and only if the renaming succeeded;
+ * <code>false</code> otherwise
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * method denies write access to either the old or new pathnames
+ *
+ * @throws NullPointerException
+ * If parameter <code>dest</code> is <code>null</code>
+ */
+ public boolean renameTo(File dest) {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkWrite(path);
+ security.checkWrite(dest.path);
+ }
+ return fs.rename(this, dest);
+ }
+
+ /**
+ * Sets the last-modified time of the file or directory named by this
+ * abstract pathname.
+ *
+ * <p> All platforms support file-modification times to the nearest second,
+ * but some provide more precision. The argument will be truncated to fit
+ * the supported precision. If the operation succeeds and no intervening
+ * operations on the file take place, then the next invocation of the
+ * <code>{@link #lastModified}</code> method will return the (possibly
+ * truncated) <code>time</code> argument that was passed to this method.
+ *
+ * @param time The new last-modified time, measured in milliseconds since
+ * the epoch (00:00:00 GMT, January 1, 1970)
+ *
+ * @return <code>true</code> if and only if the operation succeeded;
+ * <code>false</code> otherwise
+ *
+ * @throws IllegalArgumentException If the argument is negative
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * method denies write access to the named file
+ *
+ * @since 1.2
+ */
+ public boolean setLastModified(long time) {
+ if (time < 0) throw new IllegalArgumentException("Negative time");
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkWrite(path);
+ }
+ return fs.setLastModifiedTime(this, time);
+ }
+
+ /**
+ * Marks the file or directory named by this abstract pathname so that
+ * only read operations are allowed. After invoking this method the file
+ * or directory is guaranteed not to change until it is either deleted or
+ * marked to allow write access. Whether or not a read-only file or
+ * directory may be deleted depends upon the underlying system.
+ *
+ * @return <code>true</code> if and only if the operation succeeded;
+ * <code>false</code> otherwise
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * method denies write access to the named file
+ *
+ * @since 1.2
+ */
+ public boolean setReadOnly() {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkWrite(path);
+ }
+ return fs.setReadOnly(this);
+ }
+
+ /**
+ * Sets the owner's or everybody's write permission for this abstract
+ * pathname.
+ *
+ * @param writable
+ * If <code>true</code>, sets the access permission to allow write
+ * operations; if <code>false</code> to disallow write operations
+ *
+ * @param ownerOnly
+ * If <code>true</code>, the write permission applies only to the
+ * owner's write permission; otherwise, it applies to everybody. If
+ * the underlying file system can not distinguish the owner's write
+ * permission from that of others, then the permission will apply to
+ * everybody, regardless of this value.
+ *
+ * @return <code>true</code> if and only if the operation succeeded. The
+ * operation will fail if the user does not have permission to change
+ * the access permissions of this abstract pathname.
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * method denies write access to the named file
+ *
+ * @since 1.6
+ */
+ public boolean setWritable(boolean writable, boolean ownerOnly) {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkWrite(path);
+ }
+ return fs.setPermission(this, FileSystem.ACCESS_WRITE, writable, ownerOnly);
+ }
+
+ /**
+ * A convenience method to set the owner's write permission for this abstract
+ * pathname.
+ *
+ * <p> An invocation of this method of the form <tt>file.setWritable(arg)</tt>
+ * behaves in exactly the same way as the invocation
+ *
+ * <pre>
+ * file.setWritable(arg, true) </pre>
+ *
+ * @param writable
+ * If <code>true</code>, sets the access permission to allow write
+ * operations; if <code>false</code> to disallow write operations
+ *
+ * @return <code>true</code> if and only if the operation succeeded. The
+ * operation will fail if the user does not have permission to
+ * change the access permissions of this abstract pathname.
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * method denies write access to the file
+ *
+ * @since 1.6
+ */
+ public boolean setWritable(boolean writable) {
+ return setWritable(writable, true);
+ }
+
+ /**
+ * Sets the owner's or everybody's read permission for this abstract
+ * pathname.
+ *
+ * @param readable
+ * If <code>true</code>, sets the access permission to allow read
+ * operations; if <code>false</code> to disallow read operations
+ *
+ * @param ownerOnly
+ * If <code>true</code>, the read permission applies only to the
+ * owner's read permission; otherwise, it applies to everybody. If
+ * the underlying file system can not distinguish the owner's read
+ * permission from that of others, then the permission will apply to
+ * everybody, regardless of this value.
+ *
+ * @return <code>true</code> if and only if the operation succeeded. The
+ * operation will fail if the user does not have permission to
+ * change the access permissions of this abstract pathname. If
+ * <code>readable</code> is <code>false</code> and the underlying
+ * file system does not implement a read permission, then the
+ * operation will fail.
+ *
+ * @throws SecurityException
+ * If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * method denies write access to the file
+ *
+ * @since 1.6
+ */
+ public boolean setReadable(boolean readable, boolean ownerOnly) {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkWrite(path);
+ }
+ return fs.setPermission(this, FileSystem.ACCESS_READ, readable, ownerOnly);
+ }
+
+ /**
+ * A convenience method to set the owner's read permission for this abstract
+ * pathname.
+ *
+ * <p>An invocation of this method of the form <tt>file.setReadable(arg)</tt>
+ * behaves in exactly the same way as the invocation
+ *
+ * <pre>
+ * file.setReadable(arg, true) </pre>
+ *
+ * @param readable
+ * If <code>true</code>, sets the access permission to allow read
+ * operations; if <code>false</code> to disallow read operations
+ *
+ * @return <code>true</code> if and only if the operation succeeded. The
+ * operation will fail if the user does not have permission to
+ * change the access permissions of this abstract pathname. If
+ * <code>readable</code> is <code>false</code> and the under...
[truncated message content] |
|
From: <ls...@us...> - 2007-07-06 11:08:49
|
Revision: 3351
http://jnode.svn.sourceforge.net/jnode/?rev=3351&view=rev
Author: lsantha
Date: 2007-07-06 04:08:47 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/java/java/io/File.java
Deleted: trunk/core/src/classpath/java/java/io/File.java
===================================================================
--- trunk/core/src/classpath/java/java/io/File.java 2007-07-06 11:08:00 UTC (rev 3350)
+++ trunk/core/src/classpath/java/java/io/File.java 2007-07-06 11:08:47 UTC (rev 3351)
@@ -1,1364 +0,0 @@
-/* File.java -- Class representing a file on disk
- Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-import gnu.classpath.SystemProperties;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Complete to version 1.3.
- */
-
-/**
- * This class represents a file or directory on a local disk. It provides
- * facilities for dealing with a variety of systems that use various
- * types of path separators ("/" versus "\", for example). It also
- * contains method useful for creating and deleting files and directories.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Tom Tromey (tr...@cy...)
- */
-public class File implements Serializable, Comparable<File>
-{
- private static final long serialVersionUID = 301077366599181567L;
-
- /**
- * This is the path separator string for the current host. This field
- * contains the value of the <code>file.separator</code> system property.
- * An example separator string would be "/" on the GNU system.
- */
- public static final String separator = SystemProperties.getProperty("file.separator");
- private static final String dupSeparator = separator + separator;
-
- /**
- * This is the first character of the file separator string. On many
- * hosts (for example, on the GNU system), this represents the entire
- * separator string. The complete separator string is obtained from the
- * <code>file.separator</code>system property.
- */
- public static final char separatorChar = separator.charAt(0);
-
- /**
- * This is the string that is used to separate the host name from the
- * path name in paths than include the host name. It is the value of
- * the <code>path.separator</code> system property.
- */
- public static final String pathSeparator
- = SystemProperties.getProperty("path.separator");
-
- /**
- * This is the first character of the string used to separate the host name
- * from the path name in paths that include a host. The separator string
- * is taken from the <code>path.separator</code> system property.
- */
- public static final char pathSeparatorChar = pathSeparator.charAt(0);
-
- /**
- * This is the path to the file set when the object is created. It
- * may be an absolute or relative path name.
- */
- private String path;
-
-
- /**
- * The time (millisecond), when the last temporary file was created.
- */
- private static long last_tmp;
-
- /**
- * The number of files, created during the current millisecond.
- */
- private static int n_created;
-
- /**
- * This method tests whether or not the current thread is allowed to
- * to read the file pointed to by this object. This will be true if and
- * and only if 1) the file exists and 2) the <code>SecurityManager</code>
- * (if any) allows access to the file via it's <code>checkRead</code>
- * method 3) the file is readable.
- *
- * @return <code>true</code> if reading is allowed,
- * <code>false</code> otherwise
- *
- * @exception SecurityException If the <code>SecurityManager</code>
- * does not allow access to the file
- */
- public boolean canRead()
- {
- // Test for existence. This also does the SecurityManager check
- if (!exists())
- return false;
-
- return VMFile.canRead(path);
- }
-
- /**
- * This method test whether or not the current thread is allowed to
- * write to this object. This will be true if and only if 1) The
- * <code>SecurityManager</code> (if any) allows write access to the
- * file and 2) The file exists and 3) The file is writable. To determine
- * whether or not a non-existent file can be created, check the parent
- * directory for write access.
- *
- * @return <code>true</code> if writing is allowed, <code>false</code>
- * otherwise
- *
- * @exception SecurityException If the <code>SecurityManager</code>
- * does not allow access to the file
- */
- public boolean canWrite()
- {
- // First do a SecurityCheck before doing anything else.
- checkWrite();
-
- // Test for existence. This is required by the spec
- if (! VMFile.exists(path))
- return false;
-
- if (VMFile.isDirectory(path))
- return VMFile.canWriteDirectory(this);
- else
- return VMFile.canWrite(path);
- }
-
- /**
- * This method creates a new file of zero length with the same name as
- * the path of this <code>File</code> object if an only if that file
- * does not already exist.
- * <p>
- * A <code>SecurityManager.checkWrite</code> check is done prior
- * to performing this action.
- *
- * @return <code>true</code> if the file was created, <code>false</code> if
- * the file alread existed.
- *
- * @exception IOException If an I/O error occurs
- * @exception SecurityException If the <code>SecurityManager</code> will
- * not allow this operation to be performed.
- *
- * @since 1.2
- */
- public boolean createNewFile() throws IOException
- {
- checkWrite();
- return VMFile.create(path);
- }
- /**
- * This method deletes the file represented by this object. If this file
- * is a directory, it must be empty in order for the delete to succeed.
- *
- * @return <code>true</code> if the file was deleted, <code>false</code>
- * otherwise
- *
- * @exception SecurityException If deleting of the file is not allowed
- */
- public synchronized boolean delete()
- {
- SecurityManager s = System.getSecurityManager();
-
- if (s != null)
- s.checkDelete(path);
-
- return VMFile.delete(path);
- }
-
- /**
- * This method tests two <code>File</code> objects for equality by
- * comparing the path of the specified <code>File</code> against the path
- * of this object. The two objects are equal if an only if 1) The
- * argument is not null 2) The argument is a <code>File</code> object and
- * 3) The path of the <code>File</code>argument is equal to the path
- * of this object.
- * <p>
- * The paths of the files are determined by calling the
- * <code>getPath()</code>
- * method on each object.
- *
- * @return <code>true</code> if the two objects are equal,
- * <code>false</code> otherwise.
- */
- public boolean equals(Object obj)
- {
- if (! (obj instanceof File))
- return false;
-
- File other = (File) obj;
-
- if (VMFile.IS_CASE_SENSITIVE)
- return path.equals(other.path);
- else
- return path.equalsIgnoreCase(other.path);
- }
-
- /**
- * This method tests whether or not the file represented by the object
- * actually exists on the filesystem.
- *
- * @return <code>true</code> if the file exists, <code>false</code>otherwise.
- *
- * @exception SecurityException If reading of the file is not permitted
- */
- public boolean exists()
- {
- checkRead();
- return VMFile.exists(path);
- }
-
- /**
- * This method initializes a new <code>File</code> object to represent
- * a file with the specified path.
- *
- * @param name The path name of the file
- */
- public File(String name)
- {
- path = normalizePath (name);
- }
-
- // Remove duplicate and redundant separator characters.
- private String normalizePath(String p)
- {
- // On Windows, convert any '/' to '\'. This appears to be the same logic
- // that Sun's Win32 Java performs.
- if (separatorChar == '\\')
- {
- p = p.replace ('/', '\\');
- // We have to special case the "\c:" prefix.
- if (p.length() > 2 && p.charAt(0) == '\\' &&
- ((p.charAt(1) >= 'a' && p.charAt(1) <= 'z') ||
- (p.charAt(1) >= 'A' && p.charAt(1) <= 'Z')) &&
- p.charAt(2) == ':')
- p = p.substring(1);
- }
-
- int dupIndex = p.indexOf(dupSeparator);
- int plen = p.length();
-
- // Special case: permit Windows UNC path prefix.
- if (dupSeparator.equals("\\\\") && dupIndex == 0)
- dupIndex = p.indexOf(dupSeparator, 1);
-
- if (dupIndex == -1)
- {
- // Ignore trailing separator (though on Windows "a:\", for
- // example, is a valid and minimal path).
- if (plen > 1 && p.charAt (plen - 1) == separatorChar)
- {
- if (! (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':'))
- return p.substring (0, plen - 1);
- }
- else
- return p;
- }
-
- StringBuffer newpath = new StringBuffer(plen);
- int last = 0;
- while (dupIndex != -1)
- {
- newpath.append(p.substring(last, dupIndex));
- // Ignore the duplicate path characters.
- while (p.charAt(dupIndex) == separatorChar)
- {
- dupIndex++;
- if (dupIndex == plen)
- return newpath.toString();
- }
- newpath.append(separatorChar);
- last = dupIndex;
- dupIndex = p.indexOf(dupSeparator, last);
- }
-
- // Again, ignore possible trailing separator (except special cases
- // like "a:\" on Windows).
- int end;
- if (plen > 1 && p.charAt (plen - 1) == separatorChar)
- {
- if (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':')
- end = plen;
- else
- end = plen - 1;
- }
- else
- end = plen;
- newpath.append(p.substring(last, end));
-
- return newpath.toString();
- }
-
- /**
- * This method initializes a new <code>File</code> object to represent
- * a file in the specified named directory. The path name to the file
- * will be the directory name plus the separator string plus the file
- * name. If the directory path name ends in the separator string, another
- * separator string will still be appended.
- *
- * @param dirPath The path to the directory the file resides in
- * @param name The name of the file
- */
- public File(String dirPath, String name)
- {
- if (name == null)
- throw new NullPointerException();
- if (dirPath != null)
- {
- if (dirPath.length() > 0)
- {
- // Try to be smart about the number of separator characters.
- if (dirPath.charAt(dirPath.length() - 1) == separatorChar
- || name.length() == 0)
- path = normalizePath(dirPath + name);
- else
- path = normalizePath(dirPath + separatorChar + name);
- }
- else
- {
- // If dirPath is empty, use a system dependant
- // default prefix.
- // Note that the leading separators in name have
- // to be chopped off, to prevent them forming
- // a UNC prefix on Windows.
- if (separatorChar == '\\' /* TODO use ON_WINDOWS */)
- {
- int skip = 0;
- while(name.length() > skip
- && (name.charAt(skip) == separatorChar
- || name.charAt(skip) == '/'))
- {
- skip++;
- }
- name = name.substring(skip);
- }
- path = normalizePath(separatorChar + name);
- }
- }
- else
- path = normalizePath(name);
- }
-
- /**
- * This method initializes a new <code>File</code> object to represent
- * a file in the specified directory. If the <code>directory</code>
- * argument is <code>null</code>, the file is assumed to be in the
- * current directory as specified by the <code>user.dir</code> system
- * property
- *
- * @param directory The directory this file resides in
- * @param name The name of the file
- */
- public File(File directory, String name)
- {
- this (directory == null ? null : directory.path, name);
- }
-
- /**
- * This method initializes a new <code>File</code> object to represent
- * a file corresponding to the specified <code>file:</code> protocol URI.
- *
- * @param uri The uri.
- */
- public File(URI uri)
- {
- if (uri == null)
- throw new NullPointerException("uri is null");
-
- if (!uri.getScheme().equals("file"))
- throw new IllegalArgumentException("invalid uri protocol");
-
- path = normalizePath(uri.getPath());
- }
-
- /**
- * This method returns the path of this file as an absolute path name.
- * If the path name is already absolute, then it is returned. Otherwise
- * the value returned is the current directory plus the separatory
- * string plus the path of the file. The current directory is determined
- * from the <code>user.dir</code> system property.
- *
- * @return The absolute path of this file
- */
- public String getAbsolutePath()
- {
- if (isAbsolute())
- return path;
- else if (separatorChar == '\\'
- && path.length() > 0 && path.charAt (0) == '\\')
- {
- // On Windows, even if the path starts with a '\\' it is not
- // really absolute until we prefix the drive specifier from
- // the current working directory to it.
- return System.getProperty ("user.dir").substring (0, 2) + path;
- }
- else if (separatorChar == '\\'
- && path.length() > 1 && path.charAt (1) == ':'
- && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z')
- || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z')))
- {
- // On Windows, a process has a current working directory for
- // each drive and a path like "G:foo\bar" would mean the
- // absolute path "G:\wombat\foo\bar" if "\wombat" is the
- // working directory on the G drive.
- String drvDir = null;
- try
- {
- drvDir = new File (path.substring (0, 2)).getCanonicalPath();
- }
- catch (IOException e)
- {
- drvDir = path.substring (0, 2) + "\\";
- }
-
- // Note: this would return "C:\\." for the path "C:.", if "\"
- // is the working folder on the C drive, but this is
- // consistent with what Sun's JRE 1.4.1.01 actually returns!
- if (path.length() > 2)
- return drvDir + '\\' + path.substring (2, path.length());
- else
- return drvDir;
- }
- else
-// @classpath-bugfix ##### 23/7/2006 crawley
- {
- String currentDir = System.getProperty("user.dir");
-
- if (currentDir.endsWith(separator))
- return currentDir + path;
- else
- return currentDir + separator + path;
- }
-// @classpath-bugfix-end
- }
-
- /**
- * This method returns a <code>File</code> object representing the
- * absolute path of this object.
- *
- * @return A <code>File</code> with the absolute path of the object.
- *
- * @since 1.2
- */
- public File getAbsoluteFile()
- {
- return new File(getAbsolutePath());
- }
-
- /**
- * This method returns a canonical representation of the pathname of
- * this file. The actual form of the canonical representation is
- * different. On the GNU system, the canonical form differs from the
- * absolute form in that all relative file references to "." and ".."
- * are resolved and removed.
- * <p>
- * Note that this method, unlike the other methods which return path
- * names, can throw an IOException. This is because native method
- * might be required in order to resolve the canonical path
- *
- * @exception IOException If an error occurs
- */
- public String getCanonicalPath() throws IOException
- {
- // On Windows, getAbsolutePath might end up calling us, so we
- // have to special case that call to avoid infinite recursion.
- if (separatorChar == '\\' && path.length() == 2 &&
- ((path.charAt(0) >= 'a' && path.charAt(0) <= 'z') ||
- (path.charAt(0) >= 'A' && path.charAt(0) <= 'Z')) &&
- path.charAt(1) == ':')
- {
- return VMFile.toCanonicalForm(path);
- }
- // Call getAbsolutePath first to make sure that we do the
- // current directory handling, because the native code
- // may have a different idea of the current directory.
- return VMFile.toCanonicalForm(getAbsolutePath());
- }
-
- /**
- * This method returns a <code>File</code> object representing the
- * canonical path of this object.
- *
- * @return A <code>File</code> instance representing the canonical path of
- * this object.
- *
- * @exception IOException If an error occurs.
- *
- * @since 1.2
- */
- public File getCanonicalFile() throws IOException
- {
- return new File(getCanonicalPath());
- }
-
- /**
- * This method returns the name of the file. This is everything in the
- * complete path of the file after the last instance of the separator
- * string.
- *
- * @return The file name
- */
- public String getName()
- {
- return VMFile.getName(path);
- }
-
- /**
- * This method returns a <code>String</code> the represents this file's
- * parent. <code>null</code> is returned if the file has no parent. The
- * parent is determined via a simple operation which removes the
- *
- * @return The parent directory of this file
- */
- public String getParent()
- {
- String prefix = null;
- int nameSeqIndex = 0;
-
- // The "prefix", if present, is the leading "/" on UNIX and
- // either the drive specifier (e.g. "C:") or the leading "\\"
- // of a UNC network path on Windows.
- if (separatorChar == '/' && path.charAt (0) == '/')
- {
- prefix = "/";
- nameSeqIndex = 1;
- }
- else if (separatorChar == '\\' && path.length() > 1)
- {
- if ((path.charAt (0) == '\\' && path.charAt (1) == '\\')
- || (((path.charAt (0) >= 'a' && path.charAt (0) <= 'z')
- || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))
- && path.charAt (1) == ':'))
- {
- prefix = path.substring (0, 2);
- nameSeqIndex = 2;
- }
- }
-
- // According to the JDK docs, the returned parent path is the
- // portion of the name sequence before the last separator
- // character, if found, prefixed by the prefix, otherwise null.
- if (nameSeqIndex < path.length())
- {
- String nameSeq = path.substring (nameSeqIndex, path.length());
- int last = nameSeq.lastIndexOf (separatorChar);
- if (last == -1)
- return prefix;
- else if (last == (nameSeq.length() - 1))
- // Note: The path would not have a trailing separator
- // except for cases like "C:\" on Windows (see
- // normalizePath( )), where Sun's JRE 1.4 returns null.
- return null;
- else if (last == 0)
- last++;
-
- if (prefix != null)
- return prefix + nameSeq.substring (0, last);
- else
- return nameSeq.substring (0, last);
- }
- else
- // Sun's JRE 1.4 returns null if the prefix is the only
- // component of the path - so "/" gives null on UNIX and
- // "C:", "\\", etc. return null on Windows.
- return null;
- }
-
- /**
- * This method returns a <code>File</code> object representing the parent
- * file of this one.
- *
- * @return a <code>File</code> for the parent of this object.
- * <code>null</code>
- * will be returned if this object does not have a parent.
- *
- * @since 1.2
- */
- public File getParentFile()
- {
- String parent = getParent();
- return parent != null ? new File(parent) : null;
- }
-
- /**
- * Returns the path name that represents this file. May be a relative
- * or an absolute path name
- *
- * @return The pathname of this file
- */
- public String getPath()
- {
- return path;
- }
-
- /**
- * This method returns a hash code representing this file. It is the
- * hash code of the path of this file (as returned by <code>getPath()</code>)
- * exclusived or-ed with the value 1234321.
- *
- * @return The hash code for this object
- */
- public int hashCode()
- {
- if (VMFile.IS_CASE_SENSITIVE)
- return path.hashCode() ^ 1234321;
- else
- return path.toLowerCase().hashCode() ^ 1234321;
- }
-
- /**
- * This method returns true if this object represents an absolute file
- * path and false if it does not. The definition of an absolute path varies
- * by system. As an example, on GNU systems, a path is absolute if it starts
- * with a "/".
- *
- * @return <code>true</code> if this object represents an absolute
- * file name, <code>false</code> otherwise.
- */
- public boolean isAbsolute()
- {
- if (separatorChar == '\\')
- return path.startsWith(dupSeparator) ||
- (path.length() > 2 &&
- ((path.charAt(0) >= 'a' && path.charAt(0) <= 'z') ||
- (path.charAt(0) >= 'A' && path.charAt(0) <= 'Z')) &&
- path.charAt(1) == ':' &&
- path.charAt(2) == '\\');
- else
- return path.startsWith(separator);
- }
-
- /**
- * This method tests whether or not the file represented by this object
- * is a directory. In order for this method to return <code>true</code>,
- * the file represented by this object must exist and be a directory.
- *
- * @return <code>true</code> if this file is a directory, <code>false</code>
- * otherwise
- *
- * @exception SecurityException If reading of the file is not permitted
- */
- public boolean isDirectory()
- {
- checkRead();
- return VMFile.isDirectory(path);
- }
-
- /**
- * This method tests whether or not the file represented by this object
- * is a "plain" file. A file is a plain file if and only if it 1) Exists,
- * 2) Is not a directory or other type of special file.
- *
- * @return <code>true</code> if this is a plain file, <code>false</code>
- * otherwise
- *
- * @exception SecurityException If reading of the file is not permitted
- */
- public boolean isFile()
- {
- checkRead();
- return VMFile.isFile(path);
- }
-
- /**
- * This method tests whether or not this file represents a "hidden" file.
- * On GNU systems, a file is hidden if its name begins with a "."
- * character. Files with these names are traditionally not shown with
- * directory listing tools.
- *
- * @return <code>true</code> if the file is hidden, <code>false</code>
- * otherwise.
- *
- * @since 1.2
- */
- public boolean isHidden()
- {
- return VMFile.isHidden(path);
- }
-
- /**
- * This method returns the last modification time of this file. The
- * time value returned is an abstract value that should not be interpreted
- * as a specified time value. It is only useful for comparing to other
- * such time values returned on the same system. In that case, the larger
- * value indicates a more recent modification time.
- * <p>
- * If the file does not exist, then a value of 0 is returned.
- *
- * @return The last modification time of the file
- *
- * @exception SecurityException If reading of the file is not permitted
- */
- public long lastModified()
- {
- checkRead();
- return VMFile.lastModified(path);
- }
-
- /**
- * This method returns the length of the file represented by this object,
- * or 0 if the specified file does not exist.
- *
- * @return The length of the file
- *
- * @exception SecurityException If reading of the file is not permitted
- */
- public long length()
- {
- checkRead();
- return VMFile.length(path);
- }
-
- /**
- * This method returns a array of <code>String</code>'s representing the
- * list of files is then directory represented by this object. If this
- * object represents a non-directory file or a non-existent file, then
- * <code>null</code> is returned. The list of files will not contain
- * any names such as "." or ".." which indicate the current or parent
- * directory. Also, the names are not guaranteed to be sorted.
- * <p>
- * In this form of the <code>list()</code> method, a filter is specified
- * that allows the caller to control which files are returned in the
- * list. The <code>FilenameFilter</code> specified is called for each
- * file returned to determine whether or not that file should be included
- * in the list.
- * <p>
- * A <code>SecurityManager</code> check is made prior to reading the
- * directory. If read access to the directory is denied, an exception
- * will be thrown.
- *
- * @param filter An object which will identify files to exclude from
- * the directory listing.
- *
- * @return An array of files in the directory, or <code>null</code>
- * if this object does not represent a valid directory.
- *
- * @exception SecurityException If read access is not allowed to the
- * directory by the <code>SecurityManager</code>
- */
- public String[] list(FilenameFilter filter)
- {
- checkRead();
-
- if (!exists() || !isDirectory())
- return null;
-
- // Get the list of files
- String files[] = VMFile.list(path);
-
- // Check if an error occured in listInternal().
- if (files == null)
- return null;
-
- if (filter == null)
- return files;
-
- // Apply the filter
- int count = 0;
- for (int i = 0; i < files.length; i++)
- {
- if (filter.accept(this, files[i]))
- ++count;
- else
- files[i] = null;
- }
-
- String[] retfiles = new String[count];
- count = 0;
- for (int i = 0; i < files.length; i++)
- if (files[i] != null)
- retfiles[count++] = files[i];
-
- return retfiles;
- }
-
- /**
- * This method returns a array of <code>String</code>'s representing the
- * list of files is then directory represented by this object. If this
- * object represents a non-directory file or a non-existent file, then
- * <code>null</code> is returned. The list of files will not contain
- * any names such as "." or ".." which indicate the current or parent
- * directory. Also, the names are not guaranteed to be sorted.
- * <p>
- * A <code>SecurityManager</code> check is made prior to reading the
- * directory. If read access to the directory is denied, an exception
- * will be thrown.
- *
- * @return An array of files in the directory, or <code>null</code> if
- * this object does not represent a valid directory.
- *
- * @exception SecurityException If read access is not allowed to the
- * directory by the <code>SecurityManager</code>
- */
- public String[] list()
- {
- return list(null);
- }
-
- /**
- * This method returns an array of <code>File</code> objects representing
- * all the files in the directory represented by this object. If this
- * object does not represent a directory, <code>null</code> is returned.
- * Each of the returned <code>File</code> object is constructed with this
- * object as its parent.
- * <p>
- * A <code>SecurityManager</code> check is made prior to reading the
- * directory. If read access to the directory is denied, an exception
- * will be thrown.
- *
- * @return An array of <code>File</code> objects for this directory.
- *
- * @exception SecurityException If the <code>SecurityManager</code> denies
- * access to this directory.
- *
- * @since 1.2
- */
- public File[] listFiles()
- {
- return listFiles((FilenameFilter) null);
- }
-
- /**
- * This method returns an array of <code>File</code> objects representing
- * all the files in the directory represented by this object. If this
- * object does not represent a directory, <code>null</code> is returned.
- * Each of the returned <code>File</code> object is constructed with this
- * object as its parent.
- * <p>
- * In this form of the <code>listFiles()</code> method, a filter is specified
- * that allows the caller to control which files are returned in the
- * list. The <code>FilenameFilter</code> specified is called for each
- * file returned to determine whether or not that file should be included
- * in the list.
- * <p>
- * A <code>SecurityManager</code> check is made prior to reading the
- * directory. If read access to the directory is denied, an exception
- * will be thrown.
- *
- * @return An array of <code>File</code> objects for this directory.
- *
- * @exception SecurityException If the <code>SecurityManager</code> denies
- * access to this directory.
- *
- * @since 1.2
- */
- public File[] listFiles(FilenameFilter filter)
- {
- String[] filelist = list(filter);
-
- if (filelist == null)
- return null;
-
- File[] fobjlist = new File [filelist.length];
-
- for (int i = 0; i < filelist.length; i++)
- fobjlist [i] = new File(this, filelist [i]);
-
- return fobjlist;
- }
-
- /**
- * This method returns an array of <code>File</code> objects representing
- * all the files in the directory represented by this object. If this
- * object does not represent a directory, <code>null</code> is returned.
- * Each of the returned <code>File</code> object is constructed with this
- * object as its parent.
- * <p>
- * In this form of the <code>listFiles()</code> method, a filter is specified
- * that allows the caller to control which files are returned in the
- * list. The <code>FileFilter</code> specified is called for each
- * file returned to determine whether or not that file should be included
- * in the list.
- * <p>
- * A <code>SecurityManager</code> check is made prior to reading the
- * directory. If read access to the directory is denied, an exception
- * will be thrown.
- *
- * @return An array of <code>File</code> objects for this directory.
- *
- * @exception SecurityException If the <code>SecurityManager</code> denies
- * access to this directory.
- *
- * @since 1.2
- */
- public File[] listFiles(FileFilter filter)
- {
- File[] fobjlist = listFiles((FilenameFilter) null);
-
- if (fobjlist == null)
- return null;
-
- if (filter == null)
- return fobjlist;
-
- int count = 0;
- for (int i = 0; i < fobjlist.length; i++)
- if (filter.accept(fobjlist[i]) == true)
- ++count;
-
- File[] final_list = new File[count];
- count = 0;
- for (int i = 0; i < fobjlist.length; i++)
- if (filter.accept(fobjlist[i]) == true)
- {
- final_list[count] = fobjlist[i];
- ++count;
- }
-
- return final_list;
- }
-
- /**
- * This method returns a <code>String</code> that is the path name of the
- * file as returned by <code>getPath</code>.
- *
- * @return A <code>String</code> representation of this file
- */
- public String toString()
- {
- return path;
- }
-
- /**
- * @return A <code>URI</code> for this object.
- */
- public URI toURI()
- {
- String abspath = getAbsolutePath();
-
- if (isDirectory())
- abspath = abspath + separatorChar;
-
- if (separatorChar == '\\')
- abspath = separatorChar + abspath;
-
- try
- {
- return new URI("file", null, null, -1,
- abspath.replace(separatorChar, '/'),
- null, null);
- }
- catch (URISyntaxException use)
- {
- // Can't happen.
- throw (InternalError) new InternalError("Unconvertible file: "
- + this).initCause(use);
- }
- }
-
- /**
- * This method returns a <code>URL</code> with the <code>file:</code>
- * protocol that represents this file. The exact form of this URL is
- * system dependent.
- *
- * @return A <code>URL</code> for this object.
- *
- * @exception MalformedURLException If the URL cannot be created
- * successfully.
- */
- public URL toURL() throws MalformedURLException
- {
- // On Win32, Sun's JDK returns URLs of the form "file:/c:/foo/bar.txt",
- // while on UNIX, it returns URLs of the form "file:/foo/bar.txt".
- if (separatorChar == '\\')
- return new URL ("file:/" + getAbsolutePath().replace ('\\', '/')
- + (isDirectory() ? "/" : ""));
- else
- return new URL ("file:" + getAbsolutePath()
- + (isDirectory() ? "/" : ""));
- }
-
-
- /**
- * This method creates a directory for the path represented by this object.
- *
- * @return <code>true</code> if the directory was created,
- * <code>false</code> otherwise
- *
- * @exception SecurityException If write access is not allowed to this file
- */
- public boolean mkdir()
- {
- checkWrite();
- return VMFile.mkdir(path);
- }
-
- /**
- * This method creates a directory for the path represented by this file.
- * It will also create any intervening parent directories if necessary.
- *
- * @return <code>true</code> if the directory was created,
- * <code>false</code> otherwise
- *
- * @exception SecurityException If write access is not allowed to this file
- */
- public boolean mkdirs()
- {
- String parent = getParent();
- if (parent == null)
- {
- return mkdir();
- }
-
- File f = new File(parent);
- if (!f.exists())
- {
- boolean rc = f.mkdirs();
- if (rc == false)
- return false;
- }
-
- return mkdir();
- }
-
- /**
- * This method creates a temporary file in the specified directory. If
- * the directory name is null, then this method uses the system temporary
- * directory. The files created are guaranteed not to currently exist and
- * the same file name will never be used twice in the same virtual
- * machine instance.
- * The system temporary directory is determined by examinging the
- * <code>java.io.tmpdir</code> system property.
- * <p>
- * The <code>prefix</code> parameter is a sequence of at least three
- * characters that are used as the start of the generated filename. The
- * <code>suffix</code> parameter is a sequence of characters that is used
- * to terminate the file name. This parameter may be <code>null</code>
- * and if it is, the suffix defaults to ".tmp".
- * <p>
- * If a <code>SecurityManager</code> exists, then its <code>checkWrite</code>
- * method is used to verify that this operation is permitted.
- *
- * @param prefix The character prefix to use in generating the path name.
- * @param suffix The character suffix to use in generating the path name.
- * @param directory The directory to create the file in, or
- * <code>null</code> for the default temporary directory
- *
- * @exception IllegalArgumentException If the patterns is not valid
- * @exception SecurityException If there is no permission to perform
- * this operation
- * @exception IOException If an error occurs
- *
- * @since 1.2
- */
- public static synchronized File createTempFile(String prefix, String suffix,
- File directory)
- throws IOException
- {
- // Grab the system temp directory if necessary
- if (directory == null)
- {
- String dirname = System.getProperty("java.io.tmpdir");
- if (dirname == null)
- throw new IOException("Cannot determine system temporary directory");
-
- directory = new File(dirname);
- if (! VMFile.exists(directory.path))
- throw new IOException("System temporary directory "
- + directory.getName() + " does not exist.");
- if (! VMFile.isDirectory(directory.path))
- throw new IOException("System temporary directory "
- + directory.getName()
- + " is not really a directory.");
- }
-
- // Check if prefix is at least 3 characters long
- if (prefix.length() < 3)
- throw new IllegalArgumentException("Prefix too short: " + prefix);
-
- // Set default value of suffix
- if (suffix == null)
- suffix = ".tmp";
-
- // Now identify a file name and make sure it doesn't exist.
- File file;
- if (!VMFile.IS_DOS_8_3)
- {
- do
- {
- long now = System.currentTimeMillis();
- if (now > last_tmp)
- {
- // The last temporary file was created more than 1 ms ago.
- last_tmp = now;
- n_created = 0;
- }
- else
- n_created++;
-
- String name = Long.toHexString(now);
- if (n_created > 0)
- name += '_'+Integer.toHexString(n_created);
- String filename = prefix + name + suffix;
- file = new File(directory, filename);
- }
- while (VMFile.exists(file.path));
- }
- else
- {
- // make sure prefix is not longer than 7 characters
- if (prefix.length() >= 8)
- throw new IllegalArgumentException("Prefix too long: " + prefix + "(valid length 3..7)");
-
- long mask = 0x000000ffffFFFFL >> (prefix.length() * 4);
- do
- {
- int n = (int) (System.currentTimeMillis() & mask);
- String filename = prefix + java.lang.Integer.toHexString(n) + suffix;
- file = new File(directory, filename);
- }
- while (VMFile.exists(file.path));
- }
-
- // Verify that we are allowed to create this file
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkWrite(file.getAbsolutePath());
-
- // Now create the file and return our file object
- // XXX - FIXME race condition.
- VMFile.create(file.getAbsolutePath());
- return file;
- }
-
- /**
- * This method sets the file represented by this object to be read only.
- * A read only file or directory cannot be modified. Please note that
- * GNU systems allow read only files to be deleted if the directory it
- * is contained in is writable.
- *
- * @return <code>true</code> if the operation succeeded, <code>false</code>
- * otherwise.
- *
- * @exception SecurityException If the <code>SecurityManager</code> does
- * not allow this operation.
- *
- * @since 1.2
- */
- public boolean setReadOnly()
- {
- // Do a security check before trying to do anything else.
- checkWrite();
-
- // Test for existence.
- if (! VMFile.exists(path))
- return false;
-
- return VMFile.setReadOnly(path);
- }
-
- /**
- * This method returns an array of filesystem roots. Some operating systems
- * have volume oriented filesystem. This method provides a mechanism for
- * determining which volumes exist. GNU systems use a single hierarchical
- * filesystem, so will have only one "/" filesystem root.
- *
- * @return An array of <code>File</code> objects for each filesystem root
- * available.
- *
- * @since 1.2
- */
- public static File[] listRoots()
- {
- return VMFile.listRoots();
- }
-
- /**
- * This method creates a temporary file in the system temporary directory.
- * The files created are guaranteed not to currently exist and the same file
- * name will never be used twice in the same virtual machine instance. The
- * system temporary directory is determined by examinging the
- * <code>java.io.tmpdir</code> system property.
- * <p>
- * The <code>prefix</code> parameter is a sequence of at least three
- * characters that are used as the start of the generated filename. The
- * <code>suffix</code> parameter is a sequence of characters that is used
- * to terminate the file name. This parameter may be <code>null</code>
- * and if it is, the suffix defaults to ".tmp".
- * <p>
- * If a <code>SecurityManager</code> exists, then its <code>checkWrite</code>
- * method is used to verify that this operation is permitted.
- * <p>
- * This method is identical to calling
- * <code>createTempFile(prefix, suffix, null)</code>.
- *
- * @param prefix The character prefix to use in generating the path name.
- * @param suffix The character suffix to use in generating the path name.
- *
- * @exception IllegalArgumentException If the prefix or suffix are not valid.
- * @exception SecurityException If there is no permission to perform
- * this operation
- * @exception IOException If an error occurs
- */
- public static File createTempFile(String prefix, String suffix)
- throws IOException
- {
- return createTempFile(prefix, suffix, null);
- }
-
- /**
- * This method compares the specified <code>File</code> to this one
- * to test for equality. It does this by comparing the canonical path names
- * of the files.
- * <p>
- * The canonical paths of the files are determined by calling the
- * <code>getCanonicalPath</code> method on each object.
- * <p>
- * This method returns a 0 if the specified <code>Object</code> is equal
- * to this one, a negative value if it is less than this one
- * a positive value if it is greater than this one.
- *
- * @return An integer as described above
- *
- * @since 1.2
- */
- public int compareTo(File other)
- {
- if (VMFile.IS_CASE_SENSITIVE)
- return path.compareTo (other.path);
- else
- return path.compareToIgnoreCase (other.path);
- }
-
- /**
- * This method renames the file represented by this object to the path
- * of the file represented by the argument <code>File</code>.
- *
- * @param dest The <code>File</code> object representing the target name
- *
- * @return <code>true</code> if the rename succeeds, <code>false</code>
- * otherwise.
- *
- * @exception SecurityException If write access is not allowed to the
- * file by the <code>SecurityMananger</code>.
- */
- public synchronized boolean renameTo(File dest)
- {
- checkWrite();
- dest.checkWrite();
- // Call our native rename method
- return VMFile.renameTo(path, dest.path);
- }
-
- /**
- * This method sets the modification time on the file to the specified
- * value. This is specified as the number of seconds since midnight
- * on January 1, 1970 GMT.
- *
- * @param time The desired modification time.
- *
- * @return <code>true</code> if the operation succeeded, <code>false</code>
- * otherwise.
- *
- * @exception IllegalArgumentException If the specified time is negative.
- * @exception SecurityException If the <code>SecurityManager</code> will
- * not allow this operation.
- *
- * @since 1.2
- */
- public boolean setLastModified(long time)
- {
- if (time < 0)
- throw new IllegalArgumentException("Negative modification time: " + time);
-
- checkWrite();
- return VMFile.setLastModified(path, time);
- }
-
- private void checkWrite()
- {
- // Check the SecurityManager
- SecurityManager s = System.getSecurityManager();
-
- if (s != null)
- s.checkWrite(path);
- }
-
- private void checkRead()
- {
- // Check the SecurityManager
- SecurityManager s = System.getSecurityManager();
-
- if (s != null)
- s.checkRead(path);
- }
-
- /**
- * Calling this method requests that the file represented by this object
- * be deleted when the virtual machine exits. Note that this request cannot
- * be cancelled. Also, it will only be carried out if the virtual machine
- * exits normally.
- *
- * @exception SecurityException If deleting of the file is not allowed
- *
- * @since 1.2
- */
- public void deleteOnExit()
- {
- // Check the SecurityManager
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkDelete(path);
-
- DeleteFileHelper.add(this);
- }
-
- private void writeObject(ObjectOutputStream oos) throws IOException
- {
- oos.defaultWriteObject();
- oos.writeChar(separatorChar);
- }
-
- private void readObject(ObjectInputStream ois)
- throws ClassNotFoundException, IOException
- {
- ois.defaultReadObject();
-
- // If the file was from an OS with a different dir separator,
- // fixup the path to use the separator on this OS.
- char oldSeparatorChar = ois.readChar();
-
- if (oldSeparatorChar != separatorChar)
- path = path.replace(oldSeparatorChar, separatorChar);
- }
-
-} // class File
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-06 11:08:03
|
Revision: 3350
http://jnode.svn.sourceforge.net/jnode/?rev=3350&view=rev
Author: lsantha
Date: 2007-07-06 04:08:00 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/descriptors/org.classpath.core.xml
Modified: trunk/core/descriptors/org.classpath.core.xml
===================================================================
--- trunk/core/descriptors/org.classpath.core.xml 2007-07-06 11:07:32 UTC (rev 3349)
+++ trunk/core/descriptors/org.classpath.core.xml 2007-07-06 11:08:00 UTC (rev 3350)
@@ -15,8 +15,10 @@
<export name="com.sun.naming.internal.*"/>
<export name="sun.*" />
+ <export name="sun.awt.EventListenerAggregate" />
<export name="sun.misc.*"/>
<export name="sun.reflect.Reflection"/>
+ <export name="sun.reflect.NativeReflection"/>
<export name="sun.net.www.protocol.http.InMemoryCookieStore"/>
<export name="sun.security.util.Debug"/>
<export name="sun.security.util.SecurityConstants"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-06 11:07:34
|
Revision: 3349
http://jnode.svn.sourceforge.net/jnode/?rev=3349&view=rev
Author: lsantha
Date: 2007-07-06 04:07:32 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/sun/sun/awt/
trunk/core/src/openjdk/sun/sun/awt/EventListenerAggregate.java
trunk/core/src/openjdk/sun/sun/beans/
trunk/core/src/openjdk/sun/sun/beans/editors/
trunk/core/src/openjdk/sun/sun/beans/editors/BooleanEditor.java
trunk/core/src/openjdk/sun/sun/beans/editors/ByteEditor.java
trunk/core/src/openjdk/sun/sun/beans/editors/ColorEditor.java
trunk/core/src/openjdk/sun/sun/beans/editors/DoubleEditor.java
trunk/core/src/openjdk/sun/sun/beans/editors/EnumEditor.java
trunk/core/src/openjdk/sun/sun/beans/editors/FloatEditor.java
trunk/core/src/openjdk/sun/sun/beans/editors/FontEditor.java
trunk/core/src/openjdk/sun/sun/beans/editors/IntegerEditor.java
trunk/core/src/openjdk/sun/sun/beans/editors/LongEditor.java
trunk/core/src/openjdk/sun/sun/beans/editors/NumberEditor.java
trunk/core/src/openjdk/sun/sun/beans/editors/ShortEditor.java
trunk/core/src/openjdk/sun/sun/beans/editors/StringEditor.java
trunk/core/src/openjdk/sun/sun/beans/infos/
trunk/core/src/openjdk/sun/sun/beans/infos/ComponentBeanInfo.java
Added: trunk/core/src/openjdk/sun/sun/awt/EventListenerAggregate.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/awt/EventListenerAggregate.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/awt/EventListenerAggregate.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.awt;
+
+import java.lang.reflect.Array;
+import java.util.EventListener;
+
+
+/**
+ * A class that assists in managing {@link java.util.EventListener}s of
+ * the specified type. Its instance holds an array of listeners of the same
+ * type and allows to perform the typical operations on the listeners.
+ * This class is thread-safe.
+ *
+ * @version 1.9, 05/05/07
+ * @author Alexander Gerasimov
+ *
+ * @since 1.5
+ */
+public class EventListenerAggregate {
+
+ private EventListener[] listenerList;
+
+ /**
+ * Constructs an <code>EventListenerAggregate</code> object.
+ *
+ * @param listenerClass the type of the listeners to be managed by this object
+ *
+ * @throws NullPointerException if <code>listenerClass</code> is
+ * <code>null</code>
+ * @throws ClassCastException if <code>listenerClass</code> is not
+ * assignable to <code>java.util.EventListener</code>
+ */
+ public EventListenerAggregate(Class listenerClass) {
+ if (listenerClass == null) {
+ throw new NullPointerException("listener class is null");
+ }
+
+ if (!EventListener.class.isAssignableFrom(listenerClass)) {
+ throw new ClassCastException("listener class " + listenerClass +
+ " is not assignable to EventListener");
+ }
+
+ listenerList = (EventListener[])Array.newInstance(listenerClass, 0);
+ }
+
+ private Class getListenerClass() {
+ return listenerList.getClass().getComponentType();
+ }
+
+ /**
+ * Adds the listener to this aggregate.
+ *
+ * @param listener the listener to be added
+ *
+ * @throws ClassCastException if <code>listener</code> is not
+ * an instatce of <code>listenerClass</code> specified
+ * in the constructor
+ */
+ public synchronized void add(EventListener listener) {
+ Class listenerClass = getListenerClass();
+
+ if (!listenerClass.isInstance(listener)) { // null is not an instance of any class
+ throw new ClassCastException("listener " + listener + " is not " +
+ "an instance of listener class " + listenerClass);
+ }
+
+ EventListener[] tmp = (EventListener[])Array.newInstance(listenerClass, listenerList.length + 1);
+ System.arraycopy(listenerList, 0, tmp, 0, listenerList.length);
+ tmp[listenerList.length] = listener;
+ listenerList = tmp;
+ }
+
+ /**
+ * Removes a listener that is equal to the given one from this aggregate.
+ * <code>equals()</code> method is used to compare listeners.
+ *
+ * @param listener the listener to be removed
+ *
+ * @return <code>true</code> if this aggregate contained the specified
+ * <code>listener</code>; <code>false</code> otherwise
+ *
+ * @throws ClassCastException if <code>listener</code> is not
+ * an instatce of <code>listenerClass</code> specified
+ * in the constructor
+ */
+ public synchronized boolean remove(EventListener listener) {
+ Class listenerClass = getListenerClass();
+
+ if (!listenerClass.isInstance(listener)) { // null is not an instance of any class
+ throw new ClassCastException("listener " + listener + " is not " +
+ "an instance of listener class " + listenerClass);
+ }
+
+ for (int i = 0; i < listenerList.length; i++) {
+ if (listenerList[i].equals(listener)) {
+ EventListener[] tmp = (EventListener[])Array.newInstance(listenerClass,
+ listenerList.length - 1);
+ System.arraycopy(listenerList, 0, tmp, 0, i);
+ System.arraycopy(listenerList, i + 1, tmp, i, listenerList.length - i - 1);
+ listenerList = tmp;
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns an array of all the listeners contained in this aggregate.
+ * The array is the data structure in which listeners are stored internally.
+ * The runtime type of the returned array is "array of <code>listenerClass</code>"
+ * (<code>listenerClass</code> has been specified as a parameter to
+ * the constructor of this class).
+ *
+ * @return all the listeners contained in this aggregate (an empty
+ * array if there are no listeners)
+ */
+ public synchronized EventListener[] getListenersInternal() {
+ return listenerList;
+ }
+
+ /**
+ * Returns an array of all the listeners contained in this aggregate.
+ * The array is a copy of the data structure in which listeners are stored
+ * internally.
+ * The runtime type of the returned array is "array of <code>listenerClass</code>"
+ * (<code>listenerClass</code> has been specified as a parameter to
+ * the constructor of this class).
+ *
+ * @return a copy of all the listeners contained in this aggregate (an empty
+ * array if there are no listeners)
+ */
+ public synchronized EventListener[] getListenersCopy() {
+ return (listenerList.length == 0) ? listenerList : (EventListener[])listenerList.clone();
+ }
+
+ /**
+ * Returns the number of lisetners in this aggregate.
+ *
+ * @return the number of lisetners in this aggregate
+ */
+ public synchronized int size() {
+ return listenerList.length;
+ }
+
+ /**
+ * Returns <code>true</code> if this aggregate contains no listeners,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this aggregate contains no listeners,
+ * <code>false</code> otherwise
+ */
+ public synchronized boolean isEmpty() {
+ return listenerList.length == 0;
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/beans/editors/BooleanEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/BooleanEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/BooleanEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "boolean" type.
+ */
+
+import java.beans.*;
+
+public class BooleanEditor extends PropertyEditorSupport {
+
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? value.toString()
+ : "null";
+ }
+
+ public String getAsText() {
+ Object value = getValue();
+ return (value instanceof Boolean)
+ ? getValidName((Boolean) value)
+ : null;
+ }
+
+ public void setAsText(String text) throws java.lang.IllegalArgumentException {
+ if (text == null) {
+ setValue(null);
+ } else if (isValidName(true, text)) {
+ setValue(Boolean.TRUE);
+ } else if (isValidName(false, text)) {
+ setValue(Boolean.FALSE);
+ } else {
+ throw new java.lang.IllegalArgumentException(text);
+ }
+ }
+
+ public String[] getTags() {
+ return new String[] {getValidName(true), getValidName(false)};
+ }
+
+ // the following method should be localized (4890258)
+
+ private String getValidName(boolean value) {
+ return value ? "True" : "False";
+ }
+
+ private boolean isValidName(boolean value, String name) {
+ return getValidName(value).equalsIgnoreCase(name);
+ }
+}
+
Added: trunk/core/src/openjdk/sun/sun/beans/editors/ByteEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/ByteEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/ByteEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "byte" type.
+ *
+ */
+
+import java.beans.*;
+
+public class ByteEditor extends NumberEditor {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? "((byte)" + value + ")"
+ : "null";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Byte.decode(text));
+ }
+
+}
+
Added: trunk/core/src/openjdk/sun/sun/beans/editors/ColorEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/ColorEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/ColorEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,213 @@
+/*
+ * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.beans.editors;
+
+import java.awt.*;
+import java.beans.*;
+
+public class ColorEditor extends Panel implements PropertyEditor {
+ public ColorEditor() {
+ setLayout(null);
+
+ ourWidth = hPad;
+
+ // Create a sample color block bordered in black
+ Panel p = new Panel();
+ p.setLayout(null);
+ p.setBackground(Color.black);
+ sample = new Canvas();
+ p.add(sample);
+ sample.reshape(2, 2, sampleWidth, sampleHeight);
+ add(p);
+ p.reshape(ourWidth, 2, sampleWidth+4, sampleHeight+4);
+ ourWidth += sampleWidth + 4 + hPad;
+
+ text = new TextField("", 14);
+ add(text);
+ text.reshape(ourWidth,0,100,30);
+ ourWidth += 100 + hPad;
+
+ choser = new Choice();
+ int active = 0;
+ for (int i = 0; i < colorNames.length; i++) {
+ choser.addItem(colorNames[i]);
+ }
+ add(choser);
+ choser.reshape(ourWidth,0,100,30);
+ ourWidth += 100 + hPad;
+
+ resize(ourWidth,40);
+ }
+
+ public void setValue(Object o) {
+ Color c = (Color)o;
+ changeColor(c);
+ }
+
+ public Dimension preferredSize() {
+ return new Dimension(ourWidth, 40);
+ }
+
+ public boolean keyUp(Event e, int key) {
+ if (e.target == text) {
+ try {
+ setAsText(text.getText());
+ } catch (IllegalArgumentException ex) {
+ // Quietly ignore.
+ }
+ }
+ return (false);
+ }
+
+ public void setAsText(String s) throws java.lang.IllegalArgumentException {
+ if (s == null) {
+ changeColor(null);
+ return;
+ }
+ int c1 = s.indexOf(',');
+ int c2 = s.indexOf(',', c1+1);
+ if (c1 < 0 || c2 < 0) {
+ // Invalid string.
+ throw new IllegalArgumentException(s);
+ }
+ try {
+ int r = Integer.parseInt(s.substring(0,c1));
+ int g = Integer.parseInt(s.substring(c1+1, c2));
+ int b = Integer.parseInt(s.substring(c2+1));
+ Color c = new Color(r,g,b);
+ changeColor(c);
+ } catch (Exception ex) {
+ throw new IllegalArgumentException(s);
+ }
+
+ }
+
+ public boolean action(Event e, Object arg) {
+ if (e.target == choser) {
+ changeColor(colors[choser.getSelectedIndex()]);
+ }
+ return false;
+ }
+
+ public String getJavaInitializationString() {
+ return (this.color != null)
+ ? "new java.awt.Color(" + this.color.getRGB() + ",true)"
+ : "null";
+ }
+
+
+ private void changeColor(Color c) {
+
+ if (c == null) {
+ this.color = null;
+ this.text.setText("");
+ return;
+ }
+
+ color = c;
+
+ text.setText("" + c.getRed() + "," + c.getGreen() + "," + c.getBlue());
+
+ int active = 0;
+ for (int i = 0; i < colorNames.length; i++) {
+ if (color.equals(colors[i])) {
+ active = i;
+ }
+ }
+ choser.select(active);
+
+ sample.setBackground(color);
+ sample.repaint();
+
+ support.firePropertyChange("", null, null);
+ }
+
+ public Object getValue() {
+ return color;
+ }
+
+ public boolean isPaintable() {
+ return true;
+ }
+
+ public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {
+ Color oldColor = gfx.getColor();
+ gfx.setColor(Color.black);
+ gfx.drawRect(box.x, box.y, box.width-3, box.height-3);
+ gfx.setColor(color);
+ gfx.fillRect(box.x+1, box.y+1, box.width-4, box.height-4);
+ gfx.setColor(oldColor);
+ }
+
+ public String getAsText() {
+ return (this.color != null)
+ ? this.color.getRed() + "," + this.color.getGreen() + "," + this.color.getBlue()
+ : null;
+ }
+
+ public String[] getTags() {
+ return null;
+ }
+
+ public java.awt.Component getCustomEditor() {
+ return this;
+ }
+
+ public boolean supportsCustomEditor() {
+ return true;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {
+ support.addPropertyChangeListener(l);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener l) {
+ support.removePropertyChangeListener(l);
+ }
+
+
+ private String colorNames[] = { " ", "white", "lightGray", "gray", "darkGray",
+ "black", "red", "pink", "orange",
+ "yellow", "green", "magenta", "cyan",
+ "blue"};
+ private Color colors[] = { null, Color.white, Color.lightGray, Color.gray, Color.darkGray,
+ Color.black, Color.red, Color.pink, Color.orange,
+ Color.yellow, Color.green, Color.magenta, Color.cyan,
+ Color.blue};
+
+ private Canvas sample;
+ private int sampleHeight = 20;
+ private int sampleWidth = 40;
+ private int hPad = 5;
+ private int ourWidth;
+
+ private Color color;
+ private TextField text;
+ private Choice choser;
+
+ private PropertyChangeSupport support = new PropertyChangeSupport(this);
+}
+
Added: trunk/core/src/openjdk/sun/sun/beans/editors/DoubleEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/DoubleEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/DoubleEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "double" type.
+ *
+ */
+
+import java.beans.*;
+
+public class DoubleEditor extends NumberEditor {
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Double.valueOf(text));
+ }
+
+}
+
Added: trunk/core/src/openjdk/sun/sun/beans/editors/EnumEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/EnumEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/EnumEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package sun.beans.editors;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyEditor;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Property editor for java.lang.Enum subclasses.
+ *
+ * @see PropertyEditor
+ *
+ * @since 1.7
+ *
+ * @version 1.6 05/05/07
+ * @author Sergey A. Malenkov
+ */
+public final class EnumEditor implements PropertyEditor {
+ private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
+
+ private final Class type;
+ private final String[] tags;
+
+ private Object value;
+
+ public EnumEditor( Class type ) {
+ Object[] values = type.getEnumConstants();
+ if ( values == null ) {
+ throw new IllegalArgumentException( "Unsupported " + type );
+ }
+ this.type = type;
+ this.tags = new String[values.length];
+ for ( int i = 0; i < values.length; i++ ) {
+ this.tags[i] = ( ( Enum )values[i] ).name();
+ }
+ }
+
+ public Object getValue() {
+ return this.value;
+ }
+
+ public void setValue( Object value ) {
+ if ( ( value != null ) && ( this.type != value.getClass() ) ) {
+ throw new IllegalArgumentException( "Unsupported value: " + value );
+ }
+ Object oldValue;
+ PropertyChangeListener[] listeners;
+ synchronized ( this.listeners ) {
+ oldValue = this.value;
+ this.value = value;
+
+ if ( ( value == null ) ? oldValue == null : value.equals( oldValue ) ) {
+ return; // do not fire event if value is not changed
+ }
+ int size = this.listeners.size();
+ if ( size == 0 ) {
+ return; // do not fire event if there are no any listener
+ }
+ listeners = this.listeners.toArray( new PropertyChangeListener[size] );
+ }
+ PropertyChangeEvent event = new PropertyChangeEvent( this, null, oldValue, value );
+ for ( PropertyChangeListener listener : listeners ) {
+ listener.propertyChange( event );
+ }
+ }
+
+ public String getAsText() {
+ return ( this.value != null )
+ ? ( ( Enum )this.value ).name()
+ : null;
+ }
+
+ public void setAsText( String text ) {
+ setValue( ( text != null )
+ ? Enum.valueOf( this.type, text )
+ : null );
+ }
+
+ public String[] getTags() {
+ return this.tags.clone();
+ }
+
+ public String getJavaInitializationString() {
+ String name = getAsText();
+ return ( name != null )
+ ? this.type.getName() + '.' + name
+ : "null";
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue( Graphics gfx, Rectangle box ) {
+ }
+
+ public boolean supportsCustomEditor() {
+ return false;
+ }
+
+ public Component getCustomEditor() {
+ return null;
+ }
+
+ public void addPropertyChangeListener( PropertyChangeListener listener ) {
+ synchronized ( this.listeners ) {
+ this.listeners.add( listener );
+ }
+ }
+
+ public void removePropertyChangeListener( PropertyChangeListener listener ) {
+ synchronized ( this.listeners ) {
+ this.listeners.remove( listener );
+ }
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/beans/editors/FloatEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/FloatEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/FloatEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "float" type.
+ *
+ */
+
+import java.beans.*;
+
+public class FloatEditor extends NumberEditor {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? value + "F"
+ : "null";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Float.valueOf(text));
+ }
+
+}
+
Added: trunk/core/src/openjdk/sun/sun/beans/editors/FontEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/FontEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/FontEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,219 @@
+/*
+ * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.beans.editors;
+
+import java.awt.*;
+import java.beans.*;
+
+public class FontEditor extends Panel implements java.beans.PropertyEditor {
+
+ public FontEditor() {
+ setLayout(null);
+
+ toolkit = Toolkit.getDefaultToolkit();
+ fonts = toolkit.getFontList();
+
+ familyChoser = new Choice();
+ for (int i = 0; i < fonts.length; i++) {
+ familyChoser.addItem(fonts[i]);
+ }
+ add(familyChoser);
+ familyChoser.reshape(20, 5, 100, 30);
+
+ styleChoser = new Choice();
+ for (int i = 0; i < styleNames.length; i++) {
+ styleChoser.addItem(styleNames[i]);
+ }
+ add(styleChoser);
+ styleChoser.reshape(145, 5, 70, 30);
+
+ sizeChoser = new Choice();
+ for (int i = 0; i < pointSizes.length; i++) {
+ sizeChoser.addItem("" + pointSizes[i]);
+ }
+ add(sizeChoser);
+ sizeChoser.reshape(220, 5, 70, 30);
+
+ resize(300,40);
+ }
+
+
+ public Dimension preferredSize() {
+ return new Dimension(300, 40);
+ }
+
+ public void setValue(Object o) {
+ font = (Font) o;
+ if (this.font == null)
+ return;
+
+ changeFont(font);
+ // Update the current GUI choices.
+ for (int i = 0; i < fonts.length; i++) {
+ if (fonts[i].equals(font.getFamily())) {
+ familyChoser.select(i);
+ break;
+ }
+ }
+ for (int i = 0; i < styleNames.length; i++) {
+ if (font.getStyle() == styles[i]) {
+ styleChoser.select(i);
+ break;
+ }
+ }
+ for (int i = 0; i < pointSizes.length; i++) {
+ if (font.getSize() <= pointSizes[i]) {
+ sizeChoser.select(i);
+ break;
+ }
+ }
+ }
+
+ private void changeFont(Font f) {
+ font = f;
+ if (sample != null) {
+ remove(sample);
+ }
+ sample = new Label(sampleText);
+ sample.setFont(font);
+ add(sample);
+ Component p = getParent();
+ if (p != null) {
+ p.invalidate();
+ p.layout();
+ }
+ invalidate();
+ layout();
+ repaint();
+ support.firePropertyChange("", null, null);
+ }
+
+ public Object getValue() {
+ return (font);
+ }
+
+ public String getJavaInitializationString() {
+ if (this.font == null)
+ return "null";
+
+ return "new java.awt.Font(\"" + font.getFamily() + "\", " +
+ font.getStyle() + ", " + font.getSize() + ")";
+ }
+
+ public boolean action(Event e, Object arg) {
+ String family = familyChoser.getSelectedItem();
+ int style = styles[styleChoser.getSelectedIndex()];
+ int size = pointSizes[sizeChoser.getSelectedIndex()];
+ try {
+ Font f = new Font(family, style, size);
+ changeFont(f);
+ } catch (Exception ex) {
+ System.err.println("Couldn't create font " + family + "-" +
+ styleNames[style] + "-" + size);
+ }
+ return (false);
+ }
+
+
+ public boolean isPaintable() {
+ return true;
+ }
+
+ public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {
+ // Silent noop.
+ Font oldFont = gfx.getFont();
+ gfx.setFont(font);
+ FontMetrics fm = gfx.getFontMetrics();
+ int vpad = (box.height - fm.getAscent())/2;
+ gfx.drawString(sampleText, 0, box.height-vpad);
+ gfx.setFont(oldFont);
+ }
+
+ public String getAsText() {
+ if (this.font == null) {
+ return null;
+ }
+ StringBuilder sb = new StringBuilder();
+ sb.append(this.font.getFamily());
+ sb.append(' ');
+
+ boolean b = this.font.isBold();
+ if (b) {
+ sb.append("BOLD");
+ }
+ boolean i = this.font.isItalic();
+ if (i) {
+ sb.append("ITALIC");
+ }
+ if (b || i) {
+ sb.append(' ');
+ }
+ sb.append(this.font.getSize());
+ return sb.toString();
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Font.decode(text));
+ }
+
+ public String[] getTags() {
+ return null;
+ }
+
+ public java.awt.Component getCustomEditor() {
+ return this;
+ }
+
+ public boolean supportsCustomEditor() {
+ return true;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {
+ support.addPropertyChangeListener(l);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener l) {
+ support.removePropertyChangeListener(l);
+ }
+
+ private Font font;
+ private Toolkit toolkit;
+ private String sampleText = "Abcde...";
+
+ private Label sample;
+ private Choice familyChoser;
+ private Choice styleChoser;
+ private Choice sizeChoser;
+
+ private String fonts[];
+ private String[] styleNames = { "plain", "bold", "italic" };
+ private int[] styles = { Font.PLAIN, Font.BOLD, Font.ITALIC };
+ private int[] pointSizes = { 3, 5, 8, 10, 12, 14, 18, 24, 36, 48 };
+
+ private PropertyChangeSupport support = new PropertyChangeSupport(this);
+
+}
+
Added: trunk/core/src/openjdk/sun/sun/beans/editors/IntegerEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/IntegerEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/IntegerEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "int" type.
+ *
+ */
+
+import java.beans.*;
+
+public class IntegerEditor extends NumberEditor {
+
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Integer.decode(text));
+ }
+
+}
+
Added: trunk/core/src/openjdk/sun/sun/beans/editors/LongEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/LongEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/LongEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "long" type.
+ *
+ */
+
+import java.beans.*;
+
+public class LongEditor extends NumberEditor {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? value + "L"
+ : "null";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Long.decode(text));
+ }
+
+}
+
Added: trunk/core/src/openjdk/sun/sun/beans/editors/NumberEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/NumberEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/NumberEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 1996 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.beans.editors;
+
+/**
+ * Abstract Property editor for a java builtin number types.
+ *
+ */
+
+import java.beans.*;
+
+abstract public class NumberEditor extends PropertyEditorSupport {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? value.toString()
+ : "null";
+ }
+
+}
+
Added: trunk/core/src/openjdk/sun/sun/beans/editors/ShortEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/ShortEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/ShortEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+package sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "short" type.
+ *
+ */
+
+import java.beans.*;
+
+public class ShortEditor extends NumberEditor {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? "((short)" + value + ")"
+ : "null";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Short.decode(text));
+ }
+
+}
+
Added: trunk/core/src/openjdk/sun/sun/beans/editors/StringEditor.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/editors/StringEditor.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/editors/StringEditor.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+package sun.beans.editors;
+
+import java.beans.*;
+
+public class StringEditor extends PropertyEditorSupport {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ if (value == null)
+ return "null";
+
+ String str = value.toString();
+ int length = str.length();
+ StringBuilder sb = new StringBuilder(length + 2);
+ sb.append('"');
+ for (int i = 0; i < length; i++) {
+ char ch = str.charAt(i);
+ switch (ch) {
+ case '\b': sb.append("\\b"); break;
+ case '\t': sb.append("\\t"); break;
+ case '\n': sb.append("\\n"); break;
+ case '\f': sb.append("\\f"); break;
+ case '\r': sb.append("\\r"); break;
+ case '\"': sb.append("\\\""); break;
+ case '\\': sb.append("\\\\"); break;
+ default:
+ if ((ch < ' ') || (ch > '~')) {
+ sb.append("\\u");
+ String hex = Integer.toHexString((int) ch);
+ for (int len = hex.length(); len < 4; len++) {
+ sb.append('0');
+ }
+ sb.append(hex);
+ } else {
+ sb.append(ch);
+ }
+ break;
+ }
+ }
+ sb.append('"');
+ return sb.toString();
+ }
+
+ public void setAsText(String text) {
+ setValue(text);
+ }
+
+}
+
Added: trunk/core/src/openjdk/sun/sun/beans/infos/ComponentBeanInfo.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/beans/infos/ComponentBeanInfo.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/beans/infos/ComponentBeanInfo.java 2007-07-06 11:07:32 UTC (rev 3349)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 1996-2002 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.beans.infos;
+
+import java.beans.*;
+
+/**
+ * BeanInfo descriptor for a standard AWT component.
+ */
+
+public class ComponentBeanInfo extends SimpleBeanInfo {
+ private static final Class beanClass = java.awt.Component.class;
+
+ public PropertyDescriptor[] getPropertyDescriptors() {
+ try {
+ PropertyDescriptor
+ name = new PropertyDescriptor("name", beanClass),
+ background = new PropertyDescriptor("background", beanClass),
+ foreground = new PropertyDescriptor("foreground", beanClass),
+ font = new PropertyDescriptor("font", beanClass),
+ enabled = new PropertyDescriptor("enabled", beanClass),
+ visible = new PropertyDescriptor("visible", beanClass),
+ focusable = new PropertyDescriptor("focusable", beanClass);
+
+ enabled.setExpert(true);
+ visible.setHidden(true);
+
+ background.setBound(true);
+ foreground.setBound(true);
+ font.setBound(true);
+ focusable.setBound(true);
+
+ PropertyDescriptor[] rv = {name, background, foreground, font, enabled, visible, focusable };
+ return rv;
+ } catch (IntrospectionException e) {
+ throw new Error(e.toString());
+ }
+ }
+}
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-06 11:05:44
|
Revision: 3348
http://jnode.svn.sourceforge.net/jnode/?rev=3348&view=rev
Author: lsantha
Date: 2007-07-06 04:05:42 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/beans/
trunk/core/src/openjdk/java/java/beans/AppletInitializer.java
trunk/core/src/openjdk/java/java/beans/BeanDescriptor.java
trunk/core/src/openjdk/java/java/beans/BeanInfo.java
trunk/core/src/openjdk/java/java/beans/Beans.java
trunk/core/src/openjdk/java/java/beans/ConstructorProperties.java
trunk/core/src/openjdk/java/java/beans/Customizer.java
trunk/core/src/openjdk/java/java/beans/DefaultPersistenceDelegate.java
trunk/core/src/openjdk/java/java/beans/DesignMode.java
trunk/core/src/openjdk/java/java/beans/Encoder.java
trunk/core/src/openjdk/java/java/beans/EventHandler.java
trunk/core/src/openjdk/java/java/beans/EventSetDescriptor.java
trunk/core/src/openjdk/java/java/beans/ExceptionListener.java
trunk/core/src/openjdk/java/java/beans/Expression.java
trunk/core/src/openjdk/java/java/beans/FeatureDescriptor.java
trunk/core/src/openjdk/java/java/beans/IndexedPropertyChangeEvent.java
trunk/core/src/openjdk/java/java/beans/IndexedPropertyDescriptor.java
trunk/core/src/openjdk/java/java/beans/IntrospectionException.java
trunk/core/src/openjdk/java/java/beans/Introspector.java
trunk/core/src/openjdk/java/java/beans/MetaData.java
trunk/core/src/openjdk/java/java/beans/MethodDescriptor.java
trunk/core/src/openjdk/java/java/beans/NameGenerator.java
trunk/core/src/openjdk/java/java/beans/ParameterDescriptor.java
trunk/core/src/openjdk/java/java/beans/PersistenceDelegate.java
trunk/core/src/openjdk/java/java/beans/PropertyChangeEvent.java
trunk/core/src/openjdk/java/java/beans/PropertyChangeListener.java
trunk/core/src/openjdk/java/java/beans/PropertyChangeListenerProxy.java
trunk/core/src/openjdk/java/java/beans/PropertyChangeSupport.java
trunk/core/src/openjdk/java/java/beans/PropertyDescriptor.java
trunk/core/src/openjdk/java/java/beans/PropertyEditor.java
trunk/core/src/openjdk/java/java/beans/PropertyEditorManager.java
trunk/core/src/openjdk/java/java/beans/PropertyEditorSupport.java
trunk/core/src/openjdk/java/java/beans/PropertyVetoException.java
trunk/core/src/openjdk/java/java/beans/ReflectionUtils.java
trunk/core/src/openjdk/java/java/beans/SimpleBeanInfo.java
trunk/core/src/openjdk/java/java/beans/Statement.java
trunk/core/src/openjdk/java/java/beans/VetoableChangeListener.java
trunk/core/src/openjdk/java/java/beans/VetoableChangeListenerProxy.java
trunk/core/src/openjdk/java/java/beans/VetoableChangeSupport.java
trunk/core/src/openjdk/java/java/beans/Visibility.java
trunk/core/src/openjdk/java/java/beans/XMLDecoder.java
trunk/core/src/openjdk/java/java/beans/XMLEncoder.java
trunk/core/src/openjdk/java/java/beans/beancontext/
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContext.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextChild.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextChildComponentProxy.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextChildSupport.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextContainerProxy.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextEvent.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextMembershipEvent.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextMembershipListener.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextProxy.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextServiceAvailableEvent.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextServiceProvider.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextServiceRevokedEvent.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextServiceRevokedListener.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextServices.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextServicesListener.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextServicesSupport.java
trunk/core/src/openjdk/java/java/beans/beancontext/BeanContextSupport.java
trunk/core/src/openjdk/java/java/beans/beancontext/package.html
trunk/core/src/openjdk/java/java/beans/package.html
Added: trunk/core/src/openjdk/java/java/beans/AppletInitializer.java
===================================================================
--- trunk/core/src/openjdk/java/java/beans/AppletInitializer.java (rev 0)
+++ trunk/core/src/openjdk/java/java/beans/AppletInitializer.java 2007-07-06 11:05:42 UTC (rev 3348)
@@ -0,0 +1,92 @@
+/*
+ * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.beans;
+
+import java.applet.Applet;
+
+import java.beans.beancontext.BeanContext;
+
+/**
+ * <p>
+ * This interface is designed to work in collusion with java.beans.Beans.instantiate.
+ * The interafce is intended to provide mechanism to allow the proper
+ * initialization of JavaBeans that are also Applets, during their
+ * instantiation by java.beans.Beans.instantiate().
+ * </p>
+ *
+ * @see java.beans.Beans#instantiate
+ *
+ * @version 1.19, 05/05/07
+ * @since 1.2
+ *
+ */
+
+
+public interface AppletInitializer {
+
+ /**
+ * <p>
+ * If passed to the appropriate variant of java.beans.Beans.instantiate
+ * this method will be called in order to associate the newly instantiated
+ * Applet (JavaBean) with its AppletContext, AppletStub, and Container.
+ * </p>
+ * <p>
+ * Conformant implementations shall:
+ * <ol>
+ * <li> Associate the newly instantiated Applet with the appropriate
+ * AppletContext.
+ *
+ * <li> Instantiate an AppletStub() and associate that AppletStub with
+ * the Applet via an invocation of setStub().
+ *
+ * <li> If BeanContext parameter is null, then it shall associate the
+ * Applet with its appropriate Container by adding that Applet to its
+ * Container via an invocation of add(). If the BeanContext parameter is
+ * non-null, then it is the responsibility of the BeanContext to associate
+ * the Applet with its Container during the subsequent invocation of its
+ * addChildren() method.
+ * </ol>
+ * </p>
+ *
+ * @param newAppletBean The newly instantiated JavaBean
+ * @param bCtxt The BeanContext intended for this Applet, or
+ * null.
+ */
+
+ void initialize(Applet newAppletBean, BeanContext bCtxt);
+
+ /**
+ * <p>
+ * Activate, and/or mark Applet active. Implementors of this interface
+ * shall mark this Applet as active, and optionally invoke its start()
+ * method.
+ * </p>
+ *
+ * @param newApplet The newly instantiated JavaBean
+ */
+
+ void activate(Applet newApplet);
+}
Added: trunk/core/src/openjdk/java/java/beans/BeanDescriptor.java
===================================================================
--- trunk/core/src/openjdk/java/java/beans/BeanDescriptor.java (rev 0)
+++ trunk/core/src/openjdk/java/java/beans/BeanDescriptor.java 2007-07-06 11:05:42 UTC (rev 3348)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 1996-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.beans;
+
+import java.lang.ref.Reference;
+
+/**
+ * A BeanDescriptor provides global information about a "bean",
+ * including its Java class, its displayName, etc.
+ * <p>
+ * This is one of the kinds of descriptor returned by a BeanInfo object,
+ * which also returns descriptors for properties, method, and events.
+ */
+
+public class BeanDescriptor extends FeatureDescriptor {
+
+ private Reference beanClassRef;
+ private Reference customizerClassRef;
+
+ /**
+ * Create a BeanDescriptor for a bean that doesn't have a customizer.
+ *
+ * @param beanClass The Class object of the Java class that implements
+ * the bean. For example sun.beans.OurButton.class.
+ */
+ public BeanDescriptor(Class<?> beanClass) {
+ this(beanClass, null);
+ }
+
+ /**
+ * Create a BeanDescriptor for a bean that has a customizer.
+ *
+ * @param beanClass The Class object of the Java class that implements
+ * the bean. For example sun.beans.OurButton.class.
+ * @param customizerClass The Class object of the Java class that implements
+ * the bean's Customizer. For example sun.beans.OurButtonCustomizer.class.
+ */
+ public BeanDescriptor(Class<?> beanClass, Class<?> customizerClass) {
+ beanClassRef = createReference(beanClass);
+ customizerClassRef = createReference(customizerClass);
+
+ String name = beanClass.getName();
+ while (name.indexOf('.') >= 0) {
+ name = name.substring(name.indexOf('.')+1);
+ }
+ setName(name);
+ }
+
+ /**
+ * Gets the bean's Class object.
+ *
+ * @return The Class object for the bean.
+ */
+ public Class<?> getBeanClass() {
+ return (Class)getObject(beanClassRef);
+ }
+
+ /**
+ * Gets the Class object for the bean's customizer.
+ *
+ * @return The Class object for the bean's customizer. This may
+ * be null if the bean doesn't have a customizer.
+ */
+ public Class<?> getCustomizerClass() {
+ return (Class)getObject(customizerClassRef);
+ }
+
+ /*
+ * Package-private dup constructor
+ * This must isolate the new object from any changes to the old object.
+ */
+ BeanDescriptor(BeanDescriptor old) {
+ super(old);
+ beanClassRef = old.beanClassRef;
+ customizerClassRef = old.customizerClassRef;
+ }
+}
Added: trunk/core/src/openjdk/java/java/beans/BeanInfo.java
===================================================================
--- trunk/core/src/openjdk/java/java/beans/BeanInfo.java (rev 0)
+++ trunk/core/src/openjdk/java/java/beans/BeanInfo.java 2007-07-06 11:05:42 UTC (rev 3348)
@@ -0,0 +1,171 @@
+/*
+ * Copyright 1996-1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.beans;
+
+/**
+ * A bean implementor who wishes to provide explicit information about
+ * their bean may provide a BeanInfo class that implements this BeanInfo
+ * interface and provides explicit information about the methods,
+ * properties, events, etc, of their bean.
+ * <p>
+ * A bean implementor doesn't need to provide a complete set of
+ * explicit information. You can pick and choose which information
+ * you want to provide and the rest will be obtained by automatic
+ * analysis using low-level reflection of the bean classes' methods
+ * and applying standard design patterns.
+ * <p>
+ * You get the opportunity to provide lots and lots of different
+ * information as part of the various XyZDescriptor classes. But
+ * don't panic, you only really need to provide the minimal core
+ * information required by the various constructors.
+ * <P>
+ * See also the SimpleBeanInfo class which provides a convenient
+ * "noop" base class for BeanInfo classes, which you can override
+ * for those specific places where you want to return explicit info.
+ * <P>
+ * To learn about all the behaviour of a bean see the Introspector class.
+ */
+
+public interface BeanInfo {
+
+ /**
+ * Gets the beans <code>BeanDescriptor</code>.
+ *
+ * @return A BeanDescriptor providing overall information about
+ * the bean, such as its displayName, its customizer, etc. May
+ * return null if the information should be obtained by automatic
+ * analysis.
+ */
+ BeanDescriptor getBeanDescriptor();
+
+ /**
+ * Gets the beans <code>EventSetDescriptor</code>s.
+ *
+ * @return An array of EventSetDescriptors describing the kinds of
+ * events fired by this bean. May return null if the information
+ * should be obtained by automatic analysis.
+ */
+ EventSetDescriptor[] getEventSetDescriptors();
+
+ /**
+ * A bean may have a "default" event that is the event that will
+ * mostly commonly be used by humans when using the bean.
+ * @return Index of default event in the EventSetDescriptor array
+ * returned by getEventSetDescriptors.
+ * <P> Returns -1 if there is no default event.
+ */
+ int getDefaultEventIndex();
+
+ /**
+ * Gets the beans <code>PropertyDescriptor</code>s.
+ *
+ * @return An array of PropertyDescriptors describing the editable
+ * properties supported by this bean. May return null if the
+ * information should be obtained by automatic analysis.
+ * <p>
+ * If a property is indexed, then its entry in the result array will
+ * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
+ * A client of getPropertyDescriptors can use "instanceof" to check
+ * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
+ */
+ PropertyDescriptor[] getPropertyDescriptors();
+
+ /**
+ * A bean may have a "default" property that is the property that will
+ * mostly commonly be initially chosen for update by human's who are
+ * customizing the bean.
+ * @return Index of default property in the PropertyDescriptor array
+ * returned by getPropertyDescriptors.
+ * <P> Returns -1 if there is no default property.
+ */
+ int getDefaultPropertyIndex();
+
+ /**
+ * Gets the beans <code>MethodDescriptor</code>s.
+ *
+ * @return An array of MethodDescriptors describing the externally
+ * visible methods supported by this bean. May return null if
+ * the information should be obtained by automatic analysis.
+ */
+ MethodDescriptor[] getMethodDescriptors();
+
+ /**
+ * This method allows a BeanInfo object to return an arbitrary collection
+ * of other BeanInfo objects that provide additional information on the
+ * current bean.
+ * <P>
+ * If there are conflicts or overlaps between the information provided
+ * by different BeanInfo objects, then the current BeanInfo takes precedence
+ * over the getAdditionalBeanInfo objects, and later elements in the array
+ * take precedence over earlier ones.
+ *
+ * @return an array of BeanInfo objects. May return null.
+ */
+ BeanInfo[] getAdditionalBeanInfo();
+
+ /**
+ * This method returns an image object that can be used to
+ * represent the bean in toolboxes, toolbars, etc. Icon images
+ * will typically be GIFs, but may in future include other formats.
+ * <p>
+ * Beans aren't required to provide icons and may return null from
+ * this method.
+ * <p>
+ * There are four possible flavors of icons (16x16 color,
+ * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only
+ * support a single icon we recommend supporting 16x16 color.
+ * <p>
+ * We recommend that icons have a "transparent" background
+ * so they can be rendered onto an existing background.
+ *
+ * @param iconKind The kind of icon requested. This should be
+ * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
+ * ICON_MONO_16x16, or ICON_MONO_32x32.
+ * @return An image object representing the requested icon. May
+ * return null if no suitable icon is available.
+ */
+ java.awt.Image getIcon(int iconKind);
+
+ /**
+ * Constant to indicate a 16 x 16 color icon.
+ */
+ final static int ICON_COLOR_16x16 = 1;
+
+ /**
+ * Constant to indicate a 32 x 32 color icon.
+ */
+ final static int ICON_COLOR_32x32 = 2;
+
+ /**
+ * Constant to indicate a 16 x 16 monochrome icon.
+ */
+ final static int ICON_MONO_16x16 = 3;
+
+ /**
+ * Constant to indicate a 32 x 32 monochrome icon.
+ */
+ final static int ICON_MONO_32x32 = 4;
+}
Added: trunk/core/src/openjdk/java/java/beans/Beans.java
===================================================================
--- trunk/core/src/openjdk/java/java/beans/Beans.java (rev 0)
+++ trunk/core/src/openjdk/java/java/beans/Beans.java 2007-07-06 11:05:42 UTC (rev 3348)
@@ -0,0 +1,627 @@
+/*
+ * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.beans;
+
+import com.sun.beans.finder.ClassFinder;
+
+import java.applet.*;
+
+import java.awt.*;
+
+import java.beans.AppletInitializer;
+
+import java.beans.beancontext.BeanContext;
+
+import java.io.*;
+
+import java.lang.reflect.Constructor;
+
+import java.net.URL;
+import java.lang.reflect.Array;
+
+/**
+ * This class provides some general purpose beans control methods.
+ */
+
+public class Beans {
+
+ /**
+ * <p>
+ * Instantiate a JavaBean.
+ * </p>
+ *
+ * @param cls the class-loader from which we should create
+ * the bean. If this is null, then the system
+ * class-loader is used.
+ * @param beanName the name of the bean within the class-loader.
+ * For example "sun.beanbox.foobah"
+ *
+ * @exception java.lang.ClassNotFoundException if the class of a serialized
+ * object could not be found.
+ * @exception java.io.IOException if an I/O error occurs.
+ */
+
+ public static Object instantiate(ClassLoader cls, String beanName) throws java.io.IOException, ClassNotFoundException {
+ return Beans.instantiate(cls, beanName, null, null);
+ }
+
+ /**
+ * <p>
+ * Instantiate a JavaBean.
+ * </p>
+ *
+ * @param cls the class-loader from which we should create
+ * the bean. If this is null, then the system
+ * class-loader is used.
+ * @param beanName the name of the bean within the class-loader.
+ * For example "sun.beanbox.foobah"
+ * @param beanContext The BeanContext in which to nest the new bean
+ *
+ * @exception java.lang.ClassNotFoundException if the class of a serialized
+ * object could not be found.
+ * @exception java.io.IOException if an I/O error occurs.
+ */
+
+ public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws java.io.IOException, ClassNotFoundException {
+ return Beans.instantiate(cls, beanName, beanContext, null);
+ }
+
+ /**
+ * Instantiate a bean.
+ * <p>
+ * The bean is created based on a name relative to a class-loader.
+ * This name should be a dot-separated name such as "a.b.c".
+ * <p>
+ * In Beans 1.0 the given name can indicate either a serialized object
+ * or a class. Other mechanisms may be added in the future. In
+ * beans 1.0 we first try to treat the beanName as a serialized object
+ * name then as a class name.
+ * <p>
+ * When using the beanName as a serialized object name we convert the
+ * given beanName to a resource pathname and add a trailing ".ser" suffix.
+ * We then try to load a serialized object from that resource.
+ * <p>
+ * For example, given a beanName of "x.y", Beans.instantiate would first
+ * try to read a serialized object from the resource "x/y.ser" and if
+ * that failed it would try to load the class "x.y" and create an
+ * instance of that class.
+ * <p>
+ * If the bean is a subtype of java.applet.Applet, then it is given
+ * some special initialization. First, it is supplied with a default
+ * AppletStub and AppletContext. Second, if it was instantiated from
+ * a classname the applet's "init" method is called. (If the bean was
+ * deserialized this step is skipped.)
+ * <p>
+ * Note that for beans which are applets, it is the caller's responsiblity
+ * to call "start" on the applet. For correct behaviour, this should be done
+ * after the applet has been added into a visible AWT container.
+ * <p>
+ * Note that applets created via beans.instantiate run in a slightly
+ * different environment than applets running inside browsers. In
+ * particular, bean applets have no access to "parameters", so they may
+ * wish to provide property get/set methods to set parameter values. We
+ * advise bean-applet developers to test their bean-applets against both
+ * the JDK appletviewer (for a reference browser environment) and the
+ * BDK BeanBox (for a reference bean container).
+ *
+ * @param cls the class-loader from which we should create
+ * the bean. If this is null, then the system
+ * class-loader is used.
+ * @param beanName the name of the bean within the class-loader.
+ * For example "sun.beanbox.foobah"
+ * @param beanContext The BeanContext in which to nest the new bean
+ * @param initializer The AppletInitializer for the new bean
+ *
+ * @exception java.lang.ClassNotFoundException if the class of a serialized
+ * object could not be found.
+ * @exception java.io.IOException if an I/O error occurs.
+ */
+
+ public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
+ throws java.io.IOException, ClassNotFoundException {
+
+ java.io.InputStream ins;
+ java.io.ObjectInputStream oins = null;
+ Object result = null;
+ boolean serialized = false;
+ java.io.IOException serex = null;
+
+ // If the given classloader is null, we check if an
+ // system classloader is available and (if so)
+ // use that instead.
+ // Note that calls on the system class loader will
+ // look in the bootstrap class loader first.
+ if (cls == null) {
+ try {
+ cls = ClassLoader.getSystemClassLoader();
+ } catch (SecurityException ex) {
+ // We're not allowed to access the system class loader.
+ // Drop through.
+ }
+ }
+
+ // Try to find a serialized object with this name
+ final String serName = beanName.replace('.','/').concat(".ser");
+ final ClassLoader loader = cls;
+ ins = (InputStream)java.security.AccessController.doPrivileged
+ (new java.security.PrivilegedAction() {
+ public Object run() {
+ if (loader == null)
+ return ClassLoader.getSystemResourceAsStream(serName);
+ else
+ return loader.getResourceAsStream(serName);
+ }
+ });
+ if (ins != null) {
+ try {
+ if (cls == null) {
+ oins = new ObjectInputStream(ins);
+ } else {
+ oins = new ObjectInputStreamWithLoader(ins, cls);
+ }
+ result = oins.readObject();
+ serialized = true;
+ oins.close();
+ } catch (java.io.IOException ex) {
+ ins.close();
+ // Drop through and try opening the class. But remember
+ // the exception in case we can't find the class either.
+ serex = ex;
+ } catch (ClassNotFoundException ex) {
+ ins.close();
+ throw ex;
+ }
+ }
+
+ if (result == null) {
+ // No serialized object, try just instantiating the class
+ Class cl;
+
+ try {
+ cl = ClassFinder.findClass(beanName, cls);
+ } catch (ClassNotFoundException ex) {
+ // There is no appropriate class. If we earlier tried to
+ // deserialize an object and got an IO exception, throw that,
+ // otherwise rethrow the ClassNotFoundException.
+ if (serex != null) {
+ throw serex;
+ }
+ throw ex;
+ }
+
+ /*
+ * Try to instantiate the class.
+ */
+
+ try {
+ result = cl.newInstance();
+ } catch (Exception ex) {
+ // We have to remap the exception to one in our signature.
+ // But we pass extra information in the detail message.
+ throw new ClassNotFoundException("" + cl + " : " + ex, ex);
+ }
+ }
+
+ if (result != null) {
+
+ // Ok, if the result is an applet initialize it.
+
+ AppletStub stub = null;
+
+ if (result instanceof Applet) {
+ Applet applet = (Applet) result;
+ boolean needDummies = initializer == null;
+
+ if (needDummies) {
+
+ // Figure our the codebase and docbase URLs. We do this
+ // by locating the URL for a known resource, and then
+ // massaging the URL.
+
+ // First find the "resource name" corresponding to the bean
+ // itself. So a serialzied bean "a.b.c" would imply a
+ // resource name of "a/b/c.ser" and a classname of "x.y"
+ // would imply a resource name of "x/y.class".
+
+ final String resourceName;
+
+ if (serialized) {
+ // Serialized bean
+ resourceName = beanName.replace('.','/').concat(".ser");
+ } else {
+ // Regular class
+ resourceName = beanName.replace('.','/').concat(".class");
+ }
+
+ URL objectUrl = null;
+ URL codeBase = null;
+ URL docBase = null;
+
+ // Now get the URL correponding to the resource name.
+
+ final ClassLoader cloader = cls;
+ objectUrl = (URL)
+ java.security.AccessController.doPrivileged
+ (new java.security.PrivilegedAction() {
+ public Object run() {
+ if (cloader == null)
+ return ClassLoader.getSystemResource
+ (resourceName);
+ else
+ return cloader.getResource(resourceName);
+ }
+ });
+
+ // If we found a URL, we try to locate the docbase by taking
+ // of the final path name component, and the code base by taking
+ // of the complete resourceName.
+ // So if we had a resourceName of "a/b/c.class" and we got an
+ // objectURL of "file://bert/classes/a/b/c.class" then we would
+ // want to set the codebase to "file://bert/classes/" and the
+ // docbase to "file://bert/classes/a/b/"
+
+ if (objectUrl != null) {
+ String s = objectUrl.toExternalForm();
+
+ if (s.endsWith(resourceName)) {
+ int ix = s.length() - resourceName.length();
+ codeBase = new URL(s.substring(0,ix));
+ docBase = codeBase;
+
+ ix = s.lastIndexOf('/');
+
+ if (ix >= 0) {
+ docBase = new URL(s.substring(0,ix+1));
+ }
+ }
+ }
+
+ // Setup a default context and stub.
+ BeansAppletContext context = new BeansAppletContext(applet);
+
+ stub = (AppletStub)new BeansAppletStub(applet, context, codeBase, docBase);
+ applet.setStub(stub);
+ } else {
+ initializer.initialize(applet, beanContext);
+ }
+
+ // now, if there is a BeanContext, add the bean, if applicable.
+
+ if (beanContext != null) {
+ beanContext.add(result);
+ }
+
+ // If it was deserialized then it was already init-ed.
+ // Otherwise we need to initialize it.
+
+ if (!serialized) {
+ // We need to set a reasonable initial size, as many
+ // applets are unhappy if they are started without
+ // having been explicitly sized.
+ applet.setSize(100,100);
+ applet.init();
+ }
+
+ if (needDummies) {
+ ((BeansAppletStub)stub).active = true;
+ } else initializer.activate(applet);
+
+ } else if (beanContext != null) beanContext.add(result);
+ }
+
+ return result;
+ }
+
+
+ /**
+ * From a given bean, obtain an object representing a specified
+ * type view of that source object.
+ * <p>
+ * The result may be the same object or a different object. If
+ * the requested target view isn't available then the given
+ * bean is returned.
+ * <p>
+ * This method is provided in Beans 1.0 as a hook to allow the
+ * addition of more flexible bean behaviour in the future.
+ *
+ * @param bean Object from which we want to obtain a view.
+ * @param targetType The type of view we'd like to get.
+ *
+ */
+ public static Object getInstanceOf(Object bean, Class<?> targetType) {
+ return bean;
+ }
+
+ /**
+ * Check if a bean can be viewed as a given target type.
+ * The result will be true if the Beans.getInstanceof method
+ * can be used on the given bean to obtain an object that
+ * represents the specified targetType type view.
+ *
+ * @param bean Bean from which we want to obtain a view.
+ * @param targetType The type of view we'd like to get.
+ * @return "true" if the given bean supports the given targetType.
+ *
+ */
+ public static boolean isInstanceOf(Object bean, Class<?> targetType) {
+ return Introspector.isSubclass(bean.getClass(), targetType);
+ }
+
+
+ /**
+ * Test if we are in design-mode.
+ *
+ * @return True if we are running in an application construction
+ * environment.
+ *
+ * @see java.beans.DesignMode
+ */
+ public static boolean isDesignTime() {
+ return designTime;
+ }
+
+ /**
+ * Determines whether beans can assume a GUI is available.
+ *
+ * @return True if we are running in an environment where beans
+ * can assume that an interactive GUI is available, so they
+ * can pop up dialog boxes, etc. This will normally return
+ * true in a windowing environment, and will normally return
+ * false in a server environment or if an application is
+ * running as part of a batch job.
+ *
+ * @see java.beans.Visibility
+ *
+ */
+ public static boolean isGuiAvailable() {
+ return guiAvailable;
+ }
+
+ /**
+ * Used to indicate whether of not we are running in an application
+ * builder environment.
+ *
+ * <p>Note that this method is security checked
+ * and is not available to (for example) untrusted applets.
+ * More specifically, if there is a security manager,
+ * its <code>checkPropertiesAccess</code>
+ * method is called. This could result in a SecurityException.
+ *
+ * @param isDesignTime True if we're in an application builder tool.
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkPropertiesAccess</code> method doesn't allow setting
+ * of system properties.
+ * @see SecurityManager#checkPropertiesAccess
+ */
+
+ public static void setDesignTime(boolean isDesignTime)
+ throws SecurityException {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPropertiesAccess();
+ }
+ designTime = isDesignTime;
+ }
+
+ /**
+ * Used to indicate whether of not we are running in an environment
+ * where GUI interaction is available.
+ *
+ * <p>Note that this method is security checked
+ * and is not available to (for example) untrusted applets.
+ * More specifically, if there is a security manager,
+ * its <code>checkPropertiesAccess</code>
+ * method is called. This could result in a SecurityException.
+ *
+ * @param isGuiAvailable True if GUI interaction is available.
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkPropertiesAccess</code> method doesn't allow setting
+ * of system properties.
+ * @see SecurityManager#checkPropertiesAccess
+ */
+
+ public static void setGuiAvailable(boolean isGuiAvailable)
+ throws SecurityException {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPropertiesAccess();
+ }
+ guiAvailable = isGuiAvailable;
+ }
+
+
+ private static boolean designTime;
+ private static boolean guiAvailable;
+ static {
+ guiAvailable = !GraphicsEnvironment.isHeadless();
+ }
+}
+
+/**
+ * This subclass of ObjectInputStream delegates loading of classes to
+ * an existing ClassLoader.
+ */
+
+class ObjectInputStreamWithLoader extends ObjectInputStream
+{
+ private ClassLoader loader;
+
+ /**
+ * Loader must be non-null;
+ */
+
+ public ObjectInputStreamWithLoader(InputStream in, ClassLoader loader)
+ throws IOException, StreamCorruptedException {
+
+ super(in);
+ if (loader == null) {
+ throw new IllegalArgumentException("Illegal null argument to ObjectInputStreamWithLoader");
+ }
+ this.loader = loader;
+ }
+
+ /**
+ * Use the given ClassLoader rather than using the system class
+ */
+ protected Class resolveClass(ObjectStreamClass classDesc)
+ throws IOException, ClassNotFoundException {
+
+ String cname = classDesc.getName();
+ return ClassFinder.resolveClass(cname, this.loader);
+ }
+}
+
+/**
+ * Package private support class. This provides a default AppletContext
+ * for beans which are applets.
+ */
+
+class BeansAppletContext implements AppletContext {
+ Applet target;
+ java.util.Hashtable imageCache = new java.util.Hashtable();
+
+ BeansAppletContext(Applet target) {
+ this.target = target;
+ }
+
+ public AudioClip getAudioClip(URL url) {
+ // We don't currently support audio clips in the Beans.instantiate
+ // applet context, unless by some luck there exists a URL content
+ // class that can generate an AudioClip from the audio URL.
+ try {
+ return (AudioClip) url.getContent();
+ } catch (Exception ex) {
+ return null;
+ }
+ }
+
+ public synchronized Image getImage(URL url) {
+ Object o = imageCache.get(url);
+ if (o != null) {
+ return (Image)o;
+ }
+ try {
+ o = url.getContent();
+ if (o == null) {
+ return null;
+ }
+ if (o instanceof Image) {
+ imageCache.put(url, o);
+ return (Image) o;
+ }
+ // Otherwise it must be an ImageProducer.
+ Image img = target.createImage((java.awt.image.ImageProducer)o);
+ imageCache.put(url, img);
+ return img;
+
+ } catch (Exception ex) {
+ return null;
+ }
+ }
+
+ public Applet getApplet(String name) {
+ return null;
+ }
+
+ public java.util.Enumeration getApplets() {
+ java.util.Vector applets = new java.util.Vector();
+ applets.addElement(target);
+ return applets.elements();
+ }
+
+ public void showDocument(URL url) {
+ // We do nothing.
+ }
+
+ public void showDocument(URL url, String target) {
+ // We do nothing.
+ }
+
+ public void showStatus(String status) {
+ // We do nothing.
+ }
+
+ public void setStream(String key, InputStream stream)throws IOException{
+ // We do nothing.
+ }
+
+ public InputStream getStream(String key){
+ // We do nothing.
+ return null;
+ }
+
+ public java.util.Iterator getStreamKeys(){
+ // We do nothing.
+ return null;
+ }
+}
+
+/**
+ * Package private support class. This provides an AppletStub
+ * for beans which are applets.
+ */
+class BeansAppletStub implements AppletStub {
+ transient boolean active;
+ transient Applet target;
+ transient AppletContext context;
+ transient URL codeBase;
+ transient URL docBase;
+
+ BeansAppletStub(Applet target,
+ AppletContext context, URL codeBase,
+ URL docBase) {
+ this.target = target;
+ this.context = context;
+ this.codeBase = codeBase;
+ this.docBase = docBase;
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+ public URL getDocumentBase() {
+ // use the root directory of the applet's class-loader
+ return docBase;
+ }
+
+ public URL getCodeBase() {
+ // use the directory where we found the class or serialized object.
+ return codeBase;
+ }
+
+ public String getParameter(String name) {
+ return null;
+ }
+
+ public AppletContext getAppletContext() {
+ return context;
+ }
+
+ public void appletResize(int width, int height) {
+ // we do nothing.
+ }
+}
Added: trunk/core/src/openjdk/java/java/beans/ConstructorProperties.java
===================================================================
--- trunk/core/src/openjdk/java/java/beans/ConstructorProperties.java (rev 0)
+++ trunk/core/src/openjdk/java/java/beans/ConstructorProperties.java 2007-07-06 11:05:42 UTC (rev 3348)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.beans;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ <p>An annotation on a constructor that shows how the parameters of
+ that constructor correspond to the constructed object's getter
+ methods. For example:
+
+ <blockquote>
+<pre>
+ public class Point {
+ @ConstructorProperties({"x", "y"})
+ public Point(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public int getX() {
+ return x;
+ }
+
+ public int getY() {
+ return y;
+ }
+
+ private final int x, y;
+ }
+</pre>
+</blockquote>
+
+ The annotation shows that the first parameter of the constructor
+ can be retrieved with the {@code getX()} method and the second with
+ the {@code getY()} method. Since parameter names are not in
+ general available at runtime, without the annotation there would be
+ no way to know whether the parameters correspond to {@code getX()}
+ and {@code getY()} or the other way around.</p>
+
+ @since 1.6
+*/
+@Documented @Target(CONSTRUCTOR) @Retention(RUNTIME)
+public @interface ConstructorProperties {
+ /**
+ <p>The getter names.</p>
+ @return the getter names corresponding to the parameters in the
+ annotated constructor.
+ */
+ String[] value();
+}
Added: trunk/core/src/openjdk/java/java/beans/Customizer.java
===================================================================
--- trunk/core/src/openjdk/java/java/beans/Customizer.java (rev 0)
+++ trunk/core/src/openjdk/java/java/beans/Customizer.java 2007-07-06 11:05:42 UTC (rev 3348)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 1996 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.beans;
+
+/**
+ * A customizer class provides a complete custom GUI for customizing
+ * a target Java Bean.
+ * <P>
+ * Each customizer should inherit from the java.awt.Component class so
+ * it can be instantiated inside an AWT dialog or panel.
+ * <P>
+ * Each customizer should have a null constructor.
+ */
+
+public interface Customizer {
+
+ /**
+ * Set the object to be customized. This method should be called only
+ * once, before the Customizer has been added to any parent AWT container.
+ * @param bean The object to be customized.
+ */
+ void setObject(Object bean);
+
+ /**
+ * Register a listener for the PropertyChange event. The customizer
+ * should fire a PropertyChange event whenever it changes the target
+ * bean in a way that might require the displayed properties to be
+ * refreshed.
+ *
+ * @param listener An object to be invoked when a PropertyChange
+ * event is fired.
+ */
+ void addPropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ * Remove a listener for the PropertyChange event.
+ *
+ * @param listener The PropertyChange listener to be removed.
+ */
+ void removePropertyChangeListener(PropertyChangeListener listener);
+
+}
+
Added: trunk/core/src/openjdk/java/java/beans/DefaultPersistenceDelegate.java
===================================================================
--- trunk/core/src/openjdk/java/java/beans/DefaultPersistenceDelegate.java (rev 0)
+++ trunk/core/src/openjdk/java/java/beans/DefaultPersistenceDelegate.java 2007-07-06 11:05:42 UTC (rev 3348)
@@ -0,0 +1,412 @@
+/*
+ * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package java.beans;
+
+import java.util.*;
+import java.lang.reflect.*;
+import sun.reflect.misc.*;
+
+
+/**
+ * The <code>DefaultPersistenceDelegate</code> is a concrete implementation of
+ * the abstract <code>PersistenceDelegate</code> class and
+ * is the delegate used by default for classes about
+ * which no information is available. The <code>DefaultPersistenceDelegate</code>
+ * provides, version resilient, public API-based persistence for
+ * classes that follow the JavaBeans conventions without any class specific
+ * configuration.
+ * <p>
+ * The key assumptions are that the class has a nullary constructor
+ * and that its state is accurately represented by matching pairs
+ * of "setter" and "getter" methods in the order they are returned
+ * by the Introspector.
+ * In addition to providing code-free persistence for JavaBeans,
+ * the <code>DefaultPersistenceDelegate</code> provides a convenient means
+ * to effect persistent storage for classes that have a constructor
+ * that, while not nullary, simply requires some property values
+ * as arguments.
+ *
+ * @see #DefaultPersistenceDelegate(String[])
+ * @see java.beans.Introspector
+ *
+ * @since 1.4
+ *
+ * @version 1.27 05/05/07
+ * @author Philip Milne
+ */
+
+public class DefaultPersistenceDelegate extends PersistenceDelegate {
+ private String[] constructor;
+ private Boolean definesEquals;
+
+ /**
+ * Creates a persistence delegate for a class with a nullary constructor.
+ *
+ * @see #DefaultPersistenceDelegate(java.lang.String[])
+ */
+ public DefaultPersistenceDelegate() {
+ this(new String[0]);
+ }
+
+ /**
+ * Creates a default persistence delegate for a class with a
+ * constructor whose arguments are the values of the property
+ * names as specified by <code>constructorPropertyNames</code>.
+ * The constructor arguments are created by
+ * evaluating the property names in the order they are supplied.
+ * To use this class to specify a single preferred constructor for use
+ * in the serialization of a particular type, we state the
+ * names of the properties that make up the constructor's
+ * arguments. For example, the <code>Font</code> class which
+ * does not define a nullary constructor can be handled
+ * with the following persistence delegate:
+ *
+ * <pre>
+ * new DefaultPersistenceDelegate(new String[]{"name", "style", "size"});
+ * </pre>
+ *
+ * @param constructorPropertyNames The property names for the arguments of this constructor.
+ *
+ * @see #instantiate
+ */
+ public DefaultPersistenceDelegate(String[] constructorPropertyNames) {
+ this.constructor = constructorPropertyNames;
+ }
+
+ private static boolean definesEquals(Class type) {
+ try {
+ return type == type.getMethod("equals", Object.class).getDeclaringClass();
+ }
+ catch(NoSuchMethodException e) {
+ return false;
+ }
+ }
+
+ private boolean definesEquals(Object instance) {
+ if (definesEquals != null) {
+ return (definesEquals == Boolean.TRUE);
+ }
+ else {
+ boolean result = definesEquals(instance.getClass());
+ definesEquals = result ? Boolean.TRUE : Boolean.FALSE;
+ return result;
+ }
+ }
+
+ /**
+ * If the number of arguments in the specified constructor is non-zero and
+ * the class of <code>oldInstance</code> explicitly declares an "equals" method
+ * this method returns the value of <code>oldInstance.equals(newInstance)</code>.
+ * Otherwise, this method uses the superclass's definition which returns true if the
+ * classes of the two instances are equal.
+ *
+ * @param oldInstance The instance to be copied.
+ * @param newInstance The instance that is to be modified.
+ * @return True if an equivalent copy of <code>newInstance</code> may be
+ * created by applying a series of mutations to <code>oldInstance</code>.
+ *
+ * @see #DefaultPersistenceDelegate(String[])
+ */
+ protected boolean mutatesTo(Object oldInstance, Object newInstance) {
+ // Assume the instance is either mutable or a singleton
+ // if it has a nullary constructor.
+ return (constructor.length == 0) || !definesEquals(oldInstance) ?
+ super.mutatesTo(oldInstance, newInstance) :
+ oldInstance.equals(newInstance);
+ }
+
+ /**
+ * This default implementation of the <code>instantiate</code> method returns
+ * an expression containing the predefined method name "new" which denotes a
+ * call to a constructor with the arguments as specified in
+ * the <code>DefaultPersistenceDelegate</code>'s constructor.
+ *
+ * @param oldInstance The instance to be instantiated.
+ * @param out The code output stream.
+ * @return An expression whose value is <code>oldInstance</code>.
+ *
+ * @see #DefaultPersistenceDelegate(String[])
+ */
+ protected Expression instantiate(Object oldInstance, Encoder out) {
+ int nArgs = constructor.length;
+ Class type = oldInstance.getClass();
+ Object[] constructorArgs = new Object[nArgs];
+ for(int i = 0; i < nArgs; i++) {
+ try {
+ Method method = findMethod(type, this.constructor[i]);
+ constructorArgs[i] = MethodUtil.invoke(method, oldInstance, new Object[0]);
+ }
+ catch (Exception e) {
+ out.getExceptionListener().exceptionThrown(e);
+ }
+ }
+ return new Expression(oldInstance, oldInstance.getClass(), "new", constructorArgs);
+ }
+
+ private Method findMethod(Class type, String property) throws IntrospectionException {
+ if (property == null) {
+ throw new IllegalArgumentException("Property name is null");
+ }
+ BeanInfo info = Introspector.getBeanInfo(type);
+ for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
+ if (property.equals(pd.getName())) {
+ Method method = pd.getReadMethod();
+ if (method != null) {
+ return method;
+ }
+ throw new IllegalStateException("Could not find getter for the property " + property);
+ }
+ }
+ throw new IllegalStateException("Could not find property by the name " + property);
+ }
+
+ // This is a workaround for a bug in the introspector.
+ // PropertyDescriptors are not shared amongst subclasses.
+ private boolean isTransient(Class type, PropertyDescriptor pd) {
+ if (type == null) {
+ return false;
+ }
+ // This code was mistakenly deleted - it may be fine and
+ // is more efficient than the code below. This should
+ // all disappear anyway when property descriptors are shared
+ // by the introspector.
+ /*
+ Method getter = pd.getReadMethod();
+ Class declaringClass = getter.getDeclaringClass();
+ if (declaringClass == type) {
+ return Boolean.TRUE.equals(pd.getValue("transient"));
+ }
+ */
+ String pName = pd.getName();
+ BeanInfo info = MetaData.getBeanInfo(type);
+ PropertyDescriptor[] propertyDescriptors = info.getPropertyDescriptors();
+ for (int i = 0; i < propertyDescriptors.length; ++i ) {
+ PropertyDescriptor pd2 = propertyDescriptors[i];
+ if (pName.equals(pd2.getName())) {
+ Object value = pd2.getValue("transient");
+ if (value != null) {
+ return Boolean.TRUE.equals(value);
+ }
+ }
+ }
+ return isTransient(type.getSuperclass(), pd);
+ }
+
+ private static boolean equals(Object o1, Object o2) {
+ return (o1 == null) ? (o2 == null) : o1.equals(o2);
+ }
+
+ private void doProperty(Class type, PropertyDescriptor pd, Object oldInstance, Object newInstance, Encoder out) throws Exception {
+ Method getter = pd.getReadMethod();
+ Method setter = pd.getWriteMethod();
+
+ if (getter != null && setter != null && !isTransient(type, pd)) {
+ Expression oldGetExp = new Expression(oldInstance, getter.getName(), new Object[]{});
+ Expression newGetExp = new Expression(newInstance, getter.getName(), new Object[]{});
+ Object oldValue = oldGetExp.getValue();
+ Object newValue = newGetExp.getValue();
+ out.writeExpression(oldGetExp);
+ if (!equals(newValue, out.get(oldValue))) {
+ // Search for a static constant with this value;
+ Object e = (Object[])pd.getValue("enumerationValues");
+ if (e instanceof Object[] && Array.getLength(e) % 3 == 0) {
+ Object[] a = (Object[])e;
+ for(int i = 0; i < a.length; i = i + 3) {
+ try {
+ Field f = type.getField((String)a[i]);
+ if (f.get(null).equals(oldValue)) {
+ out.remove(oldValue);
+ out.writeExpression(new Expression(oldValue, f, "get", new Object[]{null}));
+ }
+ }
+ catch (Exception ex) {}
+ }
+ }
+ invokeStatement(oldInstance, setter.getName(), new Object[]{oldValue}, out);
+ }
+ }
+ }
+
+ static void invokeStatement(Object instance, String methodName, Object[] args, Encoder out) {
+ out.writeStatement(new Statement(instance, methodName, args));
+ }
+
+ // Write out the properties of this instance.
+ private void initBean(Class type, Object oldInstance, Object newInstance, Encoder out) {
+ // System.out.println("initBean: " + oldInstance);
+ BeanInfo info = MetaData.getBeanInfo(type);
+
+ // Properties
+ PropertyDescriptor[] propertyDescriptors = info.getPropertyDescriptors();
+ for (int i = 0; i < propertyDescriptors.length; ++i ) {
+ try {
+ doProperty(type, propertyDescriptors[i], oldInstance, newInstance, out);
+ }
+ catch (Exception e) {
+ out.getExceptionListener().exceptionThrown(e);
+ }
+ }
+
+ // Listeners
+ /*
+ Pending(milne). There is a general problem with the archival of
+ listeners which is unresolved as of 1.4. Many of the methods
+ which install one object inside another (typically "add" methods
+ or setters) automatically install a listener on the "child" object
+ so that its "parent" may respond to changes that are made to it.
+ For example the JTable:setModel() method automatically adds a
+ TableModelListener (the JTable itself in this case) to the supplied
+ table model.
+
+ We do not need to explictly add these listeners to the model in an
+ archive as they will be added automatically by, in the above case,
+ the JTable's "setModel" method. In some cases, we must specifically
+ avoid trying to do this since the listener may be an inner class
+ that cannot be instantiated using public API.
+
+ No general mechanism currently
+ exists for differentiating between these kind of listeners and
+ those which were added explicitly by the user. A mechanism must
+ be created to provide a general means to differentiate these
+ special cases so as to provide reliable persistence of listeners
+ for the general case.
+ */
+ if (!java.awt.Component.class.isAssignableFrom(type)) {
+ return; // Just handle the listeners of Components for now.
+ }
+ EventSetDescriptor[] eventSetDescriptors = info.getEventSetDescriptors();
+ for (int e = 0; e < eventSetDescriptors.length; e++) {
+ EventSetDescriptor d = eventSetDescriptors[e];
+ Class listenerType = d.getListenerType();
+
+
+ // The ComponentListener is added automatically, when
+ // Contatiner:add is called on the parent.
+ if (listenerType == java.awt.event.ComponentListener.class) {
+ continue;
+ }
+
+ // JMenuItems have a change listener added to them in
+ // their "add" methods to enable accessibility support -
+ // see the add method in JMenuItem for details. We cannot
+ // instantiate this instance as it is a private inner class
+ ...
[truncated message content] |
|
From: <ls...@us...> - 2007-07-06 11:04:10
|
Revision: 3347
http://jnode.svn.sourceforge.net/jnode/?rev=3347&view=rev
Author: lsantha
Date: 2007-07-06 04:04:09 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/java/java/beans/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-01 09:25:24
|
Revision: 3346
http://jnode.svn.sourceforge.net/jnode/?rev=3346&view=rev
Author: lsantha
Date: 2007-07-01 02:25:23 -0700 (Sun, 01 Jul 2007)
Log Message:
-----------
Simplified code.
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/fs/jfat/command/JGrubInstallCommand.java
Modified: trunk/fs/src/fs/org/jnode/fs/jfat/command/JGrubInstallCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jfat/command/JGrubInstallCommand.java 2007-07-01 09:07:44 UTC (rev 3345)
+++ trunk/fs/src/fs/org/jnode/fs/jfat/command/JGrubInstallCommand.java 2007-07-01 09:25:23 UTC (rev 3346)
@@ -53,27 +53,24 @@
public class JGrubInstallCommand implements Command {
static final DeviceArgument ARG_DEVICE = new DeviceArgument("device", "device where grub will be installed");
static final FileArgument ARG_DIR = new FileArgument("directory", "the directory for stage2 and menu.lst");
- static final OptionArgument TYPE = new OptionArgument("action",
- "Type parameter",
- new OptionArgument.Option[] { new OptionArgument.Option("-p",
- "Set the partition point for installing Stage2,menu.lst") });
- static final OptionArgument PS_VAL = new OptionArgument("Partition Value",
- "Setting The Partition value like (-p 1) for the hdx1", new OptionArgument.Option[] {
- new OptionArgument.Option("0", "hdX0"),
- new OptionArgument.Option("1", "hdX1"),
- new OptionArgument.Option("2", "hdX2"),
- new OptionArgument.Option("3", "hdX3")
- });
+ static final OptionArgument TYPE = new OptionArgument("action","Type parameter",
+ new OptionArgument.Option("-p","Set the partition point for installing Stage2,menu.lst"));
+ static final OptionArgument PS_VAL = new OptionArgument("Partition Value",
+ "Setting The Partition value like (-p 1) for the hdx1",
+ new OptionArgument.Option("0", "hdX0"),
+ new OptionArgument.Option("1", "hdX1"),
+ new OptionArgument.Option("2", "hdX2"),
+ new OptionArgument.Option("3", "hdX3"));
- static final Help.Info HELP_INFO = new Help.Info ("grub", "Install the grub to the specified location.", new Parameter[] {
+ static final Help.Info HELP_INFO = new Help.Info("grub",
+ "Install the grub to the specified location.",
new Parameter(ARG_DEVICE, Parameter.MANDATORY),
new Parameter(TYPE,Parameter.MANDATORY),
new Parameter(PS_VAL,Parameter.MANDATORY),
- new Parameter(ARG_DIR,Parameter.MANDATORY),
- });
+ new Parameter(ARG_DIR,Parameter.MANDATORY));
/**
* @param args
* @throws Exception
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-01 09:07:45
|
Revision: 3345
http://jnode.svn.sourceforge.net/jnode/?rev=3345&view=rev
Author: lsantha
Date: 2007-07-01 02:07:44 -0700 (Sun, 01 Jul 2007)
Log Message:
-----------
Minimal XMLisation of comments.
Modified Paths:
--------------
trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java
Modified: trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java 2007-07-01 09:03:38 UTC (rev 3344)
+++ trunk/core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java 2007-07-01 09:07:44 UTC (rev 3345)
@@ -457,7 +457,7 @@
*/
public void endInlinedMethod(VmMethod previousMethod) {
if (log) {
- os.log("End of inlined method");
+ os.log("End of inlined method</inline>");
}
// Do some housekeeping
helper.setMethod(previousMethod);
@@ -1017,7 +1017,7 @@
*/
public void startInlinedMethodCode(VmMethod inlinedMethod, int newMaxLocals) {
if (log) {
- os.log("Start of inlined method code");
+ os.log("<inline name=\""+inlinedMethod.getName() + "\">Start of inlined method code");
}
if (debug) {
BootLog.debug("startInlinedMethodCode(" + inlinedMethod + ")");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|