Example usage for com.vaadin.ui.themes ValoTheme BUTTON_FRIENDLY

List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_FRIENDLY

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme BUTTON_FRIENDLY.

Prototype

String BUTTON_FRIENDLY

To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_FRIENDLY.

Click Source Link

Document

A prominent button that can be used instead of the #BUTTON_PRIMARY for primary actions when the action is considered safe for the user (i.e.

Usage

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

private void createViewButtonWithEditableImage(final String name, String caption, String nameImage) {
    Button button = new Button(caption, new ClickListener() {
        @Override//  w  ww  . j  a va  2  s . co m
        public void buttonClick(ClickEvent event) {
            navigator.navigateTo(name);
        }

    });

    button.setPrimaryStyleName(ValoTheme.BUTTON_FRIENDLY);
    //        button.setWidth(50, Unit.PERCENTAGE);
    image.setWidth(90, Unit.PIXELS);
    image.setHeight(90, Unit.PIXELS);

    FileReader.createDirectoriesFromCurrent(getInitialPath());
    final Image image = new Image("", new ThemeResource("img/" + nameImage));
    try {
        FileReader.copyFile(VaadinUtils.getResourcePath(nameImage),
                VaadinUtils.getInitialPath() + File.separator + nameImage);
        image.setSource(new FileResource(new File(VaadinUtils.getInitialPath() + File.separator + nameImage)));
    } catch (IOException e) {
        e.printStackTrace();
        image.setSource(new ThemeResource("img/" + nameImage));
    }

    //        image.setWidth(50, Unit.PERCENTAGE);
    image.setWidth(90, Unit.PIXELS);
    image.setHeight(90, Unit.PIXELS);
    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setPrimaryStyleName(ValoTheme.MENU_ITEM);
    horizontalLayout.addComponents(image, button);
    image.addClickListener(new MouseEvents.ClickListener() {
        @Override
        public void click(MouseEvents.ClickEvent event) {
            uploadFieldImage = new UploadField();
            uploadFieldImage.setAcceptFilter("image/*");
            uploadFieldImage.getUpload().addListener(new com.vaadin.v7.ui.Upload.FailedListener() {
                @Override
                public void uploadFailed(com.vaadin.v7.ui.Upload.FailedEvent event) {
                    uploadFieldImage.clearDefaulLayout();
                    horizontalLayout.removeComponent(uploadFieldImage);
                }

                private static final long serialVersionUID = 1L;

            });
            horizontalLayout.addComponent(uploadFieldImage, 2);
            uploadFieldImage.getUpload().addListener(new com.vaadin.v7.ui.Upload.SucceededListener() {

                @Override
                public void uploadSucceeded(com.vaadin.v7.ui.Upload.SucceededEvent event) {
                    File file = (File) uploadFieldImage.getValue();
                    try {
                        showUploadedImage(uploadFieldImage, image, file.getName(), nameImage);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    uploadFieldImage.clearDefaulLayout();
                    horizontalLayout.removeComponent(uploadFieldImage);

                }
            });
            uploadFieldImage.setFieldType(UploadField.FieldType.FILE);
            horizontalLayout.markAsDirty();
            //                image.setWidth(50, Unit.PERCENTAGE);
            image.setWidth(90, Unit.PIXELS);
            image.setHeight(90, Unit.PIXELS);
            image.setVisible(false);
            image.markAsDirty();
            horizontalLayout.addComponent(image, 0);
        }
    });
    button.setVisible(true);
    image.setVisible(true);
    menuItemsLayout.addComponents(horizontalLayout);
    viewButtons.put(name, button);
}

From source file:com.mcparland.john.vaadin_mvn_arch.samples.authentication.LoginScreen.java

License:Apache License

private Component buildLoginForm() {
    FormLayout loginForm = new FormLayout();

    loginForm.addStyleName("login-form");
    loginForm.setSizeUndefined();// w  w w  .  j a va2  s  .c o  m
    loginForm.setMargin(false);

    loginForm.addComponent(username = new TextField("Username", "admin"));
    username.setWidth(15, Unit.EM);
    loginForm.addComponent(password = new PasswordField("Password"));
    password.setWidth(15, Unit.EM);
    password.setDescription("Write anything");
    CssLayout buttons = new CssLayout();
    buttons.setStyleName("buttons");
    loginForm.addComponent(buttons);

    buttons.addComponent(login = new Button("Login"));
    login.setDisableOnClick(true);
    login.addClickListener(new Button.ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                login();
            } finally {
                login.setEnabled(true);
            }
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    buttons.addComponent(forgotPassword = new Button("Forgot password?"));
    forgotPassword.addClickListener(new Button.ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            showNotification(new Notification("Hint: Try anything"));
        }
    });
    forgotPassword.addStyleName(ValoTheme.BUTTON_LINK);
    return loginForm;
}

From source file:com.mechanicshop.components.DataEntryLayout.java

private void buildLayout() {
    FormLayout formLayout1 = new FormLayout();

    formLayout1.setMargin(new MarginInfo(false, false, false, true));
    formLayout1.setSpacing(true);/*from w ww  .  j a  va 2s  . com*/

    FormLayout formLayout2 = new FormLayout();
    formLayout2.setMargin(new MarginInfo(false, false, false, true));
    formLayout2.setSpacing(true);

    FormLayout formLayout3 = new FormLayout();
    formLayout3.setMargin(new MarginInfo(false, true, false, true));
    formLayout3.setSpacing(true);

    tfTag.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfTag.setWidth("180px");
    tfTag.setMaxLength(3);
    tfTag.setNullRepresentation("");
    tfPhone.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfPhone.setWidth("180px");
    tfPhone.setNullRepresentation("");
    tfPhone.setMaxLength(11);
    tfName.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfName.setWidth("180px");
    tfName.setMaxLength(50);
    tfName.setNullRepresentation("");
    tfVehicle.setWidth("180px");
    tfVehicle.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfVehicle.setMaxLength(75);
    tfVehicle.setNullRepresentation("");
    tfLicensePlate.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfLicensePlate.setWidth("180px");
    tfLicensePlate.setMaxLength(10);
    tfLicensePlate.setNullRepresentation("");
    tfVin.setWidth("180px");
    tfVin.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfVin.setMaxLength(17);
    tfVin.setNullRepresentation("");
    dfInShop.setImmediate(true);
    dfInShop.addStyleName(ValoTheme.DATEFIELD_TINY);
    dfInShop.setInputPrompt("Select");
    dfInShop.setWidth("120px");

    dfOutShop.setImmediate(true);
    dfOutShop.addStyleName(ValoTheme.DATEFIELD_TINY);
    dfOutShop.setInputPrompt("Select");
    dfOutShop.setWidth("120px");

    nsStatus.addItems("In", "Out", "Pending", "Ready", "Comeback");
    nsStatus.setImmediate(true);
    nsStatus.setWidth("120px");
    nsStatus.setStyleName(ValoTheme.COMBOBOX_TINY);
    nsStatus.setValue("In");
    tfMileage.setWidth("120px");
    tfMileage.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfMileage.setMaxLength(6);
    tfMileage.setNullRepresentation("");
    tfPicked.setWidth("120px");
    tfPicked.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfPicked.setMaxLength(3);
    tfPicked.setNullRepresentation("");
    tfPayment.setWidth("180px");
    tfPayment.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfPayment.setMaxLength(50);
    tfPayment.setNullRepresentation("");
    taRemarks.setWidth("500px");
    taRemarks.setStyleName(ValoTheme.TEXTFIELD_TINY);
    taRemarks.setMaxLength(500);
    taRemarks.setNullRepresentation("");
    tfRebuilder.setWidth("180px");
    tfRebuilder.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfRebuilder.setMaxLength(20);
    tfRebuilder.setNullRepresentation("");
    tfInstaller.setWidth("180px");
    tfInstaller.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfInstaller.setMaxLength(20);
    tfInstaller.setNullRepresentation("");
    tfFirstCheckBy.setWidth("500px");
    tfFirstCheckBy.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfFirstCheckBy.setMaxLength(100);
    tfFirstCheckBy.setNullRepresentation("");
    tfSecondCheckBy.setWidth("500px");
    tfSecondCheckBy.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfSecondCheckBy.setMaxLength(100);
    tfSecondCheckBy.setNullRepresentation("");
    dfFirstCheckDate.setImmediate(true);
    dfFirstCheckDate.addStyleName(ValoTheme.DATEFIELD_TINY);
    dfFirstCheckDate.setInputPrompt("Select");
    dfFirstCheckDate.setWidth("120px");

    dfSecondCheckDate.setImmediate(true);
    dfSecondCheckDate.addStyleName(ValoTheme.DATEFIELD_TINY);
    dfSecondCheckDate.setInputPrompt("Select");
    dfSecondCheckDate.setWidth("120px");

    taMedia.setWidth("500px");
    taMedia.setStyleName(ValoTheme.TEXTFIELD_TINY);
    taMedia.setNullRepresentation("");
    taMedia2.setWidth("500px");
    taMedia2.setStyleName(ValoTheme.TEXTFIELD_TINY);
    taMedia2.setNullRepresentation("");
    tfReferedBy.setWidth("180px");
    tfReferedBy.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfReferedBy.setMaxLength(20);
    tfReferedBy.setNullRepresentation("");
    tfWarrantyLimit.setWidth("180px");
    tfWarrantyLimit.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tfWarrantyLimit.setMaxLength(5);
    tfWarrantyLimit.setNullRepresentation("");
    nsWarranty.setWidth("120px");
    nsWarranty.setStyleName(ValoTheme.TEXTFIELD_TINY);
    nsWarranty.addItems("YES", "NO");
    nsWarranty.setValue("NO");
    nsWarranty.setStyleName(ValoTheme.COMBOBOX_TINY);

    nsSMS.setWidth("120px");
    nsSMS.setStyleName(ValoTheme.TEXTFIELD_TINY);
    nsSMS.addItems("YES", "NO");
    nsSMS.setValue("NO");
    nsComeback.setWidth("120px");
    nsComeback.setStyleName(ValoTheme.TEXTFIELD_TINY);
    nsComeback.addItems("YES", "NO");
    nsComeback.setValue("NO");
    nsComeback.setStyleName(ValoTheme.COMBOBOX_TINY);

    formLayout1.addComponents(tfTag, tfPhone, tfName, tfVehicle, tfPayment, tfRebuilder, tfInstaller,
            tfLicensePlate, tfVin, tfReferedBy, tfWarrantyLimit);

    formLayout2.addComponents(nsWarranty, dfInShop, dfOutShop, nsStatus, nsSMS, nsComeback, tfMileage, tfPicked,
            dfFirstCheckDate, dfSecondCheckDate);

    formLayout3.addComponents(tfFirstCheckBy, tfSecondCheckBy, taRemarks, taMedia, taMedia2);

    HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.setMargin(new MarginInfo(false, true, false, true));

    sendBtn.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            Integer tag = null;
            Integer mileage = null;
            if (tfTag.getValue() != null)
                if (!tfTag.getValue().isEmpty()) {
                    tag = (Integer.parseInt(tfTag.getValue()));
                } else
                    tag = null;

            if (tfMileage.getValue() != null)
                if (!tfMileage.getValue().isEmpty()) {
                    mileage = (Integer.parseInt(tfMileage.getValue()));
                } else
                    mileage = null;

            Object[] args = new Object[] { tag, tfPhone.getValue(), tfName.getValue(), tfVehicle.getValue(),
                    tfLicensePlate.getValue(), tfVin.getValue(), dfInShop.getValue(), dfOutShop.getValue(),
                    nsStatus.getValue(), mileage, tfPicked.getValue(), tfPayment.getValue(),
                    taRemarks.getValue(), tfRebuilder.getValue(), tfInstaller.getValue(),
                    tfFirstCheckBy.getValue(), tfSecondCheckBy.getValue(), dfFirstCheckDate.getValue(),
                    dfSecondCheckDate.getValue(), taMedia.getValue(), taMedia2.getValue(),
                    tfReferedBy.getValue(), tfWarrantyLimit.getValue(), nsWarranty.getValue(), nsSMS.getValue(),
                    nsComeback.getValue() };

            if (sendBtn.getCaption().equals("Add")) {
                try {
                    String status = nsStatus.getValue().toString();
                    searchService.insertCar(args, status);
                    Notification.show("Entry inserted succesfully");
                    close();
                } catch (Exception e) {
                    e.printStackTrace();
                    Notification.show("An error has occurred", Notification.Type.ERROR_MESSAGE);
                }
            } else {
                try {
                    searchService.editCar(args, tableName, no);
                    Notification.show("Entry edited succesfully");
                    close();
                } catch (Exception e) {
                    e.printStackTrace();
                    Notification.show("An error has occurred", Notification.Type.ERROR_MESSAGE);
                }

            }
        }

    });
    sendBtn.setImmediate(true);
    sendBtn.setStyleName(ValoTheme.BUTTON_TINY);
    sendBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    layoutButtons.setSizeUndefined();
    layoutButtons.setSpacing(true);
    layoutButtons.addComponents(sendBtn);

    hLayoutForms.addComponents(formLayout1, formLayout2, formLayout3);

    mainLayout.addComponent(hLayoutForms);
    mainLayout.addComponent(layoutButtons);
    mainLayout.setComponentAlignment(hLayoutForms, Alignment.MIDDLE_CENTER);
    mainLayout.setComponentAlignment(layoutButtons, Alignment.MIDDLE_LEFT);
    mainLayout.setExpandRatio(hLayoutForms, 3);

}

From source file:com.mechanicshop.components.TableLayout.java

private void buildLayout() {
    HorizontalLayout layoutTitle = new HorizontalLayout();
    layoutTitle.setSizeUndefined();//from   w  w  w .j  a v a 2  s.  c om
    layoutTitle.setWidth("100%");
    layoutTitle.setSpacing(false);
    layoutTitle.setMargin(false);
    titleLabel.addStyleName(ValoTheme.LABEL_H2);
    titleLabel.addStyleName(ValoTheme.LABEL_COLORED);
    titleLabel.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    titleLabel.addStyleName(ValoTheme.LABEL_BOLD);
    titleLabel.setSizeUndefined();

    layoutTitle.addComponent(titleLabel);
    layoutTitle.setComponentAlignment(titleLabel, Alignment.MIDDLE_CENTER);

    VerticalLayout layoutTable = new VerticalLayout();

    layoutTable.addComponent(table);
    layoutTable.setComponentAlignment(table, Alignment.TOP_CENTER);
    layoutTable.setSizeFull();

    layoutTable.setSpacing(true);
    HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.setMargin(false);
    layoutButtons.setSpacing(true);
    layoutButtons.setSizeUndefined();
    layoutButtons.setWidth("100%");
    Button addBtn = new Button("Add new Car");
    addBtn.addClickListener(addBtnListener);
    addBtn.setImmediate(true);
    addBtn.setStyleName(ValoTheme.BUTTON_TINY);
    addBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    Button deleteBtn = new Button("Delete Selected");
    deleteBtn.setStyleName(ValoTheme.BUTTON_TINY);
    deleteBtn.addStyleName(ValoTheme.BUTTON_DANGER);
    deleteBtn.setImmediate(true);
    deleteBtn.addClickListener(removeListener);

    btnSendSMS.setStyleName(ValoTheme.BUTTON_TINY);
    btnSendSMS.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    btnSendSMS.setImmediate(true);
    btnSendSMS.addClickListener(sendSMSBtnListener);

    searchTextField.setImmediate(true);
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_TINY);
    searchTextField.addTextChangeListener(filterChangeListener);
    Label lbSearch = new Label("Search");
    lbSearch.addStyleName(ValoTheme.LABEL_TINY);
    lbSearch.setSizeUndefined();
    layoutButtons.addComponents(lbSearch, searchTextField, addBtn, deleteBtn, btnSendSMS);

    layoutButtons.setComponentAlignment(lbSearch, Alignment.MIDDLE_LEFT);
    layoutButtons.setComponentAlignment(searchTextField, Alignment.BOTTOM_LEFT);
    layoutButtons.setComponentAlignment(addBtn, Alignment.BOTTOM_RIGHT);
    layoutButtons.setComponentAlignment(deleteBtn, Alignment.BOTTOM_RIGHT);
    layoutButtons.setComponentAlignment(btnSendSMS, Alignment.BOTTOM_RIGHT);
    layoutButtons.setExpandRatio(addBtn, 3);
    addComponent(layoutTitle);
    addComponent(layoutTable);
    layoutTable.addComponent(layoutButtons);
    layoutTable.setExpandRatio(table, 3);
    setComponentAlignment(layoutTitle, Alignment.TOP_CENTER);
    setComponentAlignment(layoutTable, Alignment.TOP_CENTER);
    setExpandRatio(layoutTable, 3);
    setSpacing(true);
    setMargin(true);

}

From source file:com.mechanicshop.components.TableLayout.java

public void createCustomMessage() {
    final TextArea textArea = new TextArea();
    textArea.setImmediate(true);/*w  ww.j a va 2s  .c o m*/
    textArea.setColumns(30);
    textArea.setRows(10);
    textArea.addStyleName(ValoTheme.TEXTAREA_SMALL);
    textArea.setRequired(true);
    final Window subWindow = new Window();
    subWindow.setModal(true);
    subWindow.setHeight("350px");
    subWindow.setWidth("500px");
    subWindow.setCaption("Insert Message");
    subWindow.setStyleName(ValoTheme.WINDOW_TOP_TOOLBAR);
    subWindow.setClosable(false);
    subWindow.setResizable(false);

    HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.setMargin(false);
    Button sendBtn = new Button("Send");
    sendBtn.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                textArea.validate();
                String message = textArea.getValue();
                smsSenderService.sendMessageMassive(message);
                subWindow.close();
                Notification.show("Message Sent");
            } catch (Exception e) {

            }
        }
    });
    sendBtn.setImmediate(true);
    sendBtn.setStyleName(ValoTheme.BUTTON_TINY);
    sendBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    Button cancelBtn = new Button("Cancel");
    cancelBtn.setStyleName(ValoTheme.BUTTON_TINY);
    cancelBtn.addStyleName(ValoTheme.BUTTON_DANGER);
    cancelBtn.setImmediate(true);
    cancelBtn.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            subWindow.close();

        }
    });

    layoutButtons.setSizeUndefined();
    layoutButtons.setSpacing(true);
    layoutButtons.addComponents(cancelBtn, sendBtn);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.addComponent(textArea);
    layout.addComponent(layoutButtons);
    layout.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(layoutButtons, Alignment.MIDDLE_RIGHT);
    layout.setExpandRatio(textArea, 3);

    layout.setSizeFull();

    subWindow.setContent(layout);
    subWindow.center();

    getUI().addWindow(subWindow);
}

From source file:com.mycompany.controller.initUImethods.java

public void createButt(String day, Grid.MultiSelectionModel selectionOfGivenDay, Grid gridOfGivenDay,
        Grid.FooterRow footer) {/*from   w  w  w . j a  v  a  2s. c o m*/
    Button buttonThisDay = new Button("Add to cart", new Button.ClickListener() { //anonim inner class

        @Override
        public void buttonClick(Button.ClickEvent e) {
            for (Object itemId : selectionOfGivenDay.getSelectedRows()) {
                Property nameOfGiven = gridOfGivenDay.getContainerDataSource().getContainerProperty(itemId,
                        "name");
                Property priceOfGiven = gridOfGivenDay.getContainerDataSource().getContainerProperty(itemId,
                        "price");
                Property quantityOfGiven = gridOfGivenDay.getContainerDataSource().getContainerProperty(itemId,
                        "quantity");
                int price = Integer.parseInt(priceOfGiven.getValue().toString());
                int quan = Integer.parseInt(quantityOfGiven.getValue().toString());
                cartItems.add(new CartObject(day, nameOfGiven.getValue().toString(), price, quan,
                        Days.valueOf(day).getPriority()));
            }

            cart.getContainerDataSource().removeAllItems(); //sorbarendezs miatt, nem a legjobb de elmegy
            sum = 0;
            gridOfGivenDay.getSelectionModel().reset();
            cartItems.sort(Comparator.comparing(CartObject::getPriority));

            for (CartObject cartItem : cartItems) {
                cart.addRow(cartItem.getDay(), cartItem.getFoodName(), cartItem.getPrice(), cartItem.getQuan());
                sum += cartItem.getPrice() * cartItem.getQuan();
            }
            footer.getCell("Mennyisg").setText(Integer.toString(sum));
        }
    });

    gridOfGivenDay.getFooterRow(0).getCell("name").setComponent(buttonThisDay);
    buttonThisDay.setStyleName(ValoTheme.BUTTON_FRIENDLY);
}

From source file:com.philippefichet.vaadincdipush.view.FirstView.java

@PostConstruct
public void init() {
    setHeight("100%");
    loginLayout = new HorizontalLayout();
    Label loginLabel = new Label("Login");
    loginChoose = new TextField();
    attach = new Button("Connect");
    attach.addClickListener((Button.ClickEvent event) -> {
        if (chat.loginFree(loginChoose.getValue())) {
            if (login == null) {
                login = loginChoose.getValue();
                chat.getUsernameConnected().forEach((l) -> {
                    newUser(l);/*from  ww  w .  j a  va 2  s . c o m*/
                });
                chat.attach(this);
            } else {
                chat.rename(loginChoose.getValue(), this);
                login = loginChoose.getValue();
            }
            attach.setStyleName(ValoTheme.BUTTON_FRIENDLY);
            Notification.show("Login \"" + loginChoose.getValue() + "\" valid.", null,
                    Notification.Type.HUMANIZED_MESSAGE);

            messagePanel.setVisible(true);
            sendLayout.setVisible(true);

        } else {
            Notification.show("Login \"" + loginChoose.getValue() + "\" already exist.", null,
                    Notification.Type.ERROR_MESSAGE);
        }
    });

    chatMessage.setWidth("100%");
    sendLayout.setWidth("100%");
    sendMessage.setWidthUndefined();
    sendLayout.addComponent(chatMessage);
    sendLayout.addComponent(sendMessage);
    sendLayout.setExpandRatio(chatMessage, 100);
    sendMessage.addClickListener((event) -> {
        chat.sendMessage(this, chatMessage.getValue());
        chatMessage.setValue("");
    });

    Button next = new Button("next");
    next.addClickListener((eventClick) -> {
        getUI().getNavigator().navigateTo("next");
    });

    loginLayout.addComponent(loginLabel);
    loginLayout.addComponent(loginChoose);
    loginLayout.addComponent(attach);
    loginLayout.setComponentAlignment(loginLabel, Alignment.MIDDLE_RIGHT);
    loginLayout.setComponentAlignment(loginChoose, Alignment.MIDDLE_CENTER);
    loginLayout.setComponentAlignment(attach, Alignment.MIDDLE_LEFT);

    loginLayout.setWidth("100%");
    loginLabel.setWidthUndefined();
    loginChoose.setWidth("100%");
    attach.setWidthUndefined();
    messagePanel.setHeight("100%");
    listUserPanel.setStyleName(ValoTheme.PANEL_WELL);
    listUserPanel.setContent(listUserLayout);
    listUserPanel.setHeight("100%");
    centerLayout.setHeight("100%");
    centerLayout.addComponent(listUserPanel);
    centerLayout.addComponent(messageLayout);
    centerLayout.setExpandRatio(messageLayout, 100);
    messagePanel.setContent(centerLayout);
    addComponent(loginLayout);
    addComponent(messagePanel);
    addComponent(sendLayout);

    messagePanel.setVisible(false);
    sendLayout.setVisible(false);

    setExpandRatio(messagePanel, 100);
}

From source file:com.scipionyx.butterflyeffect.frontend.configuration.ui.view.AboutView.java

License:Apache License

/**
 * //w  w w .ja  v  a 2  s .c  om
 */
@Override
public void doBuildWorkArea(VerticalLayout workAreaPanel) throws Exception {

    //
    tableFrontEndInformation = new Grid<>("Frontend Information");
    tableFrontEndInformation.addColumn(GridProperty::getName).setCaption("Property");
    tableFrontEndInformation.addColumn(GridProperty::getValue).setCaption("Value");
    tableFrontEndInformation.addColumn(GridProperty::getDescription).setCaption("Description");

    workAreaPanel.addComponent(tableFrontEndInformation);

    //
    backendLayout = createClusterInformation("Backend", workAreaPanel);
    frontendLayout = createClusterInformation("Frontend", workAreaPanel);

    addButton(ValoTheme.BUTTON_FRIENDLY, new Button("Refresh", event -> doEnter(null)));

}

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

License:Open Source License

/**
 * Generates content.//from  ww w. j  a  v  a 2 s  .  com
 * @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:de.fatalix.app.view.login.LoginView.java

private Component buildLoginForm() {
    FormLayout loginForm = new FormLayout();

    loginForm.addStyleName("login-form");
    loginForm.setSizeUndefined();//from  w  ww.jav  a  2  s . c  om
    loginForm.setMargin(false);

    loginForm.addComponent(username = new TextField("Username", "admin"));
    username.setWidth(15, Unit.EM);
    loginForm.addComponent(password = new PasswordField("Password"));
    password.setWidth(15, Unit.EM);
    password.setDescription("Write anything");
    CssLayout buttons = new CssLayout();
    buttons.setStyleName("buttons");
    loginForm.addComponent(buttons);

    buttons.addComponent(login = new Button("Login"));
    login.setDisableOnClick(true);
    login.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                presenter.doLogin(username.getValue(), password.getValue());
            } catch (AuthenticationException ex) {
                LoginView.this.showNotification(
                        new Notification("Wrong login", Notification.Type.ERROR_MESSAGE),
                        ValoTheme.NOTIFICATION_FAILURE);
            } finally {
                login.setEnabled(true);
            }
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    buttons.addComponent(forgotPassword = new Button("Forgot password?"));
    forgotPassword.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            showNotification(new Notification("Hint: Try anything", Notification.Type.HUMANIZED_MESSAGE),
                    ValoTheme.NOTIFICATION_SUCCESS);
        }
    });
    forgotPassword.addStyleName(ValoTheme.BUTTON_LINK);
    return loginForm;
}