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;
}
Aggregations