Search in sources :

Example 6 with IIndicatorNode

use of org.talend.dq.nodes.indicator.IIndicatorNode in project tdq-studio-se by Talend.

the class AbstractIndicatorSelectGrid method processNodeSelection.

/**
 * recursively check if a entire row/column is selected/
 *
 * @param grid
 * @param parentItem
 * @param currentItem
 */
void processNodeSelection(GridItem parentItem, GridItem currentItem) {
    if (currentItem.hasChildren()) {
        // declare and initialize variables
        Boolean[] allCheckedInColumn = new Boolean[getColumnCount()];
        Boolean[] hasCheckedInColumn = new Boolean[getColumnCount()];
        for (int j = 1; j < getColumnCount(); j++) {
            allCheckedInColumn[j] = true;
            hasCheckedInColumn[j] = false;
        }
        for (int i = 0; i < currentItem.getItemCount(); i++) {
            GridItem childItem = currentItem.getItem(i);
            // process the children of current item, this must be done before handling the current item
            processNodeSelection(currentItem, childItem);
            boolean allCheckedInRow = true;
            boolean hasCheckedInRow = false;
            boolean expanded = false;
            for (int j = 2; j < getColumnCount(); j++) {
                if (childItem.getChecked(j)) {
                    hasCheckedInRow = true;
                    hasCheckedInColumn[j] = true;
                    expanded = true;
                    if (childItem.getGrayed(j)) {
                        allCheckedInRow = false;
                        allCheckedInColumn[j] = false;
                    }
                } else {
                    if (childItem.getCheckable(j)) {
                        allCheckedInRow = false;
                        allCheckedInColumn[j] = false;
                    }
                }
            }
            childItem.setChecked(1, hasCheckedInRow);
            childItem.setGrayed(1, hasCheckedInRow && !allCheckedInRow);
            if (expanded) {
                currentItem.setExpanded(true);
            }
        }
        // process the selections of indicator category row
        boolean entireCategoryChecked = true;
        for (int j = 2; j < getColumnCount(); j++) {
            if (currentItem.getCheckable(j)) {
                if (hasCheckedInColumn[j]) {
                    hasCheckedInColumn[1] = true;
                    currentItem.setChecked(j, true);
                } else {
                    currentItem.setChecked(j, false);
                }
                if (!allCheckedInColumn[j]) {
                    currentItem.setGrayed(j, hasCheckedInColumn[j]);
                    entireCategoryChecked = false;
                } else {
                    currentItem.setGrayed(j, false);
                }
                // are selected
                if (hasCheckedInColumn[j] && allCheckedInColumn[j]) {
                    IIndicatorNode indicatorNode = (IIndicatorNode) currentItem.getData();
                    IndicatorEnum indicatorEnum = indicatorNode.getIndicatorEnum();
                    ModelElementIndicator meIndicator = (ModelElementIndicator) getColumn(j).getData();
                    if (indicatorEnum != null && meIndicator != null && (indicatorEnum == IndicatorEnum.RangeIndicatorEnum || indicatorEnum == IndicatorEnum.IQRIndicatorEnum)) {
                        meIndicator.addTempIndicatorEnum(indicatorEnum);
                    }
                }
            }
        }
        if (currentItem.getCheckable(1)) {
            currentItem.setChecked(1, hasCheckedInColumn[1]);
            currentItem.setGrayed(1, hasCheckedInColumn[1] && !entireCategoryChecked);
        }
    }
}
Also used : TalendGridItem(org.eclipse.nebula.widgets.grid.TalendGridItem) GridItem(org.eclipse.nebula.widgets.grid.GridItem) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) Point(org.eclipse.swt.graphics.Point) IIndicatorNode(org.talend.dq.nodes.indicator.IIndicatorNode) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 7 with IIndicatorNode

use of org.talend.dq.nodes.indicator.IIndicatorNode in project tdq-studio-se by Talend.

the class AbstractIndicatorSelectGrid method createTableContent.

/**
 * Create the Content of table
 */
protected void createTableContent() {
    IIndicatorNode[] branchNodes = IndicatorTreeModelBuilder.buildIndicatorCategory();
    for (IIndicatorNode indicatorNode : branchNodes) {
        TalendGridItem item = new TalendGridItem(this, SWT.NONE);
        item.setText(indicatorNode.getLabel());
        item.setData(indicatorNode);
        createChildNodes(null, item, indicatorNode);
        processNodeSelection(null, item);
    }
}
Also used : TalendGridItem(org.eclipse.nebula.widgets.grid.TalendGridItem) IIndicatorNode(org.talend.dq.nodes.indicator.IIndicatorNode)

Example 8 with IIndicatorNode

use of org.talend.dq.nodes.indicator.IIndicatorNode in project tdq-studio-se by Talend.

the class IndicatorCategoryNode method creatChildren.

private void creatChildren(IndicatorEnum[] indicatorEnums) {
    IIndicatorNode[] childrenNodes = new IIndicatorNode[indicatorEnums.length];
    for (int i = 0; i < indicatorEnums.length; i++) {
        if (indicatorEnums[i].hasChildren()) {
            childrenNodes[i] = new IndicatorCategoryNode(indicatorEnums[i]);
        // ((IndicatorCategoryNode) childrenNodes[i]).createChildren(indicatorEnums[i]);
        } else {
            childrenNodes[i] = new IndicatorNode(indicatorEnums[i]);
        }
        childrenNodes[i].setParent(this);
    }
    this.setChildren(childrenNodes);
}
Also used : IIndicatorNode(org.talend.dq.nodes.indicator.IIndicatorNode) IIndicatorNode(org.talend.dq.nodes.indicator.IIndicatorNode)

Aggregations

IIndicatorNode (org.talend.dq.nodes.indicator.IIndicatorNode)8 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)5 TalendGridItem (org.eclipse.nebula.widgets.grid.TalendGridItem)4 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)4 Point (org.eclipse.swt.graphics.Point)3 GridItem (org.eclipse.nebula.widgets.grid.GridItem)2 DelimitedFileIndicator (org.talend.dataprofiler.core.model.DelimitedFileIndicator)2 DatePatternFreqIndicator (org.talend.dataquality.indicators.DatePatternFreqIndicator)2 Indicator (org.talend.dataquality.indicators.Indicator)2 PhoneNumbStatisticsIndicator (org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator)2 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1