Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ImgLink.java @ 5838:5aa05a7a34b7
Rename modules to more fitting names.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 15:23:37 +0200 |
parents | flys-client/src/main/java/org/dive4elements/river/client/client/ui/ImgLink.java@821a02bbfb4e |
children | 172338b1407f |
comparison
equal
deleted
inserted
replaced
5837:d9901a08d0a6 | 5838:5aa05a7a34b7 |
---|---|
1 package org.dive4elements.river.client.client.ui; | |
2 | |
3 import com.smartgwt.client.types.Overflow; | |
4 import com.smartgwt.client.widgets.HTMLPane; | |
5 | |
6 | |
7 public class ImgLink extends HTMLPane { | |
8 | |
9 private int width; | |
10 private int height; | |
11 | |
12 private String href; | |
13 private String imgUrl; | |
14 | |
15 private boolean newTab; | |
16 | |
17 | |
18 public ImgLink(String imgUrl, String href, int width, int height) { | |
19 super(); | |
20 | |
21 this.width = width; | |
22 this.height = height; | |
23 this.href = href; | |
24 this.imgUrl = imgUrl; | |
25 this.newTab = false; | |
26 | |
27 update(); | |
28 } | |
29 | |
30 | |
31 public ImgLink(String imgUrl, String href, int w, int h, boolean newTab) { | |
32 this(imgUrl, href, w, h); | |
33 this.newTab = newTab; | |
34 | |
35 update(); | |
36 } | |
37 | |
38 | |
39 protected void update() { | |
40 String target = newTab ? "_blank" : "_self"; | |
41 | |
42 setContents("<a target='" + target + "' href='" + href + "'><img src='" + imgUrl + "'></a>"); | |
43 setWidth(width); | |
44 setHeight(height); | |
45 setOverflow(Overflow.VISIBLE); | |
46 } | |
47 | |
48 | |
49 public void setSource(String href) { | |
50 this.href = href; | |
51 update(); | |
52 } | |
53 } |