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;
}
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());
}
Aggregations