* This will do a drop down for enumerated values..
*/
public static Widget enumDropDown(final String currentValue, final ValueChanged valueChanged,
final DropDownData dropData) {
final ListBox box = new ListBox();
final Constants cs = GWT.create(Constants.class);
//if we have to do it lazy, we will hit up the server when the widget gets focus
if (dropData.fixedList == null && dropData.queryExpression != null) {
DeferredCommand.addCommand(new Command() {
public void execute() {
LoadingPopup.showMessage(cs.RefreshingList());
RepositoryServiceFactory.getService().loadDropDownExpression(dropData.valuePairs, dropData.queryExpression, new GenericCallback() {
public void onSuccess(Object data) {
LoadingPopup.close();
String[] list = (String[]) data;
doDropDown(currentValue, list, box);
}
public void onFailure(Throwable t) {
LoadingPopup.close();
//just do an empty drop down...
doDropDown(currentValue, new String[] {cs.UnableToLoadList()}, box);
}
});
}
});