feat: FormView
This commit is contained in:
parent
bc99e561b5
commit
1f9ae9483b
2 changed files with 35 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
package com.application.munera.views;
|
||||
|
||||
import com.application.munera.views.expenses.ExpensesView;
|
||||
import com.application.munera.views.expenses.FormView;
|
||||
import com.vaadin.flow.component.applayout.AppLayout;
|
||||
import com.vaadin.flow.component.applayout.DrawerToggle;
|
||||
import com.vaadin.flow.component.html.Footer;
|
||||
|
@ -51,6 +52,7 @@ public class MainLayout extends AppLayout {
|
|||
SideNav nav = new SideNav();
|
||||
|
||||
nav.addItem(new SideNavItem("Expenses", ExpensesView.class, LineAwesomeIcon.COLUMNS_SOLID.create()));
|
||||
nav.addItem(new SideNavItem("Form", FormView.class, LineAwesomeIcon.COLUMNS_SOLID.create()));
|
||||
|
||||
return nav;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.application.munera.views.expenses;
|
||||
|
||||
import com.vaadin.flow.component.formlayout.FormLayout;
|
||||
import com.vaadin.flow.component.html.Div;
|
||||
import com.vaadin.flow.component.textfield.PasswordField;
|
||||
import com.vaadin.flow.router.Route;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@Route("form")
|
||||
public class FormView extends Div {
|
||||
|
||||
public FormView() {
|
||||
TextField firstName = new TextField("First name");
|
||||
TextField lastName = new TextField("Last name");
|
||||
TextField username = new TextField("Username");
|
||||
PasswordField password = new PasswordField("Password");
|
||||
PasswordField confirmPassword = new PasswordField("Confirm password");
|
||||
|
||||
FormLayout formLayout = new FormLayout();
|
||||
formLayout.add(password);
|
||||
formLayout.setResponsiveSteps(
|
||||
// Use one column by default
|
||||
new com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep("0", 1),
|
||||
// Use two columns, if layout's width exceeds 500px
|
||||
new com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep("500px", 2));
|
||||
// Stretch the username field over 2 columns
|
||||
formLayout.setColspan(password, 2);
|
||||
|
||||
add(formLayout);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue