use of org.eclipse.nebula.widgets.grid.TalendGridItem in project tdq-studio-se by Talend.
the class AbstractIndicatorSelectGrid method createChildNodes.
/**
* recursively create tree nodes and checked the existing indicators.
*
* @param grid
* @param currentItem
* @param indicatorNode
*/
void createChildNodes(GridItem parentItem, GridItem currentItem, IIndicatorNode indicatorNode) {
Boolean[] hasCheckableInColumn = new Boolean[getColumnCount()];
for (int j = 1; j < getColumnCount(); j++) {
hasCheckableInColumn[j] = false;
}
for (int i = 0; i < indicatorNode.getChildren().length; i++) {
IIndicatorNode childNode = indicatorNode.getChildren()[i];
TalendGridItem childItem = new TalendGridItem(currentItem, SWT.NONE);
childItem.setImage(ImageLib.getImage(childNode.getImageName()));
if (childNode.hasChildren()) {
createChildNodes(currentItem, childItem, childNode);
}
childItem.setText(childNode.getLabel());
childItem.setData(childNode);
if (parentItem == null) {
childItem.setExpanded(true);
}
boolean hasCheckableInRow = false;
for (int j = 2; j < getColumnCount(); j++) {
// ignore indicator label column and row select column
IndicatorEnum indicatorEnum = childNode.getIndicatorEnum();
// DB columns
ModelElementIndicator meIndicator = null;
if (j - 2 < _modelElementIndicators.length) {
meIndicator = _modelElementIndicators[j - 2];
} else {
meIndicator = _modelElementIndicators[0];
}
// Enable/disable the check box
boolean isMatch = _dialog.isMatchCurrentIndicator(meIndicator, childNode);
childItem.setCheckable(j, isMatch);
if (isMatch) {
hasCheckableInRow = true;
hasCheckableInColumn[j] = true;
// Check the box if it is already selected
if (meIndicator != null && (meIndicator.tempContains(indicatorEnum) || meIndicator.specialTempContains(childNode.getIndicatorInstance()))) {
childItem.setChecked(j, true);
}
}
}
childItem.setCheckable(1, hasCheckableInRow);
}
boolean entireCategoryCheckable = false;
for (int j = 2; j < getColumnCount(); j++) {
if (hasCheckableInColumn[j]) {
entireCategoryCheckable = true;
} else {
currentItem.setCheckable(j, false);
}
}
currentItem.setCheckable(1, entireCategoryCheckable);
}
use of org.eclipse.nebula.widgets.grid.TalendGridItem in project tdq-studio-se by Talend.
the class ColumnPreviewGrid method createTableContent.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.grid.AbstractIndicatorSelectGrid#createTableContent()
*/
@Override
protected void createTableContent() {
try {
TalendGridItem PreviewItem = new TalendGridItem(this, SWT.NONE);
for (int i = 0; i < this.getColumnCount(); i++) {
PreviewItem.setCheckable(i, false);
}
// $NON-NLS-1$
PreviewItem.setText(DefaultMessagesImpl.getString("ColumnPreviewGrid.PreviewItemLabel"));
processNodePrivew(null, PreviewItem);
PreviewItem.setExpanded(true);
} catch (SQLException e) {
}
}
use of org.eclipse.nebula.widgets.grid.TalendGridItem in project tdq-studio-se by Talend.
the class ColumnPreviewGrid method processNodePrivew.
/**
* DOC talend Comment method "processNodePrivew".
*
* @param object
* @param previewItem
* @throws SQLException
*/
private void processNodePrivew(Object object, GridItem parentItem) throws SQLException {
if (!checkSameTable()) {
return;
}
for (int j = 0; j < limitNumber; j++) {
TalendGridItem currentItem = new TalendGridItem(parentItem, SWT.NONE);
currentItem.setCheckable(0, false);
currentItem.setCheckable(1, false);
for (int i = 2; i < this.getColumnCount(); i++) {
GridColumn column = getColumn(i);
currentItem.setCheckable(i, false);
String columnValue = getColumnValue(i - 2, currentItem);
if (columnValue == null) {
this.remove(this.indexOf(currentItem));
return;
}
int minWith = columnValue.length() * 7 > 100 ? 100 : columnValue.length() * 7;
column.setWidth(COLUMN_WIDTH < minWith ? minWith : COLUMN_WIDTH);
currentItem.setText(i, columnValue);
}
}
}
use of org.eclipse.nebula.widgets.grid.TalendGridItem 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);
}
}
Aggregations