Example usage for com.vaadin.ui Label setHeight

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

Introduction

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

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

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

License:Open Source License

private void refillCommentList(Session sess) {
    ActionPlan ap = ActionPlan.get(apId, sess);
    Set<Message> lis = ap.getComments();
    int total = lis.size();

    if (total == commentListVL.getComponentCount())
        return; // no change

    commentListVL.removeAllComponents();

    mother.adjustCommentsLinkCaption(total);

    User u = User.get(Mmowgli2UI.getGlobals().getUserID(), sess);
    boolean isGameMaster = u.isGameMaster() || u.isAdministrator();

    int i = total;
    for (Message m : lis) {
        ActionPlanComment apc = new MyActionPlanComment(null, total, m, isGameMaster, ap, sess, readonly); // dont show order new ActionPlanComment(i, total, m));
        commentListVL.addComponent(apc);
        apc.initGui(sess);/*  w w  w.j a  v a2 s.c o m*/

        handleVisible(apc); //apc.setVisible(!m.isHidden());
        apc.setWidth("920px");
        Label sp;
        commentListVL.addComponent(sp = new Label());
        sp.setHeight("1px");
        if (i == total)
            mother.fillHeaderCommentWithLatest(apc.getMessage(), sess);
        i--;
    }
    ;
}

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

License:Open Source License

@Override
public void initGui() {
    setSizeUndefined();//ww w.  j  a va 2s.  c om

    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);
}

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

License:Open Source License

public ActionPlanPageTabPanel(Object apId, boolean isMockup, boolean isReadOnly) {
    this.apId = apId;
    this.isMockup = isMockup;
    this.isReadOnly = isReadOnly;

    setSpacing(true);//from  w w w.j  a  v a 2 s  .c  om
    setMargin(false);

    setWidth("970px");
    setHeight("750px");

    VerticalLayout leftWrapper = new VerticalLayout();
    addComponent(leftWrapper);
    leftWrapper.setSpacing(false);
    leftWrapper.setMargin(false);
    leftWrapper.setWidth("261px");

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

    GhostVerticalLayoutWrapper gWrap = new GhostVerticalLayoutWrapper();
    leftWrapper.addComponent(gWrap);
    leftVertLay = new VerticalLayout();
    gWrap.ghost_setContent(leftVertLay);

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

    VerticalLayout rightWrapper = new VerticalLayout();
    addComponent(rightWrapper);
    rightWrapper.setSpacing(false);
    rightWrapper.setMargin(false);
    rightWrapper.setWidth("100%");
    rightWrapper.setHeight("690px");

    rightVertLay = new VerticalLayout();
    rightWrapper.addComponent(rightVertLay);
    rightVertLay.setWidth("690px");
    rightVertLay.setHeight("695px");
}

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

License:Open Source License

@Override
public void initGui() {
    setSizeUndefined();//from  ww  w  .j av a  2  s . c  o m
    VerticalLayout leftVL = this.getLeftLayout();

    leftVL.setSpacing(true);

    Label missionLab = new Label("Authors, this is your team space.");
    leftVL.addComponent(missionLab);
    leftVL.setComponentAlignment(missionLab, Alignment.TOP_LEFT);
    missionLab.addStyleName("m-actionplan-mission-title-text");

    ActionPlan ap = ActionPlan.getTL(apId);

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

    leftVL.addComponent(missionContentLab);
    leftVL.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT);
    leftVL.addStyleName("m-actionplan-mission-content-text");

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

    VerticalLayout rightVL = getRightLayout();
    rightVL.setSpacing(true);

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

    rightVL.addComponent(nonAuthorLabel = new Label("This is a space for plan authors to communicate."));
    nonAuthorLabel.setVisible(false);

    rightVL.addComponent(chatEntryComponent);
    chatEntryComponent.setWidth("100%");

    if (isGameMasterOrAdmin) {
        HorizontalLayout hl = new HorizontalLayout();
        rightVL.addComponent(hl);
        hl.setWidth("100%");

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

        viewAllButt = new ToggleLinkButton("View all", "View unhidden only", "m-actionplan-comment-text");
        viewAllButt.setToolTips("Temporarily show all messages, including those marked \"hidden\" (gm)",
                "Temporarily hide messages marked \"hidden\" (gm)");
        viewAllButt.addStyleName("m-actionplan-comments-button");
        viewAllButt.addOnListener(new ViewAllListener());
        viewAllButt.addOffListener(new ViewUnhiddenOnlyListener());
        hl.addComponent(viewAllButt);

        hl.addComponent(sp = new Label());
        sp.setWidth("8px");
    }
    Component comp = createChatScroller(rightVL);
    comp.setWidth("99%");
    rightVL.setExpandRatio(comp, 1.0f);
    comp.setHeight("99%");
    fillChatScrollerTL();
}

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

License:Open Source License

@Override
public void initGui() {
    setSizeUndefined(); // let flow to right
    VerticalLayout leftLay = getLeftLayout();

    leftLay.setSpacing(false);/*w w  w  .  j  av  a  2s .  c o m*/
    leftLay.setMargin(false);

    VerticalLayout flowLay = new VerticalLayout();
    leftLay.addComponent(flowLay);
    flowLay.setSpacing(true);

    Label missionLab = new Label("Authors, this is your workspace.");
    flowLay.addComponent(missionLab);
    flowLay.setComponentAlignment(missionLab, Alignment.TOP_LEFT);
    missionLab.addStyleName("m-actionplan-mission-title-text");

    ActionPlan actPln = ActionPlan.getTL(apId);
    Label missionContentLab;
    if (!isMockup)
        missionContentLab = new HtmlLabel(actPln.getPlanInstructions());
    else {
        Game g = Game.getTL();
        missionContentLab = new HtmlLabel(g.getDefaultActionPlanThePlanText());
    }
    MovePhase ph = MovePhase.getCurrentMovePhaseTL();

    flowLay.addComponent(missionContentLab);
    flowLay.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT);
    flowLay.addStyleName("m-actionplan-mission-content-text");

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

    flowLay = new VerticalLayout();
    flowLay.setWidth("100%");
    rightLay.addComponent(flowLay);
    flowLay.setSpacing(true);
    flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside .m-actionplan-plan-headling { blah:blah;} )

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

    flowLay.addComponent(whoGroup = buildTextAreaGroup(
            ph.getActionPlanWhoIsInvolvedHeader()/*"Who is involved?"*/, whoTA, "Who-is-involved history",
            "Previous values", "Text", "getSubTitleEditHistory", "getSubTitle", "setSubTitleWithHistoryTL"));
    whoGroup.setValueTL(actPln.getSubTitle()); // misnamed since we're calling it it who is involved instead of subtitle

    flowLay.addComponent(whatGroup = buildTextAreaGroup(ph.getActionPlanWhatIsItHeader()/*"What is it?"*/,
            whatTA, "What-is-it history", "Previous values", "Text", "getWhatIsItEditHistory",
            "getWhatIsItText", "setWhatIsItTextWithHistoryTL"));
    whatGroup.setValueTL(actPln.getWhatIsItText());

    flowLay.addComponent(
            whatTakeGroup = buildTextAreaGroup(ph.getActionPlanWhatWillItTakeHeader()/*"What will it take?"*/,
                    whatWillItTakeTA, "What-will-it-take history", "Previous values", "Text",
                    "getWhatTakeEditHistory", "getWhatWillItTakeText", "setWhatWillItTakeTextWithHistoryTL"));
    whatTakeGroup.setValueTL(actPln.getWhatWillItTakeText());

    flowLay.addComponent(
            howGroup = buildTextAreaGroup(ph.getActionPlanHowWillItWorkHeader()/*"How will it work?"*/,
                    howWorkTA, "How-will-it-work history", "Previous values", "Text", "getHowWorkEditHistory",
                    "getHowWillItWorkText", "setHowWillItWorkTextWithHistoryTL"));
    howGroup.setValueTL(actPln.getHowWillItWorkText());

    flowLay.addComponent(howChangeGroup = buildTextAreaGroup(
            ph.getActionPlanHowWillItChangeHeader()/*"How will it change the situation?"*/, howChangeTA,
            "How-will-it-change-things history", "Previous values", "Text", "getHowChangeEditHistory",
            "getHowWillItChangeText", "setHowWillItChangeTextWithHistoryTL"));
    howChangeGroup.setValueTL(actPln.getHowWillItChangeText());
}

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

License:Open Source License

@SuppressWarnings("serial")
public AddVideoDialog() {
    super("Add a Video");
    addStyleName("m-greybackground");

    setClosable(false); // no x in corner
    setWidth("530px");
    setHeight("400px");

    VerticalLayout mainVL = new VerticalLayout();
    mainVL.setSpacing(true);// w  w w. j ava  2 s  . com
    mainVL.setMargin(true);
    mainVL.setSizeUndefined(); // auto size
    mainVL.setWidth("100%");
    setContent(mainVL);

    Label helpLab = new HtmlLabel("Add YouTube videos to your Action Plan this way:"
            + "<OL><LI>Find the video you want at <a href=\"https://www.youtube.com\" target=\""
            + PORTALTARGETWINDOWNAME + "\">www.youtube.com</a>.</LI>"
            + "<LI>Click the \"share\" button below the video screen.</LI>"
            + "<LI>Copy the URL under \"Link to this video:\"</LI>"
            + "<LI>Paste the URL into the field below.</LI>" + "</OL>" + "If you have media that "
            + "has not been uploaded to YouTube, see <a href=\"https://www.youtube.com\" target=\""
            + PORTALTARGETWINDOWNAME + "\">www.youtube.com</a> "
            + "for help with establishing a free account.<br/>");
    helpLab.setWidth("100%");
    mainVL.addComponent(helpLab);

    HorizontalLayout mainHL = new HorizontalLayout();
    mainHL.setMargin(false);
    mainHL.setSpacing(true);
    mainVL.addComponent(mainHL);

    holder = new AbsoluteLayout();
    mainHL.addComponent(holder);
    holder.addStyleName("m-darkgreyborder");
    holder.setWidth("150px");
    holder.setHeight("150px");
    holder.addComponent(new Label("Test video display"), "top:0px;left:0px;");
    VerticalLayout rightVL = new VerticalLayout();
    mainHL.addComponent(rightVL);
    rightVL.setMargin(false);
    rightVL.setSpacing(true);
    rightVL.addComponent(new Label("YouTube video address"));

    HorizontalLayout tfHL = new HorizontalLayout();
    tfHL.setSpacing(true);
    rightVL.addComponent(tfHL);
    addrTf = new TextField();
    tfHL.addComponent(addrTf);
    addrTf.setColumns(21);
    tfHL.addComponent(testButt = new Button("Test"));

    rightVL.addComponent(new Label("Using the test button will set the"));
    rightVL.addComponent(new Label("default title and description."));

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

    HorizontalLayout bottomHL = new HorizontalLayout();
    rightVL.addComponent(bottomHL);
    rightVL.setComponentAlignment(bottomHL, Alignment.TOP_RIGHT);
    bottomHL.setSpacing(true);
    bottomHL.setWidth("100%");
    Label spacer;
    bottomHL.addComponent(spacer = new Label());
    spacer.setWidth("100%");
    bottomHL.setExpandRatio(spacer, 1.0f);

    bottomHL.addComponent(cancelButt = new Button("Cancel"));
    bottomHL.addComponent(submitButt = new Button("Add"));
    testButt.addClickListener(new TestVidHandler());

    submitButt.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(AddVideoDialog.this);
            if (closer != null)
                closer.windowClose(null);
        }
    });

    cancelButt.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            media = null;
            UI.getCurrent().removeWindow(AddVideoDialog.this);
            if (closer != null)
                closer.windowClose(null);
        }
    });
}

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

License:Open Source License

@SuppressWarnings("serial")
public AuthorThisPlanPopup(Object apPlnId) {
    super(null);//from  ww  w. j av a2 s  .c  o  m
    super.initGui();
    this.apId = apPlnId;

    setListener(this);

    setTitleString("Author This Plan");

    contentVLayout.setSpacing(true);

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

    contentVLayout.addComponent(lab = new Label("Become an author of this plan?"));
    lab.addStyleName("m-dialog-text");
    lab.setWidthUndefined();
    contentVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

    HorizontalLayout buttHL = new HorizontalLayout();
    contentVLayout.addComponent(buttHL);
    contentVLayout.setComponentAlignment(buttHL, Alignment.MIDDLE_CENTER);
    buttHL.setSpacing(true);

    buttHL.addComponent(okButt = new Button("Yes, I'm in."));
    buttHL.addComponent(noButt = new Button("I'll pass."));
    noButt.addClickListener(new ClickListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        @HibernateUpdate
        @HibernateUserUpdate
        public void buttonClick(ClickEvent event) {
            HSess.init();
            User me = Mmowgli2UI.getGlobals().getUserTL();
            ActionPlan ap = ActionPlan.getTL(apId);

            if (usrContainsByIds(ap.getInvitees(), me))
                ap.removeInvitee(me);
            if (!usrContainsByIds(ap.getDeclinees(), me))
                ap.getDeclinees().add(me);
            ActionPlan.updateTL(ap);

            if (apContainsByIds(me.getActionPlansInvited(), ap))
                me.getActionPlansInvited().remove(ap);

            User.updateTL(me);
            GameEventLogger.logActionPlanInvitationDeclinedTL(ap, me.getUserName());
            HSess.close();

            AuthorThisPlanPopup.this.buttonClick(event);
        }
    });

    okButt.addClickListener(new ClickListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        @HibernateUpdate
        @HibernateUserUpdate
        public void buttonClick(ClickEvent event) {
            HSess.init();
            MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals();
            User me = globs.getUserTL(); //feb refactor DBGet.getUserFreshTL(globs.getUserID());
            ActionPlan thisAp = ActionPlan.getTL(apId);

            Set<ActionPlan> myInvites = me.getActionPlansInvited();
            Set<ActionPlan> myAuthored = me.getActionPlansAuthored();

            boolean usrNeedsUpdate = false;
            if (apContainsByIds(myInvites, thisAp)) {
                //System.out.println("AP-AUTHOR_DEBUG:  removing aplan from users invite list, AuthorThisPlanPopup.128");           
                myInvites.remove(thisAp);
                // Jam it in here
                //ScoreManager.userJoinsActionPlan(me);  // replace by...
                globs.getScoreManager().actionPlanUserJoinsTL(thisAp, me);
                usrNeedsUpdate = true;
            }
            if (!apContainsByIds(myAuthored, thisAp)) {// if already there, causes exception 
                //System.out.println("AP-AUTHOR_DEBUG:  adding aplan to users authored list, AuthorThisPlanPopup.133");           
                myAuthored.add(thisAp);
                usrNeedsUpdate = true;
            }
            if (usrNeedsUpdate) {
                // User update here
                User.updateTL(me);
            }

            boolean apNeedsUpdate = false;
            if (usrContainsByIds(thisAp.getInvitees(), me)) {
                //System.out.println("AP-AUTHOR_DEBUG:  removing user from ap invite list, AuthorThisPlanPopup.146");                     
                thisAp.removeInvitee(me); //apInvitees.remove(me);
                apNeedsUpdate = true;
            }
            if (!usrContainsByIds(thisAp.getAuthors(), me)) {
                //System.out.println("AP-AUTHOR_DEBUG:  adding user to ap authors list, AuthorThisPlanPopup.151");
                thisAp.addAuthor(me); //apAuthors.add(me);
                apNeedsUpdate = true;
            }
            if (apNeedsUpdate)
                ActionPlan.updateTL(thisAp);

            GameEventLogger.logActionPlanInvitationAcceptedTL(thisAp, me.getUserName());

            HSess.close();

            AuthorThisPlanPopup.this.buttonClick(event); // sets up its own session
            return;
        }
    });
}

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

License:Open Source License

@SuppressWarnings("serial")
@HibernateSessionThreadLocalConstructor//  w w  w  . java2 s  .  c o  m
public HelpWantedDialog(final Object aplnId, boolean interested) {
    setCaption(interested ? "Express Interest in Action Plan" : "Offer Assistance with Action Plan");
    setModal(true);
    setSizeUndefined();
    setWidth("500px");
    setHeight("550px");

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

    StringBuilder sb = new StringBuilder();

    ActionPlan ap = ActionPlan.getTL(aplnId);
    String s = ap.getHelpWanted();

    if (s != null) {
        vLay.addComponent(new Label(msg1));
        Label helpWantedLab = new Label(s);
        helpWantedLab.addStyleName("m-helpWantedLabel");
        helpWantedLab.setWidth("100%");
        vLay.addComponent(helpWantedLab);
    }

    vLay.addComponent(new Label(msg2));
    final TextArea toTA = new TextArea("To");
    toTA.addStyleName("m-textareaboldcaption");
    toTA.setWidth("100%");
    toTA.setRows(1);
    toTA.setNullRepresentation("");
    toTA.setValue(getAuthors(sb, ap));
    vLay.addComponent(toTA);

    final TextArea ccTA = new TextArea("CC");
    ccTA.addStyleName("m-textareaboldcaption");
    ccTA.setWidth("100%");
    ccTA.setRows(1);
    ccTA.setNullRepresentation("");

    PagesData pd = new PagesData();
    ccTA.setValue(pd.gettroubleMailto());

    vLay.addComponent(ccTA);

    final TextArea subjTA = new TextArea("Subject");
    subjTA.addStyleName("m-textareaboldcaption");
    subjTA.setWidth("100%");
    subjTA.setRows(2);
    subjTA.setNullRepresentation("");
    sb.setLength(0);
    sb.append("My interest in Action Plan ");
    sb.append(ap.getId());
    sb.append(", \"");
    sb.append(ap.getTitle());
    sb.append('"');
    subjTA.setValue(sb.toString());
    vLay.addComponent(subjTA);

    final TextArea msgTA = new TextArea("Message");
    msgTA.addStyleName("m-textareaboldcaption");
    msgTA.setWidth("100%");
    msgTA.setHeight("100%");
    msgTA.setNullRepresentation("");
    vLay.addComponent(msgTA);
    vLay.setExpandRatio(msgTA, 1.0f);

    HorizontalLayout buttLay = new HorizontalLayout();
    vLay.addComponent(buttLay);
    buttLay.setSpacing(true);
    buttLay.setWidth("100%");
    Label sp;
    buttLay.addComponent(sp = new Label());
    sp.setHeight("1px");
    buttLay.setExpandRatio(sp, 1.0f);

    Button canButt = new Button("Cancel");
    buttLay.addComponent(canButt);

    Button sendButt = new Button("Send to authors");
    buttLay.addComponent(sendButt);

    canButt.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(HelpWantedDialog.this);
        }
    });

    sendButt.addClickListener(new ClickListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void buttonClick(ClickEvent event) {
            Object tos = toTA.getValue();
            if (tos == null || tos.toString().length() <= 0) {
                Notification.show("No recipients", Notification.Type.ERROR_MESSAGE);
                return;
            }
            Object cc = ccTA.getValue();
            if (cc == null || cc.toString().length() <= 0)
                cc = null;

            Object msg = msgTA.getValue();
            if (msg == null || msg.toString().length() <= 0) {
                Notification.show("No Message", Notification.Type.ERROR_MESSAGE);
                return;
            }
            Object subj = subjTA.getValue();
            if (subj == null)
                subj = "";

            HSess.init();

            List<User> authors = parseAuthorsTL(tos.toString().trim());
            MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals();
            MailManager mmgr = AppMaster.instance().getMailManager();
            User me = globs.getUserTL();
            for (User u : authors) {
                mmgr.mailToUserTL(me.getId(), u.getId(), subj.toString(), msg.toString());
            }

            if (cc == null)
                mmgr.mailToUserTL(me.getId(), me.getId(), "(CC:)" + subj.toString(), msg.toString());
            else
                mmgr.mailToUserTL(me.getId(), me.getId(), subj.toString(), msg.toString(), cc.toString(),
                        MailManager.Channel.BOTH); // the cc is an email, not a user name

            UI.getCurrent().removeWindow(HelpWantedDialog.this);
            Notification.show("Message(s) sent", Notification.Type.HUMANIZED_MESSAGE); // fixed 21 Jan 2015

            HSess.close();
        }
    });
}

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

License:Open Source License

@HibernateSessionThreadLocalConstructor
@SuppressWarnings("serial")
public RfeDialog(Object aplnId) {
    this.apId = aplnId;

    setCaption("Request for Expertise");
    setModal(true);//from   www . java2s. c  om
    setSizeUndefined();
    setWidth("500px");
    setHeight("400px");

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

    IDButton searchButt = new IDButton("Option 1: Search for players with needed expertise", SEARCHCLICK, null);
    searchButt.enableAction(false); // do manually
    searchButt.addClickListener(new SearchListener());
    vLay.addComponent(searchButt);

    VerticalLayout nuts = new VerticalLayout();
    vLay.addComponent(nuts);
    nuts.setSizeFull();
    vLay.setExpandRatio(nuts, 1.0f);
    Label lab;
    /*vLay*/nuts.addComponent(lab = new Label("Option 2: Post help-wanted notice to action plan"));
    lab.addStyleName("m-font-bold11");

    final VerticalLayout helpWantedPan = new VerticalLayout();
    /*vLay*/nuts.addComponent(helpWantedPan);
    helpWantedPan.addStyleName("m-greyborder");
    helpWantedPan.setWidth("99%");
    helpWantedPan.setHeight("99%");
    helpWantedPan.setSpacing(true);
    helpWantedPan.setMargin(true);
    /*vLay*/nuts.setExpandRatio(helpWantedPan, 1.0f);

    helpWantedTA = new TextArea("Current posting");
    helpWantedTA.setWidth("100%");
    helpWantedTA.setHeight("100%");
    helpWantedTA.setNullRepresentation("");
    helpWantedPan.addComponent(helpWantedTA);
    helpWantedPan.setExpandRatio(helpWantedTA, 1.0f);

    HorizontalLayout buttLay = new HorizontalLayout();
    helpWantedPan.addComponent(buttLay);
    buttLay.setSpacing(true);
    buttLay.setWidth("100%");

    buttLay.addComponent(lab = new Label());
    lab.setWidth("10px");

    clearButt = new Button("Clear");
    buttLay.addComponent(clearButt);
    clearButt.addClickListener(clearButtLis = new ClickListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void buttonClick(ClickEvent event) {
            HSess.init();
            ActionPlan ap = ActionPlan.getTL(apId);
            helpWantedTA.setValue(null);
            if (null != ap.getHelpWanted()) {
                ap.setHelpWanted(null);
                ActionPlan.updateTL(ap);
                Notification notif = new Notification("Cleared");
                notif.setDelayMsec(3000);
                notif.show(Page.getCurrent());
                GameEventLogger.logHelpWantedTL(ap);
                notifyAuthorsOfChangeTL(ap);
            }
            HSess.close();
        }
    });

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

    postButt = new Button("Post");
    buttLay.addComponent(postButt);
    postButt.addClickListener(new ClickListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void buttonClick(ClickEvent event) {
            Object val = helpWantedTA.getValue();
            if (val == null || val.toString().length() <= 0) {
                clearButtLis.buttonClick(event);
                return;
            }

            HSess.init();
            String s = val.toString();
            ActionPlan ap = ActionPlan.getTL(apId);
            if (s == null ? ap.getHelpWanted() != null : !s.equals(ap.getHelpWanted())) {
                ap.setHelpWanted(s);
                ActionPlan.updateTL(ap);
                Notification notif = new Notification("Posted");
                notif.setDelayMsec(3000);
                notif.show(Page.getCurrent());
                GameEventLogger.logHelpWantedTL(ap);
                notifyAuthorsOfChangeTL(ap);
            }
            HSess.close();
        }
    });
    buttLay.addComponent(lab = new Label());
    lab.setWidth("10px");

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

    IDButton troubleButt = new IDButton("Option 3: Post Trouble Report", POSTTROUBLECLICK, null);
    troubleButt.enableAction(false); // managed manually
    troubleButt.addClickListener(new TroubleListener());
    vLay.addComponent(troubleButt);

    Button closeButt = new Button("Close");
    vLay.addComponent(closeButt);
    closeButt.addClickListener(new CloseListener());

    vLay.setComponentAlignment(closeButt, Alignment.MIDDLE_RIGHT);

    ActionPlan ap = ActionPlan.getTL(apId);
    String s = ap.getHelpWanted();
    helpWantedTA.setValue(s);
}

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

License:Open Source License

protected void addSeparator(GridLayout grid, int row) {
    Label lab;
    grid.addComponent(lab = new Label(), 0, row, 2, row);
    lab.setHeight("5px");
    lab.addStyleName("m-greybackground");
}