mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-13 06:49:31 -06:00
detailed information for the type errors from PGFService
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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:'
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -84,6 +84,10 @@
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.my-error-title {
|
||||
background: #DDDDDD;
|
||||
}
|
||||
|
||||
.my-treeimage {
|
||||
width: 650px;
|
||||
height: 520px;
|
||||
|
||||
Reference in New Issue
Block a user