# HG changeset patch # User Ingo Weinzierl # Date 1299764988 0 # Node ID 3cacc9d2dd015d8fbfddc1c4d46c6b4f3038d013 # Parent d692e2ff95e2da98f12653bba1370895fc75d472 CollectionView implements HasParameterChangeHandler and ParameterChangeHandler interfaces. flys-client/trunk@1457 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r d692e2ff95e2 -r 3cacc9d2dd01 flys-client/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java: diff -r d692e2ff95e2 -r 3cacc9d2dd01 flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.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 handlers; + /** The list of ParameterizationChangeHandler.*/ + protected List 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(); - this.layout = new VLayout(); + this.tabs = new TabSet(); + this.parameterTab = new Tab(messages.winfo()); + this.parameterList = new ParameterList(); + this.handlers = new ArrayList(); + this.parameterHandlers = new ArrayList(); + 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 onValueChange() method of all * registered ValueChangeHanders. */ @@ -198,6 +219,17 @@ /** + * This method calls the onParameterChange() 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() { @@ -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();