annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ExportPanel.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/ExportPanel.java@821a02bbfb4e
children 172338b1407f
rev   line source
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
1 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
2
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 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
4 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
5
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 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
7
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 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
9 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
10 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
11 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
12
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
13 import org.dive4elements.river.client.shared.model.Collection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
14 import org.dive4elements.river.client.shared.model.ExportMode;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
15 import org.dive4elements.river.client.shared.model.Facet;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
16 import org.dive4elements.river.client.client.Config;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
17 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
18
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 /**
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 * 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
22 * Collection.
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 *
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 * @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
25 */
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 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
27
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 /** 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
29 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
30
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 protected Collection c;
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 protected List<ExportMode> exports;
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 /** 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
35 protected HLayout container;
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 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
39 super();
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 this.c = c;
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 this.exports = exports;
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 this.container = new HLayout();
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 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
46 title.setHeight(15);
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 title.setStyleName("fontNormalSmallUnderlined");
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 addMember(title);
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 addMember(createExportItems());
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
277
50b88b641be6 Changed the height of the export panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 275
diff changeset
52 setHeight(45);
275
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 setMembersMargin(5);
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 }
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
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 /**
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 * 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
59 * 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
60 *
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 * @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
62 */
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 protected HLayout createExportItems() {
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 HLayout layout = new HLayout();
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 for (ExportMode mode: exports) {
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 String name = mode.getName();
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 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
69
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 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
71 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
72 continue;
b67af5b44d68 Hide the W/Q AT export button in fix analysis parameter tab.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2931
diff changeset
73 }
4912
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
74 String filename = name;
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
75 if (name.equals("computed_dischargecurve_at_export")) {
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
76 filename = "dischargecurve";
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
77 }
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
78 layout.addMember(createExportButton(
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
79 name,
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
80 facet.getName(),
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
81 filename));
275
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 }
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 }
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 return layout;
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 }
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 /**
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 * 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
91 * concrete export mode / type.
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 * @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
94 * @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
95 *
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 * @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
97 */
4912
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
98 protected Canvas createExportButton(
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
99 String name,
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
100 String facet,
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
101 String filename
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
102 ) {
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
103 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
104 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
105 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
106 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
107 }
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4912
diff changeset
108 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
109 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
110 }
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4912
diff changeset
111 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
112 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
113 }
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4912
diff changeset
114 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
115 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
116 }
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4912
diff changeset
117 else {
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4912
diff changeset
118 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
119 }
2c31625d4e6a New icons! Use the new icons in project list and for export buttons.
Raimund Renkert <rrenkert@intevation.de>
parents: 4912
diff changeset
120 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
121 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
122
1343
0d3d3860beb5 Added a ImgLink class which creates an html link with an image.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 433
diff changeset
123 return link;
275
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 }
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 /**
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 * 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
129 *
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 * @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
131 * @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
132 *
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 * @return the export URL.
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 */
4912
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
135 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
136 Config config = Config.getInstance();
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 String url = GWT.getModuleBaseURL();
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 url += "export";
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 url += "?uuid=" + c.identifier();
4912
94b95e002fb9 Added filename to export url.
Raimund Renkert <rrenkert@intevation.de>
parents: 3525
diff changeset
141 url += "&name=" + filename;
275
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 url += "&mode=" + name;
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 url += "&type=" + facet;
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 url += "&server=" + config.getServerUrl();
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 url += "&locale=" + config.getLocale();
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 return url;
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 }
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
149
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
150
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
151 /**
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
152 * 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
153 *
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
154 * @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
155 * @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
156 *
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 * @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
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 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
160 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
161 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
162 }
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
163 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
164 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
165 }
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
166 }
275
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 }
8264b02091ef ISSUE-56 Display download buttons to export the computed data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org