Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java @ 611:854312c0528c
#21 Newly created projects cannot be opened twice.
flys-client/trunk@2225 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 24 Jun 2011 09:20:22 +0000 |
parents | 9e30c776cbef |
children | 4e0b73b7113b |
line wrap: on
line diff
--- 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 <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ -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); } } }