/* * Copyright 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.sduk.client; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.DockPanel; import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.LoadListener; import com.google.gwt.user.client.ui.VerticalPanel; /** * Demonstrates {@link com.google.gwt.user.client.ui.Image}. */ public class BruceDenny extends Sink implements ClickListener, LoadListener { private static final String[][] sImages = new String[][]{ new String[] {"Images/denny.dropping04.jpg", "Dropping Out (Bronze, Edition of 6, H:800|W:400|D:400mm )"}, new String[] {"Images/denny.up03.jpg", "Upwardly Mobile (Bronze & Stainless Steel, Edition of 6, H:3200|W:1000|D:500mm )"}, new String[] {"Images/denny.tow01.jpg", "Towing the Line (Bronze, Edition of 6, H:1500|W:1200|D:600mm )"}, new String[] {"Images/denny.fitting02.jpg", "Fitting In (Bronze, Edition of 6, H:1300|W:600|D:600mm "}, new String[] {"Images/denny.laying03.jpg", "Laying Low (Bronze, Edition of 6, H:350|W:700|D:300mm "}, new String[] {"Images/denny.sitting01.jpg", "Sitting Pretty (Bronze, Edition of 6, H:350|W:350|D:250mm "}, new String[] {"Images/denny.being04.jpg", "Being (Bronze, Edition of 6, H:300|W:450|D:250mm "}, }; public static SinkInfo init() { return new SinkInfo("Bruce Denny", "Bruce Denny's sculptures can be purchased from " + "www.brucedenny.com " + "where there are more images and moving images of the sculptures. " + "A number of his sculptures are currently on display at HSBC Bank, London." ) { public Sink createInstance() { return new BruceDenny(); } }; } private int curImage; private Image imageCentral = new Image(); private HTML htmlTitleCentral = new HTML("", true); private Image loadingImage = new Image("Images/blanksearching.gif"); private Image nextButton = new Image("Images/forward.gif"); private Image prevButton = new Image("Images/back.gif"); public BruceDenny() { imageCentral.addLoadListener(this); imageCentral.setStyleName("ks-images-Image"); nextButton.addClickListener(this); nextButton.setStyleName("ks-images-Button"); prevButton.addClickListener(this); prevButton.setStyleName("ks-images-Button"); DockPanel topPanel = new DockPanel(); topPanel.setVerticalAlignment(DockPanel.ALIGN_MIDDLE); topPanel.add(prevButton, DockPanel.WEST); topPanel.add(nextButton, DockPanel.EAST); topPanel.add(loadingImage, DockPanel.CENTER); VerticalPanel panel = new VerticalPanel(); panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); panel.setWidth("100%"); panel.add( htmlTitleCentral ); panel.add(topPanel); panel.add(imageCentral); initWidget(panel); loadImage(0); } public void onClick(Widget sender) { if (sender == prevButton) { loadImage(curImage - 1); } else if (sender == nextButton) { loadImage(curImage + 1); } } public void onError(Widget sender) { } public void onLoad(Widget sender) { loadingImage.setUrl("Images/blanksearching.gif"); } public void onShow() { } private void loadImage(int index) { if (index < 0) { index = sImages.length - 1; } else if (index > sImages.length - 1) { index = 0; } curImage = index; loadingImage.setUrl("Images/searching.gif"); htmlTitleCentral.setHTML("