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/11/06 16:28:25 UTC
svn commit: r833440 - in /incubator/pivot/trunk/tutorials:
src/org/apache/pivot/tutorials/layout/FlowPanes.java
src/org/apache/pivot/tutorials/layout/flow_panes.wtkx www/flow_panes.html
Author: gbrown
Date: Fri Nov 6 15:28:25 2009
New Revision: 833440
URL: http://svn.apache.org/viewvc?rev=833440&view=rev
Log:
Add "align to baseline" checkbox to FlowPane tutorial.
Modified:
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/FlowPanes.java
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/flow_panes.wtkx
incubator/pivot/trunk/tutorials/www/flow_panes.html
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/FlowPanes.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/FlowPanes.java?rev=833440&r1=833439&r2=833440&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/FlowPanes.java (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/FlowPanes.java Fri Nov 6 15:28:25 2009
@@ -20,6 +20,7 @@
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.ButtonStateListener;
+import org.apache.pivot.wtk.Checkbox;
import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.FlowPane;
@@ -34,6 +35,7 @@
private RadioButton leftRadioButton = null;
private RadioButton rightRadioButton = null;
private RadioButton centerRadioButton = null;
+ private Checkbox alignToBaselineCheckbox = null;
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
@@ -43,6 +45,7 @@
leftRadioButton = (RadioButton)wtkxSerializer.get("leftRadioButton");
rightRadioButton = (RadioButton)wtkxSerializer.get("rightRadioButton");
centerRadioButton = (RadioButton)wtkxSerializer.get("centerRadioButton");
+ alignToBaselineCheckbox = (Checkbox)wtkxSerializer.get("alignToBaselineCheckbox");
ButtonStateListener buttonStateListener = new ButtonStateListener() {
@Override
@@ -54,6 +57,7 @@
leftRadioButton.getButtonStateListeners().add(buttonStateListener);
rightRadioButton.getButtonStateListeners().add(buttonStateListener);
centerRadioButton.getButtonStateListeners().add(buttonStateListener);
+ alignToBaselineCheckbox.getButtonStateListeners().add(buttonStateListener);
updateFlowPaneState();
@@ -91,6 +95,8 @@
if (alignment != null) {
flowPane.getStyles().put("alignment", alignment);
}
+
+ flowPane.getStyles().put("alignToBaseline", alignToBaselineCheckbox.isSelected());
}
public static void main(String[] args) {
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/flow_panes.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/flow_panes.wtkx?rev=833440&r1=833439&r2=833440&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/flow_panes.wtkx (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/flow_panes.wtkx Fri Nov 6 15:28:25 2009
@@ -49,6 +49,10 @@
<RadioButton wtkx:id="leftRadioButton" buttonData="Left" buttonGroup="$alignment" selected="true"/>
<RadioButton wtkx:id="rightRadioButton" buttonData="Right" buttonGroup="$alignment"/>
<RadioButton wtkx:id="centerRadioButton" buttonData="Center" buttonGroup="$alignment"/>
+
+ <BoxPane styles="{padding:{top:6}}">
+ <Checkbox wtkx:id="alignToBaselineCheckbox" buttonData="Align to baseline"/>
+ </BoxPane>
</BoxPane>
</content>
</Border>
Modified: incubator/pivot/trunk/tutorials/www/flow_panes.html
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/www/flow_panes.html?rev=833440&r1=833439&r2=833440&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/www/flow_panes.html (original)
+++ incubator/pivot/trunk/tutorials/www/flow_panes.html Fri Nov 6 15:28:25 2009
@@ -33,7 +33,9 @@
</head>
<body>
<h1>Flow Panes</h1>
-<p>Flow panes arrange components in a horizontal line, wrapping when the contents don't fit on a single line. Components may be aligned to left, right, or center when there is space left over within a given line. The following example demonstrates the use of the <tt>FlowPane</tt> container:</p>
+<p>Flow panes arrange components in a horizontal line, wrapping when the contents don't fit on a single line. Components may be horizontally aligned to left, right, or center when there is space left over within a given line, and may optionally be vertically aligned by to their baselines.</p>
+
+<p>The following example demonstrates the use of the <tt>FlowPane</tt> container. The buttons on the right can be used to modify the alignment properties:</p>
<script src="version.js"></script>
<script>
@@ -61,7 +63,7 @@
<content>
<SplitPane splitRatio="0.75">
<left>
- <Border styles="{padding:0}">
+ <Border>
<content>
<FlowPane wtkx:id="flowPane" styles="{padding:2}">
<PushButton buttonData="0" styles="{minimumAspectRatio:1.5}"/>
@@ -80,7 +82,7 @@
<Border styles="{padding:{top:2, left:6}}">
<content>
<BoxPane orientation="vertical">
- <Label text="Alignment" styles="{fontBold:true}"/>
+ <Label text="Alignment" styles="{font:{bold:true}}"/>
<wtkx:define>
<ButtonGroup wtkx:id="alignment"/>
@@ -88,6 +90,10 @@
<RadioButton wtkx:id="leftRadioButton" buttonData="Left" buttonGroup="$alignment" selected="true"/>
<RadioButton wtkx:id="rightRadioButton" buttonData="Right" buttonGroup="$alignment"/>
<RadioButton wtkx:id="centerRadioButton" buttonData="Center" buttonGroup="$alignment"/>
+
+ <BoxPane styles="{padding:{top:6}}">
+ <Checkbox wtkx:id="alignToBaselineCheckbox" buttonData="Align to baseline"/>
+ </BoxPane>
</BoxPane>
</content>
</Border>
@@ -106,6 +112,7 @@
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.ButtonStateListener;
+import org.apache.pivot.wtk.Checkbox;
import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.FlowPane;
@@ -120,7 +127,9 @@
private RadioButton leftRadioButton = null;
private RadioButton rightRadioButton = null;
private RadioButton centerRadioButton = null;
+ private Checkbox alignToBaselineCheckbox = null;
+ @Override
public void startup(Display display, Map<String, String> properties) throws Exception {
WTKXSerializer wtkxSerializer = new WTKXSerializer();
window = (Window)wtkxSerializer.readObject(this, "flow_panes.wtkx");
@@ -128,8 +137,10 @@
leftRadioButton = (RadioButton)wtkxSerializer.get("leftRadioButton");
rightRadioButton = (RadioButton)wtkxSerializer.get("rightRadioButton");
centerRadioButton = (RadioButton)wtkxSerializer.get("centerRadioButton");
+ alignToBaselineCheckbox = (Checkbox)wtkxSerializer.get("alignToBaselineCheckbox");
ButtonStateListener buttonStateListener = new ButtonStateListener() {
+ @Override
public void stateChanged(Button button, Button.State previousState) {
updateFlowPaneState();
}
@@ -138,12 +149,14 @@
leftRadioButton.getButtonStateListeners().add(buttonStateListener);
rightRadioButton.getButtonStateListeners().add(buttonStateListener);
centerRadioButton.getButtonStateListeners().add(buttonStateListener);
+ alignToBaselineCheckbox.getButtonStateListeners().add(buttonStateListener);
updateFlowPaneState();
window.open(display);
}
+ @Override
public boolean shutdown(boolean optional) {
if (window != null) {
window.close();
@@ -152,9 +165,11 @@
return false;
}
+ @Override
public void suspend() {
}
+ @Override
public void resume() {
}
@@ -172,6 +187,8 @@
if (alignment != null) {
flowPane.getStyles().put("alignment", alignment);
}
+
+ flowPane.getStyles().put("alignToBaseline", alignToBaselineCheckbox.isSelected());
}
public static void main(String[] args) {