use of org.eclipse.ui.forms.events.ExpansionEvent in project eclipse.platform.ui by eclipse-platform.
the class FiltersConfigurationDialog method createFieldArea.
/**
* Create a field area in the form for the FilterConfigurationArea
*
* @param toolkit
* @param scrolledForm
* @param area
* @param expand
* <code>true</code> if the area should be expanded by default
*/
private void createFieldArea(final FormToolkit toolkit, final ScrolledForm scrolledForm, final FilterConfigurationArea area, boolean expand) {
final ExpandableComposite expandable = toolkit.createExpandableComposite(scrolledForm.getBody(), ExpandableComposite.TWISTIE);
expandable.setText(area.getTitle());
expandable.setBackground(scrolledForm.getBackground());
expandable.setLayout(new GridLayout());
expandable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, area.grabExcessVerticalSpace()));
expandable.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
scrolledForm.reflow(true);
}
});
Composite sectionClient = toolkit.createComposite(expandable);
GridLayout gridLayout = new GridLayout();
gridLayout.verticalSpacing = 3;
sectionClient.setLayout(gridLayout);
sectionClient.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
sectionClient.setBackground(scrolledForm.getBackground());
area.createContents(sectionClient);
expandable.setClient(sectionClient);
expandable.setExpanded(expand);
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project jbosstools-openshift by jbosstools.
the class BuildConfigWizardPage method doCreateControls.
@Override
protected void doCreateControls(Composite parent, DataBindingContext dbc) {
GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(parent);
GridLayoutFactory.fillDefaults().applyTo(parent);
Group buildConfigsGroup = new Group(parent, SWT.NONE);
buildConfigsGroup.setText("Existing Build Configs:");
GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).applyTo(buildConfigsGroup);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(buildConfigsGroup);
// build configs tree
TreeViewer buildConfigsViewer = createBuildConfigsViewer(new Tree(buildConfigsGroup, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL), model);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).hint(SWT.DEFAULT, 200).span(1, 2).applyTo(buildConfigsViewer.getControl());
final IObservableValue selectedItem = BeanProperties.value(IBuildConfigPageModel.PROPERTY_SELECTED_ITEM).observe(model);
Binding selectedBuildConfigBinding = ValueBindingBuilder.bind(ViewerProperties.singleSelection().observe(buildConfigsViewer)).converting(new ObservableTreeItem2ModelConverter()).to(selectedItem).converting(new Model2ObservableTreeItemConverter()).in(dbc);
dbc.addValidationStatusProvider(new MultiValidator() {
@Override
protected IStatus validate() {
if (!(selectedItem.getValue() instanceof IBuildConfig)) {
return ValidationStatus.cancel("Please select the existing build config that you want to import");
} else {
return ValidationStatus.ok();
}
}
});
IObservableValue connectionObservable = BeanProperties.value(IBuildConfigPageModel.PROPERTY_CONNECTION).observe(model);
DataBindingUtils.addDisposableValueChangeListener(onConnectionChanged(buildConfigsViewer, model), connectionObservable, buildConfigsViewer.getTree());
ControlDecorationSupport.create(selectedBuildConfigBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater(true));
// refresh button
Button refreshButton = new Button(buildConfigsGroup, SWT.PUSH);
refreshButton.setText("&Refresh");
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(100, SWT.DEFAULT).applyTo(refreshButton);
refreshButton.addSelectionListener(onRefresh(buildConfigsViewer, model));
// filler
Label fillerLabel = new Label(buildConfigsGroup, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, true).applyTo(fillerLabel);
// details
ExpandableComposite expandable = new ExpandableComposite(buildConfigsGroup, SWT.None);
GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, false).hint(SWT.DEFAULT, 150).applyTo(expandable);
expandable.setText("Build config Details");
expandable.setExpanded(true);
GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).spacing(0, 0).applyTo(expandable);
GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, false).hint(SWT.DEFAULT, 150).applyTo(expandable);
Composite detailsContainer = new Composite(expandable, SWT.NONE);
GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, false).hint(SWT.DEFAULT, 150).applyTo(detailsContainer);
IObservableValue selectedService = new WritableValue();
ValueBindingBuilder.bind(selectedItem).to(selectedService).notUpdatingParticipant().in(dbc);
new BuildConfigDetailViews(selectedService, detailsContainer, dbc).createControls();
expandable.setClient(detailsContainer);
expandable.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
buildConfigsGroup.update();
buildConfigsGroup.layout(true);
}
});
loadBuildConfigs(model);
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project knime-workbench by knime.
the class PreferredRendererPreferencePage method createFieldEditors.
/**
* {@inheritDoc}
*/
@Override
protected void createFieldEditors() {
Map<String, List<ExtensibleUtilityFactory>> groupedUtilityFactories = new HashMap<String, List<ExtensibleUtilityFactory>>();
// TODO retrieve the utility factories from the data type extension point once we have it
for (ExtensibleUtilityFactory fac : ExtensibleUtilityFactory.getAllFactories()) {
List<ExtensibleUtilityFactory> groupList = groupedUtilityFactories.get(fac.getGroupName());
if (groupList == null) {
groupList = new ArrayList<ExtensibleUtilityFactory>(16);
groupedUtilityFactories.put(fac.getGroupName(), groupList);
}
groupList.add(fac);
}
List<String> groupNames = new ArrayList<String>(groupedUtilityFactories.keySet());
Collections.sort(groupNames);
for (String group : groupNames) {
final Section sectionExpander = new Section(getFieldEditorParent(), ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
sectionExpander.setText(group);
final Composite section = new Composite(sectionExpander, SWT.NONE);
sectionExpander.setClient(section);
sectionExpander.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(final ExpansionEvent e) {
Composite comp = section;
while (!(comp instanceof ScrolledComposite)) {
comp = comp.getParent();
}
// this is to fix a bug in Eclipse, no scrollbar is shown when this is true
((ScrolledComposite) comp).setExpandVertical(false);
comp = section;
while (!(comp instanceof ScrolledComposite)) {
comp.setSize(comp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
comp.layout();
comp = comp.getParent();
}
}
});
List<ExtensibleUtilityFactory> utilityFactories = groupedUtilityFactories.get(group);
Collections.sort(utilityFactories, utilityFactoryComparator);
for (ExtensibleUtilityFactory utilFac : utilityFactories) {
List<DataValueRendererFactory> rendererFactories = new ArrayList<DataValueRendererFactory>(utilFac.getAvailableRenderers());
Collections.sort(rendererFactories, rendererFactoryComparator);
String[][] comboEntries = new String[utilFac.getAvailableRenderers().size()][2];
int i = 0;
for (DataValueRendererFactory rendFac : rendererFactories) {
comboEntries[i++] = new String[] { rendFac.getDescription(), rendFac.getId() };
}
ComboFieldEditor c = new ComboFieldEditor(utilFac.getPreferenceKey(), utilFac.getName(), comboEntries, section);
c.setEnabled(comboEntries.length > 1, section);
addField(c);
m_fieldEditors.put(utilFac.getPreferenceKey(), c);
}
// add a dummy control which occupies the second column so that the next expander is in a new row
new Label(getFieldEditorParent(), SWT.NONE);
}
DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(DataValueRendererFactory.class).getSymbolicName()).addPreferenceChangeListener(this);
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project tdq-studio-se by Talend.
the class CorrelationAnalysisDetailsPage method createPreviewCharts.
public void createPreviewCharts(final ScrolledForm form, final Composite composite, final boolean isCreate) {
List<Composite> previewChartList = new ArrayList<Composite>();
if (ColumnsetPackage.eINSTANCE.getWeakCorrelationIndicator() == columnSetMultiIndicator.eClass()) {
GraphBuilder gBuilder = new GraphBuilder();
gBuilder.setTotalWeight(columnSetMultiIndicator.getCount());
List<Object[]> listRows = columnSetMultiIndicator.getListRows();
// MOD msjian TDQ-4781 2012-6-8: make sure exist data
if (listRows != null && listRows.size() > 0) {
// TDQ-4781~
JungGraphGenerator generator = new JungGraphGenerator(gBuilder, listRows);
// MOD yyi 2009-09-09 feature 8834
generator.generate(composite, false, true);
}
} else {
List<ModelElement> numericOrDateList = new ArrayList<ModelElement>();
if (ColumnsetPackage.eINSTANCE.getCountAvgNullIndicator() == columnSetMultiIndicator.eClass()) {
numericOrDateList = columnSetMultiIndicator.getNumericColumns();
}
if (ColumnsetPackage.eINSTANCE.getMinMaxDateIndicator() == columnSetMultiIndicator.eClass()) {
numericOrDateList = columnSetMultiIndicator.getDateColumns();
}
for (ModelElement column : numericOrDateList) {
final MetadataColumn tdColumn = (MetadataColumn) column;
ExpandableComposite exComp = toolkit.createExpandableComposite(composite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
// $NON-NLS-1$
exComp.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.column", tdColumn.getName()));
exComp.setLayout(new GridLayout());
exComp.setData(columnSetMultiIndicator);
previewChartList.add(exComp);
final Composite comp = toolkit.createComposite(exComp);
comp.setLayout(new GridLayout());
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
if (tdColumn != null) {
IRunnableWithProgress rwp = new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask(// $NON-NLS-1$
DefaultMessagesImpl.getString(// $NON-NLS-1$
"ColumnMasterDetailsPage.createPreview", tdColumn.getName()), IProgressMonitor.UNKNOWN);
Display.getDefault().asyncExec(new Runnable() {
public void run() {
new HideSeriesChartComposite(comp, getCurrentModelElement(), columnSetMultiIndicator, tdColumn, false);
}
});
monitor.done();
}
};
try {
new ProgressMonitorDialog(getSite().getShell()).run(true, false, rwp);
} catch (Exception ex) {
log.error(ex, ex);
}
}
exComp.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
getChartComposite().layout();
form.reflow(true);
}
});
exComp.setExpanded(true);
exComp.setClient(comp);
}
}
if (!previewChartList.isEmpty()) {
this.previewChartCompsites = previewChartList.toArray(new Composite[previewChartList.size()]);
}
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project tdq-studio-se by Talend.
the class BusinessRuleAnalysisDetailsPage method createPreviewCharts.
@Override
public void createPreviewCharts(final ScrolledForm form1, final Composite composite) {
previewChartList = new ArrayList<ExpandableComposite>();
dynamicList.clear();
for (final TableIndicator tableIndicator : this.treeViewer.getTableIndicator()) {
final NamedColumnSet set = tableIndicator.getColumnSet();
ExpandableComposite exComp = toolkit.createExpandableComposite(composite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
// bug 10541 modify by zshen,Change some character set to be proper to add view in the table anasys
if (tableIndicator.isTable()) {
// $NON-NLS-1$
exComp.setText(DefaultMessagesImpl.getString("TableMasterDetailsPage.table") + set.getName());
} else {
// $NON-NLS-1$
exComp.setText(DefaultMessagesImpl.getString("TableMasterDetailsPage.view") + set.getName());
}
exComp.setLayout(new GridLayout());
exComp.setLayoutData(new GridData(GridData.FILL_BOTH));
exComp.setData(tableIndicator);
previewChartList.add(exComp);
final Composite comp = toolkit.createComposite(exComp);
comp.setLayout(new GridLayout());
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
exComp.setExpanded(true);
exComp.setClient(comp);
if (tableIndicator.getIndicators().length != 0) {
IRunnableWithProgress rwp = new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask(// $NON-NLS-1$
DefaultMessagesImpl.getString("TableMasterDetailsPage.createPreview") + set.getName(), IProgressMonitor.UNKNOWN);
Display.getDefault().syncExec(new Runnable() {
public void run() {
Map<EIndicatorChartType, List<TableIndicatorUnit>> indicatorComposite = CompositeIndicator.getInstance().getTableIndicatorComposite(tableIndicator);
for (EIndicatorChartType chartType : indicatorComposite.keySet()) {
List<TableIndicatorUnit> units = indicatorComposite.get(chartType);
if (!units.isEmpty()) {
final IChartTypeStates chartTypeState = ChartTypeStatesFactory.getChartStateOfTableAna(chartType, units, tableIndicator);
// get all indicator lists separated by chart, and only
// WhereRuleStatisticsStateTable can get not-null charts
List<List<Indicator>> pagedIndicators = ((WhereRuleStatisticsStateTable) chartTypeState).getPagedIndicators();
// Added TDQ-9241: for each list(for each chart), check if the current
// list has been registered dynamic event
List<Object> datasets = new ArrayList<Object>();
for (List<Indicator> oneChart : pagedIndicators) {
IEventReceiver event = EventManager.getInstance().findRegisteredEvent(oneChart.get(0), EventEnum.DQ_DYMANIC_CHART, 0);
if (event != null) {
// get the dataset from the event
Object dataset = ((TableDynamicChartEventReceiver) event).getDataset();
// one running)
if (dataset != null) {
datasets.add(dataset);
}
}
// ~
}
// create chart
List<Object> charts = null;
if (datasets.size() > 0) {
charts = chartTypeState.getChartList(datasets);
} else {
charts = chartTypeState.getChartList();
}
int index = 0;
if (charts != null) {
for (Object chart : charts) {
Object chartComp = TOPChartUtils.getInstance().createChartComposite(comp, SWT.NONE, chart, true);
// Added TDQ-8787 20140707 yyin: create and store the dynamic model
DynamicIndicatorModel dyModel = AnalysisUtils.createDynamicModel(chartType, pagedIndicators.get(index++), chart);
dynamicList.add(dyModel);
// ~
TOPChartUtils.getInstance().addListenerToChartComp(chartComp, chartTypeState.getReferenceLink(), // $NON-NLS-1$
DefaultMessagesImpl.getString("TableMasterDetailsPage.what"));
}
}
}
}
}
});
monitor.done();
}
};
try {
new ProgressMonitorDialog(getSite().getShell()).run(true, false, rwp);
} catch (Exception ex) {
log.error(ex, ex);
}
}
exComp.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
getChartComposite().layout();
form1.reflow(true);
composite.pack();
}
});
getChartComposite().layout();
form1.reflow(true);
composite.pack();
}
if (!previewChartList.isEmpty()) {
this.previewChartCompsites = previewChartList.toArray(new Composite[previewChartList.size()]);
}
}
Aggregations