use of org.eclipse.ui.forms.events.ExpansionEvent in project egit by eclipse.
the class SimpleConfigurePushDialog method createAdditionalUriArea.
@Override
protected Control createAdditionalUriArea(Composite parent) {
ExpandableComposite pushUriArea = new ExpandableComposite(parent, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
GridDataFactory.fillDefaults().grab(true, false).applyTo(pushUriArea);
pushUriArea.setExpanded(!getConfig().getPushURIs().isEmpty());
pushUriArea.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
parent.layout(true, true);
parent.getShell().pack();
}
});
pushUriArea.setText(UIText.SimpleConfigurePushDialog_PushUrisLabel);
final Composite pushUriDetails = new Composite(pushUriArea, SWT.NONE);
pushUriArea.setClient(pushUriDetails);
pushUriDetails.setLayout(new GridLayout(2, false));
GridDataFactory.fillDefaults().grab(true, true).applyTo(pushUriDetails);
uriViewer = new TableViewer(pushUriDetails, SWT.BORDER | SWT.MULTI);
GridDataFactory.fillDefaults().grab(true, true).minSize(SWT.DEFAULT, 30).applyTo(uriViewer.getTable());
uriViewer.setContentProvider(ArrayContentProvider.getInstance());
final Composite uriButtonArea = new Composite(pushUriDetails, SWT.NONE);
GridLayoutFactory.fillDefaults().applyTo(uriButtonArea);
GridDataFactory.fillDefaults().grab(false, true).applyTo(uriButtonArea);
Button addUri = new Button(uriButtonArea, SWT.PUSH);
addUri.setText(UIText.SimpleConfigurePushDialog_AddPushUriButton);
GridDataFactory.fillDefaults().applyTo(addUri);
addUri.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SelectUriWizard wiz = new SelectUriWizard(false);
if (new WizardDialog(getShell(), wiz).open() == Window.OK) {
getConfig().addPushURI(wiz.getUri());
updateControls();
}
}
});
final Button changeUri = new Button(uriButtonArea, SWT.PUSH);
changeUri.setText(UIText.SimpleConfigurePushDialog_ChangePushUriButton);
GridDataFactory.fillDefaults().applyTo(changeUri);
changeUri.setEnabled(false);
changeUri.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
URIish uri = (URIish) ((IStructuredSelection) uriViewer.getSelection()).getFirstElement();
SelectUriWizard wiz = new SelectUriWizard(false, uri.toPrivateString());
if (new WizardDialog(getShell(), wiz).open() == Window.OK) {
getConfig().removePushURI(uri);
getConfig().addPushURI(wiz.getUri());
updateControls();
}
}
});
final Button deleteUri = new Button(uriButtonArea, SWT.PUSH);
deleteUri.setText(UIText.SimpleConfigurePushDialog_DeletePushUriButton);
GridDataFactory.fillDefaults().applyTo(deleteUri);
deleteUri.setEnabled(false);
deleteUri.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
URIish uri = (URIish) ((IStructuredSelection) uriViewer.getSelection()).getFirstElement();
getConfig().removePushURI(uri);
updateControls();
}
});
uriViewer.addSelectionChangedListener(event -> {
deleteUri.setEnabled(!uriViewer.getSelection().isEmpty());
changeUri.setEnabled(((IStructuredSelection) uriViewer.getSelection()).size() == 1);
});
return pushUriArea;
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project tdq-studio-se by Talend.
the class CorrelationAnalysisResultPage method createBubbleOrGanttChart.
private void createBubbleOrGanttChart(final ScrolledForm sForm, final Composite composite, final ColumnSetMultiValueIndicator columnSetMultiValueIndicator) {
List<Composite> previewChartList = new ArrayList<Composite>();
List<ModelElement> bubOrGanttColumnList = new ArrayList<ModelElement>();
if (columnSetMultiValueIndicator instanceof CountAvgNullIndicator) {
bubOrGanttColumnList = columnSetMultiValueIndicator.getNumericColumns();
} else {
bubOrGanttColumnList = columnSetMultiValueIndicator.getDateColumns();
}
for (ModelElement column : bubOrGanttColumnList) {
final MetadataColumn tdColumn = (MetadataColumn) column;
final 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(columnSetMultiValueIndicator);
previewChartList.add(exComp);
final Composite comp = toolkit.createComposite(exComp);
comp.setLayout(new GridLayout(2, false));
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(DefaultMessagesImpl.getString("ColumnCorrelationNominalIntervalResultPage.CreatePreview", tdColumn.getName()), // $NON-NLS-1$
IProgressMonitor.UNKNOWN);
Display.getDefault().asyncExec(new Runnable() {
public void run() {
HideSeriesChartComposite hcc = new HideSeriesChartComposite(comp, getAnalysisHandler().getAnalysis(), columnSetMultiValueIndicator, tdColumn, true);
GridData gd = new GridData();
gd.widthHint = 800;
gd.heightHint = 450;
hcc.setLayoutData(gd);
}
});
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();
sForm.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 MasterPaginationInfo method render.
@Override
protected void render() {
// refresh analysis tree
if (treeViewer != null) {
treeViewer.setElements(modelElementIndicators.toArray(new ModelElementIndicator[modelElementIndicators.size()]), false);
}
// chart composite don't display So need't consider it.
if (previewChartList == null || uiPagination.getChartComposite() == null) {
return;
}
previewChartList.clear();
clearDynamicList();
if (EditorPreferencePage.isHideGraphicsSectionForSettingsPage() || !TOPChartUtils.getInstance().isTOPChartInstalled()) {
return;
}
for (ModelElementIndicator modelElementIndicator : modelElementIndicators) {
final ExpandableComposite exComp = uiPagination.getToolkit().createExpandableComposite(uiPagination.getChartComposite(), ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
needDispostWidgets.add(exComp);
exComp.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.column", // $NON-NLS-1$
modelElementIndicator.getElementName()));
exComp.setLayout(new GridLayout());
exComp.setData(modelElementIndicator);
previewChartList.add(exComp);
Composite comp = uiPagination.getToolkit().createComposite(exComp);
comp.setLayout(new GridLayout());
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
Map<EIndicatorChartType, List<IndicatorUnit>> indicatorComposite = CompositeIndicator.getInstance().getIndicatorComposite(modelElementIndicator);
for (EIndicatorChartType chartType : indicatorComposite.keySet()) {
List<IndicatorUnit> units = indicatorComposite.get(chartType);
if (!units.isEmpty()) {
if (chartType == EIndicatorChartType.UDI_FREQUENCY) {
for (IndicatorUnit unit : units) {
List<IndicatorUnit> specialUnit = new ArrayList<IndicatorUnit>();
specialUnit.add(unit);
createChart(comp, chartType, specialUnit);
}
} else {
createChart(comp, chartType, units);
}
}
}
exComp.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
uiPagination.getChartComposite().layout();
form.reflow(true);
if (e.getState()) {
exComp.setExpanded(e.getState());
exComp.getParent().pack();
}
}
});
exComp.setExpanded(true);
exComp.setClient(comp);
uiPagination.getChartComposite().layout();
}
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project tdq-studio-se by Talend.
the class ResultPaginationInfo method render.
@Override
protected void render() {
clearDynamicList();
allExpandableCompositeList.clear();
columnCompositeMap.clear();
for (ModelElementIndicator modelElementIndicator : modelElementIndicators) {
ExpandableComposite exComp = uiPagination.getToolkit().createExpandableComposite(uiPagination.getChartComposite(), ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.EXPANDED | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT);
needDispostWidgets.add(exComp);
allExpandableCompositeList.add(exComp);
// MOD klliu add more information about the column belongs to which table/view.
IRepositoryNode modelElementRepositoryNode = modelElementIndicator.getModelElementRepositoryNode();
IRepositoryNode parentNodeForColumnNode = RepositoryNodeHelper.getParentNodeForColumnNode(modelElementRepositoryNode);
String label = parentNodeForColumnNode.getObject().getLabel();
if (label != null && !label.equals("")) {
// $NON-NLS-1$
// $NON-NLS-1$
label = label.concat(".").concat(modelElementIndicator.getElementName());
} else {
label = modelElementIndicator.getElementName();
}
// ~
// $NON-NLS-1$
exComp.setText(DefaultMessagesImpl.getString("ColumnAnalysisResultPage.Column", label));
exComp.setLayout(new GridLayout());
exComp.setLayoutData(new GridData(GridData.FILL_BOTH));
// MOD xqliu 2009-06-23 bug 7481
exComp.setExpanded(EditorPreferencePage.isUnfoldingAnalyzedEelementsResultPage());
// ~
// TDQ-11525 msjian : Add "expand all" and "fold all" icon buttons in the "Analysis Results" section
Composite collapseExpandComposite = uiPagination.getToolkit().createComposite(exComp);
GridLayout gdLayout = new GridLayout();
gdLayout.numColumns = 2;
collapseExpandComposite.setLayout(gdLayout);
createCollapseAllLink(collapseExpandComposite, label);
createExpandAllLink(collapseExpandComposite, label);
exComp.setTextClient(collapseExpandComposite);
// TDQ-11525~
Composite comp = uiPagination.getToolkit().createComposite(exComp);
comp.setLayout(new GridLayout());
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
exComp.setClient(comp);
createResultDataComposite(comp, modelElementIndicator);
columnCompositeMap.put(label, comp);
exComp.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
uiPagination.getChartComposite().layout();
form.reflow(true);
}
});
uiPagination.getChartComposite().layout();
masterPage.registerSection(exComp);
}
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project tdq-studio-se by Talend.
the class ResultPaginationInfo method createChart.
/**
* DOC bZhou Comment method "createChart".
*
* @param comp
* @param chartType
* @param units
*/
private void createChart(Composite comp, EIndicatorChartType chartType, List<IndicatorUnit> units) {
DynamicIndicatorModel dyModel = new DynamicIndicatorModel();
// MOD TDQ-8787 20140618 yyin: to let the chart and table use the same dataset
Object chart = null;
Object dataset = null;
// Added TDQ-8787 20140722 yyin:(when first switch from master to result) if there is some dynamic event for the
// current indicator, use its dataset directly (TDQ-9241)
IEventReceiver event = EventManager.getInstance().findRegisteredEvent(units.get(0).getIndicator(), EventEnum.DQ_DYMANIC_CHART, 0);
// get the dataset from the event
if (event != null) {
dataset = ((DynamicChartEventReceiver) event).getDataset();
}
// ~
// Added TDQ-8787 2014-06-18 yyin: add the current units and dataset into the list
List<Indicator> indicators = null;
dyModel.setChartType(chartType);
this.dynamicList.add(dyModel);
if (EIndicatorChartType.SUMMARY_STATISTICS.equals(chartType)) {
// for the summary indicators, the table show 2 more than the bar chart
dyModel.setSummaryIndicators(getIndicatorsForTable(units, true));
}
// create UI
ExpandableComposite subComp = uiPagination.getToolkit().createExpandableComposite(comp, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.EXPANDED);
subComp.setText(chartType.getLiteral());
subComp.setLayoutData(new GridData(GridData.FILL_BOTH));
// MOD xqliu 2009-06-23 bug 7481
subComp.setExpanded(EditorPreferencePage.isUnfoldingIndicatorsResultPage());
// ~
final Composite composite = uiPagination.getToolkit().createComposite(subComp, SWT.NULL);
composite.setLayout(new GridLayout(2, false));
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
Analysis analysis = masterPage.getAnalysisHandler().getAnalysis();
// create table viewer firstly
ITableTypeStates tableTypeState = TableTypeStatesFactory.getInstance().getTableState(chartType, units);
ChartDataEntity[] dataEntities = tableTypeState.getDataEntity();
TableWithData chartData = new TableWithData(chartType, dataEntities);
TableViewer tableviewer = tableTypeState.getTableForm(composite);
tableviewer.setInput(chartData);
tableviewer.getTable().pack();
dyModel.setTableViewer(tableviewer);
DataExplorer dataExplorer = tableTypeState.getDataExplorer();
ChartTableFactory.addMenuAndTip(tableviewer, dataExplorer, analysis);
if (EIndicatorChartType.TEXT_STATISTICS.equals(chartType) && dataEntities != null && dataEntities.length > 0) {
// only text indicator need
indicators = getIndicators(dataEntities);
} else {
indicators = getIndicators(units);
}
dyModel.setIndicatorList(indicators);
// create chart
try {
if (!EditorPreferencePage.isHideGraphicsForResultPage() && TOPChartUtils.getInstance().isTOPChartInstalled()) {
IChartTypeStates chartTypeState = ChartTypeStatesFactory.getChartState(chartType, units);
boolean isPattern = chartTypeState instanceof PatternStatisticsState;
if (event == null) {
chart = chartTypeState.getChart();
if (chart != null && isSQLMode) {
// chart is null for MODE. Get the dataset by this way for SQL mode
if (EIndicatorChartType.BENFORD_LAW_STATISTICS.equals(chartType)) {
dataset = TOPChartUtils.getInstance().getDatasetFromChart(chart, 2);
if (dataset == null) {
dataset = TOPChartUtils.getInstance().getDatasetFromChart(chart, 1);
}
dyModel.setSecondDataset(TOPChartUtils.getInstance().getDatasetFromChart(chart, 0));
} else {
dataset = TOPChartUtils.getInstance().getDatasetFromChart(chart, 1);
if (dataset == null) {
dataset = TOPChartUtils.getInstance().getDatasetFromChart(chart, -1);
}
}
}
} else {
chart = chartTypeState.getChart(dataset);
}
dyModel.setDataset(dataset);
if (chart != null) {
if (!isPattern) {
// need not to decorate the chart of Pattern(Regex/Sql/UdiMatch)
TOPChartUtils.getInstance().decorateChart(chart, false);
} else {
TOPChartUtils.getInstance().decoratePatternMatching(chart);
}
Object chartComposite = TOPChartUtils.getInstance().createTalendChartComposite(composite, SWT.NONE, chart, true);
dyModel.setBawParentChartComp(chartComposite);
Map<String, Object> menuMap = createMenuForAllDataEntity((Composite) chartComposite, dataExplorer, analysis, ((ICustomerDataset) chartTypeState.getDataset()).getDataEntities());
// call chart service to create related mouse listener
if (EIndicatorChartType.BENFORD_LAW_STATISTICS.equals(chartType) || EIndicatorChartType.FREQUENCE_STATISTICS.equals(chartType)) {
TOPChartUtils.getInstance().addMouseListenerForChart(chartComposite, menuMap, false);
} else {
TOPChartUtils.getInstance().addMouseListenerForChart(chartComposite, menuMap, true);
}
}
}
// TDQ-11886 add these 2 catches.make it continue to work even if encounter some problems.
} catch (Error e) {
// $NON-NLS-1$
log.error(DefaultMessagesImpl.getString("IndicatorPaginationInfo.FailToCreateChart"), e);
} catch (Exception exp) {
// $NON-NLS-1$
log.error(DefaultMessagesImpl.getString("IndicatorPaginationInfo.FailToCreateChart"), exp);
}
subComp.setClient(composite);
subComp.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
form.reflow(true);
}
});
masterPage.registerSection(subComp);
}
Aggregations