Example usage for com.vaadin.ui VerticalLayout setSpacing

List of usage examples for com.vaadin.ui VerticalLayout setSpacing

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setSpacing.

Prototype

@Override
    public void setSpacing(boolean spacing) 

Source Link

Usage

From source file:edu.nps.moves.mmowgli.components.SendMessageWindow.java

License:Open Source License

public SendMessageWindow(User user, boolean ccSelf, MailManager.Channel channel, boolean showCcTroubleList) {
    super("A message to " + user.getUserName());

    this.usr = user;
    this.ccSelf = ccSelf;
    this.channel = channel;

    setModal(true);//from  w  w w .  ja  v  a2s .c  o  m
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    setContent(layout);

    subjTf = new TextField();
    subjTf.setCaption("Subject");
    subjTf.setWidth("100%");

    User me = Mmowgli2UI.getGlobals().getUserTL();
    Game game = Game.getTL();
    String acronym = game.getAcronym();
    acronym = acronym == null ? "" : acronym + " ";
    subjTf.setValue(acronym + "Mmowgli message to " + usr.getUserName() + " from " + me.getUserName());
    layout.addComponent(subjTf);
    if (showCcTroubleList) {
        layout.addComponent(ccTroubleListCB = new CheckBox("CC mmowgli trouble list"));
        ccTroubleListCB.setValue(false);
    }
    ta = new TextArea();
    ta.setCaption("Content");
    ta.setRows(10);
    ta.setColumns(50);
    ta.setInputPrompt("Type message here");
    layout.addComponent(ta);

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

    WindowCloser closeListener = new WindowCloser(this);
    cancelButt = new Button("Cancel", closeListener);
    buttHL.addComponent(cancelButt);

    sendButt = new Button("Send", closeListener);//new IDButton("Send", SENDPRIVATEMESSAGECLICK, user);
    sendButt.addClickListener(closeListener);
    buttHL.addComponent(sendButt);

    layout.addComponent(buttHL);
    layout.setComponentAlignment(buttHL, Alignment.MIDDLE_RIGHT);
    layout.setSizeUndefined(); // does a "pack"

    UI.getCurrent().addWindow(this);
    ta.focus();
}

From source file:edu.nps.moves.mmowgli.components.SignupsTable.java

License:Open Source License

@SuppressWarnings("serial")
public static void showDialog(String title) {
    final Button bulkMailButt = new Button("Initiate bulk mail job sending to filtered list");

    final Button emailButt = new Button("Compose email");
    emailButt.setDescription("Opens editing dialog to compose an email message to the selected individuals");
    final Button displayButt = new Button("Display as plain text");
    Button closeButt;//from   w w  w.  j a va  2s . c  o m

    final SignupsTable tab = new SignupsTable(null, null, new ValueChangeListener() // selected
    {
        @Override
        public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            emailButt.setEnabled(true);
        }
    });

    final Window dialog = new Window(title);
    dialog.setWidth("950px");
    dialog.setHeight("650px");

    VerticalLayout vl = new VerticalLayout();
    dialog.setContent(vl);
    vl.setSizeFull();
    vl.setMargin(true);
    vl.setSpacing(true);
    addFilterCheckBoxes(vl);
    vl.addComponent(new Label("Individuals who have established game accounts are shown faintly"));

    tab.setSizeFull();
    vl.addComponent(tab);
    vl.setExpandRatio(tab, 1.0f);

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

    buttHL.addComponent(bulkMailButt);
    bulkMailButt.setImmediate(true);
    ;
    Label lab = new Label("");
    buttHL.addComponent(lab);
    buttHL.setExpandRatio(lab, 1.0f);

    buttHL.addComponent(emailButt);
    emailButt.setImmediate(true);
    buttHL.addComponent(displayButt);
    displayButt.setImmediate(true);
    buttHL.addComponent(closeButt = new Button("Close"));
    closeButt.setImmediate(true);

    emailButt.setEnabled(false);

    closeButt.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            dialog.close();
        }
    });

    emailButt.addClickListener(new ClickListener() {
        @SuppressWarnings("rawtypes")
        @Override
        public void buttonClick(ClickEvent event) {
            HSess.init();
            Set set = (Set) tab.getValue();
            ArrayList<String> emails = new ArrayList<String>(set.size());
            Iterator itr = set.iterator();
            while (itr.hasNext()) {
                QueryWrapper wrap = (QueryWrapper) itr.next();
                emails.add(wrap.getEmail());
            }
            new SendMessageWindow(emails);
            HSess.close();
        }
    });

    displayButt.addClickListener(new ClickListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void buttonClick(ClickEvent event) {
            HSess.init();
            dumpSignupsTL();
            HSess.close();
        }
    });

    bulkMailButt.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            BulkMailHandler.showDialog((QueryContainer) tab.getContainerDataSource());
        }
    });

    vl.addComponent(buttHL);
    vl.setComponentAlignment(buttHL, Alignment.MIDDLE_RIGHT);

    UI.getCurrent().addWindow(dialog);
    dialog.center();
}

From source file:edu.nps.moves.mmowgli.components.VideoWithRightTextPanel.java

License:Open Source License

public void initGui() {
    addStyleName("m-calltoaction-novideo"); // m-calltoaction"); // puts up background
    setMargin(false);/*from   w w w .  j  a v  a 2 s  .  com*/
    setSpacing(false);
    setWidth("988px");

    Label lab;

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

    HorizontalLayout horLay = new HorizontalLayout();
    horLay.setSpacing(false);
    horLay.setMargin(false);
    horLay.setWidth("100%");
    addComponent(horLay);

    horLay.addComponent(lab = new Label());
    lab.setWidth("38px");

    if (vidMedia != null && vidMedia.getUrl() != null && vidMedia.getUrl().trim().length() > 0) {
        if (vidMedia.getType() == MediaType.YOUTUBE) {
            try {
                Flash ytp = new Flash();
                ytp.setSource(new ExternalResource("https://www.youtube.com/v/" + vidMedia.getUrl()));
                ytp.setParameter("allowFullScreen", "true");
                ytp.setParameter("showRelated", "false");
                ytp.setWidth(539.0f, Unit.PIXELS); //VID_W_PX,Unit.PIXELS);
                ytp.setHeight(342.0f, Unit.PIXELS); //VID_H_PX,Unit.PIXELS);
                player = ytp;
            } catch (Exception ex) {
                System.err.println("Exception instantiating YouTubePlayer: " + ex.getClass().getSimpleName()
                        + ": " + ex.getLocalizedMessage());
            }
        } else {
            System.err.println("Bad media file in VideoWithRightTextPanel");
            player = new Label("missing video");
        }
        VerticalLayout plyrLinkWrap = new VerticalLayout();
        plyrLinkWrap.setMargin(false);
        plyrLinkWrap.setSpacing(true);
        plyrLinkWrap.setSizeUndefined();

        VerticalLayout playerVL = new VerticalLayout(); //AbsoluteLayout();
        playerVL.setWidth("539px");
        playerVL.setHeight("342px");
        playerVL.addStyleName("m-boxshadow-5");
        playerVL.addComponent(player);
        plyrLinkWrap.addComponent(playerVL);

        Link link = getAlternateVideoLink(vidMedia);
        if (link != null) {
            plyrLinkWrap.addComponent(link);
            plyrLinkWrap.setComponentAlignment(link, Alignment.BOTTOM_CENTER);
        }
        horLay.addComponent(plyrLinkWrap);
        horLay.addComponent(lab = new Label());
        lab.setWidth("22px");
    }
    VerticalLayout rightColVLayout = new VerticalLayout();
    horLay.addComponent(rightColVLayout);
    horLay.setExpandRatio(rightColVLayout, 1.0f);

    horLay.addComponent(lab = new Label());
    lab.setWidth("35px");

    rightColVLayout.setSpacing(true);

    if (headerImg != null) { // Image takes priority over text
        rightColVLayout.addComponent(headerImg);
    } else {
        headingLab = new HtmlLabel(heading);
        if (largerText)
            headingLab.addStyleName("m-orientation-heading");
        else
            headingLab.addStyleName("m-calltoaction-thesituation-heading");
        rightColVLayout.addComponent(headingLab);
    }

    summaryLab = new HtmlLabel(summary);
    if (largerText)
        summaryLab.addStyleName("m-orientation-summary");
    else
        summaryLab.addStyleName("m-calltoaction-thesituation-summary");
    rightColVLayout.addComponent(summaryLab);

    // text = text.replace("\n", "<br/><br/>"); // pure html with <p> tags seems to work well
    textLab = new HtmlLabel(text);
    if (largerText)
        textLab.addStyleName("m-orientation-text");
    else
        textLab.addStyleName("m-calltoaction-thesituation-text");
    rightColVLayout.addComponent(textLab);

    // Move 2, no room
    /*
     * if (promptImg != null) { // Image priority over text rightColVLayout.addComponent(promptImg); } else if (prompt != null){ promptLab = new Label(prompt);
     * promptLab.setContentMode(Label.CONTENT_XHTML); if(largerText) promptLab.addStyleName("m-orientation-prompt"); else
     * promptLab.addStyleName("m-calltoaction-thesituation-prompt"); rightColVLayout.addComponent(promptLab); }
     */
    // spacer so background doesn't look cut-off
    addComponent(lab = new Label());
    lab.setHeight("25px");
}

From source file:edu.nps.moves.mmowgli.export.BaseExporter.java

License:Open Source License

protected void getMetaStringOrCancel(final MetaListener lis, String title, final Map<String, String> params) {
    final Window dialog = new Window(title);
    final TextField[] parameterFields;

    dialog.setModal(true);/*from   w w w.  j  a v a 2s.c  om*/

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();
    dialog.setContent(layout);

    final TextArea ta = new TextArea();
    ta.setWidth("100%");
    ta.setInputPrompt("Type a description of this data, or the game which generated this data (optional)");

    ta.setImmediate(true);
    layout.addComponent(ta);

    Set<String> keySet = params.keySet();
    parameterFields = new TextField[keySet.size()];
    int i = 0;
    GridLayout pGL = new GridLayout();
    pGL.addStyleName("m-greyborder");
    pGL.setColumns(2);
    Label hdr = new HtmlLabel("<b>Parameters</b>");
    hdr.addStyleName("m-textaligncenter");
    pGL.addComponent(hdr, 0, 0, 1, 0); // top row
    pGL.setComponentAlignment(hdr, Alignment.MIDDLE_CENTER);
    pGL.setSpacing(false);
    for (String key : keySet) {
        pGL.addComponent(new HtmlLabel("&nbsp;" + key + "&nbsp;&nbsp;"));
        pGL.addComponent(parameterFields[i] = new TextField());
        parameterFields[i++].setValue(params.get(key));
    }
    if (i > 0) {
        layout.addComponent(pGL);
        layout.setComponentAlignment(pGL, Alignment.TOP_CENTER);
    }

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    @SuppressWarnings("serial")
    Button cancelButt = new Button("Cancel", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            dialog.close();
            lis.continueOrCancel(null);
        }
    });

    @SuppressWarnings("serial")
    Button exportButt = new Button("Export", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            dialog.close();

            Set<String> keySet = params.keySet();
            int i = 0;
            for (String key : keySet)
                params.put(key, parameterFields[i++].getValue().toString());

            lis.continueOrCancel(ta.getValue().toString());
        }
    });
    hl.addComponent(cancelButt);
    hl.addComponent(exportButt);
    hl.setComponentAlignment(cancelButt, Alignment.MIDDLE_RIGHT);
    hl.setExpandRatio(cancelButt, 1.0f);

    // The components added to the window are actually added to the window's
    // layout; you can use either. Alignments are set using the layout
    layout.addComponent(hl);
    dialog.setWidth("385px");
    dialog.setHeight("310px");
    hl.setWidth("100%");
    ta.setWidth("100%");
    ta.setHeight("100%");
    layout.setExpandRatio(ta, 1.0f);

    UI.getCurrent().addWindow(dialog);
}

From source file:edu.nps.moves.mmowgli.hibernate.SearchPopup.java

License:Open Source License

@SuppressWarnings("serial")
public SearchPopup(String startingText) {
    super("Search for Players, Action Plans, Idea Cards");
    //setModal(true);   better not to be model

    this.initialText = startingText;
    setWidth("635px");
    setHeight("600px");
    center();/*w ww  .  j  av  a 2 s.  c om*/

    VerticalLayout vLay = new VerticalLayout();
    vLay.setSizeFull();
    vLay.setMargin(true);
    vLay.setSpacing(true);
    setContent(vLay);

    WordCloudPanel wcPan = new WordCloudPanel(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WordButton wb = (WordButton) event.getButton();
            tf.setValue(wb.word.text);
            searchButt.fireClick();
        }
    });
    wcPan.setImmediate(true);

    TermInfo[] tinfo = SearchManager.getHighFrequencyTerms();
    List<Word> wdLis = new ArrayList<Word>(tinfo.length);

    for (TermInfo inf : tinfo) {
        String txt = inf.term.text();
        Word wd = new Word(txt, inf.docFreq);
        wdLis.add(wd);
    }

    // V7
    /*
    TermStats[] tstats = SearchManager.getHighFrequencyTerms();
    List<Word> wdLis = new ArrayList<Word>(tstats.length);
    for(TermStats ts : tstats) {
      String txt = new String(ts.termtext.utf8ToString());
      Word wd = new Word(txt,ts.docFreq);
      wdLis.add(wd);
    }
    */

    wdLis = finalFilter(wdLis);
    // dumpList(wLis);
    wcPan.setWordData(wdLis, WordOrder.ALPHA);
    wcPan.setWidth("590px"); // won't work in ie"100%");
    vLay.addComponent(wcPan);

    HorizontalLayout topHL = new HorizontalLayout();
    vLay.addComponent(topHL);
    topHL.setWidth("100%");
    topHL.setMargin(true);
    topHL.setSpacing(true);

    topHL.addComponent(tf = new TextField());
    tf.addValueChangeListener(new TextFieldChangeListener());
    tf.setWidth("100%");
    //tf.setInputPrompt("Enter search terms");
    tf.setImmediate(true);
    tf.setTextChangeTimeout(5000);
    topHL.setExpandRatio(tf, 1.0f);
    if (startingText != null)
        tf.setValue(startingText);

    searchButt = new FireableButton("Search", this);
    topHL.addComponent(searchButt);
    searchButt.setClickShortcut(KeyCode.ENTER);

    vLay.addComponent(statusLabel = new HtmlLabel("&nbsp;"));
    statusLabel.setImmediate(true);

    resultsTable = new Table();
    resultsTable.addStyleName("m-actiondashboard-table");
    resultsTable.setImmediate(true);
    vLay.addComponent(resultsTable);
    resultsTable.setHeight("100%");
    resultsTable.setWidth("99%");
    vLay.setExpandRatio(resultsTable, 1.0f);

    BeanItemContainer<SearchResult> bCont = new BeanItemContainer<SearchResult>(SearchResult.class);
    bCont.addBean(new SearchResult("", "", "")); // fix for 6.7.0 bug
    resultsTable.addGeneratedColumn("text", new ToolTipAdder());
    resetTable(bCont);

    resultsTable.setNewItemsAllowed(false);
    resultsTable.setSelectable(true);

    resultsTable.addItemClickListener(new ItemClickListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void itemClick(ItemClickEvent event) {
            HSess.init();
            @SuppressWarnings("unchecked")
            BeanItem<SearchResult> bi = (BeanItem<SearchResult>) event.getItem();
            SearchResult sr = bi.getBean();
            MmowgliController controller = Mmowgli2UI.getGlobals().getController();
            if (sr.getType().equals(USERTYPEKEY))
                controller.miscEventTL(new AppEvent(SHOWUSERPROFILECLICK, SearchPopup.this, sr.getHibId()));
            else if (sr.getType().equals(ACTIONPLANTYPEKEY))
                controller.miscEventTL(new AppEvent(ACTIONPLANSHOWCLICK, SearchPopup.this, sr.getHibId()));
            else
                controller.miscEventTL(new AppEvent(CARDCLICK, SearchPopup.this, sr.getHibId()));
            HSess.close();

            closeListener.buttonClick(null);
        }
    });

    vLay.addComponent(closeButt = new Button("Close"));
    vLay.setComponentAlignment(closeButt, Alignment.TOP_RIGHT);
    closeButt.addClickListener(closeListener = new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (searchThread != null)
                searcherObj.killed = true;
            //V7 SearchPopup.this.getParent().removeWindow(SearchPopup.this);
            SearchPopup.this.close();
        }
    });
}

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

License:Open Source License

private static void _postGameEvent(String title, final GameEvent.EventType typ, String buttName,
        boolean doWarning) {
    // Create the window...
    final Window bcastWindow = new Window(title);
    bcastWindow.setModal(true);//from  w w w. ja v  a2s  .c  om

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

    layout.addComponent(new Label("Compose message (255 char limit):"));
    final TextArea ta = new TextArea();
    ta.setRows(5);
    ta.setWidth("99%");
    layout.addComponent(ta);

    HorizontalLayout buttHl = new HorizontalLayout();
    final Button bcancelButt = new Button("Cancel");
    buttHl.addComponent(bcancelButt);
    Button bokButt = new Button(buttName);
    buttHl.addComponent(bokButt);
    layout.addComponent(buttHl);
    layout.setComponentAlignment(buttHl, Alignment.TOP_RIGHT);

    if (doWarning)
        layout.addComponent(new Label("Use with great deliberation!"));

    bcastWindow.setWidth("320px");
    UI.getCurrent().addWindow(bcastWindow);
    bcastWindow.setPositionX(0);
    bcastWindow.setPositionY(0);

    ta.focus();

    @SuppressWarnings("serial")
    ClickListener lis = new ClickListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        @HibernateUserRead
        public void buttonClick(ClickEvent event) {
            if (event.getButton() == bcancelButt)
                ; // nothin
            else {
                // This check is now done in GameEvent.java, but should ideally prompt the user.
                HSess.init();
                String msg = ta.getValue().toString().trim();
                if (msg.length() > 0) {
                    if (msg.length() > 255) // clamp to 255 to avoid db exception
                        msg = msg.substring(0, 254);
                    Serializable uid = Mmowgli2UI.getGlobals().getUserID();
                    User u = User.getTL(uid);
                    if (typ == GameEvent.EventType.GAMEMASTERNOTE)
                        GameEventLogger.logGameMasterCommentTL(msg, u);
                    else
                        GameEventLogger.logGameMasterBroadcastTL(typ, msg, u); // GameEvent.save(new GameEvent(typ,msg));
                    HSess.close();
                }
            }
            bcastWindow.close();
        }
    };
    bcancelButt.addClickListener(lis);
    bokButt.addClickListener(lis);
}

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   w  w  w  . j  a  v a2  s .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.actionplans.ActionPlanPageCommentPanel2.java

License:Open Source License

@Override
public void initGui() {
    this.setStyleName(Reindeer.PANEL_LIGHT);
    this.setHeight("625px");
    this.addStyleName("m-greyborder");

    VerticalLayout vl = new VerticalLayout();
    vl.setSpacing(false);
    vl.setWidth(COMMENT_PANEL_WIDTH);/* w ww .  j  a v a 2  s  . c o m*/
    vl.setMargin(false);
    setContent(vl);
    VerticalLayout contentBack = new VerticalLayout();
    contentBack.setWidth(COMMENT_PANEL_WIDTH);
    //    contentBack.addStyleName("m-whitepanel-middle");
    vl.addComponent(contentBack);

    VerticalLayout content = new VerticalLayout();
    contentBack.addComponent(content);
    content.setMargin(new MarginInfo(false, true, false, true)); // don't need margins at top and bottom
    content.setSpacing(true);
    content.setWidth("100%");

    addCommentClicked = new AddCommentListener();
    content.addComponent(addCommentPanel = new AddedCommentPanel());
    addCommentPanel.initGui();

    addCommentPanel.setVisible(false);

    commentListVL = new VerticalLayout();
    commentListVL.setSpacing(false);
    content.addComponent(commentListVL);

    refillCommentList(HSess.get());
}

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

License:Open Source License

@Override
public void initGui() {
    setSizeUndefined();// w  w  w. j  a  v  a  2 s .  co  m
    VerticalLayout leftLay = getLeftLayout();
    leftLay.setSpacing(false);
    leftLay.setMargin(false);

    VerticalLayout flowLay = new VerticalLayout();
    flowLay.setWidth("100%");
    leftLay.addComponent(flowLay);
    flowLay.setSpacing(true);

    Label missionLab = new Label("Authors, add some images!");
    flowLay.addComponent(missionLab);
    flowLay.setComponentAlignment(missionLab, Alignment.TOP_LEFT);
    missionLab.addStyleName("m-actionplan-mission-title-text");

    ActionPlan ap = ActionPlan.getTL(apId);

    Label missionContentLab;
    if (!isMockup)
        missionContentLab = new HtmlLabel(ap.getImagesInstructions());
    else {
        Game g = Game.getTL();
        missionContentLab = new HtmlLabel(g.getDefaultActionPlanImagesText());
    }
    flowLay.addComponent(missionContentLab);
    flowLay.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT);
    flowLay.addStyleName("m-actionplan-mission-content-text");

    MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals();
    flowLay.addComponent(addImageButt);
    addImageButt.addStyleName("m-actionplan-addimage-butt");
    addImageButt.addStyleName("borderless");
    addImageButt.setIcon(globs.getMediaLocator().getActionPlanAddImageButt());
    addImageButt.addClickListener(new ImageAdder());
    addImageButt.setEnabled(!isReadOnly);

    flowLay.addComponent(nonAuthorLabel = new Label("Authors may add images when editing the plan."));
    nonAuthorLabel.setVisible(false);

    VerticalLayout rightLay = getRightLayout();
    rightLay.setSpacing(false);
    rightLay.setMargin(false);

    imageScroller = new Panel();
    GridLayout gridL = new GridLayout();
    gridL.setColumns(2);
    gridL.setSpacing(true);
    gridL.setMargin(new MarginInfo(true));
    imageScroller.setContent(gridL);
    imageScroller.setStyleName(Reindeer.PANEL_LIGHT); // make a transparent scroller
    imageScroller.setWidth("100%");
    imageScroller.setHeight("99%");
    setUpIndexListener(imageScroller);

    rightLay.addComponent(imageScroller);
    fillWithImagesTL();
}

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

License:Open Source License

@Override
public void initGui() {
    setSizeUndefined();//from   w  w w . j a va  2s.c o m

    ActionPlan ap = ActionPlan.getTL(apId);
    mmowgliMap = ap.getMap();
    if (mmowgliMap == null) {
        mmowgliMap = new edu.nps.moves.mmowgli.db.GoogleMap();
        GoogleMap.saveTL(mmowgliMap);

        ap.setMap(mmowgliMap);
        ActionPlan.updateTL(ap);
    }

    VerticalLayout leftLay = getLeftLayout();
    leftLay.setSpacing(false);
    leftLay.setMargin(false);

    Label missionLab = new Label("Authors, put your plan on the map!");
    leftLay.addComponent(missionLab);
    leftLay.setComponentAlignment(missionLab, Alignment.TOP_LEFT);
    missionLab.addStyleName("m-actionplan-mission-title-text");

    Label missionContentLab;
    if (!isMockup)
        missionContentLab = new HtmlLabel(ap.getMapInstructions());
    else {
        Game g = Game.getTL();
        missionContentLab = new HtmlLabel(g.getDefaultActionPlanMapText());
    }

    leftLay.addComponent(missionContentLab);
    leftLay.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT);
    leftLay.addStyleName("m-actionplan-mission-content-text");
    /*
    Component c;
    c=buildMapFlags(leftLay);  // does the addComponent
    leftLay.setComponentAlignment(c, Alignment.TOP_CENTER);
    */
    toggleFlags(editingOK);

    Label sp;
    leftLay.addComponent(sp = new Label());
    sp.setHeight("1px");
    leftLay.setExpandRatio(sp, 1.0f);

    map.setAttributionPrefix("Powered by Leaflet with v-leaflet");
    map.addStyleName("m-greyborder");
    map.removeAllComponents();
    try {
        LeafletLayers.installAllProviders(map);
    } catch (Exception ex) {
        System.err.println("ActionPlanPageTabMap error loading layers: " + ex.getClass().getSimpleName() + " "
                + ex.getLocalizedMessage());
    }
    double lat = mmowgliMap.getLatCenter();
    double lon = mmowgliMap.getLonCenter();
    map.setCenter(lat, lon);
    map.setZoomLevel(mmowgliMap.getZoom());
    map.setWidth(MAPWIDTH);
    map.setHeight(editingOK ? MAPHEIGHT_WITH_BUTTONS : MAPHEIGHT);

    // Build a mmowgliMap widget from our content
    /*
    googleMapWidget = new MmowgliMapWidget(app, mmowgliMap.getLatLonCenter(), mmowgliMap.getZoom(), GOOGLEMAPS_KEY);
            
    googleMapWidget.setWidth(MAPWIDTH);
    googleMapWidget.setHeight(editingOK ? MAPHEIGHT_WITH_BUTTONS : MAPHEIGHT);
    googleMapWidget.addControl(MapControl.MenuMapTypeControl);
    googleMapWidget.addControl(MapControl.SmallMapControl);
    //googleMapWidget.addListener(new MyMapClickListener());
    googleMapWidget.addListener(new MyMapMoveListener());
    //googleMapWidget.addListener(new MyMarkerClickListener());
    googleMapWidget.addListener(new MyMarkerMovedListener());
    googleMapWidget.reportMapBounds();
    */
    loadMarkers(ap);

    VerticalLayout rightLay = getRightLayout();
    rightLay.setSpacing(false);
    rightLay.setMargin(false);

    rightLay.addComponent(sp = new Label());
    sp.setHeight("15px");

    savePanel = new MapSaveButtPan();
    rightLay.addComponent(savePanel);
    rightLay.setComponentAlignment(savePanel, Alignment.TOP_CENTER);
    savePanel.setVisible(editingOK);
    // MapSaveListener msLis = new MapSaveListener();
    //  savePanel.setClickHearers(msLis.mapLocListener,msLis.mapMarkerListener,msLis.cancelListener);

    /*  DragAndDropWrapper ddw = new DragAndDropWrapper(googleMapWidget);
      ddw.setDropHandler(new MapDropHandler());
      ddw.setSizeFull();
              
      rightLay.addComponent(ddw);
      rightLay.setExpandRatio(ddw, 1.0f);
      */
    rightLay.addComponent(map);
    rightLay.setExpandRatio(map, 1);
}