use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class PatternDynamicChartEventReceiver method refreshTable.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver#refreshTable(java.lang.String)
*/
@Override
public void refreshTable(String value) {
TableWithData input = (TableWithData) tableViewer.getInput();
if (input != null) {
ChartDataEntity[] dataEntities = input.getEnity();
if (dataEntities != null && dataEntities.length > getIndexInDataset()) {
((PatternChartDataEntity) dataEntities[getIndexInDataset()]).setNumMatch(value);
((PatternChartDataEntity) dataEntities[getIndexInDataset()]).setNumNoMatch(value);
tableViewer.getTable().clearAll();
tableViewer.setInput(input);
}
}
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class TableDynamicChartEventReceiver method clearValue.
@Override
public void clearValue() {
if (IndicatorEnum.RowCountIndicatorEnum.equals(this.getIndicatorType())) {
super.clearValue();
} else {
// clear the data before running.
if (dataset != null) {
TOPChartUtils.getInstance().setValue(dataset, 0.0, WhereRuleStatisticsStateTable.ROW_KEY_NOT_PASS, indicatorName);
TOPChartUtils.getInstance().setValue(dataset, 0.0, WhereRuleStatisticsStateTable.ROW_KEY_PASS, indicatorName);
}
if (tableViewer != null) {
TableWithData input = (TableWithData) tableViewer.getInput();
if (input != null) {
ChartDataEntity[] dataEntities = input.getEnity();
((WhereRuleChartDataEntity) dataEntities[this.getEntityIndex()]).setNumMatch(NAN_STRING);
((WhereRuleChartDataEntity) dataEntities[this.getEntityIndex()]).setNumNoMatch(NAN_STRING);
tableViewer.getTable().clearAll();
tableViewer.setInput(input);
}
}
}
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class PhoneNumbStatisticsTableState method getDataEntity.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.editor.preview.model.states.table.AbstractTableTypeStates#getDataEntity()
*/
@Override
public ChartDataEntity[] getDataEntity() {
List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
for (IndicatorUnit unit : units) {
String value = CommonStateUtil.getUnitValue(unit.getValue(), 0);
String label = unit.getIndicatorName();
ChartDataEntity entity = PhoneNumbStatisticsStateUtil.createDataEntity(unit.getIndicator(), value, label);
dataEnities.add(entity);
}
return dataEnities.toArray(new ChartDataEntity[dataEnities.size()]);
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class PieStatisticsTableState method getDataEntity.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.editor.preview.model.states.table.AbstractTableTypeStates#getDataEntity()
*/
@Override
public ChartDataEntity[] getDataEntity() {
List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
for (IndicatorUnit unit : units) {
if (unit.isExcuted()) {
FrequencyExt[] frequencyExt = (FrequencyExt[]) unit.getValue();
int numOfShown = PieStatisticsStateUtil.getNumberOfShown(unit, frequencyExt);
for (int i = 0; i < numOfShown; i++) {
FrequencyExt freqExt = frequencyExt[i];
ChartDataEntity entity = PieStatisticsStateUtil.createDataEntity(unit, freqExt, PieStatisticsStateUtil.getkeyLabel(freqExt));
dataEnities.add(entity);
}
}
}
return dataEnities.toArray(new ChartDataEntity[dataEnities.size()]);
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class FrequencyDynamicChartEventReceiver method handle.
@Override
public boolean handle(Object value) {
Object indValue = value;
if (value == null) {
indValue = 0;
}
if (dataset != null) {
// no sort needed here
if (indValue instanceof FrequencyExt[]) {
FrequencyExt[] frequencyExt = (FrequencyExt[]) indValue;
setFrequecyToDataset(dataset, frequencyExt, indicator);
}
}
if (tableViewer != null && dataset != null) {
TableWithData input = (TableWithData) tableViewer.getInput();
if (input != null) {
if (this.indicator instanceof ModeIndicator) {
ChartDataEntity entity = new ChartDataEntity();
entity.setIndicator(indicator);
entity.setLabel(this.indicatorName);
entity.setValue(String.valueOf(indValue));
// mode indicator has not a chart so that no dataset too
input.setEntities(new ChartDataEntity[] { entity });
} else {
ICustomerDataset customerDataset = TOPChartUtils.getInstance().getCustomerDataset(dataset);
if (customerDataset != null) {
input.setEntities((customerDataset).getDataEntities());
} else {
input.setEntities(((ICustomerDataset) dataset).getDataEntities());
}
}
}
if (!tableViewer.getTable().isDisposed()) {
tableViewer.getTable().clearAll();
tableViewer.setInput(input);
}
}
if (registerChart != TOPChartUtils.getInstance().getChartFromChartComposite(parentChartComposite)) {
restoreChart();
}
// need to refresh the parent composite of the chart to show the changes
if (!(indicator instanceof ModeIndicator)) {
EventManager.getInstance().publish(chartComposite, EventEnum.DQ_DYNAMIC_REFRESH_DYNAMIC_CHART, null);
}
return true;
}
Aggregations