本文整理汇总了Java中com.vaadin.ui.TextField.setSizeFull方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.setSizeFull方法的具体用法?Java TextField.setSizeFull怎么用?Java TextField.setSizeFull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.TextField
的用法示例。
在下文中一共展示了TextField.setSizeFull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例3: getTargetComponent
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
@Override
public Component getTargetComponent() {
final TextField textField = new TextField();
textField.setSizeFull();
textField.setValue("Copy to clipboard textfield value....");
textField.setId("tocopie-textfield");
return textField;
}
示例4: 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);
}
示例5: 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));
}
}
示例6: showAddProjectDialog
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
/**
* Zeige das Projekt-Hinzufuegen-Dialogfenster, bei dem ein Eingabefeld fuer
* den Namen des Projekts und ein Hinzfuege-Button vorhanden ist. Funktion
* bei geklicktem Button siehe Clicklistener in dieser Klasse. Das
* horizontale Layout zur Darstellung besitzt ein Formlayout und den Button,
* die nebeneinander dargestellt werden.
*
* @author Christian Scherer, Mirko Göpfrich
*/
@Override
public void showAddProjectDialog() {
addDialog = new Window("Projekt hinzufügen");
addDialog.setModal(true);
addDialog.setWidth(410, UNITS_PIXELS);
addDialog.setResizable(false);
addDialog.setDraggable(false);
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(false);
FormLayout formLayout = new FormLayout();
formLayout.setMargin(true);
formLayout.setSpacing(true);
//TextFeld für Name dem Formular hinzufügen
tfName = new TextField("Name wählen:");
tfName.setRequired(true);
tfName.addValidator(new StringLengthValidator(
"Der Projektname muss zwischen 2 und 20 Zeichen lang sein.", 2,
20, false));
tfName.setRequiredError("Pflichtfeld");
tfName.setSizeFull();
formLayout.addComponent(tfName);
//TextArea für Beschreibung dem Formular hinzufügen
taDescription = new TextArea("Beschreibung wählen");
taDescription.setSizeFull();
formLayout.addComponent(taDescription);
//Formular dem Layout hinzufügen
layout.addComponent(formLayout);
//Hinzufüge-Button erstllen und dem Layout hinzufügen
dialogAddBtn = new Button("Hinzufügen", this);
layout.addComponent(dialogAddBtn);
//Layout dem Dialog-Fenster hinzufügen
addDialog.addComponent(layout);
//Dialog dem Hauptfenster hinzufügen
getWindow().addWindow(addDialog);
logger.debug("Hinzufuege-Dialog erzeugt");
}
示例7: showEditProjectDialog
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
/**Methode zur Implementierung des Dialogfensters für Projekt-Änderungen.
*
*/
@Override
public void showEditProjectDialog(Project project) {
editDialog = new Window("Projekt bearbeiten");
editDialog.setModal(true);
editDialog.setWidth(410, UNITS_PIXELS);
editDialog.setResizable(false);
editDialog.setDraggable(false);
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
FormLayout formLayout = new FormLayout();
formLayout.setMargin(true);
formLayout.setSpacing(true);
//TextFeld für Name dem Formular hinzufügen
tfName = new TextField("Name ändern:", project.getName());
tfName.setRequired(true);
tfName.addValidator(new StringLengthValidator(
"Der Projektname muss zwischen 2 und 20 Zeichen lang sein.", 2,
20, false));
tfName.setRequiredError("Pflichtfeld");
tfName.setSizeFull();
formLayout.addComponent(tfName);
//TextArea für Beschreibung dem Formular hinzufügen
taDescription = new TextArea("Beschreibung ändern:", project.getDescription());
taDescription.setSizeFull();
formLayout.addComponent(taDescription);
//Formular dem Layout hinzufügen
layout.addComponent(formLayout);
//Speichern-Button erstllen und dem Layout hinzufügen
//TODO: ist das korrekt? Gute Frage, I have no idea what u r doing
dialogEditBtn = new Button("Speichern");
layout.addComponent(dialogEditBtn);
dialogEditBtn.addListener(new Button.ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
if (tfName.isValid()) {
boolean succed = presenter.editProject(projects.get(indexEditBtn), (String) tfName.getValue(), (String) taDescription.getValue());
if (succed) {
getWindow().removeWindow(editDialog);
logger.debug("Projekt-bearbeiten Dialog geschlossen");
}
} else {
getWindow().showNotification(
"",
"Projektname ist ein Pflichtfeld. Bitte geben Sie einen Projektnamen an",
Notification.TYPE_ERROR_MESSAGE);
}
}
});
//Layout dem Dialog-Fenster hinzufügen
editDialog.addComponent(layout);
//Dialog dem Hauptfenster hinzufügen
getWindow().addWindow(editDialog);
logger.debug("Bearbeiten-Dialog erzeugt");
}