Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/Config.java @ 585:ab7ec931bae2
#22 Introduced a polling mechanism to refresh the projects of a user in the project list.
flys-client/trunk@2173 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 21 Jun 2011 10:05:04 +0000 |
parents | 385e9368ffcd |
children | d81533df4138 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/Config.java Tue Jun 21 08:13:47 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/Config.java Tue Jun 21 10:05:04 2011 +0000 @@ -80,5 +80,31 @@ public String getLocale() { return LocaleInfo.getCurrentLocale().getLocaleName(); } + + + /** + * Returns the integer configured at + * <i>/config/projectlist/update-interval/text()</i> or -1 if an error + * occured or no such option is defined. + * + * @return the update interval of the project list. + */ + public int getProjectListUpdateInterval() { + Node projectlist = config.getElementsByTagName("projectlist").item(0); + + if (projectlist == null) { + return -1; + } + + Node interval = config.getElementsByTagName("update-interval").item(0); + + if (interval == null) { + return -1; + } + + String value = interval.getFirstChild().getNodeValue(); + + return value != null ? Integer.valueOf(value) : -1; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :