# HG changeset patch # User Ingo Weinzierl # Date 1308907222 0 # Node ID 854312c0528c67f7743a92ebdf30389e800aabb8 # Parent ea2191b1299d9fa2de637f35de7ce51d121879fa #21 Newly created projects cannot be opened twice. flys-client/trunk@2225 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r ea2191b1299d -r 854312c0528c flys-client/ChangeLog --- a/flys-client/ChangeLog Thu Jun 23 17:46:08 2011 +0000 +++ b/flys-client/ChangeLog Fri Jun 24 09:20:22 2011 +0000 @@ -1,3 +1,17 @@ +2011-06-24 Ingo Weinzierl + + flys/issue21 (Gleiches Projekt kann mehr als einmal gleichzeitig geƶffnet werden) + + * src/main/java/de/intevation/flys/client/client/FLYS.java: Implements + CollectionChangeHandler to lock new projects. In addition, there is a + new method to close projects. + + * src/main/java/de/intevation/flys/client/client/ui/CollectionView.java: + If this view contains a Collection, FLYS is used to close this window. + FLYS needs to unlock the project before the view is destroyed. + Otherwise - if no Collection has been created yet - this view destroys + itself. + 2011-06-23 Ingo Weinzierl flys/issue170 (Diagramm: Initiales Zoomen zeigt verschobenen Bereich) diff -r ea2191b1299d -r 854312c0528c flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Thu Jun 23 17:46:08 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Fri Jun 24 09:20:22 2011 +0000 @@ -25,6 +25,8 @@ import de.intevation.flys.client.shared.model.River; import de.intevation.flys.client.shared.model.User; +import de.intevation.flys.client.client.event.CollectionChangeEvent; +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.DescribeCollectionService; @@ -49,7 +51,7 @@ * * @author Ingo Weinzierl */ -public class FLYS implements EntryPoint { +public class FLYS implements EntryPoint, CollectionChangeHandler { /** The message class that provides i18n strings.*/ protected FLYSConstants MSG = GWT.create(FLYSConstants.class); @@ -382,6 +384,12 @@ } + public void closeProject(String uuid) { + unlockProject(uuid); + workspace.destroyProject(uuid); + } + + /** * Create a new Artifact. */ @@ -404,12 +412,22 @@ } + public void onCollectionChange(CollectionChangeEvent event) { + Collection oldC = event.getOldValue(); + + if (oldC == null) { + Collection newC = event.getNewValue(); + lockProject(newC.identifier()); + } + } + + /** * This CloseClickHandler is used to remove lock on a specific Collection so * that is might be opened again. */ - private class CloseCollectionViewHandler implements CloseClickHandler { + public class CloseCollectionViewHandler implements CloseClickHandler { protected FLYS flys; protected String uuid; @@ -419,8 +437,7 @@ } public void onCloseClick(CloseClientEvent event) { - flys.unlockProject(uuid); - workspace.removeProject(uuid); + flys.closeProject(uuid); } } } diff -r ea2191b1299d -r 854312c0528c 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 Jun 23 17:46:08 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Fri Jun 24 09:20:22 2011 +0000 @@ -114,6 +114,7 @@ addCollectionChangeHandler(this); addCollectionChangeHandler(parameterList); + addCollectionChangeHandler(flys); addOutputModesChangeHandler(this); addOutputModesChangeHandler(parameterList); addCloseClickHandler(this); @@ -139,6 +140,7 @@ addCollectionChangeHandler(this); addCollectionChangeHandler(parameterList); + addCollectionChangeHandler(flys); addOutputModesChangeHandler(this); addOutputModesChangeHandler(parameterList); addCloseClickHandler(this); @@ -493,8 +495,13 @@ public void onCloseClick(CloseClientEvent event) { - hide(); - destroy(); + if (collection != null) { + flys.closeProject(collection.identifier()); + } + else { + hide(); + destroy(); + } } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r ea2191b1299d -r 854312c0528c flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Thu Jun 23 17:46:08 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Fri Jun 24 09:20:22 2011 +0000 @@ -307,7 +307,10 @@ Axis xAxis = chartInfo.getXAxis(0); Axis yAxis = chartInfo.getYAxis(0); + GWT.log("ZOOM X"); double[] x = zoomAxis(xAxis, factor); + + GWT.log("ZOOM Y"); double[] y = zoomAxis(yAxis, factor); zoom[0] = x[0]; @@ -324,12 +327,16 @@ double min = axis.getFrom(); double max = axis.getTo(); + GWT.log("ZOOM CURRENT: " + min + " - " + max); + double add = (max - min) / 100 * factor; add = add < 0 ? (-1) * add : add; min -= add; max += add; + GWT.log("ZOOM TO: " + min + " - " + max); + return computeZoom(axis, min, max); }