List of usage examples for com.vaadin.ui Embedded setWidth
@Override public void setWidth(String width)
From source file:com.scsb.crpro.MessageBox.java
License:Apache License
/** * Similar to {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)}, * but the message component is defined explicitly. The component can be even a composite * of a layout manager and manager further Vaadin components. * /*from w w w .j ava 2 s . c om*/ * @param messageComponent a Vaadin component */ public MessageBox(String dialogWidth, String dialogHeight, String dialogCaption, Icon dialogIcon, Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) { super(); setResizable(false); setClosable(false); setSizeUndefined(); setWidth(dialogWidth); //setHeight(dialogHeight); setCaption(dialogCaption); GridLayout mainLayout = new GridLayout(2, 2); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setSizeUndefined(); mainLayout.setWidth(GRID_DEFAULT_WIDTH1); // Add Content messageComponent.setSizeUndefined(); messageComponent.setWidth(GRID_DEFAULT_WIDTH2); if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) { mainLayout.addComponent(messageComponent, 0, 0, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(0, 1.0f); } else { mainLayout.addComponent(messageComponent, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, 1.0f); Embedded icon = null; switch (dialogIcon) { case QUESTION: icon = new Embedded(null, new ThemeResource("images/question.png")); break; case INFO: icon = new Embedded(null, new ThemeResource("images/info.png")); break; case WARN: icon = new Embedded(null, new ThemeResource("images/warn.png")); break; case ERROR: icon = new Embedded(null, new ThemeResource("images/error.png")); break; } mainLayout.addComponent(icon, 0, 0); icon.setWidth(ICON_DEFAULT_SIZE); icon.setHeight(ICON_DEFAULT_SIZE); } // Add Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); mainLayout.addComponent(buttonLayout, 0, 1, 1, 1); mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment); for (ButtonConfig buttonConfig : buttonConfigs) { Button button = new Button(buttonConfig.getCaption(), new ButtonClickListener(buttonConfig.getButtonType())); if (buttonConfig.getWidth() != null) { button.setWidth(buttonConfig.getWidth()); } if (buttonConfig.getOptionalResource() != null) { button.setIcon(buttonConfig.getOptionalResource()); } else { Resource icon = null; switch (buttonConfig.getButtonType()) { case ABORT: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CANCEL: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CLOSE: icon = new ThemeResource("images/famfamfam/door.png"); break; case HELP: icon = new ThemeResource("images/famfamfam/lightbulb.png"); break; case OK: icon = new ThemeResource("images/famfamfam/tick.png"); break; case YES: icon = new ThemeResource("images/famfamfam/tick.png"); break; case NO: icon = new ThemeResource("images/famfamfam/cross.png"); break; case SAVE: icon = new ThemeResource("images/famfamfam/disk.png"); break; case RETRY: icon = new ThemeResource("images/famfamfam/arrow_refresh.png"); break; case IGNORE: icon = new ThemeResource("images/famfamfam/lightning_go.png"); break; } button.setIcon(icon); } buttonLayout.addComponent(button); } setContent(mainLayout); }
From source file:com.scsb.vaadin.composite.MessageBox.java
License:Apache License
/** * Similar to {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)}, * but the message component is defined explicitly. The component can be even a composite * of a layout manager and manager further Vaadin components. * /*from www .j ava2s. c o m*/ * @param messageComponent a Vaadin component */ public MessageBox(String dialogWidth, String dialogHeight, String dialogCaption, Icon dialogIcon, Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) { super(); setResizable(false); setClosable(false); setSizeUndefined(); setWidth(dialogWidth); //setHeight(dialogHeight); setCaption(dialogCaption); GridLayout mainLayout = new GridLayout(2, 2); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setSizeUndefined(); mainLayout.setWidth(GRID_DEFAULT_WIDTH1); // Add Content messageComponent.setSizeUndefined(); messageComponent.setWidth(GRID_DEFAULT_WIDTH2); if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) { mainLayout.addComponent(messageComponent, 0, 0, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(0, 1.0f); } else { mainLayout.addComponent(messageComponent, 1, 0); mainLayout.setRowExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, 1.0f); Embedded icon = null; switch (dialogIcon) { case QUESTION: icon = new Embedded(null, new ThemeResource("./images/question.png")); break; case INFO: icon = new Embedded(null, new ThemeResource("./images/info.png")); break; case WARN: icon = new Embedded(null, new ThemeResource("./images/warn.png")); break; case ERROR: icon = new Embedded(null, new ThemeResource("./images/error.png")); break; } mainLayout.addComponent(icon, 0, 0); icon.setWidth(ICON_DEFAULT_SIZE); icon.setHeight(ICON_DEFAULT_SIZE); } // Add Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); mainLayout.addComponent(buttonLayout, 0, 1, 1, 1); mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment); for (ButtonConfig buttonConfig : buttonConfigs) { Button button = new Button(buttonConfig.getCaption(), new ButtonClickListener(buttonConfig.getButtonType())); if (buttonConfig.getWidth() != null) { button.setWidth(buttonConfig.getWidth()); } if (buttonConfig.getOptionalResource() != null) { button.setIcon(buttonConfig.getOptionalResource()); } else { Resource icon = null; switch (buttonConfig.getButtonType()) { case ABORT: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CANCEL: icon = new ThemeResource("images/famfamfam/cross.png"); break; case CLOSE: icon = new ThemeResource("images/famfamfam/door.png"); break; case HELP: icon = new ThemeResource("images/famfamfam/lightbulb.png"); break; case OK: icon = new ThemeResource("images/famfamfam/tick.png"); break; case YES: icon = new ThemeResource("images/famfamfam/tick.png"); break; case NO: icon = new ThemeResource("images/famfamfam/cross.png"); break; case SAVE: icon = new ThemeResource("images/famfamfam/disk.png"); break; case RETRY: icon = new ThemeResource("images/famfamfam/arrow_refresh.png"); break; case IGNORE: icon = new ThemeResource("images/famfamfam/lightning_go.png"); break; } button.setIcon(icon); } buttonLayout.addComponent(button); } setContent(mainLayout); }
From source file:com.tapas.evidence.fe.components.EvidenceUpload.java
License:Apache License
public void showImage(String path) { final Resource imageResource = new ExternalResource(path); Embedded image = new Embedded("", imageResource); image.setCaption(null);/*ww w.j av a 2 s. c om*/ image.setWidth("200px"); imagePanel.setHeight(null); imagePanel.removeAllComponents(); imagePanel.addComponent(image); status.setValue(null); }
From source file:com.tapas.evidence.fe.components.EvidenceUpload.java
License:Apache License
public void showImage(final byte[] byteArray) { final StreamResource imageResource = new StreamResource(new ImageSource(byteArray), "photo.jpg", getApplication());/*w w w . j av a 2 s. co m*/ imageResource.setCacheTime(0); // disable cache Embedded image = new Embedded("", imageResource); image.setCaption(null); image.setWidth("200px"); imagePanel.setHeight(null); imagePanel.addComponent(image); status.setValue(null); }
From source file:com.thingtrack.konekti.map.ui.LicenseView.java
private Component buildLicenseNodeLayout() { HorizontalComponentGroup aboutNodeComponentGroup = new HorizontalComponentGroup(); aboutNodeComponentGroup.setMargin(true); aboutNodeComponentGroup.setWidth("100%"); aboutNodeComponentGroup.addStyleName("about"); Resource image = new ThemeResource("nodes/thingtrack_icon.png"); if (image != null) { Embedded embedded = new Embedded(null, image); embedded.setWidth("100px"); aboutNodeComponentGroup.addComponent(embedded); }// www. j a va 2 s . c o m aboutNodeComponentGroup.addComponent( new Label("<p><b>Konekti Map</b><br/>Localiza todo aquello que quieras</p>", Label.CONTENT_RAW)); aboutNodeComponentGroup.addComponent(new Label("<b>Versin 1.2.0</b>", Label.CONTENT_RAW)); aboutNodeComponentGroup.addComponent(new Label( "<p>Todo el Contenido de esta Aplicacin,<br/>como as tambin los productos y<br/>servicios comercializados son propiedad intelectual de Edikal Technology S.L.</p>", Label.CONTENT_RAW)); return aboutNodeComponentGroup; }
From source file:edu.nps.moves.mmowgli.components.CardTable.java
License:Open Source License
@SuppressWarnings("unused") private Component orig_buildGenAuthorColumn(Card card) { // IE7 can't handle fanciness: if (Mmowgli2UI.getGlobals().isIE7()) { return new Label(card.getAuthorName()); //.getAuthor().getUserName()); }//from w ww . j a v a 2 s . com HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(false); hl.setSpacing(true); User auth = card.getAuthor(); if (auth.getAvatar() != null) { Embedded avatar = new Embedded(null, Mmowgli2UI.getGlobals().getMediaLocator().locate(auth.getAvatar().getMedia(), 32)); avatar.setWidth("24px"); avatar.setHeight("24px"); hl.addComponent(avatar); hl.setComponentAlignment(avatar, Alignment.MIDDLE_LEFT); avatar.addStyleName("m-cursor-pointer"); } IDButton uButt = new IDButton(auth.getUserName(), SHOWUSERPROFILECLICK, auth.getId()); uButt.addStyleName(BaseTheme.BUTTON_LINK); uButt.setWidth(8.0f, Unit.EM); hl.addComponent(uButt); hl.setComponentAlignment(uButt, Alignment.MIDDLE_LEFT); return hl; }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboard.java
License:Open Source License
public void initGuiTL() { setSizeUndefined();/* w w w. j a v a 2 s .co m*/ setWidth(APPLICATION_SCREEN_WIDTH); // setHeight("855px"); //ACTIONDASHBOARD_H); Label sp; addComponent(sp = new Label()); sp.setHeight("10px"); HorizontalLayout titleHL = new HorizontalLayout(); titleHL.setWidth("95%"); addComponent(titleHL); titleHL.addComponent(sp = new Label()); sp.setWidth("20px"); Component titleC; titleHL.addComponent(titleC = Mmowgli2UI.getGlobals().getMediaLocator().getActionDashboardTitle()); titleHL.setComponentAlignment(titleC, Alignment.MIDDLE_LEFT); titleHL.addComponent(sp = new Label()); sp.setWidth("1px"); titleHL.setExpandRatio(sp, 1.0f); titleHL.addComponent(howToWinActionButt); howToWinActionButt.setDescription(howWinAction_tt); AbsoluteLayout absL = new AbsoluteLayout(); addComponent(absL); absL.setWidth(APPLICATION_SCREEN_WIDTH); absL.setHeight(ACTIONDASHBOARD_H); MediaLocator medLoc = Mmowgli2UI.getGlobals().getMediaLocator(); AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master mainAbsLay.setWidth(APPLICATION_SCREEN_WIDTH); mainAbsLay.setHeight(ACTIONDASHBOARD_H); absL.addComponent(mainAbsLay, ACTIONDASHBOARD_OFFSET_POS); // Now the background Embedded backgroundImage = new Embedded(null, medLoc.getActionDashboardPlanBackground()); backgroundImage.setWidth(ACTIONDASHBOARD_W); backgroundImage.setHeight(ACTIONDASHBOARD_H); mainAbsLay.addComponent(backgroundImage, "top:0px;left:0px"); HorizontalLayout tabsHL = new HorizontalLayout(); tabsHL.setStyleName("m-actionDashboardBlackTabs"); tabsHL.setSpacing(false); tabsHL.addComponent(sp = new Label()); sp.setWidth("12px"); TabClickHandler tabHndlr = new TabClickHandler(); actionPlansTabButt.setStyleName("m-actionDashboardActionPlansTab"); actionPlansTabButt.addClickListener(tabHndlr); actionPlansTabButt.setId(ACTION_DASHBOARD_ACTION_PLANS_TAB); tabsHL.addComponent(actionPlansTabButt); tabsHL.addComponent(sp = new Label()); sp.setWidth("1px"); myPlansTabButt.setStyleName("m-actionDashboardMyPlansTab"); myPlansTabButt.addClickListener(tabHndlr); myPlansTabButt.setId(ACTION_DASHBOARD_MY_ACTION_PLANS_TAB); tabsHL.addComponent(myPlansTabButt); myPlansTabButt.addStyleName("m-transparent-background"); // initially tabsHL.addComponent(sp = new Label()); sp.setWidth("1px"); needAuthorsTabButt.setStyleName("m-actionDashboardNeedAuthorsTab"); needAuthorsTabButt.addClickListener(tabHndlr); needAuthorsTabButt.setId(ACTION_DASHBOARD_NEED_AUTHORS_TAB); tabsHL.addComponent(needAuthorsTabButt); needAuthorsTabButt.addStyleName("m-transparent-background"); // initially absL.addComponent(tabsHL, "left:7px;top:8px"); // stack the pages absL.addComponent(actionPlansTab, ACTIONDASHBOARD_TABCONTENT_POS); actionPlansTab.initGuiTL(); absL.addComponent(myPlansTab, ACTIONDASHBOARD_TABCONTENT_POS); myPlansTab.initGuiTL(); myPlansTab.setVisible(false); absL.addComponent(needAuthorsTab, ACTIONDASHBOARD_TABCONTENT_POS); needAuthorsTab.initGuiTL(); needAuthorsTab.setVisible(false); User me = Mmowgli2UI.getGlobals().getUserTL(); Set<ActionPlan> invitedSet = me.getActionPlansInvited(); if (invitedSet != null && (invitedSet.size()) > 0) { Notification note = new Notification("<center>You're invited to an Action Plan!</center>", "<center> Look for the \"you're invited to join!\" notice.<br/>" + "First, check out the plan. Then, if you want to join,<br/>" + "click the link to become an author." + "</center>", Type.HUMANIZED_MESSAGE, true); // allow html note.setPosition(Position.MIDDLE_CENTER); note.setDelayMsec(5000);// 5 secs note.show(Page.getCurrent()); } }
From source file:edu.nps.moves.mmowgli.modules.administration.AbstractGameBuilderPanel.java
License:Open Source License
@Override public void initGui() { String title = getTitle();// w ww. j a v a2 s.co m if (title != null) { Label titleLab; addComponent(titleLab = new Label(title)); titleLab.addStyleName("m-centeralign"); } Embedded e = this.getImage(); if (e != null) { e.setWidth("800px"); // "930px"); e.setHeight("400px"); // "465px"); e.addStyleName("m-greyborder3"); addComponent(e); setComponentAlignment(e, Alignment.MIDDLE_CENTER); } if (lines.size() > 0) { grid.setColumns(3); String heading = getHeading(); Component footer = getFooter(); int nRows = lines.size() + (heading != null ? 1 : 0) + (footer != null ? 1 : 0); grid.setRows(nRows); int rowOffst = 0; if (heading != null) { grid.addComponent(makeLabel(heading), 0, 0, 2, 0); rowOffst = 1; } for (int r = 0; r < lines.size(); r++) { EditLine edLine = lines.get(r); if (edLine.ta != null) edLine.ta.setDescription(edLine.tooltip); if (edLine.isSeparator()) { addSeparator(grid, r + rowOffst); continue; } if (edLine.justComponent()) { addLineComponent(grid, r + rowOffst, edLine.ta); continue; } Label textLab = new HtmlLabel(edLine.name); textLab.setDescription(edLine.tooltip); textLab.addStyleName("m-font-bold14"); textLab.setWidth(getColumn1WidthString()); grid.addComponent(textLab, 0, r + rowOffst); // c0,r0,c1,r1 Label fieldLab = new Label(edLine.info); fieldLab.setDescription(edLine.tooltip); fieldLab.addStyleName("m-italic"); fieldLab.setWidth(getColumn2WidthString()); grid.addComponent(fieldLab, 1, r + rowOffst); if (edLine.ta instanceof TextArea) { TextArea ta = (TextArea) edLine.ta; ta.setDescription(edLine.tooltip); ta.setImmediate(true); ta.setWidth("100%"); if (edLine.fieldName != null && autoSave) ta.addValueChangeListener(new IndivListener(edLine, updatesOK, edLine.fieldClass == null ? String.class : edLine.fieldClass)); grid.addComponent(ta, 2, r + rowOffst); } else if (edLine.ta instanceof CheckBox) { CheckBox cb = (CheckBox) edLine.ta; cb.setDescription(edLine.tooltip); cb.setImmediate(true); if (edLine.fieldName != null && autoSave) cb.addValueChangeListener(new IndivListener(edLine, updatesOK, boolean.class)); grid.addComponent(cb, 2, r + rowOffst); } else if (edLine.ta instanceof Component) { grid.addComponent(edLine.ta, 2, r + rowOffst); } } if (footer != null) { int frow = lines.size() + rowOffst; grid.addComponent(footer, 0, frow, 2, frow); } grid.setWidth("99%"); grid.setHeight("100%"); addComponent(grid); grid.setColumnExpandRatio(2, 1.0f); if (showTestButton) { Button testButt = new Button(getTextButtonText(), new ClickListener() { private static final long serialVersionUID = 1L; @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); testButtonClickedTL(event); HSess.close(); } }); addComponent(testButt); setComponentAlignment(testButt, Alignment.MIDDLE_CENTER); } } }
From source file:edu.nps.moves.mmowgli.modules.cards.CardSummaryLine.java
License:Open Source License
@Override public void initGui() { Card c = Card.getTL(cardId);/* www .j a v a 2s . c o 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);// ww w . j ava2 s . 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 }