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 2010/10/29 00:44:08 UTC
svn commit: r1028525 - in /pivot/trunk:
demos/src/org/apache/pivot/demos/displays/ demos/xsl/
tutorials/src/org/apache/pivot/tutorials/boundedrange/
tutorials/src/org/apache/pivot/tutorials/localization/
tutorials/src/org/apache/pivot/tutorials/stocktr...
Author: gbrown
Date: Thu Oct 28 22:44:07 2010
New Revision: 1028525
URL: http://svn.apache.org/viewvc?rev=1028525&view=rev
Log:
Continue updating tutorials for Pivot 2.0 release.
Removed:
pivot/trunk/demos/src/org/apache/pivot/demos/displays/
pivot/trunk/tutorials/www/drawing.xml
Modified:
pivot/trunk/demos/xsl/demo.html.xsl
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/boundedrange/spinners.bxml
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/localization/Localization.java
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTracker.java
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java
pivot/trunk/tutorials/www/calendars.xml
pivot/trunk/tutorials/www/component-and-container.xml
pivot/trunk/tutorials/www/expanders.xml
pivot/trunk/tutorials/www/hello-bxml.xml
pivot/trunk/tutorials/www/labels-and-image-views.xml
pivot/trunk/tutorials/www/localization.xml
pivot/trunk/tutorials/www/menu-buttons.xml
pivot/trunk/tutorials/www/property-binding.xml
pivot/trunk/tutorials/www/push-buttons.xml
pivot/trunk/tutorials/www/repeatable-list-buttons.xml
pivot/trunk/tutorials/www/split-panes.xml
pivot/trunk/tutorials/www/stock-tracker.events.xml
pivot/trunk/tutorials/www/web-queries.xml
pivot/trunk/wtk/src/org/apache/pivot/wtk/ScriptApplication.java
Modified: pivot/trunk/demos/xsl/demo.html.xsl
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/xsl/demo.html.xsl?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/demos/xsl/demo.html.xsl (original)
+++ pivot/trunk/demos/xsl/demo.html.xsl Thu Oct 28 22:44:07 2010
@@ -100,10 +100,21 @@ limitations under the License.
<!-- Base parameters -->
var parameters = {
codebase_lookup:false,
- java_arguments:"-Dsun.awt.noerasebackground=true -Dsun.awt.erasebackgroundonresize=true",
- application_class_name:"<xsl:value-of select="@class"/>"
+ application_class_name:'<xsl:value-of select="@class"/>'
};
+ <!-- Java arguments -->
+ var javaArguments = ["-Dsun.awt.noerasebackground=true",
+ "-Dsun.awt.erasebackgroundonresize=true"];
+
+ <xsl:if test="java-arguments">
+ <xsl:for-each select="java-arguments/*">
+ javaArguments.push("-D<xsl:value-of select="name(.)"/>=<xsl:apply-templates/>");
+ </xsl:for-each>
+ </xsl:if>
+
+ parameters.java_arguments = javaArguments.join(" ");
+
<!-- Startup properties -->
<xsl:if test="startup-properties">
var startupProperties = [];
@@ -113,6 +124,15 @@ limitations under the License.
parameters.startup_properties = startupProperties.join("&");
</xsl:if>
+ <!-- System properties -->
+ <xsl:if test="system-properties">
+ var systemProperties = [];
+ <xsl:for-each select="system-properties/*">
+ systemProperties.push("<xsl:value-of select="name(.)"/>=<xsl:apply-templates/>");
+ </xsl:for-each>
+ parameters.system_properties = systemProperties.join("&");
+ </xsl:if>
+
deployJava.runApplet(attributes, parameters, "1.6");
</script>
</xsl:template>
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/boundedrange/spinners.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/boundedrange/spinners.bxml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/boundedrange/spinners.bxml (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/boundedrange/spinners.bxml Thu Oct 28 22:44:07 2010
@@ -24,7 +24,9 @@ limitations under the License.
<Spinner spinnerData="['One', 'Two', 'Three', 'Four', 'Five']"
circular="true" preferredWidth="80" selectedIndex="0"/>
<Spinner preferredWidth="40" selectedIndex="0">
- <content:NumericSpinnerData lowerBound="0" upperBound="9" increment="1"/>
+ <spinnerData>
+ <content:NumericSpinnerData lowerBound="0" upperBound="9" increment="1"/>
+ </spinnerData>
</Spinner>
</BoxPane>
</Window>
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/localization/Localization.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/localization/Localization.java?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/localization/Localization.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/localization/Localization.java Thu Oct 28 22:44:07 2010
@@ -18,6 +18,7 @@ package org.apache.pivot.tutorials.local
import java.awt.Font;
import java.awt.GraphicsEnvironment;
+import java.util.Locale;
import org.apache.pivot.beans.BXMLSerializer;
import org.apache.pivot.collections.Map;
@@ -31,9 +32,13 @@ import org.apache.pivot.wtk.Window;
public class Localization implements Application {
private Window window = null;
+ public static final String LANGUAGE_KEY = "language";
+
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
- Resources resources = new Resources(getClass().getName());
+ String language = properties.get(LANGUAGE_KEY);
+ Locale locale = (language == null) ? Locale.getDefault() : new Locale(language);
+ Resources resources = new Resources(getClass().getName(), locale);
Theme theme = Theme.getTheme();
Font font = theme.getFont();
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTracker.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTracker.java?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTracker.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTracker.java Thu Oct 28 22:44:07 2010
@@ -16,8 +16,11 @@
*/
package org.apache.pivot.tutorials.stocktracker;
+import java.util.Locale;
+
import org.apache.pivot.beans.BXMLSerializer;
import org.apache.pivot.collections.Map;
+import org.apache.pivot.util.Resources;
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
@@ -28,11 +31,17 @@ import org.apache.pivot.wtk.Display;
public class StockTracker implements Application {
private StockTrackerWindow window = null;
+ public static final String LANGUAGE_KEY = "language";
+
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
+ String language = properties.get(LANGUAGE_KEY);
+ Locale locale = (language == null) ? Locale.getDefault() : new Locale(language);
+ Resources resources = new Resources(StockTrackerWindow.class.getName(), locale);
+
BXMLSerializer bxmlSerializer = new BXMLSerializer();
- window = (StockTrackerWindow)bxmlSerializer.readObject(StockTrackerWindow.class,
- "stock_tracker_window.bxml", true);
+ window = (StockTrackerWindow)bxmlSerializer.readObject(getClass().getResource("stock_tracker_window.bxml"),
+ resources);
window.open(display);
}
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java Thu Oct 28 22:44:07 2010
@@ -57,8 +57,13 @@ public class WebQueries implements Appli
getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>() {
@Override
public void taskExecuted(Task<Object> task) {
- listView.setListData((List<?>)JSON.get(task.getResult(), "value.items"));
- loadingLabel.setVisible(false);
+ List<?> items = (List<?>)JSON.get(task.getResult(), "value.items");
+ if (items.getLength() > 0) {
+ listView.setListData(items);
+ loadingLabel.setVisible(false);
+ } else {
+ loadingLabel.setText("No results.");
+ }
}
@Override
Modified: pivot/trunk/tutorials/www/calendars.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/calendars.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/calendars.xml (original)
+++ pivot/trunk/tutorials/www/calendars.xml Thu Oct 28 22:44:07 2010
@@ -23,14 +23,16 @@ limitations under the License.
<body>
<p>
- Pivot supports two types of calendar components: a standalone <tt>Calendar</tt>
+ Pivot provides two types of calendar components: a standalone <tt>Calendar</tt>
component that can be used anywhere within an application's user interface, and a
<tt>CalendarButton</tt> component that, like a <a href="list-buttons.html">list
button</a>, displays a popup calendar when pressed.
</p>
<p>
- The following sample application demonstrates both component types:
+ The following sample application demonstrates both component types. Selecting a date
+ on one calendar automatically updates the other calendar as well as setting the text
+ of a label to the currently selected date:
</p>
<application class="org.apache.pivot.wtk.ScriptApplication"
@@ -82,8 +84,28 @@ limitations under the License.
</source>
<p>
- TBD No Java - selection state of the <tt>Calendar</tt> and <tt>CalendarButton</tt> is
- kept in sync via binding...
+ Note that there is no Java or script code associated with this example. The calendars
+ are kept in sync via a Pivot feature called <i>property binding</i>. This feature allows
+ a caller to declaratively create a relationship between a source and target property such
+ that changes to the source are automatically reflected in the target.
+ </p>
+
+ <p>
+ In BXML, a binding relationship is created via the "${...}" syntax shown in the sample
+ code. For example, the following markup ensures that any changes to the "calendar.selectedDate"
+ property are automatically propagated to the <tt>Label</tt>'s "text" property:
+ </p>
+
+ <source type="xml">
+ <![CDATA[
+ <Label bxml:id="selectedDateLabel" Form.label="Selected date"
+ text="${calendar.selectedDate}"/>
+ ]]>
+ </source>
+
+ <p>
+ Property binding is discussed in more detail in the
+ <a href="property_binding.html">Property Binding</a> section.
</p>
</body>
</document>
Modified: pivot/trunk/tutorials/www/component-and-container.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/component-and-container.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/component-and-container.xml (original)
+++ pivot/trunk/tutorials/www/component-and-container.xml Thu Oct 28 22:44:07 2010
@@ -305,7 +305,7 @@ limitations under the License.
selectors are supported. For example:
</p>
- <pre>
+ <source type="jscript">
{ Button: {
color: "#aa0000"
},
@@ -336,7 +336,7 @@ limitations under the License.
color: "#666666"
}
}
- </pre>
+ </source>
<h2>Attributes</h2>
@@ -354,8 +354,8 @@ limitations under the License.
Callers can set attribute values programmatically using a static setter method of
the <tt>Container</tt> subclass (e.g. <tt>TabPane#setLabel(Component, String)</tt>).
Alternatively, attributes can be specified in BXML. For example, the sub-elements of
- a <tt>TabPane</tt> can provide a "TabPane.label" attribute to specify the value that
- should be used as the name for that component.
+ a <tt>TabPane</tt> can provide a <tt>TabPane.label</tt> attribute to specify the value
+ that should be used as the text label for that component.
</p>
<h2>Events</h2>
Modified: pivot/trunk/tutorials/www/expanders.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/expanders.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/expanders.xml (original)
+++ pivot/trunk/tutorials/www/expanders.xml Thu Oct 28 22:44:07 2010
@@ -76,7 +76,8 @@ limitations under the License.
</source>
<p>
- TBD No Java
+ Since this example does not require any logic, there is no associated Java or script
+ code.
</p>
</body>
</document>
Modified: pivot/trunk/tutorials/www/hello-bxml.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/hello-bxml.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/hello-bxml.xml (original)
+++ pivot/trunk/tutorials/www/hello-bxml.xml Thu Oct 28 22:44:07 2010
@@ -156,7 +156,7 @@ limitations under the License.
interface. Rather, it is launched using the <tt>org.apache.pivot.wtk.ScriptApplication</tt> class.
This class, which is included with the Pivot platform, implements the
<tt>Application</tt> interface and takes the name of a BXML file to launch as a startup
- property named <tt>src</tt>. The BXML file is expected to contain a root element representing a
+ property named <tt>src</tt>. The source file is expected to contain a root element representing a
<tt>Window</tt> subclass.
</p>
@@ -164,7 +164,7 @@ limitations under the License.
The class is named <tt>ScriptApplication</tt> because it is often used to launch
applications whose logic is defined entirely in script; however, it can actually be
used to launch any application whose main window is defined in a single BXML file. Many
- of the examples in the following sections are launched using this class.
+ of the examples in the following sections are executed using this class.
Scripting is discussed in more detail in the <a href="scripting.html">Scripting</a> section.
</p>
</body>
Modified: pivot/trunk/tutorials/www/labels-and-image-views.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/labels-and-image-views.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/labels-and-image-views.xml (original)
+++ pivot/trunk/tutorials/www/labels-and-image-views.xml Thu Oct 28 22:44:07 2010
@@ -64,13 +64,5 @@ limitations under the License.
horizontally. The <tt>BoxPane</tt> container is discussed in more detail in the
<a href="layout-containers.html">Layout Containers</a> section.
</p>
-
- <p>
- Finally, note that, while the graphic used in this example is a static bitmap
- (represented by the <tt>org.apache.pivot.wtk.media.Picture</tt> class),
- <tt>ImageView</tt> is also capable of presenting vector graphic images, represented by
- the <tt>org.apache.pivot.wtk.media.Drawing</tt> class. Drawings are discussed in more
- detail in the <a href="drawing.html">Drawing</a> section.
- </p>
</body>
</document>
Modified: pivot/trunk/tutorials/www/localization.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/localization.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/localization.xml (original)
+++ pivot/trunk/tutorials/www/localization.xml Thu Oct 28 22:44:07 2010
@@ -123,6 +123,7 @@ limitations under the License.
import java.awt.Font;
import java.awt.GraphicsEnvironment;
+ import java.util.Locale;
import org.apache.pivot.beans.BXMLSerializer;
import org.apache.pivot.collections.Map;
@@ -136,9 +137,13 @@ limitations under the License.
public class Localization implements Application {
private Window window = null;
+ public static final String LANGUAGE_KEY = "language";
+
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
- Resources resources = new Resources(getClass().getName());
+ String language = properties.get(LANGUAGE_KEY);
+ Locale locale = (language == null) ? Locale.getDefault() : new Locale(language);
+ Resources resources = new Resources(getClass().getName(), locale);
Theme theme = Theme.getTheme();
Font font = theme.getFont();
@@ -198,9 +203,9 @@ limitations under the License.
<library>wtk-terra</library>
<library>tutorials</library>
</libraries>
- <system-properties>
- <user.language>de</user.language>
- </system-properties>
+ <startup-properties>
+ <language>de</language>
+ </startup-properties>
</application>
<p>
Modified: pivot/trunk/tutorials/www/menu-buttons.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/menu-buttons.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/menu-buttons.xml (original)
+++ pivot/trunk/tutorials/www/menu-buttons.xml Thu Oct 28 22:44:07 2010
@@ -29,7 +29,9 @@ limitations under the License.
</p>
<p>
- The following sample application demonstrates the use of a menu button. The...
+ The following sample application demonstrates the use of a menu button. Selecting an
+ option from the menu button on the left adds the corresponding component type to the
+ content area on the right:
</p>
<application class="org.apache.pivot.wtk.ScriptApplication"
@@ -145,9 +147,5 @@ limitations under the License.
}
]]>
</source>
-
- <p>
- Each action simply adds a particular component to the...
- </p>
</body>
</document>
Modified: pivot/trunk/tutorials/www/property-binding.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/property-binding.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/property-binding.xml (original)
+++ pivot/trunk/tutorials/www/property-binding.xml Thu Oct 28 22:44:07 2010
@@ -23,8 +23,9 @@ limitations under the License.
<body>
<p>
- This application demonstrates Pivot's ability to dynamically bind component properties
- to namespace values including script variables and other component properties.
+ This application demonstrates Pivot's support for "property binding". This feature allows
+ a caller to declaratively create a relationship between a source and target property such
+ that changes to the source are automatically reflected in the target.
</p>
<application class="org.apache.pivot.wtk.ScriptApplication" width="480" height="360">
@@ -41,7 +42,24 @@ limitations under the License.
</application>
<p>
- The BXML source for the example is below:
+ Property binding is most commonly used to establish a one-way relationship between a
+ source and target value; however, as shown in the example, bi-directional bindings
+ are also supported. Property relationships are established in markup using the following
+ binding syntax:
+ </p>
+
+ <p>
+ <i>targetProperty="${mappingFunction:sourceProperty}"</i>
+ </p>
+
+ <p>
+ "mappingFunction" is an optional script function that can be used to transform a bound
+ source value before it is applied to the target property. If omitted, the source value
+ is simply applied to the target as-is.
+ </p>
+
+ <p>
+ The BXML source for the example is shown below:
</p>
<source type="xml" location="org/apache/pivot/tutorials/databinding/property_binding.bxml">
@@ -99,7 +117,16 @@ limitations under the License.
</source>
<p>
- The Java source is as follows:
+ Note the use of mapping functions to transform the "textInput.text" property to
+ all caps before applying it to the bound label. Similarly, a mapping function is used
+ to transform the "selectedColor" property of the ColorChooserButton to a hex string
+ so it can be used as the value for the "color" style of the selected color label.
+ </p>
+
+ <p>
+ Bindings are not limited to BXML - they can also be defined programmatically. For
+ example, the "manual binding" shown in the demo is constructed in Java code as shown
+ in the <tt>initialize()</tt> method below:
</p>
<source type="java" location="org/apache/pivot/tutorials/databinding/PropertyBinding.java">
@@ -142,5 +169,11 @@ limitations under the License.
}
]]>
</source>
+
+ <p>
+ The primary advantage to creating a binding relationship in code is that it can be
+ "unbound" when it is no longer needed; once established, bindings defined in BXML cannot
+ be removed.
+ </p>
</body>
</document>
Modified: pivot/trunk/tutorials/www/push-buttons.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/push-buttons.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/push-buttons.xml (original)
+++ pivot/trunk/tutorials/www/push-buttons.xml Thu Oct 28 22:44:07 2010
@@ -61,11 +61,16 @@ limitations under the License.
</source>
<p>
- TBD Mention use of custom namespace
+ Note the use of the custom "buttons" namespace. This namespace is associated with the
+ <tt>org.apache.pivot.tutorials.buttons</tt> package. The root element,
+ <tt><buttons:PushButtons></tt> represents an instance of
+ <tt>org.apache.pivot.tutorials.buttons.PushButtons</tt> - a custom,
+ application-specific subclass of the <tt>org.apache.pivot.wtk.Window</tt> class.
+ When the BXML file is loaded, an instance of this class will be returned.
+ </p>
- The following is the Java source for the example. The application simply registers the
- event listener that is called when the button is pressed, as an anonymous inner class
- that implements <tt>ButtonPressListener</tt>:
+ <p>
+ The source code for the <tt>PushButtons</tt> class is shown below:
</p>
<source type="java" location="org/apache/pivot/tutorials/buttons/PushButtons.java">
@@ -103,8 +108,17 @@ limitations under the License.
</source>
<p>
- When called, the event handler method, <tt>buttonPressed()</tt>, uses a static method
- of the <tt>Alert</tt> class to display the message to the user.
+ Note that the <tt>PushButtons</tt> class implements the <tt>org.apache.pivot.beans.Bindable</tt>
+ interface. This interface defines a single method, <tt>initialize()</tt>, that is called
+ when the root element of a BXML file has been completely loaded. This allows the bound
+ class to perform additional initialization tasks such as event registration.
+ </p>
+
+ <p>
+ In the <tt>initialize()</tt> method, the application registers an event listener that
+ is called when the button is pressed. When this listener is invoked, the <tt>buttonPressed()</tt>
+ event handler method calls a static method of the <tt>Alert</tt> class to display a simple
+ message to the user.
</p>
</body>
</document>
Modified: pivot/trunk/tutorials/www/repeatable-list-buttons.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/repeatable-list-buttons.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/repeatable-list-buttons.xml (original)
+++ pivot/trunk/tutorials/www/repeatable-list-buttons.xml Thu Oct 28 22:44:07 2010
@@ -22,10 +22,22 @@ limitations under the License.
</properties>
<body>
- <p>The following example...</p>
+ <p>
+ The following example demonstrates Pivot's support for "repeatable" list buttons.
+ A repeatable list button allows a user to easily repeat the action associated with
+ the currently selected item. They are often used to define "rubber stamp" behaviors
+ that are applied to one or more selected items.
+ </p>
+
+ <p>
+ For example, the list button in the example allows the user to change the text color
+ of the selected checkboxes. Clicking the drop-down arrow presents a list of color
+ options, and clicking the currently selected color re-applies the color selection
+ to the currently selected checkboxes:
+ </p>
<application class="org.apache.pivot.wtk.ScriptApplication"
- width="300" height="200">
+ width="320" height="220">
<libraries>
<library>core</library>
<library>wtk</library>
@@ -38,7 +50,7 @@ limitations under the License.
</application>
<p>
- The BXML source for the example is...
+ The BXML source for the example is as follows:
</p>
<source type="xml" location="org/apache/pivot/tutorials/lists/repeatable_list_buttons.bxml">
@@ -101,7 +113,10 @@ limitations under the License.
</source>
<p>
- The Java source for the example is below:
+ The Java source for the example is shown below. The logic for applying the color
+ selection is encapsulated in the anonymous "applyColor" action defined by the
+ <tt>applyColorAction</tt> member. The rest of the code simply manages the selection
+ state of the checkboxes:
</p>
<source type="java" location="org/apache/pivot/tutorials/lists/RepeatableListButtons.java">
Modified: pivot/trunk/tutorials/www/split-panes.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/split-panes.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/split-panes.xml (original)
+++ pivot/trunk/tutorials/www/split-panes.xml Thu Oct 28 22:44:07 2010
@@ -127,11 +127,9 @@ limitations under the License.
<Checkbox buttonData="Use Shadow">
<buttonStateListeners>
- <![CDATA[
function stateChanged(button, previousState) {
splitPane.getStyles().put("useShadow", button.isSelected());
}
- ]]>
</buttonStateListeners>
</Checkbox>
</BoxPane>
Modified: pivot/trunk/tutorials/www/stock-tracker.events.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/stock-tracker.events.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/stock-tracker.events.xml (original)
+++ pivot/trunk/tutorials/www/stock-tracker.events.xml Thu Oct 28 22:44:07 2010
@@ -49,9 +49,13 @@ limitations under the License.
<![CDATA[
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
+ String language = properties.get(LANGUAGE_KEY);
+ Locale locale = (language == null) ? Locale.getDefault() : new Locale(language);
+ Resources resources = new Resources(StockTrackerWindow.class.getName(), locale);
+
BXMLSerializer bxmlSerializer = new BXMLSerializer();
- window = (StockTrackerWindow)bxmlSerializer.readObject(StockTrackerWindow.class,
- "stock_tracker_window.bxml", true);
+ window = (StockTrackerWindow)bxmlSerializer.readObject(getClass().getResource("stock_tracker_window.bxml"),
+ resources);
window.open(display);
}
]]>
Modified: pivot/trunk/tutorials/www/web-queries.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/web-queries.xml?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/web-queries.xml (original)
+++ pivot/trunk/tutorials/www/web-queries.xml Thu Oct 28 22:44:07 2010
@@ -153,8 +153,13 @@ limitations under the License.
getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>() {
@Override
public void taskExecuted(Task<Object> task) {
- listView.setListData((List<?>)JSON.get(task.getResult(), "value.items"));
- loadingLabel.setVisible(false);
+ List<?> items = (List<?>)JSON.get(task.getResult(), "value.items");
+ if (items.getLength() > 0) {
+ listView.setListData(items);
+ loadingLabel.setVisible(false);
+ } else {
+ loadingLabel.setText("No results.");
+ }
}
@Override
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ScriptApplication.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ScriptApplication.java?rev=1028525&r1=1028524&r2=1028525&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ScriptApplication.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ScriptApplication.java Thu Oct 28 22:44:07 2010
@@ -62,7 +62,7 @@ public class ScriptApplication implement
+ " argument must start with a slash character.");
}
- ApplicationContext.applyStylesheet(stylesheet.substring(1));
+ ApplicationContext.applyStylesheet(stylesheet);
}
// Load the file and open the window