public void initCmbValues(Component comp) { // first click in panel if (comp != null) { FeatureList featList = new FeatureList(FeatureManager.getDefaultFeatures(comp.getName())); componentName.setText("Component: " + comp.getName()); cmbFeatures.removeAllItems(); for (Feature feat : featList.getFeatureList()) { cmbFeatures.addItem(feat.getName()); } renewCmbValues(comp); unlockComponents(); } }
public void renewCmbValues(Component comp) { // call when an item state changes in Cmb DBFeatureValues values = null; if (comp != null && cmbFeatures.getSelectedItem() != null) { // try{ values = FeatureManager.getFeatureValues(comp.getName(), cmbFeatures.getSelectedItem().toString()); // }catch(Exception e){} unlockComponents(); // remove listeners first so that changing the values in combo box will not trigger saves removeCmbValuesListeners(); cmbValues.removeAllItems(); if (values != null) { for (String value : values.getValues()) { cmbValues.addItem(value); } cmbValues.setSelectedItem( comp.getFeature(cmbFeatures.getSelectedItem().toString()).getValue()); } cmbValues.addItemListener(saveFeatureListener); } }