Search in sources :

Example 1 with RowMatchExplorer

use of org.talend.dq.analysis.explore.RowMatchExplorer in project tdq-studio-se by Talend.

the class RedundancyAnalysisResultPage method createMenu.

/**
 * DOC hcheng Comment method "createMenu".
 *
 * @param resultTable
 * @param indicator
 * @return
 */
private Menu createMenu(final Table resultTable, final RowMatchingIndicator indicator) {
    if (indicator == null) {
        return null;
    }
    final ColumnSet columnSet = SwitchHelpers.COLUMN_SET_SWITCH.doSwitch(indicator.getAnalyzedElement());
    getAnalysisHandler().getAnalyzedColumns();
    if (columnSet == null) {
        return null;
    }
    Menu menu = new Menu(resultTable);
    MenuItem itemNotMatch = new MenuItem(menu, SWT.PUSH);
    MenuItem itemRow = new MenuItem(menu, SWT.PUSH);
    // MOD qiongli 2012-8-30 TDQ-5907 hide 'view match row' menue for hive connection.
    final Connection provider = ConnectionHelper.getDataProvider(columnSet);
    if (!ConnectionHelper.isHive(provider)) {
        MenuItem itemMatch = new MenuItem(menu, SWT.PUSH);
        itemMatch.setText(DataExplorer.MENU_VIEW_MATCH_ROWS);
        itemMatch.setImage(ImageLib.getImage(ImageLib.EXPLORE_IMAGE));
        itemMatch.addListener(SWT.Selection, new Listener() {

            public void handleEvent(Event event) {
                RowMatchExplorer rowMatchExplorer = new RowMatchExplorer();
                rowMatchExplorer.setAnalysis(masterPage.getCurrentModelElement());
                // $NON-NLS-1$ //$NON-NLS-2$
                rowMatchExplorer.setEnitty(new ChartDataEntity(indicator, "", ""));
                String query = rowMatchExplorer.getRowsMatchStatement();
                if (provider != null) {
                    SqlExplorerUtils.getDefault().runInDQViewer(provider, query, columnSet.getName());
                }
            }
        });
    }
    itemNotMatch.setText(DataExplorer.MENU_VIEW_NOT_MATCH_ROWS);
    itemNotMatch.setImage(ImageLib.getImage(ImageLib.EXPLORE_IMAGE));
    itemRow.setText(DataExplorer.MENU_VIEW_ROWS);
    itemRow.setImage(ImageLib.getImage(ImageLib.EXPLORE_IMAGE));
    itemNotMatch.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            RowMatchExplorer rowMatchExplorer = new RowMatchExplorer();
            rowMatchExplorer.setAnalysis(masterPage.getCurrentModelElement());
            // $NON-NLS-1$ //$NON-NLS-2$
            rowMatchExplorer.setEnitty(new ChartDataEntity(indicator, "", ""));
            String query = rowMatchExplorer.getRowsNotMatchStatement();
            if (provider != null) {
                SqlExplorerUtils.getDefault().runInDQViewer(provider, query, columnSet.getName());
            }
        }
    });
    itemRow.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            // MOD 10913 zshen:unify the method that get sql query
            RowMatchExplorer rowMatchExplorer = new RowMatchExplorer();
            rowMatchExplorer.setAnalysis(masterPage.getCurrentModelElement());
            // $NON-NLS-1$ //$NON-NLS-2$
            rowMatchExplorer.setEnitty(new ChartDataEntity(indicator, "", ""));
            String query = rowMatchExplorer.getAllRowsStatement();
            if (provider != null) {
                SqlExplorerUtils.getDefault().runInDQViewer(provider, query, columnSet.getName());
            }
        // ~10913
        }
    });
    return menu;
}
Also used : MouseListener(org.eclipse.swt.events.MouseListener) Listener(org.eclipse.swt.widgets.Listener) Connection(org.talend.core.model.metadata.builder.connection.Connection) MouseEvent(org.eclipse.swt.events.MouseEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ColumnSet(orgomg.cwm.resource.relational.ColumnSet) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) PatternChartDataEntity(org.talend.dq.indicators.preview.table.PatternChartDataEntity) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) RowMatchExplorer(org.talend.dq.analysis.explore.RowMatchExplorer)

Example 2 with RowMatchExplorer

use of org.talend.dq.analysis.explore.RowMatchExplorer in project tdq-studio-se by Talend.

the class RedundancyAnalysisResultPage method creatChart.

private void creatChart(Composite parent, String tableA, String tableB) {
    CustomerDefaultCategoryDataset dataset = new CustomerDefaultCategoryDataset();
    // DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(rowMatchingIndicatorA.getNotMatchingValueCount(), NOT_MATCHING, tableA);
    dataset.addValue(rowMatchingIndicatorA.getMatchingValueCount(), MATCHING, tableA);
    // add by hcheng
    PatternChartDataEntity dataEntityA = new PatternChartDataEntity();
    dataEntityA.setLabel(tableA);
    dataEntityA.setIndicator(rowMatchingIndicatorA);
    dataEntityA.setNumMatch(rowMatchingIndicatorA.getMatchingValueCount().toString());
    dataEntityA.setNumNoMatch(rowMatchingIndicatorA.getNotMatchingValueCount().toString());
    dataset.addDataEntity(dataEntityA);
    if (!isHasDeactivatedIndicator) {
        dataset.addValue(rowMatchingIndicatorB.getNotMatchingValueCount(), NOT_MATCHING, tableB);
        dataset.addValue(rowMatchingIndicatorB.getMatchingValueCount(), MATCHING, tableB);
        PatternChartDataEntity dataEntityB = new PatternChartDataEntity();
        dataEntityB.setLabel(tableB);
        dataEntityB.setIndicator(rowMatchingIndicatorB);
        dataEntityB.setNumMatch(rowMatchingIndicatorB.getMatchingValueCount().toString());
        dataEntityB.setNumNoMatch(rowMatchingIndicatorB.getNotMatchingValueCount().toString());
        dataset.addDataEntity(dataEntityB);
    }
    Object chart = TOPChartUtils.getInstance().createStackedBarChart(// $NON-NLS-1$
    DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.ColumnsComparison"), // $NON-NLS-1$
    dataset, true, true);
    final Object chartComp = TOPChartUtils.getInstance().createChartComposite(parent, SWT.NONE, chart, true);
    // add by hcheng for 6530(add menu to "View query result" for chart )
    addMenuToChartComp(chartComp, new RowMatchExplorer(), getAnalysisHandler().getAnalysis(), ((ICustomerDataset) dataset).getDataEntities());
}
Also used : PatternChartDataEntity(org.talend.dq.indicators.preview.table.PatternChartDataEntity) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset) RowMatchExplorer(org.talend.dq.analysis.explore.RowMatchExplorer)

Aggregations

RowMatchExplorer (org.talend.dq.analysis.explore.RowMatchExplorer)2 PatternChartDataEntity (org.talend.dq.indicators.preview.table.PatternChartDataEntity)2 MouseEvent (org.eclipse.swt.events.MouseEvent)1 MouseListener (org.eclipse.swt.events.MouseListener)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Event (org.eclipse.swt.widgets.Event)1 Listener (org.eclipse.swt.widgets.Listener)1 Menu (org.eclipse.swt.widgets.Menu)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1 Connection (org.talend.core.model.metadata.builder.connection.Connection)1 CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)1 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)1 ColumnSet (orgomg.cwm.resource.relational.ColumnSet)1