import org.simantics.document.server.io.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.swt.core.SWTDocument;
public PostEventCommand(SWTDocument document, AbstractEventHandler handler, CommandContextMutable context, PostEventCommand next) {
super(document);
+ assert(handler != null);
this.handler = handler;
this.context = context;
this.next = next;
@Override
public CommandContext handleCommand(CommandContextMutable context) {
- document.post(handler, context);
+ CommandContextMutable mergedContext = new CommandContextImpl().merge(context)
+ .merge(this.context);
+ document.post(handler, mergedContext);
return context;
}
List<ICommand> commands = object.getJSONField("commands");
HashSet<Object> listeners = new HashSet<Object>();
List<Pair<WidgetData, ICommand>> data = new ArrayList<>();
+ data.addAll(SWTViews.getTriggeredCommands(document, commands, "click"));
data.addAll(SWTViews.getTriggeredCommands(document, commands, "eventOut"));
data.add(new Pair<WidgetData, ICommand>(wd, new Command("onPress")));
SelectionListener listener = new ButtonSelectionListener(wd, data);
if("onPress".equals(command.getCommand())) {
CommandContextMutable context = new CommandContextImpl().merge(p);
AbstractEventHandler onPress = object.getJSONField("onPress");
+ if(onPress == null) return null;
return new PostEventCommand(document, onPress, context);
}
return null;
List<DataDefinition> dataDefinitions = object.getJSONField("dataDefinitions");
CommandContextMutable context = new CommandContextImpl();
context.merge(p);
+ context.merge(command.getConstants());
for(DataDefinition dd : dataDefinitions) {
WidgetData wd = document.getWidgetData().get(dd.getElementId());
if(wd != null && wd.object != null) {
@SWT.defAttribute L0.Value "Boolean"
>-- COMPONENTS.Component.NoScroll
@SWT.defAttribute L0.Value "Boolean"
+ >-- COMPONENTS.Component.Check
+ @SWT.defAttribute L0.Value "Boolean"
>-- COMPONENTS.Component.alignment
@SWT.defAttribute L0.Value "String"
@SWT.defAttribute L0.Value "String"
>-- COMPONENTS.Explorer.dragSourceListenerFactory
@SWT.defAttribute L0.Value "DragSourceListenerFactory"
+ >-- COMPONENTS.Explorer.onCheck
+ @SWT.defAttribute L0.Value "AbstractEventHandler"
@attribute COMPONENTS.Explorer.browseContext
""