Example usage for com.vaadin.ui HorizontalLayout addComponent

List of usage examples for com.vaadin.ui HorizontalLayout addComponent

Introduction

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

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

From source file:cb_server.SettingsWindow.java

License:Open Source License

private Component getBoolView(SettingBool sB, int backgroundChanger) {

    com.vaadin.ui.HorizontalLayout box = new HorizontalLayout();
    com.vaadin.ui.Label label = new com.vaadin.ui.Label();
    label.setCaption(sB.getName());/*  w  ww.jav  a2  s  .c  o m*/
    box.addComponent(label);

    return box;
}

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

License:Open Source License

/**
 * Method which actually creates the whole UI.
 */// w w  w  .ja  v a  2  s  . c  o 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.LoginView.java

License:Open Source License

/**
 * Function sets the content to display the view after
 *///from  w w w . j ava 2  s. c  o m
@Override
public void display(Component content) {
    HorizontalLayout component = (HorizontalLayout) content;
    if (!this.loginController.isUserLoggedInOnSession()) {
        component.addComponent(this.loginLayout);
    } else {
        component.addComponent(this.logoutLayout);
    }
}

From source file:ch.wscr.management.ui.view.MemberView.java

/**
 * Kopfzeile fr das Grid erstellen//w  w w.j  a va2s.co m
 *
 * @param grid das Grid dem die Kopfzeile hinzugefgt werden soll
 */
private void setHeaderRow(final Grid grid) {
    // TODO Erstellung neuer Mitglieder muss noch optimiert werden

    final Button addMember = new Button("Neu", clickEvent -> {
        BeanItem<Member> beanItem = memberBeanItemContainer.addItem(new Member());
        grid.setEditorEnabled(true);
        //grid.editItem(beanItem);

    });

    addMember.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    addMember.setIcon(FontAwesome.PLUS_CIRCLE);

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSizeFull();
    buttonLayout.setSpacing(true);
    buttonLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    buttonLayout.addComponent(addMember);

    HeaderRow headerRow = grid.prependHeaderRow();
    headerRow.join("memberId", "lastName", "firstName", "adrStreet", "adrPostalCode", "adrCity", "adrCountry",
            "birthDate", "driverLicense");
    headerRow.getCell("lastName").setComponent(buttonLayout);
}

From source file:ch.wscr.management.ui.view.MemberView.java

/**
 * Header der View erstellen/*w w  w .java 2  s .  c o m*/
 *
 * @return der Header
 */
private Component buidViewHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth(100f, Unit.PERCENTAGE);
    header.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);
    header.setSpacing(true);

    Label title = new Label("Mitgliederverwaltung");
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H1);

    header.addComponent(title);

    Label gap = new Label();
    gap.setWidth(10, Unit.PIXELS);

    header.addComponent(gap);
    header.setExpandRatio(title, 1);
    return header;
}

From source file:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java

License:Open Source License

private Component getSubmitLayout() {
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);//from   w  w w.ja v  a  2s.c o m

    submitButton = getButton(SUBMIT_CAPTION);
    submitButton.addClickListener(getSubmitButtonClickListener());
    buttonLayout.addComponent(submitButton);

    resetButton = getButton(RESET_CAPTION);
    resetButton.addClickListener(getResetClickListener());
    buttonLayout.addComponent(resetButton);

    return buttonLayout;
}

From source file:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java

License:Open Source License

private Component getProgressLayout() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);//from   ww w.  ja v  a  2 s .co  m

    status = new Label("");
    layout.addComponent(this.status);

    progress = new ProgressBar();
    progress.setEnabled(false);
    progress.setVisible(false);
    layout.addComponent(progress);

    return layout;
}

From source file:com.adonis.ui.menu.Menu.java

public Menu(PersonService personService, VehicleService vehicleService, Navigator navigator) {
    this.navigator = navigator;
    setPrimaryStyleName(ValoTheme.MENU_ROOT);
    menuPart = new CssLayout();
    menuPart.addStyleName(ValoTheme.MENU_PART);

    setPersonsCrudProperties(personService);
    setVehiclesCrudProperties(vehicleService);

    // header of the menu
    final HorizontalLayout top = new HorizontalLayout();
    top.addStyleName(ValoTheme.MENU_TITLE);
    top.setSpacing(true);//from   ww  w.  j  a v a2  s.  c om

    Label title = new Label("Vehicle manager");
    title.addStyleName(ValoTheme.LABEL_H1);
    title.setSizeUndefined();

    Image image = new Image(null, new ThemeResource("img/car.png"));
    image.setStyleName(ValoTheme.MENU_LOGO);

    top.addComponent(image);
    top.addComponent(title);
    menuPart.addComponent(top);

    // logout menu item
    //        HorizontalLayout logoutLayout = new HorizontalLayout();
    //        logoutLayout.addStyleName(ValoTheme.MENU_ITEM);
    //        logoutLayout.setSpacing(false);
    //
    //        MenuBar logoutMenu = new MenuBar();
    //        logoutMenu.setStyleName(VALO_MENUITEMS);
    //        logoutMenu.addItem("Logout", new MenuBar.Command() {
    //
    //            @Override
    //            public void menuSelected(MenuBar.MenuItem selectedItem) {
    //                VaadinSession.getCurrent().getSession().invalidate();
    //                Page.getCurrent().reload();
    //            }
    //        });
    //
    //        logoutMenu.addStyleName("user-menu");
    //        Image logout = new Image(null, new ThemeResource("img/logout.png"));
    //        logoutLayout.addComponent(logout, 0);
    //        logoutLayout.addComponent(logoutMenu, 1);
    //        menuPart.addComponent(logoutLayout);

    // button for toggling the visibility of the menu when on a small screen
    showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) {
                menuPart.removeStyleName(VALO_MENU_VISIBLE);
            } else {
                menuPart.addStyleName(VALO_MENU_VISIBLE);
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName(VALO_MENU_TOGGLE);
    //        showMenu.setIcon(FontAwesome.NAVICON);
    menuPart.addComponent(showMenu);

    // container for the navigation buttons, which are added by addView()
    menuItemsLayout = new CssLayout();
    menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS);
    menuPart.addComponent(menuItemsLayout);

    addComponent(menuPart);
    addStyleName("backImage");
}

From source file:com.ahmed.vaadinone.ui.PersonForm.java

public PersonForm() {
    addField("First Name", new TextField("First Name"));
    addField("Last Name", new TextField("Last Name"));
    HorizontalLayout footer = new HorizontalLayout();
    footer.setSpacing(true);/*from  w  w w.j  a va 2  s  . co  m*/
    footer.addComponent(save);
    footer.addComponent(cancel);
    setFooter(footer);
}

From source file:com.application.modules.commercial.ClientListView.java

public void init() {

    //Recherche TextField
    rech = new ComboBox("Rechercher un Client :");
    this.addComponent(rech);
    this.setComponentAlignment(rech, Alignment.TOP_RIGHT);

    //Panels//from   ww  w. ja  v a2 s .com
    HorizontalLayout panels = new HorizontalLayout();
    panels.setHeight("100%");
    panels.setWidth("100%");
    Panel panel_liste = new Panel("Liste des Clients");
    Panel panel_license = new Panel("Liste des licenses");
    panels.addComponent(panel_liste);
    panels.addComponent(panel_license);
    this.addComponent(panels);

    //Intervention Liste table
    Client_liste = new Table();
    Client_liste.setHeight("550px");
    License_liste = new Table();
    License_liste.setHeight("550px");

    Client_liste.setWidth("100%");
    License_liste.setWidth("100%");

    // selectable
    Client_liste.setSelectable(true);
    Client_liste.setMultiSelect(false);
    Client_liste.setImmediate(true);

    License_liste.setSelectable(true);
    License_liste.setMultiSelect(false);
    License_liste.setImmediate(true);

    // turn on column reordering and collapsing
    Client_liste.setColumnReorderingAllowed(true);
    Client_liste.setColumnCollapsingAllowed(true);
    License_liste.setColumnReorderingAllowed(true);
    License_liste.setColumnCollapsingAllowed(true);

    //Client Table
    Client_liste.addContainerProperty("Num", String.class, null);
    Client_liste.addContainerProperty("Nom client", String.class, null);
    Client_liste.addContainerProperty("Contact", String.class, null);
    Client_liste.addContainerProperty("Adresse", String.class, null);
    Client_liste.addContainerProperty("Tlephone", String.class, null);

    //License Table
    License_liste.addContainerProperty("Num", String.class, null);
    License_liste.addContainerProperty("Application", String.class, null);
    License_liste.addContainerProperty("Date Expiration", Date.class, null);

    panel_liste.addComponent(Client_liste);
    panel_license.addComponent(License_liste);

    rech.setImmediate(true);
    Property.ValueChangeListener listener = new Property.ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            presenter.load_ClientListe();
        }
    };

    Client_liste.addListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent itemClickEvent) {
            System.out.println(itemClickEvent.getItemId().toString());
            presenter.load_LicenseListe(itemClickEvent.getItemId());
        }
    });

    rech.addListener(listener);

    //Class Layout properties
    this.setWidth("100%");
    this.setMargin(true);
    this.setSpacing(true);

    presenter.load_ClientListe();
    presenter.list_client();

}