Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ImgLink.java @ 7563:04cc2dee911e
flys/issue1503: Evil hack to force loaded of data to be bound to 'w_differences'. TODO: Remove all the broken code from DataCageTwinPanel.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Tue, 12 Nov 2013 19:47:24 +0100 |
parents | 4875ca46fdcd |
children | 5e38e2924c07 |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.client.ui; |
1343
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import com.smartgwt.client.types.Overflow; |
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import com.smartgwt.client.widgets.HTMLPane; |
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
6556
4875ca46fdcd
Doc/Debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6231
diff
changeset
|
15 /** An image wrapped in a clickable link. */ |
1343
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 public class ImgLink extends HTMLPane { |
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
6231
bfbccad9c3f0
Subclass ImgLink with a new class WikiImgLink
Andre Heinecke <aheinecke@intevation.de>
parents:
5993
diff
changeset
|
18 protected int width; |
bfbccad9c3f0
Subclass ImgLink with a new class WikiImgLink
Andre Heinecke <aheinecke@intevation.de>
parents:
5993
diff
changeset
|
19 protected int height; |
2391
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
20 |
6231
bfbccad9c3f0
Subclass ImgLink with a new class WikiImgLink
Andre Heinecke <aheinecke@intevation.de>
parents:
5993
diff
changeset
|
21 protected String href; |
bfbccad9c3f0
Subclass ImgLink with a new class WikiImgLink
Andre Heinecke <aheinecke@intevation.de>
parents:
5993
diff
changeset
|
22 protected String imgUrl; |
2391
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
23 |
6231
bfbccad9c3f0
Subclass ImgLink with a new class WikiImgLink
Andre Heinecke <aheinecke@intevation.de>
parents:
5993
diff
changeset
|
24 protected boolean newTab; |
2500
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
25 |
2391
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
26 |
1343
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 public ImgLink(String imgUrl, String href, int width, int height) { |
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 super(); |
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
2391
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
30 this.width = width; |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
31 this.height = height; |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
32 this.href = href; |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
33 this.imgUrl = imgUrl; |
2500
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
34 this.newTab = false; |
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
35 |
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
36 update(); |
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
37 } |
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
38 |
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
39 |
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
40 public ImgLink(String imgUrl, String href, int w, int h, boolean newTab) { |
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
41 this(imgUrl, href, w, h); |
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
42 this.newTab = newTab; |
2391
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
43 |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
44 update(); |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
45 } |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
46 |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
47 |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
48 protected void update() { |
2500
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
49 String target = newTab ? "_blank" : "_self"; |
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
50 |
69a498896c9c
Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2486
diff
changeset
|
51 setContents("<a target='" + target + "' href='" + href + "'><img src='" + imgUrl + "'></a>"); |
1343
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 setWidth(width); |
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 setHeight(height); |
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 setOverflow(Overflow.VISIBLE); |
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 } |
2391
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
56 |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
57 |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
58 public void setSource(String href) { |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
59 this.href = href; |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
60 update(); |
3c8ae5605a51
Picked rev 4059,4071,4072,4073 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1343
diff
changeset
|
61 } |
1343
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 } |
6556
4875ca46fdcd
Doc/Debug.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6231
diff
changeset
|
63 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |