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/10/21 14:59:25 UTC

svn commit: r827998 - /incubator/pivot/trunk/tutorials/www/split_panes.html

Author: tvolkert
Date: Wed Oct 21 12:59:25 2009
New Revision: 827998

URL: http://svn.apache.org/viewvc?rev=827998&view=rev
Log:
Added part of the split panes tutorial html page

Modified:
    incubator/pivot/trunk/tutorials/www/split_panes.html

Modified: incubator/pivot/trunk/tutorials/www/split_panes.html
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/www/split_panes.html?rev=827998&r1=827997&r2=827998&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/www/split_panes.html (original)
+++ incubator/pivot/trunk/tutorials/www/split_panes.html Wed Oct 21 12:59:25 2009
@@ -34,7 +34,220 @@
 <body>
 <h1>Split Panes</h1>
 
-<p>This section is not yet complete.</>
+<p>TODO</p>
+
+<script src="version.js"></script>
+<script>
+var attributes = {code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
+    archive:"lib/pivot-core-" + version + ".jar"
+        + ",lib/pivot-wtk-" + version + ".jar"
+        + ",lib/pivot-wtk-" + version + ".terra.jar"
+        + ",lib/pivot-tutorials-" + version + ".jar",
+    width:320,
+    height:240
+};
+var parameters = {application_class_name:"org.apache.pivot.wtk.ScriptApplication",
+    codebase_lookup:false,
+    java_arguments:"-Dsun.awt.noerasebackground=true -Dsun.awt.erasebackgroundonresize=true",
+    startup_properties:"src=org/apache/pivot/tutorials/layout/split_panes.wtkx"
+};
+deployJava.writeAppletTag(attributes, parameters);
+</script>
+
+<p>The WTKX for this example is shown below:</p>
+
+<pre class="brush:xml">
+&lt;Window title="Split Panes" maximized="true"
+    WindowStateListener.windowOpened="init();"
+    xmlns:wtkx="http://pivot.apache.org/wtkx"
+    xmlns:collections="org.apache.pivot.collections"
+    xmlns:content="org.apache.pivot.wtk.content"
+    xmlns="org.apache.pivot.wtk"&gt;
+    &lt;wtkx:script&gt;
+    &lt;![CDATA[
+    function init() {
+        spinner.setSelectedIndex(3);
+        primaryColorListButton.setSelectedIndex(0);
+        secondaryColorListButton.setSelectedIndex(1);
+        orientationListButton.setSelectedIndex(0);
+    }
+    ]]&gt;
+    &lt;/wtkx:script&gt;
+
+    &lt;content&gt;
+        &lt;SplitPane wtkx:id="splitPane" orientation="horizontal" splitRatio="0.6"&gt;
+            &lt;splitPaneListeners&gt;
+                &lt;wtkx:script&gt;
+                &lt;![CDATA[
+                function splitRatioChanged(splitPane, previousSplitRatio) {
+                    var value = Math.floor(splitPane.getSplitRatio() * 100);
+                    label.setText(value + "%");
+                }
+                ]]&gt;
+                &lt;/wtkx:script&gt;
+            &lt;/splitPaneListeners&gt;
+            &lt;left&gt;
+                &lt;Border&gt;
+                    &lt;content&gt;
+                        &lt;Panel styles="{backgroundColor:'#f7f5ed'}"/&gt;
+                    &lt;/content&gt;
+                &lt;/Border&gt;
+            &lt;/left&gt;
+            &lt;right&gt;
+                &lt;Border styles="{padding:{top:10}}"&gt;
+                    &lt;content&gt;
+                        &lt;BoxPane orientation="vertical" styles="{fill:true,
+                            horizontalAlignment:'right'}"&gt;
+                            &lt;Label text="Properties" styles="{padding:{left:10}, font:{bold:true}}"/&gt;
+                            &lt;BoxPane orientation="vertical" styles="{horizontalAlignment:'right'}"&gt;
+                                &lt;Form styles="{horizontalSpacing:18, rightAlignLabels:true}"&gt;
+                                    &lt;sections&gt;
+                                        &lt;Form.Section&gt;
+                                            &lt;Label wtkx:id="label" Form.label="Split Ratio"
+                                                minimumPreferredWidth="100"/&gt;
+                                            &lt;ListButton wtkx:id="orientationListButton"
+                                                Form.label="Orientation"
+                                                listData="['Horizontal', 'Vertical']"&gt;
+                                                &lt;listButtonSelectionListeners&gt;
+                                                    &lt;wtkx:script&gt;
+                                                    &lt;![CDATA[
+                                                    function selectedIndexChanged(listButton, previousSelectedIndex) {
+                                                        var orientation = listButton.getSelectedItem();
+                                                        splitPane.setOrientation(orientation);
+                                                    }
+                                                    ]]&gt;
+                                                    &lt;/wtkx:script&gt;
+                                                &lt;/listButtonSelectionListeners&gt;
+                                            &lt;/ListButton&gt;
+                                            &lt;BoxPane Form.label="Flags" orientation="vertical"
+                                                styles="{spacing:10}"&gt;
+                                                &lt;Checkbox buttonData="Locked"&gt;
+                                                    &lt;buttonStateListeners&gt;
+                                                        &lt;wtkx:script&gt;
+                                                        &lt;![CDATA[
+                                                        function stateChanged(button, previousState) {
+                                                            splitPane.setLocked(button.isSelected());
+                                                        }
+                                                        ]]&gt;
+                                                        &lt;/wtkx:script&gt;
+                                                    &lt;/buttonStateListeners&gt;
+                                                &lt;/Checkbox&gt;
+                                            &lt;/BoxPane&gt;
+                                        &lt;/Form.Section&gt;
+                                    &lt;/sections&gt;
+                                &lt;/Form&gt;
+                            &lt;/BoxPane&gt;
+                            &lt;Separator/&gt;
+                            &lt;Label text="Styles" styles="{padding:{left:10}, font:{bold:true}}"/&gt;
+                            &lt;BoxPane orientation="vertical" styles="{horizontalAlignment:'right'}"&gt;
+                                &lt;Form styles="{horizontalSpacing:18, rightAlignLabels:true}"&gt;
+                                    &lt;sections&gt;
+                                        &lt;Form.Section&gt;
+                                            &lt;Spinner wtkx:id="spinner"
+                                                Form.label="Splitter Thickness"
+                                                styles="{sizeToContent:true}"&gt;
+                                                &lt;spinnerSelectionListeners&gt;
+                                                    &lt;wtkx:script&gt;
+                                                    &lt;![CDATA[
+                                                    function selectedIndexChanged(spinner, previousSelectedIndex) {
+                                                        var value = spinner.getSelectedItem();
+                                                        splitPane.getStyles().put("splitterThickness", value);
+                                                    }
+                                                    ]]&gt;
+                                                    &lt;/wtkx:script&gt;
+                                                &lt;/spinnerSelectionListeners&gt;
+                                                &lt;spinnerData&gt;
+                                                    &lt;content:NumericSpinnerData lowerBound="3"
+                                                        upperBound="20" /&gt;
+                                                &lt;/spinnerData&gt;
+                                            &lt;/Spinner&gt;
+                                            &lt;ListButton wtkx:id="primaryColorListButton"
+                                                Form.label="Splitter Handle Primary Color"
+                                                styles="{listSize:6}"&gt;
+                                                &lt;listData&gt;
+                                                    &lt;collections:ArrayList&gt;
+                                                        &lt;content:ColorItem color="#000000" name="Black"/&gt;
+                                                        &lt;content:ColorItem color="#dddcd5" name="Tan"/&gt;
+                                                        &lt;content:ColorItem color="#14538b" name="Blue"/&gt;
+                                                        &lt;content:ColorItem color="#b0000f" name="Red"/&gt;
+                                                    &lt;/collections:ArrayList&gt;
+                                                &lt;/listData&gt;
+                                                &lt;dataRenderer&gt;
+                                                    &lt;content:ListButtonColorRenderer/&gt;
+                                                &lt;/dataRenderer&gt;
+                                                &lt;itemRenderer&gt;
+                                                    &lt;content:ListViewColorRenderer/&gt;
+                                                &lt;/itemRenderer&gt;
+                                                &lt;listButtonSelectionListeners&gt;
+                                                    &lt;wtkx:script&gt;
+                                                    &lt;![CDATA[
+                                                    function selectedIndexChanged(listButton, previousSelectedIndex) {
+                                                        var colorItem = listButton.getSelectedItem();
+                                                        splitPane.getStyles().put("splitterHandlePrimaryColor",
+                                                            colorItem.getColor());
+                                                    }
+                                                    ]]&gt;
+                                                    &lt;/wtkx:script&gt;
+                                                &lt;/listButtonSelectionListeners&gt;
+                                            &lt;/ListButton&gt;
+                                            &lt;ListButton wtkx:id="secondaryColorListButton"
+                                                Form.label="Splitter Handle Secondary Color"
+                                                styles="{listSize:6}"&gt;
+                                                &lt;listData&gt;
+                                                    &lt;collections:ArrayList&gt;
+                                                        &lt;content:ColorItem color="#000000" name="Black"/&gt;
+                                                        &lt;content:ColorItem color="#dddcd5" name="Tan"/&gt;
+                                                        &lt;content:ColorItem color="#14538b" name="Blue"/&gt;
+                                                        &lt;content:ColorItem color="#b0000f" name="Red"/&gt;
+                                                    &lt;/collections:ArrayList&gt;
+                                                &lt;/listData&gt;
+                                                &lt;dataRenderer&gt;
+                                                    &lt;content:ListButtonColorRenderer/&gt;
+                                                &lt;/dataRenderer&gt;
+                                                &lt;itemRenderer&gt;
+                                                    &lt;content:ListViewColorRenderer/&gt;
+                                                &lt;/itemRenderer&gt;
+                                                &lt;listButtonSelectionListeners&gt;
+                                                    &lt;wtkx:script&gt;
+                                                    &lt;![CDATA[
+                                                    function selectedIndexChanged(listButton, previousSelectedIndex) {
+                                                        var colorItem = listButton.getSelectedItem();
+                                                        splitPane.getStyles().put("splitterHandleSecondaryColor",
+                                                            colorItem.getColor());
+                                                    }
+                                                    ]]&gt;
+                                                    &lt;/wtkx:script&gt;
+                                                &lt;/listButtonSelectionListeners&gt;
+                                            &lt;/ListButton&gt;
+                                            &lt;BoxPane Form.label="Flags" orientation="vertical"
+                                                minimumPreferredWidth="100"
+                                                styles="{spacing:10}"&gt;
+                                                &lt;Checkbox buttonData="Use Shadow"&gt;
+                                                    &lt;buttonStateListeners&gt;
+                                                        &lt;wtkx:script&gt;
+                                                        &lt;![CDATA[
+                                                        function stateChanged(button, previousState) {
+                                                            splitPane.getStyles().put("useShadow", button.isSelected());
+                                                        }
+                                                        ]]&gt;
+                                                        &lt;/wtkx:script&gt;
+                                                    &lt;/buttonStateListeners&gt;
+                                                &lt;/Checkbox&gt;
+                                            &lt;/BoxPane&gt;
+                                        &lt;/Form.Section&gt;
+                                    &lt;/sections&gt;
+                                &lt;/Form&gt;
+                            &lt;/BoxPane&gt;
+                        &lt;/BoxPane&gt;
+                    &lt;/content&gt;
+                &lt;/Border&gt;
+            &lt;/right&gt;
+        &lt;/SplitPane&gt;
+    &lt;/content&gt;
+&lt;/Window>
+</pre>
+
+<p>Since this example is written entirely in WTKX and script, there is no associated Java source.</p>
 
 <p>Next: <a href="forms.html">Forms</a></p>
 </body>