if (model != null) {
TransformerUI ui = model.getSelectedTransformerUI();
if (ui != null && model.isAttributeTransformerUI(ui)) {
//Ranking
Function selectedColumn = model.getSelectedFunction();
attibuteBox.removeItemListener(attributeListener);
comboBoxModel.addElement(NO_SELECTION);
comboBoxModel.setSelectedItem(NO_SELECTION);
List<Function> rows = new ArrayList<Function>();
rows.addAll(model.getFunctions());
Collections.sort(rows, new Comparator<Function>() {
@Override
public int compare(Function o1, Function o2) {
return o1.getUI().getDisplayName().compareTo(o2.getUI().getDisplayName());
}
});
for (Function r : rows) {
comboBoxModel.addElement(r);
if (selectedColumn != null && selectedColumn.equals(r)) {
comboBoxModel.setSelectedItem(r);
}
}
attributeListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (model != null) {
if (!attibuteBox.getSelectedItem().equals(NO_SELECTION)) {
Function selectedItem = (Function) attibuteBox.getSelectedItem();
controller.setSelectedFunction(selectedItem);
} else {
controller.setSelectedFunction(null);
}
}