diff options
| author | krasimir <krasimir@chalmers.se> | 2010-07-13 15:33:54 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2010-07-13 15:33:54 +0000 |
| commit | 4fdd21f1273e75b84e87c49b95b02e9fc149b5c0 (patch) | |
| tree | 2f23924035d3b2a45918ea4bd215de57d313520a /src/ui/gwt | |
| parent | 3ca0b6a976719be9f1fe17481441061bb7d18f45 (diff) | |
detailed information for the type errors from PGFService
Diffstat (limited to 'src/ui/gwt')
6 files changed, 42 insertions, 10 deletions
diff --git a/src/ui/gwt/Editor-compile b/src/ui/gwt/Editor-compile index 4106298ea..d054d16ad 100644 --- a/src/ui/gwt/Editor-compile +++ b/src/ui/gwt/Editor-compile @@ -1,6 +1,8 @@ #!/bin/sh APPDIR=`dirname $0`; +GWT_DIR="/home/angelov/gwt-2.0.4" +GWT_CLASSPATH="$GWT_DIR/gwt-user.jar:$GWT_DIR/gwt-dev.jar" if [ -z "$GWT_CLASSPATH" ]; then echo 'ERROR: $GWT_CLASSPATH is not set' diff --git a/src/ui/gwt/Translate-compile b/src/ui/gwt/Translate-compile index 220cf4a46..c2fbca65c 100644 --- a/src/ui/gwt/Translate-compile +++ b/src/ui/gwt/Translate-compile @@ -2,6 +2,9 @@ APPDIR=`dirname $0`; +GWT_DIR="/home/angelov/gwt-2.0.4" +GWT_CLASSPATH="$GWT_DIR/gwt-user.jar:$GWT_DIR/gwt-dev.jar" + 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:' diff --git a/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/FridgeApp.java b/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/FridgeApp.java index c54bb4ddb..886679b04 100644 --- a/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/FridgeApp.java +++ b/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/FridgeApp.java @@ -54,10 +54,10 @@ public class FridgeApp implements EntryPoint { } if (tr.getTypeErrors() != null) - for (String error : tr.getTypeErrors()) { + for (PGF.TcError error : tr.getTypeErrors()) { SimplePanel panel = new SimplePanel(); panel.addStyleName("my-typeError"); - panel.add(new HTML("<pre>"+error+"</pre>")); + panel.add(new HTML("<pre>"+error.getMsg()+"</pre>")); outputPanel.add(panel); } } diff --git a/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/PGF.java b/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/PGF.java index 41e77539c..5a1a9e873 100644 --- a/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/PGF.java +++ b/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/PGF.java @@ -63,9 +63,9 @@ public class PGF { protected TranslationResult() { } public final native String getFrom() /*-{ return this.from; }-*/; - public final native String getBracketedString() /*-{ return this.brackets; }-*/; + public final native BracketedString getBracketedString() /*-{ return this.brackets; }-*/; public final native IterableJsArray<Translation> getTranslations() /*-{ return this.translations; }-*/; - public final native String[] getTypeErrors() /*-{ return this.typeErrors; }-*/; + public final native TcError[] getTypeErrors() /*-{ return this.typeErrors; }-*/; } public static class Translation extends JavaScriptObject { @@ -137,9 +137,27 @@ public class PGF { protected ParseResult() { } public final native String getFrom() /*-{ return this.from; }-*/; - public final native String getBracketedString() /*-{ return this.brackets; }-*/; + public final native BracketedString getBracketedString() /*-{ return this.brackets; }-*/; public final native String[] getTrees() /*-{ return this.trees; }-*/; - public final native String[] getTypeErrors() /*-{ return this.typeErrors; }-*/; + public final native TcError[] getTypeErrors() /*-{ return this.typeErrors; }-*/; + } + + public static class BracketedString extends JavaScriptObject { + protected BracketedString() { } + + public final native String getToken() /*-{ return this.token; }-*/; + + public final native String getCat() /*-{ return this.cat; }-*/; + public final native int getFId() /*-{ return this.fid; }-*/; + public final native int getIndex() /*-{ return this.index; }-*/; + public final native BracketedString[] getChildren() /*-{ return this.children; }-*/; + } + + public static class TcError extends JavaScriptObject { + protected TcError() { } + + public final native int getFId() /*-{ return this.fid; }-*/; + public final native String getMsg() /*-{ return this.msg; }-*/; } public String graphvizAbstractTree(String pgfURL, String abstractTree) { diff --git a/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/TranslateApp.java b/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/TranslateApp.java index d2ae216ec..2b65a2be7 100644 --- a/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/TranslateApp.java +++ b/src/ui/gwt/src/org/grammaticalframework/ui/gwt/client/TranslateApp.java @@ -66,13 +66,18 @@ public class TranslateApp implements EntryPoint { } } - if (tr.getTypeErrors() != null) - for (String error : tr.getTypeErrors()) { - SimplePanel panel = new SimplePanel(); + if (tr.getTypeErrors() != null && tr.getTypeErrors().length > 0) { + for (PGF.TcError error : tr.getTypeErrors()) { + VerticalPanel panel = new VerticalPanel(); panel.addStyleName("my-typeError"); - panel.add(new HTML("<pre>"+error+"</pre>")); + Label errLabel = new Label("Type Error"); + errLabel.addStyleName("my-error-title"); + HTML msgHTML = new HTML("<pre>"+error.getMsg()+"</pre>"); + panel.add(errLabel); + panel.add(msgHTML); outputPanel.add(panel); } + } } } public void onError (Throwable e) { diff --git a/src/ui/gwt/src/org/grammaticalframework/ui/gwt/public/Translate.css b/src/ui/gwt/src/org/grammaticalframework/ui/gwt/public/Translate.css index 49efa8c76..dd0ad3091 100644 --- a/src/ui/gwt/src/org/grammaticalframework/ui/gwt/public/Translate.css +++ b/src/ui/gwt/src/org/grammaticalframework/ui/gwt/public/Translate.css @@ -84,6 +84,10 @@ cursor:pointer; } +.my-error-title { + background: #DDDDDD; +} + .my-treeimage { width: 650px; height: 520px; |
