private void initializeListboxProgressTypes() { if (cbProgressTypes == null) { cbProgressTypes = (Combobox) planner.getFellow("cbProgressTypes"); } if (btnShowAdvances == null) { btnShowAdvances = (Button) planner.getFellow("showAdvances"); } cbProgressTypes.setModel(new ListModelList(ProgressType.getAll())); cbProgressTypes.setItemRenderer(new ProgressTypeRenderer()); // Update completion of tasks on selecting new progress type cbProgressTypes.addEventListener(Events.ON_SELECT, new EventListener() { @Override public void onEvent(Event event) { planner.forcedShowAdvances(); planner.updateCompletion(getSelectedProgressType().toString()); } private ProgressType getSelectedProgressType() { return (ProgressType) cbProgressTypes.getSelectedItem().getValue(); } }); cbProgressTypes.setVisible(true); ProgressType progressType = getProgressTypeFromConfiguration(); if (progressType != null) { planner.updateCompletion(progressType.toString()); } }
@Override public void render(Comboitem item, Object data) { final ProgressType progressType = (ProgressType) data; item.setValue(progressType); item.setLabel(_(progressType.getValue())); ProgressType configuredProgressType = getProgressTypeFromConfiguration(); if ((configuredProgressType != null) && configuredProgressType.equals(progressType)) { cbProgressTypes.setSelectedItem(item); } }