Search in sources :

Example 1 with CustomPropertyFunctionEntityList

use of eu.esdihumboldt.hale.ui.functions.custom.pages.internal.CustomPropertyFunctionEntityList in project hale by halestudio.

the class CustomPropertyFunctionEntitiesPage method createEntityGroup.

/**
 * Create an entity group
 *
 * @param ssid the schema space id
 * @param parent the parent composite
 * @return the main group control
 */
protected Control createEntityGroup(SchemaSpaceID ssid, Composite parent) {
    // return another Composite, since the returned Control's layoutData are
    // overwritten.
    Composite holder = new Composite(parent, SWT.NONE);
    holder.setLayout(GridLayoutFactory.fillDefaults().create());
    // Important: Field does rely on DynamicScrolledComposite to be the
    // parent of its parent,
    // because sadly layout(true, true) on the Shell does not seem to
    // propagate to this place.
    ScrolledComposite sc = new DynamicScrolledComposite(holder, SWT.V_SCROLL);
    sc.setExpandHorizontal(true);
    sc.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(300, 400).create());
    Group main = new Group(sc, SWT.NONE);
    sc.setContent(main);
    main.setLayout(GridLayoutFactory.swtDefaults().numColumns(1).margins(10, 5).create());
    // load from initial function
    DefaultCustomPropertyFunction cf = getWizard().getResultFunction();
    // set group title
    switch(ssid) {
        case SOURCE:
            main.setText("Input variables");
            sources = new CustomPropertyFunctionEntityList(null, null, main, cf.getSources());
            break;
        case TARGET:
            main.setText("Output");
            target = new BindingOrTypeEditor(main, SchemaSpaceID.TARGET);
            GridDataFactory.fillDefaults().grab(true, false).applyTo(target.getControl());
            if (cf.getTarget() != null) {
                BindingOrType bot = new BindingOrType();
                bot.setType(cf.getTarget().getBindingType());
                bot.setBinding(cf.getTarget().getBindingClass());
                bot.setUseBinding(cf.getTarget().getBindingType() == null);
                target.setValue(bot);
            }
            break;
    }
    return holder;
}
Also used : DynamicScrolledComposite(eu.esdihumboldt.hale.ui.util.components.DynamicScrolledComposite) Group(org.eclipse.swt.widgets.Group) DefaultCustomPropertyFunction(eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunction) DynamicScrolledComposite(eu.esdihumboldt.hale.ui.util.components.DynamicScrolledComposite) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) CustomPropertyFunctionEntityList(eu.esdihumboldt.hale.ui.functions.custom.pages.internal.CustomPropertyFunctionEntityList) DynamicScrolledComposite(eu.esdihumboldt.hale.ui.util.components.DynamicScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) BindingOrType(eu.esdihumboldt.hale.ui.functions.custom.pages.internal.BindingOrType) BindingOrTypeEditor(eu.esdihumboldt.hale.ui.functions.custom.pages.internal.BindingOrTypeEditor)

Aggregations

DefaultCustomPropertyFunction (eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunction)1 BindingOrType (eu.esdihumboldt.hale.ui.functions.custom.pages.internal.BindingOrType)1 BindingOrTypeEditor (eu.esdihumboldt.hale.ui.functions.custom.pages.internal.BindingOrTypeEditor)1 CustomPropertyFunctionEntityList (eu.esdihumboldt.hale.ui.functions.custom.pages.internal.CustomPropertyFunctionEntityList)1 DynamicScrolledComposite (eu.esdihumboldt.hale.ui.util.components.DynamicScrolledComposite)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 Composite (org.eclipse.swt.widgets.Composite)1 Group (org.eclipse.swt.widgets.Group)1