package org.simantics.document.swt.core.widget;
-import java.util.HashMap;
import java.util.List;
import java.util.TreeMap;
import org.simantics.document.server.client.WidgetData;
import org.simantics.document.server.client.WidgetManager;
import org.simantics.document.server.handler.AbstractEventHandler;
+import org.simantics.document.server.io.CommandContext;
+import org.simantics.document.server.io.CommandContextImpl;
+import org.simantics.document.server.io.CommandContextMutable;
+import org.simantics.document.server.io.ICommand;
import org.simantics.document.swt.core.SWTDocument;
import org.simantics.document.swt.core.base.PostEventCommand;
import org.simantics.document.swt.core.base.PropertyWidgetManager;
}
@Override
- public IEventCommand eventCommand(SWTDocument document, JSONObject object, Object component, String command) {
- if("event".equals(command)) {
+ public IEventCommand eventCommand(SWTDocument document, JSONObject object, Object component, ICommand command, CommandContext p) {
+ if("event".equals(command.getCommand())) {
List<DataDefinition> dataDefinitions = object.getJSONField("dataDefinitions");
- HashMap<String, String> data = new HashMap<String, String>();
+ CommandContextMutable context = new CommandContextImpl();
+ context.merge(p);
for(DataDefinition dd : dataDefinitions) {
WidgetData wd = document.getWidgetData().get(dd.getElementId());
if(wd != null && wd.object != null) {
if(manager != null) {
@SuppressWarnings("unchecked")
String result = manager.getProperty(document, wd.object, wd.widget, dd.getProperty());
- data.put(dd.getTarget(), result);
+ context.putValue(dd.getTarget(), result);
}
}
}
AbstractEventHandler handler = object.getJSONField("SCLFunction");
- return new PostEventCommand(document, handler, data);
+ return new PostEventCommand(document, handler, context);
} else {
return null;
}