Search in sources :

Example 6 with TableWithData

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);
            }
        }
    }
}
Also used : WhereRuleChartDataEntity(org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity) TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) WhereRuleChartDataEntity(org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity)

Example 7 with TableWithData

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();
    }
}
Also used : TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)

Example 8 with TableWithData

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;
}
Also used : TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) ModeIndicator(org.talend.dataquality.indicators.ModeIndicator) FrequencyExt(org.talend.dq.indicators.ext.FrequencyExt) ICustomerDataset(org.talend.dataprofiler.common.ui.editor.preview.ICustomerDataset)

Example 9 with TableWithData

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;
}
Also used : WhereRuleChartDataEntity(org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity) TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) WhereRuleChartDataEntity(org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity)

Example 10 with TableWithData

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);
        }
    }
}
Also used : TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Aggregations

TableWithData (org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData)12 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)7 TableViewer (org.eclipse.jface.viewers.TableViewer)5 IChartTypeStates (org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates)5 ITableTypeStates (org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates)5 ArrayList (java.util.ArrayList)4 EIndicatorChartType (org.talend.dq.indicators.preview.EIndicatorChartType)4 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 ColumnSetIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit)3 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)3 Analysis (org.talend.dataquality.analysis.Analysis)3 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)2 ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)2 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)2 ICustomerDataset (org.talend.dataprofiler.common.ui.editor.preview.ICustomerDataset)2 DynamicIndicatorModel (org.talend.dataprofiler.core.model.dynamic.DynamicIndicatorModel)2 CompositeIndicator (org.talend.dataprofiler.core.ui.editor.preview.CompositeIndicator)2 IEventReceiver (org.talend.dataprofiler.core.ui.events.IEventReceiver)2