use of org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData 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.dataprofiler.core.ui.editor.preview.model.TableWithData in project tdq-studio-se by Talend.
the class FrequencyDynamicChartEventReceiver method clearValue.
@Override
public void clearValue() {
if (dataset != null) {
// clear old data
if (dataset instanceof CustomerDefaultCategoryDataset) {
((CustomerDefaultCategoryDataset) dataset).clearAll();
} else {
TOPChartUtils.getInstance().clearDataset(dataset);
}
}
if (tableViewer != null) {
TableWithData input = (TableWithData) tableViewer.getInput();
input.setEntities(null);
tableViewer.getTable().clearAll();
}
}
use of org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData 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;
}
use of org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData in project tdq-studio-se by Talend.
the class TableDynamicChartEventReceiver method handle.
@Override
public boolean handle(Object value) {
if (value == null) {
return false;
}
if (IndicatorEnum.RowCountIndicatorEnum.equals(this.getIndicatorType())) {
super.handle(value);
} else {
Long count = getIndicator().getCount();
double valueMatch = WhereRuleStatisticsStateUtil.getMatchValue(value);
double valueNotmatch = WhereRuleStatisticsStateUtil.getNotMatchValue(value, valueMatch, count);
if (dataset != null) {
TOPChartUtils.getInstance().setValue(dataset, valueNotmatch, WhereRuleStatisticsStateTable.ROW_KEY_NOT_PASS, indicatorName);
TOPChartUtils.getInstance().setValue(dataset, valueMatch, 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(String.valueOf(valueMatch));
((WhereRuleChartDataEntity) dataEntities[this.getEntityIndex()]).setNumNoMatch(String.valueOf(valueNotmatch));
tableViewer.getTable().clearAll();
tableViewer.setInput(input);
}
}
}
return true;
}
use of org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData in project tdq-studio-se by Talend.
the class DynamicChartEventReceiver method refreshTable.
public void refreshTable(String value) {
TableWithData input = (TableWithData) tableViewer.getInput();
if (input != null) {
ChartDataEntity[] dataEntities = input.getEnity();
if (dataEntities != null && dataEntities.length > entityIndex) {
dataEntities[entityIndex].setValue(value);
dataEntities[entityIndex].setPercent(Double.NaN);
tableViewer.getTable().clearAll();
tableViewer.setInput(input);
}
}
}
Aggregations