Example usage for com.vaadin.ui Alignment BOTTOM_LEFT

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

Introduction

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

Prototype

Alignment BOTTOM_LEFT

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

Click Source Link

Usage

From source file:com.openhris.payroll.PayrollAdvancesLedgerUI.java

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

    setSpacing(false);//  w  w w .  j a  v a 2s  .c o m
    setMargin(false);
    setWidth("100%");
    setHeight("100%");
    setImmediate(true);

    final VerticalSplitPanel vsplit = new VerticalSplitPanel();

    vsplit.setImmediate(true);
    vsplit.setMargin(false);
    vsplit.setSizeFull();
    vsplit.setLocked(true);

    vsplit.setSplitPosition(90, Sizeable.UNITS_PIXELS);

    GridLayout glayout = new GridLayout(2, 1);
    glayout.setWidth("60%");
    glayout.setMargin(true);
    glayout.setSpacing(true);

    employeeComboBox(getBranchId());
    glayout.addComponent(employee, 0, 0);

    Button button = new Button();
    button.setWidth("100%");
    button.setCaption("Generate Ledger");
    button.setEnabled(UserAccessControl.isPayroll());
    button.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            System.out.println("employeeId: " + employee.getValue());
        }
    });

    glayout.addComponent(button, 1, 0);
    glayout.setComponentAlignment(button, Alignment.BOTTOM_LEFT);

    vsplit.setFirstComponent(glayout);
    addComponent(vsplit);

    setExpandRatio(vsplit, 1.0f);
}

From source file:com.peergreen.example.webconsole.extensions.NotifierExtension.java

License:Open Source License

@PostConstruct
public void init() {
    HorizontalLayout row = new HorizontalLayout();
    row.setWidth("100%");
    Button simpleButton = new Button("Click to create a notification !");
    final Random random = new Random();
    simpleButton.addClickListener(new Button.ClickListener() {
        @Override//from w w  w . j  a  v  a  2s. com
        public void buttonClick(Button.ClickEvent clickEvent) {
            notifierService.addNotification(MESSAGES[random.nextInt(MESSAGES.length)]);
        }
    });
    simpleButton.setWidth("400px");
    row.addComponent(simpleButton);
    row.setComponentAlignment(simpleButton, Alignment.BOTTOM_LEFT);

    final TextField customNotification = new TextField();
    customNotification.setCaption("Write something and type enter");
    final ShortcutListener addNotification = new ShortcutListener("Execute", ShortcutAction.KeyCode.ENTER,
            null) {
        @Override
        public void handleAction(Object o, Object o2) {
            notifierService.addNotification(customNotification.getValue());
            customNotification.setValue("");
        }
    };
    customNotification.addFocusListener(new FieldEvents.FocusListener() {
        @Override
        public void focus(FieldEvents.FocusEvent focusEvent) {
            customNotification.addShortcutListener(addNotification);
        }
    });
    customNotification.addBlurListener(new FieldEvents.BlurListener() {
        @Override
        public void blur(FieldEvents.BlurEvent blurEvent) {
            customNotification.removeShortcutListener(addNotification);
        }
    });
    customNotification.setWidth("400px");
    row.addComponent(customNotification);
    addComponent(row);
    setExpandRatio(row, 1.5f);
}

From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java

License:Open Source License

/**
 * Build login view/*from  w w  w . j a  v  a  2s. c om*/
 *
 * @param exit
 */
private void buildLoginView(final boolean exit) {
    if (exit) {
        root.removeAllComponents();
    }
    notifierService.closeAll();

    addStyleName("login");

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setId("webconsole_loginlayout_id");
    loginLayout.setSizeFull();
    loginLayout.addStyleName("login-layout");
    root.addComponent(loginLayout);

    final CssLayout loginPanel = new CssLayout();
    loginPanel.addStyleName("login-panel");

    HorizontalLayout labels = new HorizontalLayout();
    labels.setWidth(MAX_WIDTH);
    labels.setMargin(true);
    loginPanel.addComponent(labels);

    Label welcome = new Label("Welcome");
    welcome.addStyleName("h4");
    labels.addComponent(welcome);
    labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT);

    Label title = new Label(consoleName);
    //title.setSizeUndefined();
    title.addStyleName("h2");
    title.addStyleName("light");
    labels.addComponent(title);
    labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT);

    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.setMargin(true);
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.focus();
    username.setId("webconsole_login_username");
    fields.addComponent(username);

    final PasswordField password = new PasswordField("Password");
    password.setId("webconsole_login_password");
    fields.addComponent(password);

    final Button signin = new Button("Sign In");
    signin.setId("webconsole_login_signin");
    signin.addStyleName("default");
    fields.addComponent(signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    final ShortcutListener enter = new ShortcutListener("Sign In", ShortcutAction.KeyCode.ENTER, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            signin.click();
        }
    };

    signin.addShortcutListener(enter);
    loginPanel.addComponent(fields);

    HorizontalLayout bottomRow = new HorizontalLayout();
    bottomRow.setWidth(MAX_WIDTH);
    bottomRow.setMargin(new MarginInfo(false, true, false, true));
    final CheckBox keepLoggedIn = new CheckBox("Keep me logged in");
    bottomRow.addComponent(keepLoggedIn);
    bottomRow.setComponentAlignment(keepLoggedIn, Alignment.MIDDLE_LEFT);
    // Add new error message
    final Label error = new Label("Wrong username or password.", ContentMode.HTML);
    error.setId("webconsole_login_error");
    error.addStyleName("error");
    error.setSizeUndefined();
    error.addStyleName("light");
    // Add animation
    error.addStyleName("v-animate-reveal");
    error.setVisible(false);
    bottomRow.addComponent(error);
    bottomRow.setComponentAlignment(error, Alignment.MIDDLE_RIGHT);
    loginPanel.addComponent(bottomRow);

    signin.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (authenticate(username.getValue(), password.getValue())) {
                //                    if (keepLoggedIn.getValue()) {
                //                        //Cookie userCookie = getCookieByName(PEERGREEN_USER_COOKIE_NAME);
                //                       if (getCookieByName(PEERGREEN_USER_COOKIE_NAME) == null) {
                //                            // Get a token for this user and create a cooki
                //                            Page.getCurrent().getJavaScript().execute( String.format("document.cookie = '%s=%s; path=%s'",
                //                                    PEERGREEN_USER_COOKIE_NAME, token, VaadinService.getCurrentRequest().getContextPath()));
                //                        } else {
                //                            // update token
                //                            userCookie.setValue(token);
                //                            userCookie.setPath(VaadinService.getCurrentRequest().getContextPath());
                //                        }
                //                    }

                buildMainView();
            } else {
                error.setVisible(true);
            }
        }
    });

    loginLayout.addComponent(loginPanel);
    loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
}

From source file:com.purebred.core.view.Results.java

License:Open Source License

private HorizontalLayout createNavigationLine() {

    HorizontalLayout resultCountDisplay = new HorizontalLayout();
    Label showingLabel = new Label(uiMessageSource.getMessage("entityResults.showing") + " &nbsp ",
            Label.CONTENT_XHTML);
    showingLabel.setSizeUndefined();//from   w  ww  .  j  av a  2  s  .  co m
    showingLabel.addStyleName("small");
    resultCountDisplay.addComponent(showingLabel);
    firstResultTextField = createFirstResultTextField();
    firstResultTextField.addStyleName("small");
    firstResultTextField.setSizeUndefined();
    resultCountDisplay.addComponent(firstResultTextField);
    resultCountLabel = new Label("", Label.CONTENT_XHTML);
    resultCountLabel.setSizeUndefined();
    resultCountLabel.addStyleName("small");
    resultCountDisplay.addComponent(resultCountLabel);

    Label spaceLabel = new Label("   ", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    resultCountDisplay.addComponent(spaceLabel);

    Button refreshButton = new Button(null, getResultsTable(), "refresh");
    refreshButton.setDescription(uiMessageSource.getMessage("entityResults.refresh.description"));
    refreshButton.setSizeUndefined();
    refreshButton.addStyleName("borderless");
    refreshButton.setIcon(new ThemeResource("icons/16/refresh-blue.png"));
    resultCountDisplay.addComponent(refreshButton);

    HorizontalLayout navigationButtons = new HorizontalLayout();
    navigationButtons.setMargin(false, true, false, false);
    navigationButtons.setSpacing(true);

    String perPageText = uiMessageSource.getMessage("entityResults.pageSize");
    pageSizeMenu = new Select();
    pageSizeMenu.addStyleName("small");
    pageSizeMenu.addItem(5);
    pageSizeMenu.setItemCaption(5, "5 " + perPageText);
    pageSizeMenu.addItem(10);
    pageSizeMenu.setItemCaption(10, "10 " + perPageText);
    pageSizeMenu.addItem(25);
    pageSizeMenu.setItemCaption(25, "25 " + perPageText);
    pageSizeMenu.addItem(50);
    pageSizeMenu.setItemCaption(50, "50 " + perPageText);
    pageSizeMenu.addItem(100);
    pageSizeMenu.setItemCaption(100, "100 " + perPageText);
    pageSizeMenu.setFilteringMode(Select.FILTERINGMODE_OFF);
    pageSizeMenu.setNewItemsAllowed(false);
    pageSizeMenu.setNullSelectionAllowed(false);
    pageSizeMenu.setImmediate(true);
    pageSizeMenu.setWidth(8, UNITS_EM);
    navigationButtons.addComponent(pageSizeMenu);

    firstButton = new Button(null, getResultsTable(), "firstPage");
    firstButton.setDescription(uiMessageSource.getMessage("entityResults.first.description"));
    firstButton.setSizeUndefined();
    firstButton.addStyleName("borderless");
    firstButton.setIcon(new ThemeResource("icons/16/first.png"));
    navigationButtons.addComponent(firstButton);

    previousButton = new Button(null, getResultsTable(), "previousPage");
    previousButton.setDescription(uiMessageSource.getMessage("entityResults.previous.description"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("icons/16/previous.png"));
    navigationButtons.addComponent(previousButton);

    nextButton = new Button(null, getResultsTable(), "nextPage");
    nextButton.setDescription(uiMessageSource.getMessage("entityResults.next.description"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("icons/16/next.png"));
    navigationButtons.addComponent(nextButton);

    lastButton = new Button(null, getResultsTable(), "lastPage");
    lastButton.setDescription(uiMessageSource.getMessage("entityResults.last.description"));
    lastButton.setSizeUndefined();
    lastButton.addStyleName("borderless");
    lastButton.setIcon(new ThemeResource("icons/16/last.png"));
    navigationButtons.addComponent(lastButton);

    HorizontalLayout navigationLine = new HorizontalLayout();
    navigationLine.setWidth("100%");
    navigationLine.setMargin(true, true, true, false);

    navigationLine.addComponent(resultCountDisplay);
    navigationLine.setComponentAlignment(resultCountDisplay, Alignment.BOTTOM_LEFT);

    navigationLine.addComponent(navigationButtons);
    navigationLine.setComponentAlignment(navigationButtons, Alignment.BOTTOM_RIGHT);

    return navigationLine;
}

From source file:com.rdonasco.security.application.views.ApplicationEditorView.java

License:Apache License

private void configureApplicationInfoFields() {
    nameField.setWidth(200f, UNITS_PIXELS);
    applicationInfoPanel.addComponent(nameField);
    ((VerticalLayout) applicationInfoPanel.getContent()).setSpacing(true);
    HorizontalLayout tokenFieldLayout = new HorizontalLayout();
    tokenFieldLayout.setSpacing(true);// www.  j  a  v  a2s.  c om
    tokenField.setWidth(300, UNITS_PIXELS);
    tokenFieldLayout.addComponent(tokenField);
    generateTokenButton.addStyleName(BaseTheme.BUTTON_LINK);
    generateTokenButton.setDescription(I18NResource.localize("Generate token"));
    generateTokenButton.setIcon(new ThemeResource(SecurityDefaultTheme.ICON_32x32_RELOAD));
    tokenFieldLayout.addComponent(generateTokenButton);
    tokenFieldLayout.setComponentAlignment(generateTokenButton, Alignment.BOTTOM_LEFT);
    applicationInfoPanel.addComponent(tokenFieldLayout);
}

From source file:com.skysql.manager.ui.CalendarDialog.java

License:Open Source License

/**
 * Inits the layout content.//from   w w w  .j av  a2 s . c  om
 */
private void initLayoutContent() {
    initNavigationButtons();
    initAddNewEventButton();
    initHideWeekEndButton();
    //initAllScheduleButton();

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("100%");
    hl.setSpacing(true);
    hl.setMargin(new MarginInfo(false, false, true, false));
    hl.addComponent(prevButton);
    hl.addComponent(captionLabel);
    hl.addComponent(monthButton);
    hl.addComponent(weekButton);
    hl.addComponent(nextButton);
    hl.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT);
    hl.setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(monthButton, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(weekButton, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT);

    monthButton.setVisible(viewMode == Mode.WEEK);
    weekButton.setVisible(viewMode == Mode.DAY);

    HorizontalLayout controlPanel = new HorizontalLayout();
    controlPanel.setSpacing(true);
    controlPanel.setMargin(new MarginInfo(false, false, true, false));
    controlPanel.setWidth("100%");
    //controlPanel.addComponent(localeSelect);
    //controlPanel.setComponentAlignment(localeSelect, Alignment.MIDDLE_LEFT);
    controlPanel.addComponent(timeZoneSelect);
    controlPanel.setComponentAlignment(timeZoneSelect, Alignment.MIDDLE_LEFT);
    //controlPanel.addComponent(formatSelect);
    //controlPanel.setComponentAlignment(formatSelect, Alignment.MIDDLE_LEFT);
    controlPanel.addComponent(addNewEvent);
    controlPanel.setComponentAlignment(addNewEvent, Alignment.BOTTOM_LEFT);
    controlPanel.addComponent(hideWeekendsButton);
    controlPanel.setComponentAlignment(hideWeekendsButton, Alignment.BOTTOM_LEFT);
    //controlPanel.addComponent(allScheduleButton);
    //controlPanel.setComponentAlignment(allScheduleButton, Alignment.MIDDLE_LEFT);

    VerticalLayout layout = (VerticalLayout) dialogWindow.getContent();
    layout.addComponent(controlPanel);
    layout.addComponent(hl);
    layout.addComponent(calendarComponent);
    layout.setExpandRatio(calendarComponent, 1);
}

From source file:com.skysql.manager.ui.CalendarDialog.java

License:Open Source License

/**
 * Initializes a modal window to edit schedule event.
 *
 * @param event the event//from  w  ww .j av a 2s . com
 * @param newEvent the new event
 */
private void createCalendarEventPopup(CalendarCustomEvent event, boolean newEvent) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);

    scheduleEventPopup = new Window(null, layout);
    scheduleEventPopup.setWidth("400px");
    scheduleEventPopup.setModal(true);
    scheduleEventPopup.center();

    Date occurrence = event.getOccurrence();
    if (!newEvent && occurrence != null) {
        Form form = new Form();
        form.setCaption("This is a repeat occurrence");
        layout.addComponent(form);

        DateField dateField = new DateField("Occurrence Start");
        if (useSecondResolution) {
            dateField.setResolution(Resolution.SECOND);
        } else {
            dateField.setResolution(Resolution.MINUTE);
        }
        dateField.setValue(event.getStart());
        dateField.setEnabled(false);
        form.addField("dateField", dateField);
        form.setFooter(null);

        HorizontalLayout editLayout = new HorizontalLayout();
        editLayout.setSpacing(true);
        layout.addComponent(editLayout);

        final Label label = new Label("Click to change the original event below:");
        editLayout.addComponent(label);
        editLayout.setComponentAlignment(label, Alignment.BOTTOM_LEFT);

        editOriginalButton = new Button("Edit", new ClickListener() {

            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent clickEvent) {
                scheduleEventForm.setEnabled(true);
                applyEventButton.setEnabled(true);
                label.setValue("Editing original event:");
                editOriginalButton.setVisible(false);
            }
        });
        editLayout.addComponent(editOriginalButton);

        scheduleEventForm.setEnabled(false);
    } else {
        scheduleEventForm.setEnabled(true);
    }

    layout.addComponent(scheduleEventForm);

    applyEventButton = new Button("Add", new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            commitCalendarEvent();
        }
    });
    Button cancel = new Button("Cancel", new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            discardCalendarEvent();
        }
    });
    deleteEventButton = new Button("Delete", new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            deleteCalendarEvent();
        }
    });
    scheduleEventPopup.addListener(new CloseListener() {
        private static final long serialVersionUID = 1L;

        public void windowClose(CloseEvent e) {
            discardCalendarEvent();
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(cancel);
    buttons.addComponent(applyEventButton);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);
}

From source file:com.skysql.manager.ui.TopPanel.java

License:Open Source License

/**
 * Instantiates a new top panel.// ww  w .  j  a va  2 s .c om
 */
public TopPanel() {
    setSpacing(true);
    addStyleName("titleLayout");
    setWidth("100%");

    Embedded logo = new Embedded(null, new ThemeResource("img/productlogo.png"));
    addComponent(logo);
    setComponentAlignment(logo, Alignment.BOTTOM_LEFT);

    // LINKS AREA (TOP-RIGHT)
    HorizontalLayout userSettingsLayout = new HorizontalLayout();
    userSettingsLayout.setSizeUndefined();
    userSettingsLayout.setSpacing(true);
    addComponent(userSettingsLayout);
    setComponentAlignment(userSettingsLayout, Alignment.MIDDLE_RIGHT);

    // User icon and name
    VerticalLayout userLayout = new VerticalLayout();
    userSettingsLayout.addComponent(userLayout);
    userSettingsLayout.setComponentAlignment(userLayout, Alignment.BOTTOM_CENTER);

    UserObject userObject = VaadinSession.getCurrent().getAttribute(UserObject.class);
    String name = userObject.getAnyName();
    userName = new Label("Welcome, " + name);
    userName.setSizeUndefined();
    userLayout.addComponent(userName);

    // buttons
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setSizeUndefined();
    buttonsLayout.setSpacing(true);
    userSettingsLayout.addComponent(buttonsLayout);
    userSettingsLayout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER);

    // Settings button
    SettingsDialog settingsDialog = new SettingsDialog("Settings");
    Button settingsButton = settingsDialog.getButton();
    buttonsLayout.addComponent(settingsButton);
    buttonsLayout.setComponentAlignment(settingsButton, Alignment.MIDDLE_CENTER);

    // Logout
    Button logoutButton = new Button("Logout");
    logoutButton.setSizeUndefined();
    buttonsLayout.addComponent(logoutButton);
    buttonsLayout.setComponentAlignment(logoutButton, Alignment.MIDDLE_CENTER);
    logoutButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(ClickEvent event) {
            UI.getCurrent().getPage().setLocation("");
            UI.getCurrent().close();
            getSession().setAttribute(UserObject.class, null);
            getSession().close();
        }
    });

}

From source file:com.toptal.ui.view.LoginView.java

License:Open Source License

/**
 * Generates content.// ww w . j av  a 2 s .c  o m
 * @return Content.
 */
private Component content() {
    final HorizontalLayout content = new HorizontalLayout();
    content.setSpacing(true);
    this.username = new TextField("Username");
    this.username.setIcon(FontAwesome.USER);
    this.username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    this.password = new PasswordField("Password");
    this.password.setIcon(FontAwesome.LOCK);
    this.password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    final Button login = new Button("Log In");
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    login.setClickShortcut(KeyCode.ENTER);
    login.focus();
    login.addClickListener(e -> this.login(this.username.getValue(), this.password.getValue()));
    final Button signup = new Button("Sign Up");
    signup.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signup.addClickListener(e -> this.signup(this.username.getValue(), this.password.getValue()));
    content.addComponents(this.username, this.password, login, signup);
    content.setComponentAlignment(login, Alignment.BOTTOM_LEFT);
    content.setComponentAlignment(signup, Alignment.BOTTOM_LEFT);
    return content;
}

From source file:com.vphakala.SubscriberUI.java

public SubscriberUI(SubscriberService service) {
    super();/*from w  w w .j  a  va  2  s. c om*/

    this.service = service;

    setMargin(true);
    setSpacing(true);
    setCaption("Subscriber");

    Toolbar toolbar = new Toolbar(this.getCaption(), read, create, update, delete);

    recharge.setStyleName(BaseTheme.BUTTON_LINK);
    HorizontalLayout account = new HorizontalLayout(balance, recharge, rechargeResponse);
    account.setSpacing(true);
    account.setComponentAlignment(recharge, Alignment.BOTTOM_LEFT);

    voucher = voucherService.getRtBVoucherWSImplPort();

    addComponents(toolbar, email, phoneNumber, account);
}