Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/Config.java @ 9640:68d7b09a47b7
zu pos 20 little fixes
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Tue, 12 Nov 2019 10:07:09 +0100 |
parents | 9f3ffb218bc0 |
children |
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; |
9
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
229
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
11 import com.google.gwt.i18n.client.LocaleInfo; |
9
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import com.google.gwt.xml.client.Document; |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import com.google.gwt.xml.client.Node; |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 /** |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 * A class that is used to handle the global configuration of this client. You |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 * can retrieve an instance of this class using the <code>getInstance</code> |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 * methods. <b>NOTE:</b> the configuration is initialized using {@link |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * getInstance(Document)} the first time. |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 * |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 */ |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public class Config { |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 /** The instance of the configuration. */ |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 protected static Config INSTANCE; |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
1347
d81533df4138
Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
585
diff
changeset
|
29 /** The xml document that contains the configuration options. */ |
9
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 protected Document config; |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
6479
ac6c41fcae55
Use help-url provided by ServerInfoService (fix for #1197).
Christian Lins <christian.lins@intevation.de>
parents:
6418
diff
changeset
|
32 protected String helpUrl; |
9
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 /** |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 * Get an instance by using {@link getInstance(Document)} or {@link |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 * getInstance()}. |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 */ |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 private Config(Document config) { |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 this.config = config; |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 } |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 /** |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 * Returns an instance of this class and initializes the configuration of |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 * this has not been done so far. |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 * |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 * @param config The client configuration. |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 * |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 * @return an instance of this Config class. |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 */ |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 public static Config getInstance(Document config) { |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 if (INSTANCE == null) { |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 INSTANCE = new Config(config); |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 } |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 return INSTANCE; |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 } |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 /** |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 * Returns an instance of this class. If it has not been initialized with a |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 * valid configuration, null is returned. |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 * |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 * @return an instance of this class or null, if the Config has not been |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 * initialized using {@link getInstance(Document)} so far. |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 */ |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 public static Config getInstance() { |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 return INSTANCE; |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 } |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 /** |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 * Returns the URL of the artifact server. |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 * |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 * @return the artifact server url. |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 */ |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 public String getServerUrl() { |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 Node server = config.getElementsByTagName("server").item(0); |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 return server.getFirstChild().getNodeValue(); |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 } |
229
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
81 |
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
82 |
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
83 /** |
6418
c702bac7f72e
Make wiki url configurable in gwt client (flys/#1197). It's probably better to retrieve
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
84 * Returns the URL of the FLYS/d4e-Wiki. |
c702bac7f72e
Make wiki url configurable in gwt client (flys/#1197). It's probably better to retrieve
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
85 * |
c702bac7f72e
Make wiki url configurable in gwt client (flys/#1197). It's probably better to retrieve
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
86 * @return wiki base URL |
c702bac7f72e
Make wiki url configurable in gwt client (flys/#1197). It's probably better to retrieve
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
87 */ |
c702bac7f72e
Make wiki url configurable in gwt client (flys/#1197). It's probably better to retrieve
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
88 public String getWikiUrl() { |
6479
ac6c41fcae55
Use help-url provided by ServerInfoService (fix for #1197).
Christian Lins <christian.lins@intevation.de>
parents:
6418
diff
changeset
|
89 return this.helpUrl; |
ac6c41fcae55
Use help-url provided by ServerInfoService (fix for #1197).
Christian Lins <christian.lins@intevation.de>
parents:
6418
diff
changeset
|
90 } |
ac6c41fcae55
Use help-url provided by ServerInfoService (fix for #1197).
Christian Lins <christian.lins@intevation.de>
parents:
6418
diff
changeset
|
91 |
ac6c41fcae55
Use help-url provided by ServerInfoService (fix for #1197).
Christian Lins <christian.lins@intevation.de>
parents:
6418
diff
changeset
|
92 public void setWikiUrl(String url) { |
ac6c41fcae55
Use help-url provided by ServerInfoService (fix for #1197).
Christian Lins <christian.lins@intevation.de>
parents:
6418
diff
changeset
|
93 this.helpUrl = url; |
6418
c702bac7f72e
Make wiki url configurable in gwt client (flys/#1197). It's probably better to retrieve
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
94 } |
c702bac7f72e
Make wiki url configurable in gwt client (flys/#1197). It's probably better to retrieve
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
95 |
c702bac7f72e
Make wiki url configurable in gwt client (flys/#1197). It's probably better to retrieve
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
96 |
c702bac7f72e
Make wiki url configurable in gwt client (flys/#1197). It's probably better to retrieve
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
97 /** |
229
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
98 * Returns the name of the current locale. |
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
99 * |
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
100 * @return the name of the current locale. |
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
101 */ |
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
102 public String getLocale() { |
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
103 return LocaleInfo.getCurrentLocale().getLocaleName(); |
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
104 } |
585
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
105 |
8503
9f3ffb218bc0
(issue1777) Hide logout button if it is configured.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
6479
diff
changeset
|
106 public boolean getHideLogout() { |
9f3ffb218bc0
(issue1777) Hide logout button if it is configured.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
6479
diff
changeset
|
107 Node hide_logout = config.getElementsByTagName("hide-logout").item(0); |
9f3ffb218bc0
(issue1777) Hide logout button if it is configured.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
6479
diff
changeset
|
108 if (hide_logout == null) { |
9f3ffb218bc0
(issue1777) Hide logout button if it is configured.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
6479
diff
changeset
|
109 return false; |
9f3ffb218bc0
(issue1777) Hide logout button if it is configured.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
6479
diff
changeset
|
110 } |
9f3ffb218bc0
(issue1777) Hide logout button if it is configured.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
6479
diff
changeset
|
111 String value = hide_logout.getFirstChild().getNodeValue(); |
9f3ffb218bc0
(issue1777) Hide logout button if it is configured.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
6479
diff
changeset
|
112 return value.toLowerCase().equals("true"); |
9f3ffb218bc0
(issue1777) Hide logout button if it is configured.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
6479
diff
changeset
|
113 } |
585
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
114 |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
115 /** |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
116 * Returns the integer configured at |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
117 * <i>/config/projectlist/update-interval/text()</i> or -1 if an error |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
118 * occured or no such option is defined. |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
119 * |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
120 * @return the update interval of the project list. |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
121 */ |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
122 public int getProjectListUpdateInterval() { |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
123 Node projectlist = config.getElementsByTagName("projectlist").item(0); |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
124 |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
125 if (projectlist == null) { |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
126 return -1; |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
127 } |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
128 |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
129 Node interval = config.getElementsByTagName("update-interval").item(0); |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
130 |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
131 if (interval == null) { |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
132 return -1; |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
133 } |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
134 |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
135 String value = interval.getFirstChild().getNodeValue(); |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
136 |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
137 return value != null ? Integer.valueOf(value) : -1; |
ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
252
diff
changeset
|
138 } |
9
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 } |
8facd8545a12
Added a global configuration for the client and classes providing methods to retrieve these information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |