本文整理汇总了Java中com.vaadin.ui.TextField.addTextChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.addTextChangeListener方法的具体用法?Java TextField.addTextChangeListener怎么用?Java TextField.addTextChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.TextField
的用法示例。
在下文中一共展示了TextField.addTextChangeListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addStringFilters
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
/**
* Ajoute un filtre en TextField sur une liste de colonnes
*
* @param filterRow
* @param container
* @param propertys
*/
private void addStringFilters(String... propertys) {
for (String property : propertys) {
HeaderCell cell = getFilterCell(property);
TextField filterField = new TextField();
filterField.setImmediate(true);
filterField.setWidth(100, Unit.PERCENTAGE);
filterField.addStyleName(ValoTheme.TEXTFIELD_TINY);
filterField.setInputPrompt(applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()));
filterField.addTextChangeListener(change -> {
// Can't modify filters so need to replace
container.removeContainerFilters(property);
// (Re)create the filter if necessary
if (!change.getText().isEmpty()) {
container.addContainerFilter(new InsensitiveStringFilter(property, change.getText()));
}
fireFilterListener();
});
cell.setComponent(filterField);
}
}
示例2: addFileNameLayout
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private void addFileNameLayout(final Item newItem, final String baseSoftwareModuleNameVersion,
final String customFileName, final String itemId) {
final HorizontalLayout horizontalLayout = new HorizontalLayout();
final TextField fileNameTextField = createTextField(
baseSoftwareModuleNameVersion + "/" + customFileName + "/customFileName");
fileNameTextField.setData(baseSoftwareModuleNameVersion + "/" + customFileName);
fileNameTextField.setValue(customFileName);
newItem.getItemProperty(FILE_NAME).setValue(fileNameTextField.getValue());
final Label warningIconLabel = getWarningLabel();
warningIconLabel.setId(baseSoftwareModuleNameVersion + "/" + customFileName + "/icon");
setWarningIcon(warningIconLabel, fileNameTextField.getValue(), itemId);
newItem.getItemProperty(WARNING_ICON).setValue(warningIconLabel);
horizontalLayout.addComponent(fileNameTextField);
horizontalLayout.setComponentAlignment(fileNameTextField, Alignment.MIDDLE_LEFT);
horizontalLayout.addComponent(warningIconLabel);
horizontalLayout.setComponentAlignment(warningIconLabel, Alignment.MIDDLE_RIGHT);
newItem.getItemProperty(FILE_NAME_LAYOUT).setValue(horizontalLayout);
fileNameTextField.addTextChangeListener(event -> onFileNameChange(event, warningIconLabel, newItem));
}
示例3: createNameTextField
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private TextField createNameTextField() {
final TextField nameField = new TextFieldBuilder().caption(i18n.getMessage("textfield.customfiltername"))
.prompt(i18n.getMessage("textfield.customfiltername")).immediate(true)
.id(UIComponentIdProvider.CUSTOM_FILTER_ADD_NAME).buildTextComponent();
nameField.setPropertyDataSource(nameLabel);
nameField.addTextChangeListener(this::onFilterNameChange);
return nameField;
}
示例4: createKeyTextField
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private TextField createKeyTextField() {
final TextField keyField = new TextFieldBuilder().caption(i18n.getMessage("textfield.key")).required(true)
.prompt(i18n.getMessage("textfield.key")).immediate(true)
.id(UIComponentIdProvider.METADATA_KEY_FIELD_ID).maxLengthAllowed(MetaData.KEY_MAX_SIZE)
.buildTextComponent();
keyField.addTextChangeListener(this::onKeyChange);
keyField.setTextChangeEventMode(TextChangeEventMode.EAGER);
keyField.setWidth("100%");
return keyField;
}
示例5: createSearchField
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
/**
* Create a search text field.
*
* @param textChangeListener
* listener when text is changed.
* @return the textfield
*/
public TextField createSearchField(final TextChangeListener textChangeListener) {
final TextField textField = style("filter-box").styleName("text-style filter-box-hide").buildTextComponent();
textField.setWidth(100.0F, Unit.PERCENTAGE);
textField.addTextChangeListener(textChangeListener);
textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
// 1 seconds timeout.
textField.setTextChangeTimeout(1000);
return textField;
}
示例6: setManufacturerFilter
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
/**
* @param filterRow
*/
private void setManufacturerFilter(HeaderRow filterRow) {
HeaderCell manufacturerFilter = filterRow.getCell(MANUFACTURER);
TextField textField = new TextField();
textField.setImmediate(true);
// On Change of text, trigger filter operation
textField.addTextChangeListener(getManufacturingFilterListener());
manufacturerFilter.setComponent(textField);
}
示例7: buildFilter
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private Component buildFilter() {
final TextField filter = new TextField();
filter.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(final TextChangeEvent event) {
Filterable data = (Filterable) table.getContainerDataSource();
data.removeAllContainerFilters();
data.addContainerFilter(new Filter() {
@Override
public boolean passesFilter(final Object itemId,
final Item item) {
if (event.getText() == null
|| event.getText().equals("")) {
return true;
}
return filterByProperty("country", item,
event.getText())
|| filterByProperty("city", item,
event.getText())
|| filterByProperty("title", item,
event.getText());
}
@Override
public boolean appliesToProperty(final Object propertyId) {
if (propertyId.equals("country")
|| propertyId.equals("city")
|| propertyId.equals("title")) {
return true;
}
return false;
}
});
}
});
filter.setInputPrompt("Filter");
filter.setIcon(FontAwesome.SEARCH);
filter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
filter.addShortcutListener(new ShortcutListener("Clear",
KeyCode.ESCAPE, null) {
@Override
public void handleAction(final Object sender, final Object target) {
filter.setValue("");
((Filterable) table.getContainerDataSource())
.removeAllContainerFilters();
}
});
return filter;
}