Example usage for com.vaadin.ui VerticalLayout setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

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  ava2  s  .c  o  m
    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

private Component createChatScroller(VerticalLayout cont) {
    chatScroller = new Panel();
    cont.addComponent(chatScroller);/*from   ww w.  j ava2 s  . com*/
    VerticalLayout vl = new VerticalLayout();
    chatScroller.setContent(vl);
    vl.addStyleName("m-padding2");
    vl.setWidth("99%"); // the padding screws up the panel's width calc
    return chatScroller;
}

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);/*ww w  .  java 2 s. 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.ActionPlanPageTabVideos.java

License:Open Source License

@Override
public void initGui() {
    setSizeUndefined();/*from ww w  .j  a v a  2s .  c  om*/
    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 videos!");
    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.getVideosInstructions());
    else {
        Game g = Game.getTL();
        missionContentLab = new HtmlLabel(g.getDefaultActionPlanVideosText());
    }
    flowLay.addComponent(missionContentLab);
    flowLay.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT);
    flowLay.addStyleName("m-actionplan-mission-content-text");

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

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

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

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

    rightLay.addComponent(rightScroller);
    ;
    fillWithVideosTL();
}

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

License:Open Source License

@SuppressWarnings("serial")
@HibernateSessionThreadLocalConstructor//from   ww  w . ja  v  a2s .c  o  m
public AddImageDialog(Object apId) {
    super("Add an Image");

    addStyleName("m-greybackground");

    setClosable(false); // no x in corner

    VerticalLayout mainVL = new VerticalLayout();
    mainVL.setSpacing(true);
    mainVL.setMargin(true);
    mainVL.setSizeUndefined(); // auto size
    setContent(mainVL);

    mainHL = new HorizontalLayout();
    mainVL.addComponent(mainHL);

    mainHL.setSpacing(true);

    holder = new AbsoluteLayout();
    mainHL.addComponent(holder);
    holder.setWidth("150px");
    holder.setHeight("150px");
    holder.addStyleName("m-darkgreyborder");

    VerticalLayout rightVL = new VerticalLayout();
    mainHL.addComponent(rightVL);

    fromWebCheck = new CheckBox();
    fromWebCheck.addStyleName("v-radiobutton");
    fromWebCheck.setValue(true);
    fromWebCheck.setImmediate(true);
    fromWebCheck.addValueChangeListener(new RadioListener(fromWebCheck));

    HorizontalLayout frWebHL = new HorizontalLayout();
    rightVL.addComponent(frWebHL);
    frWebHL.addComponent(fromWebCheck);
    VerticalLayout frWebVL = new VerticalLayout();
    frWebVL.setMargin(true);
    frWebVL.addStyleName("m-greyborder");
    frWebHL.addComponent(frWebVL);
    frWebVL.setWidth("370px");

    frWebVL.addComponent(new Label("From the web:"));
    HorizontalLayout webHL = new HorizontalLayout();
    webHL.setSpacing(true);
    frWebVL.addComponent(webHL);
    webHL.addComponent(webUrl = new TextField());
    webUrl.setColumns(21);
    webHL.addComponent(testButt = new Button("Test"));
    Label sp;
    webHL.addComponent(sp = new Label());
    sp.setWidth("1px");
    webHL.setExpandRatio(sp, 1.0f);

    fromDeskCheck = new CheckBox();
    fromDeskCheck.addStyleName("v-radiobutton");
    fromDeskCheck.setValue(false);
    fromDeskCheck.addValueChangeListener(new RadioListener(fromDeskCheck));
    fromDeskCheck.setImmediate(true);
    HorizontalLayout dtHL = new HorizontalLayout();
    rightVL.addComponent(dtHL);
    dtHL.addComponent(fromDeskCheck);

    VerticalLayout dtopVL = new VerticalLayout();
    dtopVL.setMargin(true);
    dtopVL.addStyleName("m-greyborder");
    dtHL.addComponent(dtopVL);
    dtopVL.setWidth("370px");
    dtopVL.addComponent(new Label("From your desktop:"));
    HorizontalLayout localHL = new HorizontalLayout();
    localHL.setSpacing(true);
    dtopVL.addComponent(localHL);
    localHL.addComponent(localTF = new TextField());
    localTF.setColumns(21);
    localHL.addComponent(uploadWidget = new Upload());
    panel = new UploadStatus(uploadWidget);
    uploadWidget.setButtonCaption("Browse");

    File tempDir = Files.createTempDir();
    tempDir.deleteOnExit();
    handler = new UploadHandler(uploadWidget, panel, tempDir.getAbsolutePath());
    uploadWidget.setReceiver(handler);
    uploadWidget.setImmediate(true);
    panel.setWidth("100%");
    dtopVL.addComponent(panel);
    dtopVL.setComponentAlignment(panel, Alignment.TOP_CENTER);

    HorizontalLayout bottomHL = new HorizontalLayout();
    mainVL.addComponent(bottomHL);
    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"));
    setDisabledFields();

    uploadWidget.addFinishedListener(new FinishedListener() {
        @Override
        public void uploadFinished(FinishedEvent event) {
            Object key = HSess.checkInit();
            System.out.println("AddImageDialog.uploadFinished()");
            String fpath = handler.getFullUploadedPath();
            if (fpath != null) { // error of some kind if null 
                if (!MalwareChecker.isFileVirusFree(fpath)) {
                    panel.state.setValue("<span style='color:red;'>Failed malware check</span>");
                    fpath = null;
                    localTF.setValue("");
                    HSess.checkClose(key);
                    return;
                }

                File f = new File(fpath);
                f.deleteOnExit();

                try {
                    MediaImage mediaImage = InstallImageDialog.putFileImageIntoDbTL(f, f.getName(),
                            event.getMIMEType());
                    f.delete();
                    media = mediaImage.media;
                    image = mediaImage.image;
                    media.setCaption(null);
                    Resource res = Mmowgli2UI.getGlobals().getMediaLocator().locate(media);
                    setupEmbeddedImageThumbnail(res, media);
                    localTF.setValue(event.getFilename());
                } catch (IOException ex) {
                    Notification.show("Error loading image", Notification.Type.ERROR_MESSAGE);
                    MSysOut.println(ERROR_LOGS, "Error in AddImageDialog loading image: "
                            + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage());
                }
            }
            HSess.checkClose(key);
        }
    });

    testButt.addClickListener(new testWebImageHandler());

    submitButt.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (fromWebCheck.getValue()) {
                if (checkBadUrl(webUrl.getValue(), event.getButton()))
                    return;
            }
            UI.getCurrent().removeWindow(AddImageDialog.this);
            if (closer != null)
                closer.windowClose(null);
        }
    });
    cancelButt.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            Object key = HSess.checkInit();
            if (media != null) {
                Media.deleteTL(media);
                media = null;
            }
            if (image != null) {
                Image.deleteTL(image);
                image = null;
            }
            uploadWidget.interruptUpload();
            UI.getCurrent().removeWindow(AddImageDialog.this);
            if (closer != null)
                closer.windowClose(null);

            HSess.checkClose(key);
        }
    });

    webUrl.focus();
}

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);/*from  w w  w  . j  a  v a  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.RfeDialog.java

License:Open Source License

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

    setCaption("Request for Expertise");
    setModal(true);/*from w w  w  .  j  a  va  2 s .  c  o m*/
    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.SubCardsGameDesignPanel.java

License:Open Source License

private Component renderFields(CardTypeFields fields, NativeSelect combo, String name) {
    VerticalLayout topPan = new VerticalLayout();
    topPan.setWidth("98%");
    topPan.addStyleName("m-greyborder3");
    Label lab;//w w  w.  j  a  v  a  2s  . c  o m
    topPan.addComponent(lab = new Label());
    lab.setHeight("18px");

    HorizontalLayout topHL = new HorizontalLayout();
    topHL.setSpacing(true);
    ;
    topHL.addComponent(lab = new Label());
    lab.setWidth("1px");
    topHL.setExpandRatio(lab, 0.5f);
    topHL.addComponent(lab = new HtmlLabel("<b>" + name + "</b>"));
    lab.setSizeUndefined();

    topHL.addComponent(combo);

    Button newTypeButt;
    topHL.addComponent(newTypeButt = new NativeButton("Define new type"));
    newTypeButt.addStyleName(Runo.BUTTON_SMALL);

    newTypeButt.setReadOnly(globs.readOnlyCheck(false));
    newTypeButt.setEnabled(!newTypeButt.isReadOnly());
    if (!newTypeButt.isReadOnly())
        newTypeButt.addClickListener(new NewTypeListener(fields.typeOrdinal));

    topHL.addComponent(lab = new Label());
    lab.setWidth("1px");
    topHL.setExpandRatio(lab, 0.5f);

    topPan.addComponent(topHL);
    topHL.setWidth("100%");

    topPan.addComponent(fields);
    fields.setWidth("100%");
    return topPan;
}

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

License:Open Source License

private Component renderFields(CardTypeFields fields, NativeSelect combo, String name, Label editWarningLab) {
    VerticalLayout topPan = new VerticalLayout();
    topPan.setWidth("98%");
    topPan.addStyleName("m-greyborder3");
    Label lab;/*from   ww w  .j  a  v  a 2  s  .  co m*/
    topPan.addComponent(lab = new Label());
    lab.setHeight("18px");

    HorizontalLayout topHL = new HorizontalLayout();
    topHL.setSpacing(true);
    ;
    topHL.addComponent(lab = new Label());
    lab.setWidth("1px");
    topHL.setExpandRatio(lab, 0.5f);
    topHL.addComponent(lab = new HtmlLabel("<b>" + name + "</b>"));
    lab.setSizeUndefined();

    topHL.addComponent(combo);

    Button newTypeButt;
    topHL.addComponent(newTypeButt = new NativeButton("Define new top-level type"));
    newTypeButt.addStyleName(Runo.BUTTON_SMALL);
    newTypeButt.setReadOnly(globals.readOnlyCheck(false));
    newTypeButt.setEnabled(!newTypeButt.isReadOnly());
    if (!newTypeButt.isReadOnly())
        newTypeButt.addClickListener(new NewCardClassListener(fields.cardClass));

    topHL.addComponent(lab = new Label());
    lab.setWidth("1px");
    topHL.setExpandRatio(lab, 0.5f);

    topPan.addComponent(topHL);
    topHL.setWidth("100%");

    addComponent(editWarningLab);

    topPan.addComponent(fields);
    fields.setWidth("100%");
    return topPan;
}

From source file:edu.nps.moves.mmowgli.modules.cards.CallToActionPage.java

License:Open Source License

public void initGui() {
    Object sessKey = HSess.checkInit();
    Label spacer = new Label();
    spacer.setWidth(CALLTOACTION_HOR_OFFSET_STR);
    addComponent(spacer);//w  ww  .java  2 s . c o m
    VerticalLayout mainVl = new VerticalLayout();
    addComponent(mainVl);
    mainVl.setSpacing(true);
    mainVl.setWidth("100%");

    MovePhase phase = MovePhase.getCurrentMovePhaseTL();
    String sum = phase.getCallToActionBriefingSummary();
    String tx = phase.getCallToActionBriefingText();
    Media v = phase.getCallToActionBriefingVideo();

    Embedded headerImg = new Embedded(null, Mmowgli2UI.getGlobals().mediaLocator().getCallToActionBang());
    headerImg.setDescription("Review motivation and purpose of this game");

    NativeButton needButt = new NativeButton();
    needButt.setStyleName("m-weNeedYourHelpButton");

    vidPan = new VideoWithRightTextPanel(v, headerImg, sum, tx, needButt); // needImg);
    vidPan.initGui();
    mainVl.addComponent(vidPan);

    String playCardString = Game.getTL().getCurrentMove().getCurrentMovePhase().getPlayACardTitle();
    NativeButton butt;
    if (!mockupOnly)
        butt = new IDNativeButton(playCardString, MmowgliEvent.PLAYIDEACLICK);
    else
        butt = new NativeButton(playCardString); // no listener
    butt.addStyleName("borderless");
    butt.addStyleName("m-calltoaction-playprompt");
    butt.setDescription("View existing cards and play new ones");
    mainVl.addComponent(butt);
    mainVl.setComponentAlignment(butt, Alignment.MIDDLE_CENTER);
    HSess.checkClose(sessKey);
}