Mercurial > dive4elements > river
changeset 36:3cacc9d2dd01
CollectionView implements HasParameterChangeHandler and ParameterChangeHandler interfaces.
flys-client/trunk@1457 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 10 Mar 2011 13:49:48 +0000 |
parents | d692e2ff95e2 |
children | b6b89ff1adee |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java |
diffstat | 2 files changed, 67 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Thu Mar 10 13:42:15 2011 +0000 +++ b/flys-client/ChangeLog Thu Mar 10 13:49:48 2011 +0000 @@ -1,3 +1,9 @@ +2011-03-10 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/CollectionView.java: + Integrated the mechnism to listen on paramer changes. The CollectionView + is both: a HasParameterChangeHandler and a ParameterChangeHandler. + 2011-03-10 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Thu Mar 10 13:42:15 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Thu Mar 10 13:49:48 2011 +0000 @@ -27,11 +27,14 @@ import de.intevation.flys.client.client.FLYS; import de.intevation.flys.client.client.FLYSMessages; import de.intevation.flys.client.client.event.HasCollectionChangeHandlers; +import de.intevation.flys.client.client.event.HasParameterChangeHandler; import de.intevation.flys.client.client.event.HasStepForwardHandlers; import de.intevation.flys.client.client.event.CollectionChangeEvent; +import de.intevation.flys.client.client.event.CollectionChangeHandler; +import de.intevation.flys.client.client.event.ParameterChangeEvent; +import de.intevation.flys.client.client.event.ParameterChangeHandler; import de.intevation.flys.client.client.event.StepForwardEvent; import de.intevation.flys.client.client.event.StepForwardHandler; -import de.intevation.flys.client.client.event.CollectionChangeHandler; import de.intevation.flys.client.client.services.ArtifactService; import de.intevation.flys.client.client.services.ArtifactServiceAsync; import de.intevation.flys.client.client.services.StepForwardService; @@ -47,6 +50,7 @@ public class CollectionView extends Window implements CollectionChangeHandler, HasCollectionChangeHandlers, + HasParameterChangeHandler, ParameterChangeHandler, StepForwardHandler { /** The ArtifactService used to communicate with the Artifact server. */ @@ -73,6 +77,9 @@ /** The list of ValueChangeHandlers.*/ protected List<CollectionChangeHandler> handlers; + /** The list of ParameterizationChangeHandler.*/ + protected List<ParameterChangeHandler> parameterHandlers; + /** The collection to be displayed.*/ protected Collection collection; @@ -101,13 +108,15 @@ this.flys = flys; this.collection = collection; - this.tabs = new TabSet(); - this.parameterTab = new Tab(messages.winfo()); - this.parameterList = new ParameterList(); - this.handlers = new ArrayList<CollectionChangeHandler>(); - this.layout = new VLayout(); + this.tabs = new TabSet(); + this.parameterTab = new Tab(messages.winfo()); + this.parameterList = new ParameterList(); + this.handlers = new ArrayList<CollectionChangeHandler>(); + this.parameterHandlers = new ArrayList<ParameterChangeHandler>(); + this.layout = new VLayout(); addCollectionChangeHandler(this); + addParameterChangeHandler(this); init(); } @@ -185,6 +194,18 @@ /** + * This method registers a new ParameterChangeHandler. + * + * @param handler The new ParameterChangeHandler. + */ + public void addParameterChangeHandler(ParameterChangeHandler handler) { + if (handler != null) { + parameterHandlers.add(handler); + } + } + + + /** * This method calls the <code>onValueChange()</code> method of all * registered ValueChangeHanders. */ @@ -198,6 +219,17 @@ /** + * This method calls the <code>onParameterChange()</code> method of all + * registered ParameterChangeHandler. + */ + protected void fireParameterChangeEvent(Artifact old, Artifact newArt) { + for (ParameterChangeHandler handler: parameterHandlers) { + handler.onParameterChange(new ParameterChangeEvent(old, newArt)); + } + } + + + /** * This method returns true, if the Collection is new and no plugins has * been chosen. * @@ -252,7 +284,6 @@ public void onSuccess(Artifact artifact) { GWT.log("Successfully created a new artifact."); - setArtifact(artifact); forwardService.go(serverUrl, artifact, feedData, new AsyncCallback<Artifact>() { @@ -281,7 +312,23 @@ * @param artifact The new artifact. */ protected void setArtifact(Artifact artifact) { + Artifact tmp = this.artifact; this.artifact = artifact; + + fireParameterChangeEvent(tmp, this.artifact); + } + + + /** + * Implements the onCollectionChange() method to do update the GUI after the + * parameterization has changed. + * + * @param event The ParameterChangeEvent. + */ + public void onParameterChange(ParameterChangeEvent event) { + + // TODO IMPLEMENT ME + updateView(); } @@ -303,6 +350,12 @@ } + /** + * This method is called if the user clicks on the 'next' button to advance + * to the next state. + * + * @param event The StepForwardEvent. + */ public void onStepForward(StepForwardEvent event) { GWT.log("CollectionView - onStepForward()"); GWT.log("TODO: IMPLEMENT FEED!"); @@ -313,8 +366,7 @@ * Update the view (refresh the list of old and current data). */ protected void updateView() { - GWT.log("Update view of the collection: " + collection.identifier()); - Artifact artifact = collection.getArtifact(0); + GWT.log("CollectionView.updateView()"); ArtifactDescription desc = artifact.getArtifactDescription(); Data currentData = desc.getCurrentData();