Java Code Examples for com.google.gwt.user.client.ui.Image#setSize()

The following examples show how to use com.google.gwt.user.client.ui.Image#setSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TopPanel.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
private void addLogo(HorizontalPanel panel) {
  // Logo is a link to App Inv homepage. Add timestamp to logo url
  // to get around browsers that agressively cache the image! This
  // same trick is used in StorageUtil.getFilePath().
  Image logo = new Image(LOGO_IMAGE_URL + "?t=" + System.currentTimeMillis());
  logo.setSize("180px", "40px");
  logo.setStyleName("ode-Logo");
  String logoUrl = ode.getSystemConfig().getLogoUrl();
  if (!Strings.isNullOrEmpty(logoUrl)) {
    logo.addClickHandler(new WindowOpenClickHandler(logoUrl));
  }
  panel.add(logo);
  panel.setCellWidth(logo, "230px");
  panel.setCellHorizontalAlignment(logo, HorizontalPanel.ALIGN_LEFT);
  panel.setCellVerticalAlignment(logo, HorizontalPanel.ALIGN_MIDDLE);
}
 
Example 2
Source File: MapToolTipPopup.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private void addImageAttribute(final StringBuffer htmlString, final String attributeValue) {
	final String url = attributeValue.replace("img:", "");
	final Image image = new Image(url);
	image.setSize("48px", "48px");
	
	final Anchor anchor = new AnchorBuilder().setHref(url)
			.setTitle(UIMessages.INSTANCE.openInNewWindow())
			.setImage(image).build();

	htmlString.append(anchor.getElement().getString());
}