Example usage for com.vaadin.ui Label setContentMode

List of usage examples for com.vaadin.ui Label setContentMode

Introduction

In this page you can find the example usage for com.vaadin.ui Label setContentMode.

Prototype

public void setContentMode(ContentMode contentMode) 

Source Link

Document

Sets the content mode of the label.

Usage

From source file:org.investovator.ui.dataplayback.admin.DataPlaybackEngineAdminDashboard.java

License:Open Source License

public Component setupGameConfigBox() {
    FormLayout layout = new FormLayout();
    layout.setCaption("Game Configuration");
    layout.addStyleName("center-caption");

    GameTypes config = DataPlaybackEngineStates.gameConfig;

    //show the game description
    Label gameDescription = new Label(config.getDescription());
    layout.addComponent(gameDescription);
    gameDescription.setContentMode(ContentMode.HTML);
    gameDescription.setWidth(320, Unit.PIXELS);
    gameDescription.setCaption("Game: ");

    //add the player type
    Label playerType = new Label();
    layout.addComponent(playerType);//w  ww .java 2  s . co  m
    playerType.setCaption("Player Type: ");
    playerType.setValue(player.getName());

    //show the attributes
    Label attributes = new Label(config.getInterestedAttributes().toString());
    layout.addComponent(attributes);
    attributes.setContentMode(ContentMode.HTML);
    attributes.setCaption("Attributes: ");

    //matching attribute
    Label matchingAttr = new Label(config.getAttributeToMatch().toString());
    layout.addComponent(matchingAttr);
    matchingAttr.setContentMode(ContentMode.HTML);
    matchingAttr.setCaption("Played On: ");

    return layout;

}

From source file:org.investovator.ui.utils.dashboard.dataplayback.BasicGameOverWindow.java

License:Open Source License

public void setupUI() {
    VerticalLayout content = new VerticalLayout();

    //create the leaderboard
    Table leaderboard = getLeaderboard();

    Portfolio myPortfolio = this.getMyPortfolio(username);
    if (myPortfolio == null) {
        this.close();
        return;/*from w  w  w  .  j a  v  a 2  s.c  o  m*/
    }
    Label rankLabel = new Label(
            "<H2 align=\"center\">Congratulations " + myPortfolio.getUsername() + ". You Won..!</H2>");

    //if this player has not won the game
    if (!leaderboard.isFirstId(username)) {
        rankLabel.setValue("<H2 align=\"center\">Game Over!</H2>");
    }
    rankLabel.setContentMode(ContentMode.HTML);
    content.addComponent(rankLabel);

    content.addComponent(leaderboard);

    //add the exit game button
    Button exitGame = new Button("Exit Game");
    exitGame.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            //if admin
            if (userType == Authenticator.UserType.ADMIN) {
                getUI().getNavigator().navigateTo(UIConstants.MAINVIEW);
            } else {
                getUI().getNavigator().navigateTo(UIConstants.USER_VIEW);
            }
            close();
        }
    });

    content.addComponent(exitGame);

    this.setContent(content);

}

From source file:org.investovator.ui.utils.dashboard.DecisionMakerPanel.java

License:Open Source License

/**
 * Loads the description for a decision making algorithm
 * @return//from w w  w.ja  va2s .c om
 */
private Component getToolDescription() {
    VerticalLayout descriptionContainer = new VerticalLayout();

    SigGenMAType type = (SigGenMAType) this.indicators.getValue();

    String description = "<p>" + SigGenMAType.getDescription(type) + "</p>";

    Label descriptionLabel = new Label();
    descriptionContainer.addComponent(descriptionLabel);
    descriptionLabel.setContentMode(ContentMode.HTML);
    descriptionLabel.setValue(description);

    return descriptionContainer;
}

From source file:org.jpos.qi.minigl.AccountsView.java

License:Open Source License

@Override
protected HorizontalLayout createHeader(String title) {
    HorizontalLayout header = super.createHeader(title);
    if (isGeneralView()) {
        Label refDebit = new Label(FontAwesome.SQUARE.getHtml() + " DEBIT accounts");
        Label refCredit = new Label(FontAwesome.SQUARE.getHtml() + " CREDIT accounts");
        refDebit.setContentMode(ContentMode.HTML);
        refCredit.setContentMode(ContentMode.HTML);
        refDebit.setStyleName("debit-color");
        refCredit.setStyleName("credit-color");
        refDebit.addStyleName(ValoTheme.LABEL_SMALL);
        refCredit.addStyleName(ValoTheme.LABEL_SMALL);
        Button collapse = new Button(getApp().getMessage("collapseAll"), event -> {
            ((TreeGrid) getGrid()).collapse(expandedItems.toArray());

        });//from w w w . ja  v a 2  s  .  co m
        collapse.setStyleName(ValoTheme.BUTTON_LINK);
        collapse.addStyleName(ValoTheme.BUTTON_SMALL);
        HorizontalLayout l = new HorizontalLayout(refDebit, refCredit, collapse);
        l.setSpacing(true);
        l.setComponentAlignment(refDebit, Alignment.BOTTOM_CENTER);
        l.setComponentAlignment(refCredit, Alignment.BOTTOM_CENTER);
        l.setComponentAlignment(collapse, Alignment.BOTTOM_CENTER);
        header.addComponent(l);
        header.setComponentAlignment(l, Alignment.MIDDLE_RIGHT);
    }
    return header;
}

From source file:org.jpos.qi.QIEntityView.java

License:Open Source License

protected HorizontalLayout createHeader(String title) {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth("100%");
    header.setSpacing(false);/*from   ww w  . ja  v  a  2 s. c  om*/
    header.setMargin(new MarginInfo(false, true, false, true));
    Label lbl = new Label(title);
    lbl.addStyleName("h2");
    lbl.setSizeUndefined();
    lbl.setContentMode(ContentMode.HTML);
    header.addComponent(lbl);
    header.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT);
    if (isGeneralView() && canAdd()) {
        Button addBtn = new Button(getApp().getMessage("add"));
        addBtn.addStyleName("borderless-colored");
        addBtn.setIcon(VaadinIcons.PLUS);
        addBtn.addClickListener(event -> navigateToNewRoute());
        header.addComponent(addBtn);
        header.setComponentAlignment(addBtn, Alignment.BOTTOM_RIGHT);
    }
    return header;
}

From source file:org.jpos.qi.system.AboutView.java

License:Open Source License

public AboutView() {
    super();/*w  w w  . j a v a 2  s .c  om*/
    Label html = new Label(Q2.getVersionString());
    html.setContentMode(ContentMode.PREFORMATTED);
    setMargin(true);
    addComponent(html);
}

From source file:org.jpos.qi.system.MemoryUsageView.java

License:Open Source License

private Label createLabel() {
    Label l = new Label();
    l.setContentMode(ContentMode.HTML);
    l.setSizeUndefined();//from  w w w.  j  a va 2 s  .c o  m
    return l;
}

From source file:org.jpos.qi.system.MemoryUsageView.java

License:Open Source License

private Label strong(String s) {
    Label l = new Label("<strong>" + s + "</strong>");
    l.setContentMode(ContentMode.HTML);
    l.setSizeUndefined();//  www  .ja  v a 2 s.  c  om
    return l;
}

From source file:org.jpos.qi.system.MemoryUsageView.java

License:Open Source License

private Label createMBLabel() {
    Label l = new Label("&nbsp;MB");
    l.setContentMode(ContentMode.HTML);
    return l;//from   ww  w  .ja v  a2 s  . c  o m
}

From source file:org.jug.montpellier.sonni.about.AboutPerspectiveContribution.java

License:Apache License

private Component getAboutDialog() {
    CssLayout titleLayout = new CssLayout();
    titleLayout.addStyleName("transparent-frame");
    titleLayout.setWidth("90%");
    Label title = new Label("Sonni - Dynamic Vaadin OSGi Demo");
    title.setWidth("100%");
    title.addStyleName("about-title");
    titleLayout.addComponent(title);//from  w w w . j a v  a 2  s .co m
    Label description = new Label(
            "<br/>Copyright (c) Developer <a href='mailto:eric.taix@gmail.com'>Eric Taix</a> - <a href='http://www.montpellier-jug.org'>Montpellier JUG</a><br>"
                    + "<br/><br/>This application aims to demonstrate how to develop a dynamic application with <a href='http://www.vaadin.com'>Vaadin</a> and OSGi<br/>"
                    + "All buttons in the left panel are loaded dynamically from components stored in differents bundles. Play with the parameter view to activate or desactivate components."
                    // + "This application can be forked from <a href='https://github.com/eric-taix/sonni'>gitHub</a>."
                    + "<br/><br/><br/>The Montpellier Java User Group's goals are:"
                    + "<li>Create an independent community 'In Real Life' (the JUG is not intended to be another virtual community built around an electronic forum)</li>"
                    + "<li>Promote exchanges between industry, academia and students</li>"
                    + "<li>Share knowledge and experiences around Java</li>"
                    + "<li>Promote Java and associated technologies</li>"
                    + "All in a professional and user-friendly form.<br/><br><br/>"

                    + "Licensed under Apache Software Foundation 2.0 license (ASF)<br>"
                    + "This software contains modules licenced under the Apache Software Foundation 2.0 license (ASF) and EPL<br>"
                    + "Many thanks to Siemens AG, Kai Tdter, Chris Brind, Neil Bartlett, "
                    + " Petter Holmstrm and others for their OSGi and Vaadin"
                    + " related work, blogs, and bundles."
                    + "<br/><br/><br/>Why <b>Sonni</b>?<br/>'Sonni' is the finish translation for bulls. Finland has a lot of reinders and in our county we have a lot of bulls !<br/><br/>");
    description.addStyleName("about");
    description.setWidth("100%");
    description.setContentMode(Label.CONTENT_XHTML);

    titleLayout.addComponent(description);
    return titleLayout;
}