use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class OverviewResultPage method createResultSection.
@Override
protected void createResultSection(Composite parent) {
statisticalSection = this.createSection(form, parent, DefaultMessagesImpl.getString("ConnectionMasterDetailsPage.statisticalinformations"), // $NON-NLS-1$
null);
Composite sectionClient = toolkit.createComposite(statisticalSection);
sectionClient.setLayout(new GridLayout());
catalogTableViewer = new TableViewer(sectionClient, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
Table catalogTable = catalogTableViewer.getTable();
TableUtils.addActionTooltip(catalogTable);
catalogTable.setHeaderVisible(true);
catalogTable.setBackgroundMode(SWT.INHERIT_FORCE);
catalogTable.setLinesVisible(true);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(catalogTable);
List<Catalog> catalogs = getCatalogs();
boolean containSubSchema = false;
for (Catalog catalog : catalogs) {
List<Schema> schemas = CatalogHelper.getSchemas(catalog);
if (schemas.size() > 0) {
containSubSchema = true;
break;
}
}
if (catalogs.size() > 0 && containSubSchema) {
createCatalogSchemaColumns(catalogTable);
provider = new CatalogSchemaViewerProvier();
addColumnSorters(catalogTableViewer, catalogTable.getColumns(), catalogWithSchemaSorters);
createSchemaTableViewer(sectionClient);
schemaTableViewer.addSelectionChangedListener(new DisplayTableAndViewListener());
catalogTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
StructuredSelection selection = (StructuredSelection) event.getSelection();
OverviewIndUIElement firstElement = (OverviewIndUIElement) selection.getFirstElement();
List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
if (firstElement != null) {
Indicator overviewIndicator = firstElement.getOverviewIndicator();
// selection.getFirstElement();
CatalogIndicator catalogIndicator = (CatalogIndicator) overviewIndicator;
// MOD qiongli bug 13093,2010-7-2,
// selection.getFirstElement();
currentCatalogIndicator = (SchemaIndicator) overviewIndicator;
// MOD xqliu 2009-11-30 bug 9114
if (catalogIndicator != null) {
EList<SchemaIndicator> schemaIndicators = catalogIndicator.getSchemaIndicators();
for (SchemaIndicator schemaIndicator : schemaIndicators) {
RepositoryNode schemaNode = RepositoryNodeHelper.recursiveFind(schemaIndicator.getAnalyzedElement());
OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
cataUIEle.setNode(schemaNode);
cataUIEle.setOverviewIndicator(schemaIndicator);
cataUIEleList.add(cataUIEle);
}
schemaTableViewer.setInput(cataUIEleList);
schemaTableViewer.getTable().setVisible(true);
addColumnSorters(schemaTableViewer, schemaTableViewer.getTable().getColumns(), schemaSorters);
}
}
// ~
}
});
createContextMenuFor(schemaTableViewer);
} else {
if (catalogs.size() > 0) {
createCatalogTableColumns(catalogTable);
provider = new CatalogViewerProvier();
} else {
createSchemaTableColumns(catalogTable);
provider = new SchemaViewerProvier();
}
addColumnSorters(catalogTableViewer, catalogTable.getColumns(), schemaSorters);
catalogTableViewer.addSelectionChangedListener(new DisplayTableAndViewListener());
}
catalogTableViewer.setLabelProvider(provider);
catalogTableViewer.setContentProvider(provider);
doSetInput();
tableAndViewComposite = new Composite(sectionClient, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tableAndViewComposite);
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.horizontalSpacing = 50;
tableAndViewComposite.setLayout(layout);
tableAndViewComposite.setVisible(false);
sectionClient.layout();
statisticalSection.setClient(sectionClient);
createContextMenuFor(catalogTableViewer);
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class RedundancyAnalysisDetailsPage method initialize.
@Override
public void initialize(FormEditor editor) {
super.initialize(editor);
// MOD xqliu 2009-06-10 bug7334
stringDataFilterA = AnalysisHelper.getStringDataFilter(getCurrentModelElement(), 0);
stringDataFilterB = AnalysisHelper.getStringDataFilter(getCurrentModelElement(), 1);
// ~
if (getCurrentModelElement().getResults().getIndicators().size() == 0) {
ColumnsetFactory factory = ColumnsetFactory.eINSTANCE;
rowMatchingIndicatorA = factory.createRowMatchingIndicator();
rowMatchingIndicatorB = factory.createRowMatchingIndicator();
Indicator[] currentIndicators = new Indicator[] { rowMatchingIndicatorA, rowMatchingIndicatorB };
setDefaultIndDef(currentIndicators);
} else {
EList<Indicator> indicators = getCurrentModelElement().getResults().getIndicators();
rowMatchingIndicatorA = (RowMatchingIndicator) indicators.get(0);
rowMatchingIndicatorB = (RowMatchingIndicator) indicators.get(1);
}
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class RedundancyAnalysisResultPage method createAnalyzedColumnSetsSection.
private void createAnalyzedColumnSetsSection(Composite parent) {
columnSetSection = createSection(form, parent, DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.analyzedColumnSets"), // $NON-NLS-1$
null);
Composite sectionClient = toolkit.createComposite(columnSetSection);
sectionClient.setLayout(new GridLayout());
sectionClient.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
TableViewer elementsTableViewer = new TableViewer(sectionClient, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
Table table = elementsTableViewer.getTable();
GridDataFactory.fillDefaults().applyTo(table);
((GridData) table.getLayoutData()).heightHint = 240;
((GridData) table.getLayoutData()).widthHint = 600;
table.setHeaderVisible(true);
table.setLinesVisible(true);
table.setDragDetect(true);
// $NON-NLS-1$
table.setToolTipText(DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.dragAndDropToolTip"));
final TableColumn columnHeader1 = new TableColumn(table, SWT.LEAD);
columnHeader1.setWidth(300);
final TableColumn columnHeader2 = new TableColumn(table, SWT.LEAD);
columnHeader2.setWidth(300);
Analysis analysis = this.masterPage.getAnalysisHandler().getAnalysis();
isHasDeactivatedIndicator = analysis.getParameters().getDeactivatedIndicators().size() != 0;
EList<Indicator> indicators = analysis.getResults().getIndicators();
if (indicators.size() != 0) {
rowMatchingIndicatorA = (RowMatchingIndicator) indicators.get(0);
rowMatchingIndicatorB = (RowMatchingIndicator) indicators.get(1);
TdColumn columnA = null;
if (rowMatchingIndicatorA.getColumnSetA().size() > 0) {
columnA = rowMatchingIndicatorA.getColumnSetA().get(0);
if (columnA.eIsProxy()) {
columnA = (TdColumn) EObjectHelper.resolveObject(columnA);
}
}
String columnName = rowMatchingIndicatorA.getColumnSetA().size() > 0 ? ColumnHelper.getColumnOwnerAsColumnSet(columnA).getName() : PluginConstant.EMPTY_STRING;
columnHeader1.setText(columnName.equals(PluginConstant.EMPTY_STRING) ? columnName : DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.elementsFrom", // $NON-NLS-1$
columnName));
TdColumn columnB = null;
if (rowMatchingIndicatorA.getColumnSetB().size() > 0) {
columnB = rowMatchingIndicatorA.getColumnSetB().get(0);
if (columnB.eIsProxy()) {
columnB = (TdColumn) EObjectHelper.resolveObject(columnB);
}
}
columnName = rowMatchingIndicatorA.getColumnSetA().size() > 0 ? ColumnHelper.getColumnOwnerAsColumnSet(columnB).getName() : PluginConstant.EMPTY_STRING;
columnHeader2.setText(columnName.equals(PluginConstant.EMPTY_STRING) ? columnName : DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.elementsFrom", // $NON-NLS-1$
columnName));
}
ColumnPairsViewerProvider provider = new ColumnPairsViewerProvider();
elementsTableViewer.setContentProvider(provider);
elementsTableViewer.setLabelProvider(provider);
elementsTableViewer.setInput(rowMatchingIndicatorA);
columnSetSection.setClient(sectionClient);
}
use of org.talend.dataquality.indicators.Indicator 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);
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class BusinessRuleAnalysisResultPage method registerDynamicEvent.
/**
* Added TDQ-8787 20140613 yyin: create all charts before running, register each chart with its related indicator.
*/
public void registerDynamicEvent() {
// register dynamic event,for the indicator (for each column)
for (DynamicIndicatorModel oneCategoryIndicatorModel : dynamicList) {
Object categoryDataset = oneCategoryIndicatorModel.getDataset();
TableViewer tableViewer = oneCategoryIndicatorModel.getTableViewer();
int index = 0;
for (Indicator oneIndicator : oneCategoryIndicatorModel.getIndicatorList()) {
TableDynamicChartEventReceiver eReceiver = new TableDynamicChartEventReceiver();
eReceiver.setDataset(categoryDataset);
eReceiver.setIndexInDataset(index++);
eReceiver.setIndicatorName(oneIndicator.getName());
eReceiver.setIndicator(oneIndicator);
eReceiver.setIndicatorType(IndicatorEnum.findIndicatorEnum(oneIndicator.eClass()));
eReceiver.setChartComposite(sectionClient);
eReceiver.setTableViewer(tableViewer);
// clear data
eReceiver.clearValue();
registerIndicatorEvent(oneIndicator, eReceiver);
}
}
reLayoutChartComposite();
registerRefreshDynamicChartEvent();
}
Aggregations