Example usage for com.vaadin.ui HorizontalLayout addStyleName

List of usage examples for com.vaadin.ui HorizontalLayout addStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout addStyleName.

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:dhbw.clippinggorilla.userinterface.views.ClippingView.java

public Component createClippingRow(Article a) {
    Image imageNewsImage = new Image();
    String url = a.getUrlToImage();
    if (url == null || url.isEmpty()) {
        url = a.getSourceAsSource().getLogo().toExternalForm();
    }//from w w w . j ava2 s  .  c  o m
    imageNewsImage.setSource(new ExternalResource(url));
    imageNewsImage.addStyleName("articleimage");

    VerticalLayout layoutNewsImage = new VerticalLayout(imageNewsImage);
    layoutNewsImage.setMargin(false);
    layoutNewsImage.setSpacing(false);
    layoutNewsImage.setWidth("200px");
    layoutNewsImage.setHeight("150px");
    layoutNewsImage.setComponentAlignment(imageNewsImage, Alignment.MIDDLE_CENTER);

    Label labelHeadLine = new Label(a.getTitle(), ContentMode.HTML);
    labelHeadLine.addStyleName(ValoTheme.LABEL_H2);
    labelHeadLine.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    labelHeadLine.setWidth("100%");

    Label labelDescription = new Label(a.getDescription(), ContentMode.HTML);
    labelDescription.setWidth("100%");

    Image imageSource = new Image();
    Source s = a.getSourceAsSource();
    URL logo = null;
    if (s != null) {
        logo = s.getLogo();
    } else {
        Log.error("Source is null: " + a.getSource());
        return new Label("INTERNAL ERROR");
    }
    if (logo != null) {
        imageSource.setSource(new ExternalResource(logo));
    } else {
        Log.error("Sourcelogo is null: " + s.getName());
    }
    imageSource.setHeight("30px");
    Label labelSource = new Label(a.getSourceAsSource().getName());
    labelSource.addStyleName(ValoTheme.LABEL_SMALL);

    LocalDateTime time = a.getPublishedAtAsLocalDateTime();
    DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG);
    formatter.withZone(ZoneId.of("Europe/Berlin"));
    Label labelDate = new Label(time.format(formatter));
    labelDate.addStyleName(ValoTheme.LABEL_SMALL);

    Label labelAuthor = new Label();
    labelAuthor.addStyleName(ValoTheme.LABEL_SMALL);
    labelAuthor.setWidth("100%");
    if (a.getAuthor() != null && !a.getAuthor().isEmpty()) {
        labelAuthor.setValue(a.getAuthor());
    }

    Button openWebsite = new Button(VaadinIcons.EXTERNAL_LINK);
    openWebsite.addClickListener(e -> UI.getCurrent().getPage().open(a.getUrl(), "_blank", false));

    HorizontalLayout layoutArticleOptions = new HorizontalLayout();
    layoutArticleOptions.setWidth("100%");
    layoutArticleOptions.addComponents(imageSource, labelSource, labelDate, labelAuthor, openWebsite);
    layoutArticleOptions.setComponentAlignment(imageSource, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setComponentAlignment(labelSource, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setComponentAlignment(labelDate, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setComponentAlignment(labelAuthor, Alignment.MIDDLE_LEFT);
    layoutArticleOptions.setComponentAlignment(openWebsite, Alignment.MIDDLE_CENTER);
    layoutArticleOptions.setExpandRatio(labelAuthor, 5);

    VerticalLayout layoutNewsText = new VerticalLayout(labelHeadLine, labelDescription, layoutArticleOptions);
    layoutNewsText.setMargin(false);
    layoutNewsText.setWidth("100%");

    HorizontalLayout layoutClipping = new HorizontalLayout();
    layoutClipping.setWidth("100%");
    layoutClipping.setMargin(true);
    layoutClipping.addComponents(layoutNewsImage, layoutNewsText);
    layoutClipping.setComponentAlignment(layoutNewsImage, Alignment.MIDDLE_CENTER);
    layoutClipping.setExpandRatio(layoutNewsText, 5);
    layoutClipping.addStyleName(ValoTheme.LAYOUT_CARD);
    layoutClipping.addStyleName("tags");
    return layoutClipping;
}

From source file:dhbw.clippinggorilla.userinterface.windows.PreferencesWindow.java

private Component buildFooter(User user) {
    HorizontalLayout footer = new HorizontalLayout();
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth(100.0f, Unit.PERCENTAGE);

    Button cancelButton = new Button(Language.get(Word.CANCEL));
    cancelButton.setIcon(VaadinIcons.CLOSE);
    cancelButton.addClickListener(event -> {
        close();/*from  w  w w .j a  v  a2 s.co m*/
    });

    saveButton = new Button(Language.get(Word.SAVE));
    saveButton.setIcon(VaadinIcons.CHECK);
    saveButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    saveButton.addClickListener(event -> {
        boolean error = false;
        if (!user.getFirstName().equals(firstNameField.getValue())) {
            boolean success = UserUtils.changeFirstName(user, firstNameField.getValue());
            if (!success) {
                error = true;
            }
        }
        if (!user.getLastName().equals(lastNameField.getValue())) {
            boolean success = UserUtils.changeLastName(user, lastNameField.getValue());
            if (!success) {
                error = true;
            }
        }
        if (!user.getUsername().equals(usernameField.getValue())) {
            boolean success = UserUtils.changeUsername(user, usernameField.getValue());
            if (!success) {
                error = true;
            }
        }
        if (!user.getEmail().equals(emailField.getValue())) {
            UI.getCurrent().addWindow(ActivateWindow.get());
            boolean success = UserUtils.changeEmail(user, user.getEmail(), emailField.getValue(),
                    emailField.getValue());
            if (!success) {
                error = true;
            }
        }
        boolean wrongPW = false;
        if (!password1Field.isEmpty() && password1Field.getValue().equals(password2Field.getValue())) {
            wrongPW = !UserUtils.changePassword(user, oldPasswordField.getValue(), password1Field.getValue(),
                    password2Field.getValue());
        }
        if (error) {
            VaadinUtils.errorNotification(Language.get(Word.UNEXPECTED_ERROR));
        } else if (wrongPW) {
            VaadinUtils.errorNotification(Language.get(Word.WRONG_PASSWORD));
        } else {
            VaadinUtils.infoNotification(Language.get(Word.SUCCESSFULLY_SAVED));
            close();
        }
    });
    saveButton.focus();

    Label placeholder = new Label();

    footer.addComponents(placeholder, cancelButton, saveButton);
    footer.setExpandRatio(placeholder, 5);
    footer.setComponentAlignment(cancelButton, Alignment.TOP_CENTER);
    footer.setComponentAlignment(saveButton, Alignment.TOP_CENTER);
    return footer;
}

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);/*w  w  w.j  ava 2 s  .  c  o  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.nps.moves.mmowgli.components.MmowgliDialog.java

License:Open Source License

@Override
public void initGui() {
    outerLayout = new VerticalLayout();
    outerLayout.setSpacing(false);//from  w w  w .j  a v  a  2  s  .  co  m
    outerLayout.setSizeUndefined();
    outerLayout.addStyleName("m-transparent");
    setContent(outerLayout);

    Label sp;
    sp = new Label();
    sp.setHeight("100px");
    outerLayout.addComponent(sp);

    HorizontalLayout headerWrapper2 = new HorizontalLayout();
    outerLayout.addComponent(headerWrapper2); // at the top
    headerWrapper2.addStyleName("m-dialog-header");
    headerWrapper2.setHeight("75px");
    headerWrapper2.setWidth("592px");
    headerWrapper2.setSpacing(false);
    headerWrapper2.setMargin(false);
    headerWrapper2.addComponent(sp = new Label()); // indent from left
    sp.setWidth("45px");

    headerHL2 = new HorizontalLayout(); // Where the title gets written
    headerHL2.setSpacing(false);
    headerHL2.setMargin(false);
    headerHL2.setHeight("75px");
    headerWrapper2.addComponent(headerHL2);
    headerWrapper2.setExpandRatio(headerHL2, 1.0f);

    cancelButt = makeCancelButton();
    cancelButt.addClickListener(new MyCancelListener());
    cancelButt.setClickShortcut(KeyCode.ESCAPE);
    headerWrapper2.addComponent(cancelButt);
    headerWrapper2.setComponentAlignment(cancelButt, Alignment.MIDDLE_CENTER);

    headerWrapper2.addComponent(sp = new Label());
    sp.setWidth("15px");

    contentVLayout = new VerticalLayout();
    contentVLayout.addStyleName("m-dialog-content");
    contentVLayout.setSizeUndefined();
    contentVLayout.setWidth("592px"); // but do the width explicitly

    outerLayout.addComponent(contentVLayout);

    Image footer = new Image(null, Mmowgli2UI.getGlobals().mediaLocator().getDialogFooterBackground());
    footer.setWidth("592px");
    footer.setHeight("36px");
    outerLayout.addComponent(footer);
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPage2.java

License:Open Source License

@SuppressWarnings("serial")
public void initGuiTL() {
    ActionPlan actPln = ActionPlan.getTL(apId);
    User me = Mmowgli2UI.getGlobals().getUserTL();
    addStyleName("m-cssleft-45");

    setWidth("1089px");
    setHeight("1821px");
    Label sp;/*from ww  w  .jav  a  2s . c om*/

    VerticalLayout mainVL = new VerticalLayout();
    addComponent(mainVL, "top:0px;left:0px");
    mainVL.addStyleName("m-overflow-visible");
    mainVL.setWidth("1089px");
    mainVL.setHeight(null);
    mainVL.setSpacing(false);
    mainVL.setMargin(false);

    VerticalLayout mainVLayout = new VerticalLayout();

    mainVLayout.setSpacing(false);
    mainVLayout.setMargin(false);
    mainVLayout.addStyleName("m-actionplan-background2");
    mainVLayout.setWidth("1089px");
    mainVLayout.setHeight(null); //"1821px");
    mainVL.addComponent(mainVLayout);

    mainVLayout.addComponent(makeIdField(actPln));

    mainVLayout.addComponent(sp = new Label());
    sp.setHeight("5px");

    VerticalLayout leftTopVL = new VerticalLayout();
    leftTopVL.setWidth("820px");
    leftTopVL.setSpacing(false);
    leftTopVL.setMargin(false);
    mainVLayout.addComponent(leftTopVL);

    HorizontalLayout titleAndThumbsHL = new HorizontalLayout();
    titleAndThumbsHL.setSpacing(false);
    titleAndThumbsHL.setMargin(false);
    titleAndThumbsHL.setHeight("115px");
    titleAndThumbsHL.addStyleName("m-actionplan-header-container");
    leftTopVL.addComponent(titleAndThumbsHL);

    titleAndThumbsHL.addComponent(sp = new Label());
    sp.setWidth("55px");

    VerticalLayout vl = new VerticalLayout();
    vl.addComponent(titleUnion); //titleTA);
    titleUnion.initGui();

    titleHistoryButt = new NativeButton();
    titleHistoryButt.setCaption("history");
    titleHistoryButt.setStyleName(BaseTheme.BUTTON_LINK);
    titleHistoryButt.addStyleName("borderless");
    titleHistoryButt.addStyleName("m-actionplan-history-button");
    titleHistoryButt.addClickListener(new TitleHistoryListener());
    titleHistoryButt.setEnabled(!readonly);
    vl.addComponent(titleHistoryButt);
    vl.setComponentAlignment(titleHistoryButt, Alignment.TOP_RIGHT);
    titleAndThumbsHL.addComponent(vl); //titleTA);

    titleUnion.setWidth(ACTIONPLAN_TITLE_W);
    titleUnion.setValueTL(actPln.getTitle() == null ? "" : actPln.getTitle());

    titleUnion.addStyleName("m-lightgrey-border");
    // titleUnion.addStyleName("m-opacity-75");
    titleUnion.setHeight("95px"); // 120 px); must make it this way for alignment of r/o vs rw

    addComponent(saveCanPan, "top:0px;left:395px");
    saveCanPan.setVisible(false);

    titleAndThumbsHL.addComponent(sp = new Label());
    sp.setWidth("50px");

    VerticalLayout thumbVL = new VerticalLayout();
    titleAndThumbsHL.addComponent(thumbVL);
    thumbVL.addComponent(sp = new Label());
    sp.setHeight("50px");

    thumbPanel = new ThumbPanel();
    Map<User, Integer> map = actPln.getUserThumbs();
    Integer t = map.get(me);
    /*  if(t == null) {
        map.put(me, 0);
        ActionPlan.update(actPln);
        GameEventLogger.logActionPlanUpdate(actPln, "thumbs changed",me.getUserName());
        t = 0;
      } */
    thumbPanel.setNumUserThumbs(t == null ? 0 : t);
    thumbVL.addComponent(thumbPanel);

    HorizontalLayout commentAndViewChainHL = new HorizontalLayout();
    leftTopVL.addComponent(commentAndViewChainHL);
    commentAndViewChainHL.setSpacing(false);
    commentAndViewChainHL.setMargin(false);
    commentAndViewChainHL.addComponent(sp = new Label());
    sp.setWidth("55px");

    VerticalLayout commLeftVL = new VerticalLayout();
    commentAndViewChainHL.addComponent(commLeftVL);
    commLeftVL.setWidth("95px");
    commLeftVL.addComponent(commentsButt);
    commentsButt.setStyleName(BaseTheme.BUTTON_LINK);
    commentsButt.addStyleName("borderless");
    commentsButt.addStyleName("m-actionplan-comments-button");

    ClickListener commLis;
    commentsButt.addClickListener(commLis = new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().setScrollTop(1250); //commentsButt.getWindow().setScrollTop(1250);
        }
    });
    commLeftVL.addComponent(sp = new Label());
    sp.setHeight("65px"); //"50px");

    commLeftVL.addComponent(envelopeButt);
    envelopeButt.addStyleName("m-actionplan-envelope-button");
    envelopeButt.addClickListener(commLis); // same as the link button above

    commentAndViewChainHL.addComponent(sp = new Label());
    sp.setWidth("5px");

    VerticalLayout commMidVL = new VerticalLayout();
    commentAndViewChainHL.addComponent(commMidVL);
    commMidVL.setWidth("535px");
    commMidVL.addComponent(addCommentButt);
    addCommentButt.setCaption("Add Comment");
    addCommentButt.setStyleName(BaseTheme.BUTTON_LINK);
    addCommentButt.addStyleName("borderless");
    addCommentButt.addStyleName("m-actionplan-comments-button");
    addCommentButt.setId(ACTIONPLAN_ADD_COMMENT_LINK_BUTTON_TOP);

    addCommentButt.addClickListener(addCommentListener = new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().setScrollTop(1250); //addCommentButt.getWindow().setScrollTop(1250);
            commentPanel.AddCommentClicked(event);
        }
    });

    commMidVL.addComponent(sp = new Label());
    sp.setHeight("5px");

    commMidVL.addComponent(lastCommentLabel = new HtmlLabel());
    lastCommentLabel.setWidth("100%");
    lastCommentLabel.setHeight("94px");
    lastCommentLabel.addStyleName("m-actionplan-textentry");
    lastCommentLabel.addStyleName("m-opacity-75");

    addComponent(viewChainButt, "left:690px;top:140px");
    viewChainButt.setStyleName("m-viewCardChainButton");
    viewChainButt.addClickListener(new ViewCardChainHandler());
    viewChainButt.setId(ACTIONPLAN_VIEW_CARD_CHAIN_BUTTON);
    // This guy sits on the bottom naw, gets covered
    // author list and rfe
    VerticalLayout rightVL = new VerticalLayout();
    this.addComponent(rightVL, "left:830px;top:0px");
    rightVL.setSpacing(false);
    rightVL.setMargin(false);
    rightVL.setWidth(null);

    VerticalLayout listVL = new VerticalLayout();
    listVL.setSpacing(false);
    listVL.addStyleName("m-actionPlanAddAuthorList");
    listVL.addStyleName("m-actionplan-header-container");
    listVL.setHeight(null);
    listVL.setWidth("190px");

    listVL.addComponent(sp = new Label());
    sp.setHeight("35px");
    sp.setDescription("List of current authors and (invited authors)");

    Label subTitle;
    listVL.addComponent(subTitle = new Label("(invited in parentheses)"));
    subTitle.setWidth(null); // keep it from being 100% wide
    subTitle.setDescription("List of current authors and (invited authors)");
    subTitle.addStyleName("m-actionplan-authorlist-sublabel");
    listVL.setComponentAlignment(subTitle, Alignment.MIDDLE_CENTER);

    rightVL.addComponent(listVL);

    TreeSet<User> ts = new TreeSet<User>(new User.AlphabeticalComparator());
    ts.addAll(actPln.getAuthors());
    TreeSet<User> greyTs = new TreeSet<User>(new User.AlphabeticalComparator());
    greyTs.addAll(actPln.getInvitees());
    authorList = new UserList(null, ts, greyTs);

    listVL.addComponent(authorList);
    authorList.addStyleName("m-greyborder");
    listVL.setComponentAlignment(authorList, Alignment.TOP_CENTER);
    authorList.setWidth("150px");
    authorList.setHeight("95px");
    listVL.addComponent(sp = new Label());
    sp.setHeight("5px");
    listVL.addComponent(addAuthButton);
    listVL.setComponentAlignment(addAuthButton, Alignment.TOP_CENTER);
    addAuthButton.setStyleName("m-actionPlanAddAuthorButt");
    addAuthButton.addClickListener(new AddAuthorHandler());
    addAuthButton.setDescription("Invite players to be authors of this action plan");

    rightVL.addComponent(sp = new Label());
    sp.setHeight("5px");
    rightVL.addComponent(rfeButt);
    rightVL.setComponentAlignment(rfeButt, Alignment.TOP_CENTER);
    // done in handleDisabledments() rfeButt.setStyleName("m-rfeButton");

    // end authorList and rfe

    mainVLayout.addComponent(sp = new Label());
    sp.setHeight("5px");
    sp.setWidth("20px");
    // Tabs:
    AbsoluteLayout absL = new AbsoluteLayout();
    mainVLayout.addComponent(absL);
    absL.setHeight("60px");
    absL.setWidth("830px");
    HorizontalLayout tabsHL = new HorizontalLayout();
    tabsHL.setStyleName("m-actionPlanBlackTabs");
    tabsHL.setSpacing(false);

    absL.addComponent(tabsHL, "left:40px;top:0px");

    NewTabClickHandler ntabHndlr = new NewTabClickHandler();

    tabsHL.addComponent(sp = new Label());
    sp.setWidth("19px");
    thePlanTabButt.setStyleName("m-actionPlanThePlanTab");
    thePlanTabButt.addStyleName(ACTIONPLAN_TAB_THEPLAN); // debug
    thePlanTabButt.addClickListener(ntabHndlr);
    tabsHL.addComponent(thePlanTabButt);

    talkTabButt.setStyleName("m-actionPlanTalkItOverTab");
    //talkTabButt.addStyleName(ACTIONPLAN_TAB_TALK);
    talkTabButt.addClickListener(ntabHndlr);
    tabsHL.addComponent(talkTabButt);
    talkTabButt.addStyleName("m-transparent-background"); // initially

    imagesTabButt.setStyleName("m-actionPlanImagesTab");
    imagesTabButt.addStyleName(ACTIONPLAN_TAB_IMAGES);
    imagesTabButt.addClickListener(ntabHndlr);
    tabsHL.addComponent(imagesTabButt);
    imagesTabButt.addStyleName("m-transparent-background"); // initially

    videosTabButt.setStyleName("m-actionPlanVideosTab");
    videosTabButt.addStyleName(ACTIONPLAN_TAB_VIDEO);
    videosTabButt.addClickListener(ntabHndlr);
    tabsHL.addComponent(videosTabButt);
    videosTabButt.addStyleName("m-transparent-background"); // initially

    mapTabButt.setStyleName("m-actionPlanMapTab");
    mapTabButt.addStyleName(ACTIONPLAN_TAB_MAP);
    mapTabButt.addClickListener(ntabHndlr);
    tabsHL.addComponent(mapTabButt);
    mapTabButt.addStyleName("m-transparent-background"); // initially

    newChatLab.setStyleName("m-newChatLabel");
    absL.addComponent(newChatLab, "left:340px;top:15px");
    newChatLab.setVisible(false);

    // stack the pages
    HorizontalLayout hsp = new HorizontalLayout();
    hsp.setHeight("742px"); // allows for differing ghost box heights
    mainVLayout.addComponent(hsp);

    hsp.addComponent(sp = new Label());
    sp.setWidth("45px");

    hsp.addComponent(thePlanTab);
    thePlanTab.initGui();

    hsp.addComponent(talkTab);
    talkTab.initGui();
    talkTab.setVisible(false);

    hsp.addComponent(imagesTab);
    imagesTab.initGui();
    imagesTab.setVisible(false);

    hsp.addComponent(videosTab);
    videosTab.initGui();
    videosTab.setVisible(false);

    hsp.addComponent(mapTab);
    mapTab.initGui();
    mapTab.setVisible(false);

    mainVLayout.addComponent(sp = new Label());
    sp.setHeight("90px");

    HorizontalLayout buttLay = new HorizontalLayout();
    buttLay.addStyleName("m-marginleft-60");
    mainVLayout.addComponent(buttLay);
    buttLay.setWidth(ActionPlanPageCommentPanel2.COMMENT_PANEL_WIDTH);
    addCommentButtBottom.setCaption("Add Comment");
    addCommentButtBottom.setStyleName(BaseTheme.BUTTON_LINK);
    addCommentButtBottom.addStyleName("borderless");
    addCommentButtBottom.addStyleName("m-actionplan-comments-button");
    addCommentButtBottom.setId(ACTIONPLAN_ADD_COMMENT_LINK_BUTTON_BOTTOM);
    addCommentButtBottom.addClickListener(addCommentListener);
    buttLay.addComponent(addCommentButtBottom);

    if (me.isAdministrator() || me.isGameMaster()) {

        buttLay.addComponent(sp = new Label());
        sp.setWidth("1px"); // "810px");
        buttLay.setExpandRatio(sp, 1.0f);
        ToggleLinkButton tlb = new ToggleLinkButton("View all", "View unhidden only",
                "m-actionplan-comment-text");
        tlb.setToolTips("Temporarily show all messages, including those marked \"hidden\" (gm)",
                "Temporarily hide messages marked \"hidden\" (gm)");
        tlb.addStyleName("m-actionplan-comments-button");
        tlb.addOnListener(new ViewAllListener());
        tlb.addOffListener(new ViewUnhiddenOnlyListener());
        buttLay.addComponent(tlb);
        buttLay.addComponent(sp = new Label());
        sp.setWidth("5px");
    }
    // And the comments
    hsp = new HorizontalLayout();
    mainVLayout.addComponent(hsp);
    mainVLayout.addComponent(sp = new Label());
    sp.setHeight("5px");
    hsp.addComponent(sp = new Label());
    sp.setWidth("56px");

    hsp.addComponent(commentPanel);
    commentPanel.initGui();

    // Set thumbs
    double thumbs = actPln.getAverageThumb();
    long round = Math.round(thumbs);
    int numApThumbs = (int) (Math.min(round, 3));
    thumbPanel.setNumApThumbs(numApThumbs);

    Integer myRating = actPln.getUserThumbs().get(me);
    if (myRating == null)
        myRating = 0;
    thumbPanel.setNumUserThumbs(myRating);

    helpWantedListener = new HelpWantedListener();
    interestedListener = new InterestedListener();

    handleDisablementsTL();
}

From source file:edu.nps.moves.mmowgli.modules.administration.SessionReportWindow.java

License:Open Source License

private Component makeTopSummary(String[][] localRpt, String[][] remoteRpts) {
    Object key = HSess.checkInit();
    HorizontalLayout hLay = new MHorizontalLayout().withMargin(new MarginInfo(false, true, false, true));
    totals tots = new totals();

    count(localRpt, tots);/*from   w  w w . ja v  a  2s.  c  o m*/
    count(remoteRpts, tots);

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

    hLay.addComponent(new Label("Logged-in players: " + tots.loggedin));
    hLay.addComponent(new Label("   Total open sessions: " + tots.total));
    hLay.addComponent(new Label("   Total registered players: " + totcount));
    hLay.addStyleName("m-margintop-5");
    hLay.addStyleName("m-marginbottom-5");

    HSess.checkClose(key);
    return hLay;
}

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageAgreement.java

License:Open Source License

public RegistrationPageAgreement(Button.ClickListener listener) {
    super(listener);
    super.initGui();

    setTitleString(getTitle()); //"User Agreement 1");

    contentVLayout.setSpacing(true);// ww  w  . j a v  a2s . co m
    Label lab = new HtmlLabel(getLabelText()); //"First, please confirm your willingness to meet game requirements.  I also confirm that I am at least 18 years of age.");
    lab.addStyleName(topLabelStyle);
    contentVLayout.addComponent(lab);

    HorizontalLayout hlayout = new HorizontalLayout();
    contentVLayout.addComponent(hlayout);
    hlayout.setSpacing(true);
    hlayout.setWidth("100%");
    hlayout.addStyleName(labelStyle);

    String readUrl = getReadUrlTL();
    if (readUrl != null) {
        Link readLink = new Link("Read", new ExternalResource(getReadUrlTL())); //REGISTRATIONCONSENTURL));
        readLink.setTargetName("_agreements");
        readLink.setTargetBorder(BorderStyle.DEFAULT);
        readLink.setDescription("Opens in new window/tab");
        hlayout.addComponent(readLink);
        readLink.setSizeUndefined();
        hlayout.setComponentAlignment(readLink, Alignment.MIDDLE_LEFT);
    }

    lab = new HtmlLabel(getReadLabel()); //"<i>Consent to Participate in Anonymous Survey</i>");
    lab.setSizeUndefined();
    hlayout.addComponent(lab);
    hlayout.setSizeUndefined();
    hlayout.setComponentAlignment(lab, Alignment.TOP_LEFT);

    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("15px");

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("98%"); //"100%");
    contentVLayout.addComponent(hl);

    hl.addComponent(lab = new Label());
    lab.setWidth("20px");

    NativeButton rejectButt = new NativeButton();
    hl.addComponent(rejectButt);
    rejectButt.setStyleName("m-rejectNoThanksButton");
    // Mmowgli2UI.getGlobals().mediaLocator().decorateDialogRejectButton(rejectButt);    
    rejectButt.addClickListener(new RejectListener());

    hl.addComponent(lab = new Label());
    hl.setExpandRatio(lab, 1.0f);

    NativeButton continueButt = new NativeButton();
    hl.addComponent(continueButt);
    //Mmowgli2UI.getGlobals().mediaLocator().decorateDialogAcceptAndContinueButton(continueButt);
    continueButt.setStyleName("m-acceptAndContinueButton");
    continueButt.addClickListener(new MyContinueListener());

    continueButt.setClickShortcut(KeyCode.ENTER);
}

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageAgreementCombo.java

License:Open Source License

public RegistrationPageAgreementCombo(Button.ClickListener listener) {
    super(listener);
    super.initGui();

    setTitleString("User Agreement");

    contentVLayout.setSpacing(true);// w w w .  j a  va2s.c  o m

    Label lab = new Label("I confirm my willingness to meet game requirements:");
    lab.addStyleName(topLabelStyle);
    contentVLayout.addComponent(lab);

    // First
    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("5px"); // space

    contentVLayout.addComponent(lab = new HtmlLabel(
            "First, I confirm that I am at least 18 years of age, I have been informed of risks<br/>and benefits, and I consent to participate."));
    lab.addStyleName(labelStyle);

    HorizontalLayout hlayout = new HorizontalLayout();
    contentVLayout.addComponent(hlayout);
    hlayout.setSpacing(true);
    hlayout.setWidth("100%");
    hlayout.addStyleName(labelStyle);

    // First read
    hlayout.addComponent(lab = new HtmlLabel("&nbsp;&nbsp;"));
    lab.setHeight("10px");
    GameLinks gl = GameLinks.getTL();
    Link readLink = new Link("Read", new ExternalResource(gl.getInformedConsentLink())); //REGISTRATIONCONSENTURL));
    readLink.setTargetName("_agreements");
    readLink.setTargetBorder(BorderStyle.DEFAULT);
    readLink.setDescription("Opens in new window/tab");
    hlayout.addComponent(readLink);
    readLink.setSizeUndefined();

    lab = new HtmlLabel("<i>Informed Consent to Participate in Research</i>");
    lab.setSizeUndefined();
    hlayout.addComponent(lab);

    hlayout.setSizeUndefined();

    // Second
    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("5px"); // space

    lab = new HtmlLabel(
            "Second, I understand that <b style='color:red;'>no classified or sensitive information can be<br/>posted</b> to the game since participation is open.  Violation of this policy may<br/>lead to serious consequences.");
    lab.addStyleName(labelStyle);
    contentVLayout.addComponent(lab);

    hlayout = new HorizontalLayout();
    contentVLayout.addComponent(hlayout);
    hlayout.setSpacing(true);
    hlayout.setWidth("100%");
    hlayout.addStyleName(labelStyle);

    // Second read
    hlayout.addComponent(lab = new HtmlLabel("&nbsp;&nbsp;"));

    readLink = new Link("Read", new ExternalResource(gl.getUserAgreementLink()));
    readLink.setTargetName("_agreements");
    readLink.setTargetBorder(BorderStyle.DEFAULT);
    readLink.setDescription("Opens in new window/tab");
    hlayout.addComponent(readLink);
    readLink.setSizeUndefined();

    lab = new HtmlLabel("<i>Department of Defense Social Media User Agreement</i>");
    lab.setSizeUndefined();
    hlayout.addComponent(lab);

    hlayout.setSizeUndefined();

    // Third
    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("5px"); // space

    lab = new HtmlLabel(
            "Third, the official language of the MMOWGLI game is English.  Other languages<br/>are not supported in order to ensure that player postings are appropriate.");
    lab.addStyleName(labelStyle);
    contentVLayout.addComponent(lab);

    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("15px");

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

    hl.addComponent(lab = new Label());
    lab.setWidth("20px");

    NativeButton rejectButt = new NativeButton();
    hl.addComponent(rejectButt);
    rejectButt.setStyleName("m-rejectNoThanksButton"); //new way
    rejectButt.addClickListener(new RejectListener());

    hl.addComponent(lab = new Label());
    hl.setExpandRatio(lab, 1.0f);

    NativeButton continueButt = new NativeButton();
    hl.addComponent(continueButt);
    continueButt.setStyleName("m-acceptAndContinueButton"); // new way
    continueButt.addClickListener(new MyContinueListener());

    continueButt.setClickShortcut(KeyCode.ENTER);
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java

License:Open Source License

HorizontalLayout makeCheckRow(Button butt) {
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeUndefined();// w w  w .java2s .  co m
    hl.addStyleName("m-userprofile-linkbuttons");
    hl.setMargin(false);
    hl.setSpacing(false);
    if (checkMarkRes == null)
        checkMarkRes = Mmowgli2UI.getGlobals().getMediaLocator().getCheckMark12px();
    Embedded embedded = new Embedded(null, checkMarkRes);
    embedded.setWidth("12px");
    if (butt == buildsButt)
        embedded.setVisible(false);
    hl.addComponent(embedded);
    hl.addComponent(butt);
    hl.setExpandRatio(butt, 1.0f);
    return hl;
}

From source file:edu.nps.moves.mmowgliMobile.ui.CardRenderer2.java

License:Open Source License

public void setMessage(FullEntryView2 mView, ListEntry message, ListView2 messageList,
        AbstractOrderedLayout layout) {/*from w  ww .  j a  v a 2  s  . c o  m*/
    Object key = HSess.checkInit();
    CardListEntry wc = (CardListEntry) message;
    Card c = wc.getCard();
    CardType typ = c.getCardType();

    layout.removeAllComponents();
    layout.setSpacing(true);

    VerticalLayout cardLay = new VerticalLayout();
    cardLay.addStyleName("m-card-render");
    cardLay.setWidth("98%"); //100%");
    cardLay.setSpacing(true);
    layout.addComponent(cardLay);

    HorizontalLayout horl = new HorizontalLayout();
    horl.addStyleName("m-card-header");
    String stl = CardStyler.getCardBaseStyle(typ);
    horl.addStyleName(stl);
    horl.addStyleName(CardStyler.getCardTextColorOverBaseStyle(typ));
    horl.setMargin(true);
    horl.setWidth("100%");

    Label lbl = new Label(typ.getTitle());//c.getText());
    horl.addComponent(lbl);
    lbl = new Label("" + getPojoId(message));
    lbl.addStyleName("m-text-align-right");
    horl.addComponent(lbl);
    cardLay.addComponent(horl);

    horl = new HorizontalLayout();
    horl.setWidth("100%");
    horl.setMargin(true);
    cardLay.addComponent(horl);
    lbl = new Label(c.getText());
    horl.addComponent(lbl);

    horl = new HorizontalLayout();
    horl.addStyleName("m-card-footer");

    horl.setMargin(true);
    horl.setWidth("100%");
    horl.addComponent(lbl = new Label(""));
    lbl.setWidth("5px");

    Image img = new Image();
    img.setSource(mediaLocator.locate(c.getAuthor().getAvatar().getMedia()));
    img.setWidth("30px");
    img.setHeight("30px");
    horl.addComponent(img);

    //    horl.addComponent(lbl=new Label(c.getAuthorName()));
    //    lbl.setWidth("100%");
    //    lbl.addStyleName("m-text-align-center");
    //    horl.setComponentAlignment(lbl, Alignment.MIDDLE_CENTER);
    //    horl.setExpandRatio(lbl, 1.0f);

    Button authButt = new MyButton(c.getAuthorName(), c, mView);
    authButt.setStyleName(BaseTheme.BUTTON_LINK);
    authButt.setWidth("100%");
    horl.addComponent(authButt);
    horl.setComponentAlignment(authButt, Alignment.MIDDLE_CENTER);
    horl.setExpandRatio(authButt, 1.0f);

    horl.addComponent(lbl = new HtmlLabel(formatter.format(message.getTimestamp())));
    lbl.setWidth("115px");
    ;
    lbl.addStyleName("m-text-align-right");
    horl.setComponentAlignment(lbl, Alignment.MIDDLE_CENTER);

    cardLay.addComponent(horl);

    //    lbl = new Hr();   
    //    layout.addComponent(lbl);

    lbl = new Label("Child Cards");
    layout.addComponent(lbl);
    lbl.addStyleName("m-text-center");

    //    lbl = new Hr();
    //    layout.addComponent(lbl);

    horl = new HorizontalLayout();
    horl.setSpacing(true);
    horl.setMargin(true);
    horl.setWidth("100%");
    layout.addComponent(horl);

    horl.addComponent(
            makeChildGroupButton("Expand", (CardListEntry) message, CardType.getExpandTypeTL(), messageList));
    horl.addComponent(
            makeChildGroupButton("Counter", (CardListEntry) message, CardType.getCounterTypeTL(), messageList));
    horl.addComponent(
            makeChildGroupButton("Adapt", (CardListEntry) message, CardType.getAdaptTypeTL(), messageList));
    horl.addComponent(
            makeChildGroupButton("Explore", (CardListEntry) message, CardType.getExploreTypeTL(), messageList));

    HSess.checkClose(key);
}