Example usage for com.vaadin.ui Alignment MIDDLE_LEFT

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

Introduction

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

Prototype

Alignment MIDDLE_LEFT

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

Click Source Link

Usage

From source file:dhbw.ka.mwi.businesshorizon2.ui.resultscreen.morescenarios.MoreScenarioResultViewImpl.java

License:Open Source License

/**
 * Diese Methode erzeugt die Anzeige der Planungsprmissen fr Szenario 2
 * //from www.  j  a  v a 2  s  .c o m
 * @author Tobias Lindner
 */
public void createScenario2Layout() {
    renditeEKLabel2 = new Label("Renditeforderung EK:");
    renditeFKLabel2 = new Label("Renditeforderung FK:");
    gewerbeStLabel2 = new Label("Gewerbesteuer:");
    koerperStLabel2 = new Label("Krperschaftssteuer <br> inkl. Solidarittszuschlag:  ");
    koerperStLabel2.setContentMode(Label.CONTENT_XHTML);
    personalTaxRateLabel2 = new Label("Persnlicher Steuersatz: ");
    renditeEK2 = new Label();
    renditeFK2 = new Label();
    gewerbeSt2 = new Label();
    koerperSt2 = new Label();
    personalTaxRate2 = new Label();

    companyValue2 = new Label();

    planningGridScenario2.addComponent(renditeEKLabel2, 0, 0);
    planningGridScenario2.addComponent(renditeEK2, 1, 0);
    planningGridScenario2.addComponent(renditeFKLabel2, 0, 1);
    planningGridScenario2.addComponent(renditeFK2, 1, 1);
    planningGridScenario2.addComponent(gewerbeStLabel2, 0, 2);
    planningGridScenario2.addComponent(gewerbeSt2, 1, 2);
    planningGridScenario2.addComponent(koerperStLabel2, 0, 3);
    planningGridScenario2.addComponent(koerperSt2, 1, 3);
    planningGridScenario2.addComponent(personalTaxRateLabel2, 0, 4);
    planningGridScenario2.addComponent(personalTaxRate2, 1, 4);
    planningGridScenario2.setComponentAlignment(koerperSt2, Alignment.MIDDLE_LEFT);

    companyValueLayoutScenario2.addComponent(companyValue2);

}

From source file:dhbw.ka.mwi.businesshorizon2.ui.resultscreen.morescenarios.MoreScenarioResultViewImpl.java

License:Open Source License

/**
 * Diese Methode erzeugt die Anzeige der Planungsprmissen fr Szenario 3
 * //ww w. j  a va  2s . c  o  m
 * @author Tobias Lindner
 */
public void createScenario3Layout() {
    renditeEKLabel3 = new Label("Renditeforderung EK:");
    renditeFKLabel3 = new Label("Renditeforderung FK:");
    gewerbeStLabel3 = new Label("Gewerbesteuer:");
    koerperStLabel3 = new Label("Krperschaftssteuer <br> inkl. Solidarittszuschlag:  ");
    koerperStLabel3.setContentMode(Label.CONTENT_XHTML);
    personalTaxRateLabel3 = new Label("Persnlicher Steuersatz: ");
    renditeEK3 = new Label();
    renditeFK3 = new Label();
    gewerbeSt3 = new Label();
    koerperSt3 = new Label();
    personalTaxRate3 = new Label();

    companyValue3 = new Label();

    planningGridScenario3.addComponent(renditeEKLabel3, 0, 0);
    planningGridScenario3.addComponent(renditeEK3, 1, 0);
    planningGridScenario3.addComponent(renditeFKLabel3, 0, 1);
    planningGridScenario3.addComponent(renditeFK3, 1, 1);
    planningGridScenario3.addComponent(gewerbeStLabel3, 0, 2);
    planningGridScenario3.addComponent(gewerbeSt3, 1, 2);
    planningGridScenario3.addComponent(koerperStLabel3, 0, 3);
    planningGridScenario3.addComponent(koerperSt3, 1, 3);
    planningGridScenario3.addComponent(personalTaxRateLabel3, 0, 4);
    planningGridScenario3.addComponent(personalTaxRate3, 1, 4);
    planningGridScenario3.setComponentAlignment(koerperSt3, Alignment.MIDDLE_LEFT);

    companyValueLayoutScenario3.addComponent(companyValue3);

}

From source file:dhbw.ka.mwi.businesshorizon2.ui.resultscreen.onescenario.OneScenarioResultViewImpl.java

License:Open Source License

/**
 * Erstelle das GUI zum Prozessschritt "Ausgabe"
 * /*from   w ww . jav a  2 s  . c  o m*/
 * @author Florian Stier
 */
private void generateUi() {

    setSizeFull();
    planningLayout = new HorizontalLayout();
    planningLabel = new Label("Planungsprmissen:");
    scenarioLayout = new GridLayout(2, 5);
    renditeEKLabel = new Label("Renditeforderung EK:");
    renditeFKLabel = new Label("Renditeforderung FK:");
    gewerbeStLabel = new Label("Gewerbesteuer:");
    koerperStLabel = new Label("Krperschaftssteuer inkl. Solidarittszuschlag:");
    personalTaxRateLabel = new Label("Persnlicher Steuersatz");
    renditeEK = new Label();
    renditeFK = new Label();
    gewerbeSt = new Label();
    koerperSt = new Label();
    personalTaxRate = new Label();
    companyValueLayout = new HorizontalLayout();
    companyValueLabel = new Label("Unternehmenswert:");
    companyValue = new Label();
    gap = new Label();
    gap2 = new Label();
    gap3 = new Label();
    gap4 = new Label();
    expandingGap = new Label();
    expandingGap2 = new Label();
    expandingGap3 = new Label();
    capitalChartLayout = new VerticalLayout();
    cashflowChartLayout = new VerticalLayout();
    chartArea = new HorizontalLayout();

    gap.setWidth("20px");
    gap2.setWidth("20px");
    gap3.setHeight("20px");
    gap4.setHeight("20px");
    expandingGap.setSizeFull();

    planningLayout.setWidth(100, UNITS_PERCENTAGE);
    companyValueLayout.setHeight(100, UNITS_PIXELS);
    companyValueLayout.setWidth(100, UNITS_PERCENTAGE);
    scenarioLayout.setWidth(100, UNITS_PERCENTAGE);
    planningLabel.setWidth(SIZE_UNDEFINED, 0);
    companyValue.setWidth(SIZE_UNDEFINED, 0);
    companyValueLabel.setWidth(SIZE_UNDEFINED, 0);
    capitalChartLayout.setWidth(250, UNITS_PIXELS);
    capitalChartLayout.setHeight(250, UNITS_PIXELS);
    cashflowChartLayout.setWidth(350, UNITS_PIXELS);
    cashflowChartLayout.setHeight(250, UNITS_PIXELS);
    chartArea.setWidth(100, UNITS_PERCENTAGE);
    chartArea.setHeight(SIZE_UNDEFINED, 0);

    planningLabel.setStyleName("font12bold");
    renditeEKLabel.setStyleName("font12bold");
    renditeFKLabel.setStyleName("font12bold");
    gewerbeStLabel.setStyleName("font12bold");
    koerperStLabel.setStyleName("font12bold");
    personalTaxRateLabel.setStyleName("font12bold");
    renditeEK.setStyleName("font12bold");
    renditeFK.setStyleName("font12bold");
    gewerbeSt.setStyleName("font12bold");
    koerperSt.setStyleName("font12bold");
    personalTaxRate.setStyleName("font12bold");
    companyValueLabel.setStyleName("font14bold");
    companyValue.setStyleName("font14bold");

    scenarioLayout.setStyleName("resultScenarioLayout");
    companyValueLayout.setStyleName("companyValueLayout");

    planningLayout.addComponent(planningLabel);
    planningLayout.addComponent(gap2);
    planningLayout.addComponent(scenarioLayout);
    scenarioLayout.addComponent(renditeEKLabel, 0, 0);
    scenarioLayout.addComponent(renditeEK, 1, 0);
    scenarioLayout.addComponent(renditeFKLabel, 0, 1);
    scenarioLayout.addComponent(renditeFK, 1, 1);
    scenarioLayout.addComponent(gewerbeStLabel, 0, 2);
    scenarioLayout.addComponent(gewerbeSt, 1, 2);
    scenarioLayout.addComponent(koerperStLabel, 0, 3);
    scenarioLayout.addComponent(koerperSt, 1, 3);
    scenarioLayout.addComponent(personalTaxRateLabel, 0, 4);
    scenarioLayout.addComponent(personalTaxRate, 1, 4);
    companyValueLayout.addComponent(expandingGap2);
    companyValueLayout.addComponent(companyValueLabel);
    companyValueLayout.addComponent(gap);
    companyValueLayout.addComponent(companyValue);
    companyValueLayout.addComponent(expandingGap3);

    planningLayout.setComponentAlignment(planningLabel, Alignment.MIDDLE_LEFT);
    planningLayout.setExpandRatio(scenarioLayout, 1.0f);
    companyValueLayout.setComponentAlignment(companyValueLabel, Alignment.MIDDLE_CENTER);
    companyValueLayout.setComponentAlignment(companyValue, Alignment.MIDDLE_CENTER);
    companyValueLayout.setExpandRatio(expandingGap2, 1.0f);
    companyValueLayout.setExpandRatio(expandingGap3, 1.0f);
    //      scenarioLayout.setColumnExpandRatio(1, 1.0f);
    //      scenarioLayout.setComponentAlignment(renditeEK, Alignment.MIDDLE_RIGHT);
    //      scenarioLayout.setComponentAlignment(renditeFK, Alignment.MIDDLE_RIGHT);
    //      scenarioLayout.setComponentAlignment(gewerbeSt, Alignment.MIDDLE_RIGHT);
    scenarioLayout.setComponentAlignment(koerperSt, Alignment.BOTTOM_CENTER);

    chartArea.addComponent(capitalChartLayout);
    chartArea.addComponent(cashflowChartLayout);

    addComponent(planningLayout);
    addComponent(gap3);
    addComponent(companyValueLayout);
    addComponent(gap4);
    addComponent(chartArea);
    addComponent(expandingGap);

    setExpandRatio(expandingGap, 1.0f);
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.scenarioscreen.ScenarioScreenViewImpl.java

License:Open Source License

/**
 * Erstelle das GUI zum Prozessschritt "Szenarien"
 * //w w w . java 2s . c  o m
 * @author Julius Hacker, Tobias Lindner
 */
private void generateUi() {

    addScenarioLayout = new HorizontalLayout();

    addIcon = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418766077_circle_add_plus_-128_green.png"));
    addIcon.setHeight(30, UNITS_PIXELS);

    addLabel = new Label("Szenario hinzufgen");
    addLabel.addStyleName("scenarios");
    addLabel.addStyleName("addScenario");

    addScenarioLayout.addComponent(addIcon);

    gap3 = new Label();
    gap3.setWidth(10, UNITS_PIXELS);

    addScenarioLayout.addComponent(gap3);
    addScenarioLayout.addComponent(addLabel);
    addScenarioLayout.setComponentAlignment(addLabel, Alignment.MIDDLE_CENTER);

    addScenarioLayout.addListener(new LayoutClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void layoutClick(LayoutClickEvent event) {
            presenter.addScenario();
        }
    });

    gap4 = new Label();
    gap4.setHeight(15, UNITS_PIXELS);

    this.vlScenarios = new VerticalLayout();
    this.vlScenarios.setSizeFull();
    this.setMargin(true);

    addComponent(addScenarioLayout);
    setComponentAlignment(addScenarioLayout, Alignment.MIDDLE_LEFT);
    addComponent(gap4);
    addComponent(this.vlScenarios);

    vlScenarios.addStyleName("scenarios");
}

From source file:ed.cracken.pos.ui.purchases.PurchaserView.java

public HorizontalLayout createFooter() {
    total = new Label("<h2><strong>Total:</strong></h2>");
    total.setContentMode(ContentMode.HTML);
    totalValue = new Label("<h2><strong>" + DataFormatHelper.formatNumber(BigDecimal.ZERO) + "</strong></h2>");
    totalValue.setContentMode(ContentMode.HTML);

    quantity = new Label("<h2><strong>Cantidad:</strong></h2>");
    quantity.setContentMode(ContentMode.HTML);
    quantityValue = new Label(
            "<h2><strong>" + DataFormatHelper.formatNumber(BigDecimal.ZERO) + "</strong></h2>");
    quantityValue.setContentMode(ContentMode.HTML);

    saveTrx = new Button("Guardar", FontAwesome.CHECK_CIRCLE_O);
    saveTrx.addStyleName(ValoTheme.BUTTON_PRIMARY);
    saveTrx.setHeight("60px");
    saveTrx.addClickListener((Button.ClickEvent event) -> {
        UI.getCurrent().addWindow(paymentView);
    });//from w w  w .  ja v a2 s .c o m
    cancelTrx = new Button("Cancelar", FontAwesome.CLOSE);
    cancelTrx.addStyleName(ValoTheme.BUTTON_DANGER);
    cancelTrx.setHeight("60px");
    HorizontalLayout bottom = new HorizontalLayout();
    HorizontalLayout labelsArea = new HorizontalLayout();
    HorizontalLayout buttonsArea = new HorizontalLayout();

    labelsArea.setSpacing(true);
    labelsArea.addComponent(total);
    labelsArea.addComponent(totalValue);
    labelsArea.addComponent(quantity);
    labelsArea.addComponent(quantityValue);

    labelsArea.setComponentAlignment(total, Alignment.MIDDLE_LEFT);
    labelsArea.setComponentAlignment(totalValue, Alignment.MIDDLE_LEFT);
    labelsArea.setComponentAlignment(quantity, Alignment.MIDDLE_RIGHT);
    labelsArea.setComponentAlignment(quantityValue, Alignment.MIDDLE_RIGHT);

    buttonsArea.setSpacing(true);
    buttonsArea.addComponent(saveTrx);
    buttonsArea.addComponent(cancelTrx);
    bottom.setSpacing(true);
    bottom.addComponent(buttonsArea);
    bottom.addComponent(labelsArea);
    bottom.setComponentAlignment(buttonsArea, Alignment.MIDDLE_LEFT);
    bottom.setComponentAlignment(labelsArea, Alignment.MIDDLE_RIGHT);
    bottom.setWidth("100%");

    return bottom;
}

From source file:edu.kit.dama.ui.admin.LoginInformationBar.java

License:Apache License

private void buildMainLayout() {
    loggedInAsLabel = new Label("Login Username");
    loggedInAsLabel.addStyleName("myboldcaption");
    loggedInUserLabel = new Label();
    activeGroupLabel = new Label("Active Group");
    activeGroupLabel.addStyleName("myboldcaption");
    groupSelection = new ComboBox();
    groupSelection.addValueChangeListener(this);
    activeRoleLabel = new Label("Current Role");
    activeRoleLabel.addStyleName("myboldcaption");
    roleLabel = new Label();

    Label spacer1 = new Label("");
    home = buildMenuItem("home", new ThemeResource("img/70x48/logo_default.png"));
    profile = buildMenuItem("profile", new ThemeResource("img/70x48/preferences.png"));
    simon = buildMenuItem("simon", new ThemeResource("img/70x48/simon.png"));
    settings = buildMenuItem("settings", new ThemeResource("img/70x48/gears_preferences.png"));
    exit = buildMenuItem("exit", new ThemeResource("img/70x48/exit.png"));

    final AbsoluteLayout helps = new AbsoluteLayout();
    helps.setHeight("48px");
    helps.setWidth("100%");
    addHelpItem("home", "Return to the main page.", helps);
    addHelpItem("profile", "Open your profile, e.g. to change your password.", helps);
    addHelpItem("simon",
            "Open the <b>SI</b>mple<b>MON</b>itoring Tool, e.g. to check the availability of single services.",
            helps);/*from  w ww  .j  a  v  a2s .  co m*/
    addHelpItem("settings", "Open the system settings. (Only available for Group Managers and Administrators)",
            helps);
    addHelpItem("exit", "Logout.", helps);

    HorizontalLayout navigation = new HorizontalLayout(home, profile, simon, settings, exit, helps, spacer1);
    navigation.setExpandRatio(helps, .9f);
    navigation.setExpandRatio(spacer1, .1f);
    navigation.setSizeFull();
    navigation.addStyleName("mynavigationmargin");

    navigation.addLayoutClickListener((LayoutEvents.LayoutClickEvent event) -> {
        if (home.equals(event.getClickedComponent())) {
            parent.updateView(VIEW.INFORMATION);
        } else if (profile.equals(event.getClickedComponent())) {
            parent.updateView(VIEW.PROFILE);
        } else if (simon.equals(event.getClickedComponent())) {
            parent.updateView(VIEW.SIMON);
        } else if (settings.equals(event.getClickedComponent())) {
            parent.updateView(VIEW.SETTINGS);
        } else if (exit.equals(event.getClickedComponent())) {
            parent.logout();
        }
    });

    GridLayout loginInformationLayout = new UIUtils7.GridLayoutBuilder(3, 2)
            .addComponent(loggedInAsLabel, Alignment.MIDDLE_CENTER, 0, 0, 1, 1)
            .addComponent(activeGroupLabel, Alignment.MIDDLE_CENTER, 1, 0, 1, 1)
            .addComponent(activeRoleLabel, Alignment.MIDDLE_CENTER, 2, 0, 1, 1)
            .addComponent(loggedInUserLabel, Alignment.MIDDLE_CENTER, 0, 1, 1, 1)
            .addComponent(groupSelection, Alignment.MIDDLE_CENTER, 1, 1, 1, 1)
            .addComponent(roleLabel, Alignment.MIDDLE_CENTER, 2, 1, 1, 1).getLayout();

    loginInformationLayout.setSpacing(true);

    mainLayout = new UIUtils7.GridLayoutBuilder(5, 2)
            .addComponent(navigation, Alignment.MIDDLE_LEFT, 0, 0, 3, 2)
            .addComponent(loginInformationLayout, Alignment.MIDDLE_RIGHT, 3, 0, 2, 2).getLayout();
    mainLayout.setColumnExpandRatio(0, 1.0f);
    mainLayout.setColumnExpandRatio(1, .01f);
    mainLayout.setColumnExpandRatio(2, .01f);
    mainLayout.setColumnExpandRatio(3, .01f);
    mainLayout.setColumnExpandRatio(4, .01f);

    mainLayout.setSpacing(true);
    mainLayout.setMargin(new MarginInfo(false, true, false, true));
    mainLayout.setSizeFull();
}

From source file:edu.kit.dama.ui.repo.MyVaadinUI.java

License:Apache License

/**
 * Setup the login form including its logic.
 *//*w w  w . ja v  a2s. c om*/
private void setupLoginForm() {
    email = UIUtils7.factoryTextField("Email", "Please enter your email.", "300px", true, -1, 255);
    password = UIUtils7.factoryPasswordField("Password", "300px", true, -1, 255);
    Button doLoginButton = new Button("Login");
    //login.setClickShortcut(KeyCode.ENTER);
    doLoginButton.setWidth("100px");
    loginForm = new UIUtils7.GridLayoutBuilder(2, 3).addComponent(email, 0, 0, 2, 1)
            .addComponent(password, 0, 1, 2, 1).addComponent(doLoginButton, 0, 2, 1, 1).getLayout();
    loginForm.setComponentAlignment(doLoginButton, Alignment.MIDDLE_LEFT);

    //login listener
    doLoginButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (!UIUtils7.validate(loginForm)) {
                new Notification("Warning", "Please correct the error(s) above.",
                        Notification.Type.WARNING_MESSAGE).show(Page.getCurrent());
                return;
            }
            String userMail = email.getValue();
            String userPassword = password.getValue();
            IMetaDataManager manager = MetaDataManagement.getMetaDataManagement().getMetaDataManager();
            manager.setAuthorizationContext(AuthorizationContext.factorySystemContext());
            try {
                ServiceAccessToken token = ServiceAccessUtil.getAccessToken(manager, userMail,
                        MAIN_LOGIN_TOKEN_KEY);
                if (token == null) {
                    new Notification("Login Failed", "No login information found for email " + userMail + ".",
                            Notification.Type.WARNING_MESSAGE).show(Page.getCurrent());
                    return;
                }

                if (!userPassword.equals(token.getSecret())) {
                    new Notification("Login Failed", "Wrong password for email " + userMail + ".",
                            Notification.Type.WARNING_MESSAGE).show(Page.getCurrent());
                } else {
                    //login successful
                    UserData template = new UserData();
                    template.setDistinguishedName(token.getUserId());
                    List<UserData> result = manager.find(template, template);
                    if (result.isEmpty() || result.size() > 1) {
                        throw new Exception("Invalid number of user entries found for userId "
                                + token.getUserId() + ". Please contact a system administrator.");
                    }
                    //done
                    loggedInUser = result.get(0);
                    refreshMainLayout();
                }
            } catch (Exception ex) {
                new Notification("Login Failed",
                        "Failed to access login database. Please contact an administrator.",
                        Notification.Type.ERROR_MESSAGE).show(Page.getCurrent());
                LOGGER.error("Login failed.", ex);
            } finally {
                manager.close();
            }
        }
    });

    loginForm.setSpacing(true);
    loginForm.setMargin(true);
}

From source file:edu.kit.dama.ui.simon.panel.SimonMainPanel.java

License:Apache License

/**
 * Create the tab for a single category.
 *
 * @param pProbes The probes of this category.
 *
 * @return The category tab component.//www  . jav a2 s.  c  om
 */
private Component createCategoryTab(List<AbstractProbe> pProbes) {
    UIUtils7.GridLayoutBuilder layoutBuilder = new UIUtils7.GridLayoutBuilder(2, pProbes.size());

    int row = 0;
    for (AbstractProbe probe : pProbes) {
        Embedded status = new Embedded(null, getResourceForStatus(probe.getCurrentStatus()));
        Label name = new Label(probe.getName());
        layoutBuilder.addComponent(status, Alignment.MIDDLE_LEFT, 0, row, 1, 1).addComponent(name,
                Alignment.MIDDLE_LEFT, 1, row, 1, 1);
        row++;
    }
    GridLayout tabLayout = layoutBuilder.getLayout();
    tabLayout.setColumnExpandRatio(0, .01f);
    tabLayout.setColumnExpandRatio(1, 1.0f);
    tabLayout.setImmediate(true);
    tabLayout.setSpacing(true);
    tabLayout.setMargin(true);
    tabLayout.setWidth("100%");
    return tabLayout;
}

From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper.java

License:Open Source License

void handleShowActiveUsersActionTL(MenuBar menubar) {
    Session session = HSess.get();//from ww w  .  j av a2 s.c  o m

    Criteria criteria = session.createCriteria(User.class);
    criteria.setProjection(Projections.rowCount());
    criteria.add(Restrictions.eq("accountDisabled", false));
    int totcount = ((Long) criteria.list().get(0)).intValue();

    // new and improved
    int count = Mmowgli2UI.getGlobals().getSessionCount();

    Window countWin = new Window("Display Active User Count");
    countWin.setModal(true);

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setWidth("99%");
    countWin.setContent(layout);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    Label lab;
    hl.addComponent(lab = new HtmlLabel("Number of users* (including yourself)<br/>currently playing:"));
    hl.addComponent(lab = new Label());
    lab.setWidth("15px");

    Label countTf = new HtmlLabel();
    countTf.setWidth("50px");
    countTf.setValue("&nbsp;" + count);
    countTf.addStyleName("m-greyborder");
    hl.addComponent(countTf);
    hl.setComponentAlignment(countTf, Alignment.MIDDLE_LEFT);
    layout.addComponent(hl);

    layout.addComponent(new Label("* Count incremented on login, decremented on timeout or logout."));

    hl = new HorizontalLayout();
    hl.setSpacing(true);

    hl.addComponent(lab = new HtmlLabel("Total registered users:"));
    hl.addComponent(lab = new Label());
    lab.setWidth("15px");

    Label totalLab = new HtmlLabel();
    totalLab.setWidth("50px");
    totalLab.setValue("&nbsp;" + totcount);
    totalLab.addStyleName("m-greyborder");
    hl.addComponent(totalLab);
    hl.setComponentAlignment(totalLab, Alignment.MIDDLE_LEFT);
    layout.addComponent(hl);

    countWin.setWidth("325px");
    UI.getCurrent().addWindow(countWin);
    countWin.center();
}

From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper.java

License:Open Source License

public void handleShowNumberCardsActionTL(MenuBar mbar) {
    Session session = HSess.get();//ww w  . j  a v a  2s  .c o  m
    Criteria criteria = session.createCriteria(Card.class);
    criteria.setProjection(Projections.rowCount());
    int count = ((Long) criteria.list().get(0)).intValue();

    // Create the window...
    Window countWin = new Window("Display Card Count");
    countWin.setModal(true);

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setWidth("99%");
    countWin.setContent(layout);
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    Label lab;
    hl.addComponent(lab = new HtmlLabel("Number of cards played:"));
    hl.addComponent(lab = new Label());
    lab.setWidth("15px");

    Label countTf = new HtmlLabel();
    countTf.setWidth("50px");
    countTf.setValue("&nbsp;" + count);
    countTf.addStyleName("m-greyborder");
    hl.addComponent(countTf);
    hl.setComponentAlignment(countTf, Alignment.MIDDLE_LEFT);
    layout.addComponent(hl);

    countWin.setWidth("255px");
    UI.getCurrent().addWindow(countWin);
    countWin.center();
}