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/11/18 19:57:21 UTC

svn commit: r881876 - in /incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials: KitchenSink.java color_choosers.wtkx kitchen_sink.wtkx

Author: tvolkert
Date: Wed Nov 18 18:57:20 2009
New Revision: 881876

URL: http://svn.apache.org/viewvc?rev=881876&view=rev
Log:
Added color choosers to the kitchen sink

Added:
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/color_choosers.wtkx   (with props)
Modified:
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/KitchenSink.java
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/kitchen_sink.wtkx

Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/KitchenSink.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/KitchenSink.java?rev=881876&r1=881875&r2=881876&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/KitchenSink.java (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/KitchenSink.java Wed Nov 18 18:57:20 2009
@@ -218,6 +218,28 @@
         }
     }
 
+    private class ColorChoosersRollupStateHandler extends RollupStateHandler {
+        private Component component = null;
+
+        @Override
+        public Vote previewExpandedChange(Rollup rollup) {
+            if (component == null) {
+                WTKXSerializer wtkxSerializer = new WTKXSerializer();
+                try {
+                    component = (Component)wtkxSerializer.readObject(this, "color_choosers.wtkx");
+                } catch(IOException exception) {
+                    throw new RuntimeException(exception);
+                } catch(SerializationException exception) {
+                    throw new RuntimeException(exception);
+                }
+
+                rollup.setContent(component);
+            }
+
+            return Vote.APPROVE;
+        }
+    }
+
     private class NavigationRollupStateHandler extends RollupStateHandler {
         private Component component = null;
 
@@ -896,6 +918,7 @@
     private Rollup listsRollup;
     private Rollup textRollup;
     private Rollup calendarsRollup;
+    private Rollup colorChoosersRollup;
     private Rollup navigationRollup;
     private Rollup splittersRollup;
     private Rollup menusRollup;
@@ -928,6 +951,9 @@
         calendarsRollup = (Rollup)wtkxSerializer.get("calendarsRollup");
         calendarsRollup.getRollupStateListeners().add(new CalendarsRollupStateHandler());
 
+        colorChoosersRollup = (Rollup)wtkxSerializer.get("colorChoosersRollup");
+        colorChoosersRollup.getRollupStateListeners().add(new ColorChoosersRollupStateHandler());
+
         navigationRollup = (Rollup)wtkxSerializer.get("navigationRollup");
         navigationRollup.getRollupStateListeners().add(new NavigationRollupStateHandler());
 

Added: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/color_choosers.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/color_choosers.wtkx?rev=881876&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/color_choosers.wtkx (added)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/color_choosers.wtkx Wed Nov 18 18:57:20 2009
@@ -0,0 +1,38 @@
+<?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.
+-->
+
+<BoxPane xmlns:wtkx="http://pivot.apache.org/wtkx"
+    xmlns:content="org.apache.pivot.wtk.content"
+    xmlns="org.apache.pivot.wtk">
+    <Border styles="{padding:2}">
+        <content>
+            <BoxPane styles="{padding:{top:2, left:4, bottom:2, right:4}, spacing:10}">
+                <BoxPane orientation="vertical">
+                    <Label text="Color Chooser" styles="{font:{bold:true}}"/>
+                    <ColorChooser selectedColor="#7ac8ba"/>
+                </BoxPane>
+
+                <BoxPane orientation="vertical">
+                    <Label text="Color Chooser Button" styles="{font:{bold:true}}"/>
+                    <ColorChooserButton selectedColor="#7f2c64"/>
+                </BoxPane>
+            </BoxPane>
+        </content>
+    </Border>
+</BoxPane>
+

Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/color_choosers.wtkx
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/color_choosers.wtkx
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/kitchen_sink.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/kitchen_sink.wtkx?rev=881876&r1=881875&r2=881876&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/kitchen_sink.wtkx (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/kitchen_sink.wtkx Wed Nov 18 18:57:20 2009
@@ -50,6 +50,11 @@
                                             <Label text="Calendars" styles="{font:{size:'110%', bold:true}, color:13}"/>
                                         </heading>
                                     </Rollup>
+                                    <Rollup wtkx:id="colorChoosersRollup">
+                                        <heading>
+                                            <Label text="Color Choosers" styles="{font:{size:'110%', bold:true}, color:13}"/>
+                                        </heading>
+                                    </Rollup>
                                     <Rollup wtkx:id="navigationRollup">
                                         <heading>
                                             <Label text="Navigation" styles="{font:{size:'110%', bold:true}, color:13}"/>