Example usage for com.vaadin.ui Button getCaption

List of usage examples for com.vaadin.ui Button getCaption

Introduction

In this page you can find the example usage for com.vaadin.ui Button getCaption.

Prototype

@Override
    public String getCaption() 

Source Link

Usage

From source file:at.jku.ce.adaptivetesting.vaadin.ui.core.VaadinUI.java

License:LGPL

public VaadinUI() {
    // Set up the Navigator
    navigator = new Navigator(this, this);

    // Create Welcome Screen
    MainUI mainScreen = new MainUI();
    mainScreen.setMargin(true);//w  ww.  ja  v  a2s . co  m
    Button start = new Button("Start", e -> {
        navigator.navigateTo(Views.TEST.toString());
    });
    start.setWidth("40%");
    start.setHeight("40%");
    //mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h1", "Willkommen zur " + productData)));
    mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h2", "Bitte klicke den <b>" + start.getCaption()
            + "</b> Button um mit dem Rechnungswesentest zu beginnen!")));
    mainScreen.addComponent(start);
    mainScreen.setComponentAlignment(start, Alignment.MIDDLE_CENTER);

    navigator.addView(Views.DEFAULT.toString(), mainScreen);
    // Question view
    // Change this to the questionManager you like
    final QuestionManager manager = new AccountingQuestionManager("Rechnungswesentest");
    navigator.addView(Views.TEST.toString(), manager);
    navigator.addView(Views.Log.toString(), new LogView(new File(Servlet.getLogFileName())));
    navigator.addView(Views.Admin.toString(), new AdminView(manager));
    navigator.addView(Views.Results.toString(), new ResultView(manager));
    navigator.setErrorView(mainScreen);
    LogHelper.logInfo("Startup completed");
}

From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.core.VaadinUI.java

License:LGPL

public VaadinUI() {
    // Set up the Navigator
    navigator = new Navigator(this, this);

    // Create Welcome Screen
    MainUI mainScreen = new MainUI();
    mainScreen.setMargin(true);//from   w  w  w . jav a  2  s.  c o m
    Button start = new Button("Start", e -> {
        navigator.navigateTo(Views.TEST.toString());
    });
    start.setWidth("40%");
    start.setHeight("40%");
    mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h1", "Welcome to " + productData)));
    mainScreen.addComponent(new HtmlLabel(
            HtmlUtils.center("h2", "Click the <b>" + start.getCaption() + "</b> Button to start!")));
    mainScreen.addComponent(start);
    mainScreen.setComponentAlignment(start, Alignment.MIDDLE_CENTER);

    navigator.addView(Views.DEFAULT.toString(), mainScreen);
    // Question view
    // Change this to the questionManager you like
    final QuestionManager manager = new AccountingQuestionManager("Accounting Quiz");
    navigator.addView(Views.TEST.toString(), manager);
    navigator.addView(Views.Log.toString(), new LogView(new File(Servlet.getLogFileName())));
    navigator.setErrorView(mainScreen);
    LogHelper.logInfo("Startup completed");
}

From source file:com.cavisson.gui.dashboard.components.controls.ValoThemeUI.java

License:Apache License

CssLayout buildMenu() {
    // Add items/*from  ww w.  j av a 2s . co m*/
    menuItems.put("common", "Common UI Elements");
    menuItems.put("labels", "Labels");
    menuItems.put("buttons-and-links", "Buttons & Links");
    menuItems.put("textfields", "Text Fields");
    menuItems.put("datefields", "Date Fields");
    menuItems.put("comboboxes", "Combo Boxes");
    menuItems.put("selects", "Selects");
    menuItems.put("checkboxes", "Check Boxes & Option Groups");
    menuItems.put("sliders", "Sliders & Progress Bars");
    menuItems.put("colorpickers", "Color Pickers");
    menuItems.put("menubars", "Menu Bars");
    menuItems.put("trees", "Trees");
    menuItems.put("tables", "Tables");
    menuItems.put("dragging", "Drag and Drop");
    menuItems.put("panels", "Panels");
    menuItems.put("splitpanels", "Split Panels");
    menuItems.put("tabs", "Tabs");
    menuItems.put("accordions", "Accordions");
    menuItems.put("popupviews", "Popup Views");
    // menuItems.put("calendar", "Calendar");
    menuItems.put("forms", "Forms");

    final HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName("valo-menu-title");
    menu.addComponent(top);
    menu.addComponent(createThemeSelect());

    final Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    final Label title = new Label("<h3>Vaadin <strong>Valo Theme</strong></h3>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);

    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");
    final StringGenerator sg = new StringGenerator();
    final MenuItem settingsItem = settings.addItem(
            sg.nextString(true) + " " + sg.nextString(true) + sg.nextString(false),
            new ThemeResource("../tests-valo/img/profile-pic-300px.jpg"), null);
    settingsItem.addItem("Edit Profile", null);
    settingsItem.addItem("Preferences", null);
    settingsItem.addSeparator();
    settingsItem.addItem("Sign Out", null);
    menu.addComponent(settings);

    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    Label label = null;
    int count = -1;
    for (final Entry<String, String> item : menuItems.entrySet()) {
        if (item.getKey().equals("labels")) {
            label = new Label("Components", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        if (item.getKey().equals("panels")) {
            label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");
            count = 0;
            label = new Label("Containers", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        if (item.getKey().equals("forms")) {
            label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");
            count = 0;
            label = new Label("Other", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        final Button b = new Button(item.getValue(), new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                navigator.navigateTo(item.getKey());
            }
        });
        if (count == 2) {
            b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">123</span>");
        }
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName("valo-menu-item");
        b.setIcon(testIcon.get());
        menuItemsLayout.addComponent(b);
        count++;
    }
    label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");

    return menu;
}

From source file:com.esofthead.mycollab.module.crm.view.CrmToolbar.java

License:Open Source License

public void gotoItem(final String crmItem) {
    for (final Iterator<com.vaadin.ui.Component> it = this.iterator(); it.hasNext();) {
        final Button btn = (Button) it.next();
        if (crmItem.equals(btn.getCaption())) {
            btn.addStyleName("isSelected");
        } else {/*w  w  w.  j  ava  2s. c o  m*/
            btn.removeStyleName("isSelected");
        }
    }
}

From source file:com.esofthead.mycollab.vaadin.web.ui.OptionPopupContent.java

License:Open Source License

public void addOption(Button btn) {
    CssLayout wrap = new CssLayout();
    btn.setWidth("100%");
    btn.setDescription(btn.getCaption());
    btn.addStyleName("action");
    wrap.addStyleName("action-wrap");
    wrap.addComponent(btn);/*from   w w  w . ja v  a2  s  . co m*/
    ((ComponentContainer) this.getCompositionRoot()).addComponent(wrap);
}

From source file:com.peergreen.webconsole.core.notifier.NotifierService.java

License:Open Source License

/**
 * Get initial caption of the button/*  w w  w  .  j a va 2 s. c  om*/
 *
 * @param button button
 * @return button caption
 */
private String getInitialCaption(Button button) {
    if (button.getCaption().contains("<span")) {
        return button.getCaption().substring(0, button.getCaption().indexOf("<span"));
    }
    return button.getCaption();
}

From source file:com.selzlein.lojavirtual.vaadin.core.NavigationMenu.java

License:Open Source License

private Button addMenuItem(String titleKey, FontAwesome icon, String viewId, ClickListener action,
        Integer badgeValue) {//  w  w w.j  a va2 s.c  o  m
    Button b = new Button(ui.getMessage(titleKey), action);
    if (badgeValue != null) {
        b.setCaption(b.getCaption() + "<span class=\"valo-menu-badge\">" + badgeValue + "</span>");
    }
    b.setIcon(icon);
    b.setPrimaryStyleName("valo-menu-item");
    b.setHtmlContentAllowed(true);
    mainMenu.addComponent(b);
    if (viewId != null) {
        menuItems.put(viewId, b);
    }
    return b;
}

From source file:com.selzlein.lojavirtual.vaadin.core.NavigationMenu.java

License:Open Source License

/**
 * Sets new value to menuItem badge.//from w  w  w.ja v  a2 s . c o  m
 * 
 * @param menuItem
 * @param badgeValue 
 */
public void refreshBadge(Button menuItem, Integer badgeValue) {
    if ((badgeValue != null) && (menuItem != null)) {
        String cleanCaption = menuItem.getCaption().substring(0, menuItem.getCaption().indexOf("<span"));
        menuItem.setCaption(cleanCaption + "<span class=\"valo-menu-badge\">" + badgeValue + "</span>");
    }
}

From source file:com.whymenu.MainUI.java

private void updateLocations() {
    locations.forEach((key, value) -> {
        Location location = value;
        if (!buttons.containsKey(key)) {
            Button button = new Button(location != null ? location.getDescription() : key);
            button.addClickListener((Button.ClickEvent event) -> {
                System.out.println("test");
            });// w w  w .  j  a  v  a 2  s .c  o m
            mainLayout.addComponent(button);
            buttons.put(key, button);
        } else {
            Button button = buttons.get(key);
            if (!button.getCaption().equals(location.getDescription())) {
                button.setCaption(location.getDescription());
            }
        }
    });
    buttons.forEach((key, value) -> {
        if (!locations.containsKey(key)) {
            mainLayout.removeComponent(value);
            value = null;
        }
    });
}

From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPostAdd.java

/**
 * Create tag list/*from  w  w  w .  j  ava2s .com*/
 * @return tag list
 */
private List<String> createTags() {
    List<String> tags = new ArrayList();
    for (Button tag : taglist) {
        tags.add(tag.getCaption());
    }
    return tags;
}