Example usage for com.vaadin.ui HorizontalLayout HorizontalLayout

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

Introduction

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

Prototype

public HorizontalLayout() 

Source Link

Document

Constructs an empty HorizontalLayout.

Usage

From source file:com.github.carljmosca.ui.MainUI.java

private void addHeader() {
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);//from w  w w  . j av  a  2 s  .com
    cmbWidgets = new ComboBox();
    cmbWidgets.setContainerDataSource(widgets);
    cmbWidgets.setItemCaptionPropertyId("name");
    hl.addComponent(cmbWidgets);

    Button btnUpdate = new Button("Update", FontAwesome.ADJUST);
    btnUpdate.addClickListener((Button.ClickEvent event) -> {
        cmbWidgets.select(widgets.getIdByIndex(0));
    });
    hl.addComponent(btnUpdate);

    Button btnShow = new Button("Show", FontAwesome.DASHBOARD);
    btnShow.addClickListener((Button.ClickEvent event) -> {
        try {
            fgWidget.commit();
        } catch (FieldGroup.CommitException ex) {
            Logger.getLogger(MainUI.class.getName()).log(Level.SEVERE, null, ex);
        }
        System.out.println(demoAppData.getSelectedWidget().getName());
    });
    hl.addComponent(btnShow);

    Button btnChange = new Button("Change", FontAwesome.REFRESH);
    btnChange.addClickListener((Button.ClickEvent event) -> {
        Widget widget = (Widget) biDemoAppData.getItemProperty("selectedWidget").getValue();
        widget.setName("test xxxx");
        System.out.println(demoAppData.getSelectedWidget().getName());
    });
    hl.addComponent(btnChange);

    mainLayout.addComponent(hl);
}

From source file:com.github.cjm.TmdbUI.java

public TmdbUI() {
    mainLayout = new VerticalLayout();
    buttonLayout = new HorizontalLayout();
    userSectionLayout = new HorizontalLayout();
    tvShowGridLayout = new HorizontalLayout();
}

From source file:com.github.daytron.sqlcontainer.DatabaseTableScreen.java

public DatabaseTableScreen() {
    setMargin(true);//w w  w  . j  a  va2s .  c  om

    table = new Table();
    table.setPageLength(10);
    table.setEditable(true);
    table.setSizeFull();

    table.addGeneratedColumn("", new RemoveItemColumnGenerator());

    HorizontalLayout buttonBar = new HorizontalLayout();

    buttonBar.setMargin(true);
    buttonBar.setSpacing(true);

    Button commitButton = new Button("Commit");
    commitButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                container.commit();
                Notification.show("Changes committed");
            } catch (UnsupportedOperationException | SQLException ex) {
                Logger.getLogger(DatabaseTableScreen.class.getName()).log(Level.SEVERE, null, ex);
                Notification.show("Unable to commit", Notification.Type.ERROR_MESSAGE);
            }

        }
    });

    buttonBar.addComponent(commitButton);
    Button rollbackButton = new Button("Rollback");

    rollbackButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                container.rollback();
                Notification.show("Changes rollback");
            } catch (UnsupportedOperationException | SQLException ex) {
                Logger.getLogger(DatabaseTableScreen.class.getName()).log(Level.SEVERE, null, ex);
                Notification.show("Unable to rollback", Notification.Type.ERROR_MESSAGE);
            }
        }
    });

    buttonBar.addComponent(rollbackButton);
    addComponent(table);
    addComponent(buttonBar);
}

From source file:com.github.djabry.platform.vaadin.ui.MainUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {

    VerticalLayout rootLayout = new VerticalLayout();
    rootLayout.setSizeFull();/*w w  w.  j a va2 s  .  c  o m*/

    setContent(rootLayout);

    BannerView banner = bannerPresenter.getView();
    rootLayout.addComponent(banner);

    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setSizeFull();

    body = new VerticalLayout();
    body.setSizeFull();

    Navigator navigator = new Navigator(this, body);
    navigator.addProvider(vP);

    this.setNavigator(navigator);
    SideBarView sidebarView = sideBarPresenter.getView();

    mainLayout.addComponent(sidebarView);
    mainLayout.addComponent(body);

    rootLayout.addComponent(mainLayout);
    rootLayout.setExpandRatio(mainLayout, 10);

    sidebarView.setWidth(150, Unit.PIXELS);
    mainLayout.setExpandRatio(body, 10);
    //rootLayout.setSplitPosition(150, Unit.PIXELS);
    navigator.navigateTo(LoginView.VIEW_NAME);

    eventBus.publish(EventScope.SESSION, this, Action.START);
}

From source file:com.github.djabry.platform.vaadin.view.LoginView.java

License:Open Source License

private Component buildLoginForm() {
    HorizontalLayout loginPanel = new HorizontalLayout();
    //loginPanel.setSizeUndefined();
    loginPanel.setSpacing(true);/* ww w  .j  a  va 2s  .  c  om*/
    Responsive.makeResponsive(loginPanel);

    //loginPanel.addStyleName("login-panel");

    //loginPanel.addComponent(buildLabels());
    loginPanel.addComponent(buildFields());
    //loginPanel.addComponent(new CheckBox("Remember me", false));
    return loginPanel;
}

From source file:com.github.djabry.platform.vaadin.view.LoginView.java

License:Open Source License

private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);//from w  w  w  .  java2  s .  co  m

    userField = new TextField("Username");

    userField.setIcon(FontAwesome.USER);
    userField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    //username.addStyleName(ValoTheme.TEXTFIELD_TINY);

    passwordField = new PasswordField("Password");
    passwordField.setIcon(FontAwesome.LOCK);
    passwordField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    //password.addStyleName(ValoTheme.TEXTFIELD_TINY);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    //signin.addStyleName(ValoTheme.BUTTON_TINY);
    signin.focus();

    fields.addComponents(userField, passwordField, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            loginAction.login(userField.getValue(), passwordField.getValue());
        }
    });
    return fields;
}

From source file:com.github.djabry.platform.vaadin.view.SideBarView.java

License:Open Source License

@PostConstruct
public void init() {
    this.setSizeFull();

    HorizontalLayout titleHolder = new HorizontalLayout();
    titleHolder.addComponent(buildTitle());
    titleHolder.addStyleName(ValoTheme.LAYOUT_WELL);
    //titleHolder.setMargin(true);
    //titleHolder.setSpacing(true);
    //this.addComponent(titleHolder);
    VerticalLayout sidebarHolder = new VerticalLayout();
    //sidebarHolder.addStyleName(ValoTheme.LAYOUT_WELL);
    sidebarHolder.addStyleName(ValoTheme.MENU_ROOT);
    //sidebarHolder.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    this.addComponent(sidebarHolder);
    sidebarHolder.setSizeFull();/* ww w. ja va 2 s.co  m*/

    sidebarHolder.addComponent(sideBar);

    //sideBar.setStyleName(ValoTheme.ACCORDION_BORDERLESS);
    sideBar.addStyleName(ValoTheme.MENU_PART);

    sideBar.setSizeFull();

}

From source file:com.github.fbhd.AbstractSideBarUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    getPage().setTitle("fbhd");
    final HorizontalLayout rootLayout = new HorizontalLayout();
    rootLayout.setSizeFull();//from  ww  w  .ja va  2  s. c o m
    setContent(rootLayout);

    final VerticalLayout viewContainer = new VerticalLayout();
    viewContainer.setSizeFull();

    final Navigator navigator = new Navigator(this, viewContainer);
    navigator.setErrorView(new ErrorView());
    navigator.addProvider(viewProvider);
    setNavigator(navigator);

    rootLayout.addComponent(getSideBar());
    rootLayout.addComponent(viewContainer);
    rootLayout.setExpandRatio(viewContainer, 1.0f);
}

From source file:com.github.fbhd.view.MainView.java

private void createDetail() {
    detailLayout = new HorizontalLayout();

    mainLayout.addComponent(detailLayout);
}

From source file:com.github.fbhd.view.MainView.java

private void createButtons() {
    buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);//from w  w w  .  j  ava 2 s  . co  m

    Button btnLogin = new Button("Login");
    btnLogin.setStyleName(ValoTheme.BUTTON_PRIMARY);

    btnLogin.addClickListener((Button.ClickEvent event) -> {
        doLogin();
    });

    Button btnCancel = new Button("Cancel");

    btnCancel.addClickListener((Button.ClickEvent event) -> {

    });

    buttonLayout.addComponents(btnLogin, btnCancel);
    mainLayout.addComponent(buttonLayout);
}