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