Mercurial > dive4elements > river
changeset 1267:07aa1f504491
Bugfix: #323 A double click in the datacage widget triggers the DatacageDoubleClickHandler.onDoubleClick() method of all registered handlers.
flys-client/trunk@2820 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 26 Sep 2011 09:08:47 +0000 |
parents | ff012a9d9d1d |
children | d0500e993218 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/event/DatacageDoubleClickHandler.java flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWindow.java |
diffstat | 4 files changed, 63 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Wed Sep 21 14:37:51 2011 +0000 +++ b/flys-client/ChangeLog Mon Sep 26 09:08:47 2011 +0000 @@ -1,3 +1,21 @@ +2011-09-26 Ingo Weinzierl <ingo@intevation.de> + + flys/issue323 (Datenkorb: Doppelklick im Datenkorb sollte gewähltes Thema (Themen) laden) + + * src/main/java/de/intevation/flys/client/client/event/DatacageDoubleClickHandler.java: + New. Interface for double click handlers used in the datacage. + + * src/main/java/de/intevation/flys/client/client/ui/DatacageWindow.java: + Implements the DatacageDoubleClickHandler. After a doubleClick event has + been received, the selected Themes from datacage widget are loaded and + the window is destroyed. + + * src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java: + A double click on a tree node triggers the onDoubleClick method for each + registered DatacageDoubleClickHandler. A DatacageDoubleClickHandler + may register itself via DatacageWidget.addDatacageDoubleClickHander() + method. + 2011-09-21 Felix Wolfsteller <felix.wolfsteller@intevation.de> Clone Subtrahend and Minuend in WDiff-branch of WINFO with waterlevelfactory.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/event/DatacageDoubleClickHandler.java Mon Sep 26 09:08:47 2011 +0000 @@ -0,0 +1,9 @@ +package de.intevation.flys.client.client.event; + +import de.intevation.flys.client.shared.model.ToLoad; + + +public interface DatacageDoubleClickHandler { + + void onDoubleClick(ToLoad toLoad); +}
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Wed Sep 21 14:37:51 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Mon Sep 26 09:08:47 2011 +0000 @@ -1,6 +1,7 @@ package de.intevation.flys.client.client.ui; import de.intevation.flys.client.client.event.DatacageHandler; +import de.intevation.flys.client.client.event.DatacageDoubleClickHandler; import com.google.gwt.core.client.GWT; @@ -64,11 +65,13 @@ protected ToLoad toLoad; - protected List<DatacageHandler> handlers; + protected List<DatacageHandler> handlers; + protected List<DatacageDoubleClickHandler> doubleHandlers; public DatacageWidget() { - handlers = new ArrayList<DatacageHandler>(); + handlers = new ArrayList<DatacageHandler>(); + doubleHandlers = new ArrayList<DatacageDoubleClickHandler>(); } @@ -170,6 +173,16 @@ /** + * @param h Handler to be added (notified on Double click on node). + */ + public void addDatacageDoubleClickHandler(DatacageDoubleClickHandler h) { + if (!doubleHandlers.contains(h)) { + doubleHandlers.add(h); + } + } + + + /** * @param handler Handler to remove from list. */ public void removeDatacageHandler(DatacageHandler handler) { @@ -235,11 +248,17 @@ } + protected void fireOnDoubleClick() { + for (DatacageDoubleClickHandler handler: doubleHandlers) { + handler.onDoubleClick(toLoad); + } + } + + protected void doubleClickedOnTree(RecordDoubleClickEvent event) { - TreeNode node = (TreeNode)event.getRecord(); collectToLoads(node); - destroy(); + fireOnDoubleClick(); }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWindow.java Wed Sep 21 14:37:51 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWindow.java Mon Sep 26 09:08:47 2011 +0000 @@ -13,6 +13,7 @@ import de.intevation.flys.client.client.FLYSConstants; import de.intevation.flys.client.client.event.DatacageHandler; +import de.intevation.flys.client.client.event.DatacageDoubleClickHandler; import de.intevation.flys.client.client.event.HasRedrawRequestHandlers; import de.intevation.flys.client.client.event.RedrawRequestHandler; import de.intevation.flys.client.client.event.RedrawRequestEvent; @@ -34,7 +35,9 @@ public class DatacageWindow extends Window -implements DatacageHandler, HasRedrawRequestHandlers +implements DatacageHandler, + DatacageDoubleClickHandler, + HasRedrawRequestHandlers { protected FLYSConstants messages = GWT.create(FLYSConstants.class); @@ -64,6 +67,7 @@ DatacageWidget dw = new DatacageWidget(artifact, user, outs); dw.addDatacageHandler(this); + dw.addDatacageDoubleClickHandler(this); addItem(dw); @@ -88,6 +92,14 @@ @Override + public void onDoubleClick(ToLoad toLoad) { + destroy(); + List<Recommendation> recs = toLoad.toRecommendations(); + loadArtifacts(recs.toArray(new Recommendation[recs.size()])); + } + + + @Override public void addRedrawRequestHandler(RedrawRequestHandler handler) { if (handler != null) { handlers.add(handler);