List of usage examples for com.vaadin.ui Image setHeight
@Override public void setHeight(String height)
From source file:com.cerebro.provevaadin.Equipment.java
public Equipment() { GridLayout contentSx = new GridLayout(15, 18); contentSx.setId("equip_body"); contentSx.setHeight("600px"); contentSx.setWidth("300px"); FileResource helmetFile = new FileResource(new File(basepath + "red.png")); Image helmet = new Image("Helmet", helmetFile); helmet.setHeight("100px"); contentSx.addComponent(helmet, 8, 0); sinistra.setContent(contentSx);// ww w . j ava2 s. c o m // root.setWidth("300px"); // root.setHeight("600px"); // // FileResource bodyMaleFile = new FileResource(new File(basepath + "body-male.jpg")); // FileResource helmetFile = new FileResource(new File(basepath + "red.png")); // // Image image = new Image("MaleBody", bodyMaleFile); // image.setWidth(root.getWidth(), root.getWidthUnits()); // Image helmet = new Image("Helmet", helmetFile); // helmet.setHeight("100px"); // // root.addComponent(image, "left: 0px; top: 0px;"); // root.addComponent(helmet, "left: 50%; top: 100px"); // // sinistra.setContent(root); // // // destra.setContent(rootDx); // this.addComponents(sinistra, destra); }
From source file:com.foc.vaadin.gui.components.FVImageField.java
License:Apache License
public Image resizeImage(Image image, int maxWidth, int maxHeight) { if (image != null) { double ratio = getRatio(image, maxWidth, maxHeight); String newHeight = Integer.toString((int) (image.getHeight() * ratio)); String newWidth = Integer.toString((int) (image.getWidth() * ratio)); image.setWidth(newWidth + "px"); image.setHeight(newHeight + "px"); setWidth(newWidth + "px"); setHeight(newHeight + "px"); }/*from www . ja v a 2 s .co m*/ return image; }
From source file:com.hack23.cia.web.impl.ui.application.views.common.AbstractView.java
License:Apache License
/** * Creates the basic layout with panel and footer. * * @param panelName//from www .j a v a2 s . com * the panel name */ protected final void createBasicLayoutWithPanelAndFooter(final String panelName) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setWidth(100, Unit.PERCENTAGE); layout.setHeight(100, Unit.PERCENTAGE); final VerticalLayout pageModeContent = new VerticalLayout(); pageModeContent.setMargin(true); pageModeContent.setSpacing(true); pageModeContent.setWidth(100, Unit.PERCENTAGE); pageModeContent.setHeight(100, Unit.PERCENTAGE); layout.addComponent(pageModeContent); final ThemeResource ciaLogoResource = new ThemeResource("cia-logo.png"); final Image ciaLogoImage = new Image(null, ciaLogoResource); final HorizontalLayout topHeader = new HorizontalLayout(); topHeader.addComponent(ciaLogoImage); ciaLogoImage.setWidth("75px"); ciaLogoImage.setHeight("75px"); topHeader.setComponentAlignment(ciaLogoImage, Alignment.MIDDLE_LEFT); topHeader.setExpandRatio(ciaLogoImage, ContentRatio.SMALL); final HorizontalLayout topTitleHeadertPanel = new HorizontalLayout(); final Label titleLabel = new Label("Citizen Intelligence Agency"); titleLabel.setStyleName("Header"); topTitleHeadertPanel.addComponent(titleLabel); topTitleHeadertPanel.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT); final Label sloganLabel = new Label("// Tracking politicians like bugs!"); sloganLabel.setStyleName("HeaderSlogan"); topTitleHeadertPanel.addComponent(sloganLabel); topTitleHeadertPanel.setComponentAlignment(sloganLabel, Alignment.MIDDLE_RIGHT); topHeader.addComponent(topTitleHeadertPanel); topHeader.setComponentAlignment(topTitleHeadertPanel, Alignment.MIDDLE_LEFT); topHeader.setExpandRatio(topTitleHeadertPanel, ContentRatio.GRID); topHeaderRightPanel.removeAllComponents(); topHeader.addComponent(topHeaderRightPanel); topHeader.setComponentAlignment(topHeaderRightPanel, Alignment.MIDDLE_RIGHT); topHeader.setExpandRatio(topHeaderRightPanel, ContentRatio.LARGE); if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN) || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) { final Link userHomePageLink = pageLinkFactory.createUserHomeViewPageLink(); topHeaderRightPanel.addComponent(userHomePageLink); topHeaderRightPanel.setComponentAlignment(userHomePageLink, Alignment.MIDDLE_RIGHT); final Button logoutButton = new Button(LOGOUT, FontAwesome.SIGN_OUT); final LogoutRequest logoutRequest = new LogoutRequest(); logoutRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId()); logoutButton.addClickListener(new LogoutClickListener(logoutRequest, applicationManager)); topHeaderRightPanel.addComponent(logoutButton); topHeaderRightPanel.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT); } else { final Link createRegisterPageLink = pageLinkFactory.createRegisterPageLink(); topHeaderRightPanel.addComponent(createRegisterPageLink); topHeaderRightPanel.setComponentAlignment(createRegisterPageLink, Alignment.MIDDLE_RIGHT); final Link createLoginPageLink = pageLinkFactory.createLoginPageLink(); topHeaderRightPanel.addComponent(createLoginPageLink); topHeaderRightPanel.setComponentAlignment(createLoginPageLink, Alignment.MIDDLE_RIGHT); } topHeaderRightPanel.setWidth("100%"); topHeaderRightPanel.setHeight("60px"); topHeader.setWidth("100%"); topHeader.setHeight("60px"); pageModeContent.addComponent(topHeader); pageModeContent.setComponentAlignment(topHeader, Alignment.TOP_CENTER); pageModeContent.addComponent(getBarmenu()); pageModeContent.setComponentAlignment(getBarmenu(), Alignment.TOP_CENTER); panel = new Panel(panelName); panel.setSizeFull(); pageModeContent.addComponent(panel); pageModeContent.setExpandRatio(panel, ContentRatio.FULL_SIZE); pageModeContent.addComponent(pageLinkFactory.createMainViewPageLink()); setContent(layout); setWidth(100, Unit.PERCENTAGE); setHeight(100, Unit.PERCENTAGE); setSizeFull(); }
From source file:com.klwork.explorer.ui.business.social.QQWeiboDisplayPage.java
License:Apache License
/** * // ww w . j ava2 s. c om */ @Override public Image initRetweetPic(final SocialUserWeibo orginWeibo) { // Image image = currentImage(orginWeibo.getOriginalPic(), null, "/460"); if (image != null) { image.setHeight("120px"); image.setWidth("120px"); } return image; }
From source file:com.klwork.explorer.ui.business.social.QQWeiboDisplayPage.java
License:Apache License
@Override public Image initOriginalPic(final SocialUserWeibo userWeibo) { // /*ww w . ja v a2s . c o m*/ String origPic = userWeibo.getOriginalPic(); Image image = currentImage(origPic, null, "/460"); // System.out.println("" + image.getHeight()); if (image != null) { image.setHeight("120px"); image.setWidth("120px"); } return image; }
From source file:com.klwork.explorer.ui.business.social.SinaWeiboDisplayPage.java
License:Apache License
@Override public Image initOriginalPic(final SocialUserWeibo userWeibo) { // //from w w w . ja v a 2s . co m String origPic = userWeibo.getOriginalPic(); Image image = currentImage(origPic, null, ""); // System.out.println("" + image.getHeight()); if (image != null) { image.setHeight("200px"); image.setWidth("200px"); } return image; }
From source file:com.m4gik.views.component.LibraryScreen.java
/** * This method creates image for cover./*www.j a v a 2 s. c o m*/ * * @param cover * The external cover for current track. * @return The image with set resource. */ private Image createImageCover(ExternalResource cover) { Image image = new Image(null, cover); image.setHeight("120px"); image.setWidth("120px"); return image; }
From source file:com.m4gik.views.component.LibraryScreen.java
/** * @param audioFile/* ww w . java 2s . co m*/ * @param cover * @return */ private Component createPlayImage(final AudioFile audioFile, ExternalResource cover) { AbsoluteLayout absoluteLayout = new AbsoluteLayout(); absoluteLayout.setWidth("120px"); absoluteLayout.setHeight("120px"); absoluteLayout.addComponent(createImageCover(cover)); final Image play = createImageCover( new ExternalResource("http://www.gelab.com.tr/interfaces/gelab/images/PlayButton.png")); play.setWidth("50px"); play.setHeight("50px"); play.addClickListener(new ClickListener() { private static final long serialVersionUID = -5184601350921707969L; @Override public void click(ClickEvent event) { MusicPlayerPanel musicPanel = MusicPlayerPanel.getInstance(getPlayerLayout()); watched.addObserver(musicPanel); MusicPlayerPanel.setAudio(audioFile); MusicPlayerPanel.runDefaultSetup(); if (isPlay.equals(false)) { watched.setValue(isPlay = true); play.setSource(new ExternalResource( "http://icons.iconarchive.com/icons/icons-land/play-stop-pause/256/Pause-Disabled-icon.png")); } else { watched.setValue(isPlay = false); play.setSource( new ExternalResource("http://www.gelab.com.tr/interfaces/gelab/images/PlayButton.png")); } } }); absoluteLayout.addComponent(play, "top: 30px; left: 30px;"); return absoluteLayout; }
From source file:com.mycompany.exodious.login.java
public login() { this.setId("loginPanel"); this.setSpacing(true); Image logo = new Image(); logo.setId("logo"); logo.setSource(slikaLogo);//from ww w. java2 s . c o m logo.setHeight("18em"); logo.setWidth("30em"); Label welcome = new Label("Welcome, please login"); welcome.setId("welcome"); TextField username = new TextField("Your ID"); PasswordField password = new PasswordField("Password"); Button submit = new Button("Login"); submit.setIcon(FontAwesome.SIGN_IN); submit.addStyleName(ValoTheme.BUTTON_PRIMARY); submit.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { } }); addComponents(logo, welcome, username, password, submit); setComponentAlignment(logo, Alignment.MIDDLE_CENTER); setComponentAlignment(welcome, Alignment.MIDDLE_CENTER); setComponentAlignment(username, Alignment.MIDDLE_CENTER); setComponentAlignment(password, Alignment.MIDDLE_CENTER); setComponentAlignment(submit, Alignment.MIDDLE_CENTER); }
From source file:de.fatalix.bookery.view.common.BookSearchLayout.java
License:Open Source License
private VerticalLayout createBookCoverLayout(final BookEntry bookEntry) { Image image = new Image(); image.setDescription(bookEntry.getTitle() + " von " + bookEntry.getAuthor()); image.setHeight("200px"); image.setWidth("130px"); image.setImmediate(true);/* ww w . jav a 2 s . c o m*/ if (bookEntry.getThumbnail() != null) { StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getThumbnail()); image.setSource(new StreamResource(source, bookEntry.getId() + "_thumb.png")); } else if (bookEntry.getCover() != null) { StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getCover()); image.setSource(new StreamResource(source, bookEntry.getId() + ".png")); } final MButton watchListButton = new MButton() .withIcon(presenter.isOnWatchList(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()) ? FontAwesome.STAR : FontAwesome.STAR_O) .withStyleName(ValoTheme.BUTTON_LINK); watchListButton.addStyleName("quick-action"); watchListButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { watchListButton.setIcon(presenter.addRemoveFromWatchList(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()) ? FontAwesome.STAR : FontAwesome.STAR_O); } }); final MButton likeButton = new MButton().withCaption("" + bookEntry.getLikes()) .withIcon(FontAwesome.THUMBS_O_UP).withStyleName(ValoTheme.BUTTON_LINK); likeButton.addStyleName("quick-action"); likeButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { BookEntry updatedBook = presenter.updateLike(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()); bookEntry.setLikes(updatedBook.getLikes()); bookEntry.setLikedby(updatedBook.getLikedby()); likeButton.setCaption("" + bookEntry.getLikes()); } catch (SolrServerException | IOException ex) { java.util.logging.Logger.getLogger(BookSearchLayout.class.getName()).log(Level.SEVERE, null, ex); } } }); final MButton downloadsButton = new MButton().withCaption("" + bookEntry.getDownloads()) .withIcon(FontAwesome.DOWNLOAD).withStyleName(ValoTheme.BUTTON_LINK); downloadsButton.addStyleName("quick-action"); HorizontalLayout quickActionLayout = new HorizontalLayout(watchListButton, likeButton, downloadsButton); quickActionLayout.addStyleName("quick-action-layout"); VerticalLayout result = new VerticalLayout(image, quickActionLayout); //result.setHeight("210px"); //result.setWidth("140px"); result.addStyleName("pointer-cursor"); result.addStyleName("book-card"); result.setComponentAlignment(image, Alignment.MIDDLE_CENTER); result.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { bookDetailLayout.loadData(bookEntry); bookDetailLayout.setLayoutVisible(true); //BookDetailDialog dialogInstance = bookDetail.get(); //dialogInstance.loadData(bookEntry); //UI.getCurrent().addWindow(dialogInstance); } }); return result; }