List of usage examples for com.vaadin.ui Flash setHeight
@Override public void setHeight(float height, Unit unit)
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.co m 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.modules.actionplans.MediaPanel.java
License:Open Source License
private Component buildPlayer(Media m) { try {/*from ww w . jav a 2 s . c om*/ Flash ytp = new Flash(); ytp.setSource(new ExternalResource("https://www.youtube.com/v/" + m.getUrl())); ytp.setParameter("allowFullScreen", "true"); ytp.setParameter("showRelated", "false"); ytp.setWidth(150.0f, Unit.PIXELS); ytp.setHeight(150.0f, Unit.PIXELS); ytp.setWidth(WIDTH); ytp.setHeight(PLAYER_HEIGHT); placeHolder = new Label("Mmowgli Video"); placeHolder.setWidth(WIDTH); placeHolder.setHeight(PLAYER_HEIGHT); return ytp; } catch (Exception e) { return new Label("Wrong media type"); } }