PL-7530 SearchPickerField must have a default input prompt

This commit is contained in:
Maxim Gorbunkov 2016-07-13 16:56:03 +04:00
parent 4f86a0bee0
commit df34716228
2 changed files with 6 additions and 5 deletions

View File

@ -55,11 +55,6 @@ public class SearchPickerFieldLoader extends SearchFieldLoader {
if (StringUtils.isNotEmpty(minSearchStringLength)) { if (StringUtils.isNotEmpty(minSearchStringLength)) {
searchPickerField.setMinSearchStringLength(Integer.parseInt(minSearchStringLength)); searchPickerField.setMinSearchStringLength(Integer.parseInt(minSearchStringLength));
} }
if (StringUtils.isEmpty(searchPickerField.getInputPrompt())) {
Messages messages = AppBeans.get(Messages.class);
searchPickerField.setInputPrompt(messages.getMainMessage("searchPickerField.inputPrompt"));
}
} }
@Override @Override

View File

@ -18,6 +18,8 @@
package com.haulmont.cuba.web.gui.components; package com.haulmont.cuba.web.gui.components;
import com.haulmont.chile.core.model.MetaClass; import com.haulmont.chile.core.model.MetaClass;
import com.haulmont.cuba.core.global.AppBeans;
import com.haulmont.cuba.core.global.Messages;
import com.haulmont.cuba.gui.components.Action; import com.haulmont.cuba.gui.components.Action;
import com.haulmont.cuba.gui.components.Frame; import com.haulmont.cuba.gui.components.Frame;
import com.haulmont.cuba.gui.components.SearchPickerField; import com.haulmont.cuba.gui.components.SearchPickerField;
@ -27,6 +29,7 @@ import com.vaadin.data.Property;
import com.vaadin.ui.ComboBox; import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Component; import com.vaadin.ui.Component;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -48,6 +51,9 @@ public class WebSearchPickerField extends WebSearchField implements SearchPicker
}; };
pickerField = new WebPickerField(picker); pickerField = new WebPickerField(picker);
Messages messages = AppBeans.get(Messages.class);
setInputPrompt(messages.getMainMessage("searchPickerField.inputPrompt"));
// Required for custom components in fieldgroup // Required for custom components in fieldgroup
initValueSync(selectComponent, picker); initValueSync(selectComponent, picker);
} }