Example usage for com.vaadin.ui Alignment MIDDLE_CENTER

List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER

Introduction

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

Prototype

Alignment MIDDLE_CENTER

To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.

Click Source Link

Usage

From source file:de.fatalix.bookery.view.common.SuggestLaneLayout.java

License:Open Source License

private VerticalLayout createBookCoverLayout(final BookEntry bookEntry) {
    Image image = new Image();
    image.setDescription(bookEntry.getTitle() + " von " + bookEntry.getAuthor());
    image.setHeight("200px");
    image.setWidth("130px");
    image.setImmediate(true);/*  w w w  . j a  v  a2 s  .c  o m*/
    if (bookEntry.getThumbnail() != null) {
        StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getThumbnail());
        image.setSource(new StreamResource(source, bookEntry.getId() + "_thumb.png"));
    } else if (bookEntry.getCover() != null) {
        StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getCover());
        image.setSource(new StreamResource(source, bookEntry.getId() + ".png"));
    }

    VerticalLayout result = new VerticalLayout(image);
    result.setHeight("210px");
    result.addStyleName("pointer-cursor");
    result.addStyleName("book-cover");
    result.setComponentAlignment(image, Alignment.MIDDLE_CENTER);

    result.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            bookDetailLayout.loadData(bookEntry);
            bookDetailLayout.setLayoutVisible(true);
        }
    });
    return result;
}

From source file:de.fatalix.bookery.view.common.SuggestLaneLayout.java

License:Open Source License

private VerticalLayout createEmptyDummy() {
    Label label = new Label("hab nix gfundn");
    label.addStyleName(ValoTheme.LABEL_H2);
    label.addStyleName(ValoTheme.LABEL_COLORED);
    label.setSizeUndefined();//from   ww w  . j  a  va2  s .c om
    VerticalLayout dummyLayout = new VerticalLayout(label);
    dummyLayout.setHeight("150px");
    dummyLayout.setWidth("800px");
    dummyLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
    return dummyLayout;
}

From source file:de.fatalix.bookery.view.login.LoginView.java

License:Open Source License

public LoginView() {
    setSizeFull();//from www.j a  va  2s.c  o  m
    CssLayout rootLayout = new CssLayout();
    rootLayout.addStyleName("login-screen");

    Component loginForm = buildLoginForm();

    VerticalLayout centeringLayout = new VerticalLayout();
    centeringLayout.setStyleName("centering-layout");
    centeringLayout.addComponent(loginForm);
    centeringLayout.setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER);

    CssLayout loginInformation = buildLoginInformation();

    rootLayout.addComponent(centeringLayout);
    rootLayout.addComponent(loginInformation);

    setCompositionRoot(rootLayout);

}

From source file:de.fatalix.lighty.web.component.LightyNavigation.java

public LightyNavigation() {
    addStyleName(LightyTheme.HEADER_BACKGROUND);
    setWidth(100, Unit.PERCENTAGE);/*from w  ww. j ava2  s. c  o  m*/
    for (LightyPage lightyPage : LightyPage.values()) {
        NavigationButton navigationButton = new NavigationButton(lightyPage.getCaption(), lightyPage.getUrl());
        addComponent(navigationButton);
        setComponentAlignment(navigationButton, Alignment.MIDDLE_CENTER);
    }
}

From source file:de.fatalix.lighty.web.component.LightyNotificationBar.java

public void showNotification(@Observes @ShowNotification final String message) {
    Label notificationLabel = new Label("");
    notificationLabel.setSizeUndefined();
    layout.removeAllComponents();//  w ww. j  a  v a 2 s  .  co m
    layout.addComponents(proxy, notificationLabel);
    layout.setComponentAlignment(notificationLabel, Alignment.MIDDLE_CENTER);
    addStyleName(LightyTheme.NOTIFICATION);
    proxy.animate(notificationLabel, AnimType.FADE_IN).setDuration(500);
    notificationLabel.setValue(message);
}

From source file:de.fzi.fhemapi.view.vaadin.ui.NewRoomPanel.java

License:Apache License

private VerticalLayout buildMainLayout() {
    VerticalLayout layout = new VerticalLayout();

    nameTextField = new TextField();
    HorizontalLayout nameLay = UIHelper.buildAttributePanel("Name", nameTextField);
    layout.addComponent(nameLay);/*w  w  w .j a  v  a 2  s .co  m*/

    typeComboBox = new ComboBox();
    for (String type : roomTypes) {
        typeComboBox.addItem(type);
    }

    HorizontalLayout typeLay = UIHelper.buildAttributePanel("Typ", typeComboBox);
    layout.addComponent(typeLay);
    layout.setComponentAlignment(typeLay, Alignment.TOP_CENTER);

    Label devicesLabel = new Label();
    devicesLabel.setImmediate(false);
    devicesLabel.setWidth("100%");
    devicesLabel.setHeight("50");
    devicesLabel.setValue("<b>Gerte</b>");
    devicesLabel.setContentMode(Label.CONTENT_XHTML);
    layout.addComponent(devicesLabel);
    layout.setComponentAlignment(devicesLabel, Alignment.TOP_CENTER);

    List<Device> deviceList = parent.server.getDeviceManager().getDevices();
    devicesCheckBox = new CheckBox[deviceList.size()];
    for (int i = 0; i < deviceList.size(); i++) {
        devicesCheckBox[i] = new CheckBox(deviceList.get(i).getName());
        layout.addComponent(devicesCheckBox[i]);
        layout.setComponentAlignment(devicesCheckBox[i], Alignment.MIDDLE_CENTER);
    }

    Button saveButton = new Button("Speichern");
    saveButton.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            List<String> names = new LinkedList<String>();
            for (CheckBox checkbox : devicesCheckBox) {
                if (checkbox.booleanValue())
                    names.add(checkbox.getCaption());
            }

            Structure struc = new Structure((String) nameTextField.getValue(), (String) typeComboBox.getValue(),
                    names);
            MessageResponse response = parent.server.getStructureManager().createNewStructure(struc);
            getWindow().showNotification(response.toString(), Notification.TYPE_TRAY_NOTIFICATION);
            parent.server.getStructureManager().rereadFromFHEM();
            parent.reloadTree();
        }
    });
    layout.addComponent(saveButton);
    layout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER);

    return layout;
}

From source file:de.gedoplan.webclients.vaadin.LoginUi.java

@Override
protected void init(VaadinRequest request) {
    TextField name = new TextField(Messages.login_name.value());
    name.focus();//w ww.  j  av a 2 s .  co m
    PasswordField password = new PasswordField(Messages.login_password.value());
    Button login = new Button(Messages.login_submit.value(), e -> {
        try {
            JaasAccessControl.login(name.getValue(), password.getValue());
            Page.getCurrent().setLocation(Konstanten.VAADIN_UI_PATH);
        } catch (ServletException ex) {
            Notification.show(Messages.login_invalid.value(), Notification.Type.ERROR_MESSAGE);
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    FormLayout fieldLayout = new FormLayout(name, password, login);
    fieldLayout.setMargin(true);
    fieldLayout.setSpacing(true);
    Panel loginPanel = new Panel(Messages.login_title.value(), fieldLayout);
    loginPanel.setSizeUndefined();
    VerticalLayout page = new VerticalLayout();
    page.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    page.addComponent(loginPanel);
    page.setSizeFull();
    setContent(page);
}

From source file:de.gedoplan.webclients.vaadin.VaadinDemoUi.java

public Panel createFooter() {
    Panel footer = new Panel();
    footer.setStyleName(ValoTheme.PANEL_WELL);
    footer.setHeight(75, Unit.PIXELS);/*ww  w  . j  ava  2s .  c  o  m*/
    Label footerText = new Label(" 2016 gedoplan.de");
    footerText.setSizeUndefined();
    VerticalLayout footerLayout = new VerticalLayout();
    footerLayout.setSizeFull();
    footerLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    footerLayout.addComponent(footerText);
    footer.setContent(footerLayout);
    return footer;
}

From source file:de.gedoplan.webclients.vaadin.views.CustomerDetailView.java

public void initNoCustomer() {
    Label error = new Label("Benutzer nicht gefunden !");
    error.setSizeUndefined();//from ww w. j  a va  2  s.  co  m
    error.setStyleName(ValoTheme.LABEL_FAILURE);
    setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    addComponent(error);
}

From source file:de.gedoplan.webclients.vaadin.views.CustomerForm.java

protected void buildLayout() {
    GridLayout gridLayout = new GridLayout(4, 4);
    gridLayout.setSpacing(true);/*w  ww.  j av a  2  s .  c  om*/
    gridLayout.setMargin(true);
    gridLayout.setWidth(100, Unit.PERCENTAGE);
    gridLayout.addComponent(id, 0, 0);
    gridLayout.addComponent(name, 1, 0, 2, 0);
    gridLayout.addComponent(kontakt, 3, 0);
    gridLayout.addComponent(strasse, 0, 1);
    gridLayout.addComponent(plz, 1, 1);
    gridLayout.addComponent(stadt, 2, 1, 3, 1);
    gridLayout.addComponent(region, 0, 2);
    gridLayout.addComponent(land, 1, 2);
    gridLayout.addComponent(telefon, 2, 2);
    gridLayout.addComponent(fax, 3, 2);
    gridLayout.addComponent(speichern, 1, 3);
    gridLayout.addComponent(abbrechen, 2, 3);
    gridLayout.setComponentAlignment(speichern, Alignment.MIDDLE_CENTER);
    gridLayout.setComponentAlignment(abbrechen, Alignment.MIDDLE_CENTER);
    speichern.setWidth(200, Unit.PIXELS);
    abbrechen.setWidth(200, Unit.PIXELS);
    setSpacing(true);
    setWidth(100, Unit.PERCENTAGE);
    addComponent(gridLayout);
}