当前位置: 首页>>代码示例>>Java>>正文


Java TextField.setValueChangeMode方法代码示例

本文整理汇总了Java中com.vaadin.ui.TextField.setValueChangeMode方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.setValueChangeMode方法的具体用法?Java TextField.setValueChangeMode怎么用?Java TextField.setValueChangeMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.ui.TextField的用法示例。


在下文中一共展示了TextField.setValueChangeMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllMetricsGrid

import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private Grid<MetricsGridRow> getAllMetricsGrid(Map<String, Number> metrics) {
	allMetricsRows = metrics.entrySet().stream()
							.map(MetricsGridRow::new)
							.collect(Collectors.toList());

	Grid<MetricsGridRow> grid = new Grid<>(MetricsGridRow.class);
	grid.removeAllColumns();
	Column<MetricsGridRow, String> nameColumn = grid.addColumn(MetricsGridRow::getName)
															.setCaption("Name")
															.setExpandRatio(1);
	grid.addColumn(MetricsGridRow::getValue).setCaption("Value");

	grid.setItems(allMetricsRows);
	grid.sort(nameColumn);
	grid.setSizeFull();
	grid.setRowHeight(40);

	TextField filterInput = new TextField();
	filterInput.setPlaceholder("filter by metric...");
	filterInput.addValueChangeListener(e -> updateMetrics(e.getValue()));
	filterInput.setValueChangeMode(ValueChangeMode.LAZY);
	filterInput.setSizeFull();

	// Header row
	HeaderRow filterRow = grid.addHeaderRowAt(grid.getHeaderRowCount());
	filterRow.getCell(nameColumn).setComponent(filterInput);

	return grid;
}
 
开发者ID:vianneyfaivre,项目名称:Persephone,代码行数:30,代码来源:MetricsPage.java

示例2: initFilterRow

import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private void initFilterRow(Column<Application, String> appColumn, Column<Application, String> envColumn, Column<Application, String> urlColumn) {
	TextField filterApp = new TextField();
	TextField filterEnv = new TextField();
	TextField filterUrl = new TextField();

	filterApp.setPlaceholder("filter by application...");
	filterApp.addValueChangeListener(e -> updateApplications(e.getValue(), filterEnv.getValue(), filterUrl.getValue()));
	filterApp.setValueChangeMode(ValueChangeMode.LAZY);
	filterApp.focus();
	filterApp.setSizeFull();

	filterEnv.setPlaceholder("filter by environment...");
	filterEnv.addValueChangeListener(e -> updateApplications(filterApp.getValue(), e.getValue(), filterUrl.getValue()));
	filterEnv.setValueChangeMode(ValueChangeMode.LAZY);
	filterEnv.setSizeFull();

	filterUrl.setPlaceholder("filter by URL...");
	filterUrl.addValueChangeListener(e -> updateApplications(filterApp.getValue(), filterEnv.getValue(), e.getValue()));
	filterUrl.setValueChangeMode(ValueChangeMode.LAZY);
	filterUrl.setSizeFull();

	// Header row
	HeaderRow filterRow = grid.addHeaderRowAt(grid.getHeaderRowCount());
	filterRow.getCell(appColumn).setComponent(filterApp);
	filterRow.getCell(envColumn).setComponent(filterEnv);
	filterRow.getCell(urlColumn).setComponent(filterUrl);
}
 
开发者ID:vianneyfaivre,项目名称:Persephone,代码行数:28,代码来源:ApplicationsPage.java

示例3: initGrid

import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private void initGrid() {
	this.grid = new Grid<>(PropertyItem.class);

	this.grid.removeAllColumns();
	Column<PropertyItem, String> propertyColumn = this.grid.addColumn(PropertyItem::getKey)
															.setCaption("Property")
															.setExpandRatio(1);
	Column<PropertyItem, String> valueColumn = this.grid.addColumn(PropertyItem::getValue)
															.setCaption("Value")
															.setExpandRatio(1);
	Column<PropertyItem, String> originColumn = this.grid.addColumn(PropertyItem::getOrigin).setCaption("Origin");

	this.grid.sort(propertyColumn);
	this.grid.setSizeFull();
	this.grid.setRowHeight(40);

	// distinct origin
	List<String> origins = this.currentEnv.getProperties().stream()
												.map(PropertyItem::getOrigin)
												.distinct()
												.sorted(String::compareTo)
												.collect(Collectors.toList());

	// Filters
	TextField filterProperty = new TextField();
	TextField filterValue = new TextField();
	NativeSelect<String> filterOrigin = new NativeSelect<>(null, origins);

	filterProperty.setPlaceholder("filter by key...");
	filterProperty.addValueChangeListener(e -> updateProperties(e.getValue(), filterValue.getValue(), filterOrigin.getValue()));
	filterProperty.setValueChangeMode(ValueChangeMode.LAZY);
	filterProperty.focus();
	filterProperty.setSizeFull();

	filterValue.setPlaceholder("filter by value...");
	filterValue.addValueChangeListener(e -> updateProperties(filterProperty.getValue(), e.getValue(), filterOrigin.getValue()));
	filterValue.setValueChangeMode(ValueChangeMode.LAZY);
	filterValue.setSizeFull();

	filterOrigin.addValueChangeListener(e -> updateProperties(filterProperty.getValue(), filterValue.getValue(), e.getValue()));
	filterOrigin.setSizeFull();

	// Header row
	HeaderRow filterRow = grid.addHeaderRowAt(grid.getHeaderRowCount());
	filterRow.getCell(propertyColumn).setComponent(filterProperty);
	filterRow.getCell(valueColumn).setComponent(filterValue);
	filterRow.getCell(originColumn).setComponent(filterOrigin);
}
 
开发者ID:vianneyfaivre,项目名称:Persephone,代码行数:49,代码来源:PropertiesPage.java

示例4: enter

import com.vaadin.ui.TextField; //导入方法依赖的package包/类
@Override
public void enter(ViewChangeEvent event) {
	pageHelper.setErrorHandler(this);

	this.removeAllComponents();

	// Get application
	int appId = Integer.parseInt(event.getParameters());
	Application app = pageHelper.getApp(appId);

	// Get loggers config
	Optional<Loggers> loggers = getLoggers(app);

	if(loggers.isPresent()) {

		// Display loggers in a grid
		grid = new Grid<>(LoggerGridRow.class);

		grid.removeAllColumns();

		Column<LoggerGridRow, String> nameColumn = grid.addColumn(LoggerGridRow::getName)
																.setCaption("Name")
																.setExpandRatio(2);
		grid.addComponentColumn(logger -> {
			NativeSelect<String> levelsDropdown = new NativeSelect<>(null, loggers.get().getLevels());

			levelsDropdown.setEmptySelectionAllowed(false);
			levelsDropdown.setSelectedItem(logger.getLevel());

			// on selected level
			levelsDropdown.addValueChangeListener(value -> {

				// change logger level
				loggersService.changeLevel(app, logger.getName(), value.getValue());

				// refresh data in grid (several loggers might have been impacted)
				updateLoggers(app);

				Notification.show(
						String.format("Logger %s level changed to %s", logger.getName(), value.getValue())
						, Notification.Type.TRAY_NOTIFICATION);
			});

			return levelsDropdown;
		})	.setCaption("Level")
			.setExpandRatio(1);

		grid.setSizeFull();
		grid.setRowHeight(40);

		grid.setItems(loggersRows);
		grid.sort(nameColumn);

		// Filter grid by logger name
		filterInput = new TextField();
		filterInput.setPlaceholder("filter by logger name...");
		filterInput.addValueChangeListener(e -> filterLoggers(e.getValue()));
		filterInput.setValueChangeMode(ValueChangeMode.LAZY);
		filterInput.focus();
		filterInput.setSizeFull();

		// Header row
		HeaderRow filterRow = grid.addHeaderRowAt(grid.getHeaderRowCount());
		filterRow.getCell(nameColumn).setComponent(filterInput);

		this.addComponent(new PageHeader(app, "Loggers"));
		this.addComponent(new Label("Changing a level will update one/many logger(s) level(s)"));
		this.addComponent(grid);
	} else {
		this.addComponent(new PageHeader(app, "Loggers"));
		this.addComponent(new Label(String.format("Failed to call %s<br />This endpoint is available since Spring Boot 1.5", app.endpoints().loggers()), ContentMode.HTML));
	}
}
 
开发者ID:vianneyfaivre,项目名称:Persephone,代码行数:74,代码来源:LoggersPage.java


注:本文中的com.vaadin.ui.TextField.setValueChangeMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。