Example usage for com.vaadin.ui VerticalLayout VerticalLayout

List of usage examples for com.vaadin.ui VerticalLayout VerticalLayout

Introduction

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

Prototype

public VerticalLayout() 

Source Link

Document

Constructs an empty VerticalLayout.

Usage

From source file:ch.bfh.blue.UI.MainUI.java

License:Open Source License

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();
    final CssLayout viewLayout = new CssLayout();
    final Navigator navigator;

    getSession().setAttribute("databaseLock", true);
    try {// w ww.  j  a  v a2s .  c o  m
        controller = new Controller();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }

    getSession().setAttribute("user", null);

    // /*
    // * is called upon closing of the UI do cleanup stuff here
    // */
    // addDetachListener(new DetachListener() {
    // @Override
    // public void detach(DetachEvent event) {
    // // during work
    // controller.close();
    //
    // }
    // });

    navigator = new Navigator(this, viewLayout);
    navigator.addView("", new HomeView(controller));
    navigator.addView("home", new HomeView(controller));
    navigator.addView("login", new LoginView(controller));
    navigator.addView("register", new RegisterView(controller));
    navigator.addView("availableSpaces", new AvailableSpacesView(controller));
    navigator.addView("reservationBySelectedRoom", new ReservationBySelectedRoomView(controller));
    navigator.addView("reservationBySelectedTime", new ReservationBySelectedTimeView(controller));

    layout.addComponent(viewLayout);
    layout.setMargin(true);
    setContent(layout);
}

From source file:ch.bfh.due1.srs.views.ReservationView.java

License:Open Source License

@Override
public void enter(ViewChangeEvent event) {
    // Notification.show("Welcome to the 'Reservation View'!");
    this.rooms = this.roomController.listRooms();
    for (Room r : rooms) {
        this.tabsheet.addTab(new VerticalLayout(), r.getName());
    }/*from www. ja va2 s .co  m*/
}

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 ava2 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.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   www  . j  a  va2 s  .  c  o 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.
 *//*from www.ja v a2  s .com*/
@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.kandr3.view.MyUI.java

License:Open Source License

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    final TextField name = new TextField();
    name.setCaption("Type your name here:");

    Button button = new Button("Click Me");
    button.addClickListener(e -> {/* ww  w. j  av  a2  s  .c  o m*/
        layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!"));
    });

    layout.addComponents(name, button);
    layout.setMargin(true);
    layout.setSpacing(true);

    setContent(layout);
}

From source file:ch.bfh.ti.soed.hs16.srs.red.ui.helper.SubWindowReservation.java

License:Open Source License

public SubWindowReservation() {
    this.layout = new VerticalLayout();
    this.id = new Label("id");
    this.name = new Label("name");
    this.roomTitle = new Label("select room");
    this.startTime = new Label("start time");
    this.endTime = new Label("end time");

    this.textFieldId = new TextField();
    this.textFieldName = new TextField();
    this.rooms = new ComboBox();
    this.dateFieldStart = new DateField();
    this.dateFieldEnd = new DateField();
    this.buttonSave = new Button("save");
    this.buttonDelete = new Button("delete");

    dateFieldStart.setResolution(Resolution.MINUTE);
    dateFieldEnd.setResolution(Resolution.MINUTE);

    /*---------------------------------
    add objects to horizontal container//  ww w . ja  va 2 s.co  m
    ---------------------------------*/
    HorizontalLayout idContainer = new HorizontalLayout(id, textFieldId);
    HorizontalLayout nameContainer = new HorizontalLayout(name, textFieldName);
    HorizontalLayout roomContainer = new HorizontalLayout(roomTitle, rooms);
    HorizontalLayout startContainer = new HorizontalLayout(startTime, dateFieldStart);
    HorizontalLayout endContainer = new HorizontalLayout(endTime, dateFieldEnd);
    HorizontalLayout buttons = new HorizontalLayout(buttonSave, buttonDelete);

    /*---------------------------------
    add style names
    ---------------------------------*/
    layout.setPrimaryStyleName(CSS_NAME);
    idContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer");
    nameContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer");
    roomContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer");
    startContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer");
    endContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer");
    buttons.setPrimaryStyleName(CSS_NAME + "-horizontalContainer");

    /*---------------------------------
    add to root layout
    ---------------------------------*/
    this.layout.addComponents(idContainer, nameContainer, roomContainer, startContainer, endContainer, buttons);
}

From source file:ch.bfh.ti.soed.hs16.srs.red.ui.views.LoginView.java

License:Open Source License

public LoginView(Navigator nav) {

    try {//  w ww .j  a  va2 s.  c  om
        // @TODO remove before release
        DevDemo devdemo = new DevDemo();
    } catch (Exception ex) {
        Notification.show("Demo Entries failed to initialize.", ex.getMessage(),
                Notification.Type.ERROR_MESSAGE);
    }
    /*---------------------------------
    initialize Objects
    ---------------------------------*/
    this.nav = nav;
    this.vertical = new VerticalLayout();
    this.loginName = new TextField("username");
    this.passwordField = new PasswordField("password");
    this.loginButton = new Button("Login", this);

    /*-------------------------------
    add to css
    -------------------------------*/
    vertical.setPrimaryStyleName("rootLogin");
    loginButton.setStyleName("buttonLogin");

    /*-------------------------------
    add Components to Layout
    --------------------------------*/
    vertical.addComponents(loginName, passwordField, loginButton);
    setCompositionRoot(vertical);
}

From source file:ch.bfh.ti.soed.hs16.srs.red.ui.views.MyReservationView.java

License:Open Source License

public MyReservationView(Navigator nav) {

    /*---------------------------------
    initialize objects//from w  w w. j  a  va 2  s .  com
    ---------------------------------*/
    this.root = new VerticalLayout();
    this.subWindowReservation = new Window();

    this.navigation = new Menu(nav);
    this.labelWelcome = new Label();
    this.error = new Label();
    this.calendarWeek = new Calendar();
    this.buttonAddRes = new Button("add Reservation", this::buttonAddReservation); //handle event in method addReservation
    this.contentSubWindow = new SubWindowReservation();
    this.saveButton = contentSubWindow.getButtonSave();
    this.deleteButton = contentSubWindow.getButtonDelete();

    this.reservationController = new ReservationController();
    this.userController = new UserController();
    this.roomController = new RoomController();

    /*---------------------------------
    specialize objects
    ---------------------------------*/
    calendarWeek.setFirstDayOfWeek(GregorianCalendar.MONDAY);
    saveButton.addClickListener(this::buttonSave);
    deleteButton.addClickListener(this::buttonDelete);

    List<Room> rooms = roomController.getAllRooms();
    for (int i = 0; i < rooms.size(); i++) {
        contentSubWindow.getRooms().addItem(rooms.get(i).getId() + " " + rooms.get(i).getName());
    }

    /*---------------------------------
    add style names
    ---------------------------------*/
    calendarWeek.setPrimaryStyleName("calendarWeek");

    /*-------------------------------
    add components to root
    --------------------------------*/
    Layout layoutMenu = navigation.getMenu();
    root.addComponents(layoutMenu, labelWelcome, error, buttonAddRes, calendarWeek);
    setCompositionRoot(root);

    /*-------------------------------
    double click on calendar events
    --------------------------------*/
    calendarWeek.setHandler((CalendarComponentEvents.EventClickHandler) event -> {
        addSubWindowToRoot(event);
    });

}

From source file:ch.bfh.ti.soed.hs16.srs.view.views.helpers.Header.java

License:Open Source License

public Header() {

    /* init objects */
    this.layout = new VerticalLayout();

    // find application in directory
    String basePath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
    // image as file resource
    // TODO Yep, logo appears. However, file should be retrieved from
    // location within JAR file. Consult Vaadin documentation on how to do
    // this./*from   w w  w  . j  av a2 s .  c  o m*/
    FileResource fileResource = new FileResource(new File(basePath + File.separator + "VAADIN" + File.separator
            + "themes" + File.separator + "mytheme" + File.separator + "srsLogo.jpg"));
    Image pic = new Image("", fileResource);

    /* add components to layout */
    this.layout.addComponents(pic);
}