本文整理汇总了Java中com.vaadin.event.FieldEvents.TextChangeEvent类的典型用法代码示例。如果您正苦于以下问题:Java TextChangeEvent类的具体用法?Java TextChangeEvent怎么用?Java TextChangeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextChangeEvent类属于com.vaadin.event.FieldEvents包,在下文中一共展示了TextChangeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getManufacturingFilterListener
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
/**
* Returns the TextChangeListener that gets triggered
*
* @return
*/
private TextChangeListener getManufacturingFilterListener() {
return new TextChangeListener() {
/**
*
*/
private static final long serialVersionUID = -2368474286053602744L;
@Override
public void textChange(TextChangeEvent event) {
String newValue = (String) event.getText();
@SuppressWarnings("unchecked")
BeanItemContainer<VehicleInfo> container = ((BeanItemContainer<VehicleInfo>) grid
.getContainerDataSource());
// This is important, this removes the previous filter that was
// used to filter the container
container.removeContainerFilters(MANUFACTURER);
if (null != newValue && !newValue.isEmpty()) {
container.addContainerFilter(new SimpleStringFilter(
MANUFACTURER, newValue, true, false));
}
grid.recalculateColumnWidths();
}
};
}
示例2: initializeText
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
protected void initializeText() {
this.textAreaComments.setImmediate(true);
this.textAreaComments.addTextChangeListener(new TextChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void textChange(TextChangeEvent event) {
if (event.getText().isEmpty()) {
self.buttonPush.setEnabled(false);
} else {
if (self.container.getConflictCount() == 0) {
self.buttonPush.setEnabled(true);
} else {
self.buttonPush.setEnabled(false);
}
}
}
});
}
示例3: initializeText
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
protected void initializeText() {
//
// Add a validator
//
this.textFieldColumn.addValidator(new IntegerRangeValidator("Please enter an integer greater than or equal to 0.", 0, null));
//
// Respond to text changing to setup the button
//
this.textFieldColumn.addTextChangeListener(new TextChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void textChange(TextChangeEvent event) {
if (event.getText() != null && event.getText().isEmpty() == false) {
self.buttonSave.setEnabled(true);
} else {
self.buttonSave.setEnabled(false);
}
}
});
}
示例4: onFileNameChange
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
private void onFileNameChange(final TextChangeEvent event, final Label warningIconLabel, final Item newItem) {
final String itemId = (String) ((TextField) event.getComponent()).getData();
final String fileName = event.getText();
final Boolean isWarningIconDisplayed = isWarningIcon(warningIconLabel);
setWarningIcon(warningIconLabel, fileName, itemId);
final Long currentSwId = (Long) newItem.getItemProperty(BASE_SOFTWARE_ID).getValue();
final String oldFileName = (String) newItem.getItemProperty(FILE_NAME).getValue();
newItem.getItemProperty(FILE_NAME).setValue(event.getText());
// if warning was displayed prior and not displayed currently
if (isWarningIconDisplayed && !warningIconLabel.isVisible()) {
modifyIconOfSameSwId(itemId, currentSwId, oldFileName);
}
checkDuplicateEntry(itemId, currentSwId, event.getText(), oldFileName);
enableOrDisableUploadBtn();
}
示例5: initSearchField
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
protected void initSearchField() {
HorizontalLayout searchLayout = new HorizontalLayout();
searchLayout.setSpacing(true);
addComponent(searchLayout);
// textfield
searchField = new TextField();
searchField.setInputPrompt(i18nManager.getMessage(Messages.PEOPLE_SEARCH));
searchField.setWidth(180, UNITS_PIXELS);
searchField.focus();
searchLayout.addComponent(searchField);
// Logic to change table according to input
searchField.addListener(new TextChangeListener() {
public void textChange(TextChangeEvent event) {
searchPeople(event.getText());
}
});
initSelectMyselfButton(searchLayout);
}
示例6: buildUI
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
protected void buildUI() {
ButtonBar buttonBar = new ButtonBar();
addComponent(buttonBar);
editor = CommonUiUtils.createAceEditor();
editor.setTextChangeEventMode(TextChangeEventMode.LAZY);
editor.setTextChangeTimeout(200);
editor.setMode(AceMode.text);
editor.setValue(component.get(TextConstant.SETTING_TEXT));
editor.addTextChangeListener(new TextChangeListener() {
public void textChange(TextChangeEvent event) {
Setting data = component.findSetting(TextConstant.SETTING_TEXT);
data.setValue(event.getText());
context.getConfigurationService().save(data);
}
});
addComponent(editor);
setExpandRatio(editor, 1);
}
示例7: buildUI
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
protected void buildUI() {
ButtonBar buttonBar = new ButtonBar();
addComponent(buttonBar);
editor = CommonUiUtils.createAceEditor();
editor.setTextChangeEventMode(TextChangeEventMode.LAZY);
editor.setTextChangeTimeout(200);
editor.setMode(AceMode.xml);
editor.setValue(component.get(Web.BODY_TEXT));
editor.addTextChangeListener(new TextChangeListener() {
public void textChange(TextChangeEvent event) {
component.put(Web.BODY_TEXT, event.getText());
context.getConfigurationService().save(component.findSetting(Web.BODY_TEXT));
}
});
addComponent(editor);
setExpandRatio(editor, 1);
}
示例8: textChange
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
@Override
public void textChange(TextChangeEvent event) {
String newValue = event.getText();
logger.debug("Text Change Event fired in {} with text = {}", NumericQuestion.class.getSimpleName(), newValue);
if (isValid(answerField, newValue)) {
String questionCode = questionDTO.getCode();
Answer answer = null;
if (StringUtils.isEmpty(newValue)) {
answer = NoAnswer.create();
} else {
answer = NumericAnswer.fromValue(Integer.parseInt(newValue));
}
answerSavedEvent.fire(AnswerSavedEvent.with().questionCode(questionCode).answer(answer).build());
answerField.setComponentError(null);
}
}
示例9: AutoCompleteTextField
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
public AutoCompleteTextField()
{
setTextChangeEventMode(TextChangeEventMode.LAZY);
setImmediate(true);
addTextChangeListener(new TextChangeListener()
{
private static final long serialVersionUID = 1L;
@Override
public void textChange(final TextChangeEvent event)
{
options.clear();
if (listener != null)
{
listener.handleQuery(AutoCompleteTextField.this, event.getText());
}
if (!options.isEmpty())
{
createContextMenu();
showOptionMenu();
}
}
});
}
示例10: textChange
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
@Override
public void textChange(TextChangeEvent event) {
String text = "";
if(model instanceof Tool) {
if(isId) {
text = ((Tool) model).getTitleId(event.getText());
} else {
text = ((Tool) model).getTitleDisplayName(event.getText());
}
model.getToolEditor().getToolEditorUI().getTreeToolEditor().updateToolTitle(text);
} else {
if(!isId && (model.getId() != null && !model.getId().isEmpty())) {
return;
}
if(event.getText().isEmpty() && isId) {
text = getValue(model.getNameValue()) + " " + getValue(model.getTypeValue());
} else {
text = getValue(event.getText()) + " " + getValue(model.getTypeValue());
}
model.getToolEditor().getToolEditorUI().getTreeToolEditor().setItemCaption(model, text);
}
model.setTitleDescriptionValue(text);
}
示例11: initializeTextField
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
protected void initializeTextField() {
//
// Initialize GUI settings
//
this.textFieldFilter.setImmediate(true);
//
// Respond to the text change events
//
this.textFieldFilter.addTextChangeListener(new TextChangeListener() {
private static final long serialVersionUID = 1L;
SimpleStringFilter currentFilter = null;
@Override
public void textChange(TextChangeEvent event) {
//
// Remove current filter
//
if (this.currentFilter != null) {
FunctionSelectionWindow.highOrderFunctions.removeContainerFilter(this.currentFilter);
this.currentFilter = null;
}
//
// Get the text
//
String value = event.getText();
if (value != null && value.length() > 0) {
//
// Add the new filter
//
this.currentFilter = new SimpleStringFilter(PROPERTY_SHORTNAME, value, true, false);
FunctionSelectionWindow.highOrderFunctions.addContainerFilter(this.currentFilter);
}
}
});
}
示例12: initializeTextField
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
protected void initializeTextField() {
this.textFieldSubdomain.setRequired(true);
this.textFieldSubdomain.setRequiredError("Please enter a valid sub domain");
//
// Validate the name entered
//
this.textFieldSubdomain.addValidator(new RegexpValidator(SUBDOMAIN_NAME_PATTERN, true, ERROR_MESSAGE) {
private static final long serialVersionUID = 1L;
});
//
// Respond to events
//
this.textFieldSubdomain.setImmediate(true);
this.textFieldSubdomain.addTextChangeListener(new TextChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void textChange(TextChangeEvent event) {
if (event.getText() != null && event.getText().length() > 0) {
self.buttonSave.setEnabled(true);
} else {
self.buttonSave.setEnabled(false);
}
}
});
}
示例13: onFilterNameChange
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
private void onFilterNameChange(final TextChangeEvent event) {
if (isNameAndQueryEmpty(event.getText(), queryTextField.getValue())
|| (event.getText().equals(oldFilterName) && queryTextField.getValue().equals(oldFilterQuery))) {
saveButton.setEnabled(false);
} else {
if (hasSavePermission()) {
saveButton.setEnabled(true);
}
}
}
示例14: textChange
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
@Override
public void textChange(final TextChangeEvent event) {
super.valueChange(new ValueChangeEvent() {
private static final long serialVersionUID = 1L;
@Override
public Property<String> getProperty() {
return new EventHolder(event);
}
});
}
示例15: removeTextListener
import com.vaadin.event.FieldEvents.TextChangeEvent; //导入依赖的package包/类
private void removeTextListener(final AbstractField<?> field) {
if (!(field instanceof TextChangeNotifier)) {
return;
}
for (final Object listener : field.getListeners(TextChangeEvent.class)) {
if (listener instanceof ChangeListener) {
((TextChangeNotifier) field).removeTextChangeListener((ChangeListener) listener);
}
}
}