Example usage for com.vaadin.ui Embedded Embedded

List of usage examples for com.vaadin.ui Embedded Embedded

Introduction

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

Prototype

public Embedded(String caption, Resource source) 

Source Link

Document

Creates a new Embedded object whose contents is loaded from given resource.

Usage

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

License:Open Source License

@Override
Embedded getImage() {//from  w  w w  . j a  v  a 2s . co m
    ClassResource cr = new ClassResource("/edu/nps/moves/mmowgli/modules/administration/actionplantexts.png");
    Embedded e = new Embedded(null, cr);
    return e;
}

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

License:Open Source License

@Override
Embedded getImage() {/*w  ww. ja v  a 2s . c o m*/
    ClassResource cr = new ClassResource("/edu/nps/moves/mmowgli/modules/administration/call2action.png");
    Embedded e = new Embedded(null, cr);
    return e;
}

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

License:Open Source License

@Override
Embedded getImage() {/*from   w  ww .  j  a v a  2 s  .c  o  m*/
    ClassResource cr = new ClassResource("/edu/nps/moves/mmowgli/modules/administration/cardplay.png");
    Embedded e = new Embedded(null, cr);
    return e;
}

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

License:Open Source License

@Override
Embedded getImage() {//  w w w .  jav a2 s . c  o m
    ClassResource cr = new ClassResource("/edu/nps/moves/mmowgli/modules/administration/welcomeshot.png");
    Embedded e = new Embedded(null, cr);
    return e;
}

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);/*from  www.  jav a 2 s.  c om*/
    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);
}

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

License:Open Source License

@Override
public void initGui() {
    Card c = Card.getTL(cardId);/*from  w  w  w . ja  va2  s .co  m*/
    String tooltip = c.getText();

    User auth = c.getAuthor();

    Label lab = new Label(dateForm.format(c.getCreationDate()));
    lab.setWidth(6.0f, Unit.EM);
    addComponent(lab);
    setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    lab.addStyleName("m-cursor-pointer");
    lab.setDescription(tooltip);

    addComponent(lab = new Label(c.getCardType().getTitle()));
    lab.setWidth(5.0f, Unit.EM);
    setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    lab.addStyleName("m-cursor-pointer");
    lab.setDescription(tooltip);

    MediaLocator mLoc = Mmowgli2UI.getGlobals().getMediaLocator();
    Embedded emb = new Embedded(null, mLoc.getCardDot(c.getCardType()));
    emb.setWidth("19px");
    emb.setHeight("15px");
    addComponent(emb);
    setComponentAlignment(emb, Alignment.MIDDLE_LEFT);
    emb.addStyleName("m-cursor-pointer");
    emb.setDescription(tooltip);

    addComponent(lab = new Label(c.getText()));
    lab.setHeight(1.0f, Unit.EM);
    ;
    setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    setExpandRatio(lab, 1.0f); // all the extra
    lab.addStyleName("m-cursor-pointer");
    lab.setDescription(tooltip);

    if (auth.getAvatar() != null) {
        avatar = new Embedded(null, mLoc.locate(auth.getAvatar().getMedia(), 32));
        avatar.setWidth("24px");
        avatar.setHeight("24px");
        addComponent(avatar);
        setComponentAlignment(avatar, Alignment.MIDDLE_LEFT);
        avatar.addStyleName("m-cursor-pointer");
        avatar.setDescription(tooltip);
    }
    IDButton uButt = new IDButton(c.getAuthorName(), SHOWUSERPROFILECLICK, c.getAuthor().getId());
    uButt.addStyleName(BaseTheme.BUTTON_LINK);
    uButt.setWidth(8.0f, Unit.EM);
    addComponent(uButt);
    setComponentAlignment(uButt, Alignment.MIDDLE_LEFT);
    uButt.setDescription(tooltip);
}

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

License:Open Source License

public void initGuiTL() {
    setWidth(APPLICATION_SCREEN_WIDTH);/*  w  w w .  j a v a 2s .c o m*/
    setHeight(IDEADASHBOARD_H);
    MediaLocator medLoc = Mmowgli2UI.getGlobals().getMediaLocator();

    addComponent(medLoc.getIdeaDashboardTitle(), "top:15px;left:20px");

    AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master
    mainAbsLay.setWidth(APPLICATION_SCREEN_WIDTH);
    mainAbsLay.setHeight(IDEADASHBOARD_H);
    addComponent(mainAbsLay, IDEADASHBOARD_OFFSET_POS);

    Embedded backgroundImage = new Embedded(null, medLoc.getIdeaDashboardBackground());
    backgroundImage.setWidth(IDEADASHBOARD_BGND_W);
    backgroundImage.setHeight(IDEADASHBOARD_BGND_H);
    mainAbsLay.addComponent(backgroundImage, "top:0px;left:0px");

    // stack the pages
    addComponent(recentTab, IDEADASHBOARD_TABCONTENT_POS);
    recentTab.initGui();

    addComponent(innovateTab, IDEADASHBOARD_TABCONTENT_POS);
    innovateTab.initGui();
    innovateTab.setVisible(false);

    addComponent(defendTab, IDEADASHBOARD_TABCONTENT_POS);
    defendTab.initGui();
    defendTab.setVisible(false);

    addComponent(superActiveTab, IDEADASHBOARD_TABCONTENT_POS);
    superActiveTab.initGui();
    superActiveTab.setVisible(false);

    // add the tab butts
    TabClickHandler tabHndlr = new TabClickHandler();

    HorizontalLayout tabHL = new HorizontalLayout();
    tabHL.setSpacing(false);

    String gameTitleLC = Game.getTL().getTitle().toLowerCase();
    makeBlackLabelOverlays(gameTitleLC); // put the card type names
    styleBlackTabs(gameTitleLC, tabHL);
    addComponent(tabHL, "top:60px;left:7px");

    Label sp;
    tabHL.addComponent(sp = new Label());
    sp.setWidth("9px");

    recentButt.setStyleName("m-ideaDashboardMostRecentTab");
    recentButt.addStyleName("m-ideaDashboardTab1"); // marker for testing
    recentButt.addClickListener(tabHndlr);
    tabHL.addComponent(recentButt);

    styleWhiteInnovateTab(gameTitleLC, tabHL, tabHndlr, CardType.getCurrentPositiveIdeaCardTypeTL());
    styleWhiteDefendTab(gameTitleLC, tabHL, tabHndlr, CardType.getCurrentNegativeIdeaCardTypeTL());

    superActiveButt.setStyleName("m-ideaDashboardSuperActiveTab");
    superActiveButt.addStyleName("m-ideaDashboardTab4"); // marker for testing
    superActiveButt.addClickListener(tabHndlr);
    tabHL.addComponent(superActiveButt);
    superActiveButt.addStyleName("m-transparent-background"); // invisible

}

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

License:Open Source License

private void fillPanelTL() {
    @SuppressWarnings("unchecked")
    List<AwardType> typs = (List<AwardType>) HSess.get().createCriteria(AwardType.class).list();
    gridList = new ArrayList<AwardType>(typs.size());
    gridList.addAll(typs);/*w ww . jav  a  2  s .com*/
    gridLayout.removeAllComponents();
    gridLayout.setRows(typs.size() + 1);
    gridLayout.setColumns(3);
    gridLayout.setSpacing(true);
    gridLayout.setColumnExpandRatio(1, 0.5f);
    gridLayout.setColumnExpandRatio(2, 0.5f);

    gridLayout.addComponent(new HtmlLabel("<b>Icon</b>"));
    gridLayout.addComponent(new HtmlLabel("<b>Name</b>"));
    gridLayout.addComponent(new HtmlLabel("<b>Description</b>"));

    MediaLocator mediaLoc = Mmowgli2UI.getGlobals().getMediaLocator();
    for (AwardType at : typs) {
        Embedded emb = new Embedded(null, mediaLoc.locate(at.getIcon55x55()));
        emb.addStyleName("m-greyborder3");
        gridLayout.addComponent(emb);
        TextArea tf;
        gridLayout.addComponent(tf = makeTa(at.getName()));
        gridLayout.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);
        gridLayout.addComponent(tf = makeTa(at.getDescription()));
        gridLayout.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);
    }
}

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

License:Open Source License

@HibernateUserRead
private void fillPanelTL(User u) {
    @SuppressWarnings("unchecked")
    List<AwardType> typs = (List<AwardType>) HSess.get().createCriteria(AwardType.class).list();
    gridList = new ArrayList<AwardType>(typs.size());
    gridList.addAll(typs);//w  ww . j ava2s .  c om
    gridLayout.removeAllComponents();
    gridLayout.setRows(typs.size());
    gridLayout.setColumns(4);
    gridLayout.setSpacing(true);
    gridLayout.setColumnExpandRatio(2, 0.5f);
    gridLayout.setColumnExpandRatio(3, 0.5f);

    Set<Award> uAwards = u.getAwards();
    MediaLocator mediaLoc = Mmowgli2UI.getGlobals().getMediaLocator();
    for (AwardType at : typs) {
        CheckBox cb;
        boolean checked = hasBeenAwarded(uAwards, at);
        gridLayout.addComponent(cb = new CheckBox());
        cb.setValue(checked);
        gridLayout.setComponentAlignment(cb, Alignment.MIDDLE_CENTER);
        Embedded emb = new Embedded(null, mediaLoc.locate(at.getIcon55x55()));
        emb.addStyleName("m-greyborder3");
        gridLayout.addComponent(emb);
        Label lab;
        gridLayout.addComponent(lab = new Label(at.getName()));
        gridLayout.setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
        gridLayout.addComponent(lab = new Label(at.getDescription()));
        gridLayout.setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    }
}

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

License:Open Source License

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