Search in sources :

Example 1 with DataEntityUnit

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);
}
Also used : DataEntityUnit(org.talend.mdm.repository.core.datacontent.DataEntityUnit)

Example 2 with DataEntityUnit

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);
}
Also used : DataEntityUnit(org.talend.mdm.repository.core.datacontent.DataEntityUnit)

Example 3 with DataEntityUnit

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());
}
Also used : DataEntityUnit(org.talend.mdm.repository.core.datacontent.DataEntityUnit) ICheckStateProvider(org.eclipse.jface.viewers.ICheckStateProvider) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) ITableLabelProvider(org.eclipse.jface.viewers.ITableLabelProvider) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent)

Example 4 with DataEntityUnit

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();
    }
}
Also used : DataEntityUnit(org.talend.mdm.repository.core.datacontent.DataEntityUnit) Point(org.eclipse.swt.graphics.Point)

Aggregations

DataEntityUnit (org.talend.mdm.repository.core.datacontent.DataEntityUnit)4 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)1 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)1 ICheckStateProvider (org.eclipse.jface.viewers.ICheckStateProvider)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 ITableLabelProvider (org.eclipse.jface.viewers.ITableLabelProvider)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 Point (org.eclipse.swt.graphics.Point)1