Commit abd61958 authored by Matija Obreza's avatar Matija Obreza
Browse files

Multiple remarks

parent b2d02af3
......@@ -16,10 +16,13 @@
package org.genesys2.anno.gui;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.DataBindingContext;
......@@ -447,21 +450,30 @@ public class SheetDisplay extends Composite {
Map<String, ?> map1 = RowConverter.toMap(dataSourceSheet, row, columnDefs);
try {
final ObjectNode jsonObject = RowConverter.toJson(map1);
final String prettyJson=mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonObject);
final String prettyJson = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonObject);
showMessageBox("Genesys JSON Preview", prettyJson);
} catch (Exception e) {
_log.error(e.getMessage(), e);
showMessageBox("Conversion error", e.getMessage());
showMessageBox("Conversion error", e);
}
}
private void showMessageBox(String title, Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
pw.println(e.getMessage());
e.printStackTrace(pw);
sw.flush();
showMessageBox(title, sw.toString());
}
public void showMessageBox(final String title, final String message) {
getDisplay().syncExec(new Runnable() {
@Override
public void run() {
MessageBox mb = new MessageBox(getShell());
mb.setMessage(message);
mb.setText(title);
mb.setMessage(StringUtils.defaultIfBlank(message, "?"));
mb.setText(StringUtils.defaultIfBlank(title, "A message from our sponsors"));
mb.open();
}
});
......
......@@ -188,7 +188,7 @@ public class GenesysJSON {
columnDef = new JsonField("available", RdfMCPD.AVAILABLE).setType(boolean.class);
columns.add(columnDef);
columnDef = new JsonField("remarks", RdfMCPD.REMARKS);
columnDef = new JsonField("remarks", RdfMCPD.REMARKS).setAllowMultiple(true);
columns.add(columnDef);
this.jsonFields = Collections.unmodifiableList(columns);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment