當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。