Search in sources :

Example 31 with ChartDataEntity

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

Example 32 with ChartDataEntity

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);
            }
        }
    }
}
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 33 with ChartDataEntity

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()]);
}
Also used : ArrayList(java.util.ArrayList) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 34 with ChartDataEntity

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()]);
}
Also used : ArrayList(java.util.ArrayList) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) FrequencyExt(org.talend.dq.indicators.ext.FrequencyExt)

Example 35 with ChartDataEntity

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;
}
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)

Aggregations

ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)61 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)17 ArrayList (java.util.ArrayList)16 Test (org.junit.Test)13 TdColumn (org.talend.cwm.relational.TdColumn)13 CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)12 Analysis (org.talend.dataquality.analysis.Analysis)11 IndicatorParameters (org.talend.dataquality.indicators.IndicatorParameters)10 TdTable (org.talend.cwm.relational.TdTable)9 TdExpression (org.talend.cwm.relational.TdExpression)8 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)8 FrequencyExt (org.talend.dq.indicators.ext.FrequencyExt)8 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)7 TableWithData (org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData)7 PatternMatchingIndicator (org.talend.dataquality.indicators.PatternMatchingIndicator)6 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)6 Expression (orgomg.cwm.objectmodel.core.Expression)6 Domain (org.talend.dataquality.domain.Domain)5 Pattern (org.talend.dataquality.domain.pattern.Pattern)5 RegularExpression (org.talend.dataquality.domain.pattern.RegularExpression)5