Sammoa-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
September 2012
- 4 participants
- 111 discussions
r561 - trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action
by fdesbois@users.forge.codelutin.com 10 Sep '12
by fdesbois@users.forge.codelutin.com 10 Sep '12
10 Sep '12
Author: fdesbois
Date: 2012-09-10 12:03:43 +0200 (Mon, 10 Sep 2012)
New Revision: 561
Url: http://forge.codelutin.com/repositories/revision/sammoa/561
Log:
little improvement
Modified:
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/AddAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BeginAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/CircleBackAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/EndAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/NextAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ObservationAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/StartAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/StopAction.java
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/AddAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/AddAction.java 2012-09-07 17:51:00 UTC (rev 560)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/AddAction.java 2012-09-10 10:03:43 UTC (rev 561)
@@ -45,7 +45,7 @@
public AddAction(JAXXContext context) {
super(Resource.getIcon("/icons/action-add.png"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.add.tip"));
- bindModelProperties(FlightUIModel.PROPERTY_FLIGHT_STATE);
+ bindModelProperty(FlightUIModel.PROPERTY_FLIGHT_STATE, false);
}
@Override
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java 2012-09-07 17:51:00 UTC (rev 560)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java 2012-09-10 10:03:43 UTC (rev 561)
@@ -80,12 +80,6 @@
return context.getContextValue(SammoaUIContext.class);
}
- protected void bindModelProperties(String... properties) {
- for (String property : properties) {
- bindModelProperty(property, false);
- }
- }
-
protected void bindModelProperty(String property, boolean all) {
NestedPropertyChangeListener listener =
new NestedPropertyChangeListener(enabledListener, property, all);
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BeginAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BeginAction.java 2012-09-07 17:51:00 UTC (rev 560)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BeginAction.java 2012-09-10 10:03:43 UTC (rev 561)
@@ -47,11 +47,9 @@
public BeginAction(JAXXContext context) {
super(_("sammoa.action.begin"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.begin.tip"));
- bindModelProperties(
- FlightUIModel.PROPERTY_FLIGHT_STATE,
- FlightUIModel.PROPERTY_CURRENT_ROUTE,
- FlightUIModel.PROPERTY_NEXT_TRANSECT + ".deleted"
- );
+ bindModelProperty(FlightUIModel.PROPERTY_FLIGHT_STATE, false);
+ bindModelProperty(FlightUIModel.PROPERTY_CURRENT_ROUTE, false);
+ bindModelProperty(FlightUIModel.PROPERTY_NEXT_TRANSECT + ".deleted", false);
}
@Override
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/CircleBackAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/CircleBackAction.java 2012-09-07 17:51:00 UTC (rev 560)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/CircleBackAction.java 2012-09-10 10:03:43 UTC (rev 561)
@@ -55,7 +55,7 @@
public CircleBackAction(JAXXContext context) {
super(CIRCLE_BACK_ICON, context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.circleBack.tip"));
- bindModelProperties(FlightUIModel.PROPERTY_CURRENT_ROUTE);
+ bindModelProperty(FlightUIModel.PROPERTY_CURRENT_ROUTE, false);
}
@Override
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/EndAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/EndAction.java 2012-09-07 17:51:00 UTC (rev 560)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/EndAction.java 2012-09-10 10:03:43 UTC (rev 561)
@@ -44,7 +44,7 @@
public EndAction(JAXXContext context) {
super(_("sammoa.action.end"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.end.tip"));
- bindModelProperties(FlightUIModel.PROPERTY_FLIGHT_STATE);
+ bindModelProperty(FlightUIModel.PROPERTY_FLIGHT_STATE, false);
}
@Override
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/NextAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/NextAction.java 2012-09-07 17:51:00 UTC (rev 560)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/NextAction.java 2012-09-10 10:03:43 UTC (rev 561)
@@ -44,8 +44,8 @@
public NextAction(JAXXContext context) {
super(_("sammoa.action.next"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.next.tip"));
- bindModelProperties(FlightUIModel.PROPERTY_FLIGHT_STATE,
- FlightUIModel.PROPERTY_NEXT_TRANSECT + ".deleted");
+ bindModelProperty(FlightUIModel.PROPERTY_FLIGHT_STATE, false);
+ bindModelProperty(FlightUIModel.PROPERTY_NEXT_TRANSECT + ".deleted", false);
}
@Override
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ObservationAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ObservationAction.java 2012-09-07 17:51:00 UTC (rev 560)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ObservationAction.java 2012-09-10 10:03:43 UTC (rev 561)
@@ -44,7 +44,7 @@
public ObservationAction(String name, JAXXContext context, Position position) {
super(name, context);
this.position = position;
- bindModelProperties(FlightUIModel.PROPERTY_FLIGHT_STATE);
+ bindModelProperty(FlightUIModel.PROPERTY_FLIGHT_STATE, false);
}
@Override
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/StartAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/StartAction.java 2012-09-07 17:51:00 UTC (rev 560)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/StartAction.java 2012-09-10 10:03:43 UTC (rev 561)
@@ -45,7 +45,7 @@
public StartAction(JAXXContext context) {
super(Resource.getIcon("/icons/playback_play.png"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.start.tip"));
- bindModelProperties(FlightUIModel.PROPERTY_FLIGHT_STATE);
+ bindModelProperty(FlightUIModel.PROPERTY_FLIGHT_STATE, false);
}
@Override
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/StopAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/StopAction.java 2012-09-07 17:51:00 UTC (rev 560)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/StopAction.java 2012-09-10 10:03:43 UTC (rev 561)
@@ -45,7 +45,7 @@
public StopAction(JAXXContext context) {
super(Resource.getIcon("/icons/playback_stop.png"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.stop.tip"));
- bindModelProperties(FlightUIModel.PROPERTY_FLIGHT_STATE);
+ bindModelProperty(FlightUIModel.PROPERTY_FLIGHT_STATE, false);
}
@Override
1
0
r560 - in trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing: . flight flight/action flight/bar flight/bar/onBoard flight/bar/validation flight/effort util
by fdesbois@users.forge.codelutin.com 07 Sep '12
by fdesbois@users.forge.codelutin.com 07 Sep '12
07 Sep '12
Author: fdesbois
Date: 2012-09-07 19:51:00 +0200 (Fri, 07 Sep 2012)
New Revision: 560
Url: http://forge.codelutin.com/repositories/revision/sammoa/560
Log:
fixes #1466 : remove validationBar from FlightBar, split in two different packages, one for each bar
fixes #1468 : set valid buttons labels depends on transect/route/observation in edition
Added:
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/DeviceStateLED.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBar.css
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBar.jaxx
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBarHandler.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBarModel.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/SoundPlayer.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBar.css
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBar.jaxx
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBarHandler.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/NestedPropertyChangeListener.java
Removed:
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/DeviceStateLED.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBar.css
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBar.jaxx
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBarHandler.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBarModel.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/SoundPlayer.java
Modified:
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/AudioCheck.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUI.jaxx
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/AudioCheck.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/AudioCheck.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/AudioCheck.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -27,25 +27,12 @@
import com.google.common.base.Throwables;
import fr.ulr.sammoa.application.device.audio.SammoaAudioReader;
import fr.ulr.sammoa.application.device.audio.SammoaAudioRecorder;
-import fr.ulr.sammoa.ui.swing.flight.bar.SoundPlayer;
+import fr.ulr.sammoa.ui.swing.flight.bar.validation.SoundPlayer;
import fr.ulr.sammoa.ui.swing.util.SammoaUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
-import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.Control;
-import javax.sound.sampled.Line;
import javax.sound.sampled.LineUnavailableException;
-import javax.sound.sampled.Mixer;
-import javax.sound.sampled.Port;
-import javax.sound.sampled.UnsupportedAudioFileException;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ButtonGroup;
@@ -56,6 +43,13 @@
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
//import javax.media.CannotRealizeException;
//import javax.media.NoPlayerException;
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUI.jaxx
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUI.jaxx 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUI.jaxx 2012-09-07 17:51:00 UTC (rev 560)
@@ -40,7 +40,6 @@
fr.ulr.sammoa.persistence.Observer
fr.ulr.sammoa.application.flightController.FlightState
fr.ulr.sammoa.ui.swing.SammoaUIContext
- fr.ulr.sammoa.ui.swing.flight.bar.FlightBar
fr.ulr.sammoa.ui.swing.flight.effort.EffortPanel
</import>
@@ -189,6 +188,6 @@
</JSplitPane>
- <FlightBar id='flightBar' constructorParams='this' constraints='BorderLayout.SOUTH'/>
+ <JComponent id='flightBar' initializer='getHandler().newFlightBar()' constraints='BorderLayout.SOUTH'/>
</JPanel>
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -105,6 +105,8 @@
import fr.ulr.sammoa.ui.swing.flight.action.ValidObservationAction;
import fr.ulr.sammoa.ui.swing.flight.action.ValidRouteAction;
import fr.ulr.sammoa.ui.swing.flight.action.ValidTransectAction;
+import fr.ulr.sammoa.ui.swing.flight.bar.onBoard.OnBoardBar;
+import fr.ulr.sammoa.ui.swing.flight.bar.validation.ValidationBar;
import fr.ulr.sammoa.ui.swing.flight.layer.BaseGeoPointLayer;
import fr.ulr.sammoa.ui.swing.flight.layer.LineGeoPointLayer;
import fr.ulr.sammoa.ui.swing.flight.layer.SimpleGeoPointLayer;
@@ -680,6 +682,16 @@
}
+ public JComponent newFlightBar() {
+ JComponent result;
+ if (getModel().isValidationMode()) {
+ result = new ValidationBar(ui);
+ } else {
+ result = new OnBoardBar(ui);
+ }
+ return result;
+ }
+
public ActionMap getActionMap() {
return ui.getActionMap();
}
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -23,15 +23,12 @@
*/
package fr.ulr.sammoa.ui.swing.flight.action;
-import com.google.common.base.Splitter;
import fr.ulr.sammoa.application.flightController.FlightController;
import fr.ulr.sammoa.ui.swing.SammoaUIContext;
import fr.ulr.sammoa.ui.swing.flight.FlightUIHandler;
import fr.ulr.sammoa.ui.swing.flight.FlightUIModel;
-import fr.ulr.sammoa.ui.swing.util.SammoaUtil;
+import fr.ulr.sammoa.ui.swing.util.NestedPropertyChangeListener;
import jaxx.runtime.JAXXContext;
-import org.jdesktop.beans.AbstractBean;
-import org.nuiton.topia.persistence.TopiaEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +36,6 @@
import javax.swing.Icon;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.Iterator;
/**
* Created: 03/07/12
@@ -86,94 +82,23 @@
protected void bindModelProperties(String... properties) {
for (String property : properties) {
- EnabledListener enabledListener = new EnabledListener(property);
- getModel().addPropertyChangeListener(enabledListener.getProperty(), enabledListener);
+ bindModelProperty(property, false);
}
}
- protected class EnabledListener implements PropertyChangeListener {
+ protected void bindModelProperty(String property, boolean all) {
+ NestedPropertyChangeListener listener =
+ new NestedPropertyChangeListener(enabledListener, property, all);
+ listener.init(getModel());
+ }
- protected String property;
+ protected PropertyChangeListener enabledListener = new PropertyChangeListener() {
- protected EnabledListener embeddedListener;
-
- public EnabledListener(String property) {
-
- if (logger.isDebugEnabled()) {
- logger.debug("[{}] New EnabledListener for property '{}'",
- BaseFlightAction.this.getClass().getSimpleName(),
- property);
- }
-
- // Init embeddedListener for nestedProperty
- if (property.contains(".")) {
- Iterator<String> it =
- Splitter.on(".").limit(2).split(property).iterator();
-
- // First element is the property
- this.property = it.next();
-
- // Next property is the nested one
- String nestedProperty = it.next();
- if (logger.isDebugEnabled()) {
- logger.debug("[{}] Add embedded EnabledListener for " +
- "nestedProperty '{}', this EnabledListener " +
- "attached to '{}'",
- new Object[] {
- BaseFlightAction.this.getClass().getSimpleName(),
- nestedProperty,
- this.property
- });
- }
- this.embeddedListener = new EnabledListener(nestedProperty);
-
- // Attach embedded on the current value from model
- Object currentValue =
- SammoaUtil.getPropertyValue(getModel(), this.property);
- attachEmbeddedListener(null, currentValue);
-
- } else {
- this.property = property;
- }
- }
-
- public String getProperty() {
- return property;
- }
-
@Override
public void propertyChange(PropertyChangeEvent evt) {
- if (embeddedListener != null) {
- attachEmbeddedListener(evt.getOldValue(), evt.getNewValue());
- }
setEnabled(checkEnabled());
}
+ };
- protected void attachEmbeddedListener(Object oldValue, Object newValue) {
-
- if (oldValue != null) {
- if (oldValue instanceof TopiaEntity) {
- TopiaEntity entity = (TopiaEntity) oldValue;
- entity.removePropertyChangeListener(embeddedListener.getProperty(), embeddedListener);
-
- } else if (oldValue instanceof AbstractBean) {
- AbstractBean entity = (AbstractBean) oldValue;
- entity.removePropertyChangeListener(embeddedListener.getProperty(), embeddedListener);
- }
- }
-
- if (newValue != null) {
- if (newValue instanceof TopiaEntity) {
- TopiaEntity entity = (TopiaEntity) newValue;
- entity.addPropertyChangeListener(embeddedListener.getProperty(), embeddedListener);
-
- } else if (newValue instanceof AbstractBean) {
- AbstractBean entity = (AbstractBean) newValue;
- entity.addPropertyChangeListener(embeddedListener.getProperty(), embeddedListener);
- }
- }
- }
- }
-
protected abstract boolean checkEnabled();
}
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -33,7 +33,6 @@
import fr.ulr.sammoa.ui.swing.flight.FlightUI;
import fr.ulr.sammoa.ui.swing.util.SammoaUtil;
import jaxx.runtime.JAXXContext;
-import org.nuiton.util.Resource;
import org.nuiton.validator.bean.list.BeanListValidator;
import org.nuiton.validator.bean.list.BeanListValidatorEvent;
import org.nuiton.validator.bean.list.BeanListValidatorListener;
@@ -54,7 +53,7 @@
protected Map<Class<?>, BeanListValidator<?>> validators = Maps.newHashMap();
public ValidAction(String name, JAXXContext context) {
- super(name, Resource.getIcon("/icons/action-tick.png"), context);
+ super(name, context);
}
protected ValidationService getValidationService() {
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -50,7 +50,7 @@
public ValidObservationAction(JAXXContext context) {
super(_("sammoa.action.validObservation"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.validObservation.tip"));
- bindModelProperties(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN + "." + Observation.PROPERTY_DELETED);
+ bindModelProperty(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN, true);
}
@Override
@@ -82,6 +82,9 @@
@Override
protected boolean checkEnabled() {
Observation observation = getModel().getObservationEditBean();
+ if (observation != null && logger.isDebugEnabled()) {
+ logger.debug("Check valid observation : {}", Observations.isValid(observation, getObservationValidator()));
+ }
return observation != null
&& Observations.isValid(observation, getObservationValidator());
}
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -54,8 +54,8 @@
public ValidRouteAction(JAXXContext context) {
super(_("sammoa.action.validRoute"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.validRoute.tip"));
- bindModelProperties(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN + ".deleted",
- FlightUIModel.PROPERTY_ROUTE_EDIT_BEAN + ".deleted");
+ bindModelProperty(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN, true);
+ bindModelProperty(FlightUIModel.PROPERTY_ROUTE_EDIT_BEAN, true);
}
@Override
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -59,9 +59,9 @@
public ValidTransectAction(JAXXContext context) {
super(_("sammoa.action.validTransect"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.validTransect.tip"));
- bindModelProperties(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN + ".deleted",
- FlightUIModel.PROPERTY_ROUTE_EDIT_BEAN + ".deleted",
- FlightUIModel.PROPERTY_TRANSECT_FLIGHT_EDIT_BEAN + ".deleted");
+ bindModelProperty(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN, true);
+ bindModelProperty(FlightUIModel.PROPERTY_ROUTE_EDIT_BEAN, true);
+ bindModelProperty(FlightUIModel.PROPERTY_TRANSECT_FLIGHT_EDIT_BEAN, true);
}
@Override
@@ -119,7 +119,6 @@
validatorIsAdjusting = true;
Route routeEditBean = getModel().getRouteEditBean();
-
getModel().setRouteEditBean(null);
// Reload all routes
Deleted: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/DeviceStateLED.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/DeviceStateLED.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/DeviceStateLED.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -1,102 +0,0 @@
-/*
- * #%L
- * SAMMOA :: UI Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 UMS 3462, Code Lutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-package fr.ulr.sammoa.ui.swing.flight.bar;
-
-import fr.ulr.sammoa.application.device.DeviceState;
-import fr.ulr.sammoa.application.device.DeviceStateEvent;
-import fr.ulr.sammoa.application.device.DeviceStateListener;
-import org.nuiton.util.Resource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-
-/**
- * Panel qui écoute l'état du peripherique pour afficher à l'utilsateur un voyant
- * lunineux dépendant de l'état du peripherique.
- * <p/>
- * Indicateurs pour l'état du peripherique
- * <ul>
- * <li>voyant gris : pas de peripherique
- * <li>voyant bleu : peripherique prêt
- * <li>voyant vert : enregistrement en cours
- * <li>voyant rouge clignotant : enregistrement mais pas de données
- * </ul>
- *
- * @author chatellier
- */
-public class DeviceStateLED extends JLabel implements DeviceStateListener {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 1L;
-
- private static final Logger logger = LoggerFactory.getLogger(DeviceStateLED.class);
-
- protected DeviceState state;
-
- protected static final ImageIcon NO_DEVICE_ICON = Resource.getIcon("/icons/device/nodevice.png");
-
- protected static final ImageIcon READY_ICON = Resource.getIcon("/icons/device/ready.png");
-
- protected static final ImageIcon RECORDING_ICON = Resource.getIcon("/icons/device/recording.png");
-
- protected static final ImageIcon NO_DATA_ICON = Resource.getIcon("/icons/device/nodata.gif");
-
- @Override
- public void stateChanged(DeviceStateEvent event) {
- setState(event.getNewValue());
- }
-
- public void setState(DeviceState state) {
- DeviceState oldValue = getState();
- this.state = state;
-
- if (oldValue != state) {
-
- logger.debug("[{}] Update LED status: {}",
- getClass().getSimpleName(), state);
-
- switch (state) {
- case UNAVAILABLE:
- setIcon(NO_DEVICE_ICON);
- break;
- case READY:
- setIcon(READY_ICON);
- break;
- case RUNNING:
- setIcon(RECORDING_ICON);
- break;
- case ERROR:
- setIcon(NO_DATA_ICON);
- break;
- }
- }
- }
-
- public DeviceState getState() {
- return state;
- }
-}
Deleted: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBar.css
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBar.css 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBar.css 2012-09-07 17:51:00 UTC (rev 560)
@@ -1,105 +0,0 @@
-/*
- * #%L
- * SAMMOA :: UI Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 UMS 3462, Code Lutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-#stateBar {
- background: {model.getEffortPanelColor()};
-}
-
-#clockTime {
- delay: 1000;
- pattern: "dd/MM/yyyy HH:mm:ss";
- visible: {!flightUIModel.isValidationMode()};
-}
-#audioTime {
- visible: {flightUIModel.isValidationMode()};
- text: {dateFormat.format(flightUIModel.getCurrentRoute().getBeginTime())};
-}
-
-#beginButton {
- _actionName: {"begin"};
-}
-
-#endButton {
- _actionName: {"end"};
-}
-
-#nextButton {
- _actionName: {"next"};
-}
-
-#effortButtonPanel {
- background: {model.getEffortPanelColor()};
-}
-
-#statusPanel {
- background: {model.getEffortPanelColor()};
-}
-
-#lblEffort {
- text: {flightUIModel.getFlightState().name()};
-}
-
-#lblTransect {
- text: {flightUIModel.getCurrentRoute().getTransectFlight().getTransect().getName()};
-}
-
-#lblStatus {
- text: {flightUIModel.getCurrentRoute().getRouteType().name()
- + (flightUIModel.getCurrentRoute().getEffortNumber() != null
- ? " " + flightUIModel.getCurrentRoute().getEffortNumber()
- : "")};
-}
-
-#lblObservation {
- text: {flightUIModel.getCurrentRoute().getTransectFlight().getTransect().getName()};
-}
-
-#cbPanel {
- background: {model.getEffortPanelColor()};
-}
-
-#gpsLED {
- text: "sammoa.statusBar.gps";
-}
-
-#audioLED {
- text: "sammoa.statusBar.audio";
-}
-
-#indicatorPanel {
- background: {model.getEffortPanelColor()};
-}
-
-#lblAlt {
- text: {model.getAlt()};
-}
-
-#lblSpeed {
- text: {model.getSpeed()};
-}
-
-#soundPlayer {
- enabled: {flightUIModel.getTransectFlightEditBean() != null};
-}
Deleted: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBar.jaxx
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBar.jaxx 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBar.jaxx 2012-09-07 17:51:00 UTC (rev 560)
@@ -1,132 +0,0 @@
-<!--
- #%L
- SAMMOA :: UI Swing
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 UMS 3462, Code Lutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JPanel id='statusBar' layout='{new GridLayout(0,1,0,0)}'>
-
- <import>
- java.text.SimpleDateFormat
- javax.swing.BoxLayout
- javax.swing.SwingConstants
- jaxx.runtime.swing.ClockWidget
-
- fr.ulr.sammoa.ui.swing.flight.FlightUIModel
- </import>
-
- <script><![CDATA[
-
- protected void $afterCompleteSetup() {
- getHandler().init();
- }
-
- ]]></script>
-
- <FlightBarHandler id='handler' constructorParams='this'/>
-
- <FlightUIModel id='flightUIModel' initializer='getHandler().getParentUI().getModel()'/>
-
- <FlightBarModel id='model'/>
-
- <SimpleDateFormat id='dateFormat' constructorParams='"dd/MM/yyyy HH:mm:ss"'/>
-
- <Table id='validationBar'>
- <row>
-<!-- <cell fill='horizontal' weightx='0.2'>
- <JPanel id='audioButtonPanel'
- layout='{new BoxLayout(audioButtonPanel, BoxLayout.X_AXIS)}'>
- <JButton id='startAudioButton'/>
- <JButton id='stopAudioButton'/>
- </JPanel>
- </cell>-->
- <cell fill='horizontal'>
- <SoundPlayer id='soundPlayer'/>
- </cell>
- <cell fill='horizontal' weightx='0.2'>
- <JPanel id='validButtonPanel'
- layout='{new BoxLayout(validButtonPanel, BoxLayout.X_AXIS)}'>
- <JButton id='validRouteButton'/>
- <JButton id='validObservationButton'/>
- <JButton id='validTransectButton'/>
- </JPanel>
- </cell>
- </row>
- </Table>
- <Table id='stateBar'>
- <row>
- <cell fill='horizontal' weightx='0.2'>
- <ClockWidget id='clockTime'/>
- </cell>
- <cell fill='horizontal' weightx='0.2'>
- <JLabel id='audioTime'/>
- </cell>
- <cell fill='vertical'>
- <JSeparator constructorParams='SwingConstants.VERTICAL'/>
- </cell>
- <cell fill='horizontal'>
- <JPanel id='effortButtonPanel'
- layout='{new BoxLayout(effortButtonPanel, BoxLayout.X_AXIS)}'>
- <JButton id='beginButton'/>
- <JButton id='endButton'/>
- <JButton id='nextButton'/>
- </JPanel>
- </cell>
- <cell fill='vertical'>
- <JSeparator constructorParams='SwingConstants.VERTICAL'/>
- </cell>
- <cell fill='horizontal' weightx='0.2' anchor='center'>
- <JLabel id='lblEffort'/>
- </cell>
- <cell fill='vertical'>
- <JSeparator constructorParams='SwingConstants.VERTICAL'/>
- </cell>
- <cell fill='horizontal' weightx='0.2' anchor='center'>
- <JLabel id='lblTransect'/>
- </cell>
- <cell fill='vertical'>
- <JSeparator constructorParams='SwingConstants.VERTICAL'/>
- </cell>
- <cell fill='horizontal' weightx='0.2' anchor='center'>
- <JLabel id='lblStatus'/>
- </cell>
- <cell fill='vertical'>
- <JSeparator constructorParams='SwingConstants.VERTICAL'/>
- </cell>
- <cell fill='horizontal' weightx='0.2' anchor='center'>
- <JPanel id='cbPanel' layout='{new BoxLayout(cbPanel, BoxLayout.Y_AXIS)}'>
- <DeviceStateLED id='gpsLED' />
- <DeviceStateLED id='audioLED' />
- </JPanel>
- </cell>
- <cell fill='vertical'>
- <JSeparator constructorParams='SwingConstants.VERTICAL'/>
- </cell>
- <cell fill='horizontal' weightx='0.2' anchor='center'>
- <JPanel id='indicatorPanel'
- layout='{new BoxLayout(indicatorPanel, BoxLayout.Y_AXIS)}'>
- <JLabel id='lblAlt'/>
- <JLabel id='lblSpeed'/>
- </JPanel>
- </cell>
- </row>
- </Table>
-</JPanel>
Deleted: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBarHandler.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBarHandler.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBarHandler.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -1,136 +0,0 @@
-/*
- * #%L
- * SAMMOA :: UI Swing
- * *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 UMS 3462, Code Lutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-package fr.ulr.sammoa.ui.swing.flight.bar;
-
-import fr.ulr.sammoa.application.device.audio.AudioReader;
-import fr.ulr.sammoa.application.device.audio.AudioRecorder;
-import fr.ulr.sammoa.application.device.gps.GpsHandler;
-import fr.ulr.sammoa.application.flightController.FlightController;
-import fr.ulr.sammoa.application.flightController.FlightState;
-import fr.ulr.sammoa.persistence.Route;
-import fr.ulr.sammoa.ui.swing.SammoaColors;
-import fr.ulr.sammoa.ui.swing.flight.FlightUI;
-import fr.ulr.sammoa.ui.swing.flight.FlightUIHandler;
-import fr.ulr.sammoa.ui.swing.flight.FlightUIModel;
-import jaxx.runtime.JAXXUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-/** @author sletellier <letellier(a)codelutin.com> */
-public class FlightBarHandler implements PropertyChangeListener {
-
- private static final Logger logger =
- LoggerFactory.getLogger(FlightBarHandler.class);
-
- protected final FlightBar ui;
-
- public FlightBarHandler(FlightBar ui) {
- this.ui = ui;
- }
-
- public FlightUI getParentUI() {
- return ui.getContextValue(FlightUI.class, JAXXUtil.PARENT);
- }
-
- protected FlightBarModel getModel() {
- return ui.getModel();
- }
-
- public void init() {
-
- FlightUIModel flightUIModel = ui.getFlightUIModel();
- flightUIModel.addPropertyChangeListener(this);
-
-
- FlightController flightController =
- ui.getContextValue(FlightUIHandler.class).getFlightController();
-
- if (flightUIModel.isValidationMode()) {
-
- // Put actionName for validation buttons
-// ui.getStartAudioButton().putClientProperty("actionName", "startAudio");
-// ui.getStopAudioButton().putClientProperty("actionName", "stopAudio");
- ui.getValidObservationButton().putClientProperty("actionName", "validObservation");
- ui.getValidRouteButton().putClientProperty("actionName", "validRoute");
- ui.getValidTransectButton().putClientProperty("actionName", "validTransect");
-
- AudioReader audioReader = flightController.getDeviceManager(AudioReader.class);
- ui.getSoundPlayer().setReader(audioReader);
-
- } else {
-
- // Remove the bar used only for validation
- ui.remove(ui.getValidationBar());
-
- AudioRecorder audioRecorder = flightController.getDeviceManager(AudioRecorder.class);
- ui.getAudioLED().setState(audioRecorder.getState());
- audioRecorder.addDeviceStateListener(ui.getAudioLED());
-
- GpsHandler gpsHandler = flightController.getDeviceManager(GpsHandler.class);
- ui.getGpsLED().setState(gpsHandler.getState());
- gpsHandler.addDeviceStateListener(ui.getGpsLED());
- gpsHandler.addGpsLocationListener(getModel());
- }
-
- if (FlightState.OFF_EFFORT.equals(ui.getFlightUIModel().getFlightState())) {
- getModel().setEffortPanelColor(SammoaColors.ON_EFFORT_BACKGROUND_COLOR);
- }
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- String propertyName = evt.getPropertyName();
-
- if (FlightUIModel.PROPERTY_FLIGHT_STATE.equals(propertyName)) {
-
- logger.debug("Modify flight bar background color");
-
- // si l'etat du vol passe en off effort
- // affiche à l'utilisateur
- FlightState newState = (FlightState) evt.getNewValue();
- if (FlightState.OFF_EFFORT.equals(newState)) {
- getModel().setEffortPanelColor(SammoaColors.ON_EFFORT_BACKGROUND_COLOR);
-
- } else {
- getModel().setEffortPanelColor(null);
- }
-
- } else if (FlightUIModel.PROPERTY_CURRENT_ROUTE.equals(propertyName)) {
-
- Route route = (Route) evt.getNewValue();
-
- logger.debug("New value received for current route {}", route);
-
- if (route == null || route.getTransectFlight() == null) {
- // set null will hide label
- ui.getLblTransect().setText(null);
- }
-
- }
- }
-}
Deleted: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBarModel.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBarModel.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBarModel.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -1,91 +0,0 @@
-/*
- * #%L
- * SAMMOA :: UI Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 UMS 3462, Code Lutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-package fr.ulr.sammoa.ui.swing.flight.bar;
-
-import fr.ulr.sammoa.application.device.gps.GpsLocationEvent;
-import fr.ulr.sammoa.application.device.gps.GpsLocationListener;
-import fr.ulr.sammoa.persistence.GeoPoint;
-import org.jdesktop.beans.AbstractSerializableBean;
-
-import java.awt.Color;
-
-import static org.nuiton.i18n.I18n._;
-
-/** @author sletellier <letellier(a)codelutin.com> */
-public class FlightBarModel extends AbstractSerializableBean implements GpsLocationListener {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_ALT = "alt";
-
- public static final String PROPERTY_SPEED = "speed";
-
- public static final String PROPERTY_EFFORT_PANEL_COLOR = "effortPanelColor";
-
- protected float alt;
-
- protected float speed;
-
- protected Color effortPanelColor;
-
- public String getAlt() {
- return _("sammoa.statusbar.alt", alt);
- }
-
- public void setAlt(float alt) {
- float oldValue = this.alt;
- this.alt = alt;
- firePropertyChange(PROPERTY_ALT, oldValue, alt);
- }
-
- public String getSpeed() {
- return _("sammoa.statusbar.speed", speed);
- }
-
- public void setSpeed(float speed) {
- float oldValue = this.speed;
- this.speed = speed;
- firePropertyChange(PROPERTY_SPEED, oldValue, speed);
- }
-
- public Color getEffortPanelColor() {
- return effortPanelColor;
- }
-
- public void setEffortPanelColor(Color effortPanelColor) {
- Color oldColor = this.effortPanelColor;
- this.effortPanelColor = effortPanelColor;
- firePropertyChange(PROPERTY_EFFORT_PANEL_COLOR, oldColor, this.effortPanelColor);
- }
-
- @Override
- public void locationChanged(GpsLocationEvent event) {
- GeoPoint newLocation = event.getNewValue();
- if (newLocation != null) {
- setSpeed((float) newLocation.getSpeed());
- setAlt((float) newLocation.getAltitude());
- }
- }
-}
Deleted: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/SoundPlayer.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/SoundPlayer.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/SoundPlayer.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -1,355 +0,0 @@
-package fr.ulr.sammoa.ui.swing.flight.bar;
-
-/*
- * #%L
- * SAMMOA :: UI Swing
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 UMS 3462, Code Lutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ulr.sammoa.application.device.DeviceState;
-import fr.ulr.sammoa.application.device.DeviceStateEvent;
-import fr.ulr.sammoa.application.device.DeviceStateListener;
-import fr.ulr.sammoa.application.device.audio.AudioPositionListener;
-import fr.ulr.sammoa.application.device.audio.AudioReader;
-import fr.ulr.sammoa.application.device.audio.SammoaAudioReader;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.time.FastDateFormat;
-
-import javax.sound.sampled.LineUnavailableException;
-import javax.sound.sampled.UnsupportedAudioFileException;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JSlider;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Hashtable;
-
-/**
- * Composant qui permet de charge un fichier audio et de le jouer. On peut se
- * placer ou l'on veut dans le fichier audio.
- *
- * usage:
- * <li> SoundPlayer sp = new SoundPlayer();
- * <li> panel.add(sp);
- * <li> sp.load(myFileWav);
- *
- * Created: 03 septembre 2012
- *
- * @author Benjamin POUSSIN <poussin(a)codelutin.com>
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-public class SoundPlayer extends JComponent implements DeviceStateListener, AudioPositionListener {
- protected AudioReader reader;
-
- // le fichier charge acutellement au niveau de l'ui (config du slider
- protected File currentFile;
-
- // The following fields are for the GUI
- protected JButton play; // The Play button
- protected JButton stop; // The Stop button
- protected JSlider progress; // Shows and sets current position in sound
- protected JLabel time; // Displays audioPosition as a number
-
- protected FastDateFormat dateFormat = FastDateFormat.getInstance("HH:mm");
- protected FastDateFormat longDateFormat = FastDateFormat.getInstance("HH:mm:ss");
-
- // Create a SoundPlayer component for the specified file.
- public SoundPlayer() {
- this(null);
- }
-
- public SoundPlayer(AudioReader reader) {
- initUI();
- setReader(reader);
- }
-
- protected void initUI() {
- // Now create the basic GUI
- play = new JButton("Play");
- play.setEnabled(false);
- stop = new JButton("Stop");
- stop.setEnabled(false);
-
- progress = new JSlider(0, 0, 0);
- progress.setMajorTickSpacing(60000); // toutes les 60s
- progress.setMinorTickSpacing(10000); // toutes les 10s
- progress.setPaintTicks(true);
- progress.setPaintLabels(true);
-
- time = new JLabel("00:00:00"); // Shows position as a #
-
- // put those controls in a row
- Box row = Box.createHorizontalBox();
-
- Box buttons = Box.createVerticalBox();
- buttons.add(play);
- buttons.add(stop);
-
- row.add(buttons);
- row.add(progress);
-
- Box timeBox = Box.createVerticalBox();
- timeBox.add(time);
- timeBox.add(Box.createVerticalGlue());
-
- row.add(timeBox);
-
- // And add them to this component.
- setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
- this.add(row);
-
- // ADD LISTENER
-
- // When clicked, start or stop playing the sound
- play.addActionListener(new ActionListener( ) {
- public void actionPerformed(ActionEvent e) {
- play();
- }
- });
-
- // When clicked, start or stop playing the sound
- stop.addActionListener(new ActionListener( ) {
- public void actionPerformed(ActionEvent e) {
- stop();
- }
- });
-
- progress.addMouseListener(new MouseAdapter() {
- boolean inPlay = false;
-
- @Override
- public void mousePressed(MouseEvent e) {
- inPlay= getAudioReader().getState() == DeviceState.RUNNING;
- if (inPlay) {
- reader.stop();
- }
- }
-
- @Override
- public void mouseReleased(MouseEvent e) {
- int value = progress.getValue( );
- // Update the time label
-// time.setText(value/1000 + "." + (value%1000)/100);
- // If we're not already there, skip there.
- if (value >= 0 && value <= reader.getLength()) {
- reader.setPosition(value);
- }
-
- if (inPlay) {
- reader.start();
- }
- }
- });
-
- // Whenever the slider value changes, update the time label.
- progress.addChangeListener(new ChangeListener( ) {
- public void stateChanged(ChangeEvent e) {
- // changement du text de position
- Date date = getAudioReader().getStartDate();
- long start = 0;
- if (date != null) {
- start = date.getTime();
- }
- int value = progress.getValue();
- String timeString = longDateFormat.format(start + value);
- time.setText(timeString);
- }
- });
- }
-
- @Override
- public void stateChanged(DeviceStateEvent event) {
- DeviceState state = event.getNewValue();
- switch (state) {
- case READY: // on vient de charger un fichier, ou arrete la lecture du fichier
- play.setEnabled(true);
- stop.setEnabled(false);
- progress.setEnabled(true);
- changeSliderInfo();
- break;
- case RUNNING: // un fichier est en cours de lecture
- play.setEnabled(false);
- stop.setEnabled(true);
- progress.setEnabled(true);
- break;
- case UNAVAILABLE: // aucun fichier charge
- play.setEnabled(false);
- stop.setEnabled(false);
- progress.setEnabled(false);
- changeSliderInfo();
- break;
- case ERROR: // erreur sur le lecture audio (erreur I/O)
- play.setEnabled(false);
- stop.setEnabled(false);
- progress.setEnabled(false);
- changeSliderInfo();
- break;
- }
- }
-
- /**
- * On met a la seconde dans le slider
- */
- protected void changeSliderInfo() {
- Date date = getAudioReader().getStartDate();
- long start = date == null ? 0 : date.getTime();
-
- long audioLength = getAudioReader().getLength();
- int max = (int)audioLength;
- // si la longueur du morceau change, on change l'info affichee
- if (progress.getMaximum() != max) {
- progress.setValue((int)getAudioReader().getPosition());
- progress.setMaximum(max);
-
- // calcul de l'espace entre chaque affichage de l'heure en fonction de la longueur du slider
- double width = progress.getSize().getWidth();
- long step = audioLength * 100 / (long)width; // on minimum tous les 100px
- step = Math.max(step, 60000); // on prend pas en dessous de la minute
-
- //Create the label table
- Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
- labelTable.put( 0, new JLabel(dateFormat.format(start)) );
- for (int i = (int)step; i+step<max; i+=step) { // on ne met pas l'avant dernier vu qu'on met max ensuite
- labelTable.put( i, new JLabel(dateFormat.format(start + i)) );
- }
- labelTable.put( max, new JLabel(dateFormat.format(start + audioLength)) );
- progress.setLabelTable( labelTable );
- }
- }
-
- public JButton getPlayButton() {
- return play;
- }
-
- public JButton getStopButton() {
- return stop;
- }
-
- @Override
- public void positionChanged(AudioReader source, long audioPosition) {
- // changement de la position du slider
- int pos = (int)audioPosition;
- progress.setValue(pos);
- }
-
- public void setReader(AudioReader reader) {
- if (this.reader != null) {
- this.reader.removeAudioPositionListener(this);
- this.reader.removeDeviceStateListener(this);
- }
- this.reader = reader;
- if (this.reader != null) {
- reader.addDeviceStateListener(this);
- reader.addAudioPositionListener(this);
- }
-
- }
-
- /**
- * retourne le lecture utilise par ce composant
- * @return
- */
- public AudioReader getAudioReader() {
- return reader;
- }
-
-// /**
-// * Charge un nouveau fichier
-// * @param f le fichier a charger
-// */
-// public void loadFile(File f) {
-// getAudioReader().load(f);
-// }
-//
-// /**
-// * Donne la position actuelle de la lecture en milliseconde
-// * @return
-// */
-// public long getPosition() {
-// return getAudioReader().getPosition();
-// }
-//
-// /**
-// * Donne la longueur total du fichier en milliseconde
-// * @return
-// */
-// public long getLength() {
-// return getAudioReader().getLength();
-// }
-
- /**
- * Start playing the sound at the current position
- */
- public void play() {
- getAudioReader().start();
- }
-
- /**
- * Stop playing the sound, but retain the current position
- */
- public void stop() {
- getAudioReader().stop();
- }
-
- // The main method just creates a SoundPlayer in a Frame and displays it
- public static void main(String[] args)
- throws IOException, UnsupportedAudioFileException, LineUnavailableException {
- SoundPlayer player;
-
- File file;
- if (args.length == 0) {
- file = new File("/tmp/junkk.wav");
- } else {
- file = new File(args[0]);
- }
-
- // Create a SoundPlayer object to play the sound.
- player = new SoundPlayer();
- AudioReader reader = new SammoaAudioReader();
- player.setReader(reader);
- reader.load(file, new Date());
-
- // Put it in a window and play it
- JFrame f = new JFrame("SoundPlayer");
- f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- f.getContentPane().add(player, "Center");
- f.pack();
- f.setVisible(true);
- }
-
- public void audioChanged(AudioReader source, long audioLength) {
- // A SUPPRIMER
- }
-}
\ No newline at end of file
Copied: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/DeviceStateLED.java (from rev 559, trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/DeviceStateLED.java)
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/DeviceStateLED.java (rev 0)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/DeviceStateLED.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -0,0 +1,102 @@
+/*
+ * #%L
+ * SAMMOA :: UI Swing
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 UMS 3462, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+package fr.ulr.sammoa.ui.swing.flight.bar.onBoard;
+
+import fr.ulr.sammoa.application.device.DeviceState;
+import fr.ulr.sammoa.application.device.DeviceStateEvent;
+import fr.ulr.sammoa.application.device.DeviceStateListener;
+import org.nuiton.util.Resource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+
+/**
+ * Panel qui écoute l'état du peripherique pour afficher à l'utilsateur un voyant
+ * lunineux dépendant de l'état du peripherique.
+ * <p/>
+ * Indicateurs pour l'état du peripherique
+ * <ul>
+ * <li>voyant gris : pas de peripherique
+ * <li>voyant bleu : peripherique prêt
+ * <li>voyant vert : enregistrement en cours
+ * <li>voyant rouge clignotant : enregistrement mais pas de données
+ * </ul>
+ *
+ * @author chatellier
+ */
+public class DeviceStateLED extends JLabel implements DeviceStateListener {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 1L;
+
+ private static final Logger logger = LoggerFactory.getLogger(DeviceStateLED.class);
+
+ protected DeviceState state;
+
+ protected static final ImageIcon NO_DEVICE_ICON = Resource.getIcon("/icons/device/nodevice.png");
+
+ protected static final ImageIcon READY_ICON = Resource.getIcon("/icons/device/ready.png");
+
+ protected static final ImageIcon RECORDING_ICON = Resource.getIcon("/icons/device/recording.png");
+
+ protected static final ImageIcon NO_DATA_ICON = Resource.getIcon("/icons/device/nodata.gif");
+
+ @Override
+ public void stateChanged(DeviceStateEvent event) {
+ setState(event.getNewValue());
+ }
+
+ public void setState(DeviceState state) {
+ DeviceState oldValue = getState();
+ this.state = state;
+
+ if (oldValue != state) {
+
+ logger.debug("[{}] Update LED status: {}",
+ getClass().getSimpleName(), state);
+
+ switch (state) {
+ case UNAVAILABLE:
+ setIcon(NO_DEVICE_ICON);
+ break;
+ case READY:
+ setIcon(READY_ICON);
+ break;
+ case RUNNING:
+ setIcon(RECORDING_ICON);
+ break;
+ case ERROR:
+ setIcon(NO_DATA_ICON);
+ break;
+ }
+ }
+ }
+
+ public DeviceState getState() {
+ return state;
+ }
+}
Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/DeviceStateLED.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBar.css (from rev 559, trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBar.css)
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBar.css (rev 0)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBar.css 2012-09-07 17:51:00 UTC (rev 560)
@@ -0,0 +1,97 @@
+/*
+ * #%L
+ * SAMMOA :: UI Swing
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 UMS 3462, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+#stateBar {
+ background: {model.getEffortPanelColor()};
+}
+
+#clockTime {
+ delay: 1000;
+ pattern: "dd/MM/yyyy HH:mm:ss";
+ visible: {!flightUIModel.isValidationMode()};
+}
+
+#beginButton {
+ _actionName: {"begin"};
+}
+
+#endButton {
+ _actionName: {"end"};
+}
+
+#nextButton {
+ _actionName: {"next"};
+}
+
+#effortButtonPanel {
+ background: {model.getEffortPanelColor()};
+}
+
+#statusPanel {
+ background: {model.getEffortPanelColor()};
+}
+
+#lblEffort {
+ text: {flightUIModel.getFlightState().name()};
+}
+
+#lblTransect {
+ text: {flightUIModel.getCurrentRoute().getTransectFlight().getTransect().getName()};
+}
+
+#lblStatus {
+ text: {flightUIModel.getCurrentRoute().getRouteType().name()
+ + (flightUIModel.getCurrentRoute().getEffortNumber() != null
+ ? " " + flightUIModel.getCurrentRoute().getEffortNumber()
+ : "")};
+}
+
+#lblObservation {
+ text: {flightUIModel.getCurrentRoute().getTransectFlight().getTransect().getName()};
+}
+
+#cbPanel {
+ background: {model.getEffortPanelColor()};
+}
+
+#gpsLED {
+ text: "sammoa.statusBar.gps";
+}
+
+#audioLED {
+ text: "sammoa.statusBar.audio";
+}
+
+#indicatorPanel {
+ background: {model.getEffortPanelColor()};
+}
+
+#lblAlt {
+ text: {model.getAlt()};
+}
+
+#lblSpeed {
+ text: {model.getSpeed()};
+}
Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBar.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBar.jaxx
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBar.jaxx (rev 0)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBar.jaxx 2012-09-07 17:51:00 UTC (rev 560)
@@ -0,0 +1,104 @@
+<!--
+ #%L
+ SAMMOA :: UI Swing
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 UMS 3462, Code Lutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<Table id='stateBar'>
+
+ <import>
+ javax.swing.BoxLayout
+ javax.swing.SwingConstants
+ jaxx.runtime.swing.ClockWidget
+
+ fr.ulr.sammoa.ui.swing.flight.FlightUIModel
+ </import>
+
+ <script><![CDATA[
+
+ protected void $afterCompleteSetup() {
+ getHandler().afterInitUI();
+ }
+
+ ]]></script>
+
+ <OnBoardBarHandler id='handler'
+ constructorParams='this'/>
+
+ <FlightUIModel id='flightUIModel'
+ initializer='getHandler().getParentUI().getModel()'/>
+
+ <OnBoardBarModel id='model'/>
+
+ <row>
+ <cell fill='horizontal' weightx='0.2'>
+ <ClockWidget id='clockTime'/>
+ </cell>
+ <cell fill='vertical'>
+ <JSeparator constructorParams='SwingConstants.VERTICAL'/>
+ </cell>
+ <cell fill='horizontal'>
+ <JPanel id='effortButtonPanel'
+ layout='{new BoxLayout(effortButtonPanel, BoxLayout.X_AXIS)}'>
+ <JButton id='beginButton'/>
+ <JButton id='endButton'/>
+ <JButton id='nextButton'/>
+ </JPanel>
+ </cell>
+ <cell fill='vertical'>
+ <JSeparator constructorParams='SwingConstants.VERTICAL'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.2' anchor='center'>
+ <JLabel id='lblEffort'/>
+ </cell>
+ <cell fill='vertical'>
+ <JSeparator constructorParams='SwingConstants.VERTICAL'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.2' anchor='center'>
+ <JLabel id='lblTransect'/>
+ </cell>
+ <cell fill='vertical'>
+ <JSeparator constructorParams='SwingConstants.VERTICAL'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.2' anchor='center'>
+ <JLabel id='lblStatus'/>
+ </cell>
+ <cell fill='vertical'>
+ <JSeparator constructorParams='SwingConstants.VERTICAL'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.2' anchor='center'>
+ <JPanel id='cbPanel' layout='{new BoxLayout(cbPanel, BoxLayout.Y_AXIS)}'>
+ <DeviceStateLED id='gpsLED' />
+ <DeviceStateLED id='audioLED' />
+ </JPanel>
+ </cell>
+ <cell fill='vertical'>
+ <JSeparator constructorParams='SwingConstants.VERTICAL'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.2' anchor='center'>
+ <JPanel id='indicatorPanel'
+ layout='{new BoxLayout(indicatorPanel, BoxLayout.Y_AXIS)}'>
+ <JLabel id='lblAlt'/>
+ <JLabel id='lblSpeed'/>
+ </JPanel>
+ </cell>
+ </row>
+</Table>
Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBar.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBarHandler.java (from rev 559, trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBarHandler.java)
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBarHandler.java (rev 0)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBarHandler.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -0,0 +1,115 @@
+/*
+ * #%L
+ * SAMMOA :: UI Swing
+ * *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 UMS 3462, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+package fr.ulr.sammoa.ui.swing.flight.bar.onBoard;
+
+import fr.ulr.sammoa.application.device.audio.AudioRecorder;
+import fr.ulr.sammoa.application.device.gps.GpsHandler;
+import fr.ulr.sammoa.application.flightController.FlightController;
+import fr.ulr.sammoa.application.flightController.FlightState;
+import fr.ulr.sammoa.persistence.Route;
+import fr.ulr.sammoa.ui.swing.SammoaColors;
+import fr.ulr.sammoa.ui.swing.flight.FlightUI;
+import fr.ulr.sammoa.ui.swing.flight.FlightUIModel;
+import jaxx.runtime.JAXXUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+/** @author sletellier <letellier(a)codelutin.com> */
+public class OnBoardBarHandler implements PropertyChangeListener {
+
+ private static final Logger logger =
+ LoggerFactory.getLogger(OnBoardBarHandler.class);
+
+ protected final OnBoardBar ui;
+
+ public OnBoardBarHandler(OnBoardBar ui) {
+ this.ui = ui;
+ }
+
+ public FlightUI getParentUI() {
+ return ui.getContextValue(FlightUI.class, JAXXUtil.PARENT);
+ }
+
+ protected OnBoardBarModel getModel() {
+ return ui.getModel();
+ }
+
+ public void afterInitUI() {
+
+ FlightUIModel flightUIModel = ui.getFlightUIModel();
+ flightUIModel.addPropertyChangeListener(this);
+
+ FlightController flightController =
+ getParentUI().getHandler().getFlightController();
+
+ AudioRecorder audioRecorder = flightController.getDeviceManager(AudioRecorder.class);
+ ui.getAudioLED().setState(audioRecorder.getState());
+ audioRecorder.addDeviceStateListener(ui.getAudioLED());
+
+ GpsHandler gpsHandler = flightController.getDeviceManager(GpsHandler.class);
+ ui.getGpsLED().setState(gpsHandler.getState());
+ gpsHandler.addDeviceStateListener(ui.getGpsLED());
+ gpsHandler.addGpsLocationListener(getModel());
+
+ if (FlightState.OFF_EFFORT.equals(ui.getFlightUIModel().getFlightState())) {
+ getModel().setEffortPanelColor(SammoaColors.ON_EFFORT_BACKGROUND_COLOR);
+ }
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ String propertyName = evt.getPropertyName();
+
+ if (FlightUIModel.PROPERTY_FLIGHT_STATE.equals(propertyName)) {
+
+ logger.debug("Modify flight bar background color");
+
+ // si l'etat du vol passe en off effort
+ // affiche à l'utilisateur
+ FlightState newState = (FlightState) evt.getNewValue();
+ if (FlightState.OFF_EFFORT.equals(newState)) {
+ getModel().setEffortPanelColor(SammoaColors.ON_EFFORT_BACKGROUND_COLOR);
+
+ } else {
+ getModel().setEffortPanelColor(null);
+ }
+
+ } else if (FlightUIModel.PROPERTY_CURRENT_ROUTE.equals(propertyName)) {
+
+ Route route = (Route) evt.getNewValue();
+
+ logger.debug("New value received for current route {}", route);
+
+ if (route == null || route.getTransectFlight() == null) {
+ // set null will hide label
+ ui.getLblTransect().setText(null);
+ }
+
+ }
+ }
+}
Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBarHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBarModel.java (from rev 559, trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/FlightBarModel.java)
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBarModel.java (rev 0)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBarModel.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -0,0 +1,91 @@
+/*
+ * #%L
+ * SAMMOA :: UI Swing
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 UMS 3462, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+package fr.ulr.sammoa.ui.swing.flight.bar.onBoard;
+
+import fr.ulr.sammoa.application.device.gps.GpsLocationEvent;
+import fr.ulr.sammoa.application.device.gps.GpsLocationListener;
+import fr.ulr.sammoa.persistence.GeoPoint;
+import org.jdesktop.beans.AbstractSerializableBean;
+
+import java.awt.Color;
+
+import static org.nuiton.i18n.I18n._;
+
+/** @author sletellier <letellier(a)codelutin.com> */
+public class OnBoardBarModel extends AbstractSerializableBean implements GpsLocationListener {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_ALT = "alt";
+
+ public static final String PROPERTY_SPEED = "speed";
+
+ public static final String PROPERTY_EFFORT_PANEL_COLOR = "effortPanelColor";
+
+ protected float alt;
+
+ protected float speed;
+
+ protected Color effortPanelColor;
+
+ public String getAlt() {
+ return _("sammoa.statusbar.alt", alt);
+ }
+
+ public void setAlt(float alt) {
+ float oldValue = this.alt;
+ this.alt = alt;
+ firePropertyChange(PROPERTY_ALT, oldValue, alt);
+ }
+
+ public String getSpeed() {
+ return _("sammoa.statusbar.speed", speed);
+ }
+
+ public void setSpeed(float speed) {
+ float oldValue = this.speed;
+ this.speed = speed;
+ firePropertyChange(PROPERTY_SPEED, oldValue, speed);
+ }
+
+ public Color getEffortPanelColor() {
+ return effortPanelColor;
+ }
+
+ public void setEffortPanelColor(Color effortPanelColor) {
+ Color oldColor = this.effortPanelColor;
+ this.effortPanelColor = effortPanelColor;
+ firePropertyChange(PROPERTY_EFFORT_PANEL_COLOR, oldColor, this.effortPanelColor);
+ }
+
+ @Override
+ public void locationChanged(GpsLocationEvent event) {
+ GeoPoint newLocation = event.getNewValue();
+ if (newLocation != null) {
+ setSpeed((float) newLocation.getSpeed());
+ setAlt((float) newLocation.getAltitude());
+ }
+ }
+}
Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/onBoard/OnBoardBarModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/SoundPlayer.java (from rev 559, trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/SoundPlayer.java)
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/SoundPlayer.java (rev 0)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/SoundPlayer.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -0,0 +1,354 @@
+package fr.ulr.sammoa.ui.swing.flight.bar.validation;
+
+/*
+ * #%L
+ * SAMMOA :: UI Swing
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 UMS 3462, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ulr.sammoa.application.device.DeviceState;
+import fr.ulr.sammoa.application.device.DeviceStateEvent;
+import fr.ulr.sammoa.application.device.DeviceStateListener;
+import fr.ulr.sammoa.application.device.audio.AudioPositionListener;
+import fr.ulr.sammoa.application.device.audio.AudioReader;
+import fr.ulr.sammoa.application.device.audio.SammoaAudioReader;
+import org.apache.commons.lang3.time.FastDateFormat;
+
+import javax.sound.sampled.LineUnavailableException;
+import javax.sound.sampled.UnsupportedAudioFileException;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JSlider;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Hashtable;
+
+/**
+ * Composant qui permet de charge un fichier audio et de le jouer. On peut se
+ * placer ou l'on veut dans le fichier audio.
+ *
+ * usage:
+ * <li> SoundPlayer sp = new SoundPlayer();
+ * <li> panel.add(sp);
+ * <li> sp.load(myFileWav);
+ *
+ * Created: 03 septembre 2012
+ *
+ * @author Benjamin POUSSIN <poussin(a)codelutin.com>
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class SoundPlayer extends JComponent implements DeviceStateListener, AudioPositionListener {
+ protected AudioReader reader;
+
+ // le fichier charge acutellement au niveau de l'ui (config du slider
+ protected File currentFile;
+
+ // The following fields are for the GUI
+ protected JButton play; // The Play button
+ protected JButton stop; // The Stop button
+ protected JSlider progress; // Shows and sets current position in sound
+ protected JLabel time; // Displays audioPosition as a number
+
+ protected FastDateFormat dateFormat = FastDateFormat.getInstance("HH:mm");
+ protected FastDateFormat longDateFormat = FastDateFormat.getInstance("HH:mm:ss");
+
+ // Create a SoundPlayer component for the specified file.
+ public SoundPlayer() {
+ this(null);
+ }
+
+ public SoundPlayer(AudioReader reader) {
+ initUI();
+ setReader(reader);
+ }
+
+ protected void initUI() {
+ // Now create the basic GUI
+ play = new JButton("Play");
+ play.setEnabled(false);
+ stop = new JButton("Stop");
+ stop.setEnabled(false);
+
+ progress = new JSlider(0, 0, 0);
+ progress.setMajorTickSpacing(60000); // toutes les 60s
+ progress.setMinorTickSpacing(10000); // toutes les 10s
+ progress.setPaintTicks(true);
+ progress.setPaintLabels(true);
+
+ time = new JLabel("00:00:00"); // Shows position as a #
+
+ // put those controls in a row
+ Box row = Box.createHorizontalBox();
+
+ Box buttons = Box.createVerticalBox();
+ buttons.add(play);
+ buttons.add(stop);
+
+ row.add(buttons);
+ row.add(progress);
+
+ Box timeBox = Box.createVerticalBox();
+ timeBox.add(time);
+ timeBox.add(Box.createVerticalGlue());
+
+ row.add(timeBox);
+
+ // And add them to this component.
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+ this.add(row);
+
+ // ADD LISTENER
+
+ // When clicked, start or stop playing the sound
+ play.addActionListener(new ActionListener( ) {
+ public void actionPerformed(ActionEvent e) {
+ play();
+ }
+ });
+
+ // When clicked, start or stop playing the sound
+ stop.addActionListener(new ActionListener( ) {
+ public void actionPerformed(ActionEvent e) {
+ stop();
+ }
+ });
+
+ progress.addMouseListener(new MouseAdapter() {
+ boolean inPlay = false;
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ inPlay= getAudioReader().getState() == DeviceState.RUNNING;
+ if (inPlay) {
+ reader.stop();
+ }
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ int value = progress.getValue( );
+ // Update the time label
+// time.setText(value/1000 + "." + (value%1000)/100);
+ // If we're not already there, skip there.
+ if (value >= 0 && value <= reader.getLength()) {
+ reader.setPosition(value);
+ }
+
+ if (inPlay) {
+ reader.start();
+ }
+ }
+ });
+
+ // Whenever the slider value changes, update the time label.
+ progress.addChangeListener(new ChangeListener( ) {
+ public void stateChanged(ChangeEvent e) {
+ // changement du text de position
+ Date date = getAudioReader().getStartDate();
+ long start = 0;
+ if (date != null) {
+ start = date.getTime();
+ }
+ int value = progress.getValue();
+ String timeString = longDateFormat.format(start + value);
+ time.setText(timeString);
+ }
+ });
+ }
+
+ @Override
+ public void stateChanged(DeviceStateEvent event) {
+ DeviceState state = event.getNewValue();
+ switch (state) {
+ case READY: // on vient de charger un fichier, ou arrete la lecture du fichier
+ play.setEnabled(true);
+ stop.setEnabled(false);
+ progress.setEnabled(true);
+ changeSliderInfo();
+ break;
+ case RUNNING: // un fichier est en cours de lecture
+ play.setEnabled(false);
+ stop.setEnabled(true);
+ progress.setEnabled(true);
+ break;
+ case UNAVAILABLE: // aucun fichier charge
+ play.setEnabled(false);
+ stop.setEnabled(false);
+ progress.setEnabled(false);
+ changeSliderInfo();
+ break;
+ case ERROR: // erreur sur le lecture audio (erreur I/O)
+ play.setEnabled(false);
+ stop.setEnabled(false);
+ progress.setEnabled(false);
+ changeSliderInfo();
+ break;
+ }
+ }
+
+ /**
+ * On met a la seconde dans le slider
+ */
+ protected void changeSliderInfo() {
+ Date date = getAudioReader().getStartDate();
+ long start = date == null ? 0 : date.getTime();
+
+ long audioLength = getAudioReader().getLength();
+ int max = (int)audioLength;
+ // si la longueur du morceau change, on change l'info affichee
+ if (progress.getMaximum() != max) {
+ progress.setValue((int)getAudioReader().getPosition());
+ progress.setMaximum(max);
+
+ // calcul de l'espace entre chaque affichage de l'heure en fonction de la longueur du slider
+ double width = progress.getSize().getWidth();
+ long step = audioLength * 100 / (long)width; // on minimum tous les 100px
+ step = Math.max(step, 60000); // on prend pas en dessous de la minute
+
+ //Create the label table
+ Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
+ labelTable.put( 0, new JLabel(dateFormat.format(start)) );
+ for (int i = (int)step; i+step<max; i+=step) { // on ne met pas l'avant dernier vu qu'on met max ensuite
+ labelTable.put( i, new JLabel(dateFormat.format(start + i)) );
+ }
+ labelTable.put( max, new JLabel(dateFormat.format(start + audioLength)) );
+ progress.setLabelTable( labelTable );
+ }
+ }
+
+ public JButton getPlayButton() {
+ return play;
+ }
+
+ public JButton getStopButton() {
+ return stop;
+ }
+
+ @Override
+ public void positionChanged(AudioReader source, long audioPosition) {
+ // changement de la position du slider
+ int pos = (int)audioPosition;
+ progress.setValue(pos);
+ }
+
+ public void setReader(AudioReader reader) {
+ if (this.reader != null) {
+ this.reader.removeAudioPositionListener(this);
+ this.reader.removeDeviceStateListener(this);
+ }
+ this.reader = reader;
+ if (this.reader != null) {
+ reader.addDeviceStateListener(this);
+ reader.addAudioPositionListener(this);
+ }
+
+ }
+
+ /**
+ * retourne le lecture utilise par ce composant
+ * @return
+ */
+ public AudioReader getAudioReader() {
+ return reader;
+ }
+
+// /**
+// * Charge un nouveau fichier
+// * @param f le fichier a charger
+// */
+// public void loadFile(File f) {
+// getAudioReader().load(f);
+// }
+//
+// /**
+// * Donne la position actuelle de la lecture en milliseconde
+// * @return
+// */
+// public long getPosition() {
+// return getAudioReader().getPosition();
+// }
+//
+// /**
+// * Donne la longueur total du fichier en milliseconde
+// * @return
+// */
+// public long getLength() {
+// return getAudioReader().getLength();
+// }
+
+ /**
+ * Start playing the sound at the current position
+ */
+ public void play() {
+ getAudioReader().start();
+ }
+
+ /**
+ * Stop playing the sound, but retain the current position
+ */
+ public void stop() {
+ getAudioReader().stop();
+ }
+
+ // The main method just creates a SoundPlayer in a Frame and displays it
+ public static void main(String[] args)
+ throws IOException, UnsupportedAudioFileException, LineUnavailableException {
+ SoundPlayer player;
+
+ File file;
+ if (args.length == 0) {
+ file = new File("/tmp/junkk.wav");
+ } else {
+ file = new File(args[0]);
+ }
+
+ // Create a SoundPlayer object to play the sound.
+ player = new SoundPlayer();
+ AudioReader reader = new SammoaAudioReader();
+ player.setReader(reader);
+ reader.load(file, new Date());
+
+ // Put it in a window and play it
+ JFrame f = new JFrame("SoundPlayer");
+ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ f.getContentPane().add(player, "Center");
+ f.pack();
+ f.setVisible(true);
+ }
+
+ public void audioChanged(AudioReader source, long audioLength) {
+ // A SUPPRIMER
+ }
+}
\ No newline at end of file
Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/SoundPlayer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBar.css
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBar.css (rev 0)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBar.css 2012-09-07 17:51:00 UTC (rev 560)
@@ -0,0 +1,39 @@
+/*
+ * #%L
+ * SAMMOA :: UI Swing
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 UMS 3462, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+#audioTime {
+ text: {dateFormat.format(model.getCurrentRoute().getBeginTime())};
+}
+
+#validTransectButton {
+ _actionName: {"validTransect"};
+}
+
+#validRouteButton {
+ _actionName: {"validRoute"};
+}
+
+#validObservationButton {
+ _actionName: {"validObservation"};
+}
Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBar.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBar.jaxx
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBar.jaxx (rev 0)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBar.jaxx 2012-09-07 17:51:00 UTC (rev 560)
@@ -0,0 +1,66 @@
+<!--
+ #%L
+ SAMMOA :: UI Swing
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 UMS 3462, Code Lutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<Table id='validationBar'>
+
+ <import>
+ java.text.SimpleDateFormat
+ javax.swing.BoxLayout
+
+ fr.ulr.sammoa.ui.swing.flight.FlightUIModel
+ </import>
+
+ <script><![CDATA[
+
+ protected void $afterCompleteSetup() {
+ getHandler().afterInitUI();
+ }
+
+ ]]></script>
+
+ <ValidationBarHandler id='handler'
+ constructorParams='this'/>
+
+ <FlightUIModel id='model'
+ initializer='getHandler().getParentUI().getModel()'/>
+
+ <SimpleDateFormat id='dateFormat' constructorParams='"dd/MM/yyyy HH:mm:ss"'/>
+
+ <row>
+ <cell fill='horizontal'>
+ <JLabel id='audioTime'/>
+ </cell>
+ <cell fill='horizontal' weightx='1.5'>
+ <SoundPlayer id='soundPlayer'/>
+ </cell>
+ <cell fill='horizontal' weightx='0.2'>
+ <JPanel id='validButtonPanel'
+ layout='{new BoxLayout(validButtonPanel, BoxLayout.X_AXIS)}'>
+ <JButton id='validTransectButton'/>
+ <JButton id='validRouteButton'/>
+ <JButton id='validObservationButton'/>
+ </JPanel>
+ </cell>
+ </row>
+</Table>
Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBar.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBarHandler.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBarHandler.java (rev 0)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBarHandler.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -0,0 +1,127 @@
+/*
+ * #%L
+ * SAMMOA :: UI Swing
+ * *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 UMS 3462, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+package fr.ulr.sammoa.ui.swing.flight.bar.validation;
+
+import fr.ulr.sammoa.application.device.audio.AudioReader;
+import fr.ulr.sammoa.application.flightController.FlightController;
+import fr.ulr.sammoa.persistence.Observation;
+import fr.ulr.sammoa.persistence.Route;
+import fr.ulr.sammoa.ui.swing.flight.FlightUI;
+import fr.ulr.sammoa.ui.swing.flight.FlightUIModel;
+import fr.ulr.sammoa.ui.swing.flight.TransectFlightModel;
+import jaxx.runtime.JAXXUtil;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import static org.nuiton.i18n.I18n._;
+
+/** @author fdesbois <fdesbois(a)codelutin.com> */
+public class ValidationBarHandler {
+
+// private static final Logger logger =
+// LoggerFactory.getLogger(ValidationBarHandler.class);
+
+ protected final ValidationBar ui;
+
+ public ValidationBarHandler(ValidationBar ui) {
+ this.ui = ui;
+ }
+
+ public FlightUI getParentUI() {
+ return ui.getContextValue(FlightUI.class, JAXXUtil.PARENT);
+ }
+
+ protected FlightUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void afterInitUI() {
+
+ FlightController flightController =
+ getParentUI().getHandler().getFlightController();
+
+ AudioReader audioReader = flightController.getDeviceManager(AudioReader.class);
+ ui.getSoundPlayer().setReader(audioReader);
+
+ getModel().addPropertyChangeListener(
+ FlightUIModel.PROPERTY_TRANSECT_FLIGHT_EDIT_BEAN, validTransectListener);
+
+ getModel().addPropertyChangeListener(
+ FlightUIModel.PROPERTY_ROUTE_EDIT_BEAN, validRouteListener);
+
+ getModel().addPropertyChangeListener(
+ FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN, validObservationListener);
+ }
+
+ protected PropertyChangeListener validTransectListener = new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+
+ TransectFlightModel newValue = (TransectFlightModel) evt.getNewValue();
+
+ String text = null;
+ if (newValue != null) {
+ text = newValue.getTransect().getSource().getName();
+ }
+ ui.getValidTransectButton().setText(text);
+ }
+ };
+
+ protected PropertyChangeListener validRouteListener = new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+
+ Route newValue = (Route) evt.getNewValue();
+
+ String text = null;
+ if (newValue != null) {
+ text = newValue.getRouteType().name();
+ if (newValue.getEffortNumber() != null) {
+ text += " " + newValue.getEffortNumber();
+ }
+ }
+ ui.getValidRouteButton().setText(text);
+ }
+ };
+
+ protected PropertyChangeListener validObservationListener = new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+
+ Observation newValue = (Observation) evt.getNewValue();
+
+ String text = null;
+ if (newValue != null) {
+ text = _("sammoa.validable.observation")
+ + " " + newValue.getObservationNumber();
+ }
+ ui.getValidObservationButton().setText(text);
+ }
+ };
+}
Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/bar/validation/ValidationBarHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java 2012-09-07 14:42:21 UTC (rev 559)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -368,12 +368,23 @@
Route route = (Route) evt.getNewValue();
getParentUI().getHandler().getFlightController().setCurrentRoute(route);
- // no unselect but ensure valid button (a select will cause a loop)
- getModel().setObservationEditBean(null);
+ if (route == null) {
+ // no unselect but ensure valid button (a select will cause a loop)
+ getModel().setObservationEditBean(null);
- // Set audio position
- if (route != null) {
+ } else {
+
+ // Set audio position
setAudioReaderPositionDate(route.getBeginTime());
+
+ // Remove observationEditBean if not in route
+ Observation previousObservation = getModel().getObservationEditBean();
+ if (previousObservation != null
+ && !Observations.inRoute(previousObservation, route, getModel().getRoutes(), true)) {
+
+ // no unselect but ensure valid button (a select will cause a loop)
+ getModel().setObservationEditBean(null);
+ }
}
}
}
Added: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/NestedPropertyChangeListener.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/NestedPropertyChangeListener.java (rev 0)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/NestedPropertyChangeListener.java 2012-09-07 17:51:00 UTC (rev 560)
@@ -0,0 +1,138 @@
+package fr.ulr.sammoa.ui.swing.util;
+
+import com.google.common.base.Splitter;
+import org.jdesktop.beans.AbstractBean;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Iterator;
+
+/**
+ * This listener is used to manage nested properties. (Ex: route.deleted will
+ * listen on property route and on the property deleted). After instanciation,
+ * use {@link #init(Object)} method to bind the listener with your own {@code model}.
+ * Only model {@link TopiaEntity} or {@link AbstractBean} are supported.
+ * <p/>
+ * Created: 07/09/12
+ *
+ * @author fdesbois <florian.desbois(a)codelutin.com>
+ */
+public class NestedPropertyChangeListener implements PropertyChangeListener {
+
+ /** Logger. */
+ private static final Logger logger = LoggerFactory.getLogger(NestedPropertyChangeListener.class);
+
+ protected PropertyChangeListener delegate;
+
+ protected String property;
+
+ protected NestedPropertyChangeListener embeddedListener;
+
+ public NestedPropertyChangeListener(PropertyChangeListener delegate,
+ String property,
+ boolean all) {
+
+ this.delegate = delegate;
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("New NestedPropertyChangeListener for property '{}'",
+ property);
+ }
+
+ // Init embeddedListener for nestedProperty
+ if (property != null && property.contains(".")) {
+ Iterator<String> it =
+ Splitter.on(".").limit(2).split(property).iterator();
+
+ // First element is the property
+ this.property = it.next();
+
+ // Next property is the nested one
+ String nestedProperty = it.next();
+ this.embeddedListener = new NestedPropertyChangeListener(delegate, nestedProperty, all);
+
+ } else if (all) {
+ this.property = property;
+ this.embeddedListener = new NestedPropertyChangeListener(delegate, null, false);
+
+ } else {
+ this.property = property;
+ }
+ }
+
+ public void init(Object model) {
+
+ // Add this NestedPropertyChangeListener on model
+ addNestedPropertyChangeListener(model, this);
+
+ if (embeddedListener != null) {
+
+ // Init the embedded NestedPropertyChangeListener with
+ // the propertyValue as model
+ Object propertyValue =
+ SammoaUtil.getPropertyValue(model, property);
+
+ embeddedListener.init(propertyValue);
+ }
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (embeddedListener != null) {
+ if (evt.getOldValue() != null) {
+ removeNestedPropertyChangeListener(evt.getOldValue(), embeddedListener);
+ }
+ if (evt.getNewValue() != null) {
+ addNestedPropertyChangeListener(evt.getNewValue(), embeddedListener);
+ }
+ }
+ delegate.propertyChange(evt);
+ }
+
+ protected void addNestedPropertyChangeListener(Object object, NestedPropertyChangeListener listener) {
+ String property = listener.getProperty();
+ if (object instanceof TopiaEntity) {
+ TopiaEntity entity = (TopiaEntity) object;
+ if (property == null) {
+ entity.addPropertyChangeListener(listener);
+ } else {
+ entity.addPropertyChangeListener(property, listener);
+ }
+
+ } else if (object instanceof AbstractBean) {
+ AbstractBean entity = (AbstractBean) object;
+ if (property == null) {
+ entity.addPropertyChangeListener(listener);
+ } else {
+ entity.addPropertyChangeListener(property, listener);
+ }
+ }
+ }
+
+ protected void removeNestedPropertyChangeListener(Object object, NestedPropertyChangeListener listener) {
+ String property = listener.getProperty();
+ if (object instanceof TopiaEntity) {
+ TopiaEntity entity = (TopiaEntity) object;
+ if (property == null) {
+ entity.removePropertyChangeListener(listener);
+ } else {
+ entity.removePropertyChangeListener(property, listener);
+ }
+
+ } else if (object instanceof AbstractBean) {
+ AbstractBean entity = (AbstractBean) object;
+ if (property == null) {
+ entity.removePropertyChangeListener(listener);
+ } else {
+ entity.removePropertyChangeListener(property, listener);
+ }
+ }
+ }
+}
Property changes on: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/NestedPropertyChangeListener.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r559 - in trunk: sammoa-application/src/main/resources/i18n sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort
by fdesbois@users.forge.codelutin.com 07 Sep '12
by fdesbois@users.forge.codelutin.com 07 Sep '12
07 Sep '12
Author: fdesbois
Date: 2012-09-07 16:42:21 +0200 (Fri, 07 Sep 2012)
New Revision: 559
Url: http://forge.codelutin.com/repositories/revision/sammoa/559
Log:
fixes #1474 : add observer initials also for onBoard
Modified:
trunk/sammoa-application/src/main/resources/i18n/sammoa-application_en_GB.properties
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/SammoaColors.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java
Modified: trunk/sammoa-application/src/main/resources/i18n/sammoa-application_en_GB.properties
===================================================================
--- trunk/sammoa-application/src/main/resources/i18n/sammoa-application_en_GB.properties 2012-09-07 14:19:49 UTC (rev 558)
+++ trunk/sammoa-application/src/main/resources/i18n/sammoa-application_en_GB.properties 2012-09-07 14:42:21 UTC (rev 559)
@@ -44,9 +44,9 @@
sammoa.flight.decorator.newFlight=New flight
sammoa.flight.decorator.notEnded=not ended
sammoa.flight.decorator.notStarted=not started
-sammoa.position.backLeft=LEFT
-sammoa.position.backRight=RIGHT
-sammoa.position.coNavigator=CENTER
-sammoa.position.frontLeft=LEFT
-sammoa.position.frontRight=RIGHT
-sammoa.position.navigator=CENTER
+sammoa.position.backLeft=L
+sammoa.position.backRight=R
+sammoa.position.coNavigator=C
+sammoa.position.frontLeft=L
+sammoa.position.frontRight=R
+sammoa.position.navigator=C
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/SammoaColors.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/SammoaColors.java 2012-09-07 14:19:49 UTC (rev 558)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/SammoaColors.java 2012-09-07 14:42:21 UTC (rev 559)
@@ -55,7 +55,7 @@
public static final Color OBSERVATION_FOR_ROUTE_ROW_COLOR = new Color(171, 214, 255);
-// public static final Color ROUTE_FOR_TRANSECT_ROW_COLOR = new Color(171, 214, 255);
+ public static final Color ROUTE_FOR_TRANSECT_ROW_COLOR = new Color(171, 214, 255);
// public static final Color ROUTE_NO_MODIFICATION_ROW_COLOR = new Color(255, 233, 233);
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java 2012-09-07 14:19:49 UTC (rev 558)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java 2012-09-07 14:42:21 UTC (rev 559)
@@ -273,10 +273,8 @@
SwingUtil.ensureRowIndex(ui.getRouteTableModel(), index);
ui.getRouteTableModel().fireTableRowsUpdated(index, index);
- // Update observation table to ensure observer's name during validation
- if (getModel().isValidationMode()) {
- fireObservationsUpdated(route, false);
- }
+ // Update observation table to ensure observer's initials
+ fireObservationsUpdated(route, false);
}
}
}
@@ -401,17 +399,17 @@
}
}
+ BeanListValidator<Route> validator = ui.getRouteValidator();
+ RouteValidatorDataLocator dataLocator = new RouteValidatorDataLocator();
+
// Validation
{
JTable errorTable = ui.getErrorTable();
SwingListValidatorMessageTableModel errorTableModel = ui.getErrorTableModel();
- BeanListValidator<Route> validator = ui.getRouteValidator();
validator.setContext(getValidatorContext());
getParentUI().setContextValue(validator, ROUTE_VALIDATOR_CONTEXT_VALUE);
- RouteValidatorDataLocator dataLocator = new RouteValidatorDataLocator();
-
SwingValidatorUtil.registerListValidator(
validator,
errorTableModel,
@@ -420,14 +418,6 @@
dataLocator
);
- addHightLighterOnEditor(
- validator,
- table,
- dataLocator,
- NuitonValidatorScope.ERROR,
- NuitonValidatorScope.WARNING
- );
-
for (Route route : tableModel.getBean()) {
validator.addBean(route);
}
@@ -437,8 +427,17 @@
{
table.addHighlighter(SammoaUtil.newBackgroundColorHighlighter(
new RouteForSelectedTransectFlightHighlightPredicate(getModel()),
- SammoaColors.OBSERVATION_FOR_ROUTE_ROW_COLOR)
+ SammoaColors.ROUTE_FOR_TRANSECT_ROW_COLOR)
);
+
+ addHightLighterOnEditor(
+ validator,
+ table,
+ dataLocator,
+ NuitonValidatorScope.ERROR,
+ NuitonValidatorScope.WARNING
+ );
+
table.addHighlighter(SammoaUtil.newForegroundColorHighlighter(
new RouteNoModificationHighlightPredicate(tableModel),
SammoaColors.ROUTE_NO_MODIFICATION_ROW_COLOR)
@@ -592,24 +591,18 @@
}
}
- table.addHighlighter(
- SammoaUtil.newBackgroundColorHighlighter(
- new ObservationForSelectedRouteHighlightPredicate(getModel()),
- SammoaColors.OBSERVATION_FOR_ROUTE_ROW_COLOR)
- );
+ BeanListValidator<Observation> validator = ui.getObservationValidator();
+ ObservationValidatorDataLocator dataLocator =
+ new ObservationValidatorDataLocator();
// Validation
{
JTable errorTable = ui.getErrorTable();
SwingListValidatorMessageTableModel errorTableModel = ui.getErrorTableModel();
- BeanListValidator<Observation> validator = ui.getObservationValidator();
validator.setContext(getValidatorContext());
getParentUI().setContextValue(validator, OBSERVATION_VALIDATOR_CONTEXT_VALUE);
- ObservationValidatorDataLocator dataLocator =
- new ObservationValidatorDataLocator();
-
SwingValidatorUtil.registerListValidator(
validator,
errorTableModel,
@@ -618,14 +611,6 @@
dataLocator
);
- addHightLighterOnEditor(
- validator,
- table,
- dataLocator,
- NuitonValidatorScope.ERROR,
- NuitonValidatorScope.WARNING
- );
-
for (Observation observation : tableModel.getBean()) {
validator.addBean(observation);
}
@@ -647,15 +632,9 @@
// Position
{
- TableCellRenderer renderer;
- if (getModel().isValidationMode()) {
- renderer = new ObservationPositionCellRenderer(
- stringRenderer, decoratorService, ui.getObservationTableModel());
+ TableCellRenderer renderer = new ObservationPositionCellRenderer(
+ stringRenderer, decoratorService, ui.getObservationTableModel());
- } else {
- renderer = decoratorService.newTableCellRender(Position.class);
- }
-
JComboBox comboBox = new JComboBox();
comboBox.setRenderer(decoratorService.newListCellRender(Position.class));
SwingUtil.fillComboBox(comboBox, ImmutableList.of(
@@ -690,6 +669,20 @@
column.setCellRenderer(editorRenderer);
}
+
+ table.addHighlighter(SammoaUtil.newBackgroundColorHighlighter(
+ new ObservationForSelectedRouteHighlightPredicate(getModel()),
+ SammoaColors.OBSERVATION_FOR_ROUTE_ROW_COLOR)
+ );
+
+ addHightLighterOnEditor(
+ validator,
+ table,
+ dataLocator,
+ NuitonValidatorScope.ERROR,
+ NuitonValidatorScope.WARNING
+ );
+
table.addHighlighter(SammoaUtil.newForegroundColorHighlighter(
new DeletedRowHighlightPredicate(getModel().getObservations()),
SammoaColors.DELETED_ROW_COLOR)
1
0
r558 - trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action
by fdesbois@users.forge.codelutin.com 07 Sep '12
by fdesbois@users.forge.codelutin.com 07 Sep '12
07 Sep '12
Author: fdesbois
Date: 2012-09-07 16:19:49 +0200 (Fri, 07 Sep 2012)
New Revision: 558
Url: http://forge.codelutin.com/repositories/revision/sammoa/558
Log:
fixes #1484 : disable transect validation on TRANSIT route
Modified:
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java 2012-09-07 14:10:02 UTC (rev 557)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java 2012-09-07 14:19:49 UTC (rev 558)
@@ -123,48 +123,4 @@
_("sammoa.confirmDialog.validation.deleteByCascade.message", label, cascadeLabel)
);
}
-
-// protected <E extends TopiaEntity & Validable> void bindValidableEntity(String propertyName,
-// Class<E> propertyClass) {
-//
-// getModel().addPropertyChangeListener(propertyName, new PropertyChangeListener() {
-//
-// @Override
-// public void propertyChange(PropertyChangeEvent evt) {
-// TopiaEntity oldValue = (TopiaEntity) evt.getOldValue();
-// if (oldValue != null) {
-// oldValue.removePropertyChangeListener(
-// "deleted", enabledListener);
-// }
-// TopiaEntity newValue = (TopiaEntity) evt.getNewValue();
-// if (newValue != null) {
-// newValue.addPropertyChangeListener(
-// "deleted", enabledListener);
-// }
-// enabledListener.propertyChange(evt);
-// }
-// });
-// }
-//
-// protected <E extends AbstractBean & Validable> void bindValidableModel(String propertyName,
-// Class<E> propertyClass) {
-//
-// getModel().addPropertyChangeListener(propertyName, new PropertyChangeListener() {
-//
-// @Override
-// public void propertyChange(PropertyChangeEvent evt) {
-// AbstractBean oldValue = (AbstractBean) evt.getOldValue();
-// if (oldValue != null) {
-// oldValue.removePropertyChangeListener(
-// "deleted", enabledListener);
-// }
-// AbstractBean newValue = (AbstractBean) evt.getNewValue();
-// if (newValue != null) {
-// newValue.addPropertyChangeListener(
-// "deleted", enabledListener);
-// }
-// enabledListener.propertyChange(evt);
-// }
-// });
-// }
}
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java 2012-09-07 14:10:02 UTC (rev 557)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java 2012-09-07 14:19:49 UTC (rev 558)
@@ -152,13 +152,10 @@
boolean result = isEnabled();
if (!validatorIsAdjusting) {
TransectFlightModel bean = getModel().getTransectFlightEditBean();
- if (bean != null) {
- TransectFlight transectflight = bean.getSource();
- result = transectflight != null
- && TransectFlights.isValid(transectflight,
- getRouteValidator(),
- getObservationValidator());
- }
+ result = bean != null &&
+ TransectFlights.isValid(bean.getSource(),
+ getRouteValidator(),
+ getObservationValidator());
}
return result;
}
1
0
r557 - trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort
by fdesbois@users.forge.codelutin.com 07 Sep '12
by fdesbois@users.forge.codelutin.com 07 Sep '12
07 Sep '12
Author: fdesbois
Date: 2012-09-07 16:10:02 +0200 (Fri, 07 Sep 2012)
New Revision: 557
Url: http://forge.codelutin.com/repositories/revision/sammoa/557
Log:
Always allow changing position date for audio
Modified:
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java 2012-09-07 14:09:48 UTC (rev 556)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/effort/EffortPanelHandler.java 2012-09-07 14:10:02 UTC (rev 557)
@@ -802,9 +802,7 @@
protected void setAudioReaderPositionDate(Date date) {
FlightController flightController = getParentUI().getHandler().getFlightController();
AudioReader audioReader = flightController.getDeviceManager(AudioReader.class);
- if (audioReader.getState() == DeviceState.READY) {
- audioReader.setPositionDate(date);
- }
+ audioReader.setPositionDate(date);
}
protected void fireObservationsUpdated(Route route, boolean scrollToFirst) {
1
0
r556 - in trunk: sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action sammoa-ui-swing/src/main/resources/i18n
by fdesbois@users.forge.codelutin.com 07 Sep '12
by fdesbois@users.forge.codelutin.com 07 Sep '12
07 Sep '12
Author: fdesbois
Date: 2012-09-07 16:09:48 +0200 (Fri, 07 Sep 2012)
New Revision: 556
Url: http://forge.codelutin.com/repositories/revision/sammoa/556
Log:
fixes #1477 : add confirm message for deletes
Modified:
trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Observations.java
trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Routes.java
trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/TransectFlights.java
trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Validables.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java
trunk/sammoa-ui-swing/src/main/resources/i18n/sammoa-ui-swing_en_GB.properties
Modified: trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Observations.java
===================================================================
--- trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Observations.java 2012-09-07 12:51:11 UTC (rev 555)
+++ trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Observations.java 2012-09-07 14:09:48 UTC (rev 556)
@@ -63,6 +63,16 @@
return Iterables.filter(observations, inRoute(route, routes, ignoreDeleted));
}
+ public static boolean isAnyDeletedFromRoute(Iterable<Observation> observations,
+ Route route,
+ Iterable<Route> routes) {
+ boolean result = FluentIterable
+ .from(observations)
+ .filter(Observations.inRoute(route, routes, false))
+ .anyMatch(Validables.isDeleted());
+ return result;
+ }
+
public static boolean isValid(Observation observation,
BeanListValidator<Observation> validator) {
return Validables.isValid(observation, validator);
Modified: trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Routes.java
===================================================================
--- trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Routes.java 2012-09-07 12:51:11 UTC (rev 555)
+++ trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Routes.java 2012-09-07 14:09:48 UTC (rev 556)
@@ -197,7 +197,7 @@
}
public static Iterable<Route> filterNotDeleted(Iterable<Route> routes) {
- return Iterables.filter(routes, Predicates.not(isDeleted()));
+ return Iterables.filter(routes, Predicates.not(Validables.isDeleted()));
}
public static Route findPrevious(Iterable<Route> routes, Route route) {
@@ -228,10 +228,6 @@
return new IsValidPredicate(validator, obsValidator);
}
- public static Predicate<Route> isDeleted() {
- return IS_DELETED_PREDICATE;
- }
-
public static Comparator<Route> orderByDate() {
return BY_DATE_COMPARATOR;
}
@@ -255,14 +251,6 @@
}
};
- private static Predicate<Route> IS_DELETED_PREDICATE = new Predicate<Route>() {
-
- @Override
- public boolean apply(Route input) {
- return input.isDeleted();
- }
- };
-
private static Function<Route, Date> TO_DATE_FUNCTION = new Function<Route, Date>() {
@Override
Modified: trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/TransectFlights.java
===================================================================
--- trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/TransectFlights.java 2012-09-07 12:51:11 UTC (rev 555)
+++ trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/TransectFlights.java 2012-09-07 14:09:48 UTC (rev 556)
@@ -81,7 +81,8 @@
if (!result) {
// Check validity of routes
- result = FluentIterable.from(routeValidator.getBeans())
+ result = FluentIterable
+ .from(routeValidator.getBeans())
.filter(Routes.withTransectFlight(transectFlight))
.allMatch(Routes.isValid(routeValidator, observationValidator));
}
Modified: trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Validables.java
===================================================================
--- trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Validables.java 2012-09-07 12:51:11 UTC (rev 555)
+++ trunk/sammoa-persistence/src/main/java/fr/ulr/sammoa/persistence/Validables.java 2012-09-07 14:09:48 UTC (rev 556)
@@ -38,6 +38,10 @@
// static class do not have instanciation
}
+ public static <E extends Validable> Predicate<E> isDeleted() {
+ return new IsDeletedPredicate<E>();
+ }
+
public static <E extends Validable> boolean isValid(E bean, BeanListValidator<E> validator) {
return bean.isValid()
|| bean.isDeleted()
@@ -48,6 +52,14 @@
return new IsValidPredicate<E>(validator);
}
+ private static class IsDeletedPredicate<E extends Validable> implements Predicate<E> {
+
+ @Override
+ public boolean apply(E input) {
+ return input.isDeleted();
+ }
+ }
+
private static class IsValidPredicate<E extends Validable> implements Predicate<E> {
protected BeanListValidator<E> validator;
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java 2012-09-07 12:51:11 UTC (rev 555)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java 2012-09-07 14:09:48 UTC (rev 556)
@@ -30,6 +30,8 @@
import fr.ulr.sammoa.persistence.Route;
import fr.ulr.sammoa.persistence.Validable;
import fr.ulr.sammoa.ui.swing.SammoaUIContext;
+import fr.ulr.sammoa.ui.swing.flight.FlightUI;
+import fr.ulr.sammoa.ui.swing.util.SammoaUtil;
import jaxx.runtime.JAXXContext;
import org.nuiton.util.Resource;
import org.nuiton.validator.bean.list.BeanListValidator;
@@ -38,6 +40,8 @@
import java.util.Map;
+import static org.nuiton.i18n.I18n._;
+
/**
* Created: 23/08/12
*
@@ -105,6 +109,21 @@
return getValidator(Observation.class);
}
+ protected boolean askConfirmDelete(String label) {
+ return SammoaUtil.askQuestion(
+ (FlightUI) context,
+ _("sammoa.confirmDialog.validation.delete.message", label)
+ );
+ }
+
+ protected boolean askConfirmDeleteByCascade(String label,
+ String cascadeLabel) {
+ return SammoaUtil.askQuestion(
+ (FlightUI) context,
+ _("sammoa.confirmDialog.validation.deleteByCascade.message", label, cascadeLabel)
+ );
+ }
+
// protected <E extends TopiaEntity & Validable> void bindValidableEntity(String propertyName,
// Class<E> propertyClass) {
//
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java 2012-09-07 12:51:11 UTC (rev 555)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java 2012-09-07 14:09:48 UTC (rev 556)
@@ -50,7 +50,7 @@
public ValidObservationAction(JAXXContext context) {
super(_("sammoa.action.validObservation"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.validObservation.tip"));
- bindModelProperties(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN + ".deleted");
+ bindModelProperties(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN + "." + Observation.PROPERTY_DELETED);
}
@Override
@@ -64,11 +64,15 @@
logger.debug("Validation for observation {}", observation.getObservationNumber());
}
- Observation observationChanged = getValidationService().validateObservation(observation);
+ if (observation.isDeleted()) {
- if (observationChanged.isDeleted()) {
- getModel().removeObservation(observationChanged);
+ if (askConfirmDelete(_("sammoa.validable.observation"))) {
+ Observation observationChanged = getValidationService().validateObservation(observation);
+ getModel().removeObservation(observationChanged);
+ }
+
} else {
+ Observation observationChanged = getValidationService().validateObservation(observation);
getModel().updateObservation(observationChanged);
getModel().setObservationEditBean(observationChanged);
}
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java 2012-09-07 12:51:11 UTC (rev 555)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java 2012-09-07 14:09:48 UTC (rev 556)
@@ -24,6 +24,7 @@
*/
import fr.ulr.sammoa.application.FlightService;
+import fr.ulr.sammoa.persistence.Observations;
import fr.ulr.sammoa.persistence.Route;
import fr.ulr.sammoa.persistence.Routes;
import fr.ulr.sammoa.ui.swing.flight.FlightUIModel;
@@ -71,27 +72,40 @@
);
}
- Route routeChanged = getValidationService().validateRoute(route);
+ if (route.isDeleted()) {
- if (routeChanged.isDeleted()) {
- getModel().removeRoute(routeChanged);
+ if (askConfirmDelete(_("sammoa.validable.route"))) {
+ Route routeChanged = getValidationService().validateRoute(route);
+ getModel().removeRoute(routeChanged);
+ }
+
} else {
- getModel().updateRoute(routeChanged);
- validatorIsAdjusting = true;
+ boolean hasDeletedObservation = Observations.isAnyDeletedFromRoute(
+ getModel().getObservations(), route, getModel().getRoutes());
- getModel().setCurrentRoute(routeChanged);
- getModel().setRouteEditBean(routeChanged);
+ if (!hasDeletedObservation
+ || askConfirmDeleteByCascade(_("sammoa.validable.route"),
+ _("sammoa.validable.observation"))) {
- getModel().setObservationEditBean(null);
+ Route routeChanged = getValidationService().validateRoute(route);
+ getModel().updateRoute(routeChanged);
- // Reload all observations
- FlightService service =
- getSammoaUIContext().getService(FlightService.class);
- getModel().clearObservation();
- getModel().addAllObservation(service.getObservations(getModel().getFlight()));
+ validatorIsAdjusting = true;
- validatorIsAdjusting = false;
+ getModel().setCurrentRoute(routeChanged);
+ getModel().setRouteEditBean(routeChanged);
+
+ getModel().setObservationEditBean(null);
+
+ // Reload all observations
+ FlightService service =
+ getSammoaUIContext().getService(FlightService.class);
+ getModel().clearObservation();
+ getModel().addAllObservation(service.getObservations(getModel().getFlight()));
+
+ validatorIsAdjusting = false;
+ }
}
}
}
@@ -106,4 +120,25 @@
}
return result;
}
+
+ protected void doValid(Route route) {
+
+ Route routeChanged = getValidationService().validateRoute(route);
+ getModel().updateRoute(routeChanged);
+
+ validatorIsAdjusting = true;
+
+ getModel().setCurrentRoute(routeChanged);
+ getModel().setRouteEditBean(routeChanged);
+
+ getModel().setObservationEditBean(null);
+
+ // Reload all observations
+ FlightService service =
+ getSammoaUIContext().getService(FlightService.class);
+ getModel().clearObservation();
+ getModel().addAllObservation(service.getObservations(getModel().getFlight()));
+
+ validatorIsAdjusting = false;
+ }
}
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java 2012-09-07 12:51:11 UTC (rev 555)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java 2012-09-07 14:09:48 UTC (rev 556)
@@ -23,10 +23,14 @@
* #L%
*/
+import com.google.common.collect.FluentIterable;
import fr.ulr.sammoa.application.FlightService;
+import fr.ulr.sammoa.persistence.Observations;
import fr.ulr.sammoa.persistence.Route;
+import fr.ulr.sammoa.persistence.Routes;
import fr.ulr.sammoa.persistence.TransectFlight;
import fr.ulr.sammoa.persistence.TransectFlights;
+import fr.ulr.sammoa.persistence.Validables;
import fr.ulr.sammoa.ui.swing.flight.FlightUIModel;
import fr.ulr.sammoa.ui.swing.flight.TransectFlightModel;
import jaxx.runtime.JAXXContext;
@@ -78,40 +82,67 @@
);
}
- TransectFlight transectFlightChanged =
+ if (transectFlight.isDeleted()) {
+
+ if (askConfirmDelete(_("sammoa.validable.transect"))) {
getValidationService().validateTransectFlight(getModel().getFlight(), transectFlight);
+ getModel().removeTransectFlight(index);
+ }
- if (transectFlightChanged == null) {
- getModel().removeTransectFlight(index);
-
} else {
- getModel().updateTransectFlight(transectFlightChanged);
- validatorIsAdjusting = true;
+ // Get routes for this transectFlight
+ FluentIterable<Route> routes = FluentIterable
+ .from(getModel().getRoutes())
+ .filter(Routes.withTransectFlight(transectFlight));
- Route routeEditBean = getModel().getRouteEditBean();
+ boolean hasDeletedRoute = routes.anyMatch(Validables.isDeleted());
- getModel().setRouteEditBean(null);
+ if (!hasDeletedRoute
+ || askConfirmDeleteByCascade(_("sammoa.validable.transect"),
+ _("sammoa.validable.route"))) {
- // Reload all routes
- FlightService service =
- getSammoaUIContext().getService(FlightService.class);
- getModel().clearRoute();
- getModel().addAllRoute(service.getRoutes(getModel().getFlight()));
+ boolean hasDeletedObservation = false;
+ for (Route route : routes) {
+ hasDeletedObservation |= Observations.isAnyDeletedFromRoute(
+ getModel().getObservations(), route, routes);
+ }
- // Keep the route selected
- if (routeEditBean != null && !routeEditBean.isDeleted()) {
- getModel().setCurrentRoute(routeEditBean);
- getModel().setRouteEditBean(routeEditBean);
- }
+ if (!hasDeletedObservation
+ || askConfirmDeleteByCascade(_("sammoa.validable.transect"),
+ _("sammoa.validable.observation"))) {
- getModel().setObservationEditBean(null);
+ TransectFlight transectFlightChanged =
+ getValidationService().validateTransectFlight(getModel().getFlight(), transectFlight);
+ getModel().updateTransectFlight(transectFlightChanged);
- // Reload all observations
- getModel().clearObservation();
- getModel().addAllObservation(service.getObservations(getModel().getFlight()));
+ validatorIsAdjusting = true;
- validatorIsAdjusting = false;
+ Route routeEditBean = getModel().getRouteEditBean();
+
+ getModel().setRouteEditBean(null);
+
+ // Reload all routes
+ FlightService service =
+ getSammoaUIContext().getService(FlightService.class);
+ getModel().clearRoute();
+ getModel().addAllRoute(service.getRoutes(getModel().getFlight()));
+
+ // Keep the route selected
+ if (routeEditBean != null && !routeEditBean.isDeleted()) {
+ getModel().setCurrentRoute(routeEditBean);
+ getModel().setRouteEditBean(routeEditBean);
+ }
+
+ getModel().setObservationEditBean(null);
+
+ // Reload all observations
+ getModel().clearObservation();
+ getModel().addAllObservation(service.getObservations(getModel().getFlight()));
+
+ validatorIsAdjusting = false;
+ }
+ }
}
}
}
Modified: trunk/sammoa-ui-swing/src/main/resources/i18n/sammoa-ui-swing_en_GB.properties
===================================================================
--- trunk/sammoa-ui-swing/src/main/resources/i18n/sammoa-ui-swing_en_GB.properties 2012-09-07 12:51:11 UTC (rev 555)
+++ trunk/sammoa-ui-swing/src/main/resources/i18n/sammoa-ui-swing_en_GB.properties 2012-09-07 14:09:48 UTC (rev 556)
@@ -69,10 +69,12 @@
sammoa.config.category.other.description=Other
sammoa.config.category.shortcuts=Shortcuts
sammoa.config.category.shortcuts.description=List of all the shortcuts
-sammoa.confirmDialog.deleteTransect.message=The flight is not started, do you want to definetely delete this flight's transect ?
+sammoa.confirmDialog.deleteTransect.message=The flight is not started, do you want to definitely delete this flight's transect ?
sammoa.confirmDialog.flightInProgress.message.exit=A flight is in progress, are you sure you want to quit ?
sammoa.confirmDialog.flightInProgress.message.showHome=A flight is in progress, are you sure you want to go back to the home screen ?
sammoa.confirmDialog.flightInProgress.title=Flight in progress
+sammoa.confirmDialog.validation.delete.message=Are you sure you want to definitely delete this %s ?
+sammoa.confirmDialog.validation.deleteByCascade.message=This %1$s contains some deleted %2$ss, do you want to continue ? This will definitely delete %2$s marked as deleted.
sammoa.datePattern=dd/MM/yyyy
sammoa.dateTimePattern=dd/MM/yyyy HH\:mm\:ss
sammoa.dialog.title.importSammoaFile=Choose sammoa file to import
@@ -261,6 +263,9 @@
sammoa.title.flight=System %1$s - Campaign %2$s - Region %3$s - Flight n°%4$d
sammoa.title.home=Home
sammoa.title.importApplication=Application import
+sammoa.validable.observation=sighting
+sammoa.validable.route=route
+sammoa.validable.transect=transect
sammoa.validator.campaign.beginDate.required=The begin date must be defined
sammoa.validator.campaign.code.required=The campaign code must be defined
sammoa.validator.campaign.endDate.anterior=The end date can't be anterior to the begin date
1
0
r555 - trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util
by fdesbois@users.forge.codelutin.com 07 Sep '12
by fdesbois@users.forge.codelutin.com 07 Sep '12
07 Sep '12
Author: fdesbois
Date: 2012-09-07 14:51:11 +0200 (Fri, 07 Sep 2012)
New Revision: 555
Url: http://forge.codelutin.com/repositories/revision/sammoa/555
Log:
fixes #1475: resolve issue with selection on new row
Modified:
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/TableDataChangeListener.java
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/TableDataChangeListener.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/TableDataChangeListener.java 2012-09-07 12:42:43 UTC (rev 554)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/TableDataChangeListener.java 2012-09-07 12:51:11 UTC (rev 555)
@@ -117,8 +117,10 @@
tableModel.fireTableRowsInserted(rowIndex, rowIndex + diff - 1);
if (firstEditableColumn != NO_COLUMN_INDEX_TO_EDIT_ON_INSERT) {
- table.changeSelection(rowIndex, firstEditableColumn, false, false);
- table.editCellAt(rowIndex, firstEditableColumn);
+ int viewRowIndex = table.convertRowIndexToView(rowIndex);
+ int viewColIndex = table.convertColumnIndexToView(firstEditableColumn);
+ table.changeSelection(viewRowIndex, viewColIndex, false, false);
+ table.editCellAt(viewRowIndex, viewColIndex);
}
}
1
0
r554 - trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight
by fdesbois@users.forge.codelutin.com 07 Sep '12
by fdesbois@users.forge.codelutin.com 07 Sep '12
07 Sep '12
Author: fdesbois
Date: 2012-09-07 14:42:43 +0200 (Fri, 07 Sep 2012)
New Revision: 554
Url: http://forge.codelutin.com/repositories/revision/sammoa/554
Log:
fixes #1476 : block edition for validated transect
Modified:
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/TransectTableModel.java
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/TransectTableModel.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/TransectTableModel.java 2012-09-07 12:42:30 UTC (rev 553)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/TransectTableModel.java 2012-09-07 12:42:43 UTC (rev 554)
@@ -104,7 +104,8 @@
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
TransectColumn column = TransectColumn.valueOf(columnIndex);
- return column.isEditable();
+ TransectFlightModel bean = getTransectFlights().get(rowIndex);
+ return column.isEditable(bean);
}
@Override
@@ -333,8 +334,8 @@
SammoaUtil.setPropertyValue(bean, value, beanProperties);
}
- public boolean isEditable() {
- boolean result = editable;
+ public boolean isEditable(TransectFlightModel bean) {
+ boolean result = !bean.isValid() && editable;
return result;
}
1
0
r553 - trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing
by fdesbois@users.forge.codelutin.com 07 Sep '12
by fdesbois@users.forge.codelutin.com 07 Sep '12
07 Sep '12
Author: fdesbois
Date: 2012-09-07 14:42:30 +0200 (Fri, 07 Sep 2012)
New Revision: 553
Url: http://forge.codelutin.com/repositories/revision/sammoa/553
Log:
Replace Beta by RC
Modified:
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/BetaLayerUI.java
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/BetaLayerUI.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/BetaLayerUI.java 2012-09-07 11:43:11 UTC (rev 552)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/BetaLayerUI.java 2012-09-07 12:42:30 UTC (rev 553)
@@ -63,6 +63,6 @@
g2.translate(35, 20);
g2.setFont(new Font("Dialog", Font.BOLD, 16));
g2.setColor(Color.BLACK);
- g2.drawString("Beta version", 10, 10);
+ g2.drawString("RC version", 10, 10);
}
}
1
0
r552 - in trunk: sammoa-application/src/main/java/fr/ulr/sammoa/application/flightController sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action
by fdesbois@users.forge.codelutin.com 07 Sep '12
by fdesbois@users.forge.codelutin.com 07 Sep '12
07 Sep '12
Author: fdesbois
Date: 2012-09-07 13:43:11 +0200 (Fri, 07 Sep 2012)
New Revision: 552
Url: http://forge.codelutin.com/repositories/revision/sammoa/552
Log:
fixes #1465 : resolve issue with deleted on nextTransect + improve action bindings
Modified:
trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/flightController/BaseFlightController.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BeginAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/NextAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java
trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java
Modified: trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/flightController/BaseFlightController.java
===================================================================
--- trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/flightController/BaseFlightController.java 2012-09-07 08:48:22 UTC (rev 551)
+++ trunk/sammoa-application/src/main/java/fr/ulr/sammoa/application/flightController/BaseFlightController.java 2012-09-07 11:43:11 UTC (rev 552)
@@ -356,8 +356,9 @@
isOffEffort(), "You can call begin() only if flight is running (started, not ended, not on effort)");
Preconditions.checkState(
- nextTransect != null, "You can't call begin() if no transect is selected. " +
- "Call setNextTransect() method first");
+ nextTransect != null && !nextTransect.isDeleted(),
+ "You can't call begin() if no transect is selected or if it is " +
+ "deleted. Call setNextTransect() method first");
TopiaContext tx = beginTransaction();
try {
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java 2012-09-07 08:48:22 UTC (rev 551)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java 2012-09-07 11:43:11 UTC (rev 552)
@@ -613,7 +613,7 @@
// use it as next one
boolean result = Routes.isAnyMatchTransectFlight(
getModel().getRoutes(), transectFlight);
- return !result;
+ return !transectFlight.isDeleted() && !result;
}
});
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java 2012-09-07 08:48:22 UTC (rev 551)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BaseFlightAction.java 2012-09-07 11:43:11 UTC (rev 552)
@@ -23,16 +23,23 @@
*/
package fr.ulr.sammoa.ui.swing.flight.action;
+import com.google.common.base.Splitter;
import fr.ulr.sammoa.application.flightController.FlightController;
import fr.ulr.sammoa.ui.swing.SammoaUIContext;
import fr.ulr.sammoa.ui.swing.flight.FlightUIHandler;
import fr.ulr.sammoa.ui.swing.flight.FlightUIModel;
+import fr.ulr.sammoa.ui.swing.util.SammoaUtil;
import jaxx.runtime.JAXXContext;
+import org.jdesktop.beans.AbstractBean;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.swing.AbstractAction;
import javax.swing.Icon;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.Iterator;
/**
* Created: 03/07/12
@@ -41,6 +48,9 @@
*/
public abstract class BaseFlightAction extends AbstractAction {
+ /** Logger. */
+ private static final Logger logger = LoggerFactory.getLogger(BaseFlightAction.class);
+
protected JAXXContext context;
public BaseFlightAction(String name, Icon icon, JAXXContext context) {
@@ -76,17 +86,94 @@
protected void bindModelProperties(String... properties) {
for (String property : properties) {
- getModel().addPropertyChangeListener(property, enabledListener);
+ EnabledListener enabledListener = new EnabledListener(property);
+ getModel().addPropertyChangeListener(enabledListener.getProperty(), enabledListener);
}
}
- protected PropertyChangeListener enabledListener = new PropertyChangeListener() {
+ protected class EnabledListener implements PropertyChangeListener {
+ protected String property;
+
+ protected EnabledListener embeddedListener;
+
+ public EnabledListener(String property) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("[{}] New EnabledListener for property '{}'",
+ BaseFlightAction.this.getClass().getSimpleName(),
+ property);
+ }
+
+ // Init embeddedListener for nestedProperty
+ if (property.contains(".")) {
+ Iterator<String> it =
+ Splitter.on(".").limit(2).split(property).iterator();
+
+ // First element is the property
+ this.property = it.next();
+
+ // Next property is the nested one
+ String nestedProperty = it.next();
+ if (logger.isDebugEnabled()) {
+ logger.debug("[{}] Add embedded EnabledListener for " +
+ "nestedProperty '{}', this EnabledListener " +
+ "attached to '{}'",
+ new Object[] {
+ BaseFlightAction.this.getClass().getSimpleName(),
+ nestedProperty,
+ this.property
+ });
+ }
+ this.embeddedListener = new EnabledListener(nestedProperty);
+
+ // Attach embedded on the current value from model
+ Object currentValue =
+ SammoaUtil.getPropertyValue(getModel(), this.property);
+ attachEmbeddedListener(null, currentValue);
+
+ } else {
+ this.property = property;
+ }
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
@Override
public void propertyChange(PropertyChangeEvent evt) {
+ if (embeddedListener != null) {
+ attachEmbeddedListener(evt.getOldValue(), evt.getNewValue());
+ }
setEnabled(checkEnabled());
}
- };
+ protected void attachEmbeddedListener(Object oldValue, Object newValue) {
+
+ if (oldValue != null) {
+ if (oldValue instanceof TopiaEntity) {
+ TopiaEntity entity = (TopiaEntity) oldValue;
+ entity.removePropertyChangeListener(embeddedListener.getProperty(), embeddedListener);
+
+ } else if (oldValue instanceof AbstractBean) {
+ AbstractBean entity = (AbstractBean) oldValue;
+ entity.removePropertyChangeListener(embeddedListener.getProperty(), embeddedListener);
+ }
+ }
+
+ if (newValue != null) {
+ if (newValue instanceof TopiaEntity) {
+ TopiaEntity entity = (TopiaEntity) newValue;
+ entity.addPropertyChangeListener(embeddedListener.getProperty(), embeddedListener);
+
+ } else if (newValue instanceof AbstractBean) {
+ AbstractBean entity = (AbstractBean) newValue;
+ entity.addPropertyChangeListener(embeddedListener.getProperty(), embeddedListener);
+ }
+ }
+ }
+ }
+
protected abstract boolean checkEnabled();
}
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BeginAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BeginAction.java 2012-09-07 08:48:22 UTC (rev 551)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/BeginAction.java 2012-09-07 11:43:11 UTC (rev 552)
@@ -50,7 +50,7 @@
bindModelProperties(
FlightUIModel.PROPERTY_FLIGHT_STATE,
FlightUIModel.PROPERTY_CURRENT_ROUTE,
- FlightUIModel.PROPERTY_NEXT_TRANSECT
+ FlightUIModel.PROPERTY_NEXT_TRANSECT + ".deleted"
);
}
@@ -67,6 +67,7 @@
TransectFlight nextTransect = getModel().getNextTransect();
boolean isReadyForLeg = nextTransect != null
+ && !nextTransect.isDeleted()
&& getModel().getFlightState() == FlightState.OFF_EFFORT;
return isCircleBack || isReadyForLeg;
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/NextAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/NextAction.java 2012-09-07 08:48:22 UTC (rev 551)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/NextAction.java 2012-09-07 11:43:11 UTC (rev 552)
@@ -44,7 +44,8 @@
public NextAction(JAXXContext context) {
super(_("sammoa.action.next"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.next.tip"));
- bindModelProperties(FlightUIModel.PROPERTY_FLIGHT_STATE, FlightUIModel.PROPERTY_NEXT_TRANSECT);
+ bindModelProperties(FlightUIModel.PROPERTY_FLIGHT_STATE,
+ FlightUIModel.PROPERTY_NEXT_TRANSECT + ".deleted");
}
@Override
@@ -55,6 +56,7 @@
@Override
protected boolean checkEnabled() {
return getModel().getFlightState() == FlightState.ON_EFFORT
- && getModel().getNextTransect() != null;
+ && getModel().getNextTransect() != null
+ && !getModel().getNextTransect().isDeleted();
}
}
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java 2012-09-07 08:48:22 UTC (rev 551)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidAction.java 2012-09-07 11:43:11 UTC (rev 552)
@@ -31,15 +31,11 @@
import fr.ulr.sammoa.persistence.Validable;
import fr.ulr.sammoa.ui.swing.SammoaUIContext;
import jaxx.runtime.JAXXContext;
-import org.jdesktop.beans.AbstractBean;
-import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.util.Resource;
import org.nuiton.validator.bean.list.BeanListValidator;
import org.nuiton.validator.bean.list.BeanListValidatorEvent;
import org.nuiton.validator.bean.list.BeanListValidatorListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import java.util.Map;
/**
@@ -109,47 +105,47 @@
return getValidator(Observation.class);
}
- protected <E extends TopiaEntity & Validable> void bindValidableEntity(String propertyName,
- Class<E> propertyClass) {
-
- getModel().addPropertyChangeListener(propertyName, new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- TopiaEntity oldValue = (TopiaEntity) evt.getOldValue();
- if (oldValue != null) {
- oldValue.removePropertyChangeListener(
- "deleted", enabledListener);
- }
- TopiaEntity newValue = (TopiaEntity) evt.getNewValue();
- if (newValue != null) {
- newValue.addPropertyChangeListener(
- "deleted", enabledListener);
- }
- enabledListener.propertyChange(evt);
- }
- });
- }
-
- protected <E extends AbstractBean & Validable> void bindValidableModel(String propertyName,
- Class<E> propertyClass) {
-
- getModel().addPropertyChangeListener(propertyName, new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- AbstractBean oldValue = (AbstractBean) evt.getOldValue();
- if (oldValue != null) {
- oldValue.removePropertyChangeListener(
- "deleted", enabledListener);
- }
- AbstractBean newValue = (AbstractBean) evt.getNewValue();
- if (newValue != null) {
- newValue.addPropertyChangeListener(
- "deleted", enabledListener);
- }
- enabledListener.propertyChange(evt);
- }
- });
- }
+// protected <E extends TopiaEntity & Validable> void bindValidableEntity(String propertyName,
+// Class<E> propertyClass) {
+//
+// getModel().addPropertyChangeListener(propertyName, new PropertyChangeListener() {
+//
+// @Override
+// public void propertyChange(PropertyChangeEvent evt) {
+// TopiaEntity oldValue = (TopiaEntity) evt.getOldValue();
+// if (oldValue != null) {
+// oldValue.removePropertyChangeListener(
+// "deleted", enabledListener);
+// }
+// TopiaEntity newValue = (TopiaEntity) evt.getNewValue();
+// if (newValue != null) {
+// newValue.addPropertyChangeListener(
+// "deleted", enabledListener);
+// }
+// enabledListener.propertyChange(evt);
+// }
+// });
+// }
+//
+// protected <E extends AbstractBean & Validable> void bindValidableModel(String propertyName,
+// Class<E> propertyClass) {
+//
+// getModel().addPropertyChangeListener(propertyName, new PropertyChangeListener() {
+//
+// @Override
+// public void propertyChange(PropertyChangeEvent evt) {
+// AbstractBean oldValue = (AbstractBean) evt.getOldValue();
+// if (oldValue != null) {
+// oldValue.removePropertyChangeListener(
+// "deleted", enabledListener);
+// }
+// AbstractBean newValue = (AbstractBean) evt.getNewValue();
+// if (newValue != null) {
+// newValue.addPropertyChangeListener(
+// "deleted", enabledListener);
+// }
+// enabledListener.propertyChange(evt);
+// }
+// });
+// }
}
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java 2012-09-07 08:48:22 UTC (rev 551)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidObservationAction.java 2012-09-07 11:43:11 UTC (rev 552)
@@ -50,7 +50,7 @@
public ValidObservationAction(JAXXContext context) {
super(_("sammoa.action.validObservation"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.validObservation.tip"));
- bindValidableEntity(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN, Observation.class);
+ bindModelProperties(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN + ".deleted");
}
@Override
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java 2012-09-07 08:48:22 UTC (rev 551)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidRouteAction.java 2012-09-07 11:43:11 UTC (rev 552)
@@ -24,7 +24,6 @@
*/
import fr.ulr.sammoa.application.FlightService;
-import fr.ulr.sammoa.persistence.Observation;
import fr.ulr.sammoa.persistence.Route;
import fr.ulr.sammoa.persistence.Routes;
import fr.ulr.sammoa.ui.swing.flight.FlightUIModel;
@@ -54,8 +53,8 @@
public ValidRouteAction(JAXXContext context) {
super(_("sammoa.action.validRoute"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.validRoute.tip"));
- bindValidableEntity(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN, Observation.class);
- bindValidableEntity(FlightUIModel.PROPERTY_ROUTE_EDIT_BEAN, Route.class);
+ bindModelProperties(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN + ".deleted",
+ FlightUIModel.PROPERTY_ROUTE_EDIT_BEAN + ".deleted");
}
@Override
Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java
===================================================================
--- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java 2012-09-07 08:48:22 UTC (rev 551)
+++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/action/ValidTransectAction.java 2012-09-07 11:43:11 UTC (rev 552)
@@ -24,7 +24,6 @@
*/
import fr.ulr.sammoa.application.FlightService;
-import fr.ulr.sammoa.persistence.Observation;
import fr.ulr.sammoa.persistence.Route;
import fr.ulr.sammoa.persistence.TransectFlight;
import fr.ulr.sammoa.persistence.TransectFlights;
@@ -56,9 +55,9 @@
public ValidTransectAction(JAXXContext context) {
super(_("sammoa.action.validTransect"), context);
putValue(Action.SHORT_DESCRIPTION, _("sammoa.action.validTransect.tip"));
- bindValidableEntity(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN, Observation.class);
- bindValidableEntity(FlightUIModel.PROPERTY_ROUTE_EDIT_BEAN, Route.class);
- bindValidableModel(FlightUIModel.PROPERTY_TRANSECT_FLIGHT_EDIT_BEAN, TransectFlightModel.class);
+ bindModelProperties(FlightUIModel.PROPERTY_OBSERVATION_EDIT_BEAN + ".deleted",
+ FlightUIModel.PROPERTY_ROUTE_EDIT_BEAN + ".deleted",
+ FlightUIModel.PROPERTY_TRANSECT_FLIGHT_EDIT_BEAN + ".deleted");
}
@Override
1
0