After using the model to write a SWT interface, if the interface is reusable, it can be defined as a composite control.
The main methods of defining composite models are as follows.
The following 40-second GIF video demonstrates how to define composite controls.

The Groovy code for the create() method in the above example is as follows.
import xworker.swt.util.ThingCompositeCreator;
//Usually use ThingCompositeCreator to help create objects
def cc = new ThingCompositeCreator(self, actionContext);
//Set prototype
def prototype = world.getThing("xworker.example.util.barcode.ZXingSwtExample/@mainComposite");
cc.setCompositeThing(prototype);
//Create
def composite = cc.create();
//To avoid polluting variables in the current context, it is common to use a separate context
def ac = cc.getNewActionContext();
//Save variable. The saved variable is usually used for interaction later.
actionContext.g().put(self.getMetadata().getName(), ac.get("messageText"));
return composite;
Copyright © 2007-2019 XWorker.org 版权所有 沪ICP备08000575号