You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/05/22 02:13:07 UTC

svn commit: r777332 - in /incubator/pivot/trunk: tutorials/src/pivot/tutorials/ tutorials/src/pivot/tutorials/navigation/ tutorials/src/pivot/tutorials/progress/ tutorials/src/pivot/tutorials/stocktracker/ wtk/src/pivot/wtk/skin/terra/

Author: gbrown
Date: Fri May 22 00:13:06 2009
New Revision: 777332

URL: http://svn.apache.org/viewvc?rev=777332&view=rev
Log:
Add Expanders tutorial; update TerraExpanderSkin and TerraRollupSkin to call scrollAreaToVisible() when expand transition completes.

Added:
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/Expanders.java
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/calendar.wtkx
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/expanders.wtkx
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/stocks.wtkx
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/weather.wtkx
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-clear.png   (with props)
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-overcast.png   (with props)
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-showers-scattered.png   (with props)
Modified:
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/progress/Meters.java
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/progress/meters.wtkx
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/stocktracker/StockTracker.java
    incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-few-clouds.png
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraRollupSkin.java

Added: incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/Expanders.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/Expanders.java?rev=777332&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/Expanders.java (added)
+++ incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/Expanders.java Fri May 22 00:13:06 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 pivot.tutorials.navigation;
+
+import pivot.collections.Dictionary;
+import pivot.wtk.Application;
+import pivot.wtk.DesktopApplicationContext;
+import pivot.wtk.Display;
+import pivot.wtk.Window;
+import pivot.wtkx.Bindable;
+
+public class Expanders extends Bindable implements Application {
+    @Load(resourceName="expanders.wtkx") private Window window;
+
+    public void startup(Display display, Dictionary<String, String> properties)
+        throws Exception {
+        bind();
+        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(Expanders.class, args);
+    }
+}

Added: incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/calendar.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/calendar.wtkx?rev=777332&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/calendar.wtkx (added)
+++ incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/calendar.wtkx Fri May 22 00:13:06 2009
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<FlowPane styles="{horizontalAlignment:'justify'}"
+    xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
+    xmlns="pivot.wtk">
+    <Border styles="{padding:0}">
+        <content>
+            <Calendar/>
+        </content>
+    </Border>
+</FlowPane>
+

Added: incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/expanders.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/expanders.wtkx?rev=777332&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/expanders.wtkx (added)
+++ incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/expanders.wtkx Fri May 22 00:13:06 2009
@@ -0,0 +1,50 @@
+<?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="Expanders" maximized="true"
+    xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1" xmlns="pivot.wtk">
+    <content>
+        <Border styles="{padding:6}">
+            <content>
+                <ScrollPane horizontalScrollBarPolicy="fill">
+                    <view>
+                        <FlowPane orientation="vertical" styles="{horizontalAlignment:'justify',
+                            padding:{left:2, right:2}}">
+                            <Expander title="Stocks">
+                                <content>
+                                    <wtkx:include src="stocks.wtkx"/>
+                                </content>
+                            </Expander>
+                            <Expander title="Weather">
+                                <content>
+                                    <wtkx:include src="weather.wtkx"/>
+                                </content>
+                            </Expander>
+                            <Expander title="Calendar">
+                                <content>
+                                    <wtkx:include src="calendar.wtkx"/>
+                                </content>
+                            </Expander>
+                        </FlowPane>
+                    </view>
+                </ScrollPane>
+            </content>
+        </Border>
+    </content>
+</Window>
+

Added: incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/stocks.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/stocks.wtkx?rev=777332&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/stocks.wtkx (added)
+++ incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/stocks.wtkx Fri May 22 00:13:06 2009
@@ -0,0 +1,65 @@
+<?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.
+-->
+
+<TablePane styles="{horizontalSpacing:6, verticalSpacing:6}"
+    xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
+    xmlns="pivot.wtk">
+    <columns>
+        <TablePane.Column width="1*"/>
+        <TablePane.Column width="-1"/>
+        <TablePane.Column width="-1"/>
+    </columns>
+    <rows>
+        <TablePane.Row>
+            <Label text="AAPL"/>
+            <Label text="124.18" styles="{horizontalAlignment:'right'}"/>
+            <Label text="-1.69" styles="{color:'#ff0000', horizontalAlignment:'right'}"/>
+        </TablePane.Row>
+        <TablePane.Row>
+            <Label text="AMZN"/>
+            <Label text="75.96" styles="{horizontalAlignment:'right'}"/>
+            <Label text="-2.01" styles="{color:'#ff0000', horizontalAlignment:'right'}"/>
+        </TablePane.Row>
+        <TablePane.Row>
+            <Label text="EBAY"/>
+            <Label text="17.15" styles="{horizontalAlignment:'right'}"/>
+            <Label text="-0.56" styles="{color:'#ff0000', horizontalAlignment:'right'}"/>
+        </TablePane.Row>
+        <TablePane.Row>
+            <Label text="GOOG"/>
+            <Label text="396.50" styles="{horizontalAlignment:'right'}"/>
+            <Label text="-0.68" styles="{color:'#ff0000', horizontalAlignment:'right'}"/>
+        </TablePane.Row>
+        <TablePane.Row>
+            <Label text="JAVA"/>
+            <Label text="9.02" styles="{horizontalAlignment:'right'}"/>
+            <Label text="+0.04" styles="{color:'#008000', horizontalAlignment:'right'}"/>
+        </TablePane.Row>
+        <TablePane.Row>
+            <Label text="MSFT"/>
+            <Label text="19.82" styles="{horizontalAlignment:'right'}"/>
+            <Label text="-0.56" styles="{color:'#ff0000', horizontalAlignment:'right'}"/>
+        </TablePane.Row>
+        <TablePane.Row>
+            <Label text="ORCL"/>
+            <Label text="18.57" styles="{horizontalAlignment:'right'}"/>
+            <Label text="-0.37" styles="{color:'#ff0000', horizontalAlignment:'right'}"/>
+        </TablePane.Row>
+    </rows>
+</TablePane>
+

Added: incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/weather.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/weather.wtkx?rev=777332&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/weather.wtkx (added)
+++ incubator/pivot/trunk/tutorials/src/pivot/tutorials/navigation/weather.wtkx Fri May 22 00:13:06 2009
@@ -0,0 +1,61 @@
+<?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.
+-->
+
+<FlowPane orientation="vertical" styles="{horizontalAlignment:'justify', padding:{bottom:8}}"
+    xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
+    xmlns="pivot.wtk">
+    <Label text="Boston, MA" styles="{fontBold:true}"/>
+    <FlowPane>
+        <Label text="Current: 88˚" styles="{fontSize:10}"/>
+        <Label text="High: 93˚" styles="{fontSize:10}"/>
+        <Label text="Low: 55˚" styles="{fontSize:10}"/>
+    </FlowPane>
+    <Separator styles="{padding:2}"/>
+    <TablePane>
+        <columns>
+            <TablePane.Column width="1*"/>
+            <TablePane.Column width="1*"/>
+            <TablePane.Column width="1*"/>
+            <TablePane.Column width="1*"/>
+            <TablePane.Column width="1*"/>
+            <TablePane.Column width="1*"/>
+            <TablePane.Column width="1*"/>
+        </columns>
+        <rows>
+            <TablePane.Row>
+                <Label text="Th" styles="{horizontalAlignment:'center'}"/>
+                <Label text="F" styles="{horizontalAlignment:'center'}"/>
+                <Label text="Sa" styles="{horizontalAlignment:'center'}"/>
+                <Label text="Su" styles="{horizontalAlignment:'center'}"/>
+                <Label text="M" styles="{horizontalAlignment:'center'}"/>
+                <Label text="Tu" styles="{horizontalAlignment:'center'}"/>
+                <Label text="W" styles="{horizontalAlignment:'center'}"/>
+            </TablePane.Row>
+            <TablePane.Row height="24">
+                <ImageView image="pivot/tutorials/weather-clear.png"/>
+                <ImageView image="pivot/tutorials/weather-few-clouds.png"/>
+                <ImageView image="pivot/tutorials/weather-showers-scattered.png"/>
+                <ImageView image="pivot/tutorials/weather-showers-scattered.png"/>
+                <ImageView image="pivot/tutorials/weather-few-clouds.png"/>
+                <ImageView image="pivot/tutorials/weather-clear.png"/>
+                <ImageView image="pivot/tutorials/weather-clear.png"/>
+            </TablePane.Row>
+        </rows>
+    </TablePane>
+</FlowPane>
+

Modified: incubator/pivot/trunk/tutorials/src/pivot/tutorials/progress/Meters.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/progress/Meters.java?rev=777332&r1=777331&r2=777332&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/pivot/tutorials/progress/Meters.java (original)
+++ incubator/pivot/trunk/tutorials/src/pivot/tutorials/progress/Meters.java Fri May 22 00:13:06 2009
@@ -1,3 +1,19 @@
+/*
+ * 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 pivot.tutorials.progress;
 
 import pivot.collections.Dictionary;

Modified: incubator/pivot/trunk/tutorials/src/pivot/tutorials/progress/meters.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/progress/meters.wtkx?rev=777332&r1=777331&r2=777332&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/pivot/tutorials/progress/meters.wtkx (original)
+++ incubator/pivot/trunk/tutorials/src/pivot/tutorials/progress/meters.wtkx Fri May 22 00:13:06 2009
@@ -16,7 +16,7 @@
 limitations under the License.
 -->
 
-<Window title="Activity Indicators" maximized="true"
+<Window title="Meters" maximized="true"
     xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1" xmlns="pivot.wtk">
     <content>
         <TablePane>

Modified: incubator/pivot/trunk/tutorials/src/pivot/tutorials/stocktracker/StockTracker.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/stocktracker/StockTracker.java?rev=777332&r1=777331&r2=777332&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/pivot/tutorials/stocktracker/StockTracker.java (original)
+++ incubator/pivot/trunk/tutorials/src/pivot/tutorials/stocktracker/StockTracker.java Fri May 22 00:13:06 2009
@@ -92,7 +92,7 @@
         symbols.add("MSFT");
         symbols.add("AMZN");
         symbols.add("GOOG");
-        symbols.add("VMW");
+        symbols.add("ORCL");
         symbols.add("JAVA");
     }
 

Added: incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-clear.png
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-clear.png?rev=777332&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-clear.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-few-clouds.png
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-few-clouds.png?rev=777332&r1=777331&r2=777332&view=diff
==============================================================================
Binary files - no diff available.

Added: incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-overcast.png
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-overcast.png?rev=777332&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-overcast.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-showers-scattered.png
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-showers-scattered.png?rev=777332&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/pivot/trunk/tutorials/src/pivot/tutorials/weather-showers-scattered.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java?rev=777332&r1=777331&r2=777332&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java Fri May 22 00:13:06 2009
@@ -25,6 +25,7 @@
 
 import pivot.collections.Dictionary;
 import pivot.util.Vote;
+import pivot.wtk.ApplicationContext;
 import pivot.wtk.Button;
 import pivot.wtk.ButtonPressListener;
 import pivot.wtk.Component;
@@ -225,7 +226,7 @@
 
     private ExpandTransition expandTransition = null;
 
-    private static final int EXPAND_DURATION = 250;
+    private static final int EXPAND_DURATION = 150;
     private static final int EXPAND_RATE = 30;
 
     public TerraExpanderSkin() {
@@ -660,7 +661,7 @@
         }
     }
 
-    public void expandedChanged(Expander expander) {
+    public void expandedChanged(final Expander expander) {
         if (expander.isShowing()) {
             if (expander.isExpanded()
         		&& expander.getContent() != null) {
@@ -669,6 +670,11 @@
                 layout();
                 expandTransition.start(new TransitionListener() {
                     public void transitionCompleted(Transition transition) {
+                        ApplicationContext.queueCallback(new Runnable() {
+                            public void run() {
+                                expander.scrollAreaToVisible(0, 0, expander.getWidth(), expander.getHeight());
+                            }
+                        });
                         expandTransition = null;
                     }
                 });

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraRollupSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraRollupSkin.java?rev=777332&r1=777331&r2=777332&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraRollupSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraRollupSkin.java Fri May 22 00:13:06 2009
@@ -23,6 +23,7 @@
 import java.awt.geom.RoundRectangle2D;
 
 import pivot.util.Vote;
+import pivot.wtk.ApplicationContext;
 import pivot.wtk.Component;
 import pivot.wtk.ComponentMouseButtonListener;
 import pivot.wtk.Cursor;
@@ -561,7 +562,7 @@
     }
 
     @Override
-    public void expandedChanged(Rollup rollup) {
+    public void expandedChanged(final Rollup rollup) {
         invalidateComponent();
 
         if (rollup.getDisplay() != null) {
@@ -574,6 +575,12 @@
                     false, EXPANSION_DURATION, EXPANSION_RATE);
                 expandTransition.start(new TransitionListener() {
                     public void transitionCompleted(Transition transition) {
+                        ApplicationContext.queueCallback(new Runnable() {
+                            public void run() {
+                                rollup.scrollAreaToVisible(0, 0, rollup.getWidth(), rollup.getHeight());
+                            }
+                        });
+
                         expandTransition = null;
                     }
                 });