Search in sources :

Example 1 with PolicyUnitPanel

use of org.ovirt.engine.ui.webadmin.section.main.view.popup.scheduling.panels.PolicyUnitPanel in project ovirt-engine by oVirt.

the class ClusterPolicyPopupView method updateFilters.

private void updateFilters(NewClusterPolicyModel model) {
    usedFilterPanel.clear();
    PolicyUnitPanel first = null;
    PolicyUnitPanel last = null;
    List<PolicyUnitPanel> list = new ArrayList<>();
    PolicyUnitPanel tempPolicyUnitPanel;
    for (PolicyUnit policyUnit : model.getUsedFilters()) {
        tempPolicyUnitPanel = new PolicyUnitPanel(policyUnit, model, true, model.getClusterPolicy().isLocked(), style);
        Integer position = model.getFilterPositionMap().get(policyUnit.getId());
        if (position == null || position == 0) {
            list.add(tempPolicyUnitPanel);
        } else {
            if (position < 0) {
                first = tempPolicyUnitPanel;
            } else if (position > 0) {
                last = tempPolicyUnitPanel;
            }
            tempPolicyUnitPanel.setPosition(position);
        }
        tempPolicyUnitPanel.initWidget();
    }
    if (first != null) {
        usedFilterPanel.add(first);
    }
    for (PolicyUnitPanel policyUnitPanel : list) {
        usedFilterPanel.add(policyUnitPanel);
    }
    if (last != null) {
        usedFilterPanel.add(last);
    }
    unusedFilterPanel.clear();
    for (PolicyUnit policyUnit : model.getUnusedFilters()) {
        PolicyUnitPanel policyUnitPanel = new PolicyUnitPanel(policyUnit, model, false, model.getClusterPolicy().isLocked(), style);
        unusedFilterPanel.add(policyUnitPanel);
        policyUnitPanel.initWidget();
    }
}
Also used : PolicyUnitPanel(org.ovirt.engine.ui.webadmin.section.main.view.popup.scheduling.panels.PolicyUnitPanel) FunctionPolicyUnitPanel(org.ovirt.engine.ui.webadmin.section.main.view.popup.scheduling.panels.FunctionPolicyUnitPanel) ArrayList(java.util.ArrayList) PolicyUnit(org.ovirt.engine.core.common.scheduling.PolicyUnit)

Aggregations

ArrayList (java.util.ArrayList)1 PolicyUnit (org.ovirt.engine.core.common.scheduling.PolicyUnit)1 FunctionPolicyUnitPanel (org.ovirt.engine.ui.webadmin.section.main.view.popup.scheduling.panels.FunctionPolicyUnitPanel)1 PolicyUnitPanel (org.ovirt.engine.ui.webadmin.section.main.view.popup.scheduling.panels.PolicyUnitPanel)1