use of org.eclipse.swt.events.ExpandListener in project tdi-studio-se by Talend.
the class MultiSchemasUI method init.
public void init() {
uiParent.setLayout(new GridLayout());
Composite composite = new Composite(uiParent, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
composite.setLayout(new FillLayout());
ExpandBar bar = new ExpandBar(composite, SWT.V_SCROLL);
final Composite fileGroup = new Composite(bar, SWT.NONE);
createFileGroup(fileGroup);
final ExpandItem settingItem = new ExpandItem(bar, SWT.NONE, 0);
settingItem.setText(ExternalMultiSchemasUIProperties.SETTINGS_LABEL);
settingItem.setHeight(fileGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
settingItem.setControl(fileGroup);
settingItem.setExpanded(true);
allContentForm = new SashForm(bar, SWT.NONE);
createViewers(allContentForm);
final ExpandItem previewItem = new ExpandItem(bar, SWT.NONE, 1);
previewItem.setText(ExternalMultiSchemasUIProperties.PREVIEW_LABEL);
previewItem.setHeight(allContentForm.computeSize(SWT.DEFAULT, SWT.DEFAULT).y + 100);
previewItem.setControl(allContentForm);
previewItem.setExpanded(true);
bar.addExpandListener(new ExpandListener() {
public void itemExpanded(ExpandEvent e) {
if (e.item != null && e.item instanceof ExpandItem) {
if (((ExpandItem) e.item).getText().equals(ExternalMultiSchemasUIProperties.PREVIEW_LABEL)) {
if (settingItem.getExpanded()) {
previewItem.setHeight(allContentForm.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
} else {
previewItem.setHeight(allContentForm.computeSize(SWT.DEFAULT, SWT.DEFAULT).y + fileGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
}
} else if (((ExpandItem) e.item).getText().equals(ExternalMultiSchemasUIProperties.SETTINGS_LABEL)) {
settingItem.setHeight(fileGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
}
}
}
public void itemCollapsed(ExpandEvent e) {
if (e.item != null && e.item instanceof ExpandItem) {
if (((ExpandItem) e.item).getText().equals(ExternalMultiSchemasUIProperties.PREVIEW_LABEL)) {
// settingItem.setHeight(allContentForm.computeSize(SWT.DEFAULT, SWT.DEFAULT).y
// + fileGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
} else if (((ExpandItem) e.item).getText().equals(ExternalMultiSchemasUIProperties.SETTINGS_LABEL)) {
previewItem.setHeight(allContentForm.computeSize(SWT.DEFAULT, SWT.DEFAULT).y + fileGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
}
}
}
});
initFieldValues();
// listener
addFieldListeners();
addButtonListeners();
addFieldsListenersGroupFileSettings();
addFieldsListenersGroupsEscapeChar();
// preview
refreshPreview();
checkDialog();
// reload
reloadSchemaDataFromNode();
}
Aggregations