Ejemplo n.º 1
0
 @Override
 public void listBoxValueChanged(String newValue) {
   if (customPrompt.equals(newValue)) {
     // "Custom..." selected, show textBox with empty value
     setListBoxValue("");
     setTextBoxValue("");
     view.setListBoxVisible(false);
     view.setTextBoxVisible(true);
     view.setTextBoxFocus(true);
   } else if (newValue.startsWith("*")) {
     // Not a valid value
     setListBoxValue("");
     setTextBoxValue("");
   } else if (newValue.startsWith(listBoxValues.getEditPrefix())) {
     // "Edit <value> ..." selected, show textBox with appropriate value
     String value = view.getModelValue();
     setTextBoxValue(value);
     view.setListBoxVisible(false);
     view.setTextBoxVisible(true);
     view.setTextBoxFocus(true);
   } else if (listBoxValues.isCustomValue(newValue)) {
     // A Custom value has been selected
     String textValue = listBoxValues.getValueForDisplayValue(newValue);
     if (quoteStringValues) {
       textValue = StringUtils.createUnquotedConstant(textValue);
     }
     setListBoxValue(newValue);
     setTextBoxValue(textValue);
   } else if (newValue != null) {
     // A non-custom value has been selected
     setListBoxValue(newValue);
     setTextBoxValue("");
   }
   updateListBoxValues(view.getListBoxValue());
 }