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

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

Introduction

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

Prototype

String LABEL_SUCCESS

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

Click Source Link

Document

Success badge style.

Usage

From source file:by.bigvova.LoginUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    getPage().setTitle("Vaadin Shared Security Demo Login");

    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();// w w w . ja va  2s.co m

    userName = new TextField("Username");
    passwordField = new PasswordField("Password");
    rememberMe = new CheckBox("Remember me");
    login = new Button("Login");
    Label label = new Label("Name: User / Password: password");
    loginForm.addComponent(userName);
    loginForm.addComponent(passwordField);
    loginForm.addComponent(rememberMe);
    loginForm.addComponent(login);
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            login();
        }
    });

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSpacing(true);
    loginLayout.setSizeUndefined();

    if (request.getParameter("logout") != null) {
        loggedOutLabel = new Label("You have been logged out!");
        loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
        loggedOutLabel.setSizeUndefined();
        loginLayout.addComponent(loggedOutLabel);
        loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
    }

    loginLayout.addComponent(loginFailedLabel = new Label());
    loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
    loginFailedLabel.setSizeUndefined();
    loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
    loginFailedLabel.setVisible(false);

    loginLayout.addComponent(label);
    loginLayout.addComponent(loginForm);
    loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

    VerticalLayout rootLayout = new VerticalLayout(loginLayout);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
    setContent(rootLayout);
    setSizeFull();
}

From source file:com.example.bbs.vaadin.view.Labels.java

License:Apache License

public Labels() {
    setMargin(true);/*from  w  w w . jav a 2s .  c  o  m*/
    addStyleName("content-labels");

    Label h1 = new Label("Labels");
    h1.addStyleName(ValoTheme.LABEL_H1);
    addComponent(h1);

    HorizontalLayout split = new HorizontalLayout();
    split.setWidth("100%");
    addComponent(split);

    VerticalLayout left = new VerticalLayout();
    left.setMargin(new MarginInfo(false, true, false, false));
    split.addComponent(left);

    Label huge = new Label("Huge type for display text.");
    huge.addStyleName(ValoTheme.LABEL_HUGE);
    left.addComponent(huge);

    Label large = new Label(
            "Large type for introductory text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    large.addStyleName(ValoTheme.LABEL_LARGE);
    left.addComponent(large);

    Label h2 = new Label("Subtitle");
    h2.addStyleName(ValoTheme.LABEL_H2);
    left.addComponent(h2);

    Label normal = new Label(
            "Normal type for plain text, with a <a href=\"https://vaadin.com\">regular link</a>. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.",
            ContentMode.HTML);
    left.addComponent(normal);

    Label h3 = new Label("Small Title");
    h3.addStyleName(ValoTheme.LABEL_H3);
    left.addComponent(h3);

    Label small = new Label(
            "Small type for additional text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    small.addStyleName(ValoTheme.LABEL_SMALL);
    left.addComponent(small);

    Label tiny = new Label("Tiny type for minor text.");
    tiny.addStyleName(ValoTheme.LABEL_TINY);
    left.addComponent(tiny);

    Label h4 = new Label("Section Title");
    h4.addStyleName(ValoTheme.LABEL_H4);
    left.addComponent(h4);

    normal = new Label(
            "Normal type for plain text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    left.addComponent(normal);

    Panel p = new Panel("Additional Label Styles");
    split.addComponent(p);

    VerticalLayout right = new VerticalLayout();
    right.setSpacing(true);
    right.setMargin(true);
    p.setContent(right);

    Label label = new Label(
            "Bold type for prominent text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    label.addStyleName(ValoTheme.LABEL_BOLD);
    right.addComponent(label);

    label = new Label(
            "Light type for subtle text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    label.addStyleName(ValoTheme.LABEL_LIGHT);
    right.addComponent(label);

    label = new Label(
            "Colored type for highlighted text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
    label.addStyleName(ValoTheme.LABEL_COLORED);
    right.addComponent(label);

    label = new Label("A label for success");
    label.addStyleName(ValoTheme.LABEL_SUCCESS);
    right.addComponent(label);

    label = new Label("A label for failure");
    label.addStyleName(ValoTheme.LABEL_FAILURE);
    right.addComponent(label);

}

From source file:com.gmail.volodymyrdotsenko.cms.fe.vaadin.LoginUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    langRepo.findAll().forEach(e -> {
        langSet.add(e.getCode());//w  w  w  .jav  a  2  s . c  o m
    });

    lang = new ComboBox("Language", langSet);

    getPage().setTitle("CMS");

    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();

    loginForm.addComponent(userName = new TextField("Username"));
    userName.setRequired(true);
    loginForm.addComponent(passwordField = new PasswordField("Password"));
    passwordField.setRequired(true);
    loginForm.addComponent(rememberMe = new CheckBox("Remember me"));
    loginForm.addComponent(lang);
    lang.setRequired(true);
    lang.setNullSelectionAllowed(false);
    loginForm.addComponent(login = new Button("Login"));
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(e -> {
        login();
    });

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSpacing(true);
    loginLayout.setSizeUndefined();

    if (request.getParameter("logout") != null) {
        loggedOutLabel = new Label("You have been logged out!");
        loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
        loggedOutLabel.setSizeUndefined();
        loginLayout.addComponent(loggedOutLabel);
        loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
    }

    loginLayout.addComponent(loginFailedLabel = new Label());
    loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
    loginFailedLabel.setSizeUndefined();
    loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
    loginFailedLabel.setVisible(false);

    loginLayout.addComponent(loginForm);
    loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

    VerticalLayout rootLayout = new VerticalLayout(loginLayout);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
    setContent(rootLayout);
    setSizeFull();

    String currentLang = getLocale().getLanguage();
    if (langSet.contains(currentLang))
        lang.select(currentLang);
    else
        lang.select("en");
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DataHandler.java

License:Open Source License

/**
 * /*from  w w w . j a v  a 2 s .  c o  m*/
 * @param statusValues
 * @return
 */
public VerticalLayout createProjectStatusComponentNew(Map<String, Integer> statusValues) {
    VerticalLayout projectStatusContent = new VerticalLayout();
    projectStatusContent.setResponsive(true);
    projectStatusContent.setMargin(true);
    projectStatusContent.setSpacing(true);

    Label planned = new Label();
    Label design = new Label();
    Label raw = new Label();
    Label results = new Label();

    Iterator<Entry<String, Integer>> it = statusValues.entrySet().iterator();

    while (it.hasNext()) {
        Map.Entry<String, Integer> pairs = (Map.Entry<String, Integer>) it.next();

        if ((Integer) pairs.getValue() == 0) {
            Label statusLabel = new Label(pairs.getKey());
            statusLabel.setStyleName(ValoTheme.LABEL_FAILURE);
            statusLabel.setResponsive(true);
            // statusLabel.addStyleName("redicon");
            if (pairs.getKey().equals("Project planned")) {
                planned = statusLabel;
            } else if (pairs.getKey().equals("Experimental design registered")) {
                design = statusLabel;
            } else if (pairs.getKey().equals("Raw data registered")) {
                raw = statusLabel;
            } else if (pairs.getKey().equals("Results registered")) {
                results = statusLabel;
            }
        }

        else {
            Label statusLabel = new Label(pairs.getKey());
            statusLabel.setStyleName(ValoTheme.LABEL_SUCCESS);
            statusLabel.setResponsive(true);

            // statusLabel.addStyleName("greenicon");

            if (pairs.getKey().equals("Project planned")) {
                planned = statusLabel;
            } else if (pairs.getKey().equals("Experimental design registered")) {
                design = statusLabel;
            } else if (pairs.getKey().equals("Raw data registered")) {
                raw = statusLabel;
            } else if (pairs.getKey().equals("Results registered")) {
                results = statusLabel;
            }
        }
    }

    projectStatusContent.addComponent(planned);
    projectStatusContent.addComponent(design);
    projectStatusContent.addComponent(raw);
    projectStatusContent.addComponent(results);

    // ProgressBar progressBar = new ProgressBar();
    // progressBar.setValue((float) finishedExperiments / statusValues.keySet().size());
    // projectStatusContent.addComponent(progressBar);

    return projectStatusContent;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientView.java

License:Open Source License

/**
 * /*from w  w w  . j av  a  2 s.  co m*/
 * @param list
 * @return
 */
private Component getMembersComponent() {
    membersLayout = new HorizontalLayout();
    // membersLayout.setIcon(FontAwesome.USERS);
    // membersLayout.setCaption("Members");
    membersLayout.setWidth("100%");

    // final Button loadMembers = new Button("[+]");
    // membersLayout.addComponent(loadMembers);
    // loadMembers.setStyleName(ValoTheme.BUTTON_LINK);
    // loadMembers.addClickListener(new ClickListener() {

    // @Override
    // public void buttonClick(ClickEvent event) {
    ProgressBar progress = new ProgressBar();
    progress.setIndeterminate(true);
    Label info = new Label(
            "Searching for members. Can take several seconds on big projects. Please be patient.");
    info.setStyleName(ValoTheme.LABEL_SUCCESS);
    // membersLayout.addComponent(info);
    membersLayout.addComponent(progress);
    MemberWorker worker = new MemberWorker();
    worker.start();
    UI.getCurrent().setPollInterval(500);
    // loadMembers.setEnabled(false);

    return membersLayout;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientView.java

License:Open Source License

public void loadGraph() {
    // LOGGER.debug(String.valueOf(graphSectionContent.getComponentCount() == 0));
    if (graphSectionContent.getComponentCount() > 0)
        LOGGER.debug(String.valueOf(graphSectionContent.getComponent(0) instanceof Image));
    if (graphSectionContent.getComponentCount() == 0
            || !(graphSectionContent.getComponent(0) instanceof Image)) {
        ProgressBar progress = new ProgressBar();
        progress.setIndeterminate(true);
        Label info = new Label(
                "Computing the project graph can take several seconds on big projects. Please be patient.");
        info.setStyleName(ValoTheme.LABEL_SUCCESS);
        graphSectionContent.removeAllComponents();
        // graphSectionContent.addComponent(info);
        graphSectionContent.addComponent(progress);
        // graphSectionContent.setComponentAlignment(info, Alignment.MIDDLE_CENTER);
        graphSectionContent.setComponentAlignment(progress, Alignment.MIDDLE_CENTER);

        Worker worker = new Worker(getCurrent());
        worker.start();/*from  w ww .j a v a2s.c  om*/
        UI.getCurrent().setPollInterval(500);
    }
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjectView.java

License:Open Source License

/**
 * /* w  w  w .ja  v  a  2s. com*/
 */
public void loadGraph() {
    if (graphSectionContent.getComponentCount() == 0
            || !(graphSectionContent.getComponent(0) instanceof Image)) {
        ProgressBar progress = new ProgressBar();
        progress.setIndeterminate(true);
        Label info = new Label(
                "Computing the project graph can take several seconds on big projects. Please be patient.");
        info.setStyleName(ValoTheme.LABEL_SUCCESS);
        graphSectionContent.removeAllComponents();
        graphSectionContent.addComponent(progress);
        graphSectionContent.setComponentAlignment(progress, Alignment.MIDDLE_CENTER);
        Worker worker = new Worker(getCurrent());
        worker.start();
        UI.getCurrent().setPollInterval(500);
    }
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjectView.java

License:Open Source License

/**
 * /*from  w w  w . j  a v  a 2s  .  c o m*/
 * @param list
 * @return
 */
private Component getMembersComponent() {
    membersLayout = new HorizontalLayout();
    membersLayout.setWidth("100%");

    ProgressBar progress = new ProgressBar();
    progress.setIndeterminate(true);
    Label info = new Label(
            "Searching for members. Can take several seconds on big projects. Please be patient.");
    info.setStyleName(ValoTheme.LABEL_SUCCESS);
    membersLayout.addComponent(progress);
    MemberWorker worker = new MemberWorker();
    worker.start();
    UI.getCurrent().setPollInterval(500);

    return membersLayout;
}

From source file:gq.vaccum121.ui.LoginScreen.java

License:Apache License

private void initLayout() {
    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();//  w w  w. ja va 2  s  .  c  o  m
    userName = new TextField("Username");
    passwordField = new PasswordField("Password");
    login = new Button("Login");
    loginForm.addComponent(userName);
    loginForm.addComponent(passwordField);
    loginForm.addComponent(login);
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            login();
        }
    });

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSizeUndefined();

    loginFailedLabel = new Label();
    loginLayout.addComponent(loginFailedLabel);
    loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
    loginFailedLabel.setSizeUndefined();
    loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
    loginFailedLabel.setVisible(false);

    loggedOutLabel = new Label("Good bye!");
    loginLayout.addComponent(loggedOutLabel);
    loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
    loggedOutLabel.setSizeUndefined();
    loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
    loggedOutLabel.setVisible(false);

    loginLayout.addComponent(loginForm);
    loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

    VerticalLayout rootLayout = new VerticalLayout(loginLayout);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
    setCompositionRoot(rootLayout);
    setSizeFull();
}

From source file:org.vaadin.mqtt.ui.MqttComponent.java

/**
 * Show a message instead of the content.
 *
 * @param message//from   w w  w  .  j  a  va 2s  .  c om
 * @param isSucsess Error messages are formatted differently from success
 * messages.
 */
public final void showUserMessage(final String message, boolean isSucsess) {
    removeAllComponents();
    Label l = new Label(message);
    l.setStyleName(isSucsess ? ValoTheme.LABEL_SUCCESS : ValoTheme.LABEL_FAILURE);
    addComponents(title, l);
}