Example usage for com.vaadin.ui Panel setContent

List of usage examples for com.vaadin.ui Panel setContent

Introduction

In this page you can find the example usage for com.vaadin.ui Panel setContent.

Prototype

@Override
public void setContent(Component content) 

Source Link

Document

Sets the content of this container.

Usage

From source file:by.bigvova.views.HomeView.java

License:Apache License

public HomeView() {
    setSpacing(true);/*  ww w  .  jav a2 s  .com*/
    setMargin(true);
    setSizeFull();

    Label header = new Label("   -=FoodNote=-");
    header.addStyleName(ValoTheme.LABEL_H1);
    addComponent(header);
    Label body = new Label(
            "<h3> ?? ? ? <b>CRUD</b> ?  ? <b>enterprise</b> ."
                    + "   ?  ?? ,    ?  ? .</h3>"
                    + "? ?:" + "<ul>"
                    + "<li>?  ?  <b>Spring Boot</b>, ? ? - propertie .</li>"
                    + "<li>? ?  ?? ? ???   <b>Repository</b> - <b>Spring Data JPA</b>, <b>Hibernate</b> (<b>JdbcTemplate</b>  ?).</li>"
                    + "<li> ?? - ?? ,  :</li>"
                    + "<ul>" + "<li>  - <b>PostgreSQL</b></li>"
                    + "<li>connection pool - <b>HikariCP</b></li>" + "</ul>"
                    + "<li>? - <b>EhCache</b>.</li>"
                    + "<li> ? -  <b>EventBus</b>, ? <b>Google Guava</b>.</li>"
                    + "<li>?,  - <b>Spring Security</b>:</li>"
                    + "<ul>"
                    + "<li>    , ? <b>UserDetails</b></li>"
                    + "<li> ??   ? <b>BCrypt</b></li>"
                    + "<li>  <b>Remember Me</b> ??</li>"
                    + "</ul>" + "<li>? - <b>JUnit4</b></li>"
                    + "<li> - <b>slf4j</b>, <b>logback</b></li>"
                    + "<li>Front-end - <b>Vaadin framework</b>, <b>GWT</b></li>"
                    + "<li>   <b>Docker</b>      ? <b>Ubuntu Server 14.04</b></li>"
                    + "</ul>"
                    + "<p>? Spring Boot - Vaadin ?? : <a href=\"https://github.com/peholmst/vaadin4spring\">vaadin4spring</a></p>"
                    + "<p> ? <a href=\"https://github.com/BigVOVA/FoodNote\">github.com/BigVOVA/FoodNote</a></p>");
    body.setContentMode(ContentMode.HTML);
    VerticalLayout bodyLayout = new VerticalLayout();
    bodyLayout.setWidth(100, Unit.PERCENTAGE);
    bodyLayout.setMargin(new MarginInfo(false, true, false, true));
    bodyLayout.addComponent(body);
    Panel panel = new Panel();
    panel.setSizeFull();
    panel.setContent(bodyLayout);
    addComponent(panel);
    setExpandRatio(panel, 1);
}

From source file:ch.bfh.ti.soed.hs16.srs.black.view.loginView.LoginView.java

License:Open Source License

public LoginView() {
    usernameField = new TextField("Username");
    usernameField.setIcon(FontAwesome.USER);
    usernameField.setWidth(12, Unit.EM);
    passwordField = new PasswordField("Password");
    passwordField.setIcon(FontAwesome.KEY);
    passwordField.setWidth(12, Unit.EM);
    loginButton = new Button("Login");
    loginButton.setWidth(5, Unit.EM);/*from w  w  w  .  j  a v  a 2 s  . c  o  m*/
    loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signUpButton = new Button("Sign Up");
    signUpButton.setWidth(6, Unit.EM);

    VerticalLayout layout = new VerticalLayout();
    HorizontalLayout layoutButtons = new HorizontalLayout(loginButton, signUpButton);
    layoutButtons.setSpacing(true);
    Panel panel = new Panel("Login - Smart ReservationEntity System");
    panel.setSizeUndefined();
    layout.addComponent(panel);

    FormLayout content = new FormLayout();
    content.addComponents(usernameField, passwordField, layoutButtons);
    content.setSizeFull();
    content.setMargin(true);
    panel.setContent(content);

    setCompositionRoot(layout);

    layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    layout.setMargin(new MarginInfo(true, false, false, false));
}

From source file:ch.bfh.ti.soed.hs16.srs.black.view.reservationView.ReservationMakeView.java

License:Open Source License

public ReservationMakeView() {
    fromField = new DateField("Start Date");
    fromField.setLocale(new Locale("de", "DE"));
    fromField.setResolution(Resolution.MINUTE);
    fromField.setDateFormat("dd.MM.yyyy HH:mm");
    fromField.setIcon(FontAwesome.CALENDAR);
    fromField.setWidth(12, Unit.EM);//from   w w w .  j  a  v a2  s .  co m
    toField = new DateField("End Date");
    toField.setLocale(new Locale("de", "DE"));
    toField.setResolution(Resolution.MINUTE);
    toField.setDateFormat("dd.MM.yyyy HH:mm");
    toField.setIcon(FontAwesome.CALENDAR);
    toField.setWidth(12, Unit.EM);
    roomSelect = new NativeSelect("Room Number");
    roomSelect.setIcon(FontAwesome.BED);
    roomSelect.setNullSelectionAllowed(true);
    roomSelect.setImmediate(true);
    makeReservationButton = new Button("Make Reservation", FontAwesome.CHECK);
    makeReservationButton.setWidth(12, Unit.EM);
    logoutButton = new Button("Logout");

    Panel panel = new Panel("Create New Reservation");
    FormLayout content = new FormLayout();
    content.addComponents(fromField, toField, roomSelect, makeReservationButton);
    content.setSizeUndefined();
    content.setMargin(true);
    VerticalLayout formAndLogout = new VerticalLayout(content, logoutButton);
    formAndLogout.setMargin(true);
    panel.setContent(formAndLogout);
    makeViewLayout = new VerticalLayout(panel);
    makeViewLayout.setSizeUndefined();
    makeViewLayout.setMargin(true);
}

From source file:ch.bfh.ti.soed.hs16.srs.black.view.reservationView.ReservationTableView.java

License:Open Source License

public ReservationTableView() {
    Panel panel = new Panel("My Reservations");
    table = new Table();
    table.addContainerProperty("RoomEntity", Integer.class, null);
    table.addContainerProperty("Start Time", Date.class, null);
    table.addContainerProperty("End Time", Date.class, null);
    table.addContainerProperty("Cancel", Button.class, null);
    table.setPageLength(table.size());//w  ww . jav a  2  s.c  o  m
    panel.setContent(table);

    listReservations = new VerticalLayout(panel);
    listReservations.setSizeUndefined();
    listReservations.setMargin(true);
}

From source file:ch.bfh.ti.soed.hs16.srs.black.view.signUpView.SignUpView.java

License:Open Source License

public SignUpView() {
    usernameField = new TextField("Username");
    usernameField.setIcon(FontAwesome.USER);
    usernameField.setWidth(12, Unit.EM);
    passwordField = new PasswordField("Password");
    passwordField.setIcon(FontAwesome.KEY);
    passwordField.setWidth(12, Unit.EM);
    passwordFieldRepeat = new PasswordField("Repeat Password");
    passwordFieldRepeat.setIcon(FontAwesome.KEY);
    passwordFieldRepeat.setWidth(12, Unit.EM);
    addUserButton = new Button("Add New User");
    addUserButton.setWidth(12, Unit.EM);
    goBackButton = new Button("Back");

    VerticalLayout layout = new VerticalLayout();
    Panel panel = new Panel("Sign Up - Smart ReservationEntity System");
    panel.setSizeUndefined();//from  w w w .j  a va  2  s .co  m
    layout.addComponent(panel);

    FormLayout content = new FormLayout();
    content.addComponents(usernameField, passwordField, passwordFieldRepeat, addUserButton);
    content.setSizeUndefined();
    content.setMargin(true);
    VerticalLayout formAndBack = new VerticalLayout(content, goBackButton);
    formAndBack.setMargin(true);
    panel.setContent(formAndBack);

    setCompositionRoot(layout);

    layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    layout.setMargin(new MarginInfo(true, false, false, false));
}

From source file:ch.bfh.ti.soed.hs16.srs.green.view.MyUI.java

License:Open Source License

/**
 * Method which actually creates the whole UI.
 *//*  www . j  ava  2  s.co m*/
@Override
protected void init(VaadinRequest vaadinRequest) {

    VerticalLayout layout = new VerticalLayout();

    Panel panel = new Panel("Login");
    panel.setSizeUndefined();

    FormLayout content = new FormLayout();
    userName = new TextField("Username");
    content.addComponent(userName);

    PasswordField password = new PasswordField("Password");
    content.addComponent(password);

    Button login = new Button("Login");
    register = new Button("Register");
    CheckBox askBox = new CheckBox("Are you a Roommanager?");

    login.setStyleName(Reindeer.BUTTON_SMALL);
    login.setWidth("86px");

    register.setStyleName(Reindeer.BUTTON_SMALL);
    register.setWidth("86px");
    askBox.setStyleName(Reindeer.BUTTON_SMALL);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.addComponent(login);
    hl.addComponent(register);
    hl.addComponent(askBox);

    content.addComponent(hl);
    content.setSizeUndefined();
    content.setMargin(true);

    panel.setContent(content);

    login.addClickListener(e -> {
        System.out.println(userName.getValue());
        System.out.println(password.getValue());
        try {
            if (controller.login(userName.getValue(), password.getValue())
                    || userName.equals(userName.getValue()) && password.equals(password.getValue())) {
                setContent(new ReservationUI());
            }
        } catch (Throwable e1) {
            e1.printStackTrace();
        }
    });

    register.addClickListener(e -> {
        try {
            Role x = askBox.getValue() ? Role.ROOMMANAGER : Role.CUSTOMER;
            controller.register(userName.getValue(), password.getValue(), x);
        } catch (Throwable e1) {
            e1.printStackTrace();
        }
    });

    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(panel);
    setContent(layout);
}

From source file:ch.bfh.ti.soed.hs16.srs.purple.view.RegistrationView.java

License:Open Source License

/**
 * Function displays the registration view on the contentpanel.
 *///  www  .  j av  a  2s.co m
@Override
public void display(Component content) {
    setDefaultView();
    Panel contentPanel = (Panel) content;
    contentPanel.setContent(this.registrationLayout);
}

From source file:ch.bfh.ti.soed.hs16.srs.purple.view.ReservationView.java

License:Open Source License

/**
 * Function shows the view on the content panel
 * @param content - the content to be displayed.
 *///from  w ww  .ja v a 2 s  . c  om
@Override
public void display(Component content) {
    actualUser = resCont
            .getSessionUser((String) VaadinSession.getCurrent().getAttribute(USER_SESSION_ATTRIBUTE));
    calendarUpdate();
    Panel contentPanel = (Panel) content;
    contentPanel.setContent(layout);
}

From source file:ch.bfh.ti.soed.hs16.srs.purple.view.UserProfileView.java

License:Open Source License

/**
 * Function displays the registration view on the contentpanel.
 *//*  ww  w  .j  a v a 2  s . co m*/
@Override
public void display(Component content) {
    fillForm();
    Panel contentPanel = (Panel) content;
    contentPanel.setContent(this.userProfileLayout);
}

From source file:cirad.cgh.vcf2fasta.Vcf2fastaUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    config = initConfig();//from   w  w w .ja v  a2  s  .  c o  m

    Panel mainPanel = new Panel("Vcf2fasta");

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    mainPanel.setContent(layout);

    vcf2fastaForm = new Vcf2fastaForm(this, config);
    vcf2fastaForm.setFormSubmitHandler(getSubmitClickListener(this));

    layout.addComponent(vcf2fastaForm);

    setTheme("tests-valo-reindeer");
    //setTheme("tests-valo-facebook");
    //setTheme("tests-valo-metro");

    setContent(mainPanel);
}