use of org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver in project tdq-studio-se by Talend.
the class MasterPaginationInfo method createChart.
/**
* DOC bZhou Comment method "createChart".
*
* @param comp
* @param chartType
* @param units
*/
private void createChart(Composite comp, EIndicatorChartType chartType, List<IndicatorUnit> units) {
final IChartTypeStates chartTypeState = ChartTypeStatesFactory.getChartState(chartType, units);
boolean isPattern = chartTypeState instanceof PatternStatisticsState;
Object chart = null;
try {
// MOD 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);
if (event == null) {
chart = chartTypeState.getChart();
} else {
chart = chartTypeState.getChart(((DynamicChartEventReceiver) event).getDataset());
}
if (chart == null) {
return;
}
if (!isPattern) {
// need not to decorate the chart of Pattern(Regex/Sql/UdiMatch)
TOPChartUtils.getInstance().decorateChart(chart, false);
} else {
TOPChartUtils.getInstance().decoratePatternMatching(chart);
}
Object chartComp = TOPChartUtils.getInstance().createChartComposite(comp, SWT.NONE, chart, true);
addListenerToChartComp(chartComp, chartTypeState);
List<Indicator> indicators = getIndicators(units);
if (isSQLMode) {
// use the dynamic model for SQL mode only.
DynamicIndicatorModel dyModel = AnalysisUtils.createDynamicModel(chartType, indicators, chart);
if (EIndicatorChartType.SUMMARY_STATISTICS.equals(chartType)) {
if (units.size() == SummaryStatisticsState.FULL_FLAG) {
indicators = getIndicatorsForTable(units, false);
}
dyModel.setSummaryIndicators(indicators);
}
this.dynamicList.add(dyModel);
if (EIndicatorChartType.SUMMARY_STATISTICS.equals(chartType)) {
// for summary indicators: need to record the chart composite, which is used for create BAW chart
dyModel.setBawParentChartComp(chartComp);
}
}
} 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);
}
}
use of org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver in project tdq-studio-se by Talend.
the class ColumnAnalysisResultPage method registerDynamicEvent.
/**
* Added TDQ-8787 20140613 yyin: create all charts before running, register each chart with its related indicator.
*/
public void registerDynamicEvent() {
// get all indicators and datasets
List<DynamicIndicatorModel> indiAndDatasets = uiPagination.getAllIndcatorAndDatasetOfCurrentPage();
// register dynamic event,for the indicator (for each column)
for (DynamicIndicatorModel oneCategoryIndicatorModel : indiAndDatasets) {
TableViewer tableViewer = oneCategoryIndicatorModel.getTableViewer();
if (EIndicatorChartType.SUMMARY_STATISTICS.equals(oneCategoryIndicatorModel.getChartType())) {
// when all/not-all summary indicators are selected
DynamicBAWChartEventReceiver bawReceiver = AnalysisUtils.createDynamicBAWChartEventReceiver(oneCategoryIndicatorModel, eventReceivers);
bawReceiver.setChartComposite(chartComposite);
bawReceiver.setParentChartComposite((Composite) oneCategoryIndicatorModel.getBawParentChartComp());
bawReceiver.refreshChart();
bawReceiver.setTableViewer(tableViewer);
// no need to register the parent baw receiver with one of summary indicator, no need to handle baw
// actually
} else {
int index = 0;
for (Indicator oneIndicator : oneCategoryIndicatorModel.getIndicatorList()) {
DynamicChartEventReceiver eReceiver = AnalysisUtils.createDynamicChartEventReceiver(oneCategoryIndicatorModel, index++, oneIndicator);
eReceiver.setChartComposite(chartComposite);
eReceiver.refreshChart();
eReceiver.setTableViewer(tableViewer);
// clear data
eReceiver.clearValue();
registerIndicatorEvent(oneIndicator, eReceiver);
}
}
}
reLayoutChartComposite();
registerOtherDynamicEvent();
}
use of org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver in project tdq-studio-se by Talend.
the class ColumnAnalysisResultPage method unRegisterDynamicEvent.
/**
* unregister every dynamic events which registered before executing analysis
*
* @param eventReceivers
*/
public void unRegisterDynamicEvent() {
EventManager.getInstance().clearEvent(masterPage.getCurrentModelElement(), EventEnum.DQ_DYNAMIC_SWITCH_MASTER_RESULT_PAGE);
for (Indicator oneIndicator : eventReceivers.keySet()) {
DynamicChartEventReceiver eventReceiver = (DynamicChartEventReceiver) eventReceivers.get(oneIndicator);
eventReceiver.clear();
EventManager.getInstance().clearEvent(oneIndicator, EventEnum.DQ_DYMANIC_CHART);
}
eventReceivers.clear();
EventManager.getInstance().clearEvent(chartComposite, EventEnum.DQ_DYNAMIC_REFRESH_DYNAMIC_CHART);
if (uiPagination != null) {
uiPagination.clearAllDynamicMapOfCurrentPage();
}
masterPage.clearDynamicDatasets();
}
use of org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver in project tdq-studio-se by Talend.
the class AnalysisUtils method createDynamicBAWChartEventReceiver.
/**
* DOC yyin Comment method "createDynamicBAWChartEventReceiver".
*
* @param oneCategoryIndicatorModel
* @param categoryDataset
* @return
*/
public static DynamicBAWChartEventReceiver createDynamicBAWChartEventReceiver(DynamicIndicatorModel oneCategoryIndicatorModel, Map<Indicator, EventReceiver> eventReceivers) {
DynamicBAWChartEventReceiver bawReceiver = new DynamicBAWChartEventReceiver();
Object categoryDataset = oneCategoryIndicatorModel.getDataset();
if (categoryDataset instanceof CustomerDefaultBAWDataset) {
// all summary selected
bawReceiver.setBawDataset((CustomerDefaultBAWDataset) categoryDataset);
} else {
// not-all summary selected
bawReceiver.setDataset(categoryDataset);
}
bawReceiver.setBAWparentComposite(oneCategoryIndicatorModel.getBawParentChartComp());
bawReceiver.setTableViewer(oneCategoryIndicatorModel.getTableViewer());
int index = 0;
int length = oneCategoryIndicatorModel.getSummaryIndicators().size();
for (Indicator oneIndicator : oneCategoryIndicatorModel.getSummaryIndicators()) {
DynamicChartEventReceiver eReceiver = bawReceiver.createEventReceiver(IndicatorEnum.findIndicatorEnum(oneIndicator.eClass()), oneIndicator);
eReceiver.setTableViewer(oneCategoryIndicatorModel.getTableViewer());
eReceiver.setEntityIndex(index++);
if (SummaryStatisticsState.FULL_FLAG != length) {
eReceiver.setDataset(categoryDataset);
}
eReceiver.clearValue();
eventReceivers.put(oneIndicator, eReceiver);
EventManager.getInstance().register(oneIndicator, EventEnum.DQ_DYMANIC_CHART, eReceiver);
}
bawReceiver.clearValue();
return bawReceiver;
}
use of org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver in project tdq-studio-se by Talend.
the class AnalysisUtils method createDynamicChartEventReceiver.
/**
* create a DynamicChart Event Receiver, according to its type
*
* @param categoryDataset
* @param index
* @param oneIndicator
* @param eIndicatorChartType
* @return
*/
public static DynamicChartEventReceiver createDynamicChartEventReceiver(DynamicIndicatorModel indicatorModel, int index, Indicator oneIndicator) {
DynamicChartEventReceiver eReceiver = null;
if (isBenford(indicatorModel.getChartType())) {
eReceiver = new BenfordFrequencyDynamicChartEventReceiver();
((BenfordFrequencyDynamicChartEventReceiver) eReceiver).setSecondDataset(indicatorModel.getSecondDataset());
} else if (isFrequency(indicatorModel.getChartType())) {
// TDQ-12870, should clear the last result
oneIndicator.setCount(0l);
eReceiver = new FrequencyDynamicChartEventReceiver();
} else if (isPattern(indicatorModel.getChartType())) {
eReceiver = new PatternDynamicChartEventReceiver();
} else {
eReceiver = new DynamicChartEventReceiver();
}
eReceiver.setDataset(indicatorModel.getDataset());
eReceiver.setIndexInDataset(index);
eReceiver.setIndicatorName(oneIndicator.getName());
eReceiver.setIndicator(oneIndicator);
return eReceiver;
}
Aggregations