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/16 17:36:28 UTC

svn commit: r754936 [18/38] - in /incubator/pivot/tags/v1.0.1: ./ charts-test/ charts-test/src/ charts-test/src/pivot/ charts-test/src/pivot/charts/ charts-test/src/pivot/charts/test/ charts/ charts/lib/ charts/src/ charts/src/pivot/ charts/src/pivot/c...

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Mouse.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Mouse.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Mouse.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Mouse.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,199 @@
+/*
+ * 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.wtk;
+
+/**
+ * Class representing the system mouse.
+ *
+ * @author gbrown
+ */
+public final class Mouse {
+    /**
+     * Enumeration representing mouse buttons.
+     *
+     * @author gbrown
+     */
+    public enum Button {
+        LEFT,
+        RIGHT,
+        MIDDLE;
+
+        public int getMask() {
+            return 2 << ordinal();
+        }
+    }
+
+    /**
+     * Enumeration defining supported scroll types.
+     *
+     * @author gbrown
+     */
+    public enum ScrollType {
+        UNIT,
+        BLOCK
+    }
+
+    private static int x = 0;
+    private static int y = 0;
+    private static int buttons = 0x00;
+    private static Cursor cursor = Cursor.DEFAULT;
+
+    /**
+     * Returns the x-coordinate of the mouse, in Display coordinates.
+     */
+    public static int getX() {
+        return x;
+    }
+
+    /**
+     * Returns the x-coordinate of the mouse, in Display coordinates.
+     */
+    public static int getY() {
+        return y;
+    }
+
+    protected static void setLocation(int x, int y) {
+        Mouse.x = x;
+        Mouse.y = y;
+    }
+
+    /**
+     * Returns a bitfield representing the mouse buttons that are currently
+     * pressed.
+     */
+    public static int getButtons() {
+        return buttons;
+    }
+
+    protected static void setButtons(int buttons) {
+        Mouse.buttons = buttons;
+    }
+
+    /**
+     * Tests the pressed state of a button.
+     *
+     * @param button
+     *
+     * @return
+     * <tt>true</tt> if the modifier is pressed; <tt>false</tt>, otherwise.
+     */
+    public static boolean isPressed(Button button) {
+        return (buttons & button.getMask()) > 0;
+    }
+
+    public static Cursor getCursor() {
+        return cursor;
+    }
+
+    @SuppressWarnings("deprecation")
+    public static void setCursor(Cursor cursor) {
+        if (cursor == null) {
+            throw new IllegalArgumentException("cursor is null.");
+        }
+
+        if (Mouse.cursor != cursor) {
+            java.awt.Container activeDisplayHost = ApplicationContext.getActiveDisplayHost();
+
+            if (activeDisplayHost != null) {
+                int cursorID = -1;
+
+                switch (cursor) {
+                    case DEFAULT: {
+                        cursorID = java.awt.Cursor.DEFAULT_CURSOR;
+                        break;
+                    }
+
+                    case HAND: {
+                        cursorID = java.awt.Cursor.HAND_CURSOR;
+                        break;
+                    }
+
+                    case TEXT: {
+                        cursorID = java.awt.Cursor.TEXT_CURSOR;
+                        break;
+                    }
+
+                    case WAIT: {
+                        cursorID = java.awt.Cursor.WAIT_CURSOR;
+                        break;
+                    }
+
+                    case CROSSHAIR: {
+                        cursorID = java.awt.Cursor.CROSSHAIR_CURSOR;
+                        break;
+                    }
+
+                    case MOVE: {
+                        cursorID = java.awt.Cursor.MOVE_CURSOR;
+                        break;
+                    }
+
+                    case RESIZE_NORTH: {
+                        cursorID = java.awt.Cursor.N_RESIZE_CURSOR;
+                        break;
+                    }
+
+                    case RESIZE_SOUTH: {
+                        cursorID = java.awt.Cursor.S_RESIZE_CURSOR;
+                        break;
+                    }
+
+                    case RESIZE_EAST: {
+                        cursorID = java.awt.Cursor.E_RESIZE_CURSOR;
+                        break;
+                    }
+
+                    case RESIZE_WEST: {
+                        cursorID = java.awt.Cursor.W_RESIZE_CURSOR;
+                        break;
+                    }
+
+                    case RESIZE_NORTH_EAST: {
+                        cursorID = java.awt.Cursor.NE_RESIZE_CURSOR;
+                        break;
+                    }
+
+                    case RESIZE_SOUTH_WEST: {
+                        cursorID = java.awt.Cursor.SW_RESIZE_CURSOR;
+                        break;
+                    }
+
+                    case RESIZE_NORTH_WEST: {
+                        cursorID = java.awt.Cursor.NW_RESIZE_CURSOR;
+                        break;
+                    }
+
+                    case RESIZE_SOUTH_EAST: {
+                        cursorID = java.awt.Cursor.SE_RESIZE_CURSOR;
+                        break;
+                    }
+
+                    default: {
+                        System.out.println(cursor + " cursor is not supported.");
+                        cursorID = java.awt.Cursor.DEFAULT_CURSOR;
+                        break;
+                    }
+                }
+
+                activeDisplayHost.setCursor(new java.awt.Cursor(cursorID));
+            } else {
+                System.out.println("No active display host.");
+            }
+
+            Mouse.cursor = cursor;
+        }
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Orientation.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Orientation.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Orientation.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Orientation.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,30 @@
+/*
+ * 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.wtk;
+
+/**
+ * Enumeration defining a two-dimensional orientation.
+ *
+ * @author gbrown
+ */
+public enum Orientation {
+    HORIZONTAL,
+    VERTICAL;
+
+    public static Orientation decode(String value) {
+        return valueOf(value.toUpperCase());
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Palette.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Palette.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Palette.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Palette.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,66 @@
+/*
+ * 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.wtk;
+
+/**
+ * Window representing a "tool palette". A tool palette is an auxiliary window
+ * whose visibility is tied to its owner's active state.
+ *
+ * @author gbrown
+ */
+@ComponentInfo(icon="Palette.png")
+public class Palette extends Window {
+    /**
+     * Creates a new palette.
+     */
+    public Palette() {
+        this(null);
+    }
+
+    /**
+     * Creates a new palette with an initial content component.
+     *
+     * @param content
+     * The sheet's content component.
+     */
+    public Palette(Component content) {
+        super(content);
+
+        installSkin(Palette.class);
+    }
+
+    /**
+     * @return
+     * <tt>true</tt>; by default, palettes are auxilliary windows.
+     */
+    @Override
+    public boolean isAuxilliary() {
+        return true;
+    }
+
+    @Override
+    public final void setOwner(Window owner) {
+        if (owner == null) {
+            throw new UnsupportedOperationException("A palette must have an owner.");
+        }
+
+        if (owner.isAuxilliary()) {
+            throw new UnsupportedOperationException("A palette window must have a primary owner.");
+        }
+
+        super.setOwner(owner);
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Palette.png
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Palette.png?rev=754936&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Palette.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Panorama.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Panorama.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Panorama.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Panorama.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,32 @@
+/*
+ * 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.wtk;
+
+/**
+ * Container that provides a scrollable view of a component.
+ *
+ * @author gbrown
+ */
+public class Panorama extends Viewport {
+    public Panorama() {
+        this(null);
+    }
+
+    public Panorama(Component view) {
+        installSkin(Panorama.class);
+        setView(view);
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Point.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Point.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Point.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Point.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,83 @@
+/*
+ * 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.wtk;
+
+import pivot.collections.Dictionary;
+
+/**
+ * Class representing the location of an object.
+ *
+ * @author gbrown
+ */
+public class Point {
+    public int x = 0;
+    public int y = 0;
+
+    public static final String X_KEY = "x";
+    public static final String Y_KEY = "y";
+
+    public Point() {
+    }
+
+    public Point(Dictionary<String, ?> point) {
+        if (point == null) {
+            throw new IllegalArgumentException("point is null.");
+        }
+
+        if (point.containsKey(X_KEY)) {
+            x = (Integer)point.get(X_KEY);
+        }
+
+        if (point.containsKey(Y_KEY)) {
+            y = (Integer)point.get(Y_KEY);
+        }
+    }
+
+    public Point(int x, int y) {
+        this.x = x;
+        this.y = y;
+    }
+
+    public Point(Point point) {
+        if (point == null) {
+            throw new IllegalArgumentException("point is null.");
+        }
+
+        this.x = point.x;
+        this.y = point.y;
+    }
+
+    public void translate(int dx, int dy) {
+        this.x += dx;
+        this.y += dy;
+    }
+
+    public boolean equals(Object object) {
+        boolean equals = false;
+
+        if (object instanceof Point) {
+            Point point = (Point)object;
+            equals = (x == point.x
+                && y == point.y);
+        }
+
+        return equals;
+    }
+
+    public String toString() {
+        return getClass().getName() + " [" + x + "," + y + "]";
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Popup.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Popup.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Popup.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Popup.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,127 @@
+/*
+ * 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.wtk;
+
+import pivot.util.ListenerList;
+
+/**
+ * Window class representing a "popup" window. A popup is an auxiliary window
+ * that is optionally associated with an "affiliate" component. A popup closes
+ * automatically when:
+ *
+ * <ul>
+ * <li>A component mouse down event or a container mouse wheel event occurs
+ * outside the bounds of its affiliate, itself, or any of its owned
+ * windows.</li>
+ * <li>The absolute location of its affiliate component changes.</li>
+ * <li>The absolute visibility of its affiliate component (the affiliate's
+ * "showing" state) changes.</li>
+ * <li>The affiliate's ancestry changes.</li>
+ * </ul>
+ *
+ * @author gbrown
+ */
+public class Popup extends Window {
+    private static class PopupListenerList extends ListenerList<PopupListener>
+        implements PopupListener {
+        public void affiliateChanged(Popup popup, Component previousAffiliate) {
+            for (PopupListener listener : this) {
+                listener.affiliateChanged(popup, previousAffiliate);
+            }
+        }
+    }
+
+    private Component affiliate = null;
+
+    private PopupListenerList popupListeners = new PopupListenerList();
+
+    /**
+     * Creates a new popup.
+     */
+    public Popup() {
+        this(null);
+    }
+
+    /**
+     * Creates a new popup with an initial content component.
+     *
+     * @param content
+     * The popup's content component.
+     */
+    public Popup(Component content) {
+        super(content);
+
+        installSkin(Popup.class);
+    }
+
+    /**
+     * Returns the popup's affiliate component.
+     *
+     * @return
+     * The component with which this popup is affiliated, or <tt>null</tt> if
+     * the popup has no affiliate.
+     */
+    public Component getAffiliate() {
+        return affiliate;
+    }
+
+    /**
+     * Sets the popup's affiliate component.
+     *
+     * @param affiliate
+     */
+    public void setAffiliate(Component affiliate) {
+        Component previousAffiliate = this.affiliate;
+
+        if (previousAffiliate != affiliate) {
+            this.affiliate = affiliate;
+            popupListeners.affiliateChanged(this, previousAffiliate);
+        }
+    }
+
+    /**
+     * @return
+     * <tt>true</tt>; by default, popups are auxilliary windows.
+     */
+    @Override
+    public boolean isAuxilliary() {
+        return true;
+    }
+
+    /**
+     * Opens the popup.
+     *
+     * @param affiliate
+     * The component with which the popup is affiliated.
+     */
+    public void open(Component affiliate) {
+        if (affiliate == null) {
+            throw new IllegalArgumentException("affiliate is null.");
+        }
+
+        if (isOpen()
+            && getAffiliate() != affiliate) {
+            throw new IllegalStateException("Popup is already open with a different affiliate.");
+        }
+
+        setAffiliate(affiliate);
+        open(affiliate.getWindow());
+    }
+
+    public ListenerList<PopupListener> getPopupListeners() {
+        return popupListeners;
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PopupListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PopupListener.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PopupListener.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PopupListener.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,16 @@
+package pivot.wtk;
+
+/**
+ * Popup listener interface.
+ *
+ * @author gbrown
+ */
+public interface PopupListener {
+    /**
+     * Called when a popup's affiliate has changed.
+     *
+     * @param popup
+     * @param previousAffiliate
+     */
+    public void affiliateChanged(Popup popup, Component previousAffiliate);
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Prompt.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Prompt.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Prompt.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Prompt.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,155 @@
+/*
+ * 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.wtk;
+
+import pivot.collections.ArrayList;
+import pivot.collections.List;
+import pivot.collections.Sequence;
+import pivot.util.ListenerList;
+import pivot.util.Resources;
+
+/**
+ * Class representing an "prompt", a sheet commonly used to perform simple
+ * user interaction.
+ * <p>
+ * <tt>Prompt</tt> is a semantic sibling of <tt>Alert</tt>, but whereas
+ * alerts are dialogs, prompts are sheets, meaning that an alert will be modal
+ * over its entire owner hierarchy (its entire "application", in common usage)
+ * but a prompt will be modal only over its owner's content.
+ *
+ * @author tvolkert
+ */
+public class Prompt extends Sheet {
+    private static class PromptListenerList extends ListenerList<PromptListener>
+        implements PromptListener {
+        public void selectedOptionChanged(Prompt prompt, int previousSelectedOption) {
+            for (PromptListener listener : this) {
+                listener.selectedOptionChanged(prompt, previousSelectedOption);
+            }
+        }
+    }
+
+    private MessageType type = null;
+    private String message = null;
+    private Component body = null;
+    private Sequence<?> options = null;
+    private int selectedOption = -1;
+
+    private PromptListenerList promptListeners = new PromptListenerList();
+
+    private static Resources resources = null;
+
+    static {
+        try {
+            resources = new Resources(Prompt.class.getName());
+        } catch(Exception exception) {
+            throw new RuntimeException(exception);
+        }
+    }
+
+    public Prompt(MessageType type, String message, Sequence<?> options) {
+        this(type, message, options, null);
+    }
+
+    public Prompt(MessageType type, String message, Sequence<?> options, Component body) {
+        if (type == null) {
+            throw new IllegalArgumentException("type is null.");
+        }
+
+        if (options == null) {
+            throw new IllegalArgumentException("options is null.");
+        }
+
+        this.type = type;
+        this.message = message;
+        this.options = options;
+        this.body = body;
+
+        installSkin(Prompt.class);
+    }
+
+    public MessageType getMessageType() {
+        return type;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public Object getOption(int index) {
+        return options.get(index);
+    }
+
+    public int getOptionCount() {
+        return options.getLength();
+    }
+
+    public Component getBody() {
+        return body;
+    }
+
+    public int getSelectedOption() {
+        return selectedOption;
+    }
+
+    public void setSelectedOption(int selectedOption) {
+        if (selectedOption < -1
+            || selectedOption >= options.getLength()) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        int previousSelectedOption = this.selectedOption;
+
+        if (selectedOption != previousSelectedOption) {
+            this.selectedOption = selectedOption;
+            promptListeners.selectedOptionChanged(this, previousSelectedOption);
+        }
+    }
+
+    public ListenerList<PromptListener> getPromptListeners() {
+        return promptListeners;
+    }
+
+    public static void prompt(String message, Window owner) {
+        prompt(MessageType.INFO, message, owner, null);
+    }
+
+    public static void prompt(String message, Window owner,
+        SheetStateListener sheetStateListener) {
+        prompt(MessageType.INFO, message, owner, sheetStateListener);
+    }
+
+    public static void prompt(MessageType type, String message, Window owner) {
+        prompt(type, message, owner, null);
+    }
+
+    public static void prompt(MessageType type, String message, Window owner,
+        SheetStateListener sheetStateListener) {
+        Prompt prompt = createPrompt(type, message);
+        prompt.open(owner, sheetStateListener);
+    }
+
+    private static Prompt createPrompt(MessageType type, String message) {
+        List<Object> options = new ArrayList<Object>();
+        options.add(resources.get("defaultOption"));
+
+        Prompt prompt = new Prompt(type, message, options, null);
+        prompt.setTitle((String)resources.get("defaultTitle"));
+        prompt.setSelectedOption(0);
+
+        return prompt;
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Prompt.json
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Prompt.json?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Prompt.json (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Prompt.json Mon Mar 16 16:36:10 2009
@@ -0,0 +1,3 @@
+{   defaultOption: "OK",
+    defaultTitle: "Prompt"
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PromptListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PromptListener.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PromptListener.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PromptListener.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.wtk;
+
+/**
+ * Prompt listener interface.
+ *
+ * @author tvolkert
+ */
+public interface PromptListener {
+    /**
+     * Called when an prompt's selected option has changed.
+     *
+     * @param prompt
+     * @param previousSelectedOption
+     */
+    public void selectedOptionChanged(Prompt prompt, int previousSelectedOption);
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PushButton.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PushButton.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PushButton.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PushButton.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,74 @@
+/*
+ * 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.wtk;
+
+import pivot.wtk.content.ButtonDataRenderer;
+
+/**
+ * Component representing a push button.
+ *
+ * @author gbrown
+ */
+@ComponentInfo(icon="PushButton.png")
+public class PushButton extends Button {
+    private static final Button.DataRenderer DEFAULT_DATA_RENDERER = new ButtonDataRenderer();
+
+    public PushButton() {
+        this(false, null);
+    }
+
+    public PushButton(boolean toggleButton) {
+        this(toggleButton, null);
+    }
+
+    public PushButton(Object buttonData) {
+        this(false, buttonData);
+    }
+
+    public PushButton(boolean toggleButton, Object buttonData) {
+        super(buttonData);
+
+        setToggleButton(toggleButton);
+        setDataRenderer(DEFAULT_DATA_RENDERER);
+
+        installSkin(PushButton.class);
+    }
+
+    public void press() {
+        if (isToggleButton()) {
+            // If the button is not part of a group, cycle through the
+            // available states; otherwise, select the button
+            if (getGroup() == null) {
+                State state = getState();
+
+                if (state == State.SELECTED) {
+                    setState(State.UNSELECTED);
+                }
+                else if (state == State.UNSELECTED) {
+                    setState(isTriState() ? State.MIXED : State.SELECTED);
+                }
+                else {
+                    setState(State.SELECTED);
+                }
+            }
+            else {
+                setSelected(true);
+            }
+        }
+
+        super.press();
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PushButton.png
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PushButton.png?rev=754936&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/PushButton.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/RadioButton.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/RadioButton.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/RadioButton.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/RadioButton.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,70 @@
+/*
+ * 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.wtk;
+
+import pivot.wtk.content.ButtonDataRenderer;
+
+/**
+ * Component representing a "radio button".
+ *
+ * @author gbrown
+ */
+@ComponentInfo(icon="RadioButton.png")
+public class RadioButton extends Button {
+    private static final Button.DataRenderer DEFAULT_DATA_RENDERER = new ButtonDataRenderer();
+
+    static {
+        DEFAULT_DATA_RENDERER.getStyles().put("horizontalAlignment", HorizontalAlignment.LEFT);
+    }
+
+    public RadioButton() {
+        this(null, null);
+    }
+
+    public RadioButton(Group group) {
+        this(group, null);
+    }
+
+    public RadioButton(Object buttonData) {
+        this(null, buttonData);
+    }
+
+    public RadioButton(Group group, Object buttonData) {
+        super(buttonData);
+        super.setToggleButton(true);
+
+        setGroup(group);
+        setDataRenderer(DEFAULT_DATA_RENDERER);
+
+        installSkin(RadioButton.class);
+    }
+
+    public void press() {
+        setSelected(getGroup() == null ? !isSelected() : true);
+
+        super.press();
+    }
+
+    @Override
+    public void setToggleButton(boolean toggleButton) {
+        throw new UnsupportedOperationException("Radio buttons are always toggle buttons.");
+    }
+
+    @Override
+    public void setTriState(boolean triState) {
+        throw new UnsupportedOperationException("Radio buttons can't be tri-state.");
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/RadioButton.png
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/RadioButton.png?rev=754936&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/RadioButton.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Renderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Renderer.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Renderer.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Renderer.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.wtk;
+
+import pivot.collections.Dictionary;
+
+/**
+ * Base interface for "renderers". Renderers are used to customize the
+ * appearance of a component's content.
+ *
+ * @author gbrown
+ */
+public interface Renderer extends ConstrainedVisual {
+    /**
+     * Returns the renderer's style dictionary.
+     */
+    public Dictionary<String, Object> getStyles();
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Rollup.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Rollup.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Rollup.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Rollup.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,101 @@
+/*
+ * 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.wtk;
+
+import pivot.util.ListenerList;
+import pivot.util.Vote;
+
+/**
+ * Container that can be expanded or collapsed to respectively show or hide its
+ * children. When expanded, the rollup's children are displayed vertically like
+ * a vertical flow pane. When collapsed, only the rollup's first child is
+ * displayed.
+ *
+ * @author gbrown
+ * @author tvolkert
+ */
+public class Rollup extends pivot.wtk.Container {
+    private static class RollupListenerList extends ListenerList<RollupListener>
+        implements RollupListener {
+        public Vote previewExpandedChange(Rollup rollup) {
+            Vote vote = Vote.APPROVE;
+
+            for (RollupListener listener : this) {
+                vote = vote.tally(listener.previewExpandedChange(rollup));
+            }
+
+            return vote;
+        }
+
+        public void expandedChangeVetoed(Rollup rollup, Vote reason) {
+            for (RollupListener listener : this) {
+                listener.expandedChangeVetoed(rollup, reason);
+            }
+        }
+
+        public void expandedChanged(Rollup rollup) {
+            for (RollupListener listener : this) {
+                listener.expandedChanged(rollup);
+            }
+        }
+    }
+
+    private boolean expanded = true;
+    private RollupListenerList rollupListeners = new RollupListenerList();
+
+    public Rollup() {
+        this(false, null);
+    }
+
+    public Rollup(boolean expanded) {
+        this(expanded, null);
+    }
+
+    public Rollup(Component firstChild) {
+        this(false, firstChild);
+    }
+
+    public Rollup(boolean expanded, Component firstChild) {
+        this.expanded = expanded;
+
+        installSkin(Rollup.class);
+
+        if (firstChild != null) {
+            add(firstChild);
+        }
+    }
+
+    public boolean isExpanded() {
+        return expanded;
+    }
+
+    public void setExpanded(boolean expanded) {
+        if (expanded != this.expanded) {
+            Vote vote = rollupListeners.previewExpandedChange(this);
+
+            if (vote == Vote.APPROVE) {
+                this.expanded = expanded;
+                rollupListeners.expandedChanged(this);
+            } else {
+                rollupListeners.expandedChangeVetoed(this, vote);
+            }
+        }
+    }
+
+    public ListenerList<RollupListener> getRollupListeners() {
+        return rollupListeners;
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/RollupListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/RollupListener.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/RollupListener.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/RollupListener.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,49 @@
+/*
+ * 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.wtk;
+
+import pivot.util.Vote;
+
+/**
+ * Defines event listener methods that pertain to rollups. Developers register
+ * for such events by adding themselves to a rollup's list of "rollup
+ * listeners" (see {@link Rollup#getRollupListeners()}).
+ *
+ * @author tvolkert
+ */
+public interface RollupListener {
+    /**
+     * Called to preview a rollup expansion event.
+     *
+     * @param rollup
+     */
+    public Vote previewExpandedChange(Rollup rollup);
+
+    /**
+     * Called when a rollup expansion event has been vetoed.
+     *
+     * @param rollup
+     * @param reason
+     */
+    public void expandedChangeVetoed(Rollup rollup, Vote reason);
+
+    /**
+     * Called when a rollup's expanded state changed.
+     *
+     * @param rollup
+     */
+    public void expandedChanged(Rollup rollup);
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBar.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBar.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBar.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBar.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,215 @@
+/*
+ * 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.wtk;
+
+import pivot.util.ListenerList;
+
+/**
+ * Component that allows a user to select one of a range of values. Most often
+ * used by scroll panes.
+ *
+ * @author gbrown
+ */
+@ComponentInfo(icon="ScrollBar.png")
+public class ScrollBar extends Container {
+    private static class ScrollBarListenerList extends ListenerList<ScrollBarListener>
+        implements ScrollBarListener {
+        public void orientationChanged(ScrollBar scrollBar,
+            Orientation previousOrientation) {
+            for (ScrollBarListener listener : this) {
+                listener.orientationChanged(scrollBar, previousOrientation);
+            }
+        }
+
+        public void scopeChanged(ScrollBar scrollBar, int previousRangeStart,
+           int previousRangeEnd, int previousExtent) {
+            for (ScrollBarListener listener : this) {
+                listener.scopeChanged(scrollBar, previousRangeStart,
+                    previousRangeEnd, previousExtent);
+            }
+        }
+
+        public void unitIncrementChanged(ScrollBar scrollBar, int previousUnitIncrement) {
+            for (ScrollBarListener listener : this) {
+                listener.unitIncrementChanged(scrollBar, previousUnitIncrement);
+            }
+        }
+
+        public void blockIncrementChanged(ScrollBar scrollBar,
+            int previousBlockIncrement) {
+            for (ScrollBarListener listener : this) {
+                listener.blockIncrementChanged(scrollBar, previousBlockIncrement);
+            }
+        }
+    }
+
+    private static class ScrollBarValueListenerList extends ListenerList<ScrollBarValueListener>
+        implements ScrollBarValueListener {
+        public void valueChanged(ScrollBar scrollBar, int previousValue) {
+            for (ScrollBarValueListener listener : this) {
+                listener.valueChanged(scrollBar, previousValue);
+            }
+        }
+    }
+
+    private Orientation orientation;
+    private int rangeStart = 0;
+    private int rangeEnd = 100;
+    private int extent = 100;
+    private int value = 0;
+    private int unitIncrement = 1;
+    private int blockIncrement = 1;
+
+    private ScrollBarListenerList scrollBarListeners = new ScrollBarListenerList();
+    private ScrollBarValueListenerList scrollBarValueListeners =
+        new ScrollBarValueListenerList();
+
+    public ScrollBar(Orientation orientation) {
+        if (orientation == null) {
+            throw new IllegalArgumentException("orientation is null");
+        }
+
+        this.orientation = orientation;
+
+        installSkin(ScrollBar.class);
+    }
+
+    public Orientation getOrientation() {
+        return orientation;
+    }
+
+    public void setOrientation(Orientation orientation) {
+        if (orientation == null) {
+            throw new IllegalArgumentException("orientation is null");
+        }
+
+        Orientation previousOrientation = this.orientation;
+
+        if (orientation != previousOrientation) {
+            this.orientation = orientation;
+            scrollBarListeners.orientationChanged(this, previousOrientation);
+        }
+    }
+
+    public int getRangeStart() {
+        return rangeStart;
+    }
+
+    public int getRangeEnd() {
+        return rangeEnd;
+    }
+
+    public Span getRange() {
+        return new Span(rangeStart, rangeEnd);
+    }
+
+    public int getExtent() {
+        return extent;
+    }
+
+    public void setScope(int rangeStart, int rangeEnd, int extent) {
+        int previousRangeStart = this.rangeStart;
+        int previousRangeEnd = this.rangeEnd;
+        int previousExtent = this.extent;
+
+        if (rangeStart != previousRangeStart
+            || rangeEnd != previousRangeEnd
+            || extent != previousExtent) {
+            if (rangeStart > value) {
+                throw new IllegalArgumentException("rangeStart is greater than value");
+            }
+
+            if (extent < 0) {
+                throw new IllegalArgumentException("extent is negative");
+            }
+
+            if (rangeEnd < value + extent) {
+                throw new IllegalArgumentException("rangeEnd is less than value+extent");
+            }
+
+            this.rangeStart = rangeStart;
+            this.rangeEnd = rangeEnd;
+            this.extent = extent;
+
+            scrollBarListeners.scopeChanged(this, previousRangeStart,
+                previousRangeEnd, previousExtent);
+        }
+    }
+
+    public int getValue() {
+        return value;
+    }
+
+    public void setValue(int value) {
+        int previousValue = this.value;
+
+        if (value != previousValue) {
+            if (value < rangeStart) {
+                throw new IllegalArgumentException("value is less than rangeStart");
+            }
+
+            if (value + extent > rangeEnd) {
+                throw new IllegalArgumentException("value+extent is greater than rangeEnd");
+            }
+
+            this.value = value;
+
+            scrollBarValueListeners.valueChanged(this, previousValue);
+        }
+    }
+
+    public int getUnitIncrement() {
+        return unitIncrement;
+    }
+
+    public void setUnitIncrement(int unitIncrement) {
+        if (unitIncrement < 0) {
+            throw new IllegalArgumentException("unitIncrement is negative");
+        }
+
+        int previousUnitIncrement = this.unitIncrement;
+
+        if (unitIncrement != previousUnitIncrement) {
+            this.unitIncrement = unitIncrement;
+            scrollBarListeners.unitIncrementChanged(this, previousUnitIncrement);
+        }
+    }
+
+    public int getBlockIncrement() {
+        return blockIncrement;
+    }
+
+    public void setBlockIncrement(int blockIncrement) {
+        if (blockIncrement < 0) {
+            throw new IllegalArgumentException("blockIncrement is negative");
+        }
+
+        int previousBlockIncrement = this.blockIncrement;
+
+        if (blockIncrement != previousBlockIncrement) {
+            this.blockIncrement = blockIncrement;
+            scrollBarListeners.blockIncrementChanged(this, previousBlockIncrement);
+        }
+    }
+
+    public ListenerList<ScrollBarListener> getScrollBarListeners() {
+        return scrollBarListeners;
+    }
+
+    public ListenerList<ScrollBarValueListener> getScrollBarValueListeners() {
+        return scrollBarValueListeners;
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBar.png
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBar.png?rev=754936&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBar.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBarListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBarListener.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBarListener.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBarListener.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,58 @@
+/*
+ * 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.wtk;
+
+/**
+ * Scroll bar listener interface.
+ *
+ * @author tvolkert
+ */
+public interface ScrollBarListener {
+    /**
+     * Called when a scroll bar's orientation has changed.
+     *
+     * @param scrollBar
+     * @param previousOrientation
+     */
+    public void orientationChanged(ScrollBar scrollBar, Orientation previousOrientation);
+
+    /**
+     * Called when a scroll bar's scope has changed.
+     *
+     * @param scrollBar
+     * @param previousRangeStart
+     * @param previousRangeEnd
+     * @param previousExtent
+     */
+    public void scopeChanged(ScrollBar scrollBar, int previousRangeStart,
+        int previousRangeEnd, int previousExtent);
+
+    /**
+     * Called when a scroll bar's unit increment has changed.
+     *
+     * @param scrollBar
+     * @param previousUnitIncrement
+     */
+    public void unitIncrementChanged(ScrollBar scrollBar, int previousUnitIncrement);
+
+    /**
+     * Called when a scroll bar's block increment ahs changed.
+     *
+     * @param scrollBar
+     * @param previousBlockIncrement
+     */
+    public void blockIncrementChanged(ScrollBar scrollBar, int previousBlockIncrement);
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBarValueListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBarValueListener.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBarValueListener.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollBarValueListener.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.wtk;
+
+/**
+ * Scroll bar value listener interface.
+ *
+ * @author tvolkert
+ */
+public interface ScrollBarValueListener {
+    /**
+     * Called when a scroll bar's value has changed.
+     *
+     * @param scrollBar
+     * @param previousValue
+     */
+    public void valueChanged(ScrollBar scrollBar, int previousValue);
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollPane.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollPane.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollPane.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollPane.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,351 @@
+/*
+ * 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.wtk;
+
+import pivot.collections.Sequence;
+import pivot.util.ListenerList;
+
+/**
+ * Container that provides a scrollable view of a component, with optional
+ * fixed row and column headers.
+ *
+ * @author tvolkert
+ */
+@ComponentInfo(icon="ScrollPane.png")
+public class ScrollPane extends Viewport {
+    /**
+     * Enumeration defining scroll pane scroll bar policies.
+     *
+     * @author gbrown
+     */
+    public enum ScrollBarPolicy {
+        AUTO,
+        NEVER,
+        ALWAYS,
+        FILL,
+        FILL_TO_CAPACITY;
+
+        public static ScrollBarPolicy decode(String value) {
+            if (value == null) {
+                throw new IllegalArgumentException("value is null.");
+            }
+
+            ScrollBarPolicy scrollBarPolicy = null;
+
+            if (value.equalsIgnoreCase("auto")) {
+                scrollBarPolicy = AUTO;
+            } else if (value.equalsIgnoreCase("never")) {
+                scrollBarPolicy = NEVER;
+            } else if (value.equalsIgnoreCase("always")) {
+                scrollBarPolicy = ALWAYS;
+            } else if (value.equalsIgnoreCase("fill")) {
+                scrollBarPolicy = FILL;
+            } else if (value.equalsIgnoreCase("fillToCapacity")) {
+                scrollBarPolicy = FILL_TO_CAPACITY;
+            } else {
+                throw new IllegalArgumentException("\"" + value
+                    + "\" is not a valid scroll bar policy.");
+            }
+
+            return scrollBarPolicy;
+        }
+    }
+
+    private static class ScrollPaneListenerList extends ListenerList<ScrollPaneListener>
+        implements ScrollPaneListener {
+
+        public void horizontalScrollBarPolicyChanged(ScrollPane scrollPane,
+            ScrollBarPolicy previousHorizontalScrollBarPolicy) {
+            for (ScrollPaneListener listener : this) {
+                listener.horizontalScrollBarPolicyChanged(scrollPane,
+                    previousHorizontalScrollBarPolicy);
+            }
+        }
+
+        public void verticalScrollBarPolicyChanged(ScrollPane scrollPane,
+            ScrollBarPolicy previousVerticalScrollBarPolicy) {
+            for (ScrollPaneListener listener : this) {
+                listener.verticalScrollBarPolicyChanged(scrollPane,
+                    previousVerticalScrollBarPolicy);
+            }
+        }
+
+        public void rowHeaderChanged(ScrollPane scrollPane, Component previousRowHeader) {
+            for (ScrollPaneListener listener : this) {
+                listener.rowHeaderChanged(scrollPane, previousRowHeader);
+            }
+        }
+
+        public void columnHeaderChanged(ScrollPane scrollPane,
+            Component previousColumnHeader) {
+            for (ScrollPaneListener listener : this) {
+                listener.columnHeaderChanged(scrollPane, previousColumnHeader);
+            }
+        }
+
+        public void cornerChanged(ScrollPane scrollPane, Component previousCorner) {
+            for (ScrollPaneListener listener : this) {
+                listener.cornerChanged(scrollPane, previousCorner);
+            }
+        }
+    }
+
+    /**
+     * Component class representing the components that will get placed in the
+     * corners of a <tt>ScrollPane</tt>. Skins will instantiate these
+     * components as needed when unfilled corners are introduced by a row
+     * header or column header.
+     *
+     * @author tvolkert
+     */
+    public static class Corner extends Component {
+        /**
+         * Enumeration defining placement values for scroll pane corners.
+         *
+         * @author tvolkert
+         */
+        public static enum Placement {
+            TOP_LEFT,
+            BOTTOM_LEFT,
+            BOTTOM_RIGHT,
+            TOP_RIGHT;
+        }
+
+        private Placement placement;
+
+        public Corner(Placement placement) {
+            if (placement == null) {
+                throw new IllegalArgumentException("Placement is null.");
+            }
+
+            this.placement = placement;
+
+            installSkin(Corner.class);
+        }
+
+        public Placement getPlacement() {
+            return placement;
+        }
+    }
+
+    private ScrollBarPolicy horizontalScrollBarPolicy;
+    private ScrollBarPolicy verticalScrollBarPolicy;
+    private Component rowHeader;
+    private Component columnHeader;
+    private Component corner;
+    private ScrollPaneListenerList scrollPaneListeners = new ScrollPaneListenerList();
+
+    public ScrollPane() {
+        this(ScrollBarPolicy.AUTO, ScrollBarPolicy.AUTO);
+    }
+
+    public ScrollPane(ScrollBarPolicy horizontalScrollBarPolicy,
+        ScrollBarPolicy verticalScrollBarPolicy) {
+        super();
+
+        if (horizontalScrollBarPolicy == null) {
+            throw new IllegalArgumentException("horizontalScrollBarPolicy is null");
+        }
+
+        if (verticalScrollBarPolicy == null) {
+            throw new IllegalArgumentException("verticalScrollBarPolicy is null");
+        }
+
+        this.horizontalScrollBarPolicy = horizontalScrollBarPolicy;
+        this.verticalScrollBarPolicy = verticalScrollBarPolicy;
+
+        installSkin(ScrollPane.class);
+    }
+
+    public ScrollBarPolicy getHorizontalScrollBarPolicy() {
+        return horizontalScrollBarPolicy;
+    }
+
+    public void setHorizontalScrollBarPolicy(ScrollBarPolicy horizontalScrollBarPolicy) {
+        if (horizontalScrollBarPolicy == null) {
+            throw new IllegalArgumentException("horizontalScrollBarPolicy is null");
+        }
+
+        ScrollBarPolicy previousHorizontalScrollBarPolicy = this.horizontalScrollBarPolicy;
+
+        if (horizontalScrollBarPolicy != previousHorizontalScrollBarPolicy) {
+            this.horizontalScrollBarPolicy = horizontalScrollBarPolicy;
+            scrollPaneListeners.horizontalScrollBarPolicyChanged(this,
+                previousHorizontalScrollBarPolicy);
+        }
+    }
+
+    public void setHorizontalScrollBarPolicy(String horizontalScrollBarPolicy) {
+        if (horizontalScrollBarPolicy == null) {
+            throw new IllegalArgumentException("horizontalScrollBarPolicy is null.");
+        }
+
+        setHorizontalScrollBarPolicy(ScrollBarPolicy.decode(horizontalScrollBarPolicy));
+    }
+
+    public ScrollBarPolicy getVerticalScrollBarPolicy() {
+        return verticalScrollBarPolicy;
+    }
+
+    public void setVerticalScrollBarPolicy(ScrollBarPolicy verticalScrollBarPolicy) {
+        if (verticalScrollBarPolicy == null) {
+            throw new IllegalArgumentException("verticalScrollBarPolicy is null");
+        }
+
+        ScrollBarPolicy previousVerticalScrollBarPolicy = this.verticalScrollBarPolicy;
+
+        if (verticalScrollBarPolicy != previousVerticalScrollBarPolicy) {
+            this.verticalScrollBarPolicy = verticalScrollBarPolicy;
+            scrollPaneListeners.verticalScrollBarPolicyChanged(this,
+                previousVerticalScrollBarPolicy);
+        }
+    }
+
+    public void setVerticalScrollBarPolicy(String verticalScrollBarPolicy) {
+        if (verticalScrollBarPolicy == null) {
+            throw new IllegalArgumentException("verticalScrollBarPolicy is null.");
+        }
+
+        setVerticalScrollBarPolicy(ScrollBarPolicy.decode(verticalScrollBarPolicy));
+    }
+
+    public Component getRowHeader() {
+        return rowHeader;
+    }
+
+    public void setRowHeader(Component rowHeader) {
+        Component previousRowHeader = this.rowHeader;
+
+        if (rowHeader != previousRowHeader) {
+            // Remove any previous rowHeader component
+            if (previousRowHeader != null) {
+                remove(previousRowHeader);
+            }
+
+            this.rowHeader = null;
+
+            if (rowHeader != null) {
+                if (rowHeader.getParent() != null) {
+                    throw new IllegalArgumentException("Component already has a parent.");
+                }
+
+                int insertionIndex = 0;
+
+                if (getView() != null) {
+                    insertionIndex++;
+                }
+
+                // Add the component
+                insert(rowHeader, insertionIndex);
+            }
+
+            this.rowHeader = rowHeader;
+
+            scrollPaneListeners.rowHeaderChanged(this, previousRowHeader);
+        }
+    }
+
+    public Component getColumnHeader() {
+        return columnHeader;
+    }
+
+    public void setColumnHeader(Component columnHeader) {
+        Component previousColumnHeader = this.columnHeader;
+
+        if (columnHeader != previousColumnHeader) {
+            // Remove any previous columnHeader component
+            if (previousColumnHeader != null) {
+                remove(previousColumnHeader);
+            }
+
+            this.columnHeader = null;
+
+            if (columnHeader != null) {
+                int insertionIndex = 0;
+
+                if (getView() != null) {
+                    insertionIndex++;
+                }
+
+                // Add the component
+                insert(columnHeader, insertionIndex);
+            }
+
+            this.columnHeader = columnHeader;
+
+            scrollPaneListeners.columnHeaderChanged(this, previousColumnHeader);
+        }
+    }
+
+    public Component getCorner() {
+        return corner;
+    }
+
+    public void setCorner(Component corner) {
+        Component previousCorner = this.corner;
+
+        if (corner != this.corner) {
+            // Remove any previous corner component
+            if (previousCorner != null) {
+                remove(previousCorner);
+            }
+
+            this.corner = null;
+
+            if (corner != null) {
+                int insertionIndex = 0;
+
+                if (getView() != null) {
+                    insertionIndex++;
+                }
+
+                if (rowHeader != null) {
+                    insertionIndex++;
+                }
+
+                if (columnHeader != null) {
+                    insertionIndex++;
+                }
+
+                // Add the component
+                insert(corner, insertionIndex);
+            }
+
+            this.corner = corner;
+
+            scrollPaneListeners.cornerChanged(this, previousCorner);
+        }
+    }
+
+    @Override
+    public Sequence<Component> remove(int index, int count) {
+        for (int i = index, n = index + count; i < n; i++) {
+            Component component = get(i);
+            if (component == rowHeader
+                || component == columnHeader
+                || component == corner) {
+                throw new UnsupportedOperationException();
+            }
+        }
+
+        // Call the base method to remove the components
+        return super.remove(index, count);
+    }
+
+    public ListenerList<ScrollPaneListener> getScrollPaneListeners() {
+        return scrollPaneListeners;
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollPane.png
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollPane.png?rev=754936&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollPane.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollPaneListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollPaneListener.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollPaneListener.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/ScrollPaneListener.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,66 @@
+/*
+ * 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.wtk;
+
+/**
+ * Scroll pane listener interface.
+ *
+ * @author tvolkert
+ */
+public interface ScrollPaneListener {
+    /**
+     * Called when the scroll pane's horizontal scroll bar policy changed.
+     *
+     * @param scrollPane
+     * @param previousPolicy
+     */
+    public void horizontalScrollBarPolicyChanged(ScrollPane scrollPane,
+        ScrollPane.ScrollBarPolicy previousPolicy);
+
+    /**
+     * Called when the scroll pane's vertical scroll bar policy changed.
+     *
+     * @param scrollPane
+     * @param previousPolicy
+     */
+    public void verticalScrollBarPolicyChanged(ScrollPane scrollPane,
+        ScrollPane.ScrollBarPolicy previousPolicy);
+
+    /**
+     * Called when the scroll pane's row header changed.
+     *
+     * @param scrollPane
+     * @param previousRowHeader
+     */
+    public void rowHeaderChanged(ScrollPane scrollPane, Component previousRowHeader);
+
+    /**
+     * Called when the scroll pane's column header changed.
+     *
+     * @param scrollPane
+     * @param previousColumnHeader
+     */
+    public void columnHeaderChanged(ScrollPane scrollPane,
+        Component previousColumnHeader);
+
+    /**
+     * Called when the scroll pane's corner component changed.
+     *
+     * @param scrollPane
+     * @param previousCorner
+     */
+    public void cornerChanged(ScrollPane scrollPane, Component previousCorner);
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Separator.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Separator.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Separator.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Separator.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,61 @@
+package pivot.wtk;
+
+import pivot.util.ListenerList;
+
+/**
+ * Component representing a horizontal divider.
+ *
+ * @author gbrown
+ */
+public class Separator extends Component {
+    private static class SeparatorListenerList extends ListenerList<SeparatorListener>
+        implements SeparatorListener {
+        public void headingChanged(Separator separator, String previousHeading) {
+            for (SeparatorListener listener : this) {
+                listener.headingChanged(separator, previousHeading);
+            }
+        }
+    }
+
+    private String heading = null;
+
+    private SeparatorListenerList separatorListeners = new SeparatorListenerList();
+
+    public Separator() {
+        this(null);
+    }
+
+    public Separator(String heading) {
+        setHeading(heading);
+        installSkin(Separator.class);
+    }
+
+    /**
+     * Returns the separator's heading.
+     *
+     * @return
+     * The separator's heading, or <tt>null</tt> if no heading is set.
+     */
+    public String getHeading() {
+        return heading;
+    }
+
+    /**
+     * Sets the separator's heading.
+     *
+     * @param heading
+     * The new heading, or <tt>null</tt> for no heading.
+     */
+    public void setHeading(String heading) {
+        String previousHeading = this.heading;
+
+        if (previousHeading != heading) {
+            this.heading = heading;
+            separatorListeners.headingChanged(this, previousHeading);
+        }
+    }
+
+    public ListenerList<SeparatorListener> getSeparatorListeners() {
+        return separatorListeners;
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SeparatorListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SeparatorListener.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SeparatorListener.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SeparatorListener.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,16 @@
+package pivot.wtk;
+
+/**
+ * Separator listener interface.
+ *
+ * @author gbrown
+ */
+public interface SeparatorListener {
+    /**
+     * Called when a separator's heading has changed.
+     *
+     * @param separator
+     * @param previousHeading
+     */
+    public void headingChanged(Separator separator, String previousHeading);
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Sheet.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Sheet.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Sheet.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Sheet.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,231 @@
+/*
+ * 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.wtk;
+
+import pivot.util.ListenerList;
+import pivot.util.Vote;
+
+/**
+ * Window class representing a "sheet". A sheet behaves like a dialog that is
+ * modal only over a window's content component.
+ *
+ * @author gbrown
+ */
+@ComponentInfo(icon="Sheet.png")
+public class Sheet extends Window {
+    private static class SheetStateListenerList extends ListenerList<SheetStateListener>
+        implements SheetStateListener {
+        public Vote previewSheetClose(Sheet sheet, boolean result) {
+            Vote vote = Vote.APPROVE;
+
+            for (SheetStateListener listener : this) {
+                vote = vote.tally(listener.previewSheetClose(sheet, result));
+            }
+
+            return vote;
+        }
+
+        public void sheetCloseVetoed(Sheet sheet, Vote reason) {
+            for (SheetStateListener listener : this) {
+                listener.sheetCloseVetoed(sheet, reason);
+            }
+        }
+
+        public void sheetClosed(Sheet sheet) {
+            for (SheetStateListener listener : this) {
+                listener.sheetClosed(sheet);
+            }
+        }
+    }
+
+    private boolean result = false;
+    private SheetCloseListener sheetCloseListener = null;
+
+    private ComponentListener ownerListener = new ComponentListener() {
+        public void parentChanged(Component component, Container previousParent) {
+            // No-op
+        }
+
+        public void sizeChanged(Component component, int previousWidth, int previousHeight) {
+            alignToOwnerContent();
+        }
+
+        public void locationChanged(Component component, int previousX, int previousY) {
+            alignToOwnerContent();
+        }
+
+        public void visibleChanged(Component component) {
+            // No-op
+        }
+
+        public void styleUpdated(Component component, String styleKey, Object previousValue) {
+            // No-op
+        }
+
+        public void cursorChanged(Component component, Cursor previousCursor) {
+            // No-op
+        }
+
+        public void tooltipTextChanged(Component component, String previousTooltipText) {
+            // No-op
+        }
+    };
+
+    private SheetStateListenerList sheetStateListeners = new SheetStateListenerList();
+
+    /**
+     * Creates a new sheet.
+     */
+    public Sheet() {
+        this(null);
+    }
+
+    /**
+     * Creates a new sheet with an initial content component.
+     *
+     * @param content
+     * The sheet's content component.
+     */
+    public Sheet(Component content) {
+        super(content);
+
+        installSkin(Sheet.class);
+    }
+
+    @Override
+    public void setSize(int width, int height) {
+    	super.setSize(width, height);
+
+        ApplicationContext.queueCallback(new Runnable() {
+            public void run() {
+                alignToOwnerContent();
+            }
+        });
+    }
+
+    /**
+     * @return
+     * <tt>true</tt>; by default, sheets are auxilliary windows.
+     */
+    @Override
+    public boolean isAuxilliary() {
+        return true;
+    }
+
+    @Override
+    public final void setOwner(Window owner) {
+        if (owner == null) {
+            throw new UnsupportedOperationException("A sheet must have an owner.");
+        }
+
+        if (owner.getContent() == null) {
+            throw new UnsupportedOperationException("A sheet's owner must have a content component.");
+        }
+
+        super.setOwner(owner);
+    }
+
+    @Override
+    public void open(Display display) {
+        super.open(display);
+
+        if (isOpen()) {
+            Window owner = getOwner();
+            owner.getComponentListeners().add(ownerListener);
+
+            Component content = owner.getContent();
+            if (content.isBlocked()) {
+            	throw new IllegalStateException("Owner content is already blocked.");
+            }
+
+            content.setEnabled(false);
+
+            ApplicationContext.queueCallback(new Runnable() {
+                public void run() {
+                    alignToOwnerContent();
+                }
+            });
+        }
+    }
+
+    public final void open(Window owner) {
+        open(owner, null);
+    }
+
+    public void open(Window owner, SheetCloseListener sheetCloseListener) {
+        super.open(owner);
+
+        if (isOpen()) {
+            this.sheetCloseListener = sheetCloseListener;
+        }
+    }
+
+    @Override
+    public final void close() {
+        close(false);
+    }
+
+    public void close(boolean result) {
+        if (!isClosed()) {
+            Vote vote = sheetStateListeners.previewSheetClose(this, result);
+
+            if (vote.isApproved()) {
+                super.close();
+
+                if (isClosed()) {
+                    this.result = result;
+
+                    Window owner = getOwner();
+                    owner.getComponentListeners().remove(ownerListener);
+
+                    Component content = owner.getContent();
+                    content.setEnabled(true);
+
+                    owner.moveToFront();
+
+                    if (sheetCloseListener != null) {
+                        sheetCloseListener.sheetClosed(this);
+                        sheetCloseListener = null;
+                    }
+
+                    sheetStateListeners.sheetClosed(this);
+                }
+            } else {
+                sheetStateListeners.sheetCloseVetoed(this, vote);
+            }
+        }
+    }
+
+    public SheetCloseListener getSheetCloseListener() {
+        return sheetCloseListener;
+    }
+
+    public boolean getResult() {
+        return result;
+    }
+
+    private void alignToOwnerContent() {
+        Window owner = getOwner();
+        Component content = owner.getContent();
+        Point contentLocation = content.mapPointToAncestor(owner.getDisplay(), 0, 0);
+        setLocation(contentLocation.x + (content.getWidth() - getWidth()) / 2,
+            contentLocation.y);
+    }
+
+    public ListenerList<SheetStateListener> getSheetStateListeners() {
+        return sheetStateListeners;
+    }
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Sheet.png
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Sheet.png?rev=754936&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Sheet.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SheetCloseListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SheetCloseListener.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SheetCloseListener.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SheetCloseListener.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.wtk;
+
+/**
+ * Sheet close listener interface.
+ *
+ * @author gbrown
+ */
+public interface SheetCloseListener {
+    /**
+     * Called when a sheet has closed.
+     *
+     * @param sheet
+     */
+    public void sheetClosed(Sheet sheet);
+
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SheetStateListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SheetStateListener.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SheetStateListener.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SheetStateListener.java Mon Mar 16 16:36:10 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.wtk;
+
+import pivot.util.Vote;
+
+/**
+ * Sheet state listener interface.
+ *
+ * @author gbrown
+ */
+public interface SheetStateListener extends SheetCloseListener {
+    /**
+     * Called to preview a sheet close event.
+     *
+     * @param sheet
+     * @param result
+     */
+    public Vote previewSheetClose(Sheet sheet, boolean result);
+
+    /**
+     * Called when a sheet close event has been vetoed.
+     *
+     * @param sheet
+     * @param reason
+     */
+    public void sheetCloseVetoed(Sheet sheet, Vote reason);
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Skin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Skin.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Skin.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/Skin.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,83 @@
+/*
+ * 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.wtk;
+
+/**
+ * Interface defining a "skin". A skin is the graphical representation
+ * of a component. In MVC terminology, a skin represents the "view" of the
+ * "model" data provided by a component. Components delegate a number of methods
+ * to the skin, including all methods defined by the <tt>Visual</tt> interface
+ * as well as style properties and layout. In conjunction with renderers
+ * (implementations of the <tt>Renderer</tt> interface), skins define the
+ * overall look and feel of an application.
+ * <p>
+ * Skins are primarily responsible for the following:
+ * <ul>
+ * <li>Painting the component; if a container, this is effectively the
+ * background of the container - the Container class itself will paint the
+ * subcomponents.</li>
+ * <li>Layout of subcomponents; if not a container, <tt>layout()</tt> is
+ * a no-op (it exists solely to avoid type checking during layout).</li>
+ * </ul>
+ * Skins will often change their appearance in response to events fired by
+ * the component; most commonly, this will be in response to data changes within
+ * the component but may also be in response to input events (e.g. keyboard,
+ * mouse). Skins are not required to register for such events - skin base
+ * classes implement all relevant listener interfaces and the component calls
+ * them as appropriate.
+ * <p>
+ * Skins may (but are not required to) expose internal properties that
+ * affect the appearance of the component as "style properties", similar to CSS
+ * styles. For example, a component might provide styles to let a caller
+ * set the foreground color and font. Since callers are not allowed to interact
+ * with a component's skin directly, access to styles is via the component's
+ * styles collection, which delegates to the dictionary methods in the installed
+ * skin. Skins are responsible for invalidating or repainting the component as
+ * appropriate in response to events and style changes.
+ */
+public interface Skin extends ConstrainedVisual {
+    /**
+     * Associates a skin with a component.
+     *
+     * @param component
+     * The component to which the skin is being attached.
+     */
+    public void install(Component component);
+
+    /**
+     * Dissociates a skin from a component.
+     */
+    public void uninstall();
+
+    /**
+     * Returns the component with which a skin is associated.
+     */
+    public Component getComponent();
+
+    /**
+     * If the component on which the skin is installed is a container, lays
+     * out the container's children.
+     */
+    public void layout();
+
+    /**
+     * Returns the skin's focusable state.
+     *
+     * @return
+     * <tt>true</tt> if this skin is focusable; </tt>false</tt>, otherwise.
+     */
+    public boolean isFocusable();
+}

Added: incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SortDirection.java
URL: http://svn.apache.org/viewvc/incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SortDirection.java?rev=754936&view=auto
==============================================================================
--- incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SortDirection.java (added)
+++ incubator/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SortDirection.java Mon Mar 16 16:36:10 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.wtk;
+
+/**
+ * Enumeration representing a sort direction. A value of <tt>null</tt> is
+ * assumed to mean "no sort".
+ *
+ * @author gbrown
+ */
+public enum SortDirection {
+    ASCENDING,
+    DESCENDING;
+
+    public static SortDirection decode(String value) {
+        return valueOf(value.toUpperCase());
+    }
+}