use of org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData in project tdq-studio-se by Talend.
the class ColumnSetAnalysisResultPage method createSimpleTable2.
private void createSimpleTable2(final ScrolledForm form, final Composite composite, final SimpleStatIndicator simpleStatIndicator) {
List<IndicatorUnit> units = new ArrayList<IndicatorUnit>();
units.add(new ColumnSetIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, masterPage.getSimpleStatIndicator().getRowCountIndicator()));
units.add(new ColumnSetIndicatorUnit(IndicatorEnum.DistinctCountIndicatorEnum, masterPage.getSimpleStatIndicator().getDistinctCountIndicator()));
units.add(new ColumnSetIndicatorUnit(IndicatorEnum.DuplicateCountIndicatorEnum, masterPage.getSimpleStatIndicator().getDuplicateCountIndicator()));
units.add(new ColumnSetIndicatorUnit(IndicatorEnum.UniqueIndicatorEnum, masterPage.getSimpleStatIndicator().getUniqueCountIndicator()));
EIndicatorChartType simpleStatType = EIndicatorChartType.SIMPLE_STATISTICS;
// create table firstly
ITableTypeStates tableTypeState = TableTypeStatesFactory.getInstance().getTableState(simpleStatType, units);
TableWithData chartData = new TableWithData(simpleStatType, tableTypeState.getDataEntity());
TableViewer tableviewer = tableTypeState.getTableForm(composite);
tableviewer.setInput(chartData);
// MOD qiongli feature 19192.
DataExplorer dataExplorer = tableTypeState.getDataExplorer();
Analysis analysis = this.getAnalysisHandler().getAnalysis();
ChartTableFactory.addMenuAndTip(tableviewer, dataExplorer, analysis);
// create chart
if (canShowChartForResultPage()) {
IChartTypeStates chartTypeState = ChartTypeStatesFactory.getChartState(simpleStatType, units);
Object chart = chartTypeState.getChart();
TOPChartUtils.getInstance().decorateChart(chart, false);
if (chart != null) {
Object chartComposite2 = TOPChartUtils.getInstance().createChartComposite(composite, SWT.NONE, chart, true);
addMenuToChartComp(chartComposite2, dataExplorer, analysis, ((ICustomerDataset) chartTypeState.getDataset()).getDataEntities());
}
}
}
use of org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData in project tdq-studio-se by Talend.
the class CorrelationAnalysisResultPage method createSimpleStatistics2.
private void createSimpleStatistics2(final Composite composite, final ColumnSetMultiValueIndicator columnSetMultiValueIndicator) {
List<IndicatorUnit> units = new ArrayList<IndicatorUnit>();
units.add(new ColumnSetIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, columnSetMultiValueIndicator.getRowCountIndicator()));
units.add(new ColumnSetIndicatorUnit(IndicatorEnum.DistinctCountIndicatorEnum, columnSetMultiValueIndicator.getDistinctCountIndicator()));
units.add(new ColumnSetIndicatorUnit(IndicatorEnum.DuplicateCountIndicatorEnum, columnSetMultiValueIndicator.getDuplicateCountIndicator()));
units.add(new ColumnSetIndicatorUnit(IndicatorEnum.UniqueIndicatorEnum, columnSetMultiValueIndicator.getUniqueCountIndicator()));
EIndicatorChartType simpleStatType = EIndicatorChartType.SIMPLE_STATISTICS;
// create table viewer firstly
ITableTypeStates tableTypeState = TableTypeStatesFactory.getInstance().getTableState(simpleStatType, units);
TableWithData chartData = new TableWithData(simpleStatType, tableTypeState.getDataEntity());
TableViewer tableviewer = tableTypeState.getTableForm(composite);
tableviewer.setInput(chartData);
TableUtils.addTooltipForTable(tableviewer.getTable());
// create chart
if (canShowChartForResultPage()) {
// then create chart
IChartTypeStates chartTypeState = ChartTypeStatesFactory.getChartState(simpleStatType, units);
Object chart = chartTypeState.getChart();
TOPChartUtils.getInstance().decorateChart(chart, false);
if (chart != null) {
TOPChartUtils.getInstance().createChartComposite(composite, SWT.NONE, chart, true);
}
}
}
use of org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData 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);
}
use of org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData in project tdq-studio-se by Talend.
the class PatternDynamicChartEventReceiver method refreshPatternTable.
private void refreshPatternTable(PatternMatchingExt matchExt) {
TableWithData input = (TableWithData) tableViewer.getInput();
if (input != null) {
ChartDataEntity[] dataEntities = input.getEnity();
if (dataEntities != null && dataEntities.length > getIndexInDataset()) {
((PatternChartDataEntity) dataEntities[getIndexInDataset()]).setNumMatch(String.valueOf(matchExt.getMatchingValueCount()));
((PatternChartDataEntity) dataEntities[getIndexInDataset()]).setNumNoMatch(String.valueOf(matchExt.getNotMatchingValueCount()));
tableViewer.getTable().clearAll();
tableViewer.setInput(input);
}
}
}
use of org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData in project tdq-studio-se by Talend.
the class PatternDynamicChartEventReceiver method refreshTable.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver#refreshTable(java.lang.String)
*/
@Override
public void refreshTable(String value) {
TableWithData input = (TableWithData) tableViewer.getInput();
if (input != null) {
ChartDataEntity[] dataEntities = input.getEnity();
if (dataEntities != null && dataEntities.length > getIndexInDataset()) {
((PatternChartDataEntity) dataEntities[getIndexInDataset()]).setNumMatch(value);
((PatternChartDataEntity) dataEntities[getIndexInDataset()]).setNumNoMatch(value);
tableViewer.getTable().clearAll();
tableViewer.setInput(input);
}
}
}
Aggregations