use of org.talend.mdm.repository.core.datacontent.DataEntityUnit in project tmdm-studio-se by Talend.
the class DataProcessRuleDialog method enableButtons.
private void enableButtons() {
DataEntityUnit curSelectedUnit = getCurSelectedUnit();
if (curSelectedUnit == null) {
return;
}
List<DataEntityUnit> entityUnits = rule.getEntityUnits();
upBun.setEnabled(entityUnits.get(0) != curSelectedUnit);
downBun.setEnabled(entityUnits.get(entityUnits.size() - 1) != curSelectedUnit);
}
use of org.talend.mdm.repository.core.datacontent.DataEntityUnit in project tmdm-studio-se by Talend.
the class DataProcessRuleDialog method updateSelectAllBun.
private void updateSelectAllBun() {
boolean selectAll = true;
for (DataEntityUnit unit : rule.getEntityUnits()) {
if (!unit.isSelected()) {
selectAll = false;
break;
}
}
selectAllBun.setSelection(selectAll);
}
use of org.talend.mdm.repository.core.datacontent.DataEntityUnit in project tmdm-studio-se by Talend.
the class DataProcessRuleDialog method initTableViewer.
private void initTableViewer() {
tableViewer.setLabelProvider(new TableLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.setCheckStateProvider(new ICheckStateProvider() {
public boolean isGrayed(Object element) {
return false;
}
public boolean isChecked(Object element) {
if (element instanceof DataEntityUnit) {
return ((DataEntityUnit) element).isSelected();
}
return false;
}
});
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
enableButtons();
}
});
tableViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
DataEntityUnit unit = (DataEntityUnit) event.getElement();
unit.setSelected(event.getChecked());
updateSelectAllBun();
updateOKButton();
}
});
//
tableViewer.setInput(rule.getEntityUnits());
}
use of org.talend.mdm.repository.core.datacontent.DataEntityUnit in project tmdm-studio-se by Talend.
the class DataProcessRuleDialog method moveUnit.
private void moveUnit(boolean up) {
DataEntityUnit curSelectedUnit = getCurSelectedUnit();
if (curSelectedUnit == null) {
return;
}
List<DataEntityUnit> units = rule.getEntityUnits();
int index = units.indexOf(curSelectedUnit);
int newIndex = -1;
if (index >= 0) {
if (up) {
newIndex = index - 1;
} else {
newIndex = index + 1;
}
DataEntityUnit bakUnit = units.get(newIndex);
units.set(newIndex, curSelectedUnit);
units.set(index, bakUnit);
tableViewer.refresh();
enableButtons();
}
}
Aggregations