You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/03/26 00:12:17 UTC

svn commit: r758461 [7/47] - in /incubator/pivot/branches: ./ 1.1/ 1.1/charts-test/ 1.1/charts-test/src/ 1.1/charts-test/src/pivot/ 1.1/charts-test/src/pivot/charts/ 1.1/charts-test/src/pivot/charts/test/ 1.1/charts/ 1.1/charts/lib/ 1.1/charts/src/ 1.1...

Added: incubator/pivot/branches/1.1/core/src/pivot/util/Version.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/Version.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/Version.java (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/Version.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.util;
+
+import java.io.Serializable;
+
+/**
+ * Represents a version number. Version numbers are defined as:
+ * <p>
+ * <i>major</i>.<i>minor</i>.<i>maintenance</i>_<i>update</i>
+ * <p>
+ * for example, "JDK 1.6.0_10".
+ *
+ * @author gbrown
+ */
+public class Version implements Comparable<Version>, Serializable {
+    private static final long serialVersionUID = 0;
+
+    private byte majorRevision = 0;
+    private byte minorRevision = 0;
+    private byte maintenanceRevision = 0;
+    private byte updateRevision = 0;
+
+    public Version(int majorRevision, int minorRevision, int maintenanceRevision,
+        int updateRevision) {
+        if (majorRevision > 0x7f) {
+            throw new IllegalArgumentException("majorRevision must be less than "
+                + 0x7f + ".");
+        }
+
+        if (minorRevision > 0xff) {
+            throw new IllegalArgumentException("minorRevision must be less than "
+                + 0xff + ".");
+        }
+
+        if (maintenanceRevision > 0xff) {
+            throw new IllegalArgumentException("maintenanceRevision must be less than "
+                + 0xff + ".");
+        }
+
+        if (updateRevision > 0xff) {
+            throw new IllegalArgumentException("updateRevision must be less than "
+                + 0xff + ".");
+        }
+
+        this.majorRevision = (byte)majorRevision;
+        this.minorRevision = (byte)minorRevision;
+        this.maintenanceRevision = (byte)maintenanceRevision;
+        this.updateRevision = (byte)updateRevision;
+    }
+
+    public byte getMajorRevision() {
+        return majorRevision;
+    }
+
+    public byte getMinorRevision() {
+        return minorRevision;
+    }
+
+    public byte getMaintenanceRevision() {
+        return maintenanceRevision;
+    }
+
+    public byte getUpdateRevision() {
+        return updateRevision;
+    }
+
+    public int getNumber() {
+        int number = (((int)majorRevision) & 0xff) << (8 * 3)
+            | (((int)minorRevision) & 0xff) << (8 * 2)
+            | (((int)maintenanceRevision) & 0xff) << (8 * 1)
+            | (((int)updateRevision) & 0xff) << (8 * 0);
+
+        return number;
+    }
+
+    public int compareTo(Version version) {
+        return (getNumber() - version.getNumber());
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        return (compareTo((Version)object) == 0);
+    }
+
+    @Override
+    public int hashCode() {
+        return getNumber();
+    }
+
+    @Override
+    public String toString() {
+        String string = majorRevision
+            + "." + minorRevision
+            + "." + maintenanceRevision
+            + "_" + updateRevision;
+
+        return string;
+    }
+
+    public static Version decode(String string) {
+        byte majorRevision = 0;
+        byte minorRevision = 0;
+        byte maintenanceRevision = 0;
+        byte updateRevision = 0;
+
+        String[] revisionNumbers = string.split("\\.");
+
+        if (revisionNumbers.length > 0) {
+            majorRevision = Byte.parseByte(revisionNumbers[0]);
+
+            if (revisionNumbers.length > 1) {
+                minorRevision = Byte.parseByte(revisionNumbers[1]);
+
+                if (revisionNumbers.length > 2) {
+                    String[] maintenanceRevisionNumbers = revisionNumbers[2].split("_");
+
+                    if (maintenanceRevisionNumbers.length > 0) {
+                        maintenanceRevision = Byte.parseByte(maintenanceRevisionNumbers[0]);
+
+                        if (maintenanceRevisionNumbers.length > 1) {
+                            updateRevision = Byte.parseByte(maintenanceRevisionNumbers[1]);
+                        }
+                    }
+                }
+            }
+        }
+
+        return new Version(majorRevision, minorRevision, maintenanceRevision,
+            updateRevision);
+    }
+}

Added: incubator/pivot/branches/1.1/core/src/pivot/util/Vote.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/Vote.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/Vote.java (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/Vote.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.util;
+
+/**
+ * Enumeration representing a vote. Votes are often used to determine the
+ * result of an event preview.
+ *
+ * @author gbrown
+ */
+public enum Vote {
+    APPROVE(true),
+    DENY(false),
+    DEFER(false);
+
+    private boolean approved;
+
+    private Vote(boolean approved) {
+        this.approved = approved;
+    }
+
+    public Vote tally(Vote vote) {
+        Vote tally;
+
+        switch(vote) {
+            case APPROVE: {
+                tally = this;
+                break;
+            }
+
+            case DENY: {
+                tally = vote;
+                break;
+            }
+
+            case DEFER: {
+                tally = (this == DENY) ? this : vote;
+                break;
+            }
+
+            default: {
+                throw new IllegalArgumentException();
+            }
+        }
+
+        return tally;
+    }
+
+    public boolean isApproved() {
+        return approved;
+    }
+
+    public static Vote decode(String value) {
+        return valueOf(value.toUpperCase());
+    }
+}

Added: incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/AbortException.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/AbortException.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/AbortException.java (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/AbortException.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.util.concurrent;
+
+/**
+ * Thrown when a task is aborted.
+ *
+ * @author gbrown
+ */
+public class AbortException extends RuntimeException {
+    private static final long serialVersionUID = 0;
+
+    public AbortException() {
+        super();
+    }
+
+    public AbortException(String message) {
+        super(message);
+    }
+}

Added: incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/Dispatcher.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/Dispatcher.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/Dispatcher.java (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/Dispatcher.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.util.concurrent;
+
+import pivot.collections.ArrayQueue;
+import pivot.collections.Queue;
+import pivot.collections.concurrent.SynchronizedQueue;
+
+/**
+ * Operates a thread pool for dispatching runnable tasks. Runnables are
+ * added to a pending queue and dispatched as threads become available to
+ * execute them.
+ * <p>
+ * TODO This class is currently functional but not complete. Runnables are
+ * currently dispatched as soon as they are added to the queue. Need to complete
+ * the pooling implementation.
+ * <p>
+ * TODO Add a flag that allows the monitor thread to run as a non-daemon, and
+ * define a shutdown() or cancel() method that will stop the thread. This will
+ * allow ApplicationContext to control the dispatcher lifecycle and prevent
+ * the thread from being randomly killed by applets.
+ * <p>
+ * TODO Is there a way to throw an AbortException when an item is removed
+ * from the queue, without having to rely on methods like abort()?
+ *
+ * @author gbrown
+ * @author tvolkert
+ */
+public class Dispatcher {
+    private class MonitorThread extends Thread {
+        public MonitorThread() {
+            super(Dispatcher.this.getClass().getName() + "-MonitorThread");
+
+            // Mark this thread as a daemon
+            setDaemon(true);
+        }
+
+        public void run() {
+            while (true) {
+                // Block until an entry is available
+                Runnable runnable = pendingQueue.dequeue();
+
+                // When our thread group is disposed, this thread will get
+                // interrupted, and the #dequeue() call will return null
+                if (runnable == null) {
+                    break;
+                }
+
+                // TODO Use the thread pool
+                Thread workerThread = new Thread(runnable,
+                    Dispatcher.this.getClass().getName() + "-WorkerThread");
+                workerThread.start();
+            }
+        }
+    }
+
+    private Queue<Runnable> pendingQueue = null;
+
+    /*
+    private int minimumThreadCount = 0;
+    private int maximumThreadCount = 0;
+    private List<Thread> threadPool = null;
+    */
+
+    private Thread queueMonitorThread = null;
+
+    public Dispatcher() {
+        this(0, 10);
+    }
+
+    public Dispatcher(int minimumThreadCount, int maximumThreadCount) {
+        // TODO Use a linked queue for performance
+        pendingQueue = new SynchronizedQueue<Runnable>(new ArrayQueue<Runnable>());
+
+        // TODO
+        /*
+        this.minimumThreadCount = minimumThreadCount;
+        this.maximumThreadCount = maximumThreadCount;
+
+        // TODO Start minimum number of pool threads
+        threadPool = new ArrayList<Thread>(maximumThreadCount);
+        */
+    }
+
+    /**
+     * Returns a reference to the dispatcher's pending runnable queue.
+     *
+     * @return
+     * A synchronized queue from which the dispatcher will withdraw runnables.
+     */
+    public Queue<Runnable> getPendingQueue() {
+        // TODO We need to check for isAlive() here because the Java Plugin
+        // appears to kill the thread when navigating between pages. Revisit
+        // this after J6u10 is generally available.
+
+        if (queueMonitorThread == null
+            || !queueMonitorThread.isAlive()) {
+            queueMonitorThread = new MonitorThread();
+            queueMonitorThread.start();
+        }
+
+        return pendingQueue;
+    }
+}

Added: incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/SynchronizedListenerList.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/SynchronizedListenerList.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/SynchronizedListenerList.java (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/SynchronizedListenerList.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.util.concurrent;
+
+import java.util.Iterator;
+
+import pivot.util.ListenerList;
+
+/**
+ * Abstract base class for synchronized listener lists.
+ *
+ * @see pivot.util.ListenerList
+ *
+ * @author gbrown
+ */
+public abstract class SynchronizedListenerList<T> extends ListenerList<T> {
+    public synchronized void add(T listener) {
+        super.add(listener);
+    }
+
+    public synchronized void remove(T listener) {
+        super.remove(listener);
+    }
+
+    /**
+     * NOTE Callers must manually synchronize on the SynchronizedListenerList
+     * instance to ensure thread safety during iteration.
+     */
+    public Iterator<T> iterator() {
+        return super.iterator();
+    }
+}

Added: incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/Task.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/Task.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/Task.java (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/Task.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.util.concurrent;
+
+/**
+ * Abstract base class for "tasks". A task is an asynchronous operation that
+ * may optionally return a value.
+ *
+ * @param V
+ * The type of the value returned by the operation. May be {@link Void} to
+ * indicate that the task does not return a value.
+ *
+ * @author gbrown
+ */
+public abstract class Task<V> {
+    /**
+     * Task execution callback that is posted to the dispatcher queue.
+     */
+    private class ExecuteCallback implements Runnable {
+        public void run() {
+            V result = null;
+            Exception fault = null;
+
+            try {
+                result = execute();
+            }
+            catch(Exception exception) {
+                fault = exception;
+            }
+
+            TaskListener<V> taskListener;
+            synchronized(Task.this) {
+                Task.this.result = result;
+                Task.this.fault = fault;
+
+                abort = false;
+
+                taskListener = Task.this.taskListener;
+                Task.this.taskListener = null;
+            }
+
+            if (fault == null) {
+                taskListener.taskExecuted(Task.this);
+            }
+            else {
+                taskListener.executeFailed(Task.this);
+            }
+        }
+    }
+
+    private Dispatcher dispatcher = null;
+
+    private V result = null;
+    private Exception fault = null;
+    private TaskListener<V> taskListener = null;
+
+    protected volatile long timeout = Long.MAX_VALUE;
+    protected volatile boolean abort = false;
+
+    private ExecuteCallback executeCallback = null;
+
+    private static Dispatcher DEFAULT_DISPATCHER = new Dispatcher();
+
+    public Task() {
+        this(DEFAULT_DISPATCHER);
+    }
+
+    public Task(Dispatcher dispatcher) {
+        if (dispatcher == null) {
+            throw new IllegalArgumentException("dispatcher is null.");
+        }
+
+        this.dispatcher = dispatcher;
+    }
+
+    /**
+     * Synchronously executes the task.
+     *
+     * @return
+     * The result of the task's execution.
+     *
+     * @throws TaskExecutionException
+     * If an error occurs while executing the task.
+     */
+    public abstract V execute() throws TaskExecutionException;
+
+    /**
+     * Asynchronously executes the task. The caller is notified of the task's
+     * completion via the listener argument. Note that the listener will be
+     * notified on the task's worker thread, not on the thread that executed
+     * the task.
+     *
+     * @param taskListener
+     * The listener to be notified when the task completes.
+     */
+    public synchronized void execute(TaskListener<V> taskListener) {
+        if (taskListener == null) {
+            throw new IllegalArgumentException("taskListener is null.");
+        }
+
+        if (this.taskListener != null) {
+            throw new IllegalThreadStateException("Task is already pending.");
+        }
+
+        this.taskListener = taskListener;
+
+        result = null;
+        fault = null;
+        abort = false;
+
+        // Create a new execute callback and post it to the dispatcher
+        executeCallback = new ExecuteCallback();
+        dispatcher.getPendingQueue().enqueue(executeCallback);
+    }
+
+    /**
+     * Returns the dispatcher used to execute this task.
+     */
+    public Dispatcher getDispatcher() {
+        return dispatcher;
+    }
+
+    /**
+     * Returns the result of executing the task.
+     *
+     * @return
+     * The task result, or <tt>null</tt> if the task is still executing or
+     * has failed. The result itself may also be <tt>null</tt>; callers should
+     * call {@link #isPending()} and {@link #getFault()} to distinguish
+     * between these cases.
+     */
+    public synchronized V getResult() {
+        return result;
+    }
+
+    /**
+     * Returns the fault that occurred while executing the task.
+     *
+     * @return
+     * The task fault, or <tt>null</tt> if the task is still executing or
+     * has succeeded. Callers should call {@link #isPending()} to distinguish
+     * between these cases.
+     */
+    public synchronized Exception getFault() {
+        return fault;
+    }
+
+    /**
+     * Returns the pending state of the task.
+     *
+     * @return
+     * <tt>true</tt> if the task is awaiting execution or currently executing;
+     * <tt>false</tt>, otherwise.
+     */
+    public synchronized boolean isPending() {
+        return (taskListener != null);
+    }
+
+
+    /**
+     * Returns the timeout value for this task.
+     *
+     * @see #setTimeout(long)
+     */
+    public synchronized long getTimeout() {
+        return timeout;
+    }
+
+    /**
+     * Sets the timeout value for this task. It is the responsibility of the
+     * implementing class to respect this value.
+     *
+     * @param timeout
+     * The time by which the task must complete execution. If the timeout is
+     * exceeded, a {@link TimeoutException} will be thrown.
+     */
+    public synchronized void setTimeout(long timeout) {
+        this.timeout = timeout;
+    }
+
+    /**
+     * Sets the abort flag for this task to <tt>true</tt>. It is the
+     * responsibility of the implementing class to respect this value and
+     * throw a {@link AbortException}.
+     */
+    public synchronized void abort() {
+        if (taskListener == null) {
+            throw new IllegalStateException("Task is not currently pending.");
+        }
+
+        abort = true;
+    }
+}

Added: incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskExecutionException.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskExecutionException.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskExecutionException.java (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskExecutionException.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.util.concurrent;
+
+/**
+ * Thrown when an error occurs during task execution.
+ *
+ * @author gbrown
+ */
+public class TaskExecutionException extends Exception {
+    private static final long serialVersionUID = 0;
+
+    public TaskExecutionException() {
+        super();
+    }
+
+    public TaskExecutionException(String message) {
+        super(message);
+    }
+
+    public TaskExecutionException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public TaskExecutionException(Throwable cause) {
+        super(cause);
+    }
+}

Added: incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskGroup.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskGroup.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskGroup.java (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskGroup.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.util.concurrent;
+
+import java.util.Iterator;
+
+import pivot.collections.Group;
+import pivot.collections.HashMap;
+import pivot.util.ImmutableIterator;
+
+/**
+ * Class that runs a group of tasks in parallel and notifies listeners
+ * when all tasks are complete. Callers can retrieve task results or faults by
+ * calling {@link Task#getResult()} and {@link Task#getFault()},
+ * respectively.
+ *
+ * @author tvolkert
+ * @author gbrown
+ */
+public class TaskGroup<V> extends Task<Void>
+    implements Group<Task<V>>, Iterable<Task<V>> {
+    private class TaskHandler implements TaskListener<V> {
+        public void taskExecuted(Task<V> task) {
+            synchronized (TaskGroup.this) {
+                tasks.put(task, Boolean.TRUE);
+                TaskGroup.this.notify();
+            }
+        }
+
+        public void executeFailed(Task<V> task) {
+            synchronized (TaskGroup.this) {
+                tasks.put(task, Boolean.TRUE);
+                TaskGroup.this.notify();
+            }
+        }
+    }
+
+    private HashMap<Task<V>, Boolean> tasks = new HashMap<Task<V>, Boolean>();
+    private boolean executing = false;
+
+    public TaskGroup() {
+        super();
+    }
+
+    public TaskGroup(Dispatcher dispatcher) {
+        super(dispatcher);
+    }
+
+    @Override
+    public synchronized Void execute() throws TaskExecutionException {
+        executing = true;
+
+        try {
+            TaskHandler taskHandler = new TaskHandler();
+
+            for (Task<V> task : tasks) {
+                tasks.put(task, Boolean.FALSE);
+                task.execute(taskHandler);
+            }
+
+            boolean complete = false;
+
+            while (!complete) {
+                try {
+                    wait();
+                } catch (InterruptedException ex) {
+                    throw new TaskExecutionException(ex);
+                }
+
+                complete = true;
+                for (Task<V> task : tasks) {
+                    if (!tasks.get(task)) {
+                        complete = false;
+                        break;
+                    }
+                }
+            }
+        } finally {
+            executing = false;
+        }
+
+        return null;
+    }
+
+    public synchronized void add(Task<V> element) {
+        if (executing) {
+            throw new IllegalStateException("Task group is executing.");
+        }
+
+        tasks.put(element, Boolean.FALSE);
+    }
+
+    public synchronized void remove(Task<V> element) {
+        if (executing) {
+            throw new IllegalStateException("Task group is executing.");
+        }
+
+        tasks.remove(element);
+    }
+
+    public boolean contains(Task<V> element) {
+        return tasks.containsKey(element);
+    }
+
+    public boolean isEmpty() {
+        return tasks.isEmpty();
+    }
+
+    public Iterator<Task<V>> iterator() {
+        return new ImmutableIterator<Task<V>>(tasks.iterator());
+    }
+}

Added: incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskListener.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskListener.java (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskListener.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.util.concurrent;
+
+/**
+ * Task listener interface.
+ *
+ * @param <V>
+ * The return type of the task.
+ *
+ * @author gbrown
+ */
+public interface TaskListener<V> {
+    /**
+     * Called when the task has completed successfully.
+     *
+     * @param task
+     * The source of the task event.
+     */
+    public void taskExecuted(Task<V> task);
+
+    /**
+     * Called when task execution has failed.
+     *
+     * @param task
+     * The source of the task event.
+     */
+    public void executeFailed(Task<V> task);
+}

Added: incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskSequence.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskSequence.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskSequence.java (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TaskSequence.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.util.concurrent;
+
+import java.util.Iterator;
+
+import pivot.collections.ArrayList;
+import pivot.collections.Sequence;
+import pivot.util.ImmutableIterator;
+
+/**
+ * Class that runs a sequence of tasks in series and notifies listeners
+ * when all tasks are complete. Callers can retrieve task results or faults by
+ * calling {@link Task#getResult()} and {@link Task#getFault()},
+ * respectively.
+ *
+ * @author gbrown
+ */
+public class TaskSequence<V> extends Task<Void>
+    implements Sequence<Task<V>>, Iterable<Task<V>> {
+    private ArrayList<Task<V>> tasks = new ArrayList<Task<V>>();
+    private int activeTaskIndex = -1;
+
+    public TaskSequence() {
+        super();
+    }
+
+    public TaskSequence(Dispatcher dispatcher) {
+        super(dispatcher);
+    }
+
+    @Override
+    public synchronized Void execute() throws TaskExecutionException {
+        TaskListener<V> taskListener = new TaskListener<V>() {
+            public void taskExecuted(Task<V> task) {
+                synchronized (TaskSequence.this) {
+                    TaskSequence.this.notify();
+                }
+            }
+
+            public void executeFailed(Task<V> task) {
+                synchronized (TaskSequence.this) {
+                    TaskSequence.this.notify();
+                }
+            }
+        };
+
+        activeTaskIndex = 0;
+
+        while (activeTaskIndex < tasks.getLength()) {
+            Task<V> activeTask = tasks.get(activeTaskIndex);
+            activeTask.execute(taskListener);
+
+            try {
+                wait();
+            } catch (InterruptedException exception) {
+                throw new TaskExecutionException(exception);
+            }
+
+            activeTaskIndex++;
+        }
+
+        activeTaskIndex = -1;
+
+        return null;
+    }
+
+    public int add(Task<V> task) {
+        int index = tasks.getLength();
+        insert(task, index);
+
+        return index;
+    }
+
+    public synchronized void insert(Task<V> task, int index) {
+        if (activeTaskIndex != -1) {
+            throw new IllegalStateException();
+        }
+
+        tasks.insert(task, index);
+    }
+
+    public synchronized Task<V> update(int index, Task<V> task) {
+        if (activeTaskIndex != -1) {
+            throw new IllegalStateException();
+        }
+
+        return tasks.update(index, task);
+    }
+
+    public int remove(Task<V> task) {
+        int index = tasks.indexOf(task);
+        if (index != -1) {
+            tasks.remove(index, 1);
+        }
+
+        return index;
+    }
+
+    public synchronized Sequence<Task<V>> remove(int index, int count) {
+        if (activeTaskIndex != -1) {
+            throw new IllegalStateException();
+        }
+
+        return tasks.remove(index, count);
+    }
+
+    public Task<V> get(int index) {
+        return tasks.get(index);
+    }
+
+
+    public int indexOf(Task<V> task) {
+        return tasks.indexOf(task);
+    }
+
+    public int getLength() {
+        return tasks.getLength();
+    }
+
+    public Iterator<Task<V>> iterator() {
+        return new ImmutableIterator<Task<V>>(tasks.iterator());
+    }
+}

Added: incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TimeoutException.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TimeoutException.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TimeoutException.java (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/TimeoutException.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.util.concurrent;
+
+/**
+ * Thrown when an executing task has timed out.
+ *
+ * @author gbrown
+ */
+public class TimeoutException extends RuntimeException {
+    private static final long serialVersionUID = 0;
+
+    public TimeoutException() {
+        super();
+    }
+
+    public TimeoutException(String message) {
+        super(message);
+    }
+}

Added: incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/package.html
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/package.html?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/package.html (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/concurrent/package.html Wed Mar 25 23:08:38 2009
@@ -0,0 +1,6 @@
+<html>
+<head></head>
+<body>
+<p>Provides a set of classes to simplify the execution of background tasks.</p>
+</body>
+</html>

Added: incubator/pivot/branches/1.1/core/src/pivot/util/package.html
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/core/src/pivot/util/package.html?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/core/src/pivot/util/package.html (added)
+++ incubator/pivot/branches/1.1/core/src/pivot/util/package.html Wed Mar 25 23:08:38 2009
@@ -0,0 +1,6 @@
+<html>
+<head></head>
+<body>
+<p>Contains a collection of common utility classes.</p>
+</body>
+</html>

Added: incubator/pivot/branches/1.1/demos/.classpath
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/.classpath?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/demos/.classpath (added)
+++ incubator/pivot/branches/1.1/demos/.classpath Wed Mar 25 23:08:38 2009
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/core"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/web"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/wtk"/>
+	<classpathentry kind="lib" path="lib/gdata-base-1.0.jar"/>
+	<classpathentry kind="lib" path="lib/gdata-client-1.0.jar"/>
+	<classpathentry kind="lib" path="lib/gdata-client-meta-1.0.jar"/>
+	<classpathentry kind="lib" path="lib/gdata-contacts-1.0.jar"/>
+	<classpathentry kind="lib" path="lib/gdata-contacts-meta-1.0.jar"/>
+	<classpathentry kind="lib" path="lib/gdata-core-1.0.jar"/>
+	<classpathentry kind="lib" path="lib/smack.jar"/>
+	<classpathentry kind="lib" path="lib/smackx.jar"/>
+	<classpathentry kind="lib" path="lib/flex-messaging-core.jar"/>
+	<classpathentry kind="lib" path="lib/flex-messaging-common.jar"/>
+	<classpathentry kind="lib" path="classes"/>
+	<classpathentry kind="lib" path="lib/gdata-media-1.0.jar"/>
+	<classpathentry kind="lib" path="lib/groovy-all-1.5.6.jar"/>
+	<classpathentry kind="lib" path="lib/groovy-engine.jar"/>
+	<classpathentry kind="lib" path="lib/js.jar"/>
+	<classpathentry kind="lib" path="lib/js-engine.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: incubator/pivot/branches/1.1/demos/.project
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/.project?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/demos/.project (added)
+++ incubator/pivot/branches/1.1/demos/.project Wed Mar 25 23:08:38 2009
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>demos</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: incubator/pivot/branches/1.1/demos/classes/flex/samples/product/Product.class
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/classes/flex/samples/product/Product.class?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/classes/flex/samples/product/Product.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/flex-messaging-common.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/flex-messaging-common.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/flex-messaging-common.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/flex-messaging-core.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/flex-messaging-core.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/flex-messaging-core.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/gdata-base-1.0.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/gdata-base-1.0.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/gdata-base-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/gdata-client-1.0.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/gdata-client-1.0.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/gdata-client-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/gdata-client-meta-1.0.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/gdata-client-meta-1.0.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/gdata-client-meta-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/gdata-contacts-1.0.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/gdata-contacts-1.0.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/gdata-contacts-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/gdata-contacts-meta-1.0.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/gdata-contacts-meta-1.0.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/gdata-contacts-meta-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/gdata-core-1.0.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/gdata-core-1.0.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/gdata-core-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/gdata-media-1.0.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/gdata-media-1.0.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/gdata-media-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/groovy-all-1.5.6.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/groovy-all-1.5.6.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/groovy-all-1.5.6.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/groovy-engine.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/groovy-engine.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/groovy-engine.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/js-engine.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/js-engine.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/js-engine.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/js.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/js.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/js.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/smack.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/smack.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/smack.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/lib/smackx.jar
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/lib/smackx.jar?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/lib/smackx.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/src/pivot/demos/amf/AMFDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/src/pivot/demos/amf/AMFDemo.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/demos/src/pivot/demos/amf/AMFDemo.java (added)
+++ incubator/pivot/branches/1.1/demos/src/pivot/demos/amf/AMFDemo.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.demos.amf;
+
+import flex.messaging.io.amf.client.AMFConnection;
+
+import pivot.collections.Dictionary;
+import pivot.collections.adapter.ListAdapter;
+import pivot.wtk.Application;
+import pivot.wtk.Button;
+import pivot.wtk.ButtonPressListener;
+import pivot.wtk.Component;
+import pivot.wtk.Display;
+import pivot.wtk.PushButton;
+import pivot.wtk.TableView;
+import pivot.wtk.TableViewHeader;
+import pivot.wtk.Window;
+import pivot.wtkx.WTKXSerializer;
+
+public class AMFDemo implements Application {
+	private Window window = null;
+
+	private TableView productTableView = null;
+	private TableViewHeader productTableViewHeader = null;
+	private PushButton getDataButton = null;
+
+    public void startup(Display display, Dictionary<String, String> properties)
+        throws Exception {
+        WTKXSerializer wtkxSerializer = new WTKXSerializer();
+        window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("amf_demo.wtkx")));
+
+        productTableView = (TableView)wtkxSerializer.getObjectByName("productTableView");
+
+        productTableViewHeader = (TableViewHeader)wtkxSerializer.getObjectByName("productTableViewHeader");
+        productTableViewHeader.getTableViewHeaderPressListeners().add(new TableView.SortHandler());
+
+        getDataButton = (PushButton)wtkxSerializer.getObjectByName("getDataButton");
+
+        getDataButton.getButtonPressListeners().add(new ButtonPressListener() {
+        	@SuppressWarnings("unchecked")
+        	public void buttonPressed(Button button) {
+        		AMFConnection amfConnection = new AMFConnection();
+        		String url = "http://localhost:8080/samples/messagebroker/amf";
+
+        		Object result = null;
+        		try {
+        		    amfConnection.connect(url);
+        		    result = amfConnection.call("product.getProducts");
+        			java.util.ArrayList<Object> products = (java.util.ArrayList<Object>)result;
+        			productTableView.setTableData(new ListAdapter<Object>(products));
+        		} catch(Exception exception) {
+        		    System.out.println(exception);
+        		} finally {
+        			amfConnection.close();
+        		}
+        	}
+        });
+
+        window.setMaximized(true);
+        window.open(display);
+    }
+
+    public boolean shutdown(boolean optional) {
+        window.close();
+        return true;
+    }
+
+    public void suspend() {
+    }
+
+    public void resume() {
+    }
+}

Added: incubator/pivot/branches/1.1/demos/src/pivot/demos/amf/amf_demo.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/src/pivot/demos/amf/amf_demo.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/demos/src/pivot/demos/amf/amf_demo.wtkx (added)
+++ incubator/pivot/branches/1.1/demos/src/pivot/demos/amf/amf_demo.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<TablePane styles="{padding:8, backgroundColor:10, verticalSpacing:8}"
+    xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008"
+    xmlns:collections="pivot.collections"
+    xmlns:amf="pivot.demos.amf" xmlns="pivot.wtk">
+    <columns>
+        <TablePane.Column width="1*"/>
+    </columns>
+    <rows>
+        <TablePane.Row height="1*">
+            <Border styles="{padding:0}">
+                <content>
+                    <ScrollPane horizontalScrollBarPolicy="fillToCapacity">
+                        <view>
+                            <TableView wtkx:id="productTableView" selectMode="single"
+                                styles="{showHorizontalGridLines:false}">
+                                <columns>
+                                    <TableView.Column name="category" headerData="Category" width="120"/>
+                                    <TableView.Column name="description" headerData="Description" width="120"/>
+                                    <TableView.Column name="image" headerData="Image" width="120"/>
+                                    <TableView.Column name="name" headerData="Name" width="120"/>
+                                    <TableView.Column name="price" headerData="Price" width="120"/>
+                                    <TableView.Column name="productId" headerData="ID" width="120"/>
+                                    <TableView.Column name="qtyInStock" headerData="Available" width="120"/>
+                                </columns>
+                            </TableView>
+                        </view>
+                        <columnHeader>
+                            <TableViewHeader wtkx:id="productTableViewHeader" tableView="$productTableView"/>
+                        </columnHeader>
+                    </ScrollPane>
+                </content>
+            </Border>
+        </TablePane.Row>
+        <TablePane.Row height="-1">
+            <FlowPane styles="{horizontalAlignment:'center'}">
+                <PushButton wtkx:id="getDataButton" buttonData="Get Data" styles="{padding:4}"/>
+            </FlowPane>
+        </TablePane.Row>
+    </rows>
+</TablePane>

Added: incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/DecoratorDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/DecoratorDemo.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/DecoratorDemo.java (added)
+++ incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/DecoratorDemo.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.demos.decorator;
+
+import pivot.collections.Dictionary;
+import pivot.wtk.Application;
+import pivot.wtk.Component;
+import pivot.wtk.ComponentMouseListener;
+import pivot.wtk.Display;
+import pivot.wtk.Frame;
+import pivot.wtk.Window;
+import pivot.wtk.effects.FadeDecorator;
+import pivot.wtk.effects.ReflectionDecorator;
+import pivot.wtkx.WTKXSerializer;
+
+public class DecoratorDemo implements Application {
+    private Window reflectionWindow = null;
+    private Frame fadeFrame = null;
+
+    public void startup(Display display, Dictionary<String, String> properties)
+        throws Exception {
+        WTKXSerializer wtkxSerializer = new WTKXSerializer();
+
+        reflectionWindow =
+            new Window((Component)wtkxSerializer.readObject(getClass().getResource("reflection.wtkx")));
+        reflectionWindow.setTitle("Reflection Window");
+        reflectionWindow.getDecorators().add(new ReflectionDecorator());
+        reflectionWindow.setLocation(20, 20);
+        reflectionWindow.open(display);
+
+        fadeFrame =
+            new Frame((Component)wtkxSerializer.readObject(getClass().getResource("translucent.wtkx")));
+        fadeFrame.setTitle("Translucent Window");
+
+        final FadeDecorator fadeDecorator = new FadeDecorator();
+        fadeFrame.getDecorators().insert(fadeDecorator, 0);
+
+        fadeFrame.getComponentMouseListeners().add(new ComponentMouseListener() {
+            public boolean mouseMove(Component component, int x, int y) {
+                return false;
+            }
+
+            public void mouseOver(Component component) {
+                fadeDecorator.setOpacity(0.9f);
+                component.repaint();
+            }
+
+            public void mouseOut(Component component) {
+                fadeDecorator.setOpacity(0.5f);
+                component.repaint();
+            }
+        });
+
+        fadeFrame.setLocation(80, 80);
+        fadeFrame.open(display);
+    }
+
+    public boolean shutdown(boolean optional) {
+        reflectionWindow.close();
+        fadeFrame.close();
+        return true;
+    }
+
+    public void suspend() {
+    }
+
+    public void resume() {
+    }
+}

Added: incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/IMG_0767_2.jpg
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/IMG_0767_2.jpg?rev=758461&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/IMG_0767_2.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/reflection.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/reflection.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/reflection.wtkx (added)
+++ incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/reflection.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<ImageView image="@IMG_0767_2.jpg"
+    xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008" xmlns="pivot.wtk"/>
+

Added: incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/translucent.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/translucent.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/translucent.wtkx (added)
+++ incubator/pivot/branches/1.1/demos/src/pivot/demos/decorator/translucent.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2008 VMware, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<FlowPane orientation="vertical" styles="{horizontalAlignment:'justify'}"
+    xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008" xmlns="pivot.wtk">
+    <Label text="A Translucent Window"/>
+    <Border styles="{color:13, padding:0}">
+        <content>
+            <ListView listData="['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5']"/>
+        </content>
+    </Border>
+</FlowPane>
+

Added: incubator/pivot/branches/1.1/demos/src/pivot/demos/dnd/DragAndDropDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/src/pivot/demos/dnd/DragAndDropDemo.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/demos/src/pivot/demos/dnd/DragAndDropDemo.java (added)
+++ incubator/pivot/branches/1.1/demos/src/pivot/demos/dnd/DragAndDropDemo.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,395 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.demos.dnd;
+
+import java.io.IOException;
+
+import pivot.collections.Dictionary;
+import pivot.io.FileList;
+import pivot.wtk.Application;
+import pivot.wtk.Button;
+import pivot.wtk.ButtonPressListener;
+import pivot.wtk.Clipboard;
+import pivot.wtk.Component;
+import pivot.wtk.Display;
+import pivot.wtk.DragSource;
+import pivot.wtk.DropAction;
+import pivot.wtk.DropTarget;
+import pivot.wtk.ImageView;
+import pivot.wtk.Label;
+import pivot.wtk.ListView;
+import pivot.wtk.LocalManifest;
+import pivot.wtk.Manifest;
+import pivot.wtk.Point;
+import pivot.wtk.PushButton;
+import pivot.wtk.Visual;
+import pivot.wtk.Window;
+import pivot.wtk.media.Image;
+import pivot.wtkx.WTKXSerializer;
+
+public class DragAndDropDemo implements Application {
+    private Window window = null;
+
+    public void startup(Display display, Dictionary<String, String> properties)
+        throws Exception {
+        WTKXSerializer wtkxSerializer = new WTKXSerializer();
+        window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("drag_and_drop.wtkx")));
+
+        // Text
+        final Label label = (Label)wtkxSerializer.getObjectByName("label");
+        label.setDragSource(new DragSource() {
+            private LocalManifest content = null;
+
+            public boolean beginDrag(Component component, int x, int y) {
+                String text = label.getText();
+                if (text != null) {
+                    content = new LocalManifest();
+                    content.putText(label.getText());
+                }
+
+                return (content != null);
+            }
+
+            public void endDrag(Component component, DropAction dropAction) {
+                content = null;
+            }
+
+            public boolean isNative() {
+                return true;
+            }
+
+            public LocalManifest getContent() {
+                return content;
+            }
+
+            public Visual getRepresentation() {
+                return null;
+            }
+
+            public Point getOffset() {
+                return null;
+            }
+
+            public int getSupportedDropActions() {
+                return DropAction.COPY.getMask();
+            }
+        });
+
+        label.setDropTarget(new DropTarget() {
+            public DropAction dragEnter(Component component, Manifest dragContent,
+                int supportedDropActions, DropAction userDropAction) {
+                DropAction dropAction = null;
+
+                if (dragContent.containsText()
+                    && DropAction.COPY.isSelected(supportedDropActions)) {
+                    dropAction = DropAction.COPY;
+                }
+
+                return dropAction;
+            }
+
+            public void dragExit(Component component) {
+            }
+
+            public DropAction dragMove(Component component, Manifest dragContent,
+                int supportedDropActions, int x, int y, DropAction userDropAction) {
+                return (dragContent.containsText() ? DropAction.COPY : null);
+            }
+
+            public DropAction userDropActionChange(Component component, Manifest dragContent,
+                int supportedDropActions, int x, int y, DropAction userDropAction) {
+                return (dragContent.containsText() ? DropAction.COPY : null);
+            }
+
+            public DropAction drop(Component component, Manifest dragContent,
+                int supportedDropActions, int x, int y, DropAction userDropAction) {
+                DropAction dropAction = null;
+
+                if (dragContent.containsText()) {
+                    try {
+                        label.setText(dragContent.getText());
+                        dropAction = DropAction.COPY;
+                    } catch(IOException exception) {
+                        System.err.println(exception);
+                    }
+                }
+
+                dragExit(component);
+
+                return dropAction;
+            }
+        });
+
+        PushButton copyTextButton = (PushButton)wtkxSerializer.getObjectByName("copyTextButton");
+        copyTextButton.getButtonPressListeners().add(new ButtonPressListener() {
+            public void buttonPressed(Button button) {
+                String text = label.getText();
+                LocalManifest clipboardContent = new LocalManifest();
+                clipboardContent.putText(text);
+                Clipboard.setContent(clipboardContent);
+            }
+        });
+
+        PushButton pasteTextButton = (PushButton)wtkxSerializer.getObjectByName("pasteTextButton");
+        pasteTextButton.getButtonPressListeners().add(new ButtonPressListener() {
+            public void buttonPressed(Button button) {
+                Manifest clipboardContent = Clipboard.getContent();
+
+                if (clipboardContent != null
+                    && clipboardContent.containsText()) {
+                    try {
+                        label.setText(clipboardContent.getText());
+                    } catch(IOException exception) {
+                        System.err.println(exception);
+                    }
+                }
+            }
+        });
+
+        // Images
+        final ImageView imageView = (ImageView)wtkxSerializer.getObjectByName("imageView");
+        imageView.setDragSource(new DragSource() {
+            private LocalManifest content = null;
+
+            public boolean beginDrag(Component component, int x, int y) {
+                Image image = imageView.getImage();
+
+                if (image != null) {
+                    content = new LocalManifest();
+                    content.putImage(image);
+                }
+
+                return (content != null);
+            }
+
+            public void endDrag(Component component, DropAction dropAction) {
+                content = null;
+            }
+
+            public boolean isNative() {
+                return true;
+            }
+
+            public LocalManifest getContent() {
+                return content;
+            }
+
+            public Visual getRepresentation() {
+                return null;
+            }
+
+            public Point getOffset() {
+                return null;
+            }
+
+            public int getSupportedDropActions() {
+                return DropAction.COPY.getMask();
+            }
+        });
+
+        imageView.setDropTarget(new DropTarget() {
+            public DropAction dragEnter(Component component, Manifest dragContent,
+                int supportedDropActions, DropAction userDropAction) {
+                DropAction dropAction = null;
+
+                if (dragContent.containsImage()
+                    && DropAction.COPY.isSelected(supportedDropActions)) {
+                    dropAction = DropAction.COPY;
+                }
+
+                return dropAction;
+            }
+
+            public void dragExit(Component component) {
+            }
+
+            public DropAction dragMove(Component component, Manifest dragContent,
+                int supportedDropActions, int x, int y, DropAction userDropAction) {
+                return (dragContent.containsImage() ? DropAction.COPY : null);
+            }
+
+            public DropAction userDropActionChange(Component component, Manifest dragContent,
+                int supportedDropActions, int x, int y, DropAction userDropAction) {
+                return (dragContent.containsImage() ? DropAction.COPY : null);
+            }
+
+            public DropAction drop(Component component, Manifest dragContent,
+                int supportedDropActions, int x, int y, DropAction userDropAction) {
+                DropAction dropAction = null;
+
+                if (dragContent.containsImage()) {
+                    try {
+                        imageView.setImage(dragContent.getImage());
+                        dropAction = DropAction.COPY;
+                    } catch(IOException exception) {
+                        System.err.println(exception);
+                    }
+                }
+
+                dragExit(component);
+
+                return dropAction;
+            }
+        });
+
+        PushButton copyImageButton = (PushButton)wtkxSerializer.getObjectByName("copyImageButton");
+        copyImageButton.getButtonPressListeners().add(new ButtonPressListener() {
+            public void buttonPressed(Button button) {
+                Image image = imageView.getImage();
+                if (image != null) {
+                    LocalManifest clipboardContent = new LocalManifest();
+                    clipboardContent.putImage(image);
+                    Clipboard.setContent(clipboardContent);
+                }
+            }
+        });
+
+        PushButton pasteImageButton = (PushButton)wtkxSerializer.getObjectByName("pasteImageButton");
+        pasteImageButton.getButtonPressListeners().add(new ButtonPressListener() {
+            public void buttonPressed(Button button) {
+                Manifest clipboardContent = Clipboard.getContent();
+
+                if (clipboardContent != null
+                    && clipboardContent.containsImage()) {
+                    try {
+                        imageView.setImage(clipboardContent.getImage());
+                    } catch(IOException exception) {
+                        System.err.println(exception);
+                    }
+                }
+            }
+        });
+
+        // Files
+        final ListView listView = (ListView)wtkxSerializer.getObjectByName("listView");
+        listView.setListData(new FileList());
+
+        listView.setDragSource(new DragSource() {
+            private LocalManifest content = null;
+
+            public boolean beginDrag(Component component, int x, int y) {
+                ListView listView = (ListView)component;
+                FileList fileList = (FileList)listView.getListData();
+
+                if (fileList.getLength() > 0) {
+                    content = new LocalManifest();
+                    content.putFileList(fileList);
+                }
+
+                return (content != null);
+            }
+
+            public void endDrag(Component component, DropAction dropAction) {
+                content = null;
+            }
+
+            public boolean isNative() {
+                return true;
+            }
+
+            public LocalManifest getContent() {
+                return content;
+            }
+
+            public Visual getRepresentation() {
+                return null;
+            }
+
+            public Point getOffset() {
+                return null;
+            }
+
+            public int getSupportedDropActions() {
+                return DropAction.COPY.getMask();
+            }
+        });
+
+        listView.setDropTarget(new DropTarget() {
+            public DropAction dragEnter(Component component, Manifest dragContent,
+                int supportedDropActions, DropAction userDropAction) {
+                DropAction dropAction = null;
+
+                if (dragContent.containsFileList()
+                    && DropAction.COPY.isSelected(supportedDropActions)) {
+                    dropAction = DropAction.COPY;
+                }
+
+                return dropAction;
+            }
+
+            public void dragExit(Component component) {
+            }
+
+            public DropAction dragMove(Component component, Manifest dragContent,
+                int supportedDropActions, int x, int y, DropAction userDropAction) {
+                return (dragContent.containsFileList() ? DropAction.COPY : null);
+            }
+
+            public DropAction userDropActionChange(Component component, Manifest dragContent,
+                int supportedDropActions, int x, int y, DropAction userDropAction) {
+                return (dragContent.containsFileList() ? DropAction.COPY : null);
+            }
+
+            public DropAction drop(Component component, Manifest dragContent,
+                int supportedDropActions, int x, int y, DropAction userDropAction) {
+                DropAction dropAction = null;
+
+                if (dragContent.containsFileList()) {
+                    try {
+                        listView.setListData(dragContent.getFileList());
+                        dropAction = DropAction.COPY;
+                    } catch(IOException exception) {
+                        System.err.println(exception);
+                    }
+                }
+
+                dragExit(component);
+
+                return dropAction;
+            }
+        });
+
+        PushButton copyFilesButton = (PushButton)wtkxSerializer.getObjectByName("copyFilesButton");
+        copyFilesButton.getButtonPressListeners().add(new ButtonPressListener() {
+            public void buttonPressed(Button button) {
+                // TODO
+            }
+        });
+
+        PushButton pasteFilesButton = (PushButton)wtkxSerializer.getObjectByName("pasteFilesButton");
+        pasteFilesButton.getButtonPressListeners().add(new ButtonPressListener() {
+            public void buttonPressed(Button button) {
+                // TODO
+            }
+        });
+
+        // Open the window
+        window.setTitle("Drag and Drop Demo");
+        window.setMaximized(true);
+        window.open(display);
+    }
+
+    public boolean shutdown(boolean optional) {
+        window.close();
+        return true;
+    }
+
+    public void suspend() {
+    }
+
+    public void resume() {
+    }
+}

Added: incubator/pivot/branches/1.1/demos/src/pivot/demos/dnd/drag_and_drop.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/src/pivot/demos/dnd/drag_and_drop.wtkx?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/demos/src/pivot/demos/dnd/drag_and_drop.wtkx (added)
+++ incubator/pivot/branches/1.1/demos/src/pivot/demos/dnd/drag_and_drop.wtkx Wed Mar 25 23:08:38 2009
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	Copyright (c) 2008 VMware, Inc.
+
+	Licensed under the Apache License, Version 2.0 (the "License");
+	you may not use this file except in compliance with the License.
+	You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+-->
+
+<TablePane styles="{padding:4, horizontalSpacing:4}"
+	xmlns:wtkx="http://pivot-toolkit.org/wtkx/2008" xmlns="pivot.wtk">
+	<columns>
+		<TablePane.Column width="1*" />
+		<TablePane.Column width="1*" />
+		<TablePane.Column width="1*" />
+	</columns>
+
+	<rows>
+		<TablePane.Row height="1*">
+			<Border>
+				<content>
+					<TablePane>
+                        <columns>
+                            <TablePane.Column width="1*"/>
+                        </columns>
+                        <rows>
+                            <TablePane.Row>
+		                        <Label text="Text"
+		                            styles="{fontBold:true, horizontalAlignment:'center'}" />
+                            </TablePane.Row>
+                            <TablePane.Row height="1*">
+                                <Border styles="{color:10}">
+                                    <content>
+                                        <ScrollPane horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="fillToCapacity">
+                                            <view>
+		                                        <Label wtkx:id="label"
+		                                            styles="{horizontalAlignment:'left', verticalAlignment:'top', wrapText:true}" />
+                                            </view>
+                                        </ScrollPane>
+                                    </content>
+                                </Border>
+                            </TablePane.Row>
+                            <TablePane.Row>
+                                <FlowPane styles="{padding:4, spacing:4, horizontalAlignment:'center'}">
+                                    <PushButton wtkx:id="copyTextButton" buttonData="Copy"/>
+                                    <PushButton wtkx:id="pasteTextButton" buttonData="Paste"/>
+                                </FlowPane>
+                            </TablePane.Row>
+                        </rows>
+					</TablePane>
+				</content>
+			</Border>
+
+			<Border>
+				<content>
+                    <TablePane>
+                        <columns>
+                            <TablePane.Column width="1*"/>
+                        </columns>
+                        <rows>
+                            <TablePane.Row>
+		                        <Label text="Images"
+		                            styles="{fontBold:true, horizontalAlignment:'center'}" />
+                            </TablePane.Row>
+                            <TablePane.Row height="1*">
+                                <Border styles="{color:10, padding:0}">
+                                    <content>
+				                        <ImageView wtkx:id="imageView"
+				                            styles="{horizontalAlignment:'center', verticalAlignment:'center'}" />
+                                    </content>
+                                </Border>
+                            </TablePane.Row>
+                            <TablePane.Row>
+                                <FlowPane styles="{padding:4, spacing:4, horizontalAlignment:'center'}">
+                                    <PushButton wtkx:id="copyImageButton" buttonData="Copy"/>
+                                    <PushButton wtkx:id="pasteImageButton" buttonData="Paste"/>
+                                </FlowPane>
+                            </TablePane.Row>
+                        </rows>
+                    </TablePane>
+				</content>
+			</Border>
+
+			<Border>
+				<content>
+                    <TablePane>
+                        <columns>
+                            <TablePane.Column width="1*"/>
+                        </columns>
+                        <rows>
+                            <TablePane.Row>
+		                        <Label text="File Lists"
+		                            styles="{fontBold:true, horizontalAlignment:'center'}" />
+                            </TablePane.Row>
+                            <TablePane.Row height="1*">
+                                <Border styles="{color:10, padding:0}">
+                                    <content>
+		                                <ScrollPane horizontalScrollBarPolicy="fillToCapacity" verticalScrollBarPolicy="fillToCapacity">
+		                                    <view>
+		                                        <ListView wtkx:id="listView" selectMode="none"/>
+		                                    </view>
+		                                </ScrollPane>
+                                    </content>
+                                </Border>
+                            </TablePane.Row>
+                            <TablePane.Row>
+                                <FlowPane styles="{padding:4, spacing:4, horizontalAlignment:'center'}">
+                                    <PushButton wtkx:id="copyFilesButton" buttonData="Copy"/>
+                                    <PushButton wtkx:id="pasteFilesButton" buttonData="Paste"/>
+                                </FlowPane>
+                            </TablePane.Row>
+                        </rows>
+                    </TablePane>
+				</content>
+			</Border>
+		</TablePane.Row>
+	</rows>
+</TablePane>

Added: incubator/pivot/branches/1.1/demos/src/pivot/demos/dom/DOMTest.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/src/pivot/demos/dom/DOMTest.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/demos/src/pivot/demos/dom/DOMTest.java (added)
+++ incubator/pivot/branches/1.1/demos/src/pivot/demos/dom/DOMTest.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2009 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.demos.dom;
+
+import pivot.collections.Dictionary;
+import pivot.wtk.Alert;
+import pivot.wtk.Application;
+import pivot.wtk.BrowserApplicationContext;
+import pivot.wtk.Button;
+import pivot.wtk.ButtonPressListener;
+import pivot.wtk.Display;
+import pivot.wtk.FlowPane;
+import pivot.wtk.HorizontalAlignment;
+import pivot.wtk.PushButton;
+import pivot.wtk.Window;
+
+public class DOMTest implements Application {
+    private Window window = null;
+    private PushButton helloButton = null;
+
+    public void startup(Display display, Dictionary<String, String> properties)
+        throws Exception {
+        FlowPane flowPane = new FlowPane();
+        flowPane.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
+
+        helloButton = new PushButton("Say Hello");
+        flowPane.add(helloButton);
+
+        helloButton.getButtonPressListeners().add(new ButtonPressListener() {
+            public void buttonPressed(Button button) {
+                BrowserApplicationContext.eval("sayHello(\"Hello from Java!\")", DOMTest.this);
+            }
+        });
+
+        window = new Window(flowPane);
+        window.setMaximized(true);
+        window.open(display);
+    }
+
+    public boolean shutdown(boolean optional) {
+        if (window != null) {
+            window.close();
+        }
+
+        return true;
+    }
+
+    public void suspend() {
+    }
+
+    public void resume() {
+    }
+
+    public void sayHello(String helloText) {
+        Alert.alert(helloText, window);
+    }
+}

Added: incubator/pivot/branches/1.1/demos/src/pivot/demos/google/ContactListViewItemRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/branches/1.1/demos/src/pivot/demos/google/ContactListViewItemRenderer.java?rev=758461&view=auto
==============================================================================
--- incubator/pivot/branches/1.1/demos/src/pivot/demos/google/ContactListViewItemRenderer.java (added)
+++ incubator/pivot/branches/1.1/demos/src/pivot/demos/google/ContactListViewItemRenderer.java Wed Mar 25 23:08:38 2009
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.demos.google;
+
+import java.awt.Color;
+import java.awt.Font;
+
+import com.google.gdata.data.contacts.ContactEntry;
+
+import pivot.wtk.HorizontalAlignment;
+import pivot.wtk.Insets;
+import pivot.wtk.Label;
+import pivot.wtk.ListView;
+import pivot.wtk.VerticalAlignment;
+
+public class ContactListViewItemRenderer extends Label
+	implements ListView.ItemRenderer {
+    public ContactListViewItemRenderer() {
+        getStyles().put("horizontalAlignment", HorizontalAlignment.LEFT);
+        getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
+        getStyles().put("padding", new Insets(2));
+    }
+
+    public void render(Object item, ListView listView, boolean selected,
+        boolean checked, boolean highlighted, boolean disabled) {
+    	ContactEntry contactEntry = (ContactEntry)item;
+    	String text = contactEntry.getTitle().getPlainText();
+    	setText(text);
+
+        Object font = listView.getStyles().get("font");
+        if (font instanceof Font) {
+            getStyles().put("font", font);
+        }
+
+        Object color = null;
+        if (listView.isEnabled() && !disabled) {
+            if (selected) {
+                if (listView.isFocused()) {
+                    color = listView.getStyles().get("selectionColor");
+                } else {
+                    color = listView.getStyles().get("inactiveSelectionColor");
+                }
+            } else {
+                color = listView.getStyles().get("color");
+            }
+        } else {
+            color = listView.getStyles().get("disabledColor");
+        }
+
+        if (color instanceof Color) {
+            getStyles().put("color", color);
+        }
+    }
+}