Search in sources :

Example 6 with SchemaSpaceID

use of eu.esdihumboldt.hale.common.schema.SchemaSpaceID in project hale by halestudio.

the class EntitiesPage 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(200, 200).create());
    Group main = new Group(sc, SWT.NONE);
    sc.setContent(main);
    main.setLayout(GridLayoutFactory.swtDefaults().numColumns(1).margins(10, 5).create());
    // set group title
    switch(ssid) {
        case SOURCE:
            main.setText("Source");
            break;
        case TARGET:
            main.setText("Target");
            break;
    }
    // determine fields
    T function = getWizard().getFunction();
    final Set<? extends D> fields;
    switch(ssid) {
        case SOURCE:
            fields = function.getSource();
            break;
        case TARGET:
            fields = function.getTarget();
            break;
        default:
            fields = new HashSet<D>();
    }
    // create fields
    for (D field : fields) {
        F functionField = createField(ssid, field, main);
        if (functionField != null) {
            functionFields.add(functionField);
            functionField.addObserver(fieldObserver);
        }
    }
    return holder;
}
Also used : DynamicScrolledComposite(eu.esdihumboldt.hale.ui.util.components.DynamicScrolledComposite) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) DynamicScrolledComposite(eu.esdihumboldt.hale.ui.util.components.DynamicScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) SWT(org.eclipse.swt.SWT) SchemaSpaceID(eu.esdihumboldt.hale.common.schema.SchemaSpaceID) DynamicScrolledComposite(eu.esdihumboldt.hale.ui.util.components.DynamicScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite)

Aggregations

SchemaSpaceID (eu.esdihumboldt.hale.common.schema.SchemaSpaceID)6 Composite (org.eclipse.swt.widgets.Composite)3 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)2 TypeEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition)2 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)2 ArrayList (java.util.ArrayList)2 Entry (com.google.common.collect.Multiset.Entry)1 PathElement (eu.esdihumboldt.hale.common.align.groovy.accessor.PathElement)1 ChildContext (eu.esdihumboldt.hale.common.align.model.ChildContext)1 PropertyEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.PropertyEntityDefinition)1 Filter (eu.esdihumboldt.hale.common.instance.model.Filter)1 DefinitionAccessor (eu.esdihumboldt.hale.common.schema.groovy.DefinitionAccessor)1 Definition (eu.esdihumboldt.hale.common.schema.model.Definition)1 PropertyDefinition (eu.esdihumboldt.hale.common.schema.model.PropertyDefinition)1 SchemaSpace (eu.esdihumboldt.hale.common.schema.model.SchemaSpace)1 XmlElement (eu.esdihumboldt.hale.io.xsd.model.XmlElement)1 XmlIndex (eu.esdihumboldt.hale.io.xsd.model.XmlIndex)1 AttributeEditorFactory (eu.esdihumboldt.hale.ui.common.definition.AttributeEditorFactory)1 DefinitionLabelFactory (eu.esdihumboldt.hale.ui.common.definition.DefinitionLabelFactory)1 SchemaService (eu.esdihumboldt.hale.ui.service.schema.SchemaService)1