pivot-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gbr...@apache.org
Subject svn commit: r800944 - in /incubator/pivot/trunk: tutorials/src/org/apache/pivot/tutorials/ tutorials/src/org/apache/pivot/tutorials/navigation/ wtk/src/org/apache/pivot/wtk/skin/terra/
Date Tue, 04 Aug 2009 20:15:19 GMT
Author: gbrown
Date: Tue Aug  4 20:15:18 2009
New Revision: 800944

URL: http://svn.apache.org/viewvc?rev=800944&view=rev
Log:
Add tutorial examples for Rollup, ScrollPane, and Panorama; fix some issues in TerraTooltipSkin.

Added:
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/IMG_1147.jpg   (with props)
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Panoramas.java
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Rollups.java
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/ScrollPanes.java
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/panoramas.wtkx
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/rollups.wtkx
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/scroll_panes.wtkx
Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTooltipSkin.java

Added: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/IMG_1147.jpg
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/IMG_1147.jpg?rev=800944&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/IMG_1147.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Panoramas.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Panoramas.java?rev=800944&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Panoramas.java
(added)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Panoramas.java
Tue Aug  4 20:15:18 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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 org.apache.pivot.tutorials.navigation;
+
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtkx.WTKXSerializer;
+
+public class Panoramas implements Application {
+    private Window window = null;
+
+    public void startup(Display display, Map<String, String> properties) throws Exception
{
+        WTKXSerializer wtkxSerializer = new WTKXSerializer();
+        window = (Window)wtkxSerializer.readObject(this, "panoramas.wtkx");
+        window.open(display);
+    }
+
+    public boolean shutdown(boolean optional) {
+        if (window != null) {
+            window.close();
+        }
+
+        return false;
+    }
+
+    public void suspend() {
+    }
+
+    public void resume() {
+    }
+
+    public static void main(String[] args) {
+        DesktopApplicationContext.main(Panoramas.class, args);
+    }
+}

Added: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Rollups.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Rollups.java?rev=800944&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Rollups.java
(added)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Rollups.java
Tue Aug  4 20:15:18 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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 org.apache.pivot.tutorials.navigation;
+
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtkx.WTKXSerializer;
+
+public class Rollups implements Application {
+    private Window window = null;
+
+    public void startup(Display display, Map<String, String> properties) throws Exception
{
+        WTKXSerializer wtkxSerializer = new WTKXSerializer();
+        window = (Window)wtkxSerializer.readObject(this, "rollups.wtkx");
+        window.open(display);
+    }
+
+    public boolean shutdown(boolean optional) {
+        if (window != null) {
+            window.close();
+        }
+
+        return false;
+    }
+
+    public void suspend() {
+    }
+
+    public void resume() {
+    }
+
+    public static void main(String[] args) {
+        DesktopApplicationContext.main(Rollups.class, args);
+    }
+}

Added: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/ScrollPanes.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/ScrollPanes.java?rev=800944&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/ScrollPanes.java
(added)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/ScrollPanes.java
Tue Aug  4 20:15:18 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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 org.apache.pivot.tutorials.navigation;
+
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtkx.WTKXSerializer;
+
+public class ScrollPanes implements Application {
+    private Window window = null;
+
+    public void startup(Display display, Map<String, String> properties) throws Exception
{
+        WTKXSerializer wtkxSerializer = new WTKXSerializer();
+        window = (Window)wtkxSerializer.readObject(this, "scroll_panes.wtkx");
+        window.open(display);
+    }
+
+    public boolean shutdown(boolean optional) {
+        if (window != null) {
+            window.close();
+        }
+
+        return false;
+    }
+
+    public void suspend() {
+    }
+
+    public void resume() {
+    }
+
+    public static void main(String[] args) {
+        DesktopApplicationContext.main(ScrollPanes.class, args);
+    }
+}

Added: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/panoramas.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/panoramas.wtkx?rev=800944&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/panoramas.wtkx
(added)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/panoramas.wtkx
Tue Aug  4 20:15:18 2009
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you 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.
+-->
+
+<Window title="Panoramas" maximized="true"
+    xmlns:wtkx="http://pivot.apache.org/wtkx"
+    xmlns="org.apache.pivot.wtk">
+    <content>
+        <Border styles="{padding:0, color:10}">
+            <content>
+                <Panorama styles="{buttonColor:'0xffffffff', buttonBackgroundColor:'0x00000044'}">
+                    <view>
+                        <ImageView image="org/apache/pivot/tutorials/IMG_1147.jpg"
+                            tooltipText="Pemaquid Point Lighthouse, Bristol ME"/>
+                    </view>
+                </Panorama>
+            </content>
+        </Border>
+    </content>
+</Window>

Added: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/rollups.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/rollups.wtkx?rev=800944&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/rollups.wtkx
(added)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/rollups.wtkx
Tue Aug  4 20:15:18 2009
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you 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.
+-->
+
+<Window title="Rollups" maximized="true"
+    xmlns:wtkx="http://pivot.apache.org/wtkx"
+    xmlns="org.apache.pivot.wtk">
+    <content>
+        <Border styles="{padding:6}">
+            <content>
+                <ScrollPane horizontalScrollBarPolicy="fill">
+                    <view>
+                        <BoxPane orientation="vertical" styles="{fill:true,
+                            padding:{left:2, right:2}}">
+                            <Rollup expanded="true">
+                                <heading>
+                                    <Label text="Stocks" styles="{fontBold:true, color:13}"/>
+                                </heading>
+                                <content>
+                                    <wtkx:include src="stocks.wtkx"/>
+                                </content>
+                            </Rollup>
+                            <Rollup>
+                                <heading>
+                                    <Label text="Weather" styles="{fontBold:true, color:13}"/>
+                                </heading>
+                                <content>
+                                    <wtkx:include src="weather.wtkx"/>
+                                </content>
+                            </Rollup>
+                            <Rollup>
+                                <heading>
+                                    <Label text="Calendar" styles="{fontBold:true, color:13}"/>
+                                </heading>
+                                <content>
+                                    <wtkx:include src="calendar.wtkx"/>
+                                </content>
+                            </Rollup>
+                            <Rollup>
+                                <heading>
+                                    <Label text="Nested" styles="{fontBold:true, color:13}"/>
+                                </heading>
+                                <content>
+                                    <BoxPane orientation="vertical">
+                                        <Rollup>
+                                            <heading>
+                                                <Label text="Level 1"/>
+                                            </heading>
+                                            <content>
+                                                <Label text="Level 1 content" styles="{fontItalic:true}"/>
+                                            </content>
+                                        </Rollup>
+
+                                        <Rollup>
+                                            <heading>
+                                                <Label text="Level 2"/>
+                                            </heading>
+                                            <content>
+                                                <Label text="Level 2 content" styles="{fontItalic:true}"/>
+                                            </content>
+                                        </Rollup>
+
+                                        <Rollup>
+                                            <heading>
+                                                <Label text="Level 3"/>
+                                            </heading>
+                                            <content>
+                                                <Label text="Level 3 content" styles="{fontItalic:true}"/>
+                                            </content>
+                                        </Rollup>
+                                    </BoxPane>
+                                </content>
+                            </Rollup>
+                        </BoxPane>
+                    </view>
+                </ScrollPane>
+            </content>
+        </Border>
+    </content>
+</Window>

Added: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/scroll_panes.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/scroll_panes.wtkx?rev=800944&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/scroll_panes.wtkx
(added)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/scroll_panes.wtkx
Tue Aug  4 20:15:18 2009
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you 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.
+-->
+
+<Window title="Scroll Panes" maximized="true"
+    xmlns:wtkx="http://pivot.apache.org/wtkx"
+    xmlns="org.apache.pivot.wtk">
+    <content>
+        <Border styles="{padding:0, color:10}">
+            <content>
+                <ScrollPane>
+                    <view>
+                        <ImageView image="org/apache/pivot/tutorials/IMG_1147.jpg"
+                            tooltipText="Pemaquid Point Lighthouse, Bristol ME"/>
+                    </view>
+                </ScrollPane>
+            </content>
+        </Border>
+    </content>
+</Window>

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTooltipSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTooltipSkin.java?rev=800944&r1=800943&r2=800944&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTooltipSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTooltipSkin.java Tue
Aug  4 20:15:18 2009
@@ -22,9 +22,8 @@
 import org.apache.pivot.wtk.Border;
 import org.apache.pivot.wtk.Component;
 import org.apache.pivot.wtk.ComponentKeyListener;
-import org.apache.pivot.wtk.ComponentMouseButtonListener;
-import org.apache.pivot.wtk.ComponentMouseListener;
-import org.apache.pivot.wtk.ComponentMouseWheelListener;
+import org.apache.pivot.wtk.Container;
+import org.apache.pivot.wtk.ContainerMouseListener;
 import org.apache.pivot.wtk.Display;
 import org.apache.pivot.wtk.Insets;
 import org.apache.pivot.wtk.Keyboard;
@@ -39,70 +38,55 @@
 import org.apache.pivot.wtk.effects.TransitionListener;
 import org.apache.pivot.wtk.skin.WindowSkin;
 
-
 /**
  * Tooltip skin.
  *
  * @author gbrown
  */
 public class TerraTooltipSkin extends WindowSkin implements TooltipListener {
-    private class CloseHandler implements ComponentMouseListener,
-        ComponentMouseButtonListener, ComponentMouseWheelListener,
-        ComponentKeyListener {
-        // Component mouse events
-        public boolean mouseMove(Component component, int x, int y) {
-            Tooltip tooltip = (Tooltip)getComponent();
-            tooltip.close();
-            return false;
-        }
-
-        public void mouseOver(Component component) {
-        }
+    private Label label = new Label();
+    private Border border = new Border();
 
-        public void mouseOut(Component component) {
-        }
+    private boolean fade = true;
 
-        public boolean mouseDown(Component component, Mouse.Button button, int x, int y)
{
+    private ContainerMouseListener displayContainerMouseListener = new ContainerMouseListener()
{
+        public boolean mouseMove(Container container, int x, int y) {
             Tooltip tooltip = (Tooltip)getComponent();
             tooltip.close();
             return false;
         }
 
-        public boolean mouseUp(Component component, Mouse.Button button, int x, int y) {
+        public boolean mouseDown(Container container, Mouse.Button button, int x, int y)
{
+            Tooltip tooltip = (Tooltip)getComponent();
+            tooltip.close();
             return false;
         }
 
-        public boolean mouseClick(Component component, Mouse.Button button, int x, int y,
int count) {
+        public boolean mouseUp(Container container, Mouse.Button button, int x, int y) {
+            Tooltip tooltip = (Tooltip)getComponent();
+            tooltip.close();
             return false;
         }
 
-        public boolean mouseWheel(Component component, Mouse.ScrollType scrollType,
+        public boolean mouseWheel(Container container, Mouse.ScrollType scrollType,
             int scrollAmount, int wheelRotation, int x, int y) {
+            fade = false;
             Tooltip tooltip = (Tooltip)getComponent();
             tooltip.close();
             return false;
         }
+    };
 
-        // Component key events
-        public boolean keyTyped(Component component, char character) {
-            return false;
-        }
-
+    private ComponentKeyListener displayKeyListener = new ComponentKeyListener.Adapter()
{
+        @Override
         public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation
keyLocation) {
+            fade = false;
             Tooltip tooltip = (Tooltip)getComponent();
             tooltip.close();
             return false;
         }
+    };
 
-        public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation
keyLocation) {
-            return false;
-        }
-    }
-
-    private Label label = new Label();
-    private Border border = new Border();
-
-    private CloseHandler closeHandler = new CloseHandler();
     private Transition closeTransition = null;
 
     private DropShadowDecorator dropShadowDecorator = null;
@@ -160,30 +144,30 @@
 
         // Add this as a display mouse and key listener
         Display display = window.getDisplay();
-        display.getComponentMouseListeners().add(closeHandler);
-        display.getComponentMouseButtonListeners().add(closeHandler);
-        display.getComponentMouseWheelListeners().add(closeHandler);
-        display.getComponentKeyListeners().add(closeHandler);
+        display.getContainerMouseListeners().add(displayContainerMouseListener);
+        display.getComponentKeyListeners().add(displayKeyListener);
     }
 
     @Override
     public Vote previewWindowClose(final Window window) {
         Vote vote = Vote.APPROVE;
 
-        if (closeTransition == null) {
-            closeTransition = new FadeWindowTransition(window,
-                CLOSE_TRANSITION_DURATION, CLOSE_TRANSITION_RATE,
-                dropShadowDecorator);
-
-            closeTransition.start(new TransitionListener() {
-                public void transitionCompleted(Transition transition) {
-                    window.close();
-                }
-            });
-
-            vote = Vote.DEFER;
-        } else {
-            vote = (closeTransition.isRunning()) ? Vote.DEFER : Vote.APPROVE;
+        if (fade) {
+            if (closeTransition == null) {
+                closeTransition = new FadeWindowTransition(window,
+                    CLOSE_TRANSITION_DURATION, CLOSE_TRANSITION_RATE,
+                    dropShadowDecorator);
+
+                closeTransition.start(new TransitionListener() {
+                    public void transitionCompleted(Transition transition) {
+                        window.close();
+                    }
+                });
+
+                vote = Vote.DEFER;
+            } else {
+                vote = (closeTransition.isRunning()) ? Vote.DEFER : Vote.APPROVE;
+            }
         }
 
         return vote;
@@ -204,10 +188,8 @@
         super.windowClosed(window, display);
 
         // Remove this as a display mouse and key listener
-        display.getComponentMouseListeners().remove(closeHandler);
-        display.getComponentMouseButtonListeners().remove(closeHandler);
-        display.getComponentMouseWheelListeners().remove(closeHandler);
-        display.getComponentKeyListeners().remove(closeHandler);
+        display.getContainerMouseListeners().remove(displayContainerMouseListener);
+        display.getComponentKeyListeners().remove(displayKeyListener);
 
         closeTransition = null;
     }



Mime
View raw message