Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ExportPanel.java @ 6272:24be0cc1c67c
Replaced the 'old school' wiki link buttons with default links.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 11 Jun 2013 12:57:51 +0200 |
parents | ea9eef426962 |
children | fc42d82aa71c |
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; |
275
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import java.util.List; |
2931
d6983b78de45
Export panel: Make code more robust when trying to resolve missing i18n strings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1356
diff
changeset
|
12 import java.util.MissingResourceException; |
275
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import com.google.gwt.core.client.GWT; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import com.smartgwt.client.widgets.Canvas; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import com.smartgwt.client.widgets.Label; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import com.smartgwt.client.widgets.layout.HLayout; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import com.smartgwt.client.widgets.layout.VLayout; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
21 import org.dive4elements.river.client.shared.model.Collection; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
22 import org.dive4elements.river.client.shared.model.ExportMode; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
23 import org.dive4elements.river.client.shared.model.Facet; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
24 import org.dive4elements.river.client.client.Config; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
25 import org.dive4elements.river.client.client.FLYSConstants; |
275
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 /** |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 * A panel that displays an download icon for all available export modes of a |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 * Collection. |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 * |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 */ |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 public class ExportPanel extends VLayout { |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 /** The message class that provides i18n strings.*/ |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 protected Collection c; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 protected List<ExportMode> exports; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 /** This layout will store a list of available export types.*/ |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 protected HLayout container; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 public ExportPanel(Collection c, List<ExportMode> exports) { |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 super(); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 this.c = c; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 this.exports = exports; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 this.container = new HLayout(); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 Label title = new Label(MSG.dataexport()); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 title.setHeight(15); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 title.setStyleName("fontNormalSmallUnderlined"); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 addMember(title); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 addMember(createExportItems()); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
277
50b88b641be6
Changed the height of the export panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
275
diff
changeset
|
60 setHeight(45); |
275
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 setMembersMargin(5); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 } |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 /** |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 * This method is used to create an item (created by createExportButton) for |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 * each facet for each export mode. |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 * |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 * @return a horizontal list of buttons. |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 */ |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 protected HLayout createExportItems() { |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 HLayout layout = new HLayout(); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 for (ExportMode mode: exports) { |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 String name = mode.getName(); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 List<Facet> facets = mode.getFacets(); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 for (Facet facet: facets) { |
3525
b67af5b44d68
Hide the W/Q AT export button in fix analysis parameter tab.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2931
diff
changeset
|
79 if (name.equals("fix_wq_curve_at_export")) { |
b67af5b44d68
Hide the W/Q AT export button in fix analysis parameter tab.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2931
diff
changeset
|
80 continue; |
b67af5b44d68
Hide the W/Q AT export button in fix analysis parameter tab.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2931
diff
changeset
|
81 } |
4912
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
82 String filename = name; |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
83 if (name.equals("computed_dischargecurve_at_export")) { |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
84 filename = "dischargecurve"; |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
85 } |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
86 layout.addMember(createExportButton( |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
87 name, |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
88 facet.getName(), |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
89 filename)); |
275
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 } |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 } |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 return layout; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 } |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 /** |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 * This method is used to create a button (with click handler) for a |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 * concrete export mode / type. |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 * |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 * @param name The name of the export. |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 * @param facet The name of the export type (e.g. CSV, WST). |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 * |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 * @return an image with click handler. |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 */ |
4912
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
106 protected Canvas createExportButton( |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
107 String name, |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
108 String facet, |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
109 String filename |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
110 ) { |
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
111 String url = getExportUrl(name, facet, filename); |
5144
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
112 String imgUrl = GWT.getHostPageBaseURL(); |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
113 if (facet.equals("pdf")) { |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
114 imgUrl += MSG.downloadPDF(); |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
115 } |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
116 else if (facet.equals("at")) { |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
117 imgUrl += MSG.downloadAT(); |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
118 } |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
119 else if (facet.equals("wst")) { |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
120 imgUrl += MSG.downloadWST(); |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
121 } |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
122 else if (facet.equals("csv")) { |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
123 imgUrl += MSG.downloadCSV(); |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
124 } |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
125 else { |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
126 imgUrl += MSG.imageSave(); |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
127 } |
2c31625d4e6a
New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents:
4912
diff
changeset
|
128 ImgLink link = new ImgLink(imgUrl, url, 30, 30); |
1343
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
433
diff
changeset
|
129 link.setTooltip(getTooltipText(name, facet)); |
275
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 |
1343
0d3d3860beb5
Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
433
diff
changeset
|
131 return link; |
275
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 } |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 /** |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 * Creates the URL used to trigger an export. |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 * |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 * @param name The name of the export. |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 * @param facet The name of the export type (e.g. CSV, WST). |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 * |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 * @return the export URL. |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 */ |
4912
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
143 protected String getExportUrl(String name, String facet, String filename) { |
275
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 Config config = Config.getInstance(); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 String url = GWT.getModuleBaseURL(); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 url += "export"; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 url += "?uuid=" + c.identifier(); |
4912
94b95e002fb9
Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents:
3525
diff
changeset
|
149 url += "&name=" + filename; |
275
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 url += "&mode=" + name; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 url += "&type=" + facet; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 url += "&server=" + config.getServerUrl(); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 url += "&locale=" + config.getLocale(); |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 return url; |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 } |
433
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
157 |
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
158 |
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
159 /** |
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
160 * Creates a text used as tooltip for a specific export and type. |
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
161 * |
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
162 * @param name The name of the export. |
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
163 * @param facet The name of the export type (e.g. CSV, WST). |
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
164 * |
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
165 * @return a tooltip text. |
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
166 */ |
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
167 protected String getTooltipText(String name, String facet) { |
2931
d6983b78de45
Export panel: Make code more robust when trying to resolve missing i18n strings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1356
diff
changeset
|
168 try { |
d6983b78de45
Export panel: Make code more robust when trying to resolve missing i18n strings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1356
diff
changeset
|
169 return MSG.getString(name) + " | " + MSG.getString(facet); |
d6983b78de45
Export panel: Make code more robust when trying to resolve missing i18n strings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1356
diff
changeset
|
170 } |
d6983b78de45
Export panel: Make code more robust when trying to resolve missing i18n strings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1356
diff
changeset
|
171 catch (MissingResourceException mre) { |
d6983b78de45
Export panel: Make code more robust when trying to resolve missing i18n strings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1356
diff
changeset
|
172 return name + " | " + facet; |
d6983b78de45
Export panel: Make code more robust when trying to resolve missing i18n strings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1356
diff
changeset
|
173 } |
433
ad2c4fb17318
Adjusted the width of an export button and added a tooltip to distinguish different exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
174 } |
275
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 } |
8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |