Example usage for com.vaadin.ui Alignment MIDDLE_LEFT

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

Introduction

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

Prototype

Alignment MIDDLE_LEFT

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

Click Source Link

Usage

From source file:com.hack23.cia.web.impl.ui.application.views.common.AbstractView.java

License:Apache License

/**
 * Creates the basic layout with panel and footer.
 *
 * @param panelName/* www. ja  v a  2  s  . c om*/
 *            the panel name
 */
protected final void createBasicLayoutWithPanelAndFooter(final String panelName) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setHeight(100, Unit.PERCENTAGE);

    final VerticalLayout pageModeContent = new VerticalLayout();
    pageModeContent.setMargin(true);
    pageModeContent.setSpacing(true);
    pageModeContent.setWidth(100, Unit.PERCENTAGE);
    pageModeContent.setHeight(100, Unit.PERCENTAGE);

    layout.addComponent(pageModeContent);

    final ThemeResource ciaLogoResource = new ThemeResource("cia-logo.png");

    final Image ciaLogoImage = new Image(null, ciaLogoResource);

    final HorizontalLayout topHeader = new HorizontalLayout();

    topHeader.addComponent(ciaLogoImage);
    ciaLogoImage.setWidth("75px");
    ciaLogoImage.setHeight("75px");
    topHeader.setComponentAlignment(ciaLogoImage, Alignment.MIDDLE_LEFT);
    topHeader.setExpandRatio(ciaLogoImage, ContentRatio.SMALL);

    final HorizontalLayout topTitleHeadertPanel = new HorizontalLayout();

    final Label titleLabel = new Label("Citizen Intelligence Agency");
    titleLabel.setStyleName("Header");
    topTitleHeadertPanel.addComponent(titleLabel);
    topTitleHeadertPanel.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT);

    final Label sloganLabel = new Label("// Tracking politicians like bugs!");
    sloganLabel.setStyleName("HeaderSlogan");
    topTitleHeadertPanel.addComponent(sloganLabel);
    topTitleHeadertPanel.setComponentAlignment(sloganLabel, Alignment.MIDDLE_RIGHT);

    topHeader.addComponent(topTitleHeadertPanel);
    topHeader.setComponentAlignment(topTitleHeadertPanel, Alignment.MIDDLE_LEFT);
    topHeader.setExpandRatio(topTitleHeadertPanel, ContentRatio.GRID);

    topHeaderRightPanel.removeAllComponents();
    topHeader.addComponent(topHeaderRightPanel);
    topHeader.setComponentAlignment(topHeaderRightPanel, Alignment.MIDDLE_RIGHT);
    topHeader.setExpandRatio(topHeaderRightPanel, ContentRatio.LARGE);

    if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN)
            || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) {

        final Link userHomePageLink = pageLinkFactory.createUserHomeViewPageLink();
        topHeaderRightPanel.addComponent(userHomePageLink);
        topHeaderRightPanel.setComponentAlignment(userHomePageLink, Alignment.MIDDLE_RIGHT);

        final Button logoutButton = new Button(LOGOUT, FontAwesome.SIGN_OUT);

        final LogoutRequest logoutRequest = new LogoutRequest();
        logoutRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
        logoutButton.addClickListener(new LogoutClickListener(logoutRequest, applicationManager));

        topHeaderRightPanel.addComponent(logoutButton);
        topHeaderRightPanel.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT);

    } else {
        final Link createRegisterPageLink = pageLinkFactory.createRegisterPageLink();
        topHeaderRightPanel.addComponent(createRegisterPageLink);
        topHeaderRightPanel.setComponentAlignment(createRegisterPageLink, Alignment.MIDDLE_RIGHT);

        final Link createLoginPageLink = pageLinkFactory.createLoginPageLink();
        topHeaderRightPanel.addComponent(createLoginPageLink);
        topHeaderRightPanel.setComponentAlignment(createLoginPageLink, Alignment.MIDDLE_RIGHT);
    }

    topHeaderRightPanel.setWidth("100%");
    topHeaderRightPanel.setHeight("60px");

    topHeader.setWidth("100%");
    topHeader.setHeight("60px");

    pageModeContent.addComponent(topHeader);
    pageModeContent.setComponentAlignment(topHeader, Alignment.TOP_CENTER);

    pageModeContent.addComponent(getBarmenu());
    pageModeContent.setComponentAlignment(getBarmenu(), Alignment.TOP_CENTER);

    panel = new Panel(panelName);

    panel.setSizeFull();
    pageModeContent.addComponent(panel);
    pageModeContent.setExpandRatio(panel, ContentRatio.FULL_SIZE);

    pageModeContent.addComponent(pageLinkFactory.createMainViewPageLink());
    setContent(layout);

    setWidth(100, Unit.PERCENTAGE);
    setHeight(100, Unit.PERCENTAGE);
    setSizeFull();

}

From source file:com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl.AbstractMenuItemFactoryImpl.java

License:Apache License

protected final void createButtonLink(final GridLayout panelContent, final String linkText, final Resource icon,
        final ClickListener command, final String description) {
    final GridLayout grid = new GridLayout(2, 1);
    grid.setWidth(100, Unit.PERCENTAGE);
    grid.setHeight(100, Unit.PERCENTAGE);
    grid.setColumnExpandRatio(0, 1);//from  ww  w  . j a v a  2 s  .  co m
    grid.setColumnExpandRatio(1, 2);

    final Button b = new Button(linkText);
    b.setStyleName("link");
    b.addClickListener(command);
    b.setWidth(100, Unit.PERCENTAGE);

    b.setIcon(icon);
    b.setWidth(100, Unit.PERCENTAGE);

    grid.addComponent(b, 0, 0);
    grid.setComponentAlignment(b, Alignment.MIDDLE_LEFT);

    final Label descriptionLabel = new Label(description);
    descriptionLabel.setWidth(100, Unit.PERCENTAGE);
    grid.addComponent(descriptionLabel, 1, 0);
    grid.setComponentAlignment(descriptionLabel, Alignment.MIDDLE_LEFT);

    panelContent.addComponent(grid);
    panelContent.setComponentAlignment(grid, Alignment.MIDDLE_LEFT);
}

From source file:com.haulmont.cuba.web.gui.components.CubaFileUploadWrapper.java

License:Apache License

protected void initLayout(UploadComponent uploadComponent) {
    this.uploadButton = uploadComponent;

    container = new HorizontalLayout();
    container.setSpacing(true);// w w  w.ja v a  2  s.c om
    container.addStyleName("c-fileupload-container");

    fileNameButton = new Button();
    fileNameButton.setWidth("100%");
    fileNameButton.addStyleName(BUTTON_LINK);
    fileNameButton.addStyleName("c-fileupload-filename");
    setFileNameButtonCaption(null);
    container.addComponent(fileNameButton);
    container.setComponentAlignment(fileNameButton, Alignment.MIDDLE_LEFT);

    container.addComponent(uploadComponent);

    Messages messages = AppBeans.get(Messages.NAME);
    clearButton = new Button(messages.getMainMessage("FileUploadField.clearButtonCaption"));
    clearButton.setStyleName("c-fileupload-clear");
    container.addComponent(clearButton);
    setShowClearButton(showClearButton);

    setShowFileName(false);
    setWidthUndefined();
}

From source file:com.haulmont.cuba.web.gui.components.presentations.PresentationEditor.java

License:Apache License

protected void initLayout() {
    ThemeConstants theme = App.getInstance().getThemeConstants();

    VerticalLayout root = new VerticalLayout();
    root.setWidthUndefined();/*from   ww  w. java2s  .  com*/
    root.setSpacing(true);
    setContent(root);

    messages = AppBeans.get(Messages.class);

    nameField = new TextField(messages.getMainMessage("PresentationsEditor.name"));
    nameField.setWidth(theme.get("cuba.web.PresentationEditor.name.width"));
    nameField.setValue(getPresentationCaption());
    root.addComponent(nameField);

    autoSaveField = new CheckBox();
    autoSaveField.setCaption(messages.getMainMessage("PresentationsEditor.autoSave"));
    autoSaveField.setValue(BooleanUtils.isTrue(presentation.getAutoSave()));
    root.addComponent(autoSaveField);

    defaultField = new CheckBox();
    defaultField.setCaption(messages.getMainMessage("PresentationsEditor.default"));
    defaultField.setValue(presentation.getId().equals(component.getDefaultPresentationId()));
    root.addComponent(defaultField);

    if (allowGlobalPresentations) {
        globalField = new CheckBox();
        globalField.setCaption(messages.getMainMessage("PresentationsEditor.global"));
        globalField.setValue(!isNew && presentation.getUser() == null);
        root.addComponent(globalField);
    }

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setWidthUndefined();
    root.addComponent(buttons);
    root.setComponentAlignment(buttons, Alignment.MIDDLE_LEFT);

    Button commitButton = new CubaButton(messages.getMainMessage("PresentationsEditor.save"));
    commitButton.addClickListener(event -> {
        if (validate()) {
            commit();
            close();
        }
    });
    buttons.addComponent(commitButton);

    Button closeButton = new CubaButton(messages.getMainMessage("PresentationsEditor.close"));
    closeButton.addClickListener(event -> {
        close();
    });
    buttons.addComponent(closeButton);

    nameField.focus();
}

From source file:com.haulmont.cuba.web.LoginWindow.java

License:Apache License

protected HorizontalLayout createTitleLayout() {
    HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setStyleName("cuba-login-title");
    titleLayout.setSpacing(true);//from   w w w  . j  ava  2  s  .  co m

    Image logoImage = getLogoImage();
    if (logoImage != null) {
        logoImage.setStyleName("cuba-login-icon");
        titleLayout.addComponent(logoImage);
        titleLayout.setComponentAlignment(logoImage, Alignment.MIDDLE_LEFT);
    }

    String welcomeMsg = messages.getMainMessage("loginWindow.welcomeLabel", resolvedLocale);
    Label label = new Label(welcomeMsg.replace("\n", "<br/>"));
    label.setContentMode(ContentMode.HTML);
    label.setWidthUndefined();
    label.setStyleName("cuba-login-caption");

    if (!StringUtils.isBlank(label.getValue())) {
        titleLayout.addComponent(label);
        titleLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
    }
    return titleLayout;
}

From source file:com.hazelcast.examples.Tutorial.java

License:Open Source License

public Tutorial() {
    setStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
    prepareSourceCode();//from   w w  w. j a v a 2 s.c  o  m
    setSizeFull();
    addComponents(example, sourceCode);

    example.add(new MHorizontalLayout(controls).expand(new RichText().withMarkDown("**"
            + getClass().getSimpleName().replaceAll("([0-9]+)", " $1") + ":** *" + getShortDescription() + "*"))
            .alignAll(Alignment.MIDDLE_LEFT)).expand(result);

}

From source file:com.hivesys.dashboard.view.preferences.PreferencesView.java

License:Apache License

public PreferencesView() {

    user = (User) VaadinSession.getCurrent().getAttribute(User.class.getName());

    setSpacing(true);/*from   w w  w  .  j  a  v a2s . c o  m*/
    setMargin(true);

    Label title = new Label("Forms");
    title.addStyleName("h1");
    addComponent(title);

    final FormLayout form = new FormLayout();
    form.setMargin(false);
    form.setWidth("800px");
    form.addStyleName("light");
    addComponent(form);

    Label section = new Label("Personal Info");
    section.addStyleName("h2");
    section.addStyleName("colored");
    form.addComponent(section);

    firstNameField = new TextField("First Name");
    firstNameField.setWidth("50%");
    form.addComponent(firstNameField);

    lastNameField = new TextField("Last Name");
    lastNameField.setWidth("50%");
    form.addComponent(lastNameField);

    titleField = new ComboBox("Title");
    titleField.setInputPrompt("Please specify");
    titleField.addItem("Mr.");
    titleField.addItem("Mrs.");
    titleField.addItem("Ms.");
    titleField.setNewItemsAllowed(true);
    form.addComponent(titleField);

    usernameField = new TextField("Username");
    usernameField.setRequired(true);
    form.addComponent(usernameField);

    sexField = new OptionGroup("Sex");
    sexField.addItem(Boolean.FALSE);
    sexField.setItemCaption(Boolean.FALSE, "Female");
    sexField.addItem(Boolean.TRUE);
    sexField.setItemCaption(Boolean.TRUE, "Male");
    sexField.addStyleName("horizontal");
    form.addComponent(sexField);

    section = new Label("Contact Info");
    section.addStyleName("h3");
    section.addStyleName("colored");
    form.addComponent(section);

    emailField = new TextField("Email");
    emailField.setWidth("50%");
    emailField.setRequired(true);
    form.addComponent(emailField);

    locationField = new TextField("Location");
    locationField.setWidth("50%");
    locationField.setNullRepresentation("");
    form.addComponent(locationField);

    phoneField = new TextField("Phone");
    phoneField.setWidth("50%");
    phoneField.setNullRepresentation("");
    form.addComponent(phoneField);

    section = new Label("Additional Info");
    section.addStyleName("h4");
    section.addStyleName("colored");
    form.addComponent(section);

    websiteField = new TextField("Website");
    websiteField.setInputPrompt("http://");
    websiteField.setWidth("100%");
    form.addComponent(websiteField);

    bioField = new RichTextArea("Bio");
    bioField.setWidth("100%");
    bioField.setValue(
            "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi  dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>");
    form.addComponent(bioField);

    Button edit = new Button("Edit", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean readOnly = form.isReadOnly();
            if (readOnly) {
                bioField.setReadOnly(false);
                form.setReadOnly(false);
                form.removeStyleName("light");
                event.getButton().setCaption("Save");
                event.getButton().addStyleName("primary");
            } else {
                bioField.setReadOnly(true);
                form.setReadOnly(true);
                form.addStyleName("light");
                event.getButton().setCaption("Edit");
                event.getButton().removeStyleName("primary");
            }
        }
    });

    HorizontalLayout footer = new HorizontalLayout();
    footer.setMargin(new MarginInfo(true, false, true, false));
    footer.setSpacing(true);
    footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    form.addComponent(footer);
    footer.addComponent(edit);

    Label lastModified = new Label("Last modified by you a minute ago");
    lastModified.addStyleName("light");
    footer.addComponent(lastModified);

    fieldGroup = new BeanFieldGroup<>(User.class);
    fieldGroup.bindMemberFields(this);
    fieldGroup.setItemDataSource(user);

    form.setReadOnly(true);
    bioField.setReadOnly(true);

}

From source file:com.hris.payroll.alphalist.AlphaListMainUI.java

public AlphaListMainUI(int branchId) {
    this.branchId = branchId;

    setSizeFull();/* ww  w . j  a v  a  2s .co  m*/
    setMargin(new MarginInfo(true, true, false, true));
    setSpacing(true);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setCaption("Year: ");
    h1.setWidthUndefined();
    h1.setSpacing(true);

    h1.addComponent(employmentStatus);
    h1.addComponent(selectYear());
    h1.addComponent(alphaListButton());
    h1.addComponent(exportToExcelButton());

    addComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setWidthUndefined();
    h2.setSpacing(true);

    progress.setWidth("410px");
    h2.addComponent(progress);
    h2.setComponentAlignment(progress, Alignment.MIDDLE_LEFT);

    status.setValue("0%");
    h2.addComponent(status);

    processLabel.setValue("");
    h2.addComponent(processLabel);

    addComponent(h2);
    addComponent(grid);
    setExpandRatio(grid, 3);
}

From source file:com.hris.payroll.thirteenthmonth.ThirteenthMonth.java

public ThirteenthMonth(int branchId) {
    this.branchId = branchId;

    setSizeFull();//from   w  w w. j  a  va2s  .  co m
    setMargin(new MarginInfo(true, true, false, true));
    setSpacing(true);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setWidthUndefined();
    h1.setSpacing(true);

    h1.addComponent(employmentStatus);
    h1.addComponent(selectYear());
    h1.addComponent(generate13thMonth());
    h1.addComponent(exportToExcelButton());

    addComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setWidthUndefined();
    h2.setSpacing(true);

    progress.setWidth("410px");
    h2.addComponent(progress);
    h2.setComponentAlignment(progress, Alignment.MIDDLE_LEFT);

    status.setValue("0%");
    h2.addComponent(status);

    grid = new ThirteenthMonthDataGridProperty();
    addComponent(h2);
    addComponent(grid);
    setExpandRatio(grid, 3);
}

From source file:com.hybridbpm.ui.component.bpm.window.TransitionConfigureWindow.java

License:Apache License

public void initUI(ProcessModelLayout processModelLayout) {
    this.processModelLayout = processModelLayout;
    nameTextField.setCaption(("Name"));
    nameTextField.setWidth(300, Unit.PIXELS);
    nameTextField.setNullRepresentation("");

    expressionTextField.setCaption(("Condition Expression"));
    expressionTextField.setWidth(100, Unit.PERCENTAGE);
    expressionTextField.setHeight(50, Unit.PIXELS);
    expressionTextField.setMode(AceMode.groovy);
    expressionTextField.setTheme(AceTheme.chrome);
    expressionTextField.setShowGutter(false);
    SuggestionExtension extension = new SuggestionExtension(
            new VariableSuggester(this.processModelLayout.getProcessModel()));
    extension.setSuggestOnDot(false);//from   ww w  . ja  v a 2  s .co  m
    extension.extend(expressionTextField);

    defaultCheckBox.setCaption(("Default Transition"));

    yTextField.setCaption(("Y"));
    yTextField.setWidth(100, Unit.PIXELS);
    yTextField.setNullRepresentation("");
    yTextField.setVisible(false);

    xTextField.setCaption(("Y"));
    xTextField.setWidth(100, Unit.PIXELS);
    xTextField.setNullRepresentation("");
    xTextField.setVisible(false);

    //        configurationLayout.setCaption("Transition properties");
    //        configurationLayout.addStyleName("process-config");
    configurationLayout.setMargin(new MarginInfo(true, true, true, true));
    configurationLayout.setSpacing(true);
    configurationLayout.addComponent(nameTextField, 0, 0, 0, 0);
    configurationLayout.addComponent(defaultCheckBox, 1, 0, 1, 0);
    configurationLayout.setComponentAlignment(defaultCheckBox, Alignment.BOTTOM_RIGHT);
    configurationLayout.addComponent(expressionTextField, 0, 1, 1, 1);
    configurationLayout.addComponent(xTextField, 0, 2, 0, 2);
    configurationLayout.addComponent(yTextField, 1, 2, 1, 2);
    configurationLayout.setColumnExpandRatio(0, 1f);
    configurationLayout.setColumnExpandRatio(1, 1f);
    configurationLayout.setColumnExpandRatio(2, 1f);

    fieldGroup.setBuffered(true); //important
    fieldGroup.bind(xTextField, "x");
    fieldGroup.bind(yTextField, "y");
    fieldGroup.bind(nameTextField, "name");
    fieldGroup.bind(expressionTextField, "expression");
    fieldGroup.bind(defaultCheckBox, "defaultTransition");
    fieldGroup.setItemDataSource(processModelLayout.getActiveElement().getTransitionModel());

    toolbar.setSpacing(true);
    toolbar.setWidth(100, Unit.PERCENTAGE);
    toolbar.addStyleName("toolbar");

    btnShowMore.setCaption(("Show more"));
    btnShowMore.setStyleName(ValoTheme.BUTTON_LINK);
    toolbar.addComponent(btnShowMore);
    toolbar.setComponentAlignment(btnShowMore, Alignment.MIDDLE_LEFT);
    toolbar.setExpandRatio(btnShowMore, 1f);

    btnOk.addStyleName(ValoTheme.BUTTON_PRIMARY);
    btnOk.setCaption(("OK"));
    toolbar.addComponent(btnOk);
    toolbar.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT);

    btnClose.setCaption(("Close"));
    toolbar.addComponent(btnClose);
    toolbar.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT);

    layout.addStyleName("process-config-layout");
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.addComponent(configurationLayout);
    layout.addComponent(toolbar);
    layout.setComponentAlignment(toolbar, Alignment.MIDDLE_RIGHT);

    setCaption("Transition");
    center();
    setResizable(false);
    //        setClosable(false);
    setModal(true);
    addStyleName("no-vertical-drag-hints");
    addStyleName("no-horizontal-drag-hints");
    addStyleName("process-config-window");
    setContent(layout);
}