KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > user > client > ui > impl > ClippedImagePrototype


1 /*
2  * Copyright 2007 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16 package com.google.gwt.user.client.ui.impl;
17
18 import com.google.gwt.user.client.ui.Image;
19 import com.google.gwt.user.client.ui.AbstractImagePrototype;
20 import com.google.gwt.core.client.GWT;
21
22 /**
23  * Implementation of {@link AbstractImagePrototype} for a clipped image. This
24  * class is used internally by the image bundle generator and is not intended
25  * for general use. It is subject to change without warning.
26  */

27 public class ClippedImagePrototype extends AbstractImagePrototype {
28
29   private static final ClippedImageImpl impl = (ClippedImageImpl) GWT.create(ClippedImageImpl.class);
30
31   private int left = 0;
32   private int top = 0;
33   private int width = 0;
34   private int height = 0;
35   private String JavaDoc url = null;
36
37   public ClippedImagePrototype(String JavaDoc url, int left, int top, int width,
38       int height) {
39     this.url = url;
40     this.left = left;
41     this.top = top;
42     this.width = width;
43     this.height = height;
44   }
45
46   public void applyTo(Image image) {
47     image.setUrlAndVisibleRect(url, left, top, width, height);
48   }
49
50   public Image createImage() {
51     return new Image(url, left, top, width, height);
52   }
53
54   public String JavaDoc getHTML() {
55     return impl.getHTML(url, left, top, width, height);
56   }
57 }
58
Popular Tags