List of usage examples for com.google.gwt.gadgets.client.ui GadgetImage GadgetImage
public GadgetImage(String url)
From source file:com.google.gwt.gadgets.sample.basicgadgetads.client.BasicGadgetAds.java
License:Apache License
@Override protected void init(AdsUserPreferences preferences) { // Creating the Panel VerticalPanel vp = new VerticalPanel(); RootPanel.get().add(vp);// w ww .jav a 2 s.c om // Setting style and alignment vp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // Using GadgetImage instead of Image will cache your images on the // Gadget's Container server. It is a Gadget Ads requirement that all // embedded assets must be cached. vp.add(new GadgetImage("http://code.google.com/webtoolkit/images/gwt-logo.png")); // Adding a waiting message to the RootPanel Label disclaimer = new Label("Use GWT for your Gadget Ads!"); vp.add(disclaimer); // Another Logo vp.add(new GadgetImage("http://code.google.com/webtoolkit/images/gwt-logo.png")); // Adding the button to go to the GWT website Button button = new Button("Visit the GWT Website NOW!!"); vp.add(button); // When clicking the button, we are redirected to the GWT website. // We use the AdsFeature.clickDestinationUrl() which will redirect to the // URL and report the clickthrough hit. // It is a GadgetAds requirement to use some AdsFeature.reportInteraction() // or AdsFeature.clickDestinationUrl() button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { adsFeature.clickDestinationUrl("http://code.google.com/webtoolkit/"); } }); // Another Logo vp.add(new GadgetImage("http://code.google.com/webtoolkit/images/gwt-logo.png")); // Some styling vp.setHeight("100%"); vp.setWidth("100%"); button.setWidth("80%"); button.getElement().getStyle().setProperty("cursor", "pointer"); button.getElement().getStyle().setPropertyPx("fontSize", 15); button.getElement().getStyle().setProperty("fontWeight", "bold"); button.getElement().getStyle().setPropertyPx("padding", 5); }