Search in sources :

Example 1 with JungGraphGenerator

use of org.talend.dataprofiler.core.ui.chart.jung.JungGraphGenerator 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)

Example 2 with JungGraphGenerator

use of org.talend.dataprofiler.core.ui.chart.jung.JungGraphGenerator in project tdq-studio-se by Talend.

the class CorrelationAnalysisResultPage method createGraphicsSectionPart.

protected Section createGraphicsSectionPart(Composite parentComp) {
    Section section = createSection(// $NON-NLS-1$
    form, // $NON-NLS-1$
    parentComp, // $NON-NLS-1$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.graphics"), // $NON-NLS-1$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.space"));
    section.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite sectionClient = toolkit.createComposite(section);
    sectionClient.setLayout(new GridLayout());
    sectionClient.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(sectionClient);
    chartComposite = toolkit.createComposite(sectionClient);
    chartComposite.setLayout(new GridLayout());
    if (ColumnsetPackage.eINSTANCE.getWeakCorrelationIndicator() == columnSetMultiIndicator.eClass()) {
        GridData gd = new GridData();
        gd.widthHint = 900;
        gd.heightHint = 450;
        chartComposite.setLayoutData(gd);
        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) {
            JungGraphGenerator generator = new JungGraphGenerator(gBuilder, listRows);
            // MOD yyi 2009-09-09 feature 8834
            generator.generate(chartComposite, false, false);
        }
    // TDQ-4781~
    } else {
        createBubbleOrGanttChart(form, chartComposite, columnSetMultiIndicator);
    }
    section.setClient(sectionClient);
    return section;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) HideSeriesChartComposite(org.talend.dataprofiler.core.ui.editor.preview.HideSeriesChartComposite) JungGraphGenerator(org.talend.dataprofiler.core.ui.chart.jung.JungGraphGenerator) GridData(org.eclipse.swt.layout.GridData) GraphBuilder(org.talend.dq.indicators.graph.GraphBuilder) Section(org.eclipse.ui.forms.widgets.Section)

Aggregations

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