本文整理汇总了Java中com.vaadin.ui.ComboBox.addValueChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.addValueChangeListener方法的具体用法?Java ComboBox.addValueChangeListener怎么用?Java ComboBox.addValueChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.ComboBox
的用法示例。
在下文中一共展示了ComboBox.addValueChangeListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildCombBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
* @return a new ComboBox
*/
public ComboBox buildCombBox() {
final ComboBox targetFilter = SPUIComponentProvider.getComboBox(null, "", null, ValoTheme.COMBOBOX_SMALL, false,
"", prompt);
targetFilter.setImmediate(true);
targetFilter.setPageLength(7);
targetFilter.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
targetFilter.setSizeUndefined();
if (id != null) {
targetFilter.setId(id);
}
if (valueChangeListener != null) {
targetFilter.addValueChangeListener(valueChangeListener);
}
return targetFilter;
}
示例2: addComboBoxFilters
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
* Ajoute un filtre en combobox String sur une colonne
*
* @param property
* @param cb
*/
public void addComboBoxFilters(String property, ComboBox cb, String libNull) {
HeaderCell cell = getFilterCell(property);
cb.addValueChangeListener(e -> {
container.removeContainerFilters(property);
if (cb.getValue() != null && !((String) cb.getValue()).isEmpty()
&& !((String) cb.getValue()).equals(libNull)) {
container.addContainerFilter(new SimpleStringFilter(property, (String) cb.getValue(), true, true));
} else if (cb.getValue() != null && !((String) cb.getValue()).isEmpty()
&& ((String) cb.getValue()).equals(libNull)) {
container.addContainerFilter(new IsNull(property));
}
fireFilterListener();
fireFilterListener();
});
cb.setImmediate(true);
cb.setWidth(100, Unit.PERCENTAGE);
cb.addStyleName(ValoTheme.COMBOBOX_TINY);
cell.setComponent(cb);
}
示例3: createThemeChooserBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox createThemeChooserBox() {
List<String> themes = Arrays.asList("Blueprint", "Dark", "Default", "Facebook", "Flat",
"Flat-Dark", "Light", "Metro");
ComboBox comboBox = new ComboBox("Choose theme", themes);
comboBox.setWidth(100, Unit.PERCENTAGE);
comboBox.setValue("Default");
comboBox.addValueChangeListener(e -> {
Object value = e.getValue();
String theme = value != null ? String.valueOf(value) : "";
if (!"".equals(theme.trim())) {
getUI().setTheme(theme.toLowerCase());
}
});
return comboBox;
}
示例4: getLogLevelComponent
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
protected ComboBox getLogLevelComponent() {
final ComboBox combo = new ComboBox("Log Level");
combo.setNullSelectionAllowed(false);
combo.setWidth(200, Unit.PIXELS);
LogLevel[] levels = LogLevel.values();
for (LogLevel logLevel : levels) {
combo.addItem(logLevel.name());
}
combo.setValue(agentDeployment.getLogLevel());
combo.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
agentDeployment.setLogLevel((String) combo.getValue());
saveAgentDeployment(agentDeployment);
}
});
return combo;
}
示例5: buildSelection
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private void buildSelection() {
exportSelectionType = new ComboBox();
exportSelectionType.setTextInputAllowed(false);
exportSelectionType.setNullSelectionAllowed(false);
exportSelectionType.setEnabled(false);
exportSelectionType.addItem(Messages.getString("Caption.Item.Selected"));
exportSelectionType.addItem(Messages.getString("Caption.Item.All"));
exportSelectionType.select(Messages.getString("Caption.Item.Selected"));
exportSelectionType.addValueChangeListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
allTestsSelected = exportSelectionType.getValue().equals(Messages.getString("Caption.Item.All"));
mainEvent.fire(new MainUIEvent.PackSelectionChangedEvent());
}
});
}
示例6: buildSelection
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected ComboBox buildSelection() {
final ComboBox selectionType = new ComboBox();
selectionType.setTextInputAllowed(false);
selectionType.setNullSelectionAllowed(false);
selectionType.addItem(Messages.getString("Caption.Item.Selected"));
selectionType.addItem(Messages.getString("Caption.Item.All"));
selectionType.select(Messages.getString("Caption.Item.Selected"));
selectionType.addValueChangeListener(e -> {
allSelected = selectionType.getValue().equals(Messages.getString("Caption.Item.All"));
mainEvent.fire(new MainUIEvent.UserSelectionChangedEvent());
});
return selectionType;
}
示例7: buildSelection
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected ComboBox buildSelection() {
final ComboBox selectionType = new ComboBox();
selectionType.setTextInputAllowed(false);
selectionType.setNullSelectionAllowed(false);
selectionType.addItem(Messages.getString("Caption.Item.Selected"));
selectionType.addItem(Messages.getString("Caption.Item.All"));
selectionType.select(Messages.getString("Caption.Item.Selected"));
selectionType.addValueChangeListener(e -> {
allSelected = selectionType.getValue().equals(Messages.getString("Caption.Item.All"));
mainEvent.fire(new MainUIEvent.GroupSelectionChangedEvent());
});
return selectionType;
}
示例8: addParentHandler
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private void addParentHandler(final ComboBox parent, final EntityContainer<E> childContainer,
final SingularAttribute<E, Parent> childForeignAttribute)
{
parent.addValueChangeListener(new ValueChangeListener()
{
private static final long serialVersionUID = 1L;
@Override
public void valueChange(com.vaadin.data.Property.ValueChangeEvent event)
{
@SuppressWarnings("unchecked")
Parent parentEntity = ((Parent) parent.getConvertedValue());
childContainer.removeAllContainerFilters();
childContainer.addContainerFilter(new Compare.Equal(childForeignAttribute.getName(), parentEntity));
DependantComboBox.this.setContainerDataSource(childContainer);
DependantComboBox.this.setValue(null);
}
});
}
示例9: createStepperTypeBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox createStepperTypeBox() {
List<String> stepperTypes = Arrays.asList("Horizontal", "Vertical");
ComboBox comboBox = new ComboBox("Stepper Type *", stepperTypes);
comboBox.setWidth(100, Unit.PERCENTAGE);
comboBox.setValue(stepperTypes.get(0));
comboBox.addValueChangeListener(event -> {
createStepper();
fireEvent(new StepperCreateEvent(StepperPropertiesLayout.this, stepper));
});
return comboBox;
}
示例10: createIconStyleBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox createIconStyleBox() {
List<String> iconStyles = Arrays.asList("Square", "Circular");
ComboBox comboBox = new ComboBox("Choose Icon Style", iconStyles);
comboBox.setWidth(100, Unit.PERCENTAGE);
comboBox.setValue("Circular");
comboBox.addValueChangeListener(event -> updateStepperIconStyles());
return comboBox;
}
示例11: setup
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private void setup() {
// Devices
ComboBox devicesComboBox = new ComboBox("Actors");
devicesComboBox.setNullSelectionItemId(false);
devicesComboBox.setContainerDataSource(
new BeanItemContainer<>(
DeviceViewDTO.class,
deviceSetupService.getAllActors().stream()
.map(deviceDTO -> modelMapper.map(deviceDTO, DeviceViewDTO.class))
.collect(Collectors.toList())
)
);
DeviceDTO selectedDeviceDTO = deviceSetupService
.getDeviceDtoByIdAndType(actionDTO.getDevId(), actionDTO.getDevType());
if (selectedDeviceDTO != null) {
devicesComboBox.select(modelMapper.map(selectedDeviceDTO, DeviceViewDTO.class));
}
devicesComboBox.addValueChangeListener(event -> {
DeviceViewDTO selected = (DeviceViewDTO) event.getProperty().getValue();
actionDTO.setDevId(selected.getDevId());
actionDTO.setDevType(selected.getType());
changeListener.accept(actionDTO);
});
mainLayout.addComponent(devicesComboBox);
// Target
TextField targetTextField = new TextField("Target", actionDTO.getParameter());
targetTextField.addValueChangeListener(event -> {
actionDTO.setParameter((String) event.getProperty().getValue());
changeListener.accept(actionDTO);
});
mainLayout.addComponent(targetTextField);
}
示例12: setCategoryFilter
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
* @param filterRow
* @return
*/
private HeaderCell setCategoryFilter(HeaderRow filterRow) {
HeaderCell categoryFilter = filterRow.getCell(CATEGORY);
ComboBox comboBox = new ComboBox();
comboBox.setHeight(100, Unit.PERCENTAGE);
comboBox.setImmediate(true);
comboBox.setNewItemsAllowed(false);
comboBox.setTextInputAllowed(false);
comboBox.addValueChangeListener(getCategoryFilterListener());
comboBox.setContainerDataSource(getCategoryDataSource());
categoryFilter.setComponent(comboBox);
return categoryFilter;
}
示例13: buildQuoteSelector
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private Component buildQuoteSelector() {
quoteSelector = new ComboBox();
// quoteSelector.setInputPrompt("Select Stock/Index...");
// quoteSelector.setItemCaptionPropertyId(Quote.PROPERTY_NAME);
// quoteSelector.setItemCaptionMode(ItemCaptionMode.PROPERTY);
// Set full width
// quoteSelector.setWidth(100.0f, Unit.PERCENTAGE);
quoteSelector.addStyleName("borderless");
// Set the appropriate filtering mode for this example
quoteSelector.setFilteringMode(FilteringMode.CONTAINS);
quoteSelector.setImmediate(true);
// Disallow null selections
quoteSelector.setNullSelectionAllowed(false);
quoteSelector.addValueChangeListener(e -> {
chart.setChartSymbol(quotes.getItem(e.getProperty().getValue()).getBean().getChartSrc());
ticker.setSymbol(quotes.getItem(e.getProperty().getValue()).getBean().getTickerSrc());
chartToolbar.getCharts().getChildren().get(LiveChart.ChartDrawType.LINE.ordinal()*2).setChecked(false);
chartToolbar.getCharts().getChildren().get(LiveChart.ChartDrawType.CANDLE.ordinal()*2).setChecked(true);
});
return quoteSelector;
}
示例14: getStartTypeComponent
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
protected ComboBox getStartTypeComponent() {
startTypeCombo = new ComboBox("Start Type");
startTypeCombo.setWidth(200, Unit.PIXELS);
startTypeCombo.setNullSelectionAllowed(false);
StartType[] values = StartType.values();
for (StartType value : values) {
startTypeCombo.addItem(value.name());
}
startTypeCombo.setValue(agentDeployment.getStartType());
startTypeCombo.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
agentDeployment.setStartType((String) startTypeCombo.getValue());
updateScheduleEnable();
for (int i = 0; i < 7; i++) {
ListSelect listSelect = ((ListSelect) cronLayout.getComponent(i));
for (Object itemId : listSelect.getItemIds()) {
listSelect.unselect(itemId);
}
listSelect.select(listSelect.getItemIds().iterator().next());
}
String startExpression = null;
if (agentDeployment.getStartType().equals(StartType.SCHEDULED_CRON.name())) {
startExpression = "0 0 0 * * ?";
}
startExpressionTextField.setValue(startExpression);
agentDeployment.setStartExpression(startExpression);
updateScheduleFields();
saveAgentDeployment(agentDeployment);
}
});
return startTypeCombo;
}
示例15: buildGrid
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
protected void buildGrid() {
grid = new Grid();
grid.setSelectionMode(SelectionMode.NONE);
grid.setSizeFull();
grid.setEditorEnabled(!readOnly);
container = new BeanItemContainer<Record>(Record.class);
grid.setContainerDataSource(container);
grid.setColumns("entityName", "attributeName", "xpath");
HeaderRow filterRow = grid.appendHeaderRow();
addColumn("entityName", filterRow);
addColumn("attributeName", filterRow);
ComboBox combo = new ComboBox();
combo.addValueChangeListener(e->saveXPathSettings());
combo.setWidth(100, Unit.PERCENTAGE);
combo.setImmediate(true);
combo.setNewItemsAllowed(true);
combo.setInvalidAllowed(true);
combo.setTextInputAllowed(true);
combo.setScrollToSelectedItem(true);
combo.setFilteringMode(FilteringMode.CONTAINS);
grid.getColumn("xpath").setEditorField(combo).setExpandRatio(1);
addShowPopulatedFilter("xpath", filterRow);
grid.setEditorBuffered(false);
addComponent(grid);
setExpandRatio(grid, 1);
}