Search in sources :

Example 1 with HideSeriesChartComposite

use of org.talend.dataprofiler.core.ui.editor.preview.HideSeriesChartComposite 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()]);
    }
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) HideSeriesChartComposite(org.talend.dataprofiler.core.ui.editor.preview.HideSeriesChartComposite) HideSeriesChartComposite(org.talend.dataprofiler.core.ui.editor.preview.HideSeriesChartComposite) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) ArrayList(java.util.ArrayList) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) GridLayout(org.eclipse.swt.layout.GridLayout) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) GridData(org.eclipse.swt.layout.GridData) CountAvgNullIndicator(org.talend.dataquality.indicators.columnset.CountAvgNullIndicator) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Example 2 with HideSeriesChartComposite

use of org.talend.dataprofiler.core.ui.editor.preview.HideSeriesChartComposite 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()]);
    }
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) HideSeriesChartComposite(org.talend.dataprofiler.core.ui.editor.preview.HideSeriesChartComposite) HideSeriesChartComposite(org.talend.dataprofiler.core.ui.editor.preview.HideSeriesChartComposite) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) ArrayList(java.util.ArrayList) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) DataprofilerCoreException(org.talend.dataquality.exception.DataprofilerCoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) GridLayout(org.eclipse.swt.layout.GridLayout) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) JungGraphGenerator(org.talend.dataprofiler.core.ui.chart.jung.JungGraphGenerator) GridData(org.eclipse.swt.layout.GridData) GraphBuilder(org.talend.dq.indicators.graph.GraphBuilder) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ArrayList (java.util.ArrayList)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)2 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)2 ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)2 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)2 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)2 HideSeriesChartComposite (org.talend.dataprofiler.core.ui.editor.preview.HideSeriesChartComposite)2 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)2 JungGraphGenerator (org.talend.dataprofiler.core.ui.chart.jung.JungGraphGenerator)1 DataprofilerCoreException (org.talend.dataquality.exception.DataprofilerCoreException)1 CountAvgNullIndicator (org.talend.dataquality.indicators.columnset.CountAvgNullIndicator)1 GraphBuilder (org.talend.dq.indicators.graph.GraphBuilder)1