Search in sources :

Example 1 with ITableTypeStates

use of org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates 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());
        }
    }
}
Also used : ITableTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates) Analysis(org.talend.dataquality.analysis.Analysis) DataExplorer(org.talend.dq.analysis.explore.DataExplorer) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ColumnSetIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit) ArrayList(java.util.ArrayList) EIndicatorChartType(org.talend.dq.indicators.preview.EIndicatorChartType) TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) TableViewer(org.eclipse.jface.viewers.TableViewer) ColumnSetIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit) IChartTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates)

Example 2 with ITableTypeStates

use of org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates 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);
        }
    }
}
Also used : ITableTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ColumnSetIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit) ArrayList(java.util.ArrayList) EIndicatorChartType(org.talend.dq.indicators.preview.EIndicatorChartType) TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) TableViewer(org.eclipse.jface.viewers.TableViewer) ColumnSetIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit) IChartTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates)

Example 3 with ITableTypeStates

use of org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates 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);
}
Also used : IEventReceiver(org.talend.dataprofiler.core.ui.events.IEventReceiver) DataExplorer(org.talend.dq.analysis.explore.DataExplorer) TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) GridLayout(org.eclipse.swt.layout.GridLayout) DynamicIndicatorModel(org.talend.dataprofiler.core.model.dynamic.DynamicIndicatorModel) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) Indicator(org.talend.dataquality.indicators.Indicator) CompositeIndicator(org.talend.dataprofiler.core.ui.editor.preview.CompositeIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) IChartTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates) ITableTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates) Analysis(org.talend.dataquality.analysis.Analysis) GridData(org.eclipse.swt.layout.GridData) PatternStatisticsState(org.talend.dataprofiler.core.ui.editor.preview.model.states.pattern.PatternStatisticsState) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) TableViewer(org.eclipse.jface.viewers.TableViewer) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Example 4 with ITableTypeStates

use of org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates in project tdq-studio-se by Talend.

the class BusinessRuleAnalysisResultPage method createResultDataComposite.

private void createResultDataComposite(final Composite comp, final TableIndicator tableIndicator) {
    if (tableIndicator.getIndicators().length != 0) {
        final NamedColumnSet set = tableIndicator.getColumnSet();
        IRunnableWithProgress rwp = new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask(DefaultMessagesImpl.getString("TableAnalysisResultPage.createPreview", set.getName()), // $NON-NLS-1$
                IProgressMonitor.UNKNOWN);
                Display.getDefault().asyncExec(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()) {
                                // create UI
                                ExpandableComposite subComp = createSubWholeComposite(comp, chartType);
                                final Composite composite = createCompositeForTableAndChart(subComp);
                                Composite tableTopComp = createTableComposite(composite);
                                Analysis analysis = masterPage.getAnalysisHandler().getAnalysis();
                                ITableTypeStates tableTypeState = TableTypeStatesFactory.getInstance().getTableStateForRule(chartType, units, tableIndicator);
                                // create table for RownCountIndicator
                                createTableViewerForRowCount(chartType, units, tableTopComp, analysis, tableTypeState);
                                // create table for WhereRuleIndicator
                                createTableForWhereRule(chartType, tableTopComp, analysis, tableTypeState, units);
                                Composite chartTopComp = createTableComposite(composite);
                                if (canShowChartForResultPage()) {
                                    createChartsForRules(tableIndicator, chartType, units, analysis, chartTopComp);
                                }
                                subComp.setClient(composite);
                                subComp.addExpansionListener(new ExpansionAdapter() {

                                    @Override
                                    public void expansionStateChanged(ExpansionEvent e) {
                                        form.reflow(true);
                                    }
                                });
                            }
                        }
                    }

                    /**
                     * DOC yyin Comment method "createChartsForRules".
                     *
                     * @param tableIndicator
                     * @param chartType
                     * @param units
                     * @param analysis
                     * @param chartTopComp
                     */
                    private void createChartsForRules(final TableIndicator tableIndicator, EIndicatorChartType chartType, List<TableIndicatorUnit> units, Analysis analysis, Composite chartTopComp) {
                        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();
                            datasets = ((WhereRuleStatisticsStateTable) chartTypeState).getTempDatasetList();
                        }
                        if (charts != null) {
                            int index = 0;
                            for (int i = 0; i < charts.size(); i++) {
                                Object chart2 = charts.get(i);
                                Object chartComp = TOPChartUtils.getInstance().createChartCompositeWithSpecialSize(chartTopComp, SWT.NONE, chart2, true, 250, 550);
                                // Added TDQ-8787 20140707 yyin: create and store the dynamic model for
                                // each chart
                                DynamicIndicatorModel dyModel = AnalysisUtils.createDynamicModel(chartType, pagedIndicators.get(index++), chart2);
                                dynamicList.add(dyModel);
                                // ~
                                // one dataset <--> one chart
                                addMenuToChartComp(chartComp, chartTypeState.getDataExplorer(), analysis, ((ICustomerDataset) datasets.get(i)).getDataEntities());
                            }
                        }
                    }

                    /**
                     * DOC yyin Comment method "createTableForWhereRule".
                     *
                     * @param chartType
                     * @param tableTopComp
                     * @param analysis
                     * @param tableTypeState
                     * @param units
                     * @return
                     */
                    private void createTableForWhereRule(EIndicatorChartType chartType, Composite tableTopComp, Analysis analysis, ITableTypeStates tableTypeState, List<TableIndicatorUnit> units) {
                        TableWithData chartData = new TableWithData(chartType, tableTypeState.getDataEntity());
                        TableViewer tableviewer = tableTypeState.getTableForm(tableTopComp);
                        tableviewer.setInput(chartData);
                        ChartTableFactory.addMenuAndTip(tableviewer, tableTypeState.getDataExplorer(), analysis);
                        // Added TDQ-8787 20140707 yyin: create and store the dynamic model
                        List<Indicator> allRules = new ArrayList<Indicator>();
                        List<TableIndicatorUnit> removeRowCountUnit = ((WhereRuleStatisticsTableState) tableTypeState).removeRowCountUnit(units);
                        for (TableIndicatorUnit indUnit : removeRowCountUnit) {
                            allRules.add(indUnit.getIndicator());
                        }
                        DynamicIndicatorModel dyModel = AnalysisUtils.createDynamicModel(chartType, allRules, null);
                        dyModel.setTableViewer(tableviewer);
                        dynamicList.add(dyModel);
                    }

                    /**
                     * DOC yyin Comment method "createTableViewerForRowCount".
                     *
                     * @param chartType
                     * @param units
                     * @param tableTopComp
                     * @param analysis
                     * @param tableTypeState
                     */
                    private void createTableViewerForRowCount(EIndicatorChartType chartType, List<TableIndicatorUnit> units, Composite tableTopComp, Analysis analysis, ITableTypeStates tableTypeState) {
                        WhereRuleStatisticsTableState tableWhereRule = (WhereRuleStatisticsTableState) tableTypeState;
                        TableWithData chartDataRowCount = new TableWithData(chartType, tableWhereRule.getDataEntityOfRowCount());
                        TableViewer tableviewerRowCount = tableWhereRule.getTableFormRowCount(tableTopComp);
                        tableviewerRowCount.setInput(chartDataRowCount);
                        ChartTableFactory.addMenuAndTip(tableviewerRowCount, tableTypeState.getDataExplorer(), analysis);
                        // Added TDQ-8787 20140707 yyin: create and store the dynamic model for row
                        // count's table
                        List<Indicator> rowCount = new ArrayList<Indicator>();
                        rowCount.add(tableWhereRule.getRownCountUnit(units).getIndicator());
                        DynamicIndicatorModel dyModel = AnalysisUtils.createDynamicModel(chartType, rowCount, null);
                        dyModel.setTableViewer(tableviewerRowCount);
                        dynamicList.add(dyModel);
                    }

                    /**
                     * DOC yyin Comment method "createTableComposite".
                     *
                     * @param composite
                     * @return
                     */
                    private Composite createTableComposite(final Composite composite) {
                        Composite tableTopComp = toolkit.createComposite(composite, SWT.NULL);
                        tableTopComp.setLayout(new GridLayout(1, false));
                        tableTopComp.setLayoutData(new GridData(GridData.FILL_BOTH));
                        return tableTopComp;
                    }

                    /**
                     * DOC yyin Comment method "createCompositeForTableAndChart".
                     *
                     * @param subComp
                     * @return
                     */
                    private Composite createCompositeForTableAndChart(ExpandableComposite subComp) {
                        final Composite composite = toolkit.createComposite(subComp, SWT.NULL);
                        composite.setLayout(new GridLayout(2, false));
                        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
                        return composite;
                    }

                    /**
                     * DOC yyin Comment method "createSubWholeComposite".
                     *
                     * @param comp
                     * @param chartType
                     * @return
                     */
                    private ExpandableComposite createSubWholeComposite(final Composite comp, EIndicatorChartType chartType) {
                        ExpandableComposite subComp = toolkit.createExpandableComposite(comp, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.EXPANDED);
                        subComp.setText(chartType.getLiteral());
                        subComp.setLayoutData(new GridData(GridData.FILL_BOTH));
                        subComp.setExpanded(EditorPreferencePage.isUnfoldingIndicatorsResultPage());
                        return subComp;
                    }
                });
                monitor.done();
            }
        };
        try {
            new ProgressMonitorDialog(this.getEditorSite().getShell()).run(true, false, rwp);
        } catch (Exception ex) {
            log.error(ex, ex);
        }
    }
}
Also used : IEventReceiver(org.talend.dataprofiler.core.ui.events.IEventReceiver) TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) GridLayout(org.eclipse.swt.layout.GridLayout) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) List(java.util.List) ArrayList(java.util.ArrayList) DynamicIndicatorModel(org.talend.dataprofiler.core.model.dynamic.DynamicIndicatorModel) NamedColumnSet(orgomg.cwm.resource.relational.NamedColumnSet) ICustomerDataset(org.talend.dataprofiler.common.ui.editor.preview.ICustomerDataset) TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) WhereRuleStatisticsTableState(org.talend.dataprofiler.core.ui.editor.preview.model.states.table.WhereRuleStatisticsTableState) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) WhereRuleStatisticsStateTable(org.talend.dataprofiler.core.ui.editor.preview.model.states.WhereRuleStatisticsStateTable) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) CompositeIndicator(org.talend.dataprofiler.core.ui.editor.preview.CompositeIndicator) Indicator(org.talend.dataquality.indicators.Indicator) TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) InvocationTargetException(java.lang.reflect.InvocationTargetException) IChartTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ITableTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates) Analysis(org.talend.dataquality.analysis.Analysis) EIndicatorChartType(org.talend.dq.indicators.preview.EIndicatorChartType) GridData(org.eclipse.swt.layout.GridData) Map(java.util.Map) IdentityHashMap(java.util.IdentityHashMap) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 5 with ITableTypeStates

use of org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates in project tdq-studio-se by Talend.

the class ColumnSetAnalysisResultPage method createAllMatchPart.

private Section createAllMatchPart(Composite parentComp, String title, AllMatchIndicator matchIndicator) {
    Section section = createSection(form, parentComp, title, null);
    section.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite sectionClient = toolkit.createComposite(section);
    sectionClient.setLayout(new GridLayout(2, false));
    sectionClient.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(sectionClient);
    List<IndicatorUnit> units = new ArrayList<IndicatorUnit>();
    units.add(new ColumnSetIndicatorUnit(IndicatorEnum.AllMatchIndicatorEnum, allMatchIndicator));
    EIndicatorChartType matchingType = EIndicatorChartType.PATTERN_MATCHING;
    ITableTypeStates tableTypeState = TableTypeStatesFactory.getInstance().getTableState(matchingType, units);
    TableWithData chartData = new TableWithData(matchingType, tableTypeState.getDataEntity());
    TableViewer tableviewer = tableTypeState.getTableForm(sectionClient);
    tableviewer.setInput(chartData);
    // MOD qiongli feature 19192.
    if (masterPage.getCurrentModelElement().getParameters().isStoreData()) {
        ChartTableFactory.addMenuAndTip(tableviewer, tableTypeState.getDataExplorer(), masterPage.getCurrentModelElement());
    } else {
        TableUtils.addTooltipForTable(tableviewer.getTable());
        TableUtils.addActionTooltip(tableviewer.getTable());
    }
    if (canShowChartForResultPage()) {
        IChartTypeStates chartTypeState = ChartTypeStatesFactory.getChartState(matchingType, units);
        Object chart = chartTypeState.getChart();
        TOPChartUtils.getInstance().decorateChart(chart, false);
        if (chart != null) {
            TOPChartUtils.getInstance().createChartComposite(sectionClient, SWT.NONE, chart, true);
        }
    }
    section.setClient(sectionClient);
    return section;
}
Also used : AbstractPageControllerComposite(org.eclipse.nebula.widgets.pagination.AbstractPageControllerComposite) Composite(org.eclipse.swt.widgets.Composite) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ColumnSetIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit) ArrayList(java.util.ArrayList) TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) Section(org.eclipse.ui.forms.widgets.Section) ColumnSetIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit) IChartTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates) GridLayout(org.eclipse.swt.layout.GridLayout) ITableTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates) GridData(org.eclipse.swt.layout.GridData) EIndicatorChartType(org.talend.dq.indicators.preview.EIndicatorChartType) TableViewer(org.eclipse.jface.viewers.TableViewer)

Aggregations

TableViewer (org.eclipse.jface.viewers.TableViewer)5 TableWithData (org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData)5 IChartTypeStates (org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates)5 ITableTypeStates (org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates)5 ArrayList (java.util.ArrayList)4 EIndicatorChartType (org.talend.dq.indicators.preview.EIndicatorChartType)4 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 ColumnSetIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit)3 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)3 Analysis (org.talend.dataquality.analysis.Analysis)3 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)2 ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)2 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)2 DynamicIndicatorModel (org.talend.dataprofiler.core.model.dynamic.DynamicIndicatorModel)2 CompositeIndicator (org.talend.dataprofiler.core.ui.editor.preview.CompositeIndicator)2 IEventReceiver (org.talend.dataprofiler.core.ui.events.IEventReceiver)2 Indicator (org.talend.dataquality.indicators.Indicator)2 DataExplorer (org.talend.dq.analysis.explore.DataExplorer)2