Author: rahul
Date: Fri Oct 3 11:49:05 2008
New Revision: 701488
URL: http://svn.apache.org/viewvc?rev=701488&view=rev
Log:
SCXML-84
Added a tutorial about using Commons SCXML on Google Android, based on the
stopwatch example.
Contributed by: Jakob Sachse <jakobsa AT gmail DOT com>
Added Jakob to list of contributors. Thanks for the patch!
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android.xml
(with props)
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/AndroidManifest.xml
(with props)
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/StopWatchActivity.java.txt
(with props)
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_1.jpg
(with props)
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_2.jpg
(with props)
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_3.jpg
(with props)
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_4.jpg
(with props)
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/diff.txt
(with props)
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/icon.png
(with props)
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/scxml-dependencies-on-android.png
(with props)
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/stopwatch_display.xml
(with props)
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/strings.xml
(with props)
Modified:
commons/proper/scxml/trunk/pom.xml
commons/proper/scxml/trunk/project.properties
commons/proper/scxml/trunk/project.xml
commons/proper/scxml/trunk/src/site/site.xml
commons/proper/scxml/trunk/xdocs/navigation.xml
commons/proper/scxml/trunk/xdocs/usecases.xml
Modified: commons/proper/scxml/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/pom.xml?rev=701488&r1=701487&r2=701488&view=diff
==============================================================================
--- commons/proper/scxml/trunk/pom.xml (original)
+++ commons/proper/scxml/trunk/pom.xml Fri Oct 3 11:49:05 2008
@@ -114,6 +114,9 @@
<contributor>
<name>Daniel Schwager</name>
</contributor>
+ <contributor>
+ <name>Jakob Sachse</name>
+ </contributor>
</contributors>
<dependencies>
Modified: commons/proper/scxml/trunk/project.properties
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/project.properties?rev=701488&r1=701487&r2=701488&view=diff
==============================================================================
--- commons/proper/scxml/trunk/project.properties (original)
+++ commons/proper/scxml/trunk/project.properties Fri Oct 3 11:49:05 2008
@@ -20,7 +20,7 @@
maven.xdoc.version=${pom.currentVersion}
maven.xdoc.developmentProcessUrl=http://commons.apache.org/charter.html
maven.xdoc.includeProjectDocumentation=yes
-maven.xdoc.xml.copy=usecases/rdc-group/*.xml,usecases/shale-dialogs/*.xml
+maven.xdoc.xml.copy=usecases/rdc-group/*.xml,usecases/shale-dialogs/*.xml,usecases/scxml-stopwatch-on-android/*.xml
# Compile targets
maven.compile.source=1.4
Modified: commons/proper/scxml/trunk/project.xml
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/project.xml?rev=701488&r1=701487&r2=701488&view=diff
==============================================================================
--- commons/proper/scxml/trunk/project.xml (original)
+++ commons/proper/scxml/trunk/project.xml Fri Oct 3 11:49:05 2008
@@ -161,6 +161,9 @@
<contributor>
<name>Daniel Schwager</name>
</contributor>
+ <contributor>
+ <name>Jakob Sachse</name>
+ </contributor>
</contributors>
<dependencies>
Modified: commons/proper/scxml/trunk/src/site/site.xml
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/site/site.xml?rev=701488&r1=701487&r2=701488&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/site/site.xml (original)
+++ commons/proper/scxml/trunk/src/site/site.xml Fri Oct 3 11:49:05 2008
@@ -85,6 +85,9 @@
<item name="SCXML in Shale dialogs"
href="/usecases/scxml-in-shale-dialogs.html" />
+ <item name="SCXML in Google Android"
+ href="/usecases/scxml-stopwatch-on-android.html" />
+
</item>
<item name="Building"
Modified: commons/proper/scxml/trunk/xdocs/navigation.xml
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/navigation.xml?rev=701488&r1=701487&r2=701488&view=diff
==============================================================================
--- commons/proper/scxml/trunk/xdocs/navigation.xml (original)
+++ commons/proper/scxml/trunk/xdocs/navigation.xml Fri Oct 3 11:49:05 2008
@@ -93,6 +93,9 @@
<item name="SCXML in Shale dialogs"
href="/usecases/scxml-in-shale-dialogs.html" />
+ <item name="SCXML in Google Android"
+ href="/usecases/scxml-stopwatch-on-android.html" />
+
</item>
<item name="Building"
Modified: commons/proper/scxml/trunk/xdocs/usecases.xml
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases.xml?rev=701488&r1=701487&r2=701488&view=diff
==============================================================================
--- commons/proper/scxml/trunk/xdocs/usecases.xml (original)
+++ commons/proper/scxml/trunk/xdocs/usecases.xml Fri Oct 3 11:49:05 2008
@@ -65,6 +65,9 @@
container.</li>
<li><a href="usecases/scxml-in-shale-dialogs.html">Usecase 3</a> -
Use in <a href="http://shale.apache.org/">Shale</a> dialogs</li>
+ <li><a href="usecases/scxml-stopwatch-on-android.html">Usecase 4</a> -
+ SCXML stopwatch example in <a
href="http://code.google.com/android/">Google Android</a>
+ </li>
</ul>
</p>
</subsection>
Added: commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android.xml
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android.xml?rev=701488&view=auto
==============================================================================
--- commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android.xml
(added)
+++ commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android.xml
Fri Oct 3 11:49:05 2008
@@ -0,0 +1,159 @@
+<?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.
+-->
+
+<document>
+
+ <properties>
+ <title>Commons SCXML Usecase - Stopwatch on Android</title>
+ <author email="[EMAIL PROTECTED]">Jakob Sachse</author>
+ </properties>
+
+ <body>
+
+ <section name="Purpose of this document">
+ <p>This document wants to show a possible approach aimed at using
+ SCXML on <a href="http://code.google.com/android/">Google Android</a>.
+ That is why the focus lies rather
+ on the steps necessary for successfully deploying the statemachine than
+ the application itself.</p>
+ <subsection name="Stopwatch">
+ <p>This usecase is based on the stopwatch example. If you should not be
+ acquainted with the stopwatch usecase you would probably want to read
this
+ first. The modeling of the statemachine as well as the scxml markup
+ will not be covered here.</p>
+ </subsection>
+ <subsection name="Motivation">
+ <ul>
+ <li>Demonstrate steps to run a Commons SCXML Statemachine on
Android.</li>
+ <li>Demonstrate what dependencies are not covered by Android and how
+ to cut those ties.</li>
+ </ul>
+ </subsection>
+ </section>
+
+ <section name="Android Background">
+ <p>Android is a mobile operating system that is developed and released by
the
+ Open Handset Alliance. First handsets are expected to enter the market
+ by October '09. Android is based on Linux and runs a virtual machine called
+ the Dalvik VM. The SDK provides tools for transferring java bytecode to
dalvik
+ compatible bytecode.
+ </p>
+ <p>Android comes with a subset of J2SE packages but also provides own
libraries
+ and other third party libraries. Interesting is the use of apache harmony
as the
+ implementation of its J2SE modules.
+ </p>
+ <subsection name="Prerequisites for building the Android Application">
+ <ul>
+ <li>an installation of Android SDK 1.0 r1</li>
+ <li>good to have: ADT Plugin for Eclipse installed</li>
+ <li>knowing about the folder structure of an Android project.</li>
+ <li>knowing about the Role of Activities in Android applications.</li>
+ <li>understanding UI Layouts created by using Androids xml layout
scheme.</li>
+ <li>being aware of Services, Intents and ContentProviders is an
advantage</li>
+ </ul>
+ </subsection>
+ </section>
+
+ <section name="Building the Android Application">
+ <subsection name="The Stopwatch Logic">
+ <p>As already mentioned this usecase is based on the stopwatch example. It
uses
+ both the <a
href="http://svn.apache.org/repos/asf/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/env/stopwatch.xml">stopwatch.xml</a>
+ and the <a
href="../xref-test/org/apache/commons/scxml/env/StopWatch.html">StopWatch.java</a>.</p>
+ </subsection>
+ <subsection name="The Stopwatch UI">
+ <p>Here is the UI definition for the stopwatch: <a
href="scxml-stopwatch-on-android/stopwatch_display.xml">stopwatch_display.xml</a>.
+ Place it into /res/layout/ from the root of your project. Note how id's
are declared and referenced. Declared
+ id's will be available through the automatically generated R.java.
+ </p>
+ </subsection>
+ <subsection name="The Stopwatch Activity">
+ <p>Here is the Activity class <a
href="scxml-stopwatch-on-android/StopWatchActivity.java.txt">StopWatchActivity.java</a>
+ which is the entry point of the application. That is also where the
instance of StopWatch resides.
+ Note how UI Elements are being referenced by using the R.java class. See
also how a handler is used to display
+ changes to the StopWatch from another Thread.
+ </p>
+ </subsection>
+ <subsection name="Resources">
+ <p>Commonly used strings are declared inside a <a
href="scxml-stopwatch-on-android/strings.xml">strings.xml</a>
+ in /res/values/. Once you put it there the R.java gets updated and you
can reference the strings using that class.
+ </p>
+ <p>If you wish to have a non standard icon you can replace
/res/drawable/icon.png with this icon.png: <a
href="scxml-stopwatch-on-android/icon.png"><img
src="scxml-stopwatch-on-android/icon.png"/></a>
+ </p>
+ </subsection>
+ <subsection name="Manifest">
+ <p>Each Android application has a <a
href="scxml-stopwatch-on-android/AndroidManifest.xml">AndroidManifest.xml</a>.
It resides inside
+ the root directory and is used to declare the overall structure of the
application.
+ </p>
+ </subsection>
+ </section>
+
+ <section name="Handling unmet dependencies">
+ <p>The real challenge of running a commons.scxml statemachine on Android
are it's dependencies. After adding all
+ needed libraries to the build path build errors will still occur. The
reason is that the dependencies are based on
+ a standard J2SE. In contrast Android uses a subset of J2SE, meaning that
several packages are missing. Dependencies to J2SE
+ are shown in this <a
href="scxml-stopwatch-on-android/scxml-dependencies-on-android.png">UML Package
Diagram</a>.
+ Reviewing <a
href="http://code.google.com/android/reference/packages.html">available
packages on Android</a> results
+ in the conclusion that <code>java.beans</code>, <code>java.awt</code> and
<code>javax.swing</code> are missing on Android. The dependency between Commons
Beanutils
+ and <code>java.beans</code> is strong. For meeting this putting the
<code>java.beans</code> module (<a href="http://harmony.apache.org/">Apache
Harmony</a>) on the build path is a possibility.
+ That module in turn has a dependency to <code>harmony.kernel</code> that
needs to be removed. The yellow color of some of the packages
+ in the diagram marks the places where code changes happened. These
modifications removed the dependence to not available
+ yet disposable J2SE packages. For a better documentation take a look at the
<a href="scxml-stopwatch-on-android/diff.txt">diff file</a>.
+ </p>
+ </section>
+
+ <section name="Building the .apk">
+ <p>Building the application is a bit tricky as well. You will notice that
ADT will break up with the following error:
+ <code>"Conversion to Dalvik format failed with error 1"</code>. You will
also find a detailed message that explains that
+ you have tried to build a core library which is not recommended. To do so
anyway you can pass <code>dx</code> (the java bytecode - dalvik bytecode
transformer)
+ the <code>--core-library option</code>. Concluding that by core-library
<code>java.*</code> packages where meant, and having in mind what is about to
be added
+ there is no reason for giving up. The problem in passing the
<code>--core-library</code> option is that there is no such possibility from
within ADT.
+ That problem can be met by using the activityCreator tool (to be found
inside the tools directory of the SDK). This tool will
+ create an empty project for you. This is meant for developers who are not
using eclipse. Alongside with the project structure the
+ tool generates an ant build script. Putting that <code>build.xml</code> to
the original eclipse project enables you to pass the <code>--core-library</code>
+ option to <code>dx</code> when using <a
href="http://ant.apache.org/">Apache Ant</a>.</p>
+ <pre>
+ <target name="dex" depends="compile">
+ <echo>Converting compiled files and external libraries into
${outdir}/${dex-file}...</echo>
+ <apply executable="${dx}" failonerror="true" parallel="true">
+ <arg value="--dex" />
+ <arg value="--core-library" />
+ <arg value="--output=${intermediate-dex-ospath}" />
+ <arg path="${outdir-classes-ospath}" />
+ <fileset dir="${external-libs}" includes="*.jar"/>
+ </apply>
+ </target>
+ </pre>
+ <p>Now its time to build and install the project on your emulator.</p>
+ </section>
+
+ <section name="The result">
+ <p>
+ <img src="scxml-stopwatch-on-android/android_1.jpg"
style="width:191px;height:365px;"/><br/>
+ (Figure 1: Begin in state "reset")<br/><br/>
+ <img src="scxml-stopwatch-on-android/android_2.jpg"
style="width:191px;height:365px;"/><br/>
+ (Figure 2: Start puts the stopwatch in "running" state)<br/><br/>
+ <img src="scxml-stopwatch-on-android/android_3.jpg"
style="width:191px;height:365px;"/><br/>
+ (Figure 3: Split causes the stopwatch to be "paused")<br/><br/>
+ <img src="scxml-stopwatch-on-android/android_4.jpg"
style="width:191px;height:365px;"/><br/>
+ (Figure 4: The stopwatch in "stopped")<br/><br/>
+ </p>
+ </section>
+
+ </body>
+
+</document>
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/AndroidManifest.xml
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/AndroidManifest.xml?rev=701488&view=auto
==============================================================================
---
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/AndroidManifest.xml
(added)
+++
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/AndroidManifest.xml
Fri Oct 3 11:49:05 2008
@@ -0,0 +1,33 @@
+<?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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.apache.commons.scxml.samples.android">
+
+
+ <application android:icon="@drawable/icon">
+
+ <activity android:name=".StopWatchActivity"
android:label="@string/stopwatch">
+ <intent-filter>
+ <action
android:name="android.intent.action.MAIN" />
+ <category
android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+
+</manifest>
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/AndroidManifest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/AndroidManifest.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/StopWatchActivity.java.txt
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/StopWatchActivity.java.txt?rev=701488&view=auto
==============================================================================
---
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/StopWatchActivity.java.txt
(added)
+++
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/StopWatchActivity.java.txt
Fri Oct 3 11:49:05 2008
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ */
+
+package org.apache.commons.scxml.samples.android;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.apache.commons.scxml.env.StopWatch;
+import org.apache.commons.scxml.samples.android.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+public class StopWatchActivity extends Activity {
+
+ private static final int UPDATE_TIME = 1;
+ private static final int UPDATE_STATE = 2;
+ private StopWatch mStopWatch;
+ private Button mStartButton;
+ private Button mSplitButton;
+ private TextView mState = null;
+ private TextView mTime = null;
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ this.setContentView(R.layout.stopwatch_display);
+ mStartButton = (Button) findViewById(R.id.startstop);
+ mSplitButton = (Button) findViewById(R.id.split);
+ mState = (TextView) findViewById(R.id.status);
+ mTime = (TextView) findViewById(R.id.time);
+ mStopWatch = new StopWatch();
+
+
+ mStartButton.setOnClickListener(new OnClickListener(){
+
+ @Override
+ public void onClick(View v) {
+ Button startButton = (Button) v;
+ Button splitButton = (Button)
findViewById(R.id.split);
+
+ String action =
startButton.getText().toString();
+ if (action == getString(R.string.start)) {
+ mStopWatch.fireEvent(StopWatch.EVENT_START);
+ startButton.setText(R.string.stop);
+ splitButton.setEnabled(true);
+ } else if (action == getString(R.string.stop)) {
+ mStopWatch.fireEvent(StopWatch.EVENT_STOP);
+ startButton.setText(R.string.reset);
+ splitButton.setEnabled(false);
+ } else if (action == getString(R.string.reset)){
+ mStopWatch.fireEvent(StopWatch.EVENT_RESET);
+ startButton.setText(R.string.start);
+ splitButton.setText(R.string.split);
+ }
+ }
+ });
+
+ mSplitButton.setOnClickListener(new OnClickListener(){
+
+ @Override
+ public void onClick(View v) {
+ Button splitButton = (Button) v;
+
+ String action =
splitButton.getText().toString();
+ if (action == getString(R.string.split)) {
+ mStopWatch.fireEvent(StopWatch.EVENT_SPLIT);
+ splitButton.setText(R.string.unsplit);
+ } else if(action == getString(R.string.unsplit)){
+ mStopWatch.fireEvent(StopWatch.EVENT_UNSPLIT);
+ splitButton.setText(R.string.split);
+ }
+ }
+ });
+
+
+ Timer displayTimer = new Timer();
+ displayTimer.scheduleAtFixedRate(new TimerTask() {
+ public void run() {
+ mHandler.sendMessage(mHandler.obtainMessage(UPDATE_STATE,
mStopWatch.getCurrentState()));
+ mHandler.sendMessage(mHandler.obtainMessage(UPDATE_TIME,
mStopWatch.getDisplay()));
+ }
+ }, 100, 100);
+
+ }
+
+
+ private Handler mHandler = new Handler() {
+ @Override public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case UPDATE_STATE:
+ mState.setText((String)msg.obj);
+ break;
+ case UPDATE_TIME:
+ mTime.setText((String)msg.obj);
+ break;
+ default:
+ super.handleMessage(msg);
+ }
+ }
+ };
+
+}
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/StopWatchActivity.java.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/StopWatchActivity.java.txt
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_1.jpg
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_1.jpg?rev=701488&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_1.jpg
------------------------------------------------------------------------------
svn:mime-type = image/jpeg
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_2.jpg
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_2.jpg?rev=701488&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_2.jpg
------------------------------------------------------------------------------
svn:mime-type = image/jpeg
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_3.jpg
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_3.jpg?rev=701488&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_3.jpg
------------------------------------------------------------------------------
svn:mime-type = image/jpeg
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_4.jpg
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_4.jpg?rev=701488&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/android_4.jpg
------------------------------------------------------------------------------
svn:mime-type = image/jpeg
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/diff.txt
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/diff.txt?rev=701488&view=auto
==============================================================================
---
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/diff.txt
(added)
+++
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/diff.txt
Fri Oct 3 11:49:05 2008
@@ -0,0 +1,414 @@
+# 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.
+
+$diff -tTrdbB --suppress-common-lines original/ altered/ > diff.txt
+
+original/java/beans/AppletInitializer.java
altered/java/beans/AppletInitializer.java
+20d19
+< import java.applet.Applet;
+25c24
+< public void initialize(Applet newAppletBean, BeanContext bCtxt);
+---
+> public void initialize(Object newAppletBean, BeanContext bCtxt);
+27c26
+< public void activate(Applet newApplet);
+---
+> public void activate(Object newApplet);
+Only in original/java/beans: AwtChoicePersistenceDelegate.java
+Only in original/java/beans: AwtColorPersistenceDelegate.java
+Only in original/java/beans: AwtComponentPersistenceDelegate.java
+Only in original/java/beans: AwtContainerPersistenceDelegate.java
+Only in original/java/beans: AwtCursorPersistenceDelegate.java
+Only in original/java/beans: AwtDimensionPersistenceDelegate.java
+Only in original/java/beans: AwtFontPersistenceDelegate.java
+Only in original/java/beans: AwtFontTextAttributePersistenceDelegate.java
+Only in original/java/beans: AwtInsetsPersistenceDelegate.java
+Only in original/java/beans: AwtListPersistenceDelegate.java
+Only in original/java/beans: AwtMenuBarPersistenceDelegate.java
+Only in original/java/beans: AwtMenuPersistenceDelegate.java
+Only in original/java/beans: AwtMenuShortcutPersistenceDelegate.java
+Only in original/java/beans: AwtPointPersistenceDelegate.java
+Only in original/java/beans: AwtRectanglePersistenceDelegate.java
+Only in original/java/beans: AwtScrollPanePersistenceDelegate.java
+Only in original/java/beans: AwtSystemColorPersistenceDelegate.java
+
+
+original/java/beans/beancontext/BeanContextChildComponentProxy.java
altered/java/beans/beancontext/BeanContextChildComponentProxy.java
+20d19
+< import java.awt.Component;
+24c23
+< public Component getComponent();
+---
+> public Object getComponent();
+
+
+original/java/beans/beancontext/BeanContextContainerProxy.java
altered/java/beans/beancontext/BeanContextContainerProxy.java
+20d19
+< import java.awt.Container;
+24c23
+< public Container getContainer();
+---
+> public Object getContainer();
+
+
+original/java/beans/beancontext/BeanContextSupport.java
altered/java/beans/beancontext/BeanContextSupport.java
+20d19
+< import java.awt.Component;
+817,819d815
+< if (childs[i] instanceof Component) {
+< return true;
+< }
+
+
+original/java/beans/BeanInfo.java altered/java/beans/BeanInfo.java
+20d19
+< import java.awt.Image;
+42c41
+< public Image getIcon(int iconKind);
+---
+> public Object getIcon(int iconKind);
+
+
+original/java/beans/Beans.java altered/java/beans/Beans.java
+20,24d19
+< import java.applet.Applet;
+< import java.applet.AppletContext;
+< import java.applet.AppletStub;
+< import java.applet.AudioClip;
+< import java.awt.Image;
+201,204c196,199
+< if (result instanceof Applet) {
+< appletLoaded((Applet) result, loader,
beanName, context,
+< initializer,
deserialized);
+< }
+---
+> // if (result instanceof Applet) {
+> // appletLoaded((Applet) result, loader,
beanName, context,
+> // initializer,
deserialized);
+> // }
+316,451d310
+< private static void appletLoaded(Applet applet, ClassLoader loader,
+< String name, BeanContext context, AppletInitializer
initializer,
+< boolean deserialized) throws ClassNotFoundException {
+<
+< // If there is an initializer
+< if (initializer != null) {
+< initializer.initialize(applet, context);
+< } else {
+< setStub(applet, loader, deserialized, name);
+< }
+<
+< if (!deserialized) {
+< applet.init();
+< }
+<
+< if (initializer != null) {
+< initializer.activate(applet);
+< }
+< }
+<
+< private static void setStub(Applet applet, final ClassLoader loader,
+< boolean serialized, String beanName) throws
ClassNotFoundException {
+< // Get path to the resource representing the applet.
+< String pathName = beanName.replace('.', '/');
+< final String resourceName = serialized ?
pathName.concat(".ser") : pathName.concat(".class"); //$NON-NLS-1$ //$NON-NLS-2$
+< URL objectUrl = AccessController
+< .doPrivileged(new PrivilegedAction<URL>() {
+< public URL run() {
+< if (loader == null)
+< return
ClassLoader.getSystemResource(resourceName);
+< return loader.getResource(resourceName);
+< }
+< });
+<
+< // If we can't get to the applet itself, the codebase and doc
base are
+< // left as null.
+< if (objectUrl == null) {
+< applet.setStub(getAppletStub(getStubAppletContext(applet),
+< null, null));
+< return;
+< }
+<
+< // Try to decompose the resource URL to get to the doc/code URL
+< String urlString = objectUrl.toExternalForm();
+<
+< // This is the URL of the directory that contains the applet.
+< int codeURLlength = urlString.length() - resourceName.length();
+< URL codeBase = safeURL(urlString.substring(0, codeURLlength));
+<
+< // URL of the document containing the applet.
+< int docURLlength = urlString.lastIndexOf('/');
+< URL docBase = safeURL(urlString.substring(0, docURLlength + 1));
+<
+< applet.setStub(getAppletStub(getStubAppletContext(applet),
+< codeBase, docBase));
+< }
+<
+<
+< private static AppletStub getAppletStub(final AppletContext
context, final URL codeBase, final URL docBase) {
+<
+< return new AppletStub() {
+< public boolean isActive() {
+< return true;
+< }
+<
+< public URL getDocumentBase() {
+< return docBase;
+< }
+<
+< public URL getCodeBase() {
+< return codeBase;
+< }
+<
+< public String getParameter(String name) {
+< // Applet beans have no params.
+< return null;
+< }
+<
+< public AppletContext getAppletContext() {
+< return context;
+< }
+<
+< public void appletResize(int width, int height) {
+< // Do nothing.
+< }
+< };
+< }
+<
+< private static AppletContext getStubAppletContext(final Applet
target) {
+< return new AppletContext() {
+< public AudioClip getAudioClip(URL url) {
+< return null;
+< }
+<
+< public synchronized Image getImage(URL url) {
+< return null;
+< }
+<
+< public Applet getApplet(String name) {
+< return null;
+< }
+<
+< public Enumeration<Applet> getApplets() {
+< Vector<Applet> applets = new Vector<Applet>();
+< applets.addElement(target);
+< return applets.elements();
+< }
+<
+< public void showDocument(URL url) {
+< // Do nothing.
+< }
+<
+< public void showDocument(URL url, String aTarget) {
+< // Do nothing.
+< }
+<
+< public void showStatus(String status) {
+< // Do nothing.
+< }
+<
+< public void setStream(String key, InputStream stream)
+< throws IOException {
+< // Do nothing.
+< }
+<
+< public InputStream getStream(String key) {
+< return null;
+< }
+<
+< public Iterator<String> getStreamKeys() {
+< return null;
+< }
+< };
+< }
+<
+<
+
+
+original/java/beans/Encoder.java altered/java/beans/Encoder.java
+20,36c20
+< import java.awt.Choice;
+< import java.awt.Color;
+< import java.awt.Component;
+< import java.awt.Container;
+< import java.awt.Cursor;
+< import java.awt.Dimension;
+< import java.awt.Font;
+< import java.awt.Insets;
+< import java.awt.List;
+< import java.awt.Menu;
+< import java.awt.MenuBar;
+< import java.awt.MenuShortcut;
+< import java.awt.Point;
+< import java.awt.Rectangle;
+< import java.awt.ScrollPane;
+< import java.awt.SystemColor;
+< import java.awt.font.TextAttribute;
+---
+>
+45,49d28
+< import javax.swing.Box;
+< import javax.swing.DefaultComboBoxModel;
+< import javax.swing.JFrame;
+< import javax.swing.JTabbedPane;
+< import javax.swing.ToolTipManager;
+108,137d86
+< delegates.put(Choice.class, new AwtChoicePersistenceDelegate());
+< delegates.put(Color.class, new AwtColorPersistenceDelegate());
+< delegates.put(Container.class, new
AwtContainerPersistenceDelegate());
+< delegates.put(Component.class, new
AwtComponentPersistenceDelegate());
+< delegates.put(Cursor.class, new AwtCursorPersistenceDelegate());
+< delegates.put(Dimension.class, new
AwtDimensionPersistenceDelegate());
+< delegates.put(Font.class, new AwtFontPersistenceDelegate());
+< delegates.put(Insets.class, new AwtInsetsPersistenceDelegate());
+< delegates.put(List.class, new AwtListPersistenceDelegate());
+< delegates.put(Menu.class, new AwtMenuPersistenceDelegate());
+< delegates.put(MenuBar.class, new
AwtMenuBarPersistenceDelegate());
+< delegates.put(MenuShortcut.class,
+< new AwtMenuShortcutPersistenceDelegate());
+< delegates.put(Point.class, new AwtPointPersistenceDelegate());
+< delegates.put(Rectangle.class, new
AwtRectanglePersistenceDelegate());
+< delegates.put(SystemColor.class,
+< new AwtSystemColorPersistenceDelegate());
+< delegates.put(TextAttribute.class,
+< new AwtFontTextAttributePersistenceDelegate());
+<
+< delegates.put(Box.class, new SwingBoxPersistenceDelegate());
+< delegates.put(JFrame.class, new
SwingJFramePersistenceDelegate());
+< delegates.put(JTabbedPane.class,
+< new SwingJTabbedPanePersistenceDelegate());
+< delegates.put(DefaultComboBoxModel.class,
+< new SwingDefaultComboBoxModelPersistenceDelegate());
+< delegates.put(ToolTipManager.class,
+< new SwingToolTipManagerPersistenceDelegate());
+< delegates.put(ScrollPane.class, new
AwtScrollPanePersistenceDelegate());
+<
+
+
+original/java/beans/PropertyEditor.java altered/java/beans/PropertyEditor.java
+20,22c20,22
+< import java.awt.Component;
+< import java.awt.Graphics;
+< import java.awt.Rectangle;
+---
+>
+>
+>
+26c26
+< public void paintValue(Graphics gfx, Rectangle box);
+---
+> public void paintValue(Object gfx, Object box);
+44c44
+< public Component getCustomEditor();
+---
+> public Object getCustomEditor();
+
+
+original/java/beans/PropertyEditorSupport.java
altered/java/beans/PropertyEditorSupport.java
+19,21c19,21
+< import java.awt.Component;
+< import java.awt.Graphics;
+< import java.awt.Rectangle;
+---
+>
+>
+>
+49c49
+< public void paintValue(Graphics gfx, Rectangle box) {
+---
+> public void paintValue(Object gfx, Object box) {
+103c103
+< public Component getCustomEditor() {
+---
+> public Object getCustomEditor() {
+
+
+original/java/beans/SimpleBeanInfo.java altered/java/beans/SimpleBeanInfo.java
+20,21c20,21
+< import java.awt.Image;
+< import java.awt.Toolkit;
+---
+>
+>
+30c30
+< public Image loadImage(String resourceName) {
+---
+> public Object loadImage(String resourceName) {
+38c38
+< return Toolkit.getDefaultToolkit().createImage(file);
+---
+> return null;
+63c63
+< public Image getIcon(int iconKind) {
+---
+> public Object getIcon(int iconKind) {
+
+
+original/java/beans/StandardBeanInfo.java
altered/java/beans/StandardBeanInfo.java
+22c22
+< import java.awt.Image;
+---
+>
+90c90
+< private Image[] icon = new Image[4];
+---
+>
+131,133c131,133
+< for (int i = 0; i < 4; i++) {
+< icon[i] = explicitBeanInfo.getIcon(i + 1);
+< }
+---
+>
+>
+>
+198,199c198,199
+< public Image getIcon(int iconKind) {
+< return icon[iconKind - 1];
+---
+> public Object getIcon(int iconKind) {
+> return null;
+Only in original/java/beans: SwingAbstractButtonPersistenceDelegate.java
+Only in original/java/beans: SwingBoxPersistenceDelegate.java
+Only in original/java/beans: SwingDefaultComboBoxModelPersistenceDelegate.java
+Only in original/java/beans: SwingJFramePersistenceDelegate.java
+Only in original/java/beans: SwingJTabbedPanePersistenceDelegate.java
+Only in original/java/beans: SwingToolTipManagerPersistenceDelegate.java
+
+
+original/java/beans/XMLEncoder.java altered/java/beans/XMLEncoder.java
+21c21
+< import java.awt.SystemColor;
+---
+>
+484c484
+< if(target == SystemColor.class || target ==
TextAttribute.class) {
+---
+> if(target == TextAttribute.class) {
+Only in altered/org/apache/commons/scxml/env: StopWatch.java
+Only in altered/org/apache/commons/scxml/env: stopwatch.xml
+Only in altered/org/apache/commons/scxml: samples
+Only in original/org/apache/harmony/beans/editors: ColorEditor.java
+Only in original/org/apache/harmony/beans/editors: FontEditor.java
+
+
+original/org/apache/harmony/beans/internal/nls/Messages.java
altered/org/apache/harmony/beans/internal/nls/Messages.java
+33,34d32
+< import org.apache.harmony.kernel.vm.VM;
+<
+221c219,220
+< final ClassLoader loader = VM.bootCallerClassLoader();
+---
+> //pass androids classloader in?
+> final ClassLoader loader = null;
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/diff.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/diff.txt
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/icon.png
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/icon.png?rev=701488&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/icon.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/scxml-dependencies-on-android.png
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/scxml-dependencies-on-android.png?rev=701488&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/scxml-dependencies-on-android.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/stopwatch_display.xml
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/stopwatch_display.xml?rev=701488&view=auto
==============================================================================
---
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/stopwatch_display.xml
(added)
+++
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/stopwatch_display.xml
Fri Oct 3 11:49:05 2008
@@ -0,0 +1,62 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical" android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="100px"
+ android:gravity="center_vertical">
+
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="14pt"
+ android:text="@string/state" />
+ <TextView android:id="@+id/status"
+ android:textSize="14pt"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingLeft="20px"/>
+ </LinearLayout>
+
+ <TextView android:id="@+id/time"
+ android:textSize="24pt"
+ android:textColor="#ffffff"
+ android:layout_width="fill_parent"
+ android:layout_height="200px"
+
android:gravity="center_vertical|center_horizontal"/>
+
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+
android:gravity="center_vertical|center_horizontal">
+
+ <Button android:id="@+id/startstop"
+ android:text="@string/start"
+ android:layout_width="100px"
+ android:layout_height="wrap_content" />
+ <Button android:id="@+id/split"
+ android:text="@string/split"
+ android:layout_width="100px"
+ android:layout_height="wrap_content" />
+ </LinearLayout>
+
+</LinearLayout>
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/stopwatch_display.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/stopwatch_display.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/strings.xml
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/strings.xml?rev=701488&view=auto
==============================================================================
---
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/strings.xml
(added)
+++
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/strings.xml
Fri Oct 3 11:49:05 2008
@@ -0,0 +1,29 @@
+<?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.
+-->
+
+<resources>
+ <string name="app_name">ScxmlStopwatch</string>
+ <string name="stopwatch">stopwatch</string>
+ <string name="state">state:</string>
+ <string name="start">start</string>
+ <string name="stop">stop</string>
+ <string name="split">split</string>
+ <string name="unsplit">unsplit</string>
+ <string name="reset">reset</string>
+ <string name="unidentified_error">unidentified error occurred</string>
+</resources>
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/strings.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
commons/proper/scxml/trunk/xdocs/usecases/scxml-stopwatch-on-android/strings.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL