This is an automated email from the git hooks/post-receive script. New commit to branch feature/list_screen_buttons in repository observe. See http://git.codelutin.com/observe.git commit 6101ffb81ab9202c758ccbf6f6eccc9c623e197c Author: Kevin Morin <morin@codelutin.com> Date: Thu Nov 5 18:37:30 2015 +0100 affichage des boutons dans la liste des marées --- .../fr/ird/observe/ObserveOpenDataManager.java | 33 ++++++++++++++++++++-- .../fr/ird/observe/ui/ObserveMainUIHandler.java | 3 ++ .../java/fr/ird/observe/ui/content/ContentUI.jaxx | 2 +- .../list/impl/seine/TripSeinesUIHandler.java | 6 ++-- .../open/impl/longline/TripLonglineUIHandler.java | 2 ++ .../open/impl/seine/TripSeineUIHandler.java | 2 ++ 6 files changed, 41 insertions(+), 7 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ObserveOpenDataManager.java b/observe-application-swing/src/main/java/fr/ird/observe/ObserveOpenDataManager.java index 46055b9..b809275 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ObserveOpenDataManager.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ObserveOpenDataManager.java @@ -5,6 +5,7 @@ import fr.ird.observe.services.dto.longline.TripLonglineDto; import fr.ird.observe.services.dto.referential.ProgramDto; import fr.ird.observe.services.dto.seine.RouteDto; import fr.ird.observe.services.dto.seine.TripSeineDto; +import org.jdesktop.beans.AbstractSerializableBean; import java.io.Closeable; import java.util.ArrayList; @@ -17,7 +18,16 @@ import java.util.List; * * @author Sylvain Bavencoff - bavencoff@codelutin.com */ -public class ObserveOpenDataManager implements Closeable { +public class ObserveOpenDataManager extends AbstractSerializableBean implements Closeable { + + public static final String PROPERTY_OPEN_PROGRAM = "openProgram"; + public static final String PROPERTY_OPEN_TRIP_SEINE = "openTripSeine"; + public static final String PROPERTY_OPEN_TRIP_LONGLINE = "openTripLongline"; + public static final String PROPERTY_OPEN_TRIP = "openTrip"; + public static final String PROPERTY_OPEN_ROUTE = "openRoute"; + public static final String PROPERTY_OPEN_ACTIVITY_SEINE = "openActivitySeine"; + public static final String PROPERTY_OPEN_ACTIVITY_LONGLINE = "openActivity"; + public static final String PROPERTY_OPEN_ACTIVITY = "openActivity"; protected String openProgramId; @@ -31,7 +41,6 @@ public class ObserveOpenDataManager implements Closeable { protected String openActivityLonglineId; - //Program public boolean canOpenProgram() { @@ -42,6 +51,7 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(programId, "id cant be null"); Preconditions.checkState(canOpenProgram(), "a trip is already opened"); openProgramId = programId; + firePropertyChange(PROPERTY_OPEN_PROGRAM, false, true); } public boolean isOpenProgram() { @@ -57,6 +67,7 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(programId, "id cant be null"); Preconditions.checkState(isOpenProgram(programId), "this program is not opened"); openProgramId = null; + firePropertyChange(PROPERTY_OPEN_PROGRAM, true, false); } // Trip Seine @@ -68,6 +79,8 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(tripSeineId, "id cant be null"); Preconditions.checkState(canOpenTripSeine(), "a trip is already opened"); openTripSeineId = tripSeineId; + firePropertyChange(PROPERTY_OPEN_TRIP_SEINE, false, true); + firePropertyChange(PROPERTY_OPEN_TRIP, false, true); } public boolean isOpenTripSeine() { @@ -83,6 +96,8 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(tripSeineId, "id cant be null"); Preconditions.checkState(isOpenTripSeine(tripSeineId), "this trip is not opened"); openTripSeineId = null; + firePropertyChange(PROPERTY_OPEN_TRIP_SEINE, true, false); + firePropertyChange(PROPERTY_OPEN_TRIP, true, false); } // Route @@ -96,6 +111,7 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(routeId, "id cant be null"); Preconditions.checkState(canOpenRoute(parentTripSeineId), "the trip is not opened or another route already opened"); openRouteId = routeId; + firePropertyChange(PROPERTY_OPEN_ROUTE, false, true); } public boolean isOpenRoute() { @@ -111,6 +127,7 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(routeId, "id cant be null"); Preconditions.checkState(isOpenRoute(routeId), "this route is not opened"); openRouteId = null; + firePropertyChange(PROPERTY_OPEN_ROUTE, true, false); } // Activity Seine @@ -124,6 +141,8 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(activitySeineId, "id cant be null"); Preconditions.checkState(canOpenActivitySeine(parentRouteId), "the route is not opened or another activity is already opened"); openActivitySeineId = activitySeineId; + firePropertyChange(PROPERTY_OPEN_ACTIVITY_SEINE, false, true); + firePropertyChange(PROPERTY_OPEN_ACTIVITY, false, true); } public boolean isOpenActivitySeine() { @@ -139,6 +158,8 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(activitySeineId, "id cant be null"); Preconditions.checkState(isOpenActivitySeine(activitySeineId), "this activity is not opened"); openActivitySeineId = null; + firePropertyChange(PROPERTY_OPEN_ACTIVITY_SEINE, true, false); + firePropertyChange(PROPERTY_OPEN_ACTIVITY, true, false); } // Trip Longline @@ -150,6 +171,8 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(tripLongLineId, "id cant be null"); Preconditions.checkState(canOpenTripLongline(), "a trip is already opened"); openTripLonglineId = tripLongLineId; + firePropertyChange(PROPERTY_OPEN_TRIP_LONGLINE, false, true); + firePropertyChange(PROPERTY_OPEN_TRIP, false, true); } public boolean isOpenTripLongline() { @@ -165,6 +188,8 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(tripLongLineId, "id cant be null"); Preconditions.checkState(isOpenTripLongline(tripLongLineId), "this trip is not opened"); openTripLonglineId = null; + firePropertyChange(PROPERTY_OPEN_TRIP_LONGLINE, true, false); + firePropertyChange(PROPERTY_OPEN_TRIP, true, false); } // Activity Longline @@ -178,6 +203,8 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(activityLonglineId, "id cant be null"); Preconditions.checkState(canOpenActivityLongline(parentTripLonglineId), "the trip is not opened or another activity is already opened"); openActivityLonglineId = activityLonglineId; + firePropertyChange(PROPERTY_OPEN_ACTIVITY_SEINE, false, true); + firePropertyChange(PROPERTY_OPEN_ACTIVITY, false, true); } public boolean isOpenActivityLongline() { @@ -193,6 +220,8 @@ public class ObserveOpenDataManager implements Closeable { Preconditions.checkNotNull(activityLonglineId, "id cant be null"); Preconditions.checkState(isOpenActivityLongline(activityLonglineId), "this activity is not opened"); openActivityLonglineId = null; + firePropertyChange(PROPERTY_OPEN_ACTIVITY_LONGLINE, true, false); + firePropertyChange(PROPERTY_OPEN_ACTIVITY, true, false); } public boolean isOpen(String openableId) { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUIHandler.java index 25cc31b..0bdc6a9 100755 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUIHandler.java @@ -21,6 +21,7 @@ */ package fr.ird.observe.ui; +import fr.ird.observe.ObserveOpenDataManager; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; @@ -222,6 +223,8 @@ public class ObserveMainUIHandler { ObserveTreeHelper treeHelper = new ObserveTreeHelper(); ObserveSwingDataSource source = context.getDataSource(); + // get it for it to be set in the context + ObserveOpenDataManager openDataManager = context.getOpenDataManager(); boolean open = context.getDataContext().getEnabled(); if (open) { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUI.jaxx index 74f2a1c..3894215 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUI.jaxx @@ -67,7 +67,7 @@ <DataContext id='dataContext' javaBean='getContextValue(DataContext.class)'/> - <ObserveOpenDataManager id='openDataManager' javaBean='getContextValue(ObserveOpenDataManager.class)'/> + <ObserveOpenDataManager id='openDataManager' initializer='getContextValue(ObserveOpenDataManager.class)'/> <ObserveTreeHelper id='treeHelper' initializer='getContextValue(ObserveTreeHelper.class)'/> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/seine/TripSeinesUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/seine/TripSeinesUIHandler.java index 062b87e..51fec20 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/seine/TripSeinesUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/seine/TripSeinesUIHandler.java @@ -58,9 +58,7 @@ public class TripSeinesUIHandler extends ContentListUIHandler<ProgramDto, TripSe @Override protected ContentMode getContentMode(DataContext dataContext) { - String openProgramId = dataContext.getOpenProgramId(); - - if (openProgramId == null) { + if (!getOpenDataManager().isOpenProgram()) { // pas de program ouvert (donc pas de maree ouverte) // on peut reouvrir une maree @@ -72,7 +70,7 @@ public class TripSeinesUIHandler extends ContentListUIHandler<ProgramDto, TripSe // il existe un maree ouverte // - if (dataContext.isSelectedOpen(ProgramDto.class)) { + if (getOpenDataManager().isOpenProgram(dataContext.getSelectedProgramId())) { // le program courant a une maree ouverte addInfoMessage(n("observe.tripSeine.message.active.found")); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java index 2b0eced..e0d7b45 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java @@ -78,6 +78,7 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline protected boolean doOpenData() { boolean result = getOpenDataManager().canOpenTripLongline(); if (result) { + getOpenDataManager().openProgram(getSelectedParentId()); getOpenDataManager().openTripLongline(getSelectedId()); } return result; @@ -88,6 +89,7 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline boolean result = getOpenDataManager().isOpenTripLongline(getSelectedId()); if (result) { getOpenDataManager().closeTripLongline(getSelectedId()); + getOpenDataManager().closeProgram(getSelectedParentId()); } return result; } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index faa8f50..9333155 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -77,6 +77,7 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { protected boolean doOpenData() { boolean result = getOpenDataManager().canOpenTripSeine(); if (result) { + getOpenDataManager().openProgram(getSelectedParentId()); getOpenDataManager().openTripSeine(getSelectedId()); } return result; @@ -87,6 +88,7 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { boolean result = getOpenDataManager().isOpenTripSeine(getSelectedId()); if (result) { getOpenDataManager().closeTripSeine(getSelectedId()); + getOpenDataManager().closeProgram(getSelectedParentId()); } return result; } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.