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