diff options
| author | krasimir <krasimir@chalmers.se> | 2009-06-04 16:26:52 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2009-06-04 16:26:52 +0000 |
| commit | f2a968b6d53ac07df67f393bd06c38f368d08c02 (patch) | |
| tree | 6cf785bcb1807de93f10452b11b0dd306157ec70 /src/server/gwt | |
| parent | 6a263f05aa8d963f7141aca8b7ee0cae0c063515 (diff) | |
the morpho server is now updated and works with the current GF. the sources are moved in directory server
Diffstat (limited to 'src/server/gwt')
| -rw-r--r-- | src/server/gwt/Morpho-compile | 19 | ||||
| -rw-r--r-- | src/server/gwt/src/se/chalmers/cs/gf/gwt/MorphoApp.gwt.xml | 24 | ||||
| -rw-r--r-- | src/server/gwt/src/se/chalmers/cs/gf/gwt/client/MorphoApp.java | 63 | ||||
| -rw-r--r-- | src/server/gwt/www/morpho/index.html | 36 | ||||
| -rw-r--r-- | src/server/gwt/www/morpho/morpho.fcgi | 1 |
5 files changed, 143 insertions, 0 deletions
diff --git a/src/server/gwt/Morpho-compile b/src/server/gwt/Morpho-compile new file mode 100644 index 000000000..e3cb451ed --- /dev/null +++ b/src/server/gwt/Morpho-compile @@ -0,0 +1,19 @@ +#!/bin/sh + +APPDIR=`dirname $0`; + +if [ -z "$GWT_CLASSPATH" ]; then + echo 'ERROR: $GWT_CLASSPATH is not set' + echo 'Set $GWT_CLASSPATH to point to the GWT JAR files. For example:' + echo 'export GWT_DIR="/Users/bringert/src/gwt-mac-1.5.2"' + echo 'export GWT_CLASSPATH="$GWT_DIR/gwt-user.jar:$GWT_DIR/gwt-dev-mac.jar"' + exit 1 +fi + +if [ `uname` = "Darwin" ]; then + GWT_JAVA_OPTS=-XstartOnFirstThread +fi + +LIBS=$APPDIR/lib/gwt-dnd-2.5.6.jar + +java $GWT_JAVA_OPTS -Xmx256M -cp "$APPDIR/src:$APPDIR/bin:$LIBS:$GWT_CLASSPATH" com.google.gwt.dev.GWTCompiler -out "$APPDIR/www/morpho" "$@" se.chalmers.cs.gf.gwt.MorphoApp; diff --git a/src/server/gwt/src/se/chalmers/cs/gf/gwt/MorphoApp.gwt.xml b/src/server/gwt/src/se/chalmers/cs/gf/gwt/MorphoApp.gwt.xml new file mode 100644 index 000000000..3743667f7 --- /dev/null +++ b/src/server/gwt/src/se/chalmers/cs/gf/gwt/MorphoApp.gwt.xml @@ -0,0 +1,24 @@ +<module> + + <!-- Inherit the core Web Toolkit stuff. --> + <inherits name="com.google.gwt.user.User" /> + <inherits name="com.google.gwt.xml.XML" /> + + <!-- Inherit the default GWT style sheet. You can change --> + <!-- the theme of your GWT application by uncommenting --> + <!-- any one of the following lines. --> + <inherits name="com.google.gwt.user.theme.standard.Standard"/> + <!-- <inherits name="com.google.gwt.user.theme.chrome.Chrome"/> --> + <!-- <inherits name="com.google.gwt.user.theme.dark.Dark"/> --> + + <!-- Other module inherits --> + <inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/> + + + <!-- Specify the app entry point class. --> + <entry-point class="se.chalmers.cs.gf.gwt.client.MorphoApp" /> + + <!-- Specify the application specific style sheet. --> + <stylesheet src="Morpho.css" /> + +</module> diff --git a/src/server/gwt/src/se/chalmers/cs/gf/gwt/client/MorphoApp.java b/src/server/gwt/src/se/chalmers/cs/gf/gwt/client/MorphoApp.java new file mode 100644 index 000000000..20c137e74 --- /dev/null +++ b/src/server/gwt/src/se/chalmers/cs/gf/gwt/client/MorphoApp.java @@ -0,0 +1,63 @@ +package se.chalmers.cs.gf.gwt.client; + +import java.util.*; + +import com.google.gwt.core.client.*; +import com.google.gwt.user.client.ui.*; +import com.google.gwt.core.client.JavaScriptObject; + +public class MorphoApp implements EntryPoint { + private TextBox lemmaBox = new TextBox(); + private Button submitButton = new Button("Submit"); + private Grid outputGrid = new Grid(2,0); + + public void onModuleLoad() { + HorizontalPanel inputPanel = new HorizontalPanel(); + inputPanel.add(lemmaBox); + inputPanel.add(submitButton); + + submitButton.addClickListener(new ClickListener() { + public void onClick(Widget sender) { + + String url = "http://localhost:41296/morpho/morpho.fcgi/eval"; + List<JSONRequestBuilder.Arg> args = new ArrayList<JSONRequestBuilder.Arg>(); + args.add(new JSONRequestBuilder.Arg("term", lemmaBox.getText())); + + JSONRequestBuilder.sendRequest(url, args, new TableCallback() { + public void onResult (IterableJsArray<InflectionForm> table) + { + outputGrid.resize(table.length(),2); + int row = 0; + for (InflectionForm form : table.iterable()) { + outputGrid.setText(row,0,form.getName()); + outputGrid.setText(row,1,form.getValue()); + row++; + } + } + + public void onError (Throwable e) + { + outputGrid.resize(1,1); + outputGrid.setText(0,0,e.toString()); + } + }); + } + }); + + + VerticalPanel mainPanel = new VerticalPanel(); + mainPanel.add(inputPanel); + mainPanel.add(outputGrid); + RootPanel.get().add(mainPanel); + } + + public interface TableCallback extends JSONCallback<IterableJsArray<InflectionForm>> { } + + public static class InflectionForm extends JavaScriptObject { + protected InflectionForm() { } + + public final native String getName() /*-{ return this.name; }-*/; + + public final native String getValue() /*-{ return this.value; }-*/; + } +} diff --git a/src/server/gwt/www/morpho/index.html b/src/server/gwt/www/morpho/index.html new file mode 100644 index 000000000..9e3beabb6 --- /dev/null +++ b/src/server/gwt/www/morpho/index.html @@ -0,0 +1,36 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!-- The HTML 4.01 Transitional DOCTYPE declaration--> +<!-- above set at the top of the file will set --> +<!-- the browser's rendering engine into --> +<!-- "Quirks Mode". Replacing this declaration --> +<!-- with a "Standards Mode" doctype is supported, --> +<!-- but may lead to some differences in layout. --> + +<html> + <head> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"> + <!-- --> + <!-- Any title is fine --> + <!-- --> + <title>Morpho</title> + + <!-- --> + <!-- This script loads your compiled module. --> + <!-- If you add any GWT meta tags, they must --> + <!-- be added before this line. --> + <!-- --> + <script type="text/javascript" language="javascript" src="se.chalmers.cs.gf.gwt.MorphoApp/se.chalmers.cs.gf.gwt.MorphoApp.nocache.js"></script> + </head> + + <!-- --> + <!-- The body can have arbitrary html, or --> + <!-- you can leave the body empty if you want --> + <!-- to create a completely dynamic UI. --> + <!-- --> + <body> + + <!-- OPTIONAL: include this if you want history support --> + <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> + + </body> +</html> diff --git a/src/server/gwt/www/morpho/morpho.fcgi b/src/server/gwt/www/morpho/morpho.fcgi new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/src/server/gwt/www/morpho/morpho.fcgi @@ -0,0 +1 @@ + |
