Mercurial > dive4elements > river
changeset 796:cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
flys-client/trunk@2312 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 08 Jul 2011 08:54:08 +0000 |
parents | 68b8770af6c5 |
children | cc3f481e9484 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/shared/model/ChartMode.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultOutputMode.java flys-client/src/main/java/de/intevation/flys/client/shared/model/MapMode.java flys-client/src/main/java/de/intevation/flys/client/shared/model/OutputMode.java |
diffstat | 8 files changed, 250 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Thu Jul 07 15:04:45 2011 +0000 +++ b/flys-client/ChangeLog Fri Jul 08 08:54:08 2011 +0000 @@ -1,3 +1,37 @@ +2011-07-08 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/client/shared/model/OutputMode.java: An + output mode has type member now. In addition, the interface describes a + method that creates an OutputTab. Concrete subclasses should return + OutputTabs that fit to their type. + + * src/main/java/de/intevation/flys/client/shared/model/ChartMode.java: + New. This OutputMode is instantiated if type == "chart" and creates + ChartOutputTabs. + + * src/main/java/de/intevation/flys/client/shared/model/MapMode.java: New. + This OutputMode is instantiated if type == "map". It creates + MapOutputTabs. + + * src/main/java/de/intevation/flys/client/shared/model/DefaultOutputMode.java: + This default implementation of an OutputMode support the type member + now. The method to create OutputTabs will return null. + + * src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java: + Now, we support the 'type' attribute of Outputs in the DESCRIBE + document. Based on the type, we will now instantiate concrete subclasses + of the DefaultOutputMode. E.g. the type == 'chart', the instantiated + OutputMode will be ChartMode. + + * src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java: + New. This OutputTab is used to render a map. + + Note: This is currently a stub only! + + * src/main/java/de/intevation/flys/client/client/ui/CollectionView.java: + Creating OutputTabs based on the names of an OutputMode is obsolete. + Now, the OutputModes itself create their required OutputTab. + 2011-07-07 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Thu Jul 07 15:04:45 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Fri Jul 08 08:54:08 2011 +0000 @@ -42,7 +42,6 @@ import de.intevation.flys.client.client.services.CreateCollectionServiceAsync; import de.intevation.flys.client.client.services.DescribeCollectionService; import de.intevation.flys.client.client.services.DescribeCollectionServiceAsync; -import de.intevation.flys.client.client.ui.chart.ChartOutputTab; /** @@ -454,12 +453,12 @@ GWT.log("Add new output tab for '" + name + "'"); - // TODO Source this out to a factory that creates the different - // OutputTabs. - String title = messages.getString(name); - OutputTab tab = new ChartOutputTab( - title, getCollection(), out, this); - outputTabs.put(name, tab); + String title = messages.getString(name); + OutputTab tab = out.createOutputTab(title, getCollection(), this); + + if (tab != null) { + outputTabs.put(name, tab); + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java Fri Jul 08 08:54:08 2011 +0000 @@ -0,0 +1,67 @@ +package de.intevation.flys.client.client.ui.map; + +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.layout.HLayout; + +import de.intevation.flys.client.shared.model.Collection; +import de.intevation.flys.client.shared.model.OutputMode; + +import de.intevation.flys.client.client.ui.CollectionView; +import de.intevation.flys.client.client.ui.OutputTab; + + +public class MapOutputTab extends OutputTab { + + protected CollectionView parent; + + protected Canvas themePanel; + protected Canvas mapPanel; + + + public MapOutputTab( + String title, + Collection collection, + OutputMode mode, + CollectionView collectionView + ){ + super(title, collection, mode); + this.parent = collectionView; + + initLayout(); + } + + + protected void initLayout() { + themePanel = createThemePanel(); + mapPanel = createMapPanel(); + + HLayout layout = new HLayout(); + layout.setWidth100(); + layout.setHeight100(); + layout.addMember(themePanel); + layout.addMember(mapPanel); + + setPane(layout); + } + + + protected Canvas createThemePanel() { + Canvas c = new Canvas(); + c.setWidth(200); + c.setHeight100(); + c.setBorder("1px solid blue"); + + return c; + } + + + protected Canvas createMapPanel() { + Canvas c = new Canvas(); + c.setWidth("*"); + c.setHeight100(); + c.setBorder("1px solid green"); + + return c; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java Thu Jul 07 15:04:45 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java Fri Jul 08 08:54:08 2011 +0000 @@ -28,9 +28,10 @@ import de.intevation.flys.client.shared.model.DefaultCollection; import de.intevation.flys.client.shared.model.DefaultCollectionItem; import de.intevation.flys.client.shared.model.DefaultFacet; -import de.intevation.flys.client.shared.model.DefaultOutputMode; import de.intevation.flys.client.shared.model.DefaultTheme; +import de.intevation.flys.client.shared.model.ChartMode; import de.intevation.flys.client.shared.model.ExportMode; +import de.intevation.flys.client.shared.model.MapMode; import de.intevation.flys.client.shared.model.ReportMode; import de.intevation.flys.client.shared.model.Facet; import de.intevation.flys.client.shared.model.OutputMode; @@ -329,6 +330,7 @@ String name = tmp.getAttributeNS(uri, "name"); String desc = tmp.getAttributeNS(uri, "description"); String mime = tmp.getAttributeNS(uri, "mime-type"); + String type = tmp.getAttributeNS(uri, "type"); if (name.length() == 0) { System.err.println("Found an invalid output mode."); @@ -338,14 +340,21 @@ OutputMode outmode = null; List<Facet> fs = extractFacets(tmp); - if (name.indexOf("export") > -1) { + if (type.equals("export")) { outmode = new ExportMode(name, desc, mime, fs); } - else if (name.indexOf("report") > -1) { + else if (type.equals("report")) { outmode = new ReportMode(name, desc, mime, fs); } + else if (type.equals("chart")){ + outmode = new ChartMode(name, desc, mime, fs); + } + else if (type.equals("map")){ + outmode = new MapMode(name, desc, mime, fs); + } else { - outmode = new DefaultOutputMode(name, desc, mime, fs); + System.err.println("Broken Output mode without type found."); + continue; } modes.add(outmode);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/ChartMode.java Fri Jul 08 08:54:08 2011 +0000 @@ -0,0 +1,39 @@ +package de.intevation.flys.client.shared.model; + +import java.util.List; + +import de.intevation.flys.client.client.ui.CollectionView; +import de.intevation.flys.client.client.ui.OutputTab; +import de.intevation.flys.client.client.ui.chart.ChartOutputTab; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class ChartMode extends DefaultOutputMode { + + public ChartMode() { + } + + + public ChartMode(String name, String desc, String mimeType) { + super(name, desc, mimeType); + } + + + public ChartMode( + String name, + String descrition, + String mimeType, + List<Facet> facets) + { + super(name, descrition, mimeType, facets); + } + + + @Override + public OutputTab createOutputTab(String t, Collection c, CollectionView p) { + return new ChartOutputTab(t, c, this, p); + } +} +// 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/DefaultOutputMode.java Thu Jul 07 15:04:45 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultOutputMode.java Fri Jul 08 08:54:08 2011 +0000 @@ -3,6 +3,9 @@ import java.util.ArrayList; import java.util.List; +import de.intevation.flys.client.client.ui.CollectionView; +import de.intevation.flys.client.client.ui.OutputTab; + /** * The default implementation of an Output. @@ -20,6 +23,9 @@ /** The mime-type of this mode.*/ protected String mimeType; + /** The type that this output mode represents.*/ + protected String type; + /** The list of available facets of this export mode.*/ protected List<Facet> facets; @@ -45,12 +51,25 @@ public DefaultOutputMode( + String name, + String description, + String mimeType, + String type) + { + this(name, description, mimeType); + + this.type = type; + } + + + public DefaultOutputMode( String name, String description, String mimeType, List<Facet> facets) { this(name, description, mimeType); + this.type = ""; this.facets = facets; } @@ -70,6 +89,11 @@ } + public String getType() { + return type; + } + + /** * Adds a new facet to this export. * @@ -120,5 +144,10 @@ public List<Facet> getFacets() { return facets; } + + + public OutputTab createOutputTab(String t, Collection c, CollectionView p) { + return null; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/MapMode.java Fri Jul 08 08:54:08 2011 +0000 @@ -0,0 +1,39 @@ +package de.intevation.flys.client.shared.model; + +import java.util.List; + +import de.intevation.flys.client.client.ui.CollectionView; +import de.intevation.flys.client.client.ui.OutputTab; +import de.intevation.flys.client.client.ui.map.MapOutputTab; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class MapMode extends DefaultOutputMode { + + public MapMode() { + } + + + public MapMode(String name, String desc, String mimeType) { + super(name, desc, mimeType); + } + + + public MapMode( + String name, + String descrition, + String mimeType, + List<Facet> facets) + { + super(name, descrition, mimeType, facets); + } + + + @Override + public OutputTab createOutputTab(String t, Collection c, CollectionView p) { + return new MapOutputTab(t, c, this, p); + } +} +// 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/OutputMode.java Thu Jul 07 15:04:45 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/OutputMode.java Fri Jul 08 08:54:08 2011 +0000 @@ -3,6 +3,9 @@ import java.io.Serializable; import java.util.List; +import de.intevation.flys.client.client.ui.CollectionView; +import de.intevation.flys.client.client.ui.OutputTab; + /** * This interface describes an output mode of an artifact. @@ -37,6 +40,14 @@ /** + * Returns the type of this mode. + * + * @return the type of this mode. + */ + String getType(); + + + /** * Adds a new facet to this mode. * * @param facet The new facet. @@ -78,5 +89,17 @@ * @return all facets. */ List<Facet> getFacets(); + + + /** + * Returns an OutputTab that is used to render the output mode. + * + * @param t The title. + * @param c The Collection. + * @param p The parent CollectionView. + * + * @return an OutputTab. + */ + OutputTab createOutputTab(String t, Collection c, CollectionView p); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :