mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 08:32:50 -06:00
the morpho server is now updated and works with the current GF. the sources are moved in directory server
This commit is contained in:
19
src/server/gwt/Morpho-compile
Normal file
19
src/server/gwt/Morpho-compile
Normal file
@@ -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;
|
||||
24
src/server/gwt/src/se/chalmers/cs/gf/gwt/MorphoApp.gwt.xml
Normal file
24
src/server/gwt/src/se/chalmers/cs/gf/gwt/MorphoApp.gwt.xml
Normal file
@@ -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>
|
||||
@@ -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; }-*/;
|
||||
}
|
||||
}
|
||||
36
src/server/gwt/www/morpho/index.html
Normal file
36
src/server/gwt/www/morpho/index.html
Normal file
@@ -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>
|
||||
1
src/server/gwt/www/morpho/morpho.fcgi
Normal file
1
src/server/gwt/www/morpho/morpho.fcgi
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user