Mercurial > dive4elements > river
changeset 22:a85bac235069
Implemented code to parse the UIProvider that should be used for a current state.
flys-client/trunk@1336 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 22 Feb 2011 17:29:51 +0000 |
parents | e98a25b5c95a |
children | dc086030e6a3 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java flys-client/src/main/java/de/intevation/flys/client/shared/model/Data.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultData.java |
diffstat | 4 files changed, 55 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Tue Feb 22 17:23:47 2011 +0000 +++ b/flys-client/ChangeLog Tue Feb 22 17:29:51 2011 +0000 @@ -1,3 +1,13 @@ +2011-02-22 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java: + The 'uiprovider' attribute is parsed from DESCRIBE document and stored at + the Data object. + + * src/main/java/de/intevation/flys/client/shared/model/Data.java, + src/main/java/de/intevation/flys/client/shared/model/DefaultData.java: + Implemented code to store the UIProvider (as string!) for the Data object. + 2011-02-22 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/client/event/StepForwardEvent.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java Tue Feb 22 17:23:47 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java Tue Feb 22 17:29:51 2011 +0000 @@ -33,6 +33,8 @@ public static final String XPATH_STATE_NAME = "@art:name"; + public static final String XPATH_UIPROVIDER = "@art:uiprovider"; + /** * This method creates the {@link ArtifactDescription} of the DESCRIBE * document <i>doc</i>. @@ -80,8 +82,9 @@ String label = ClientProtocolUtils.getLabel(data); DataItem[] dataItems = extractCurrentDataItems(choices); + String uiProvider = extractUIProvider(data); - return new DefaultData(label, null, null, dataItems); + return new DefaultData(label, null, null, dataItems, uiProvider); } @@ -115,5 +118,21 @@ return (DataItem[]) dataItems.toArray(new DataItem[count]); } + + + /** + * This method extracts the UIProvider specified by the data node. + * + * @param data The data node. + * + * @return the UIProvider that is specified in the data node. + */ + protected static String extractUIProvider(Node data) { + return (String) XMLUtils.xpath( + data, + XPATH_UIPROVIDER, + XPathConstants.STRING, + ArtifactNamespaceContext.INSTANCE); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/Data.java Tue Feb 22 17:23:47 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/Data.java Tue Feb 22 17:29:51 2011 +0000 @@ -1,6 +1,7 @@ package de.intevation.flys.client.shared.model; import java.io.Serializable; +import de.intevation.flys.client.client.ui.UIProvider; /** @@ -42,5 +43,13 @@ * @return the DataItems. */ public DataItem[] getItems(); + + + /** + * Returns the UIProvider that should be used to create UIs. + * + * @return the UIProvider. + */ + public String getUIProvider(); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultData.java Tue Feb 22 17:23:47 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultData.java Tue Feb 22 17:29:51 2011 +0000 @@ -1,5 +1,7 @@ package de.intevation.flys.client.shared.model; +import de.intevation.flys.client.client.ui.UIProvider; + /** * The default implementation of a {@link Data} item. This class just implements @@ -21,6 +23,9 @@ /** The DataItems.*/ protected DataItem[] items; + /** The UIProvider that should be used to create UIs. */ + protected String uiProvider; + public DefaultData() { } @@ -35,12 +40,17 @@ * @param items The DataItems. */ public DefaultData( - String label, String description, String type, DataItem[] items) + String label, + String description, + String type, + DataItem[] items, + String uiProvider) { this.label = label; this.description = description; this.type = type; this.items = items; + this.uiProvider = uiProvider; } @@ -62,5 +72,10 @@ public DataItem[] getItems() { return items; } + + + public String getUIProvider() { + return uiProvider; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :