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/09/30 22:20:11 UTC

svn commit: r820429 - in /incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials: drawing/simple_drawing.wtkx effects/ effects/CollapseTransition.java effects/Transitions.java effects/decorators.wtkx transition/

Author: gbrown
Date: Wed Sep 30 20:20:10 2009
New Revision: 820429

URL: http://svn.apache.org/viewvc?rev=820429&view=rev
Log:
Add a simple drawing tutorial example; add a decorator tutorial example.

Added:
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/drawing/simple_drawing.wtkx
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/
      - copied from r820380, incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/transition/
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/decorators.wtkx
Removed:
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/transition/
Modified:
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/CollapseTransition.java
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/Transitions.java

Added: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/drawing/simple_drawing.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/drawing/simple_drawing.wtkx?rev=820429&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/drawing/simple_drawing.wtkx (added)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/drawing/simple_drawing.wtkx Wed Sep 30 20:20:10 2009
@@ -0,0 +1,40 @@
+<?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="Simple Drawing" maximized="true"
+    xmlns:wtkx="http://pivot.apache.org/wtkx"
+    xmlns:media="org.apache.pivot.wtk.media"
+    xmlns="org.apache.pivot.wtk">
+    <content>
+        <ImageView>
+            <image>
+                <media:Drawing>
+                    <canvas>
+                        <Canvas xmlns="org.apache.pivot.wtk.media.drawing">
+                            <Ellipse x="0" y="0" width="240" height="240" stroke="" fill="#ffff00"/>
+                            <Ellipse x="70" y="60" width="30" height="40" fill="#000000"/>
+                            <Ellipse x="140" y="60" width="30" height="40" fill="#000000"/>
+                            <Arc x="60" y="120" width="120" height="70"
+                                start="190" extent="160" type="open" strokeThickness="8"/>
+                        </Canvas>
+                    </canvas>
+                </media:Drawing>
+            </image>
+        </ImageView>
+    </content>
+</Window>

Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/CollapseTransition.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/CollapseTransition.java?rev=820429&r1=820380&r2=820429&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/CollapseTransition.java (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/CollapseTransition.java Wed Sep 30 20:20:10 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.pivot.tutorials.transition;
+package org.apache.pivot.tutorials.effects;
 
 import org.apache.pivot.wtk.Component;
 import org.apache.pivot.wtk.effects.FadeDecorator;

Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/Transitions.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/Transitions.java?rev=820429&r1=820380&r2=820429&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/Transitions.java (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/Transitions.java Wed Sep 30 20:20:10 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.pivot.tutorials.transition;
+package org.apache.pivot.tutorials.effects;
 
 import org.apache.pivot.collections.Map;
 import org.apache.pivot.wtk.Application;

Added: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/decorators.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/decorators.wtkx?rev=820429&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/decorators.wtkx (added)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/effects/decorators.wtkx Wed Sep 30 20:20:10 2009
@@ -0,0 +1,109 @@
+<?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="Decorators" maximized="true"
+    xmlns:wtkx="http://pivot.apache.org/wtkx"
+    xmlns:effects="org.apache.pivot.wtk.effects"
+    xmlns="org.apache.pivot.wtk">
+    <wtkx:define>
+        <effects:BlurDecorator wtkx:id="blurDecorator"/>
+        <effects:FadeDecorator wtkx:id="fadeDecorator" opacity="0.33"/>
+        <effects:GrayscaleDecorator wtkx:id="grayscaleDecorator"/>
+        <effects:ReflectionDecorator wtkx:id="reflectionDecorator"/>
+        <effects:SaturationDecorator wtkx:id="saturationDecorator"/>
+        <effects:ShadeDecorator wtkx:id="shadeDecorator" color="#ff0000" opacity="0.33"/>
+        <effects:WatermarkDecorator wtkx:id="watermarkDecorator" text="Watermark"
+            font="Arial BOLD 24" opacity="0.33"/>
+    </wtkx:define>
+
+    <content>
+        <TablePane>
+            <columns>
+                <TablePane.Column width="1*"/>
+                <TablePane.Column width="-1"/>
+            </columns>
+            <rows>
+                <TablePane.Row>
+                    <Border>
+                        <content>
+                            <BoxPane preferredWidth="480" preferredHeight="480"
+                                styles="{horizontalAlignment:'center', verticalAlignment:'top', padding:6}">
+                                <ImageView wtkx:id="imageView" image="org/apache/pivot/tutorials/IMG_0725_2.jpg"/>
+                            </BoxPane>
+                        </content>
+                    </Border>
+
+                    <BoxPane orientation="vertical" styles="{padding:6, spacing:6}">
+                        <wtkx:define>
+                            <ButtonGroup wtkx:id="decoratorButtonGroup">
+                                <buttonGroupListeners>
+                                <wtkx:script>
+                                <![CDATA[
+                                function selectionChanged(buttonGroup) {
+                                    var selection = buttonGroup.getSelection();
+
+                                    if (selection != null) {
+                                        var decorator = selection.getUserData().get("decorator");
+                                        imageView.getDecorators().removeAll();
+
+                                        if (decorator != null) {
+                                            imageView.getDecorators().add(decorator);
+                                        }
+                                    }
+                                }
+                                ]]>
+                                </wtkx:script>
+                                </buttonGroupListeners>
+                            </ButtonGroup>
+                        </wtkx:define>
+
+                        <RadioButton buttonData="None" buttonGroup="$decoratorButtonGroup" selected="true"/>
+
+                        <RadioButton buttonData="Blur" buttonGroup="$decoratorButtonGroup">
+                            <userData decorator="$blurDecorator"/>
+                        </RadioButton>
+
+                        <RadioButton buttonData="Fade" buttonGroup="$decoratorButtonGroup">
+                            <userData decorator="$fadeDecorator"/>
+                        </RadioButton>
+
+                        <RadioButton buttonData="Grayscale" buttonGroup="$decoratorButtonGroup">
+                            <userData decorator="$grayscaleDecorator"/>
+                        </RadioButton>
+
+                        <RadioButton buttonData="Reflection" buttonGroup="$decoratorButtonGroup">
+                            <userData decorator="$reflectionDecorator"/>
+                        </RadioButton>
+
+                        <RadioButton buttonData="Saturation" buttonGroup="$decoratorButtonGroup">
+                            <userData decorator="$saturationDecorator"/>
+                        </RadioButton>
+
+                        <RadioButton buttonData="Shade" buttonGroup="$decoratorButtonGroup">
+                            <userData decorator="$shadeDecorator"/>
+                        </RadioButton>
+
+                        <RadioButton buttonData="Watermark" buttonGroup="$decoratorButtonGroup">
+                            <userData decorator="$watermarkDecorator"/>
+                        </RadioButton>
+                    </BoxPane>
+                </TablePane.Row>
+            </rows>
+        </TablePane>
+    </content>
+</Window>