List of usage examples for com.google.gwt.user.client.ui Image getUrl
public String getUrl()
From source file:asquare.gwt.tk.client.ui.AlertDialog.java
License:Apache License
/** * Set the image will be displayed in the caption. You can use an * {@link Icon} to ensure size information is available when the dialog * layout is calculated./*from w ww. ja v a 2 s. co m*/ * * @param icon an image or null * @see Icon */ public void setIcon(Image icon) { if (m_captionIcon != null) { m_captionIcon = null; } if (icon != null) { m_captionIcon = icon; m_captionIcon.addStyleName("tk-AlertDialog-captionIcon"); Image.prefetch(icon.getUrl()); } }
From source file:ch.sebastienzurfluh.swissmuseum.core.client.view.pagewidget.ResourceWidget.java
License:Open Source License
@Override public void notifyObserver(Observable source) { for (ResourceData resource : model.getAllNeededResources()) { // The following check is sufficient to determine unicity as there cannot be // two different resources with the same id, be it an IMAGE and a VIDEO. // This is explicitly reflected in the CakeConnector/MySQL by the use of a single // table Resources with an unique key column 'id'. if (resource.getReference().equals(this.getReference())) { switch (resource.getResourceType()) { case IMAGE: Image image = new Image(resource.getURL()); image.setStyleName(primaryStyle + imageExtension); image.setAltText(resource.getTitle()); final ResourceGallery imageGallery = new ResourceGallery(image.getUrl(), resource.getTitle(), resource.getDetails()); image.addClickHandler(new ClickHandler() { @Override// w w w . ja v a 2s .c om public void onClick(ClickEvent event) { imageGallery.center(); } }); resourceContainer.setWidget(image); break; case VIDEO: int id = Random.nextInt(); HTML video = new HTML("<a href='" + resource.getURL() + "' target='_blank'>" + "<video id='" + id + "' autobuffer class='" + primaryStyle + videoExtension + "'>" + "<source src='" + resource.getURL() + "' " + "type='video/ogg; codecs=\"theora, vorbis\"'/>" + "</video></a>"); resourceContainer.setWidget(video); // Video video = Video.createIfSupported(); // if (video == null) { // resourceContainer.setWidget(new Label("Your browser is not able to play" // + " this video")); // } else { // video.setSrc(resource.getURL()); // video.setStyleName(primaryStyle+videoExtension); // resourceContainer.setWidget(video); // } break; default: // Destroy the object. It is never referenced outside of this object, but is // attached to it's parent. this.removeFromParent(); } title.setText(resource.getTitle()); details.setText(resource.getDetails()); eventBus.fireEvent(new PageModifiedEvent()); model.allNeededResourcesObservable.unsubscribeObserver(this); return; } } }
From source file:com.ait.ext4j.client.data.TableItem.java
License:Apache License
public void setIcon(Image image) { setIcon(image.getUrl()); }
From source file:com.ait.toolkit.jqdock.client.Dock.java
License:Open Source License
public void addIcon(ImageResource imageResource) { Image img = new Image(imageResource); addIcon(new Image(img.getUrl())); }
From source file:com.ait.toolkit.jqdock.client.Dock.java
License:Open Source License
public void addIcon(ImageResource imageResource, ClickHandler handler) { Image img = new Image(imageResource); addIcon(new Image(img.getUrl()), handler); }
From source file:com.ait.toolkit.jqdock.client.Dock.java
License:Open Source License
public void addIcon(ImageResource imageResource, String title) { Image img = new Image(imageResource); addIcon(new Image(img.getUrl()), title); }
From source file:com.ait.toolkit.jqdock.client.Dock.java
License:Open Source License
public void addIcon(ImageResource imageResource, String title, ClickHandler handler) { Image img = new Image(imageResource); addIcon(new Image(img.getUrl()), title, handler); }
From source file:com.ait.toolkit.jqdock.client.Dock.java
License:Open Source License
public void addIcon(ImageResource imageResource, String title, String alt) { Image img = new Image(imageResource); addIcon(new Image(img.getUrl()), title, alt); }
From source file:com.ait.toolkit.jqdock.client.Dock.java
License:Open Source License
public void addIcon(ImageResource imageResource, String title, String alt, ClickHandler handler) { Image img = new Image(imageResource); addIcon(new Image(img.getUrl()), title, alt, handler); }
From source file:com.fullmetalgalaxy.client.game.context.WgtContextMinimap.java
License:Open Source License
public void redraw() { assert GameEngine.model() != null; Game game = GameEngine.model().getGame(); // if( m_lastResfreshTurn != game.getCurrentTimeStep() || // m_lastResfreshGameId != game.getId() ) {/*from ww w.jav a2 s . co m*/ m_lastResfreshTurn = game.getCurrentTimeStep(); m_lastResfreshGameId = game.getId(); canvas.setCoordinateSpaceWidth(game.getLandWidth() * 8); canvas.setCoordinateSpaceHeight(game.getLandHeight() * 8 + 4); Context2d gc = canvas.getContext2d(); gc.clearRect(0, 0, game.getLandWidth(), game.getLandHeight()); // draw lands ImageElement[] images = new ImageElement[LandType.values().length]; for (int iLand = 0; iLand < LandType.values().length; iLand++) { LandType land = LandType.values()[iLand]; Image img = new Image("/images/board/" + game.getPlanetType().getFolderName() + "/minimap/" + land.getImageName(game.getCurrentTide())); img.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { m_lastResfreshTurn = -1; m_lastResfreshGameId = -1; } }); images[iLand] = ImageElement.as(img.getElement()); Image.prefetch(img.getUrl()); } for (int ix = 0; ix < game.getLandWidth(); ix++) { for (int iy = 0; iy < game.getLandHeight(); iy++) { if (game.getLand(ix, iy) == LandType.Montain) { gc.drawImage(images[game.getLand(ix, iy).ordinal()], ix * 8, iy * 8 + (ix % 2) * 4, 8, 8); } else { gc.drawImage(images[game.getLand(ix, iy).ordinal()], ix * 8, iy * 8 + (ix % 2) * 4, 8, 8); } } } // draw units for (EbToken token : game.getSetToken()) { if (token.getLocation() == Location.Board && token.getColor() != EnuColor.None) { gc.drawImage(tokenImages[token.getColor()], token.getPosition().getX() * 8, token.getPosition().getY() * 8 + (token.getPosition().getX() % 2) * 4, 8, 8); for (AnBoardPosition position : token.getExtraPositions(game.getCoordinateSystem())) { gc.drawImage(tokenImages[token.getColor()], position.getX() * 8, position.getY() * 8 + (position.getX() % 2) * 4, 8, 8); } } } } if (game.getStatus() == GameStatus.Open || game.getStatus() == GameStatus.Pause) { m_panel.add(new Image(Icons.s_instance.pause32()), FmpConstant.miniMapWidth / 2 - 16, FmpConstant.miniMapHeight / 2 - 16); m_panel.add(new Label("En Pause"), 0, FmpConstant.miniMapHeight / 2 + 30); } else if (game.isFinished()) { m_panel.add(new Label("Partie termine"), 0, FmpConstant.miniMapHeight / 2 - 40); m_panel.add(new Image(Icons.s_instance.winner32()), FmpConstant.miniMapWidth / 2 - 16, FmpConstant.miniMapHeight / 2 - 16); String strWinner = ""; EbTeam winnerTeam = game.getWinnerTeam(); if ((winnerTeam != null)) { strWinner += winnerTeam.getCompany().getFullName() + ":\n"; for (EbRegistration registration : winnerTeam.getPlayers(game.getPreview())) if (registration.haveAccount()) { strWinner += registration.getAccount().getPseudo() + "\n"; } } m_panel.add(new Label(strWinner), 0, FmpConstant.miniMapHeight / 2 + 30); } }