Tutti-commits
Threads by month
- ----- 2026 -----
- August
- July
- 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
December 2012
- 2 participants
- 109 discussions
r59 - trunk/tutti-ui-swing/src/main/resources/i18n
by kmorin@users.forge.codelutin.com Dec. 14, 2012
by kmorin@users.forge.codelutin.com Dec. 14, 2012
Dec. 14, 2012
Author: kmorin
Date: 2012-12-14 17:28:45 +0100 (Fri, 14 Dec 2012)
New Revision: 59
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/59
Log:
add translation
Modified:
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-14 10:12:14 UTC (rev 58)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-14 16:28:45 UTC (rev 59)
@@ -41,6 +41,9 @@
tutti.config.ui.autoPopupNumberEditor=Toujours afficher le pav\u00c3\u00a9 num\u00c3\u00a9rique lors de l'\u00c3\u00a9dition d'un nombre
tutti.config.ui.config=Chemin du fichier de configuration des interfaces graphiques
tutti.config.ui.showNumberEditorButton=Afficher le pav\u00c3\u00a9 num\u00c3\u00a9rique de saisie
+tutti.label.attachmentEditor.file=Fichier
+tutti.label.attachmentEditor.fileComment=Commentaire
+tutti.label.attachmentEditor.fileName=Nom
tutti.label.benthos.sampleTotalWeight=Poids total \u00c3\u00a9chantillonn\u00c3\u00a9
tutti.label.benthos.totalWeight=Poids total
tutti.label.comment=Commentaire
1
0
r58 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation: accidental benthos macrowaste plankton
by kmorin@users.forge.codelutin.com Dec. 14, 2012
by kmorin@users.forge.codelutin.com Dec. 14, 2012
Dec. 14, 2012
Author: kmorin
Date: 2012-12-14 11:12:14 +0100 (Fri, 14 Dec 2012)
New Revision: 58
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/58
Log:
add comment editor to the tables with a comment column
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx 2012-12-13 17:13:46 UTC (rev 57)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx 2012-12-14 10:12:14 UTC (rev 58)
@@ -29,6 +29,7 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
jaxx.runtime.swing.editor.NumberEditor
@@ -60,6 +61,8 @@
<AccidentalBatchUIModel id='model'
initializer='getContextValue(AccidentalBatchUIModel.class)'/>
+ <LongTextEditorUI id='longTextEditorUI'/>
+
<JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
<JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
</JScrollPane>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java 2012-12-13 17:13:46 UTC (rev 57)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java 2012-12-14 10:12:14 UTC (rev 58)
@@ -35,6 +35,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import jaxx.runtime.SwingUtil;
@@ -154,6 +155,8 @@
{ // Comment column
addColumnToModel(columnModel,
+ LongTextCellComponent.newEditor(ui.getLongTextEditorUI()),
+ LongTextCellComponent.newRender(),
AccidentalBatchTableModel.COMMENT);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx 2012-12-13 17:13:46 UTC (rev 57)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx 2012-12-14 10:12:14 UTC (rev 58)
@@ -29,6 +29,7 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
jaxx.runtime.swing.editor.NumberEditor
@@ -71,6 +72,8 @@
<field name='sampleTotalWeight' component='sampleTotalWeightField'/>
</BeanValidator>
+ <LongTextEditorUI id='longTextEditorUI'/>
+
<Table id='form' fill='both' constraints='BorderLayout.NORTH'>
<!-- Poids total -->
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java 2012-12-13 17:13:46 UTC (rev 57)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java 2012-12-14 10:12:14 UTC (rev 58)
@@ -35,6 +35,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import jaxx.runtime.SwingUtil;
@@ -186,6 +187,8 @@
{ // Comment column
addColumnToModel(columnModel,
+ LongTextCellComponent.newEditor(ui.getLongTextEditorUI()),
+ LongTextCellComponent.newRender(),
BenthosBatchTableModel.COMMENT);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx 2012-12-13 17:13:46 UTC (rev 57)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx 2012-12-14 10:12:14 UTC (rev 58)
@@ -29,6 +29,7 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
jaxx.runtime.swing.editor.NumberEditor
@@ -70,6 +71,8 @@
<field name='totalWeight' component='totalWeightField'/>
</BeanValidator>
+ <LongTextEditorUI id='longTextEditorUI'/>
+
<Table id='form' fill='both' constraints='BorderLayout.NORTH'>
<!-- Poids total -->
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java 2012-12-13 17:13:46 UTC (rev 57)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java 2012-12-14 10:12:14 UTC (rev 58)
@@ -35,6 +35,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import jaxx.runtime.SwingUtil;
@@ -157,6 +158,8 @@
{ // Comment column
addColumnToModel(columnModel,
+ LongTextCellComponent.newEditor(ui.getLongTextEditorUI()),
+ LongTextCellComponent.newRender(),
MacroWasteBatchTableModel.COMMENT);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx 2012-12-13 17:13:46 UTC (rev 57)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx 2012-12-14 10:12:14 UTC (rev 58)
@@ -29,6 +29,7 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
jaxx.runtime.swing.editor.NumberEditor
@@ -71,6 +72,8 @@
<field name='sampleTotalWeight' component='sampleTotalWeightField'/>
</BeanValidator>
+ <LongTextEditorUI id='longTextEditorUI'/>
+
<Table id='form' fill='both' constraints='BorderLayout.NORTH'>
<!-- Poids total -->
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java 2012-12-13 17:13:46 UTC (rev 57)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java 2012-12-14 10:12:14 UTC (rev 58)
@@ -35,6 +35,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import jaxx.runtime.SwingUtil;
@@ -186,6 +187,8 @@
{ // Comment column
addColumnToModel(columnModel,
+ LongTextCellComponent.newEditor(ui.getLongTextEditorUI()),
+ LongTextCellComponent.newRender(),
PlanktonBatchTableModel.COMMENT);
}
1
0
r57 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/content/operation/species java/fr/ifremer/tutti/ui/swing/util java/fr/ifremer/tutti/ui/swing/util/editor resources/i18n
by kmorin@users.forge.codelutin.com Dec. 13, 2012
by kmorin@users.forge.codelutin.com Dec. 13, 2012
Dec. 13, 2012
Author: kmorin
Date: 2012-12-13 18:13:46 +0100 (Thu, 13 Dec 2012)
New Revision: 57
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/57
Log:
create comment editor
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ComponentMover.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ComponentResizer.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUIHandler.java
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx 2012-12-13 15:37:44 UTC (rev 56)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx 2012-12-13 17:13:46 UTC (rev 57)
@@ -30,6 +30,7 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesFrequencyUI
+ fr.ifremer.tutti.ui.swing.util.editor.LongTextEditorUI
org.jdesktop.swingx.JXTable
@@ -76,6 +77,8 @@
</BeanValidator>
<SpeciesFrequencyUI id='frequencyUI' constructorParams='handler.getContext()'/>
+
+ <LongTextEditorUI id='longTextEditorUI'/>
<Table id='form' fill='both' constraints='BorderLayout.NORTH'>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java 2012-12-13 15:37:44 UTC (rev 56)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java 2012-12-13 17:13:46 UTC (rev 57)
@@ -41,6 +41,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.editor.LongTextCellComponent;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import jaxx.runtime.SwingUtil;
@@ -299,6 +300,8 @@
{ // Comment column
addColumnToModel(columnModel,
+ LongTextCellComponent.newEditor(ui.getLongTextEditorUI()),
+ LongTextCellComponent.newRender(),
SpeciesBatchTableModel.COMMENT);
}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ComponentMover.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ComponentMover.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ComponentMover.java 2012-12-13 17:13:46 UTC (rev 57)
@@ -0,0 +1,375 @@
+package fr.ifremer.tutti.ui.swing.util;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
+
+/**
+ * This class allows you to move a Component by using a mouse. The Component
+ * moved can be a high level Window (ie. Window, Frame, Dialog) in which case
+ * the Window is moved within the desktop. Or the Component can belong to a
+ * Container in which case the Component is moved within the Container.
+ *
+ * When moving a Window, the listener can be added to a child Component of
+ * the Window. In this case attempting to move the child will result in the
+ * Window moving. For example, you might create a custom "Title Bar" for an
+ * undecorated Window and moving of the Window is accomplished by moving the
+ * title bar only. Multiple components can be registered as "window movers".
+ *
+ * Components can be registered when the class is created. Additional
+ * components can be added at any time using the registerComponent() method.
+ */
+public class ComponentMover extends MouseAdapter
+{
+ private Insets dragInsets = new Insets(0, 0, 0, 0);
+ private Dimension snapSize = new Dimension(1, 1);
+ private Insets edgeInsets = new Insets(0, 0, 0, 0);
+ private boolean changeCursor = true;
+ private boolean autoLayout = false;
+
+ private Class destinationClass;
+ private Component destinationComponent;
+ private Component destination;
+ private Component source;
+
+ private Point pressed;
+ private Point location;
+
+ private Cursor originalCursor;
+ private boolean autoscrolls;
+ private boolean potentialDrag;
+
+
+ /**
+ * Constructor for moving individual components. The components must be
+ * regisetered using the registerComponent() method.
+ */
+ public ComponentMover()
+ {
+ }
+
+ /**
+ * Constructor to specify a Class of Component that will be moved when
+ * drag events are generated on a registered child component. The events
+ * will be passed to the first ancestor of this specified class.
+ *
+ * @param destinationClass the Class of the ancestor component
+ * @param component the Components to be registered for forwarding
+ * drag events to the ancestor Component.
+ */
+ public ComponentMover(Class destinationClass, Component... components)
+ {
+ this.destinationClass = destinationClass;
+ registerComponent( components );
+ }
+
+ /**
+ * Constructor to specify a parent component that will be moved when drag
+ * events are generated on a registered child component.
+ *
+ * @param destinationComponent the component drage events should be forwareded to
+ * @param components the Components to be registered for forwarding drag
+ * events to the parent component to be moved
+ */
+ public ComponentMover(Component destinationComponent, Component... components)
+ {
+ this.destinationComponent = destinationComponent;
+ registerComponent( components );
+ }
+
+ /**
+ * Get the auto layout property
+ *
+ * @return the auto layout property
+ */
+ public boolean isAutoLayout()
+ {
+ return autoLayout;
+ }
+
+ /**
+ * Set the auto layout property
+ *
+ * @param autoLayout when true layout will be invoked on the parent container
+ */
+ public void setAutoLayout(boolean autoLayout)
+ {
+ this.autoLayout = autoLayout;
+ }
+
+ /**
+ * Get the change cursor property
+ *
+ * @return the change cursor property
+ */
+ public boolean isChangeCursor()
+ {
+ return changeCursor;
+ }
+
+ /**
+ * Set the change cursor property
+ *
+ * @param changeCursor when true the cursor will be changed to the
+ * Cursor.MOVE_CURSOR while the mouse is pressed
+ */
+ public void setChangeCursor(boolean changeCursor)
+ {
+ this.changeCursor = changeCursor;
+ }
+
+ /**
+ * Get the drag insets
+ *
+ * @return the drag insets
+ */
+ public Insets getDragInsets()
+ {
+ return dragInsets;
+ }
+
+ /**
+ * Set the drag insets. The insets specify an area where mouseDragged
+ * events should be ignored and therefore the component will not be moved.
+ * This will prevent these events from being confused with a
+ * MouseMotionListener that supports component resizing.
+ *
+ * @param dragInsets
+ */
+ public void setDragInsets(Insets dragInsets)
+ {
+ this.dragInsets = dragInsets;
+ }
+
+ /**
+ * Get the bounds insets
+ *
+ * @return the bounds insets
+ */
+ public Insets getEdgeInsets()
+ {
+ return edgeInsets;
+ }
+
+ /**
+ * Set the edge insets. The insets specify how close to each edge of the parent
+ * component that the child component can be moved. Positive values means the
+ * component must be contained within the parent. Negative values means the
+ * component can be moved outside the parent.
+ *
+ * @param edgeInsets
+ */
+ public void setEdgeInsets(Insets edgeInsets)
+ {
+ this.edgeInsets = edgeInsets;
+ }
+
+ /**
+ * Remove listeners from the specified component
+ *
+ * @param component the component the listeners are removed from
+ */
+ public void deregisterComponent(Component... components)
+ {
+ for (Component component : components)
+ component.removeMouseListener( this );
+ }
+
+ /**
+ * Add the required listeners to the specified component
+ *
+ * @param component the component the listeners are added to
+ */
+ public void registerComponent(Component... components)
+ {
+ for (Component component : components)
+ component.addMouseListener( this );
+ }
+
+ /**
+ * Get the snap size
+ *
+ * @return the snap size
+ */
+ public Dimension getSnapSize()
+ {
+ return snapSize;
+ }
+
+ /**
+ * Set the snap size. Forces the component to be snapped to
+ * the closest grid position. Snapping will occur when the mouse is
+ * dragged half way.
+ */
+ public void setSnapSize(Dimension snapSize)
+ {
+ if (snapSize.width < 1
+ || snapSize.height < 1)
+ throw new IllegalArgumentException("Snap sizes must be greater than 0");
+
+ this.snapSize = snapSize;
+ }
+
+ /**
+ * Setup the variables used to control the moving of the component:
+ *
+ * source - the source component of the mouse event
+ * destination - the component that will ultimately be moved
+ * pressed - the Point where the mouse was pressed in the destination
+ * component coordinates.
+ */
+ @Override
+ public void mousePressed(MouseEvent e)
+ {
+ source = e.getComponent();
+ int width = source.getSize().width - dragInsets.left - dragInsets.right;
+ int height = source.getSize().height - dragInsets.top - dragInsets.bottom;
+ Rectangle r = new Rectangle(dragInsets.left, dragInsets.top, width, height);
+
+ if (r.contains(e.getPoint()))
+ setupForDragging(e);
+ }
+
+ private void setupForDragging(MouseEvent e)
+ {
+ source.addMouseMotionListener( this );
+ potentialDrag = true;
+
+ // Determine the component that will ultimately be moved
+
+ if (destinationComponent != null)
+ {
+ destination = destinationComponent;
+ }
+ else if (destinationClass == null)
+ {
+ destination = source;
+ }
+ else // forward events to destination component
+ {
+ destination = SwingUtilities.getAncestorOfClass(destinationClass, source);
+ }
+
+ pressed = e.getLocationOnScreen();
+ location = destination.getLocation();
+
+ if (changeCursor)
+ {
+ originalCursor = source.getCursor();
+ source.setCursor( Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR) );
+ }
+
+ // Making sure autoscrolls is false will allow for smoother dragging of
+ // individual components
+
+ if (destination instanceof JComponent)
+ {
+ JComponent jc = (JComponent)destination;
+ autoscrolls = jc.getAutoscrolls();
+ jc.setAutoscrolls( false );
+ }
+ }
+
+ /**
+ * Move the component to its new location. The dragged Point must be in
+ * the destination coordinates.
+ */
+ @Override
+ public void mouseDragged(MouseEvent e)
+ {
+ Point dragged = e.getLocationOnScreen();
+ int dragX = getDragDistance(dragged.x, pressed.x, snapSize.width);
+ int dragY = getDragDistance(dragged.y, pressed.y, snapSize.height);
+
+ int locationX = location.x + dragX;
+ int locationY = location.y + dragY;
+
+ // Mouse dragged events are not generated for every pixel the mouse
+ // is moved. Adjust the location to make sure we are still on a
+ // snap value.
+
+ while (locationX < edgeInsets.left)
+ locationX += snapSize.width;
+
+ while (locationY < edgeInsets.top)
+ locationY += snapSize.height;
+
+ Dimension d = getBoundingSize( destination );
+
+ while (locationX + destination.getSize().width + edgeInsets.right > d.width)
+ locationX -= snapSize.width;
+
+ while (locationY + destination.getSize().height + edgeInsets.bottom > d.height)
+ locationY -= snapSize.height;
+
+ // Adjustments are finished, move the component
+
+ destination.setLocation(locationX, locationY);
+ }
+
+ /*
+ * Determine how far the mouse has moved from where dragging started
+ * (Assume drag direction is down and right for positive drag distance)
+ */
+ private int getDragDistance(int larger, int smaller, int snapSize)
+ {
+ int halfway = snapSize / 2;
+ int drag = larger - smaller;
+ drag += (drag < 0) ? -halfway : halfway;
+ drag = (drag / snapSize) * snapSize;
+
+ return drag;
+ }
+
+ /*
+ * Get the bounds of the parent of the dragged component.
+ */
+ private Dimension getBoundingSize(Component source)
+ {
+ if (source instanceof Window)
+ {
+ GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ Rectangle bounds = env.getMaximumWindowBounds();
+ return new Dimension(bounds.width, bounds.height);
+ }
+ else
+ {
+ return source.getParent().getSize();
+ }
+ }
+
+ /**
+ * Restore the original state of the Component
+ */
+ @Override
+ public void mouseReleased(MouseEvent e)
+ {
+ if (!potentialDrag) return;
+
+ source.removeMouseMotionListener( this );
+ potentialDrag = false;
+
+ if (changeCursor)
+ source.setCursor( originalCursor );
+
+ if (destination instanceof JComponent)
+ {
+ ((JComponent)destination).setAutoscrolls( autoscrolls );
+ }
+
+ // Layout the components on the parent container
+
+ if (autoLayout)
+ {
+ if (destination instanceof JComponent)
+ {
+ ((JComponent)destination).revalidate();
+ }
+ else
+ {
+ destination.validate();
+ }
+ }
+ }
+}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ComponentResizer.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ComponentResizer.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ComponentResizer.java 2012-12-13 17:13:46 UTC (rev 57)
@@ -0,0 +1,458 @@
+package fr.ifremer.tutti.ui.swing.util;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
+
+/**
+ * The ComponentResizer allows you to resize a component by dragging a border
+ * of the component.
+ */
+public class ComponentResizer extends MouseAdapter
+{
+ private final static Dimension MINIMUM_SIZE = new Dimension(10, 10);
+ private final static Dimension MAXIMUM_SIZE =
+ new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
+
+ private static Map<Integer, Integer> cursors = new HashMap<Integer, Integer>();
+ {
+ cursors.put(1, Cursor.N_RESIZE_CURSOR);
+ cursors.put(2, Cursor.W_RESIZE_CURSOR);
+ cursors.put(4, Cursor.S_RESIZE_CURSOR);
+ cursors.put(8, Cursor.E_RESIZE_CURSOR);
+ cursors.put(3, Cursor.NW_RESIZE_CURSOR);
+ cursors.put(9, Cursor.NE_RESIZE_CURSOR);
+ cursors.put(6, Cursor.SW_RESIZE_CURSOR);
+ cursors.put(12, Cursor.SE_RESIZE_CURSOR);
+ }
+
+ private Insets dragInsets;
+ private Dimension snapSize;
+
+ private int direction;
+ protected static final int NORTH = 1;
+ protected static final int WEST = 2;
+ protected static final int SOUTH = 4;
+ protected static final int EAST = 8;
+
+ private Cursor sourceCursor;
+ private boolean resizing;
+ private Rectangle bounds;
+ private Point pressed;
+ private boolean autoscrolls;
+
+ private Dimension minimumSize = MINIMUM_SIZE;
+ private Dimension maximumSize = MAXIMUM_SIZE;
+
+ /**
+ * Convenience contructor. All borders are resizable in increments of
+ * a single pixel. Components must be registered separately.
+ */
+ public ComponentResizer()
+ {
+ this(new Insets(5, 5, 5, 5), new Dimension(1, 1));
+ }
+
+ /**
+ * Convenience contructor. All borders are resizable in increments of
+ * a single pixel. Components can be registered when the class is created
+ * or they can be registered separately afterwards.
+ *
+ * @param components components to be automatically registered
+ */
+ public ComponentResizer(Component... components)
+ {
+ this(new Insets(5, 5, 5, 5), new Dimension(1, 1), components);
+ }
+
+ /**
+ * Convenience contructor. Eligible borders are resisable in increments of
+ * a single pixel. Components can be registered when the class is created
+ * or they can be registered separately afterwards.
+ *
+ * @param dragInsets Insets specifying which borders are eligible to be
+ * resized.
+ * @param components components to be automatically registered
+ */
+ public ComponentResizer(Insets dragInsets, Component... components)
+ {
+ this(dragInsets, new Dimension(1, 1), components);
+ }
+
+ /**
+ * Create a ComponentResizer.
+ *
+ * @param dragInsets Insets specifying which borders are eligible to be
+ * resized.
+ * @param snapSize Specify the dimension to which the border will snap to
+ * when being dragged. Snapping occurs at the halfway mark.
+ * @param components components to be automatically registered
+ */
+ public ComponentResizer(Insets dragInsets, Dimension snapSize, Component... components)
+ {
+ setDragInsets( dragInsets );
+ setSnapSize( snapSize );
+ registerComponent( components );
+ }
+
+ /**
+ * Get the drag insets
+ *
+ * @return the drag insets
+ */
+ public Insets getDragInsets()
+ {
+ return dragInsets;
+ }
+
+ /**
+ * Set the drag dragInsets. The insets specify an area where mouseDragged
+ * events are recognized from the edge of the border inwards. A value of
+ * 0 for any size will imply that the border is not resizable. Otherwise
+ * the appropriate drag cursor will appear when the mouse is inside the
+ * resizable border area.
+ *
+ * @param dragInsets Insets to control which borders are resizeable.
+ */
+ public void setDragInsets(Insets dragInsets)
+ {
+ validateMinimumAndInsets(minimumSize, dragInsets);
+
+ this.dragInsets = dragInsets;
+ }
+
+ /**
+ * Get the components maximum size.
+ *
+ * @return the maximum size
+ */
+ public Dimension getMaximumSize()
+ {
+ return maximumSize;
+ }
+
+ /**
+ * Specify the maximum size for the component. The component will still
+ * be constrained by the size of its parent.
+ *
+ * @param maximumSize the maximum size for a component.
+ */
+ public void setMaximumSize(Dimension maximumSize)
+ {
+ this.maximumSize = maximumSize;
+ }
+
+ /**
+ * Get the components minimum size.
+ *
+ * @return the minimum size
+ */
+ public Dimension getMinimumSize()
+ {
+ return minimumSize;
+ }
+
+ /**
+ * Specify the minimum size for the component. The minimum size is
+ * constrained by the drag insets.
+ *
+ * @param minimumSize the minimum size for a component.
+ */
+ public void setMinimumSize(Dimension minimumSize)
+ {
+ validateMinimumAndInsets(minimumSize, dragInsets);
+
+ this.minimumSize = minimumSize;
+ }
+
+ /**
+ * Remove listeners from the specified component
+ *
+ * @param component the component the listeners are removed from
+ */
+ public void deregisterComponent(Component... components)
+ {
+ for (Component component : components)
+ {
+ component.removeMouseListener( this );
+ component.removeMouseMotionListener( this );
+ }
+ }
+
+ /**
+ * Add the required listeners to the specified component
+ *
+ * @param component the component the listeners are added to
+ */
+ public void registerComponent(Component... components)
+ {
+ for (Component component : components)
+ {
+ component.addMouseListener( this );
+ component.addMouseMotionListener( this );
+ }
+ }
+
+ /**
+ * Get the snap size.
+ *
+ * @return the snap size.
+ */
+ public Dimension getSnapSize()
+ {
+ return snapSize;
+ }
+
+ /**
+ * Control how many pixels a border must be dragged before the size of
+ * the component is changed. The border will snap to the size once
+ * dragging has passed the halfway mark.
+ *
+ * @param snapSize Dimension object allows you to separately spcify a
+ * horizontal and vertical snap size.
+ */
+ public void setSnapSize(Dimension snapSize)
+ {
+ this.snapSize = snapSize;
+ }
+
+ /**
+ * When the components minimum size is less than the drag insets then
+ * we can't determine which border should be resized so we need to
+ * prevent this from happening.
+ */
+ private void validateMinimumAndInsets(Dimension minimum, Insets drag)
+ {
+ int minimumWidth = drag.left + drag.right;
+ int minimumHeight = drag.top + drag.bottom;
+
+ if (minimum.width < minimumWidth
+ || minimum.height < minimumHeight)
+ {
+ String message = "Minimum size cannot be less than drag insets";
+ throw new IllegalArgumentException( message );
+ }
+ }
+
+ /**
+ */
+ @Override
+ public void mouseMoved(MouseEvent e)
+ {
+ Component source = e.getComponent();
+ Point location = e.getPoint();
+ direction = 0;
+
+ if (location.x < dragInsets.left)
+ direction += WEST;
+
+ if (location.x > source.getWidth() - dragInsets.right - 1)
+ direction += EAST;
+
+ if (location.y < dragInsets.top)
+ direction += NORTH;
+
+ if (location.y > source.getHeight() - dragInsets.bottom - 1)
+ direction += SOUTH;
+
+ // Mouse is no longer over a resizable border
+
+ if (direction == 0)
+ {
+ source.setCursor( sourceCursor );
+ }
+ else // use the appropriate resizable cursor
+ {
+ int cursorType = cursors.get( direction );
+ Cursor cursor = Cursor.getPredefinedCursor( cursorType );
+ source.setCursor( cursor );
+ }
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e)
+ {
+ if (! resizing)
+ {
+ Component source = e.getComponent();
+ sourceCursor = source.getCursor();
+ }
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e)
+ {
+ if (! resizing)
+ {
+ Component source = e.getComponent();
+ source.setCursor( sourceCursor );
+ }
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e)
+ {
+ // The mouseMoved event continually updates this variable
+
+ if (direction == 0) return;
+
+ // Setup for resizing. All future dragging calculations are done based
+ // on the original bounds of the component and mouse pressed location.
+
+ resizing = true;
+
+ Component source = e.getComponent();
+ pressed = e.getPoint();
+ SwingUtilities.convertPointToScreen(pressed, source);
+ bounds = source.getBounds();
+
+ // Making sure autoscrolls is false will allow for smoother resizing
+ // of components
+
+ if (source instanceof JComponent)
+ {
+ JComponent jc = (JComponent)source;
+ autoscrolls = jc.getAutoscrolls();
+ jc.setAutoscrolls( false );
+ }
+ }
+
+ /**
+ * Restore the original state of the Component
+ */
+ @Override
+ public void mouseReleased(MouseEvent e)
+ {
+ resizing = false;
+
+ Component source = e.getComponent();
+ source.setCursor( sourceCursor );
+
+ if (source instanceof JComponent)
+ {
+ ((JComponent)source).setAutoscrolls( autoscrolls );
+ }
+ }
+
+ /**
+ * Resize the component ensuring location and size is within the bounds
+ * of the parent container and that the size is within the minimum and
+ * maximum constraints.
+ *
+ * All calculations are done using the bounds of the component when the
+ * resizing started.
+ */
+ @Override
+ public void mouseDragged(MouseEvent e)
+ {
+ if (resizing == false) return;
+
+ Component source = e.getComponent();
+ Point dragged = e.getPoint();
+ SwingUtilities.convertPointToScreen(dragged, source);
+
+ changeBounds(source, direction, bounds, pressed, dragged);
+ }
+
+ protected void changeBounds(Component source, int direction, Rectangle bounds, Point pressed, Point current)
+ {
+ // Start with original locaton and size
+
+ int x = bounds.x;
+ int y = bounds.y;
+ int width = bounds.width;
+ int height = bounds.height;
+
+ // Resizing the West or North border affects the size and location
+
+ if (WEST == (direction & WEST))
+ {
+ int drag = getDragDistance(pressed.x, current.x, snapSize.width);
+ int maximum = Math.min(width + x, maximumSize.width);
+ drag = getDragBounded(drag, snapSize.width, width, minimumSize.width, maximum);
+
+ x -= drag;
+ width += drag;
+ }
+
+ if (NORTH == (direction & NORTH))
+ {
+ int drag = getDragDistance(pressed.y, current.y, snapSize.height);
+ int maximum = Math.min(height + y, maximumSize.height);
+ drag = getDragBounded(drag, snapSize.height, height, minimumSize.height, maximum);
+
+ y -= drag;
+ height += drag;
+ }
+
+ // Resizing the East or South border only affects the size
+
+ if (EAST == (direction & EAST))
+ {
+ int drag = getDragDistance(current.x, pressed.x, snapSize.width);
+ Dimension boundingSize = getBoundingSize( source );
+ int maximum = Math.min(boundingSize.width - x, maximumSize.width);
+ drag = getDragBounded(drag, snapSize.width, width, minimumSize.width, maximum);
+ width += drag;
+ }
+
+ if (SOUTH == (direction & SOUTH))
+ {
+ int drag = getDragDistance(current.y, pressed.y, snapSize.height);
+ Dimension boundingSize = getBoundingSize( source );
+ int maximum = Math.min(boundingSize.height - y, maximumSize.height);
+ drag = getDragBounded(drag, snapSize.height, height, minimumSize.height, maximum);
+ height += drag;
+ }
+
+ source.setBounds(x, y, width, height);
+ source.validate();
+ }
+
+ /*
+ * Determine how far the mouse has moved from where dragging started
+ */
+ private int getDragDistance(int larger, int smaller, int snapSize)
+ {
+ int halfway = snapSize / 2;
+ int drag = larger - smaller;
+ drag += (drag < 0) ? -halfway : halfway;
+ drag = (drag / snapSize) * snapSize;
+
+ return drag;
+ }
+
+ /*
+ * Adjust the drag value to be within the minimum and maximum range.
+ */
+ private int getDragBounded(int drag, int snapSize, int dimension, int minimum, int maximum)
+ {
+ while (dimension + drag < minimum)
+ drag += snapSize;
+
+ while (dimension + drag > maximum)
+ drag -= snapSize;
+
+
+ return drag;
+ }
+
+ /*
+ * Keep the size of the component within the bounds of its parent.
+ */
+ private Dimension getBoundingSize(Component source)
+ {
+ if (source instanceof Window)
+ {
+ GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ Rectangle bounds = env.getMaximumWindowBounds();
+ return new Dimension(bounds.width, bounds.height);
+ }
+ else
+ {
+ return source.getParent().getSize();
+ }
+ }
+}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextCellComponent.java 2012-12-13 17:13:46 UTC (rev 57)
@@ -0,0 +1,268 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package fr.ifremer.tutti.ui.swing.util.editor;
+
+import fr.ifremer.tutti.ui.swing.util.ComponentResizer;
+import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import fr.ifremer.tutti.ui.swing.util.ComponentMover;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import java.awt.event.WindowAdapter;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Frame;
+import java.awt.Insets;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowEvent;
+import javax.swing.AbstractCellEditor;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JTable;
+import javax.swing.border.LineBorder;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Component to edit a cell in a popup with a text area
+ *
+ * @author kmorin
+ * @since 0.2
+ */
+public class LongTextCellComponent extends JButton{
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(LongTextCellComponent.class);
+
+ public LongTextCellComponent() {
+ setContentAreaFilled(false);
+ setOpaque(false);
+ setIcon(SwingUtil.createActionIcon("edit"));
+ }
+
+ public static TableCellRenderer newRender() {
+ return new LongTextCellRenderer();
+ }
+
+ public static TableCellEditor newEditor(LongTextEditorUI ui) {
+ return new LongTextCellEditor(ui);
+ }
+
+
+ public static class LongTextCellEditor extends AbstractCellEditor implements TableCellEditor {
+
+ public static final int DEFAULT_EDITOR_WIDTH = 400;
+ public static final int DEFAULT_EDITOR_HEIGHT = 200;
+
+ protected final LongTextCellComponent component;
+
+ protected final LongTextEditorUI ui;
+
+ protected Frame frame;
+
+ protected JTable table;
+
+ protected AbstractTuttiTableModel<AbstractTuttiBeanUIModel> tableModel;
+
+ protected ColumnIdentifier<AbstractTuttiBeanUIModel> columnIdentifier;
+
+ protected AbstractTuttiBeanUIModel editRow;
+
+ protected Integer rowIndex;
+
+ protected Integer columnIndex;
+
+ public LongTextCellEditor(LongTextEditorUI ui) {
+ this.ui = ui;
+
+ component = new LongTextCellComponent();
+ component.setBorder(new LineBorder(Color.BLACK));
+ component.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER ||
+ e.getKeyCode() == KeyEvent.VK_SPACE) {
+ e.consume();
+ startEdit();
+ }
+ }
+ });
+
+ component.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ e.consume();
+ startEdit();
+ }
+ });
+ }
+
+ protected void startEdit() {
+ if (frame == null) {
+ frame = SwingUtil.getParentContainer(ui, Frame.class);
+ }
+
+ ui.setBorder(BorderFactory.createTitledBorder(_(columnIdentifier.getHeaderI18nKey())));
+ ui.setBean(editRow);
+ ui.setProperty(columnIdentifier.getPropertyName());
+
+ JDialog editor = new JDialog(frame, true);
+ editor.setUndecorated(true);
+ editor.add(ui);
+ editor.setSize(DEFAULT_EDITOR_WIDTH, DEFAULT_EDITOR_HEIGHT);
+ editor.setResizable(true);
+
+ ComponentResizer cr = new ComponentResizer();
+ cr.registerComponent(editor);
+ ComponentMover cm = new ComponentMover();
+ cm.setDragInsets(cr.getDragInsets());
+ cm.registerComponent(editor);
+
+ editor.addWindowListener(new WindowAdapter() {
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+ Component ui = (Component) e.getSource();
+ if (log.isInfoEnabled()) {
+ log.info("Destroy ui " + ui);
+ }
+ JAXXUtil.destroy(ui);
+ }
+ });
+
+ // Computes the location of bottom left corner of the cell
+ Component comp = component;
+ int x = 0;
+ int y = component.getHeight();
+ while (comp != null) {
+ x += comp.getX();
+ y += comp.getY();
+ comp = comp.getParent();
+ }
+ // if the editor is too big on the right,
+ // then align its right side to the right side of the cell
+ if (x + editor.getWidth() > frame.getX() + frame.getWidth()) {
+ x = x - editor.getWidth() + component.getWidth();
+ }
+ editor.setLocation(x, y);
+ editor.setVisible(true);
+
+ int r = rowIndex;
+ int c = columnIndex;
+
+ // stop edition
+ stopCellEditing();
+
+ // reselect this cell
+ AbstractSelectTableAction.doSelectCell(table, r, c);
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ int row,
+ int column) {
+ if (tableModel == null) {
+ tableModel = (AbstractTuttiTableModel<AbstractTuttiBeanUIModel>) table.getModel();
+ this.table = table;
+ columnIdentifier = tableModel.getPropertyName(column);
+ }
+
+ rowIndex = row;
+ columnIndex = column;
+
+ editRow = tableModel.getEntry(row);
+
+ return component;
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+
+ Preconditions.checkNotNull(editRow, "No editRow found in editor.");
+
+ String propertyName = columnIdentifier.getPropertyName();
+ Object result = TuttiUIUtil.getProperty(editRow, propertyName);
+ if (log.isInfoEnabled()) {
+ log.info("editor value (" + propertyName + "): " + result);
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean stopCellEditing() {
+ boolean b = super.stopCellEditing();
+ if (b) {
+ rowIndex = null;
+ editRow = null;
+ columnIndex = null;
+ }
+ return b;
+ }
+
+ @Override
+ public void cancelCellEditing() {
+ super.cancelCellEditing();
+ rowIndex = null;
+ columnIndex = null;
+ editRow = null;
+ }
+ }
+
+ public static class LongTextCellRenderer implements TableCellRenderer {
+
+ protected final LongTextCellComponent component;
+
+ protected String propertyName;
+
+ public LongTextCellRenderer() {
+ component = new LongTextCellComponent();
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row,
+ int column) {
+
+ String text;
+ if (value == null) {
+ if (propertyName == null) {
+ AbstractTuttiTableModel tableModel =
+ (AbstractTuttiTableModel) table.getModel();
+ ColumnIdentifier columnIdentifier = tableModel.getPropertyName(column);
+ propertyName = columnIdentifier.getPropertyName();
+ }
+ // use HTML to show the tooltip in italic
+ text = "<html><body><i>" + _("tutti.tooltip." + propertyName + ".none") + "</i></body></html>";
+
+ } else {
+ // use html to display the tooltip on several lines
+ text = "<html><body>" + String.valueOf(value).replace("\n", "<br/>") + "</body></html>";
+ }
+
+ boolean editable = table.isCellEditable(row, column);
+ component.setEnabled(editable);
+ component.setToolTipText(text);
+ return component;
+ }
+ }
+}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.css 2012-12-13 17:13:46 UTC (rev 57)
@@ -0,0 +1,4 @@
+#closeButton {
+ actionIcon: "close";
+ text: "tutti.action.close";
+}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.jaxx (from rev 55, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUI.jaxx 2012-12-13 17:13:46 UTC (rev 57)
@@ -0,0 +1,48 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='mainPanel'>
+
+ <!-- bean property linked state -->
+ <String id='property' javaBean='""'/>
+
+ <!-- bean property -->
+ <fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel id='bean' javaBean='null'/>
+
+ <LongTextEditorUIHandler id='handler' constructorParams='this'/>
+
+ <row weighty='1' fill='both'>
+ <cell fill='both' weightx='1'>
+ <JScrollPane>
+ <JTextArea id='textContent'
+ onKeyReleased='handler.setText()'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row fill='both'>
+ <!-- actions -->
+ <cell fill='both' weightx='1'>
+ <JButton id='closeButton' onActionPerformed='handler.close()'/>
+ </cell>
+ </row>
+</Table>
\ No newline at end of file
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/LongTextEditorUIHandler.java 2012-12-13 17:13:46 UTC (rev 57)
@@ -0,0 +1,75 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package fr.ifremer.tutti.ui.swing.util.editor;
+
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import java.awt.Window;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Handler of the LongTextEditorUI
+ * @author kmorin
+ * @since 0.2
+ */
+public class LongTextEditorUIHandler {
+
+ private static final Log log = LogFactory.getLog(LongTextEditorUIHandler.class);
+
+ private final LongTextEditorUI ui;
+
+ public LongTextEditorUIHandler(LongTextEditorUI longTextEditorUI) {
+ ui = longTextEditorUI;
+
+ ui.addPropertyChangeListener(new PropertyChangeListener() {
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ AbstractTuttiBeanUIModel bean = ui.getBean();
+ String property = ui.getProperty();
+ if (bean != null && !StringUtils.isEmpty(property)) {
+ Object value = TuttiUIUtil.getProperty(bean, property);
+ if (value == null) {
+ value = "";
+ }
+ ui.getTextContent().setText(value.toString());
+ }
+ }
+ });
+ }
+
+ /**
+ * pushes the typed text in the property of the bean
+ */
+ public void setText() {
+ String value = ui.getTextContent().getText();
+ AbstractTuttiBeanUIModel bean = ui.getBean();
+ String property = ui.getProperty();
+ TuttiUIUtil.setProperty(bean, property, value);
+ }
+
+ public void resetText() {
+ AbstractTuttiBeanUIModel bean = ui.getBean();
+ String property = ui.getProperty();
+ TuttiUIUtil.setProperty(bean, property, null);
+
+ ui.getTextContent().setText("");
+ }
+
+ /**
+ * closes the editor
+ */
+ public void close() {
+ if (log.isInfoEnabled()) {
+ log.info("Will close UI " + ui);
+ }
+ SwingUtil.getParentContainer(ui, Window.class).dispose();
+ }
+
+}
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-13 15:37:44 UTC (rev 56)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-13 17:13:46 UTC (rev 57)
@@ -1,7 +1,7 @@
tutti.about.bottomText=Copyright %s - %s - version %s
-tutti.about.message=<h3>Tutti</h3><p><strong>Outil de saisie de données d'opérations et de captures au cours des campagnes halieutiques.</strong></p><br/><p>Ce logiciel permettra la saisie en mer des données d'opération de pêche (positions, environnement, engin, etc) et des captures associées (composition de la capture en espèces scientifiques avec poids, nombres, tailles etc) pour l'ensemble des campagnes halieutiques réalisées par l'Ifremer.</p><p>Ce projet a été initiée en 2012 par l'<a href\="http\://www.ifremer.fr">Ifremer</a> et réalisé par la société <a href\="http\://codelutin.com">Codelutin</a>.</p><hr/><br/><p>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.forge.codelutin.com/tutti">site du projet</a>.</p><p>Projet hébergé sur la forge <a href\="http\://forge.codelutin.com/projects/tutti">Forge.codelutin.com</a>.</p>
-tutti.action.about=À propos
-tutti.action.about.tip=À Propos
+tutti.about.message=<h3>Tutti</h3><p><strong>Outil de saisie de donn\u00c3\u00a9es d'op\u00c3\u00a9rations et de captures au cours des campagnes halieutiques.</strong></p><br/><p>Ce logiciel permettra la saisie en mer des donn\u00c3\u00a9es d'op\u00c3\u00a9ration de p\u00c3\u00aache (positions, environnement, engin, etc) et des captures associ\u00c3\u00a9es (composition de la capture en esp\u00c3\u00a8ces scientifiques avec poids, nombres, tailles etc) pour l'ensemble des campagnes halieutiques r\u00c3\u00a9alis\u00c3\u00a9es par l'Ifremer.</p><p>Ce projet a \u00c3\u00a9t\u00c3\u00a9 initi\u00c3\u00a9e en 2012 par l'<a href\="http\://www.ifremer.fr">Ifremer</a> et r\u00c3\u00a9alis\u00c3\u00a9 par la soci\u00c3\u00a9t\u00c3\u00a9 <a href\="http\://codelutin.com">Codelutin</a>.</p><hr/><br/><p>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.forge.codelutin.com/tutti">site du projet</a>.</p><p>Projet h\u00c3\u00a9berg\u00c3\u00a9 sur la forge <a href\="http\://forge.codelutin.com/projects/tutti">Forge.codelutin.com</a>.</p>
+tutti.action.about=\u00c3\u0080 propos
+tutti.action.about.tip=\u00c3\u0080 Propos
tutti.action.cancel=Annuler
tutti.action.casino-import=Import Casino
tutti.action.catches=Captures
@@ -13,21 +13,21 @@
tutti.action.exit.tip=Quitter l'application
tutti.action.fillCatches=Captures
tutti.action.fillCatches.tip=Saisir des captures
-tutti.action.generate=Générer
-tutti.action.generateCampaignName=Générer le nom
+tutti.action.generate=G\u00c3\u00a9n\u00c3\u00a9rer
+tutti.action.generateCampaignName=G\u00c3\u00a9n\u00c3\u00a9rer le nom
tutti.action.manageProtocol=Protocole
-tutti.action.manageProtocol.tip=Gérer les protocoles
+tutti.action.manageProtocol.tip=G\u00c3\u00a9rer les protocoles
tutti.action.new=Nouveau
tutti.action.pupitri-import=Import PUPITRI
tutti.action.reload.actions=Recharger les actions
tutti.action.reload.home=Reload home screen
tutti.action.reload.ui=Recharger l'interface graphique
-tutti.action.reset.fishingOperationValidState=Réinitialiser
+tutti.action.reset.fishingOperationValidState=R\u00c3\u00a9initialiser
tutti.action.save=Enregistrer
tutti.action.selectCampaign=Campagne
-tutti.action.selectCampaign.tip=Sélectionner la campagne à utiliser
+tutti.action.selectCampaign.tip=S\u00c3\u00a9lectionner la campagne \u00c3\u00a0 utiliser
tutti.action.site=Site
-tutti.action.site.tip=Accéder au site du projet Tutti
+tutti.action.site.tip=Acc\u00c3\u00a9der au site du projet Tutti
tutti.application.config=Configuration de l'application Tutti
tutti.application.name=Tutti
tutti.config.category.applications=Application
@@ -36,84 +36,84 @@
tutti.config.category.other.description=Autres options
tutti.config.category.shortcuts=Raccourcis
tutti.config.category.shortcuts.description=Liste des raccourcis clavier
-tutti.config.cruiseId=Identifiant de la dernière campagne utilisée
-tutti.config.programId=Identifiant de la dernière série de campagne utilisée
-tutti.config.ui.autoPopupNumberEditor=Toujours afficher le pavé numérique lors de l'édition d'un nombre
+tutti.config.cruiseId=Identifiant de la derni\u00c3\u00a8re campagne utilis\u00c3\u00a9e
+tutti.config.programId=Identifiant de la derni\u00c3\u00a8re s\u00c3\u00a9rie de campagne utilis\u00c3\u00a9e
+tutti.config.ui.autoPopupNumberEditor=Toujours afficher le pav\u00c3\u00a9 num\u00c3\u00a9rique lors de l'\u00c3\u00a9dition d'un nombre
tutti.config.ui.config=Chemin du fichier de configuration des interfaces graphiques
-tutti.config.ui.showNumberEditorButton=Afficher le pavé numérique de saisie
-tutti.label.benthos.sampleTotalWeight=Poids total échantillonné
+tutti.config.ui.showNumberEditorButton=Afficher le pav\u00c3\u00a9 num\u00c3\u00a9rique de saisie
+tutti.label.benthos.sampleTotalWeight=Poids total \u00c3\u00a9chantillonn\u00c3\u00a9
tutti.label.benthos.totalWeight=Poids total
tutti.label.comment=Commentaire
tutti.label.cruise=Campagne
-tutti.label.cruise.beginDate=Date de début
+tutti.label.cruise.beginDate=Date de d\u00c3\u00a9but
tutti.label.cruise.country=Pays
tutti.label.cruise.endDate=Date de fin
tutti.label.cruise.name=Nom
tutti.label.cruise.poche=Nombre de poches
-tutti.label.cruise.program=Série
-tutti.label.cruise.surveyPart=Série partielle
-tutti.label.cruise.year=Année
-tutti.label.fishingOperation.averageBottomSalinity=Salinité de fond moyenne
-tutti.label.fishingOperation.averageBottomTemperature=Température de fond moyenne
+tutti.label.cruise.program=S\u00c3\u00a9rie
+tutti.label.cruise.surveyPart=S\u00c3\u00a9rie partielle
+tutti.label.cruise.year=Ann\u00c3\u00a9e
+tutti.label.fishingOperation.averageBottomSalinity=Salinit\u00c3\u00a9 de fond moyenne
+tutti.label.fishingOperation.averageBottomTemperature=Temp\u00c3\u00a9rature de fond moyenne
tutti.label.fishingOperation.beaufortScale=Force du vent
tutti.label.fishingOperation.date=Date
-tutti.label.fishingOperation.distanceChalutee=Distance chalutée
-tutti.label.fishingOperation.duree=Durée
+tutti.label.fishingOperation.distanceChalutee=Distance chalut\u00c3\u00a9e
+tutti.label.fishingOperation.duree=Dur\u00c3\u00a9e
tutti.label.fishingOperation.fishingOperationInvalid=Trait invalide
-tutti.label.fishingOperation.fishingOperationNumber=Numéro de Trait
+tutti.label.fishingOperation.fishingOperationNumber=Num\u00c3\u00a9ro de Trait
tutti.label.fishingOperation.fishingOperationRectiligne=Trait rectiligne
tutti.label.fishingOperation.fishingOperationValid=Trait valide
tutti.label.fishingOperation.gearDate=Date
tutti.label.fishingOperation.gearLatitude=Latitude
tutti.label.fishingOperation.gearLongitude=Longitude
tutti.label.fishingOperation.gearShootingEnd=Fin de traine
-tutti.label.fishingOperation.gearShootingEndBottomSalinity=Salinité de fond fin de traine
-tutti.label.fishingOperation.gearShootingEndBottomTemperature=Température de fond fin de traine
+tutti.label.fishingOperation.gearShootingEndBottomSalinity=Salinit\u00c3\u00a9 de fond fin de traine
+tutti.label.fishingOperation.gearShootingEndBottomTemperature=Temp\u00c3\u00a9rature de fond fin de traine
tutti.label.fishingOperation.gearShootingEndDepth=Profondeur fin de traine
-tutti.label.fishingOperation.gearShootingEndSurfaceSalinity=Salinité de surface fin de traine
+tutti.label.fishingOperation.gearShootingEndSurfaceSalinity=Salinit\u00c3\u00a9 de surface fin de traine
tutti.label.fishingOperation.gearShootingEndSurfaceTemperature=Temperature de surface fin de traine
-tutti.label.fishingOperation.gearShootingStart=Début de traine
-tutti.label.fishingOperation.gearShootingStartBottomSalinity=Salinité de fond début de traine
-tutti.label.fishingOperation.gearShootingStartBottomTemperature=Température de fond début de traine
-tutti.label.fishingOperation.gearShootingStartDepth=Profondeur début de traine
-tutti.label.fishingOperation.gearShootingStartSurfaceSalinity=Salinité de surface début de traine
-tutti.label.fishingOperation.gearShootingStartSurfaceTemperature=Temperature de surface début de traine
+tutti.label.fishingOperation.gearShootingStart=D\u00c3\u00a9but de traine
+tutti.label.fishingOperation.gearShootingStartBottomSalinity=Salinit\u00c3\u00a9 de fond d\u00c3\u00a9but de traine
+tutti.label.fishingOperation.gearShootingStartBottomTemperature=Temp\u00c3\u00a9rature de fond d\u00c3\u00a9but de traine
+tutti.label.fishingOperation.gearShootingStartDepth=Profondeur d\u00c3\u00a9but de traine
+tutti.label.fishingOperation.gearShootingStartSurfaceSalinity=Salinit\u00c3\u00a9 de surface d\u00c3\u00a9but de traine
+tutti.label.fishingOperation.gearShootingStartSurfaceTemperature=Temperature de surface d\u00c3\u00a9but de traine
tutti.label.fishingOperation.gearTime=Heure
-tutti.label.fishingOperation.geometrieMesuree=Géométrie mesurée
-tutti.label.fishingOperation.localite=Localité
+tutti.label.fishingOperation.geometrieMesuree=G\u00c3\u00a9om\u00c3\u00a9trie mesur\u00c3\u00a9e
+tutti.label.fishingOperation.localite=Localit\u00c3\u00a9
tutti.label.fishingOperation.longueurBras=Longueur des funes
tutti.label.fishingOperation.longueurFunes=Longueur des bras
tutti.label.fishingOperation.ouvertureHorizontale=Ouverture horizontale
tutti.label.fishingOperation.ouvertureVerticale=Ouverture verticale
tutti.label.fishingOperation.seaState=Etat de la mer
-tutti.label.fishingOperation.stationNumber=Numéro de la station
+tutti.label.fishingOperation.stationNumber=Num\u00c3\u00a9ro de la station
tutti.label.fishingOperation.strata=Strate
tutti.label.fishingOperation.subStrata=Sous strate
-tutti.label.fishingOperation.systemeFermetureCul=Système de fermeture de cul
+tutti.label.fishingOperation.systemeFermetureCul=Syst\u00c3\u00a8me de fermeture de cul
tutti.label.fishingOperation.windDirection=Direction du vent
tutti.label.frequencyConfiguration.maxStep=Classe max
tutti.label.frequencyConfiguration.minStep=Classe min
-tutti.label.frequencyConfiguration.mode.autoGen=Génération des classes
-tutti.label.frequencyConfiguration.mode.autoGen.tip=Mode où toutes les classes de taille sont générées
+tutti.label.frequencyConfiguration.mode.autoGen=G\u00c3\u00a9n\u00c3\u00a9ration des classes
+tutti.label.frequencyConfiguration.mode.autoGen.tip=Mode o\u00c3\u00b9 toutes les classes de taille sont g\u00c3\u00a9n\u00c3\u00a9r\u00c3\u00a9es
tutti.label.frequencyConfiguration.mode.rafale=Mode "rafale"
-tutti.label.frequencyConfiguration.mode.rafale.tip=Mode où on ne saisit uniquement la classe de taille (les nombres seront alors incrémentés...)
+tutti.label.frequencyConfiguration.mode.rafale.tip=Mode o\u00c3\u00b9 on ne saisit uniquement la classe de taille (les nombres seront alors incr\u00c3\u00a9ment\u00c3\u00a9s...)
tutti.label.frequencyConfiguration.mode.simple=Mode simple
-tutti.label.frequencyConfiguration.mode.simple.tip=Mode par défaut on on doit tout saisir (les classes de tailles et les nombres)
+tutti.label.frequencyConfiguration.mode.simple.tip=Mode par d\u00c3\u00a9faut on on doit tout saisir (les classes de tailles et les nombres)
tutti.label.frequencyConfiguration.no.configuration=< Pas de configuration >
-tutti.label.frequencyConfiguration.rafaleStep=Classe de taille à incrémenter
+tutti.label.frequencyConfiguration.rafaleStep=Classe de taille \u00c3\u00a0 incr\u00c3\u00a9menter
tutti.label.frequencyConfiguration.step=Pas de la classe de taille
tutti.label.list.gear=Engin(s)
tutti.label.list.headOfMission=Chef(s) de mission
tutti.label.list.headOfSortRoom=Reponsable(s) de salle de tri
tutti.label.list.vessel=Navire(s)
tutti.label.macroWaste.totalWeight=Poids total
-tutti.label.no.fishingOperation.selected=< Aucun trait sélectionné >
-tutti.label.plankton.sampleTotalWeight=Poids total échantillonné
+tutti.label.no.fishingOperation.selected=< Aucun trait s\u00c3\u00a9lectionn\u00c3\u00a9 >
+tutti.label.plankton.sampleTotalWeight=Poids total \u00c3\u00a9chantillonn\u00c3\u00a9
tutti.label.plankton.totalWeight=Poids total
-tutti.label.program=Série de campagne
+tutti.label.program=S\u00c3\u00a9rie de campagne
tutti.label.program.name=Nom
tutti.label.program.zone=Zone
-tutti.label.species.sampleVracWeight=Poids total vrac échant.
+tutti.label.species.sampleVracWeight=Poids total vrac \u00c3\u00a9chant.
tutti.label.species.totalHorsVracWeight=Poids total hors vrac
tutti.label.species.totalVracWeight=Poids total vrac
tutti.label.species.totalWeight=Poids total
@@ -122,12 +122,12 @@
tutti.label.tab.fishingOperation=Trait
tutti.label.tab.fishingOperation.environment=Environnement
tutti.label.tab.fishingOperation.gearShooting=Mise en oeuvre de l'engin
-tutti.label.tab.fishingOperation.general=Caractéristiques générales
-tutti.label.tab.fishingOperation.hydrology=Paramètres hydrologiques
-tutti.label.tab.macroDechet=Macro déchets
+tutti.label.tab.fishingOperation.general=Caract\u00c3\u00a9ristiques g\u00c3\u00a9n\u00c3\u00a9rales
+tutti.label.tab.fishingOperation.hydrology=Param\u00c3\u00a8tres hydrologiques
+tutti.label.tab.macroDechet=Macro d\u00c3\u00a9chets
tutti.label.tab.observationIndividuel=Observations individuelles
tutti.label.tab.plancton=Plancton
-tutti.label.tab.species=Espèces
+tutti.label.tab.species=Esp\u00c3\u00a8ces
tutti.legend.frequencyConfiguration=Configuration
tutti.menu.actions=Actions
tutti.menu.actions.tip=Actions
@@ -135,8 +135,8 @@
tutti.menu.file.tip=Fichier
tutti.menu.help=Aide
tutti.menu.help.tip=Aide
-tutti.menu.synchronisationAllegro=Allégro
-tutti.menu.synchronisationAllegro.tip=Synchronisation Allégro
+tutti.menu.synchronisationAllegro=All\u00c3\u00a9gro
+tutti.menu.synchronisationAllegro.tip=Synchronisation All\u00c3\u00a9gro
tutti.menu.synchronisationExport=Export
tutti.menu.synchronisationExport.tip=Effectuer des exports
tutti.menu.synchronisationImport=Import
@@ -144,71 +144,72 @@
tutti.menu.synchronisations=Synchronisation
tutti.menu.synchronisations.tip=Import/Export
tutti.table.benthos.batch.header.comment=Commentaire
-tutti.table.benthos.batch.header.elevationRate=Fraction d'élévation
-tutti.table.benthos.batch.header.file=Pièces jointes
-tutti.table.benthos.batch.header.sampleWeight=Poids échantillonné
-tutti.table.benthos.batch.header.speciesByCode=Espèce
-tutti.table.benthos.batch.header.speciesByGenusCode=Espèce
+tutti.table.benthos.batch.header.elevationRate=Fraction d'\u00c3\u00a9l\u00c3\u00a9vation
+tutti.table.benthos.batch.header.file=Pi\u00c3\u00a8ces jointes
+tutti.table.benthos.batch.header.sampleWeight=Poids \u00c3\u00a9chantillonn\u00c3\u00a9
+tutti.table.benthos.batch.header.speciesByCode=Esp\u00c3\u00a8ce
+tutti.table.benthos.batch.header.speciesByGenusCode=Esp\u00c3\u00a8ce
tutti.table.benthos.batch.header.toConfirm=A Confirmer
tutti.table.benthos.batch.header.weight=Poids
tutti.table.macrowaste.batch.header.comment=Commentaire
-tutti.table.macrowaste.batch.header.file=Pièces jointes
-tutti.table.macrowaste.batch.header.speciesByCode=Espèce
-tutti.table.macrowaste.batch.header.speciesByGenusCode=Espèce
+tutti.table.macrowaste.batch.header.file=Pi\u00c3\u00a8ces jointes
+tutti.table.macrowaste.batch.header.speciesByCode=Esp\u00c3\u00a8ce
+tutti.table.macrowaste.batch.header.speciesByGenusCode=Esp\u00c3\u00a8ce
tutti.table.macrowaste.batch.header.weight=Poids
tutti.table.plankton.batch.header.comment=Commentaire
-tutti.table.plankton.batch.header.elevationRate=Fraction d'élévation
-tutti.table.plankton.batch.header.file=Pièces jointes
-tutti.table.plankton.batch.header.sampleWeight=Poids échantillonné
-tutti.table.plankton.batch.header.speciesByCode=Espèce
-tutti.table.plankton.batch.header.speciesByGenusCode=Espèce
+tutti.table.plankton.batch.header.elevationRate=Fraction d'\u00c3\u00a9l\u00c3\u00a9vation
+tutti.table.plankton.batch.header.file=Pi\u00c3\u00a8ces jointes
+tutti.table.plankton.batch.header.sampleWeight=Poids \u00c3\u00a9chantillonn\u00c3\u00a9
+tutti.table.plankton.batch.header.speciesByCode=Esp\u00c3\u00a8ce
+tutti.table.plankton.batch.header.speciesByGenusCode=Esp\u00c3\u00a8ce
tutti.table.plankton.batch.header.toConfirm=A Confirmer
tutti.table.plankton.batch.header.weight=Poids
tutti.table.species.batch.header.age=Age
tutti.table.species.batch.header.comment=Commentaire
-tutti.table.species.batch.header.computedNumber=Nombre calculé
-tutti.table.species.batch.header.computedWeight=Poids calculé
-tutti.table.species.batch.header.elevationRate=Fraction d'élévation
-tutti.table.species.batch.header.file=Pièces jointes
-tutti.table.species.batch.header.maturity=Maturité
-tutti.table.species.batch.header.sampleWeight=Poids échantillonné
+tutti.table.species.batch.header.computedNumber=Nombre calcul\u00c3\u00a9
+tutti.table.species.batch.header.computedWeight=Poids calcul\u00c3\u00a9
+tutti.table.species.batch.header.elevationRate=Fraction d'\u00c3\u00a9l\u00c3\u00a9vation
+tutti.table.species.batch.header.file=Pi\u00c3\u00a8ces jointes
+tutti.table.species.batch.header.maturity=Maturit\u00c3\u00a9
+tutti.table.species.batch.header.sampleWeight=Poids \u00c3\u00a9chantillonn\u00c3\u00a9
tutti.table.species.batch.header.sex=Sexe
-tutti.table.species.batch.header.speciesByCode=Espèce
-tutti.table.species.batch.header.speciesByGenusCode=Espèce
+tutti.table.species.batch.header.speciesByCode=Esp\u00c3\u00a8ce
+tutti.table.species.batch.header.speciesByGenusCode=Esp\u00c3\u00a8ce
tutti.table.species.batch.header.toConfirm=A Confirmer
tutti.table.species.batch.header.vracHorsVrac=Vrac / Hors Vrac
tutti.table.species.batch.header.weight=Poids
-tutti.table.species.batch.header.weightCategory=Catégorie Poids
-tutti.table.species.frequency.header.computedWeight=Poids calculé
+tutti.table.species.batch.header.weightCategory=Cat\u00c3\u00a9gorie Poids
+tutti.table.species.frequency.header.computedWeight=Poids calcul\u00c3\u00a9
tutti.table.species.frequency.header.lengthStep=Classe de taille
tutti.table.species.frequency.header.number=Nombre
-tutti.table.species.frequency.header.weight=Poids observé
+tutti.table.species.frequency.header.weight=Poids observ\u00c3\u00a9
tutti.timeeditor.H=H
-tutti.title.about=À propos de Tutti
-tutti.title.create.cruise=Créer une nouvelle campagne
-tutti.title.create.program=Créer une nouvelle série de campagne
+tutti.title.about=\u00c3\u0080 propos de Tutti
+tutti.title.create.cruise=Cr\u00c3\u00a9er une nouvelle campagne
+tutti.title.create.program=Cr\u00c3\u00a9er une nouvelle s\u00c3\u00a9rie de campagne
tutti.title.edit.cruise=Editer une campagne existante
-tutti.title.edit.operations=Saisie des opérations de pêches (%s)
-tutti.title.edit.program=Editer une série de campagne existante
+tutti.title.edit.operations=Saisie des op\u00c3\u00a9rations de p\u00c3\u00aaches (%s)
+tutti.title.edit.program=Editer une s\u00c3\u00a9rie de campagne existante
tutti.title.frequency=Saisie des mensurations
-tutti.title.home=Sélection de la campagne
-tutti.title.noSelectedCruise=Pas de campagne sélectionné
-tutti.title.noSelectedProgram=Pas de série de campagne sélectionné
+tutti.title.home=S\u00c3\u00a9lection de la campagne
+tutti.title.noSelectedCruise=Pas de campagne s\u00c3\u00a9lectionn\u00c3\u00a9
+tutti.title.noSelectedProgram=Pas de s\u00c3\u00a9rie de campagne s\u00c3\u00a9lectionn\u00c3\u00a9
tutti.title.selectedCruise=Campagne %s
-tutti.title.selectedProgram=Série de campagne %s
+tutti.title.selectedProgram=S\u00c3\u00a9rie de campagne %s
tutti.to.be.done=< A FAIRE >
-tutti.validator.error.cruise.beginDate.required=La date de début est obligatoire
+tutti.tooltip.comment.none=Aucun
+tutti.validator.error.cruise.beginDate.required=La date de d\u00c3\u00a9but est obligatoire
tutti.validator.error.cruise.country.required=Le pays est obligatoire
tutti.validator.error.cruise.endDate.required=La date de fin est obligatoire
-tutti.validator.error.cruise.gear.required=Au moins un engin doit être sélectionné
-tutti.validator.error.cruise.headOfMission.required=Au moins un chef de mission doit être sélectionné
-tutti.validator.error.cruise.headOfSortRoom.required=Au moins un responsable de salle de tri doit être sélectionné
+tutti.validator.error.cruise.gear.required=Au moins un engin doit \u00c3\u00aatre s\u00c3\u00a9lectionn\u00c3\u00a9
+tutti.validator.error.cruise.headOfMission.required=Au moins un chef de mission doit \u00c3\u00aatre s\u00c3\u00a9lectionn\u00c3\u00a9
+tutti.validator.error.cruise.headOfSortRoom.required=Au moins un responsable de salle de tri doit \u00c3\u00aatre s\u00c3\u00a9lectionn\u00c3\u00a9
tutti.validator.error.cruise.name.required=Le nom de la campagne est obligatoire
tutti.validator.error.cruise.poche.required=Le nombre de poche est obligatoire
-tutti.validator.error.cruise.program.required=La série est obligatoire
-tutti.validator.error.cruise.vessel.required=Au moins un bateau doit être sélectionné
-tutti.validator.error.cruise.year.required=L'année est obligatoire
+tutti.validator.error.cruise.program.required=La s\u00c3\u00a9rie est obligatoire
+tutti.validator.error.cruise.vessel.required=Au moins un bateau doit \u00c3\u00aatre s\u00c3\u00a9lectionn\u00c3\u00a9
+tutti.validator.error.cruise.year.required=L'ann\u00c3\u00a9e est obligatoire
tutti.validator.error.fishingOperation.date.required=La date du fishingOperation est obligatoire
-tutti.validator.error.fishingOperation.stationNumber.required=Le numéro de station est obligatoire
-tutti.validator.error.program.name.required=Le nom de la série est obligatoire
-tutti.validator.error.program.zone.required=La zone de la série est obligatoire
+tutti.validator.error.fishingOperation.stationNumber.required=Le num\u00c3\u00a9ro de station est obligatoire
+tutti.validator.error.program.name.required=Le nom de la s\u00c3\u00a9rie est obligatoire
+tutti.validator.error.program.zone.required=La zone de la s\u00c3\u00a9rie est obligatoire
1
0
Author: tchemit
Date: 2012-12-13 16:37:44 +0100 (Thu, 13 Dec 2012)
New Revision: 56
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/56
Log:
updates libraries
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-12-13 01:57:28 UTC (rev 55)
+++ trunk/pom.xml 2012-12-13 15:37:44 UTC (rev 56)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>3.4.4</version>
+ <version>3.4.6</version>
</parent>
<groupId>fr.ifremer</groupId>
@@ -82,17 +82,17 @@
<!-- libraries version -->
- <nuitonUtilsVersion>2.6.4</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.6.5</nuitonUtilsVersion>
<nuitonI18nVersion>2.5</nuitonI18nVersion>
- <eugenePluginVersion>2.6-SNAPSHOT</eugenePluginVersion>
+ <eugenePluginVersion>2.6</eugenePluginVersion>
<hibernateVersion>3.6.10.Final</hibernateVersion>
<h2Version>1.3.168</h2Version>
<postgresqlVersion>9.1-901-1.jdbc4</postgresqlVersion>
<jaxxVersion>2.5.8-SNAPSHOT</jaxxVersion>
<swingXVersion>1.6.4</swingXVersion>
- <xworkVersion>2.3.4.1</xworkVersion>
+ <xworkVersion>2.3.7</xworkVersion>
<slf4jVersion>1.7.2</slf4jVersion>
1
0
Dec. 13, 2012
Author: tchemit
Date: 2012-12-13 02:57:28 +0100 (Thu, 13 Dec 2012)
New Revision: 55
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/55
Log:
continue batch screens
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -24,16 +24,15 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
-import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
+import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.referential.Strata;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -41,6 +40,7 @@
import fr.ifremer.tutti.persistence.entities.referential.SeaState;
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.Strata;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -162,39 +162,48 @@
BenthosBatch saveBenthosBatch(BenthosBatch bean);
+ void deleteBenthosBatch(String id);
+
//------------------------------------------------------------------------//
//-- Plancton Batch methods --//
//------------------------------------------------------------------------//
- List<PlanctonBatch> getAllPlanctonBatch(String fishingOperationId);
+ List<PlanktonBatch> getAllPlanktonBatch(String fishingOperationId);
- PlanctonBatch getPlanctonBatch(String id);
+ PlanktonBatch getPlanktonBatch(String id);
- PlanctonBatch createPlanctonBatch(PlanctonBatch bean);
+ PlanktonBatch createPlanktonBatch(PlanktonBatch bean);
- PlanctonBatch savePlanctonBatch(PlanctonBatch bean);
+ PlanktonBatch savePlanktonBatch(PlanktonBatch bean);
+ void deletePlanktonBatch(String id);
+
//------------------------------------------------------------------------//
//-- Macrodechet Batch methods --//
//------------------------------------------------------------------------//
- List<MacroDechetBatch> getAllMacroDechetBatch(String fishingOperationId);
+ List<MacroWasteBatch> getAllMacroWasteBatch(String fishingOperationId);
- MacroDechetBatch getMacroDechetBatch(String id);
+ MacroWasteBatch getMacroWasteBatch(String id);
- MacroDechetBatch createMacroDechetBatch(MacroDechetBatch bean);
+ MacroWasteBatch createMacroWasteBatch(MacroWasteBatch bean);
- MacroDechetBatch saveMacroDechetBatch(MacroDechetBatch bean);
+ MacroWasteBatch saveMacroWasteBatch(MacroWasteBatch bean);
+ void deleteMacroWasteBatch(String id);
+
//------------------------------------------------------------------------//
//-- Accidentel Batch methods --//
//------------------------------------------------------------------------//
- List<AccidentelBatch> getAllAccidentelBatch(String fishingOperationId);
+ List<AccidentalBatch> getAllAccidentalBatch(String fishingOperationId);
- AccidentelBatch getAccidentelBatch(String id);
+ AccidentalBatch getAccidentalBatch(String id);
- AccidentelBatch createAccidentelBatch(AccidentelBatch bean);
+ AccidentalBatch createAccidentalBatch(AccidentalBatch bean);
- AccidentelBatch saveAccidentelBatch(AccidentelBatch bean);
+ AccidentalBatch saveAccidentalBatch(AccidentalBatch bean);
+
+ void deleteAccidentalBatch(String id);
+
}
Modified: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
===================================================================
--- trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,8 +1,8 @@
-fr.ifremer.tutti.persistence.entities.data.AccidentelBatch
+fr.ifremer.tutti.persistence.entities.data.AccidentalBatch
fr.ifremer.tutti.persistence.entities.data.BenthosBatch
fr.ifremer.tutti.persistence.entities.data.FishingOperation
-fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch
-fr.ifremer.tutti.persistence.entities.data.PlanctonBatch
+fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch
+fr.ifremer.tutti.persistence.entities.data.PlanktonBatch
fr.ifremer.tutti.persistence.entities.data.Program
fr.ifremer.tutti.persistence.entities.data.Cruise
fr.ifremer.tutti.persistence.entities.data.SpeciesBatch
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -35,13 +35,13 @@
import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
import fr.ifremer.tutti.persistence.entities.IdAware;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.FishingOperationAware;
-import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
-import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
+import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
@@ -239,7 +239,7 @@
}
//------------------------------------------------------------------------//
- //-- Program methods --//
+ //-- Program methods --//
//------------------------------------------------------------------------//
@Override
@@ -267,7 +267,7 @@
}
//------------------------------------------------------------------------//
- //-- Cruise methods --//
+ //-- Cruise methods --//
//------------------------------------------------------------------------//
@Override
@@ -300,7 +300,7 @@
}
//------------------------------------------------------------------------//
- //-- FishingOperation methods --//
+ //-- FishingOperation methods --//
//------------------------------------------------------------------------//
@Override
@@ -421,93 +421,113 @@
return result;
}
+ @Override
+ public void deleteBenthosBatch(String id) {
+ remove(BenthosBatch.class, id);
+ }
+
//------------------------------------------------------------------------//
//-- Plancton Batch methods --//
//------------------------------------------------------------------------//
@Override
- public List<PlanctonBatch> getAllPlanctonBatch(String fishingOperationId) {
- List<PlanctonBatch> result = getAllTraitFilterBatches(
- PlanctonBatch.class, fishingOperationId);
+ public List<PlanktonBatch> getAllPlanktonBatch(String fishingOperationId) {
+ List<PlanktonBatch> result = getAllTraitFilterBatches(
+ PlanktonBatch.class, fishingOperationId);
return result;
}
@Override
- public PlanctonBatch getPlanctonBatch(String id) {
- PlanctonBatch result = getBean(PlanctonBatch.class, id);
+ public PlanktonBatch getPlanktonBatch(String id) {
+ PlanktonBatch result = getBean(PlanktonBatch.class, id);
return result;
}
@Override
- public PlanctonBatch createPlanctonBatch(PlanctonBatch bean) {
- PlanctonBatch result = create(PlanctonBatch.class, bean);
+ public PlanktonBatch createPlanktonBatch(PlanktonBatch bean) {
+ PlanktonBatch result = create(PlanktonBatch.class, bean);
return result;
}
@Override
- public PlanctonBatch savePlanctonBatch(PlanctonBatch bean) {
- PlanctonBatch result = save(PlanctonBatch.class, bean);
+ public PlanktonBatch savePlanktonBatch(PlanktonBatch bean) {
+ PlanktonBatch result = save(PlanktonBatch.class, bean);
return result;
}
+ @Override
+ public void deletePlanktonBatch(String id) {
+ remove(PlanktonBatch.class, id);
+ }
+
//------------------------------------------------------------------------//
- //-- Macrodechet Batch methods --//
+ //-- Macrodechet Batch methods --//
//------------------------------------------------------------------------//
@Override
- public List<MacroDechetBatch> getAllMacroDechetBatch(String fishingOperationId) {
- List<MacroDechetBatch> result = getAllTraitFilterBatches(
- MacroDechetBatch.class, fishingOperationId);
+ public List<MacroWasteBatch> getAllMacroWasteBatch(String fishingOperationId) {
+ List<MacroWasteBatch> result = getAllTraitFilterBatches(
+ MacroWasteBatch.class, fishingOperationId);
return result;
}
@Override
- public MacroDechetBatch getMacroDechetBatch(String id) {
- MacroDechetBatch result = getBean(MacroDechetBatch.class, id);
+ public MacroWasteBatch getMacroWasteBatch(String id) {
+ MacroWasteBatch result = getBean(MacroWasteBatch.class, id);
return result;
}
@Override
- public MacroDechetBatch createMacroDechetBatch(MacroDechetBatch bean) {
- MacroDechetBatch result = create(MacroDechetBatch.class, bean);
+ public MacroWasteBatch createMacroWasteBatch(MacroWasteBatch bean) {
+ MacroWasteBatch result = create(MacroWasteBatch.class, bean);
return result;
}
@Override
- public MacroDechetBatch saveMacroDechetBatch(MacroDechetBatch bean) {
- MacroDechetBatch result = save(MacroDechetBatch.class, bean);
+ public MacroWasteBatch saveMacroWasteBatch(MacroWasteBatch bean) {
+ MacroWasteBatch result = save(MacroWasteBatch.class, bean);
return result;
}
+ @Override
+ public void deleteMacroWasteBatch(String id) {
+ remove(MacroWasteBatch.class, id);
+ }
+
//------------------------------------------------------------------------//
//-- Accidentel Batch methods --//
//------------------------------------------------------------------------//
@Override
- public List<AccidentelBatch> getAllAccidentelBatch(String fishingOperationId) {
- List<AccidentelBatch> result = getAllTraitFilterBatches(
- AccidentelBatch.class, fishingOperationId);
+ public List<AccidentalBatch> getAllAccidentalBatch(String fishingOperationId) {
+ List<AccidentalBatch> result = getAllTraitFilterBatches(
+ AccidentalBatch.class, fishingOperationId);
return result;
}
@Override
- public AccidentelBatch getAccidentelBatch(String id) {
- AccidentelBatch result = getBean(AccidentelBatch.class, id);
+ public AccidentalBatch getAccidentalBatch(String id) {
+ AccidentalBatch result = getBean(AccidentalBatch.class, id);
return result;
}
@Override
- public AccidentelBatch createAccidentelBatch(AccidentelBatch bean) {
- AccidentelBatch result = create(AccidentelBatch.class, bean);
+ public AccidentalBatch createAccidentalBatch(AccidentalBatch bean) {
+ AccidentalBatch result = create(AccidentalBatch.class, bean);
return result;
}
@Override
- public AccidentelBatch saveAccidentelBatch(AccidentelBatch bean) {
- AccidentelBatch result = save(AccidentelBatch.class, bean);
+ public AccidentalBatch saveAccidentalBatch(AccidentalBatch bean) {
+ AccidentalBatch result = save(AccidentalBatch.class, bean);
return result;
}
+ @Override
+ public void deleteAccidentalBatch(String id) {
+ remove(AccidentalBatch.class, id);
+ }
+
//------------------------------------------------------------------------//
//-- Internal methods --//
//------------------------------------------------------------------------//
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -26,12 +26,12 @@
import com.google.common.base.Preconditions;
import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
-import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
+import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
@@ -357,90 +357,114 @@
return driver.saveBenthosBatch(bean);
}
+ @Override
+ public void deleteBenthosBatch(String id) {
+ checkDriverExists();
+ driver.deleteBenthosBatch(id);
+ }
+
//------------------------------------------------------------------------//
//-- Plancton Batch methods --//
//------------------------------------------------------------------------//
@Override
- public List<PlanctonBatch> getAllPlanctonBatch(String fishingOperationId) {
+ public List<PlanktonBatch> getAllPlanktonBatch(String fishingOperationId) {
checkDriverExists();
- return driver.getAllPlanctonBatch(fishingOperationId);
+ return driver.getAllPlanktonBatch(fishingOperationId);
}
@Override
- public PlanctonBatch getPlanctonBatch(String id) {
+ public PlanktonBatch getPlanktonBatch(String id) {
checkDriverExists();
- return driver.getPlanctonBatch(id);
+ return driver.getPlanktonBatch(id);
}
@Override
- public PlanctonBatch createPlanctonBatch(PlanctonBatch bean) {
+ public PlanktonBatch createPlanktonBatch(PlanktonBatch bean) {
checkDriverExists();
- return driver.createPlanctonBatch(bean);
+ return driver.createPlanktonBatch(bean);
}
@Override
- public PlanctonBatch savePlanctonBatch(PlanctonBatch bean) {
+ public PlanktonBatch savePlanktonBatch(PlanktonBatch bean) {
checkDriverExists();
- return driver.savePlanctonBatch(bean);
+ return driver.savePlanktonBatch(bean);
}
+ @Override
+ public void deletePlanktonBatch(String id) {
+ checkDriverExists();
+ driver.deletePlanktonBatch(id);
+ }
+
//------------------------------------------------------------------------//
//-- Macrodechet Batch methods --//
//------------------------------------------------------------------------//
@Override
- public List<MacroDechetBatch> getAllMacroDechetBatch(String fishingOperationId) {
+ public List<MacroWasteBatch> getAllMacroWasteBatch(String fishingOperationId) {
checkDriverExists();
- return driver.getAllMacroDechetBatch(fishingOperationId);
+ return driver.getAllMacroWasteBatch(fishingOperationId);
}
@Override
- public MacroDechetBatch getMacroDechetBatch(String id) {
+ public MacroWasteBatch getMacroWasteBatch(String id) {
checkDriverExists();
- return driver.getMacroDechetBatch(id);
+ return driver.getMacroWasteBatch(id);
}
@Override
- public MacroDechetBatch createMacroDechetBatch(MacroDechetBatch bean) {
+ public MacroWasteBatch createMacroWasteBatch(MacroWasteBatch bean) {
checkDriverExists();
- return driver.createMacroDechetBatch(bean);
+ return driver.createMacroWasteBatch(bean);
}
@Override
- public MacroDechetBatch saveMacroDechetBatch(MacroDechetBatch bean) {
+ public MacroWasteBatch saveMacroWasteBatch(MacroWasteBatch bean) {
checkDriverExists();
- return driver.saveMacroDechetBatch(bean);
+ return driver.saveMacroWasteBatch(bean);
}
+ @Override
+ public void deleteMacroWasteBatch(String id) {
+ checkDriverExists();
+ driver.deleteMacroWasteBatch(id);
+ }
+
//------------------------------------------------------------------------//
//-- Accidentel Batch methods --//
//------------------------------------------------------------------------//
@Override
- public List<AccidentelBatch> getAllAccidentelBatch(String fishingOperationId) {
+ public List<AccidentalBatch> getAllAccidentalBatch(String fishingOperationId) {
checkDriverExists();
- return driver.getAllAccidentelBatch(fishingOperationId);
+ return driver.getAllAccidentalBatch(fishingOperationId);
}
@Override
- public AccidentelBatch getAccidentelBatch(String id) {
+ public AccidentalBatch getAccidentalBatch(String id) {
checkDriverExists();
- return driver.getAccidentelBatch(id);
+ return driver.getAccidentalBatch(id);
}
@Override
- public AccidentelBatch createAccidentelBatch(AccidentelBatch bean) {
+ public AccidentalBatch createAccidentalBatch(AccidentalBatch bean) {
checkDriverExists();
- return driver.createAccidentelBatch(bean);
+ return driver.createAccidentalBatch(bean);
}
@Override
- public AccidentelBatch saveAccidentelBatch(AccidentelBatch bean) {
+ public AccidentalBatch saveAccidentalBatch(AccidentalBatch bean) {
checkDriverExists();
- return driver.saveAccidentelBatch(bean);
+ return driver.saveAccidentalBatch(bean);
}
+ @Override
+ public void deleteAccidentalBatch(String id) {
+ checkDriverExists();
+ driver.deleteAccidentalBatch(id);
+ }
+
//------------------------------------------------------------------------//
//-- Internal methods --//
//------------------------------------------------------------------------//
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -73,7 +73,7 @@
text: "tutti.action.fillCatches";
toolTipText: "tutti.action.fillCatches.tip";
mnemonic: C;
- enabled: {model.getScreen() != TuttiScreen.FILL_FISHING_OPERATION && model.isCruiseContextFilled()};
+ enabled: {model.getScreen() != TuttiScreen.EDIT_FISHING_OPERATION && model.isCruiseContextFilled()};
/*actionIcon: "catches";*/
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -24,16 +24,16 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.config.TuttiServiceConfigOption;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
import fr.ifremer.tutti.ui.swing.config.TuttiConfigOption;
import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUI;
-import fr.ifremer.tutti.ui.swing.content.program.EditProgramUI;
import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUI;
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.program.EditProgramUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
@@ -114,7 +114,7 @@
if (context.isCruiseContextFilled()) {
// direct fill catches screen
- screen = TuttiScreen.FILL_FISHING_OPERATION;
+ screen = TuttiScreen.EDIT_FISHING_OPERATION;
} else {
// go to select cruise screen
@@ -234,7 +234,7 @@
}
public void showFillCatches() {
- context.setScreen(TuttiScreen.FILL_FISHING_OPERATION);
+ context.setScreen(TuttiScreen.EDIT_FISHING_OPERATION);
}
public void showImportScreen() {
@@ -355,9 +355,9 @@
screenUI = new EditCruiseUI(context);
break;
- case FILL_FISHING_OPERATION:
+ case EDIT_FISHING_OPERATION:
- screenTitle = _("tutti.title.fill.catches");
+ screenTitle = _("tutti.title.edit.operations", getSelectedCruiseTitle());
screenUI = new FishingOperationsUI(context);
break;
}
@@ -397,7 +397,7 @@
protected void closeCurrentBody() {
if (currentBody != null) {
- TuttiUI<?,?> body = (TuttiUI<?,?>) currentBody;
+ TuttiUI<?, ?> body = (TuttiUI<?, ?>) currentBody;
body.getHandler().onCloseUI();
context.getSwingSession().save();
@@ -430,7 +430,16 @@
}
protected void changeTitle() {
+
+ String title = getSelectedCruiseTitle();
+
+ ui.setTitle("Tutti - v " + getConfig().getVersion() + " [ " + title + " ]");
+ }
+
+ protected String getSelectedCruiseTitle() {
+
String surveyId = context.getProgramId();
+
String title;
if (surveyId == null) {
@@ -465,8 +474,7 @@
title += _("tutti.title.selectedCruise", cruise.getName());
}
}
-
- ui.setTitle("Tutti - v " + getConfig().getVersion() + " [ " + title + " ]");
+ return title;
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -65,5 +65,5 @@
*
* @since 0.1
*/
- FILL_FISHING_OPERATION
+ EDIT_FISHING_OPERATION
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -175,7 +175,7 @@
public void showFishingOperations() {
- context.setScreen(TuttiScreen.FILL_FISHING_OPERATION);
+ context.setScreen(TuttiScreen.EDIT_FISHING_OPERATION);
}
public void showSelectedProgram() {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -84,10 +84,10 @@
<field name='saisisseur' component='saisisseurList'/>
</BeanValidator>
- <JPanel id='traitPane' constraints='BorderLayout.CENTER'
+ <JPanel id='fishingOperationPane' constraints='BorderLayout.CENTER'
layout='{new BorderLayout()}'>
- <JTabbedPane id='traitTabPane' constraints='BorderLayout.CENTER'>
+ <JTabbedPane id='fishingOperationTabPane' constraints='BorderLayout.CENTER'>
<tab id='traitGeneralTab'
title='tutti.label.tab.fishingOperation.general'>
<Table fill='both' id='generalForm'>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -28,7 +28,6 @@
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -72,7 +71,7 @@
model.addPropertyChangeListener(FishingOperationTabUIModel.PROPERTY_EMPTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- JPanel form = ui.getTraitPane();
+ JPanel form = ui.getFishingOperationPane();
JLabel noContentPane = ui.getNoTraitPane();
Boolean empty = (Boolean) evt.getNewValue();
@@ -153,9 +152,6 @@
// update model empty property
model.setEmpty(empty);
- // reload bean in validator (? really mandatory?)
-// ui.getValidator().reloadBean();
-
// if new fishingOperation can already cancel his creation
model.setModify(!empty && model.isCreate());
}
@@ -192,13 +188,13 @@
}
// keep selected tab (to resotre it after save)
- int selectedIndex = ui.getTraitTabPane().getSelectedIndex();
+ int selectedIndex = ui.getFishingOperationTabPane().getSelectedIndex();
// persist current fishingOperation
parentUi.getHandler().saveFishingOperation(toSave);
// reselect current tab
- ui.getTraitTabPane().setSelectedIndex(selectedIndex);
+ ui.getFishingOperationTabPane().setSelectedIndex(selectedIndex);
getModel().setModify(false);
}
@@ -219,10 +215,6 @@
getModel().setGearShootingStartLongitude(Float.valueOf(text));
}
-// public void setGearShootingStartTime(String text) {
-// getModel().setGearShootingStartTime(Integer.valueOf(text));
-// }
-
public void setGearShootingEndLatitude(String text) {
getModel().setGearShootingEndLatitude(Float.valueOf(text));
}
@@ -230,8 +222,4 @@
public void setGearShootingEndLongitude(String text) {
getModel().setGearShootingEndLongitude(Float.valueOf(text));
}
-
-// public void setGearShootingEndTime(String text) {
-// getModel().setGearShootingEndTime(Integer.valueOf(text));
-// }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -46,7 +46,7 @@
enabled: {model.getSelectedFishingOperation() != null};
}
-#planctonTab {
+#planktonTab {
enabled: {model.getSelectedFishingOperation() != null};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -28,11 +28,11 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.accidental.AccidentelTabUI
- fr.ifremer.tutti.ui.swing.content.operation.benthos.BenthosTabUI
- fr.ifremer.tutti.ui.swing.content.operation.macrowaste.MacroDechetTabUI
- fr.ifremer.tutti.ui.swing.content.operation.plankton.PlanctonTabUI
- fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.accidental.AccidentalBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.benthos.BenthosBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.macrowaste.MacroWasteBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.plankton.PlanktonBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchUI
jaxx.runtime.swing.editor.bean.BeanComboBox
@@ -73,23 +73,23 @@
</Table>
<JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'>
- <tab id='traitTab' title='tutti.label.tab.fishingOperation'>
+ <tab id='fishingOperationTab' title='tutti.label.tab.fishingOperation'>
<FishingOperationTabUI id='fishingOperationTabContent' constructorParams='this'/>
</tab>
<tab id='speciesTab' title='tutti.label.tab.species'>
- <SpeciesTabUI id='speciesTabContent' constructorParams='this'/>
+ <SpeciesBatchUI id='speciesTabContent' constructorParams='this'/>
</tab>
<tab id='benthosTab' title='tutti.label.tab.benthos'>
- <BenthosTabUI id='benthosTabContent' constructorParams='this'/>
+ <BenthosBatchUI id='benthosTabContent' constructorParams='this'/>
</tab>
- <tab id='planctonTab' title='tutti.label.tab.plancton'>
- <PlanctonTabUI id='planctonTabContent' constructorParams='this'/>
+ <tab id='planktonTab' title='tutti.label.tab.plancton'>
+ <PlanktonBatchUI id='planktonTabContent' constructorParams='this'/>
</tab>
<tab id='macroDechetTab' title='tutti.label.tab.macroDechet'>
- <MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/>
+ <MacroWasteBatchUI id='macroDechetTabContent' constructorParams='this'/>
</tab>
<tab id='accidentelTab' title='tutti.label.tab.accidentel'>
- <AccidentelTabUI id='accidentelTabContent' constructorParams='this'/>
+ <AccidentalBatchUI id='accidentelTabContent' constructorParams='this'/>
</tab>
<tab id='observationIndividuelTab' title='tutti.label.tab.observationIndividuel'>
<JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -127,7 +127,7 @@
// ui will be saved so we do not want to keep selected tab indexes
ui.getTabPane().setSelectedIndex(0);
- ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
+ ui.getFishingOperationTabContent().getFishingOperationTabPane().setSelectedIndex(0);
// when quitting ui, let's de-select fishingOperation (will save any changes)
selectFishingOperation(null);
@@ -167,13 +167,13 @@
ui.getTabPane().setSelectedIndex(0);
// back to general tab of fishingOperation tabs
- ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
+ ui.getFishingOperationTabContent().getFishingOperationTabPane().setSelectedIndex(0);
// propagate fishingOperation to his tabs
ui.getFishingOperationTabContent().selectFishingOperation(fishingOperation);
ui.getSpeciesTabContent().selectFishingOperation(fishingOperation);
ui.getBenthosTabContent().selectFishingOperation(fishingOperation);
- ui.getPlanctonTabContent().selectFishingOperation(fishingOperation);
+ ui.getPlanktonTabContent().selectFishingOperation(fishingOperation);
ui.getMacroDechetTabContent().selectFishingOperation(fishingOperation);
ui.getAccidentelTabContent().selectFishingOperation(fishingOperation);
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchRowModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,116 @@
+package fr.ifremer.tutti.ui.swing.content.operation.accidental;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.AccidentalBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * Define a benthos batch row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentalBatchRowModel extends AbstractTuttiBeanUIModel<AccidentalBatch, AccidentalBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_SPECIES = "species";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected Species species;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ protected static final Binder<AccidentalBatch, AccidentalBatchRowModel> fromBeanBinder =
+ BinderFactory.newBinder(AccidentalBatch.class,
+ AccidentalBatchRowModel.class);
+
+ protected static final Binder<AccidentalBatchRowModel, AccidentalBatch> toBeanBinder =
+ BinderFactory.newBinder(AccidentalBatchRowModel.class,
+ AccidentalBatch.class);
+
+ public AccidentalBatchRowModel() {
+ super(AccidentalBatch.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public AccidentalBatchRowModel(AccidentalBatch aBatch) {
+ this();
+ fromBean(aBatch);
+ }
+
+ public Species getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(Species species) {
+ Object oldValue = getSpecies();
+ this.species = species;
+ firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchTableModel.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchTableModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,119 @@
+package fr.ifremer.tutti.ui.swing.content.operation.accidental;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.ui.swing.content.operation.benthos.BenthosBatchRowModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentalBatchTableModel extends AbstractTuttiTableModel<AccidentalBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<AccidentalBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.benthos.batch.header.speciesByCode"),
+ n_("tutti.table.benthos.batch.header.speciesByCode"));
+
+ public static final ColumnIdentifier<AccidentalBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.benthos.batch.header.speciesByGenusCode"),
+ n_("tutti.table.benthos.batch.header.speciesByGenusCode"));
+
+ public static final ColumnIdentifier<AccidentalBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.benthos.batch.header.weight"),
+ n_("tutti.table.benthos.batch.header.weight"));
+
+ public static final ColumnIdentifier<AccidentalBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.benthos.batch.header.comment"),
+ n_("tutti.table.benthos.batch.header.comment"));
+
+ public static final ColumnIdentifier<AccidentalBatchRowModel> FILE = ColumnIdentifier.newId(
+ null,
+ n_("tutti.table.benthos.batch.header.file"),
+ n_("tutti.table.benthos.batch.header.file"));
+
+
+ public AccidentalBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(
+ FILE
+ );
+ }
+
+ @Override
+ protected AccidentalBatchRowModel createNewRow() {
+ AccidentalBatchRowModel result = new AccidentalBatchRowModel();
+
+ // by default empty row is not valid
+ result.setValid(false);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<AccidentalBatchRowModel> propertyName,
+ AccidentalBatchRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+
+ if (propertyName == SPECIES_BY_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_GENUS_CODE);
+
+ } else if (propertyName == SPECIES_BY_GENUS_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_CODE);
+ }
+ }
+
+ @Override
+ protected boolean isCellEditable(int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<AccidentalBatchRowModel> propertyName) {
+
+ boolean result = super.isCellEditable(rowIndex,
+ columnIndex,
+ propertyName);
+
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.css (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,37 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,67 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<AccidentalBatchUIModel, AccidentalBatchUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ org.jdesktop.swingx.JXTable
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public AccidentalBatchUI(FishingOperationsUI parentUI) {
+ AccidentalBatchUIHandler handler = new AccidentalBatchUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <AccidentalBatchUIHandler id='handler'
+ initializer='getContextValue(AccidentalBatchUIHandler.class)'/>
+
+ <AccidentalBatchUIModel id='model'
+ initializer='getContextValue(AccidentalBatchUIModel.class)'/>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,464 @@
+package fr.ifremer.tutti.ui.swing.content.operation.accidental;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentalBatchUIHandler extends AbstractTuttiTableUIHandler<AccidentalBatchRowModel, AccidentalBatchUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(AccidentalBatchUIHandler.class);
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
+ private final AccidentalBatchUI ui;
+
+ /**
+ * Persistence service.
+ *
+ * @since 0.2
+ */
+ private final PersistenceService persistenceService;
+
+ /**
+ * To monitor changes on the fishing operation.
+ *
+ * @since 0.2
+ */
+ private final TuttiBeanMonitor<AccidentalBatchUIModel> fishingOperationMonitor;
+
+ public AccidentalBatchUIHandler(FishingOperationsUI parentUi, AccidentalBatchUI ui) {
+ super(parentUi.getHandler().getContext(),
+ AccidentalBatchRowModel.PROPERTY_SPECIES,
+ AccidentalBatchRowModel.PROPERTY_WEIGHT,
+ AccidentalBatchRowModel.PROPERTY_COMMENT);
+ this.ui = ui;
+ this.persistenceService = context.getService(PersistenceService.class);
+ this.fishingOperationMonitor = new TuttiBeanMonitor<AccidentalBatchUIModel>();
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected AccidentalBatchUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected AccidentalBatchTableModel getTableModel() {
+ return (AccidentalBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ {
+ // Species (by code) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ AccidentalBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ {
+ // Species (by genusCode) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ AccidentalBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ AccidentalBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ AccidentalBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ AccidentalBatchTableModel.FILE);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(AccidentalBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ boolean wasValid = row.isValid();
+
+ boolean valid = isRowValid(row);
+
+ if (log.isInfoEnabled()) {
+ log.info("Was valid / Is valid: " + wasValid + " / " + valid);
+ }
+ row.setValid(valid);
+ }
+
+ @Override
+ protected void onRowValidStateChanged(AccidentalBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ int rowIndex = getTableModel().getRowIndex(row);
+
+ if (rowIndex > -1) {
+ getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(AccidentalBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ @Override
+ protected void onModelRowsChanged(List<AccidentalBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // set valid flag
+ for (AccidentalBatchRowModel row : rows) {
+ boolean valid = isRowValid(row);
+ row.setValid(valid);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
+ AccidentalBatchUIModel model = new AccidentalBatchUIModel();
+ ui.setContextValue(model);
+
+ fishingOperationMonitor.setBean(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ AccidentalBatchTableModel tableModel =
+ new AccidentalBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+ installTableKeyListener(columnModel, table);
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+
+ Highlighter readOnlyHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY);
+
+ table.addHighlighter(readOnlyHighlighter);
+ Highlighter validHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ new HighlightPredicate.AndHighlightPredicate(HighlightPredicate.EDITABLE, new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+
+ boolean result = false;
+ if (adapter.isEditable()) {
+ int rowIndex = adapter.convertRowIndexToModel(adapter.row);
+ AccidentalBatchRowModel row = getTableModel().getEntry(rowIndex);
+ result = !row.isValid();
+ }
+ return result;
+ }
+ }), Color.RED);
+ table.addHighlighter(validHighlighter);
+
+ // when model datas change let's propagate it table model
+ listenRowsFromModel();
+
+ // save when row chaged and was modified
+ ListSelectionListener listener = new TableRowModificationListener<AccidentalBatchRowModel>(
+ getTableModel(), getRowMonitor()) {
+ @Override
+ protected void saveSelectedRow() {
+ saveSelectedRowIfRequired();
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(listener);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
+ }
+
+ @Override
+ public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ public void saveSelectedRowIfRequired(FocusEvent event) {
+
+ Component oppositeComponent = event.getOppositeComponent();
+
+ JXTable parentContainer = null;
+
+ if (oppositeComponent != null) {
+
+ // check out if still on table
+ parentContainer = SwingUtil.getParentContainer(
+ oppositeComponent, JXTable.class);
+ }
+
+ if (parentContainer == null) {
+
+ // out of the table can save
+ if (getModel().getFishingOperation() != null) {
+ saveSelectedRowIfRequired();
+ }
+ }
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ if (fishingOperationMonitor.wasModified()) {
+
+ // previous fishingOperation was modified, let's save it
+ AccidentalBatchUIModel beanToSave = fishingOperationMonitor.getBean();
+
+ FishingOperation fishingOperation = beanToSave.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("FishingOperation " + fishingOperation.getId() +
+ " was modified, will save it.");
+ }
+
+ persistenceService.saveFishingOperation(fishingOperation);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ AccidentalBatchUIModel model = getModel();
+
+ List<AccidentalBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ bean = new FishingOperation();
+ model.setFishingOperation(null);
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " + bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<AccidentalBatch> catches =
+ persistenceService.getAllAccidentalBatch(bean.getId());
+ for (AccidentalBatch aBatch : catches) {
+ AccidentalBatchRowModel entry =
+ new AccidentalBatchRowModel(aBatch);
+ rows.add(entry);
+ }
+ }
+ model.setFishingOperation(bean);
+ }
+
+ model.fromBean(bean);
+ model.setRows(rows);
+
+ fishingOperationMonitor.clearModified();
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected boolean isRowValid(AccidentalBatchRowModel row) {
+ boolean result = row.getSpecies() != null && row.getWeight() != null;
+ return result;
+ }
+
+ protected void saveSelectedRowIfRequired() {
+
+ TuttiBeanMonitor<AccidentalBatchRowModel> rowMonitor = getRowMonitor();
+
+ AccidentalBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null) {
+
+ if (bean.isValid()) {
+ // there is a valid bean attached to the monitor
+
+ if (rowMonitor.wasModified()) {
+
+ // monitored bean was modified, save it
+ if (log.isInfoEnabled()) {
+ log.info("Row " + bean + " was modified, will save it");
+ }
+
+ saveRow(bean);
+
+ // clear modified flag on the monitor
+ rowMonitor.clearModified();
+ }
+ } else {
+
+ // row is not valid can not save it
+
+ AccidentalBatch catchBean = bean.toBean();
+
+ if (!TuttiEntities.isNew(catchBean)) {
+
+ // remove this
+ persistenceService.deleteAccidentalBatch(catchBean.getId());
+ }
+ }
+ }
+ }
+
+ protected void saveRow(AccidentalBatchRowModel row) {
+
+ AccidentalBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createAccidentalBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveAccidentalBatch(catchBean);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,73 @@
+package fr.ifremer.tutti.ui.swing.content.operation.accidental;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentalBatchUIModel extends AbstractTuttiTableUIModel<FishingOperation, AccidentalBatchRowModel, AccidentalBatchUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Editing fishing operation.
+ *
+ * @since 0.2
+ */
+ protected FishingOperation fishingOperation;
+
+
+ protected static final Binder<FishingOperation, AccidentalBatchUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, AccidentalBatchUIModel.class)
+ .addProperty(FishingOperation.PROPERTY_ID, PROPERTY_ID)
+ .toBinder();
+
+ protected static final Binder<AccidentalBatchUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(AccidentalBatchUIModel.class, FishingOperation.class)
+ .toBinder();
+
+
+ public AccidentalBatchUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public FishingOperation getFishingOperation() {
+ return fishingOperation;
+ }
+
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ }
+
+
+ @Override
+ protected FishingOperation newEntity() {
+ return fishingOperation;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentalBatchUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
- bean: {model};
- showReset: true;
-}
-
-#totalWeightLabel {
- text: "tutti.label.captureAccidentel.totalWeight";
- labelFor: {totalWeightField};
-}
-
-#totalWeightField {
- property: "totalWeight";
- model: {model.getTotalWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text: "tutti.label.captureAccidentel.sampleTotalWeight";
- labelFor: {totalWeightField};
-}
-
-#sampleTotalWeightField {
- property: "sampleTotalWeight";
- model: {model.getSampleTotalWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model: {getContextValue(TableModel.class)};
- columnModel: {getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,98 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<AccidentelTabUIModel, AccidentelTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
- fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public AccidentelTabUI(FishingOperationsUI parentUI) {
- AccidentelTabUIHandler handler = new AccidentelTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <AccidentelTabUIHandler id='handler'
- initializer='getContextValue(AccidentelTabUIHandler.class)'/>
-
- <AccidentelTabUIModel id='model'
- initializer='getContextValue(AccidentelTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,182 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.accidental;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.AccidentelBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class AccidentelTabUIHandler extends AbstractTuttiUIHandler<AccidentelTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(AccidentelTabUIHandler.class);
-
- private final AccidentelTabUI ui;
-
- private final FishingOperationsUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public AccidentelTabUIHandler(FishingOperationsUI parentUi, AccidentelTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- AccidentelTabUIModel model = new AccidentelTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<Species> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
-// col.setCellRenderer(newTableCellRender(Species.class));
- col.setHeaderValue(_("tutti.table.captureAccidentel.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.captureAccidentel.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.captureAccidentel.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final AccidentelTableModel tableModel = new AccidentelTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(AccidentelTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- AccidentelTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected AccidentelTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectFishingOperation(FishingOperation bean) {
-
- boolean empty = bean == null;
-
- AccidentelTabUIModel model = ui.getModel();
-
- List<AccidentelBatch> catches;
-
- if (empty) {
- catches = null;
- bean = new FishingOperation();
- } else {
- catches = persistenceService.getAllAccidentelBatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.accidental;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.AccidentelBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class AccidentelTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<AccidentelBatch> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<AccidentelBatch> getCatches() {
- return catches;
- }
-
- public void setCatches(List<AccidentelBatch> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(FishingOperation bean) {
- BinderFactory.newBinder(FishingOperation.class,
- AccidentelTabUIModel.class).copy(bean, this);
- }
-
- public FishingOperation toBean() {
- FishingOperation result = new FishingOperation();
- BinderFactory.newBinder(AccidentelTabUIModel.class,
- FishingOperation.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.accidental;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class AccidentelTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<SpeciesBatch> data;
-
- protected final TableColumnModel columnModel;
-
- public AccidentelTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<SpeciesBatch> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new SpeciesBatch());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchRowModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,173 @@
+package fr.ifremer.tutti.ui.swing.content.operation.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * Define a benthos batch row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<BenthosBatch, BenthosBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_SPECIES = "species";
+
+ public static final String PROPERTY_SPECIES_TO_CONFIRM = "speciesToConfirm";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
+
+ public static final String PROPERTY_SAMPLING_RATIO = "samplingRatio";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected Species species;
+
+ /**
+ * Is the species need to be confirmed?.
+ *
+ * @since 0.2
+ */
+ protected boolean speciesToConfirm;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Sampling ratio.
+ *
+ * @since 0.2
+ */
+ protected Float samplingRatio;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ protected static final Binder<BenthosBatch, BenthosBatchRowModel> fromBeanBinder =
+ BinderFactory.newBinder(BenthosBatch.class,
+ BenthosBatchRowModel.class);
+
+ protected static final Binder<BenthosBatchRowModel, BenthosBatch> toBeanBinder =
+ BinderFactory.newBinder(BenthosBatchRowModel.class,
+ BenthosBatch.class);
+
+ public BenthosBatchRowModel() {
+ super(BenthosBatch.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public BenthosBatchRowModel(BenthosBatch aBatch) {
+ this();
+ fromBean(aBatch);
+ }
+
+ public Species getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(Species species) {
+ Object oldValue = getSpecies();
+ this.species = species;
+ firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ }
+
+ public Boolean getSpeciesToConfirm() {
+ return speciesToConfirm;
+ }
+
+ public void setSpeciesToConfirm(Boolean speciesToConfirm) {
+ Object oldValue = getSpeciesToConfirm();
+ this.speciesToConfirm = speciesToConfirm;
+ firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ Object oldValue = getSampleWeight();
+ this.sampleWeight = sampleWeight;
+ firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
+ }
+
+ public Float getSamplingRatio() {
+ return samplingRatio;
+ }
+
+ public void setSamplingRatio(Float samplingRatio) {
+ Object oldValue = getSamplingRatio();
+ this.samplingRatio = samplingRatio;
+ firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,147 @@
+package fr.ifremer.tutti.ui.swing.content.operation.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosBatchTableModel extends AbstractTuttiTableModel<BenthosBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ n_("tutti.table.benthos.batch.header.toConfirm"),
+ n_("tutti.table.benthos.batch.header.toConfirm"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.benthos.batch.header.speciesByCode"),
+ n_("tutti.table.benthos.batch.header.speciesByCode"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.benthos.batch.header.speciesByGenusCode"),
+ n_("tutti.table.benthos.batch.header.speciesByGenusCode"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.benthos.batch.header.weight"),
+ n_("tutti.table.benthos.batch.header.weight"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ n_("tutti.table.benthos.batch.header.sampleWeight"),
+ n_("tutti.table.benthos.batch.header.sampleWeight"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> SAMPLING_RATIO = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ n_("tutti.table.benthos.batch.header.elevationRate"),
+ n_("tutti.table.benthos.batch.header.elevationRate"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ BenthosBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.benthos.batch.header.comment"),
+ n_("tutti.table.benthos.batch.header.comment"));
+
+ public static final ColumnIdentifier<BenthosBatchRowModel> FILE = ColumnIdentifier.newId(
+ null,
+ n_("tutti.table.benthos.batch.header.file"),
+ n_("tutti.table.benthos.batch.header.file"));
+
+
+ public BenthosBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(
+ SAMPLE_WEIGHT,
+ SAMPLING_RATIO,
+ FILE
+ );
+ }
+
+ @Override
+ protected BenthosBatchRowModel createNewRow() {
+ BenthosBatchRowModel result = new BenthosBatchRowModel();
+
+ // by default empty row is not valid
+ result.setValid(false);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<BenthosBatchRowModel> propertyName,
+ BenthosBatchRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+
+ if (propertyName == SPECIES_BY_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_GENUS_CODE);
+
+ } else if (propertyName == SPECIES_BY_GENUS_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_CODE);
+ }
+ }
+
+ public void updateSamplingRatio(Set<BenthosBatchRowModel> rows) {
+ for (BenthosBatchRowModel row : rows) {
+ int rowIndex = getRows().indexOf(row);
+ fireTableCellUpdated(rowIndex,
+ SAMPLE_WEIGHT,
+ SAMPLING_RATIO);
+ }
+
+
+ }
+
+ @Override
+ protected boolean isCellEditable(int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<BenthosBatchRowModel> propertyName) {
+
+ boolean result = super.isCellEditable(rowIndex,
+ columnIndex,
+ propertyName);
+
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,61 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#totalWeightLabel {
+ text: "tutti.label.benthos.totalWeight";
+ labelFor: {totalWeightField};
+}
+
+#totalWeightField {
+ property: "totalWeight";
+ model: {model.getTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text: "tutti.label.benthos.sampleTotalWeight";
+ labelFor: {totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property: "sampleTotalWeight";
+ model: {model.getSampleTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,101 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosBatchUIModel, BenthosBatchUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXTable
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public BenthosBatchUI(FishingOperationsUI parentUI) {
+ BenthosBatchUIHandler handler = new BenthosBatchUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <BenthosBatchUIHandler id='handler'
+ initializer='getContextValue(BenthosBatchUIHandler.class)'/>
+
+ <BenthosBatchUIModel id='model'
+ initializer='getContextValue(BenthosBatchUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,496 @@
+package fr.ifremer.tutti.ui.swing.content.operation.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosBatchUIHandler extends AbstractTuttiTableUIHandler<BenthosBatchRowModel, BenthosBatchUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(BenthosBatchUIHandler.class);
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
+ private final BenthosBatchUI ui;
+
+ /**
+ * Persistence service.
+ *
+ * @since 0.2
+ */
+ private final PersistenceService persistenceService;
+
+ /**
+ * To monitor changes on the fishing operation.
+ *
+ * @since 0.2
+ */
+ private final TuttiBeanMonitor<BenthosBatchUIModel> fishingOperationMonitor;
+
+ public BenthosBatchUIHandler(FishingOperationsUI parentUi, BenthosBatchUI ui) {
+ super(parentUi.getHandler().getContext(),
+ BenthosBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ BenthosBatchRowModel.PROPERTY_SPECIES,
+ BenthosBatchRowModel.PROPERTY_WEIGHT,
+ BenthosBatchRowModel.PROPERTY_COMMENT);
+ this.ui = ui;
+ this.persistenceService = context.getService(PersistenceService.class);
+ this.fishingOperationMonitor = new TuttiBeanMonitor<BenthosBatchUIModel>(
+ BenthosBatchUIModel.PROPERTY_TOTAL_WEIGHT,
+ BenthosBatchUIModel.PROPERTY_SAMPLE_TOTAL_WEIGHT
+ );
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected BenthosBatchUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected BenthosBatchTableModel getTableModel() {
+ return (BenthosBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected String[] getRowPropertiesToIgnore() {
+ return new String[]{
+ BenthosBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ BenthosBatchRowModel.PROPERTY_SAMPLING_RATIO
+ };
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ {
+ // Species to confirm column
+
+ addBooleanColumnToModel(columnModel,
+ BenthosBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ {
+ // Species (by code) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ BenthosBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ {
+ // Species (by genusCode) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ BenthosBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ BenthosBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Sample weight column
+
+ addColumnToModel(columnModel,
+ BenthosBatchTableModel.SAMPLE_WEIGHT);
+ }
+
+ { // SamplingRatio column
+
+ addColumnToModel(columnModel,
+ BenthosBatchTableModel.SAMPLING_RATIO);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ BenthosBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ BenthosBatchTableModel.FILE);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(BenthosBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ boolean wasValid = row.isValid();
+
+ boolean valid = isRowValid(row);
+
+ if (log.isInfoEnabled()) {
+ log.info("Was valid / Is valid: " + wasValid + " / " + valid);
+ }
+ row.setValid(valid);
+ }
+
+ @Override
+ protected void onRowValidStateChanged(BenthosBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ int rowIndex = getTableModel().getRowIndex(row);
+
+ if (rowIndex > -1) {
+ getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(BenthosBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ @Override
+ protected void onModelRowsChanged(List<BenthosBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // set valid flag
+ for (BenthosBatchRowModel row : rows) {
+ boolean valid = isRowValid(row);
+ row.setValid(valid);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
+ BenthosBatchUIModel model = new BenthosBatchUIModel();
+ ui.setContextValue(model);
+
+ fishingOperationMonitor.setBean(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ BenthosBatchTableModel tableModel =
+ new BenthosBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+ installTableKeyListener(columnModel, table);
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+
+ Highlighter readOnlyHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY);
+
+ table.addHighlighter(readOnlyHighlighter);
+ Highlighter validHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ new HighlightPredicate.AndHighlightPredicate(HighlightPredicate.EDITABLE, new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+
+ boolean result = false;
+ if (adapter.isEditable()) {
+ int rowIndex = adapter.convertRowIndexToModel(adapter.row);
+ BenthosBatchRowModel row = getTableModel().getEntry(rowIndex);
+ result = !row.isValid();
+ }
+ return result;
+ }
+ }), Color.RED);
+ table.addHighlighter(validHighlighter);
+
+ // when model datas change let's propagate it table model
+ listenRowsFromModel();
+
+ // save when row chaged and was modified
+ ListSelectionListener listener = new TableRowModificationListener<BenthosBatchRowModel>(
+ getTableModel(), getRowMonitor()) {
+ @Override
+ protected void saveSelectedRow() {
+ saveSelectedRowIfRequired();
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(listener);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
+ }
+
+ @Override
+ public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ public void saveSelectedRowIfRequired(FocusEvent event) {
+
+ Component oppositeComponent = event.getOppositeComponent();
+
+ JXTable parentContainer = null;
+
+ if (oppositeComponent != null) {
+
+ // check out if still on table
+ parentContainer = SwingUtil.getParentContainer(
+ oppositeComponent, JXTable.class);
+ }
+
+ if (parentContainer == null) {
+
+ // out of the table can save
+ if (getModel().getFishingOperation() != null) {
+ saveSelectedRowIfRequired();
+ }
+ }
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ if (fishingOperationMonitor.wasModified()) {
+
+ // previous fishingOperation was modified, let's save it
+ BenthosBatchUIModel beanToSave = fishingOperationMonitor.getBean();
+
+ FishingOperation fishingOperation = beanToSave.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("FishingOperation " + fishingOperation.getId() +
+ " was modified, will save it.");
+ }
+
+ persistenceService.saveFishingOperation(fishingOperation);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ BenthosBatchUIModel model = getModel();
+
+ List<BenthosBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ bean = new FishingOperation();
+ model.setFishingOperation(null);
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " + bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<BenthosBatch> catches =
+ persistenceService.getAllBenthosBatch(bean.getId());
+ for (BenthosBatch aBatch : catches) {
+ BenthosBatchRowModel entry =
+ new BenthosBatchRowModel(aBatch);
+ rows.add(entry);
+ }
+ }
+ model.setFishingOperation(bean);
+ }
+
+ model.fromBean(bean);
+ model.setRows(rows);
+
+ fishingOperationMonitor.clearModified();
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected boolean isRowValid(BenthosBatchRowModel row) {
+ boolean result = row.getSpecies() != null && row.getWeight() != null;
+ return result;
+ }
+
+ protected void saveSelectedRowIfRequired() {
+
+ TuttiBeanMonitor<BenthosBatchRowModel> rowMonitor = getRowMonitor();
+
+ BenthosBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null) {
+
+ if (bean.isValid()) {
+ // there is a valid bean attached to the monitor
+
+ if (rowMonitor.wasModified()) {
+
+ // monitored bean was modified, save it
+ if (log.isInfoEnabled()) {
+ log.info("Row " + bean + " was modified, will save it");
+ }
+
+ saveRow(bean);
+
+ // clear modified flag on the monitor
+ rowMonitor.clearModified();
+ }
+ } else {
+
+ // row is not valid can not save it
+
+ BenthosBatch catchBean = bean.toBean();
+
+ if (!TuttiEntities.isNew(catchBean)) {
+
+ // remove this
+ persistenceService.deleteBenthosBatch(catchBean.getId());
+ }
+ }
+ }
+ }
+
+ protected void saveRow(BenthosBatchRowModel row) {
+
+ BenthosBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createBenthosBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveBenthosBatch(catchBean);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,113 @@
+package fr.ifremer.tutti.ui.swing.content.operation.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosBatchUIModel extends AbstractTuttiTableUIModel<FishingOperation, BenthosBatchRowModel, BenthosBatchUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ /**
+ * Editing fishing operation.
+ *
+ * @since 0.2
+ */
+ protected FishingOperation fishingOperation;
+
+ /**
+ * Total Weight filled in screen.
+ *
+ * @since 0.2
+ */
+ protected Float totalWeight;
+
+ /**
+ * Total Sample Weight filled in screen.
+ *
+ * @since 0.2
+ */
+ protected Float sampleTotalWeight;
+
+ protected static final Binder<FishingOperation, BenthosBatchUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, BenthosBatchUIModel.class)
+ .addProperty(FishingOperation.PROPERTY_BENTHOS_TOTAL_WEIGHT, PROPERTY_TOTAL_WEIGHT)
+ .addProperty(FishingOperation.PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT, PROPERTY_SAMPLE_TOTAL_WEIGHT)
+ .addProperty(FishingOperation.PROPERTY_ID, PROPERTY_ID)
+ .toBinder();
+
+ protected static final Binder<BenthosBatchUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(BenthosBatchUIModel.class, FishingOperation.class)
+ .addProperty(PROPERTY_TOTAL_WEIGHT, FishingOperation.PROPERTY_BENTHOS_TOTAL_WEIGHT)
+ .addProperty(PROPERTY_SAMPLE_TOTAL_WEIGHT, FishingOperation.PROPERTY_BENTHOS_SAMPLE_TOTAL_WEIGHT)
+ .toBinder();
+
+
+ public BenthosBatchUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public FishingOperation getFishingOperation() {
+ return fishingOperation;
+ }
+
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ }
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ @Override
+ protected FishingOperation newEntity() {
+ return fishingOperation;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosBatchUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.benthos.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text:"tutti.label.benthos.sampleTotalWeight";
- labelFor:{totalWeightField};
-}
-
-#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,98 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosTabUIModel, BenthosTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
- fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public BenthosTabUI(FishingOperationsUI parentUI) {
- BenthosTabUIHandler handler = new BenthosTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <BenthosTabUIHandler id='handler'
- initializer='getContextValue(BenthosTabUIHandler.class)'/>
-
- <BenthosTabUIModel id='model'
- initializer='getContextValue(BenthosTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,182 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosTabUIHandler extends AbstractTuttiUIHandler<BenthosTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(BenthosTabUIHandler.class);
-
- private final BenthosTabUI ui;
-
- private final FishingOperationsUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public BenthosTabUIHandler(FishingOperationsUI parentUi, BenthosTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- BenthosTabUIModel model = new BenthosTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<Species> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
-// col.setCellRenderer(newTableCellRender(Species.class));
- col.setHeaderValue(_("tutti.table.benthos.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.benthos.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.benthos.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final BenthosTableModel tableModel = new BenthosTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(BenthosTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- BenthosTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected BenthosTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectFishingOperation(FishingOperation bean) {
-
- boolean empty = bean == null;
-
- BenthosTabUIModel model = ui.getModel();
-
- List<BenthosBatch> catches;
-
- if (empty) {
- catches = null;
- bean = new FishingOperation();
- } else {
- catches = persistenceService.getAllBenthosBatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<BenthosBatch> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<BenthosBatch> getCatches() {
- return catches;
- }
-
- public void setCatches(List<BenthosBatch> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(FishingOperation bean) {
- BinderFactory.newBinder(FishingOperation.class,
- BenthosTabUIModel.class).copy(bean, this);
- }
-
- public FishingOperation toBean() {
- FishingOperation result = new FishingOperation();
- BinderFactory.newBinder(BenthosTabUIModel.class,
- FishingOperation.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class BenthosTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<SpeciesBatch> data;
-
- protected final TableColumnModel columnModel;
-
- public BenthosTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<SpeciesBatch> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new SpeciesBatch());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.macroDechet.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text:"tutti.label.macroDechet.sampleTotalWeight";
- labelFor:{totalWeightField};
-}
-
-#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,98 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroDechetTabUIModel, MacroDechetTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
- fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public MacroDechetTabUI(FishingOperationsUI parentUI) {
- MacroDechetTabUIHandler handler = new MacroDechetTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <MacroDechetTabUIHandler id='handler'
- initializer='getContextValue(MacroDechetTabUIHandler.class)'/>
-
- <MacroDechetTabUIModel id='model'
- initializer='getContextValue(MacroDechetTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,182 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroDechetTabUIHandler extends AbstractTuttiUIHandler<MacroDechetTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(MacroDechetTabUIHandler.class);
-
- private final MacroDechetTabUI ui;
-
- private final FishingOperationsUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public MacroDechetTabUIHandler(FishingOperationsUI parentUi, MacroDechetTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- MacroDechetTabUIModel model = new MacroDechetTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<Species> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
-// col.setCellRenderer(newTableCellRender(Species.class));
- col.setHeaderValue(_("tutti.table.macroDechet.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.macroDechet.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.macroDechet.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final MacroDechetTableModel tableModel = new MacroDechetTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(MacroDechetTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- MacroDechetTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected MacroDechetTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectFishingOperation(FishingOperation bean) {
-
- boolean empty = bean == null;
-
- MacroDechetTabUIModel model = ui.getModel();
-
- List<MacroDechetBatch> catches;
-
- if (empty) {
- catches = null;
- bean = new FishingOperation();
- } else {
- catches = persistenceService.getAllMacroDechetBatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroDechetTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<MacroDechetBatch> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<MacroDechetBatch> getCatches() {
- return catches;
- }
-
- public void setCatches(List<MacroDechetBatch> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(FishingOperation bean) {
- BinderFactory.newBinder(FishingOperation.class,
- MacroDechetTabUIModel.class).copy(bean, this);
- }
-
- public FishingOperation toBean() {
- FishingOperation result = new FishingOperation();
- BinderFactory.newBinder(MacroDechetTabUIModel.class,
- FishingOperation.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MacroDechetTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<SpeciesBatch> data;
-
- protected final TableColumnModel columnModel;
-
- public MacroDechetTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<SpeciesBatch> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new SpeciesBatch());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,116 @@
+package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * Define a benthos batch row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroWasteBatchRowModel extends AbstractTuttiBeanUIModel<MacroWasteBatch, MacroWasteBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_SPECIES = "species";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected Species species;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ protected static final Binder<MacroWasteBatch, MacroWasteBatchRowModel> fromBeanBinder =
+ BinderFactory.newBinder(MacroWasteBatch.class,
+ MacroWasteBatchRowModel.class);
+
+ protected static final Binder<MacroWasteBatchRowModel, MacroWasteBatch> toBeanBinder =
+ BinderFactory.newBinder(MacroWasteBatchRowModel.class,
+ MacroWasteBatch.class);
+
+ public MacroWasteBatchRowModel() {
+ super(MacroWasteBatch.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public MacroWasteBatchRowModel(MacroWasteBatch aBatch) {
+ this();
+ fromBean(aBatch);
+ }
+
+ public Species getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(Species species) {
+ Object oldValue = getSpecies();
+ this.species = species;
+ firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchTableModel.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchTableModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,104 @@
+package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroWasteBatchTableModel extends AbstractTuttiTableModel<MacroWasteBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<MacroWasteBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
+ MacroWasteBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.macrowaste.batch.header.speciesByCode"),
+ n_("tutti.table.macrowaste.batch.header.speciesByCode"));
+
+ public static final ColumnIdentifier<MacroWasteBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
+ MacroWasteBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.macrowaste.batch.header.speciesByGenusCode"),
+ n_("tutti.table.macrowaste.batch.header.speciesByGenusCode"));
+
+ public static final ColumnIdentifier<MacroWasteBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ MacroWasteBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.macrowaste.batch.header.weight"),
+ n_("tutti.table.macrowaste.batch.header.weight"));
+
+ public static final ColumnIdentifier<MacroWasteBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ MacroWasteBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.macrowaste.batch.header.comment"),
+ n_("tutti.table.macrowaste.batch.header.comment"));
+
+ public static final ColumnIdentifier<MacroWasteBatchRowModel> FILE = ColumnIdentifier.newId(
+ null,
+ n_("tutti.table.macrowaste.batch.header.file"),
+ n_("tutti.table.macrowaste.batch.header.file"));
+
+
+ public MacroWasteBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(FILE);
+ }
+
+ @Override
+ protected MacroWasteBatchRowModel createNewRow() {
+ MacroWasteBatchRowModel result = new MacroWasteBatchRowModel();
+
+ // by default empty row is not valid
+ result.setValid(false);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<MacroWasteBatchRowModel> propertyName,
+ MacroWasteBatchRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+
+ if (propertyName == SPECIES_BY_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_GENUS_CODE);
+
+ } else if (propertyName == SPECIES_BY_GENUS_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_CODE);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,49 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#totalWeightLabel {
+ text: "tutti.label.macroWaste.totalWeight";
+ labelFor: {totalWeightField};
+}
+
+#totalWeightField {
+ property: "totalWeight";
+ model: {model.getTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,90 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroWasteBatchUIModel, MacroWasteBatchUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXTable
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public MacroWasteBatchUI(FishingOperationsUI parentUI) {
+ MacroWasteBatchUIHandler handler = new MacroWasteBatchUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <MacroWasteBatchUIHandler id='handler'
+ initializer='getContextValue(MacroWasteBatchUIHandler.class)'/>
+
+ <MacroWasteBatchUIModel id='model'
+ initializer='getContextValue(MacroWasteBatchUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,467 @@
+package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.MacroWasteBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroWasteBatchUIHandler extends AbstractTuttiTableUIHandler<MacroWasteBatchRowModel, MacroWasteBatchUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(MacroWasteBatchUIHandler.class);
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
+ private final MacroWasteBatchUI ui;
+
+ /**
+ * Persistence service.
+ *
+ * @since 0.2
+ */
+ private final PersistenceService persistenceService;
+
+ /**
+ * To monitor changes on the fishing operation.
+ *
+ * @since 0.2
+ */
+ private final TuttiBeanMonitor<MacroWasteBatchUIModel> fishingOperationMonitor;
+
+
+ public MacroWasteBatchUIHandler(FishingOperationsUI parentUi, MacroWasteBatchUI ui) {
+ super(parentUi.getHandler().getContext(),
+ MacroWasteBatchRowModel.PROPERTY_SPECIES,
+ MacroWasteBatchRowModel.PROPERTY_WEIGHT,
+ MacroWasteBatchRowModel.PROPERTY_COMMENT);
+ this.ui = ui;
+ this.persistenceService = context.getService(PersistenceService.class);
+ this.fishingOperationMonitor = new TuttiBeanMonitor<MacroWasteBatchUIModel>(
+ MacroWasteBatchUIModel.PROPERTY_TOTAL_WEIGHT
+ );
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected MacroWasteBatchUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected MacroWasteBatchTableModel getTableModel() {
+ return (MacroWasteBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ {
+ // Species (by code) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ MacroWasteBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ {
+ // Species (by genusCode) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ MacroWasteBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ MacroWasteBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ MacroWasteBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ MacroWasteBatchTableModel.FILE);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(MacroWasteBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ boolean wasValid = row.isValid();
+
+ boolean valid = isRowValid(row);
+
+ if (log.isInfoEnabled()) {
+ log.info("Was valid / Is valid: " + wasValid + " / " + valid);
+ }
+ row.setValid(valid);
+ }
+
+ @Override
+ protected void onRowValidStateChanged(MacroWasteBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ int rowIndex = getTableModel().getRowIndex(row);
+
+ if (rowIndex > -1) {
+ getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(MacroWasteBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ @Override
+ protected void onModelRowsChanged(List<MacroWasteBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // set valid flag
+ for (MacroWasteBatchRowModel row : rows) {
+ boolean valid = isRowValid(row);
+ row.setValid(valid);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
+ MacroWasteBatchUIModel model = new MacroWasteBatchUIModel();
+ ui.setContextValue(model);
+
+ fishingOperationMonitor.setBean(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ MacroWasteBatchTableModel tableModel =
+ new MacroWasteBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+ installTableKeyListener(columnModel, table);
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+
+ Highlighter readOnlyHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY);
+
+ table.addHighlighter(readOnlyHighlighter);
+ Highlighter validHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ new HighlightPredicate.AndHighlightPredicate(HighlightPredicate.EDITABLE, new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+
+ boolean result = false;
+ if (adapter.isEditable()) {
+ int rowIndex = adapter.convertRowIndexToModel(adapter.row);
+ MacroWasteBatchRowModel row = getTableModel().getEntry(rowIndex);
+ result = !row.isValid();
+ }
+ return result;
+ }
+ }), Color.RED);
+ table.addHighlighter(validHighlighter);
+
+ // when model datas change let's propagate it table model
+ listenRowsFromModel();
+
+ // save when row chaged and was modified
+ ListSelectionListener listener = new TableRowModificationListener<MacroWasteBatchRowModel>(
+ getTableModel(), getRowMonitor()) {
+ @Override
+ protected void saveSelectedRow() {
+ saveSelectedRowIfRequired();
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(listener);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
+ }
+
+ @Override
+ public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ public void saveSelectedRowIfRequired(FocusEvent event) {
+
+ Component oppositeComponent = event.getOppositeComponent();
+
+ JXTable parentContainer = null;
+
+ if (oppositeComponent != null) {
+
+ // check out if still on table
+ parentContainer = SwingUtil.getParentContainer(
+ oppositeComponent, JXTable.class);
+ }
+
+ if (parentContainer == null) {
+
+ // out of the table can save
+ if (getModel().getFishingOperation() != null) {
+ saveSelectedRowIfRequired();
+ }
+ }
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ if (fishingOperationMonitor.wasModified()) {
+
+ // previous fishingOperation was modified, let's save it
+ MacroWasteBatchUIModel beanToSave = fishingOperationMonitor.getBean();
+
+ FishingOperation fishingOperation = beanToSave.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("FishingOperation " + fishingOperation.getId() +
+ " was modified, will save it.");
+ }
+
+ persistenceService.saveFishingOperation(fishingOperation);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ MacroWasteBatchUIModel model = getModel();
+
+ List<MacroWasteBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ bean = new FishingOperation();
+ model.setFishingOperation(null);
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " + bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<MacroWasteBatch> catches =
+ persistenceService.getAllMacroWasteBatch(bean.getId());
+ for (MacroWasteBatch aBatch : catches) {
+ MacroWasteBatchRowModel entry =
+ new MacroWasteBatchRowModel(aBatch);
+ rows.add(entry);
+ }
+ }
+ model.setFishingOperation(bean);
+ }
+
+ model.fromBean(bean);
+ model.setRows(rows);
+
+ fishingOperationMonitor.clearModified();
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected boolean isRowValid(MacroWasteBatchRowModel row) {
+ boolean result = row.getSpecies() != null && row.getWeight() != null;
+ return result;
+ }
+
+ protected void saveSelectedRowIfRequired() {
+
+ TuttiBeanMonitor<MacroWasteBatchRowModel> rowMonitor = getRowMonitor();
+
+ MacroWasteBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null) {
+
+ if (bean.isValid()) {
+ // there is a valid bean attached to the monitor
+
+ if (rowMonitor.wasModified()) {
+
+ // monitored bean was modified, save it
+ if (log.isInfoEnabled()) {
+ log.info("Row " + bean + " was modified, will save it");
+ }
+
+ saveRow(bean);
+
+ // clear modified flag on the monitor
+ rowMonitor.clearModified();
+ }
+ } else {
+
+ // row is not valid can not save it
+
+ MacroWasteBatch catchBean = bean.toBean();
+
+ if (!TuttiEntities.isNew(catchBean)) {
+
+ // remove this
+ persistenceService.deleteMacroWasteBatch(catchBean.getId());
+ }
+ }
+ }
+ }
+
+ protected void saveRow(MacroWasteBatchRowModel row) {
+
+ MacroWasteBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createMacroWasteBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveMacroWasteBatch(catchBean);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,94 @@
+package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroWasteBatchUIModel extends AbstractTuttiTableUIModel<FishingOperation, MacroWasteBatchRowModel, MacroWasteBatchUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ /**
+ * Editing fishing operation.
+ *
+ * @since 0.2
+ */
+ protected FishingOperation fishingOperation;
+
+ /**
+ * Total Weight filled in screen.
+ *
+ * @since 0.2
+ */
+ protected Float totalWeight;
+
+
+ protected static final Binder<FishingOperation, MacroWasteBatchUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, MacroWasteBatchUIModel.class)
+ .addProperty(FishingOperation.PROPERTY_MACRO_WASTE_TOTAL_WEIGHT, PROPERTY_TOTAL_WEIGHT)
+ .addProperty(FishingOperation.PROPERTY_ID, PROPERTY_ID)
+ .toBinder();
+
+ protected static final Binder<MacroWasteBatchUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(MacroWasteBatchUIModel.class, FishingOperation.class)
+ .addProperty(PROPERTY_TOTAL_WEIGHT, FishingOperation.PROPERTY_MACRO_WASTE_TOTAL_WEIGHT)
+ .toBinder();
+
+
+ public MacroWasteBatchUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public FishingOperation getFishingOperation() {
+ return fishingOperation;
+ }
+
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ }
+
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ @Override
+ protected FishingOperation newEntity() {
+ return fishingOperation;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroWasteBatchUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#totalWeightLabel {
- text:"tutti.label.plancton.totalWeight";
- labelFor:{totalWeightField};
-}
-
-#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#sampleTotalWeightLabel {
- text:"tutti.label.plancton.sampleTotalWeight";
- labelFor:{totalWeightField};
-}
-
-#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,98 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanctonTabUIModel, PlanctonTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
- fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.table.TableModel
- javax.swing.table.TableColumnModel
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public PlanctonTabUI(FishingOperationsUI parentUI) {
- PlanctonTabUIHandler handler = new PlanctonTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <PlanctonTabUIHandler id='handler'
- initializer='getContextValue(PlanctonTabUIHandler.class)'/>
-
- <PlanctonTabUIModel id='model'
- initializer='getContextValue(PlanctonTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
- </BeanValidator>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids total échantillonné -->
- <row>
- <cell>
- <JLabel id='sampleTotalWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JTable id='table'/>
- </JScrollPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,182 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.plankton;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanctonTabUIHandler extends AbstractTuttiUIHandler<PlanctonTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(PlanctonTabUIHandler.class);
-
- private final PlanctonTabUI ui;
-
- private final FishingOperationsUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public PlanctonTabUIHandler(FishingOperationsUI parentUi, PlanctonTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- PlanctonTabUIModel model = new PlanctonTabUIModel();
- ui.setContextValue(model);
-
- JTable tb = new JTable();
-
- TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
- TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
-
- // prepare the table column model
- TableColumnModel columnModel = new DefaultTableColumnModel();
-
- TableColumn col;
-
- // species (by code) column
-
- col = new TableColumn(0);
-
- JComboBox speciesEditor = new JComboBox();
- List<Species> allSpecies = persistenceService.getAllSpecies();
- SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
-// col.setCellEditor();
-// col.setCellRenderer(newTableCellRender(Species.class));
- col.setHeaderValue(_("tutti.table.plancton.header.speciesByCode"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("speciesByCode");
- columnModel.addColumn(col);
-
- // Poids observé
- col = new TableColumn(1);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.plancton.header.weight"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("weight");
- columnModel.addColumn(col);
-
- // Nombre observé
- col = new TableColumn(2);
- col.setCellEditor(defaultEditor);
- col.setCellRenderer(defaultRenderer);
- col.setHeaderValue(_("tutti.table.plancton.header.number"));
-// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
- col.setIdentifier("computedNumber");
- columnModel.addColumn(col);
-
- ui.setContextValue(columnModel);
-
- final PlanctonTableModel tableModel = new PlanctonTableModel(columnModel);
- ui.setContextValue(tableModel);
-
- model.addPropertyChangeListener(PlanctonTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
- }
- });
-
- }
-
- @Override
- public void afterInitUI() {
- PlanctonTabUIModel model = ui.getModel();
-
- initUI(ui);
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected PlanctonTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectFishingOperation(FishingOperation bean) {
-
- boolean empty = bean == null;
-
- PlanctonTabUIModel model = ui.getModel();
-
- List<PlanctonBatch> catches;
-
- if (empty) {
- catches = null;
- bean = new FishingOperation();
- } else {
- catches = persistenceService.getAllPlanctonBatch(bean.getId());
- }
-
- model.fromBean(bean);
- model.setCatches(catches);
- }
-
- public void cancel() {
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition");
- }
- }
-
- public void save() {
- if (log.isInfoEnabled()) {
- log.info("Will save");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.plankton;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
-import org.jdesktop.beans.AbstractSerializableBean;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanctonTabUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
-
- public static final String PROPERTY_CATCHES = "catches";
-
- protected Float totalWeight;
-
- protected Float sampleTotalWeight;
-
- protected List<PlanctonBatch> catches;
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getSampleTotalWeight() {
- return sampleTotalWeight;
- }
-
- public void setSampleTotalWeight(Float sampleTotalWeight) {
- Object oldValue = getSampleTotalWeight();
- this.sampleTotalWeight = sampleTotalWeight;
- firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
- }
-
- public List<PlanctonBatch> getCatches() {
- return catches;
- }
-
- public void setCatches(List<PlanctonBatch> catches) {
- Object oldValue = getCatches();
- this.catches = catches;
- firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
- }
-
- public void fromBean(FishingOperation bean) {
- BinderFactory.newBinder(FishingOperation.class,
- PlanctonTabUIModel.class).copy(bean, this);
- }
-
- public FishingOperation toBean() {
- FishingOperation result = new FishingOperation();
- BinderFactory.newBinder(PlanctonTabUIModel.class,
- FishingOperation.class).copy(this, result);
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.plankton;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class PlanctonTableModel extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- protected List<SpeciesBatch> data;
-
- protected final TableColumnModel columnModel;
-
- public PlanctonTableModel(TableColumnModel columnModel) {
- this.columnModel = columnModel;
- }
-
- public void setData(List<SpeciesBatch> data) {
- if (data == null) {
- data = Lists.newArrayList();
- data.add(new SpeciesBatch());
- }
- this.data = data;
- fireTableDataChanged();
- }
-
- @Override
- public int getRowCount() {
- return data == null ? 0 : data.size();
- }
-
- @Override
- public int getColumnCount() {
- return columnModel.getColumnCount();
- }
-
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- return null;
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return true;
- }
-}
\ No newline at end of file
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchRowModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,173 @@
+package fr.ifremer.tutti.ui.swing.content.operation.plankton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.PlanktonBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * Define a benthos batch row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanktonBatchRowModel extends AbstractTuttiBeanUIModel<PlanktonBatch, PlanktonBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_SPECIES = "species";
+
+ public static final String PROPERTY_SPECIES_TO_CONFIRM = "speciesToConfirm";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
+
+ public static final String PROPERTY_SAMPLING_RATIO = "samplingRatio";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected Species species;
+
+ /**
+ * Is the species need to be confirmed?.
+ *
+ * @since 0.2
+ */
+ protected boolean speciesToConfirm;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Sampling ratio.
+ *
+ * @since 0.2
+ */
+ protected Float samplingRatio;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ protected static final Binder<PlanktonBatch, PlanktonBatchRowModel> fromBeanBinder =
+ BinderFactory.newBinder(PlanktonBatch.class,
+ PlanktonBatchRowModel.class);
+
+ protected static final Binder<PlanktonBatchRowModel, PlanktonBatch> toBeanBinder =
+ BinderFactory.newBinder(PlanktonBatchRowModel.class,
+ PlanktonBatch.class);
+
+ public PlanktonBatchRowModel() {
+ super(PlanktonBatch.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public PlanktonBatchRowModel(PlanktonBatch aBatch) {
+ this();
+ fromBean(aBatch);
+ }
+
+ public Species getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(Species species) {
+ Object oldValue = getSpecies();
+ this.species = species;
+ firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ }
+
+ public Boolean getSpeciesToConfirm() {
+ return speciesToConfirm;
+ }
+
+ public void setSpeciesToConfirm(Boolean speciesToConfirm) {
+ Object oldValue = getSpeciesToConfirm();
+ this.speciesToConfirm = speciesToConfirm;
+ firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ Object oldValue = getSampleWeight();
+ this.sampleWeight = sampleWeight;
+ firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
+ }
+
+ public Float getSamplingRatio() {
+ return samplingRatio;
+ }
+
+ public void setSamplingRatio(Float samplingRatio) {
+ Object oldValue = getSamplingRatio();
+ this.samplingRatio = samplingRatio;
+ firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchTableModel.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchTableModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,124 @@
+package fr.ifremer.tutti.ui.swing.content.operation.plankton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanktonBatchTableModel extends AbstractTuttiTableModel<PlanktonBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ n_("tutti.table.plankton.batch.header.toConfirm"),
+ n_("tutti.table.plankton.batch.header.toConfirm"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.plankton.batch.header.speciesByCode"),
+ n_("tutti.table.plankton.batch.header.speciesByCode"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.plankton.batch.header.speciesByGenusCode"),
+ n_("tutti.table.plankton.batch.header.speciesByGenusCode"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.plankton.batch.header.weight"),
+ n_("tutti.table.plankton.batch.header.weight"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ n_("tutti.table.plankton.batch.header.sampleWeight"),
+ n_("tutti.table.plankton.batch.header.sampleWeight"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> SAMPLING_RATIO = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ n_("tutti.table.plankton.batch.header.elevationRate"),
+ n_("tutti.table.plankton.batch.header.elevationRate"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ PlanktonBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.plankton.batch.header.comment"),
+ n_("tutti.table.plankton.batch.header.comment"));
+
+ public static final ColumnIdentifier<PlanktonBatchRowModel> FILE = ColumnIdentifier.newId(
+ null,
+ n_("tutti.table.plankton.batch.header.file"),
+ n_("tutti.table.plankton.batch.header.file"));
+
+
+ public PlanktonBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ setNoneEditableCols(
+ SAMPLE_WEIGHT,
+ SAMPLING_RATIO,
+ FILE
+ );
+ }
+
+ @Override
+ protected PlanktonBatchRowModel createNewRow() {
+ PlanktonBatchRowModel result = new PlanktonBatchRowModel();
+
+ // by default empty row is not valid
+ result.setValid(false);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<PlanktonBatchRowModel> propertyName,
+ PlanktonBatchRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+
+ if (propertyName == SPECIES_BY_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_GENUS_CODE);
+
+ } else if (propertyName == SPECIES_BY_GENUS_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_CODE);
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,61 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#totalWeightLabel {
+ text: "tutti.label.plankton.totalWeight";
+ labelFor: {totalWeightField};
+}
+
+#totalWeightField {
+ property: "totalWeight";
+ model: {model.getTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text: "tutti.label.plankton.sampleTotalWeight";
+ labelFor: {totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property: "sampleTotalWeight";
+ model: {model.getSampleTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,101 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanktonBatchUIModel, PlanktonBatchUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXTable
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public PlanktonBatchUI(FishingOperationsUI parentUI) {
+ PlanktonBatchUIHandler handler = new PlanktonBatchUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <PlanktonBatchUIHandler id='handler'
+ initializer='getContextValue(PlanktonBatchUIHandler.class)'/>
+
+ <PlanktonBatchUIModel id='model'
+ initializer='getContextValue(PlanktonBatchUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,496 @@
+package fr.ifremer.tutti.ui.swing.content.operation.plankton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanktonBatchUIHandler extends AbstractTuttiTableUIHandler<PlanktonBatchRowModel, PlanktonBatchUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(PlanktonBatchUIHandler.class);
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
+ private final PlanktonBatchUI ui;
+
+ /**
+ * Persistence service.
+ *
+ * @since 0.2
+ */
+ private final PersistenceService persistenceService;
+
+ /**
+ * To monitor changes on the fishing operation.
+ *
+ * @since 0.2
+ */
+ private final TuttiBeanMonitor<PlanktonBatchUIModel> fishingOperationMonitor;
+
+ public PlanktonBatchUIHandler(FishingOperationsUI parentUi, PlanktonBatchUI ui) {
+ super(parentUi.getHandler().getContext(),
+ PlanktonBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ PlanktonBatchRowModel.PROPERTY_SPECIES,
+ PlanktonBatchRowModel.PROPERTY_WEIGHT,
+ PlanktonBatchRowModel.PROPERTY_COMMENT);
+ this.ui = ui;
+ this.persistenceService = context.getService(PersistenceService.class);
+ this.fishingOperationMonitor = new TuttiBeanMonitor<PlanktonBatchUIModel>(
+ PlanktonBatchUIModel.PROPERTY_TOTAL_WEIGHT,
+ PlanktonBatchUIModel.PROPERTY_SAMPLE_TOTAL_WEIGHT
+ );
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected PlanktonBatchUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected PlanktonBatchTableModel getTableModel() {
+ return (PlanktonBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected String[] getRowPropertiesToIgnore() {
+ return new String[]{
+ PlanktonBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ PlanktonBatchRowModel.PROPERTY_SAMPLING_RATIO
+ };
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ {
+ // Species to confirm column
+
+ addBooleanColumnToModel(columnModel,
+ PlanktonBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ {
+ // Species (by code) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ PlanktonBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ {
+ // Species (by genusCode) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ PlanktonBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ PlanktonBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Sample weight column
+
+ addColumnToModel(columnModel,
+ PlanktonBatchTableModel.SAMPLE_WEIGHT);
+ }
+
+ { // SamplingRatio column
+
+ addColumnToModel(columnModel,
+ PlanktonBatchTableModel.SAMPLING_RATIO);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ PlanktonBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ PlanktonBatchTableModel.FILE);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(PlanktonBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ boolean wasValid = row.isValid();
+
+ boolean valid = isRowValid(row);
+
+ if (log.isInfoEnabled()) {
+ log.info("Was valid / Is valid: " + wasValid + " / " + valid);
+ }
+ row.setValid(valid);
+ }
+
+ @Override
+ protected void onRowValidStateChanged(PlanktonBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ int rowIndex = getTableModel().getRowIndex(row);
+
+ if (rowIndex > -1) {
+ getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(PlanktonBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ @Override
+ protected void onModelRowsChanged(List<PlanktonBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // set valid flag
+ for (PlanktonBatchRowModel row : rows) {
+ boolean valid = isRowValid(row);
+ row.setValid(valid);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
+ PlanktonBatchUIModel model = new PlanktonBatchUIModel();
+ ui.setContextValue(model);
+
+ fishingOperationMonitor.setBean(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ PlanktonBatchTableModel tableModel =
+ new PlanktonBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+ installTableKeyListener(columnModel, table);
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+
+ Highlighter readOnlyHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY);
+
+ table.addHighlighter(readOnlyHighlighter);
+ Highlighter validHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ new HighlightPredicate.AndHighlightPredicate(HighlightPredicate.EDITABLE, new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+
+ boolean result = false;
+ if (adapter.isEditable()) {
+ int rowIndex = adapter.convertRowIndexToModel(adapter.row);
+ PlanktonBatchRowModel row = getTableModel().getEntry(rowIndex);
+ result = !row.isValid();
+ }
+ return result;
+ }
+ }), Color.RED);
+ table.addHighlighter(validHighlighter);
+
+ // when model datas change let's propagate it table model
+ listenRowsFromModel();
+
+ // save when row chaged and was modified
+ ListSelectionListener listener = new TableRowModificationListener<PlanktonBatchRowModel>(
+ getTableModel(), getRowMonitor()) {
+ @Override
+ protected void saveSelectedRow() {
+ saveSelectedRowIfRequired();
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(listener);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
+ }
+
+ @Override
+ public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ public void saveSelectedRowIfRequired(FocusEvent event) {
+
+ Component oppositeComponent = event.getOppositeComponent();
+
+ JXTable parentContainer = null;
+
+ if (oppositeComponent != null) {
+
+ // check out if still on table
+ parentContainer = SwingUtil.getParentContainer(
+ oppositeComponent, JXTable.class);
+ }
+
+ if (parentContainer == null) {
+
+ // out of the table can save
+ if (getModel().getFishingOperation() != null) {
+ saveSelectedRowIfRequired();
+ }
+ }
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ if (fishingOperationMonitor.wasModified()) {
+
+ // previous fishingOperation was modified, let's save it
+ PlanktonBatchUIModel beanToSave = fishingOperationMonitor.getBean();
+
+ FishingOperation fishingOperation = beanToSave.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("FishingOperation " + fishingOperation.getId() +
+ " was modified, will save it.");
+ }
+
+ persistenceService.saveFishingOperation(fishingOperation);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ PlanktonBatchUIModel model = getModel();
+
+ List<PlanktonBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ bean = new FishingOperation();
+ model.setFishingOperation(null);
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " + bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<PlanktonBatch> catches =
+ persistenceService.getAllPlanktonBatch(bean.getId());
+ for (PlanktonBatch aBatch : catches) {
+ PlanktonBatchRowModel entry =
+ new PlanktonBatchRowModel(aBatch);
+ rows.add(entry);
+ }
+ }
+ model.setFishingOperation(bean);
+ }
+
+ model.fromBean(bean);
+ model.setRows(rows);
+
+ fishingOperationMonitor.clearModified();
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected boolean isRowValid(PlanktonBatchRowModel row) {
+ boolean result = row.getSpecies() != null && row.getWeight() != null;
+ return result;
+ }
+
+ protected void saveSelectedRowIfRequired() {
+
+ TuttiBeanMonitor<PlanktonBatchRowModel> rowMonitor = getRowMonitor();
+
+ PlanktonBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null) {
+
+ if (bean.isValid()) {
+ // there is a valid bean attached to the monitor
+
+ if (rowMonitor.wasModified()) {
+
+ // monitored bean was modified, save it
+ if (log.isInfoEnabled()) {
+ log.info("Row " + bean + " was modified, will save it");
+ }
+
+ saveRow(bean);
+
+ // clear modified flag on the monitor
+ rowMonitor.clearModified();
+ }
+ } else {
+
+ // row is not valid can not save it
+
+ PlanktonBatch catchBean = bean.toBean();
+
+ if (!TuttiEntities.isNew(catchBean)) {
+
+ // remove this
+ persistenceService.deletePlanktonBatch(catchBean.getId());
+ }
+ }
+ }
+ }
+
+ protected void saveRow(PlanktonBatchRowModel row) {
+
+ PlanktonBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createPlanktonBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.savePlanktonBatch(catchBean);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,113 @@
+package fr.ifremer.tutti.ui.swing.content.operation.plankton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanktonBatchUIModel extends AbstractTuttiTableUIModel<FishingOperation, PlanktonBatchRowModel, PlanktonBatchUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ /**
+ * Editing fishing operation.
+ *
+ * @since 0.2
+ */
+ protected FishingOperation fishingOperation;
+
+ /**
+ * Total Weight filled in screen.
+ *
+ * @since 0.2
+ */
+ protected Float totalWeight;
+
+ /**
+ * Total Sample Weight filled in screen.
+ *
+ * @since 0.2
+ */
+ protected Float sampleTotalWeight;
+
+ protected static final Binder<FishingOperation, PlanktonBatchUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, PlanktonBatchUIModel.class)
+ .addProperty(FishingOperation.PROPERTY_PLANKTON_TOTAL_WEIGHT, PROPERTY_TOTAL_WEIGHT)
+ .addProperty(FishingOperation.PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT, PROPERTY_SAMPLE_TOTAL_WEIGHT)
+ .addProperty(FishingOperation.PROPERTY_ID, PROPERTY_ID)
+ .toBinder();
+
+ protected static final Binder<PlanktonBatchUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(PlanktonBatchUIModel.class, FishingOperation.class)
+ .addProperty(PROPERTY_TOTAL_WEIGHT, FishingOperation.PROPERTY_PLANKTON_TOTAL_WEIGHT)
+ .addProperty(PROPERTY_SAMPLE_TOTAL_WEIGHT, FishingOperation.PROPERTY_PLANKTON_SAMPLE_TOTAL_WEIGHT)
+ .toBinder();
+
+
+ public PlanktonBatchUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public FishingOperation getFishingOperation() {
+ return fishingOperation;
+ }
+
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ }
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ @Override
+ protected FishingOperation newEntity() {
+ return fishingOperation;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanktonBatchUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -155,7 +155,7 @@
protected Float sampleWeight;
/**
- * Elevation ratio.
+ * Sampling ratio.
*
* @since 0.2
*/
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,83 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#totalWeightLabel {
+ text: "tutti.label.species.totalWeight";
+ labelFor: {totalWeightField};
+}
+
+#totalWeightField {
+ property: "totalWeight";
+ model: {model.getTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#totalVracWeightLabel {
+ text: "tutti.label.species.totalVracWeight";
+ labelFor: {totalVracWeightField};
+}
+
+#totalVracWeightField {
+ property: "totalVracWeight";
+ model: {model.getTotalVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#sampleVracWeightLabel {
+ text: "tutti.label.species.sampleVracWeight";
+ labelFor: {sampleVracWeightField};
+}
+
+#sampleVracWeightField {
+ property: "sampleVracWeight";
+ model: {model.getSampleVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#totalHorsVracWeightLabel {
+ text: "tutti.label.species.totalHorsVracWeight";
+ labelFor: {totalHorsVracWeightField};
+}
+
+#totalHorsVracWeightField {
+ text: {getStringValue(model.getTotalHorsVracWeight())};
+ editable: false;
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,119 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesBatchUIModel, SpeciesBatchUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesFrequencyUI
+
+ org.jdesktop.swingx.JXTable
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+public SpeciesBatchUI(FishingOperationsUI parentUI) {
+ SpeciesBatchUIHandler handler = new SpeciesBatchUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <SpeciesBatchUIHandler id='handler'
+ initializer='getContextValue(SpeciesBatchUIHandler.class)'/>
+
+ <SpeciesBatchUIModel id='model'
+ initializer='getContextValue(SpeciesBatchUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='totalVracWeight' component='totalVracWeightField'/>
+ <field name='sampleVracWeight' component='sampleVracWeightField'/>
+ <field name='totalHorsVracWeight' component='totalHorsVracWeightField'/>
+ </BeanValidator>
+
+ <SpeciesFrequencyUI id='frequencyUI' constructorParams='handler.getContext()'/>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='totalVracWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalVracWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='sampleVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleVracWeightField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='totalHorsVracWeightLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='totalHorsVracWeightField'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java (from rev 54, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,756 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
+import fr.ifremer.tutti.persistence.entities.referential.Sex;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesBatchUIHandler extends AbstractTuttiTableUIHandler<SpeciesBatchRowModel, SpeciesBatchUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(SpeciesBatchUIHandler.class);
+
+ public static final Set<String> RECOMPUTE_TOTAL_WEIGHT = Sets.newHashSet(
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT
+ );
+
+ public static final Set<String> SAMPLING_PROPERTIES = Sets.newHashSet(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX,
+ SpeciesBatchRowModel.PROPERTY_MATURITY,
+ SpeciesBatchRowModel.PROPERTY_AGE
+ );
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
+ private final SpeciesBatchUI ui;
+
+ /**
+ * Persistence service.
+ *
+ * @since 0.2
+ */
+ private final PersistenceService persistenceService;
+
+ /**
+ * To monitor changes on the fishing operation.
+ *
+ * @since 0.2
+ */
+ private final TuttiBeanMonitor<SpeciesBatchUIModel> fishingOperationMonitor;
+
+ public SpeciesBatchUIHandler(FishingOperationsUI parentUi, SpeciesBatchUI ui) {
+ super(parentUi.getHandler().getContext(),
+ SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX,
+ SpeciesBatchRowModel.PROPERTY_MATURITY,
+ SpeciesBatchRowModel.PROPERTY_AGE,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT,
+ SpeciesBatchRowModel.PROPERTY_COMMENT,
+ SpeciesBatchRowModel.PROPERTY_FREQUENCY);
+ this.ui = ui;
+ this.persistenceService = context.getService(PersistenceService.class);
+ this.fishingOperationMonitor = new TuttiBeanMonitor<SpeciesBatchUIModel>(
+ SpeciesBatchUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
+ SpeciesBatchUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
+ SpeciesBatchUIModel.PROPERTY_TOTAL_VRAC_WEIGHT,
+ SpeciesBatchUIModel.PROPERTY_TOTAL_WEIGHT
+ );
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected SpeciesBatchUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected SpeciesBatchTableModel getTableModel() {
+ return (SpeciesBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected void onModelRowsChanged(List<SpeciesBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // build the new sampling tree from the new rows to edit
+ getModel().getSamplingTreeModel().populate(rows);
+ }
+
+ @Override
+ protected String[] getRowPropertiesToIgnore() {
+ return new String[]{
+ SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ SpeciesBatchRowModel.PROPERTY_FREQUENCY
+ };
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ List<String> samplingOrder = getModel().getSamplingOrder();
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ {
+ // Species to confirm column
+
+ addBooleanColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ {
+ // Species (by code) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ {
+ // Species (by genusCode) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC)) {
+
+ // Vrac / Hors vrac column
+
+ addComboEnumColumnToModel(columnModel,
+ SpeciesBatchTableModel.VRAC_HORS_VRAC,
+ VracHorsVracEnum.values());
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY)) {
+
+ // WeightCategory column
+
+ Decorator<WeightCategory> decorator =
+ getDecorator(WeightCategory.class,
+ DecoratorService.BY_NAME);
+
+ List<WeightCategory> data =
+ persistenceService.getAllWeightCategory();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.WEIGHT_CATEGORY,
+ decorator, data);
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_SEX)) {
+
+ // Sex column
+
+ Decorator<Sex> decorator =
+ getDecorator(Sex.class, DecoratorService.BY_NAME);
+
+ List<Sex> data = persistenceService.getAllSex();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SEX,
+ decorator, data);
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_MATURITY)) {
+
+ // Maturity column
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.MATURITY,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_AGE)) {
+
+ // Age column
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.AGE,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Computed weight column (from frequencies)
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_WEIGHT);
+ }
+
+ { // Computed number column (from frequencies)
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_NUMBER);
+ }
+
+ { // Sample weight column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.SAMPLE_WEIGHT);
+ }
+
+ { // SamplingRatio column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.SAMPLING_RATIO);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.FILE);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(SpeciesBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ if (RECOMPUTE_TOTAL_WEIGHT.contains(propertyName)) {
+
+ // Need to recompute totalHorsVracWeight
+ recomputeTotalHorsVrac();
+ }
+
+ SpeciesBatchUIModel model = getModel();
+
+ SpeciesBatchTreeModel samplingTreeModel = model.getSamplingTreeModel();
+
+ if (SAMPLING_PROPERTIES.contains(propertyName)) {
+
+ // Need to rebuilt this row sampling tree path (and then recompute
+ // old super - samplingRatio and new super - samplingRatio)
+
+ // old node of the previous sampling def for this row
+ // and remove it from any cache
+ SpeciesBatchTreeNode oldNode = samplingTreeModel.removeNodeFromCache(row);
+
+ boolean rowWasValid = row.isValid();
+ if (oldNode != null && rowWasValid) {
+
+ // remove this row from his super sampling
+ recomputeSuperSamplingRatio(samplingTreeModel, oldNode);
+ }
+
+ // get new sampling node
+ SpeciesBatchTreeNode newNode = samplingTreeModel.getSamplingNode(row);
+
+ // check this row is valid
+ boolean rowValid = samplingTreeModel.isValid(row, newNode);
+
+ // push this state back to the row
+ row.setValid(rowValid);
+
+ if (rowValid) {
+
+ // can add it to his super-sampling
+ recomputeSuperSamplingRatio(samplingTreeModel, newNode);
+ } else {
+
+ if (rowWasValid) {
+
+ row.setSampleWeight(null);
+ row.setSamplingRatio(null);
+
+ getTableModel().updateSamplingRatio(Sets.newHashSet(row));
+ }
+ }
+ }
+
+ if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName)) {
+
+ // Need to recompute the super - samplingRatio
+
+ SpeciesBatchTreeNode node = samplingTreeModel.getSamplingNode(row);
+
+ boolean rowWasValid = row.isValid();
+
+ // check this row is valid
+ boolean rowValid = samplingTreeModel.isValid(row, node);
+
+ // push this state back to the row
+ row.setValid(rowValid);
+
+ if (rowValid) {
+ recomputeSuperSamplingRatio(samplingTreeModel, node);
+ } else {
+ if (rowWasValid) {
+
+ // must remove this row from his super-sampling
+ recomputeSuperSamplingRatio(samplingTreeModel, node);
+
+ row.setSampleWeight(null);
+ row.setSamplingRatio(null);
+
+ getTableModel().updateSamplingRatio(Sets.newHashSet(row));
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void onRowValidStateChanged(SpeciesBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ int rowIndex = getTableModel().getRowIndex(row);
+
+ if (rowIndex > -1) {
+ getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(SpeciesBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
+ SpeciesBatchUIModel model = new SpeciesBatchUIModel();
+ ui.setContextValue(model);
+
+ fishingOperationMonitor.setBean(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
+ initUI(ui);
+
+ //TODO Will come from protocol
+ List<String> samplingOrder = Lists.newArrayList(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX
+ );
+
+ getModel().setSamplingOrder(samplingOrder);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ SpeciesBatchTableModel tableModel =
+ new SpeciesBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+ installTableKeyListener(columnModel, table);
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+
+ Highlighter readOnlyHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY);
+
+ table.addHighlighter(readOnlyHighlighter);
+ Highlighter validHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ new HighlightPredicate.AndHighlightPredicate(HighlightPredicate.EDITABLE, new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+
+ boolean result = false;
+ if (adapter.isEditable()) {
+ int rowIndex = adapter.convertRowIndexToModel(adapter.row);
+ SpeciesBatchRowModel row = getTableModel().getEntry(rowIndex);
+ result = !row.isValid();
+ }
+ return result;
+ }
+ }), Color.RED);
+ table.addHighlighter(validHighlighter);
+
+ // when model datas change let's propagate it table model
+ listenRowsFromModel();
+
+ // save when row chaged and was modified
+ ListSelectionListener listener = new TableRowModificationListener<SpeciesBatchRowModel>(
+ getTableModel(), getRowMonitor()) {
+ @Override
+ protected void saveSelectedRow() {
+ saveSelectedRowIfRequired();
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(listener);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
+ }
+
+ @Override
+ public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ public void saveSelectedRowIfRequired(FocusEvent event) {
+
+ Component oppositeComponent = event.getOppositeComponent();
+
+ JXTable parentContainer = null;
+
+ if (oppositeComponent != null) {
+
+ // check out if still on table
+ parentContainer = SwingUtil.getParentContainer(
+ oppositeComponent, JXTable.class);
+ }
+
+ if (parentContainer == null) {
+
+ // out of the table can save
+ if (getModel().getFishingOperation() != null) {
+ saveSelectedRowIfRequired();
+ }
+ }
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = ui.getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ if (fishingOperationMonitor.wasModified()) {
+
+ // previous fishingOperation was modified, let's save it
+ SpeciesBatchUIModel beanToSave = fishingOperationMonitor.getBean();
+
+ FishingOperation fishingOperation = beanToSave.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("FishingOperation " + fishingOperation.getId() +
+ " was modified, will save it.");
+ }
+
+ persistenceService.saveFishingOperation(fishingOperation);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ SpeciesBatchUIModel model = getModel();
+
+ List<SpeciesBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ bean = new FishingOperation();
+ model.setFishingOperation(null);
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " + bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<SpeciesBatch> catches =
+ persistenceService.getAllSpeciesBatch(bean.getId());
+ for (SpeciesBatch aBatch : catches) {
+ List<SpeciesBatchFrequency> frequencies =
+ persistenceService.getAllSpeciesBatchFrequency(aBatch.getId());
+ SpeciesBatchRowModel entry =
+ new SpeciesBatchRowModel(aBatch, frequencies);
+ rows.add(entry);
+ }
+ }
+ model.setFishingOperation(bean);
+ }
+
+ model.fromBean(bean);
+ model.setRows(rows);
+
+ fishingOperationMonitor.clearModified();
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected void recomputeSuperSamplingRatio(SpeciesBatchTreeModel samplingTreeModel,
+ SpeciesBatchTreeNode node) {
+
+ SpeciesBatchTreeNode superSamplingNode = node.getParent();
+
+ Preconditions.checkNotNull(superSamplingNode,
+ "Super sampling node can't be null");
+
+ SpeciesBatchTreeModel.SamplingContext samplingContext =
+ samplingTreeModel.createSamplingContext(superSamplingNode);
+
+ float samplingTotalWeight = samplingContext.getTotalWeight();
+ Float superSamplingTotalWeight;
+ SpeciesBatchRowModel superSamplingRow =
+ samplingContext.getSuperSamplingRow();
+ if (superSamplingRow == null) {
+
+ // Use directly the batch total weight (means no super-sampling)
+
+ superSamplingTotalWeight = getModel().getTotalWeight();
+ } else {
+ superSamplingTotalWeight = superSamplingRow.getWeight();
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Super sampling total weight: " +
+ superSamplingTotalWeight);
+ }
+
+ Float samplingRatio = null;
+ if (superSamplingTotalWeight != null) {
+ samplingRatio = samplingTotalWeight / superSamplingTotalWeight;
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Sampling ratio: " + samplingRatio);
+ }
+
+ samplingContext.applyNewSampleValues(samplingTotalWeight,
+ samplingRatio);
+
+ getTableModel().updateSamplingRatio(samplingContext.getSamplingRows());
+ }
+
+
+ protected void recomputeTotalHorsVrac() {
+
+ // recompute total hors vrac
+ Float totalHorsVrac = 0f;
+ Float totalVrac = 0f;
+
+ for (SpeciesBatchRowModel batch : getModel().getRows()) {
+ VracHorsVracEnum vracHorsVrac = batch.getVracHorsVrac();
+ if (vracHorsVrac == null) {
+
+ // can't sum anything
+ } else if (vracHorsVrac == VracHorsVracEnum.HORS_VRAC) {
+ Float weight = batch.getWeight();
+ if (weight != null) {
+ totalHorsVrac += weight;
+ }
+ } else if (vracHorsVrac == VracHorsVracEnum.VRAC) {
+ Float weight = batch.getWeight();
+ if (weight != null) {
+ totalVrac += weight;
+ }
+ }
+ }
+ if (log.isInfoEnabled()) {
+ log.info("New total vrac / hors vrac: " +
+ totalVrac + " / " + totalHorsVrac);
+ }
+ getModel().setTotalHorsVracWeight(totalHorsVrac);
+ //TODO Should we also set the total vrac weight ?
+// getModel().setTotalVracWeight(totalVrac);
+ }
+
+ protected void saveSelectedRowIfRequired() {
+
+ TuttiBeanMonitor<SpeciesBatchRowModel> rowMonitor = getRowMonitor();
+
+ SpeciesBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null) {
+
+ if (bean.isValid()) {
+ // there is a valid bean attached to the monitor
+
+ if (rowMonitor.wasModified()) {
+
+ // monitored bean was modified, save it
+ if (log.isInfoEnabled()) {
+ log.info("Row " + bean + " was modified, will save it");
+ }
+
+ saveRow(bean);
+
+ // clear modified flag on the monitor
+ rowMonitor.clearModified();
+ }
+ } else {
+
+ // row is not valid can not save it
+
+ SpeciesBatch catchBean = bean.toBean();
+
+ if (!TuttiEntities.isNew(catchBean)) {
+
+ // remove this
+ persistenceService.deleteSpeciesBatch(catchBean.getId());
+ }
+ }
+ }
+ }
+
+ protected void saveRow(SpeciesBatchRowModel row) {
+
+ SpeciesBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createSpeciesBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveSpeciesBatch(catchBean);
+ }
+
+ List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
+
+ List<SpeciesBatchFrequency> frequency =
+ SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will save " + frequency.size() + " frequencies.");
+ }
+ frequency = persistenceService.saveSpeciesBatchFrequency(
+ catchBean.getId(), frequency);
+
+ // push it back to row model
+ frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
+ row.setFrequency(frequencyRows);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java (from rev 48, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -0,0 +1,184 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesBatchUIModel extends AbstractTuttiTableUIModel<FishingOperation, SpeciesBatchRowModel, SpeciesBatchUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight";
+
+ public static final String PROPERTY_SAMPLE_VRAC_WEIGHT = "sampleVracWeight";
+
+ public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
+
+ /**
+ * Editing fishing operation.
+ *
+ * @since 0.2
+ */
+ protected FishingOperation fishingOperation;
+
+ /**
+ * Total Weight filled in screen.
+ *
+ * @since 0.2
+ */
+ protected Float totalWeight;
+
+ /**
+ * Total vrac Weight filled in screen.
+ *
+ * @since 0.2
+ */
+ protected Float totalVracWeight;
+
+ /**
+ * Total sample vrac Weight filled in screen.
+ *
+ * @since 0.2
+ */
+ protected Float sampleVracWeight;
+
+ /**
+ * Total hors vrac Weight computed by hros vrac rows.
+ *
+ * @since 0.2
+ */
+ protected Float totalHorsVracWeight;
+
+ /**
+ * Sampling order (sets by protocol).
+ *
+ * @since 0.2
+ */
+ protected List<String> samplingOrder;
+
+ /**
+ * Tree of sampling for batch rows.
+ *
+ * @since 0.2
+ */
+ protected final SpeciesBatchTreeModel samplingTreeModel;
+
+ protected static final Binder<FishingOperation, SpeciesBatchUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, SpeciesBatchUIModel.class)
+ .addProperty(FishingOperation.PROPERTY_SPECIES_TOTAL_WEIGHT, PROPERTY_TOTAL_WEIGHT)
+ .addProperty(FishingOperation.PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT, PROPERTY_TOTAL_HORS_VRAC_WEIGHT)
+ .addProperty(FishingOperation.PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT, PROPERTY_TOTAL_VRAC_WEIGHT)
+ .addProperty(FishingOperation.PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT, PROPERTY_SAMPLE_VRAC_WEIGHT)
+ .addProperty(FishingOperation.PROPERTY_ID, PROPERTY_ID)
+ .toBinder();
+
+ protected static final Binder<SpeciesBatchUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesBatchUIModel.class, FishingOperation.class)
+ .addProperty(PROPERTY_TOTAL_WEIGHT, FishingOperation.PROPERTY_SPECIES_TOTAL_WEIGHT)
+ .addProperty(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, FishingOperation.PROPERTY_SPECIES_TOTAL_HORS_VRAC_WEIGHT)
+ .addProperty(PROPERTY_TOTAL_VRAC_WEIGHT, FishingOperation.PROPERTY_SPECIES_TOTAL_VRAC_WEIGHT)
+ .addProperty(PROPERTY_SAMPLE_VRAC_WEIGHT, FishingOperation.PROPERTY_SPECIES_SAMPLE_VRAC_WEIGHT)
+ .toBinder();
+
+ public SpeciesBatchUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ this.samplingTreeModel = new SpeciesBatchTreeModel();
+ }
+
+ public FishingOperation getFishingOperation() {
+ return fishingOperation;
+ }
+
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ }
+
+ public SpeciesBatchTreeModel getSamplingTreeModel() {
+ return samplingTreeModel;
+ }
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getTotalVracWeight() {
+ return totalVracWeight;
+ }
+
+ public void setTotalVracWeight(Float totalVracWeight) {
+ Object oldValue = getTotalVracWeight();
+ this.totalVracWeight = totalVracWeight;
+ firePropertyChange(PROPERTY_TOTAL_VRAC_WEIGHT, oldValue, totalVracWeight);
+ }
+
+ public Float getSampleVracWeight() {
+ return sampleVracWeight;
+ }
+
+ public void setSampleVracWeight(Float sampleVracWeight) {
+ Object oldValue = getSampleVracWeight();
+ this.sampleVracWeight = sampleVracWeight;
+ firePropertyChange(PROPERTY_SAMPLE_VRAC_WEIGHT, oldValue, sampleVracWeight);
+ }
+
+ public Float getTotalHorsVracWeight() {
+ return totalHorsVracWeight;
+ }
+
+ public void setTotalHorsVracWeight(Float totalHorsVracWeight) {
+ Object oldValue = getTotalHorsVracWeight();
+ this.totalHorsVracWeight = totalHorsVracWeight;
+ firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
+ }
+
+ public List<String> getSamplingOrder() {
+ return samplingOrder;
+ }
+
+ public void setSamplingOrder(List<String> samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ samplingTreeModel.setSamplingOrder(samplingOrder.toArray(new String[samplingOrder.size()]));
+ }
+
+ @Override
+ protected FishingOperation newEntity() {
+ return fishingOperation;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,83 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
- bean: {model};
- showReset: true;
-}
-
-#totalWeightLabel {
- text: "tutti.label.species.totalWeight";
- labelFor: {totalWeightField};
-}
-
-#totalWeightField {
- property: "totalWeight";
- model: {model.getTotalWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#totalVracWeightLabel {
- text: "tutti.label.species.totalVracWeight";
- labelFor: {totalVracWeightField};
-}
-
-#totalVracWeightField {
- property: "totalVracWeight";
- model: {model.getTotalVracWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#sampleVracWeightLabel {
- text: "tutti.label.species.sampleVracWeight";
- labelFor: {sampleVracWeightField};
-}
-
-#sampleVracWeightField {
- property: "sampleVracWeight";
- model: {model.getSampleVracWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#totalHorsVracWeightLabel {
- text: "tutti.label.species.totalHorsVracWeight";
- labelFor: {totalHorsVracWeightField};
-}
-
-#totalHorsVracWeightField {
- text: {getStringValue(model.getTotalHorsVracWeight())};
- editable: false;
-}
-
-#table {
- selectionMode: {ListSelectionModel.SINGLE_SELECTION};
- selectionBackground: {null};
- selectionForeground: {Color.BLACK};
- sortable: false;
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,119 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
- fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
- fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesFrequencyUI
-
- org.jdesktop.swingx.JXTable
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.ListSelectionModel
-
- java.awt.Color
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
- </import>
-
- <script><![CDATA[
-
-public SpeciesTabUI(FishingOperationsUI parentUI) {
- SpeciesTabUIHandler handler = new SpeciesTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <SpeciesTabUIHandler id='handler'
- initializer='getContextValue(SpeciesTabUIHandler.class)'/>
-
- <SpeciesTabUIModel id='model'
- initializer='getContextValue(SpeciesTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='totalVracWeight' component='totalVracWeightField'/>
- <field name='sampleVracWeight' component='sampleVracWeightField'/>
- <field name='totalHorsVracWeight' component='totalHorsVracWeightField'/>
- </BeanValidator>
-
- <SpeciesFrequencyUI id='frequencyUI' constructorParams='handler.getContext()'/>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total / Poids total vrac -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- <cell anchor='west'>
- <JLabel id='totalVracWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalVracWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids échantillonné vrac / Poids total hors vrac -->
- <row>
- <cell>
- <JLabel id='sampleVracWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleVracWeightField' constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='totalHorsVracWeightLabel'/>
- </cell>
- <cell>
- <JTextField id='totalHorsVracWeightField'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
- </JScrollPane>
-
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,762 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
-import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.ComponentAdapter;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.decorator.Highlighter;
-import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-import org.nuiton.util.beans.BeanMonitor;
-import org.nuiton.util.decorator.Decorator;
-
-import javax.swing.event.ListSelectionListener;
-import javax.swing.table.TableColumnModel;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.event.FocusEvent;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTabUIHandler extends AbstractTuttiTableUIHandler<SpeciesBatchRowModel, SpeciesTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
-
- public static final Set<String> RECOMPUTE_TOTAL_WEIGHT = Sets.newHashSet(
- SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
- SpeciesBatchRowModel.PROPERTY_WEIGHT
- );
-
- public static final Set<String> SAMPLING_PROPERTIES = Sets.newHashSet(
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
- SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SEX,
- SpeciesBatchRowModel.PROPERTY_MATURITY,
- SpeciesBatchRowModel.PROPERTY_AGE
- );
-
- /**
- * UI.
- *
- * @since 0.2
- */
- private final SpeciesTabUI ui;
-
- /**
- * Persistence service.
- *
- * @since 0.2
- */
- private final PersistenceService persistenceService;
-
- /**
- * To monitor changes on the fishing operation.
- *
- * @since 0.2
- */
- private final BeanMonitor fishingOperationMonitor;
-
- public SpeciesTabUIHandler(FishingOperationsUI parentUi, SpeciesTabUI ui) {
- super(parentUi.getHandler().getContext(),
- SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
- SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SEX,
- SpeciesBatchRowModel.PROPERTY_MATURITY,
- SpeciesBatchRowModel.PROPERTY_AGE,
- SpeciesBatchRowModel.PROPERTY_WEIGHT,
-// SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
-// SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
- SpeciesBatchRowModel.PROPERTY_COMMENT,
- SpeciesBatchRowModel.PROPERTY_FREQUENCY);
- this.ui = ui;
- this.persistenceService = context.getService(PersistenceService.class);
- this.fishingOperationMonitor = new BeanMonitor(
- SpeciesTabUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
- SpeciesTabUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
- SpeciesTabUIModel.PROPERTY_TOTAL_VRAC_WEIGHT,
- SpeciesTabUIModel.PROPERTY_TOTAL_WEIGHT
- );
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiTableUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- protected SpeciesTabUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- protected SpeciesBatchTableModel getTableModel() {
- return (SpeciesBatchTableModel) getTable().getModel();
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getTable();
- }
-
- @Override
- protected void onModelRowsChanged(List<SpeciesBatchRowModel> rows) {
- super.onModelRowsChanged(rows);
-
- // build the new sampling tree from the new rows to edit
- getModel().getSamplingTreeModel().populate(rows);
- }
-
- @Override
- protected String[] getRowPropertiesToIgnore() {
- return new String[]{
- SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
- SpeciesBatchRowModel.PROPERTY_FREQUENCY
- };
- }
-
- @Override
- protected TableColumnModel createTableColumnModel() {
-
- List<String> samplingOrder = getModel().getSamplingOrder();
-
- DefaultTableColumnModelExt columnModel =
- new DefaultTableColumnModelExt();
-
- {
- // Species to confirm column
-
- addBooleanColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
- getTable());
- }
-
- List<Species> allSpecies = persistenceService.getAllSpecies();
-
- {
- // Species (by code) column
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_CODE);
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_CODE,
- decorator, allSpecies);
- }
-
- {
- // Species (by genusCode) column
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_GENUS);
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
- decorator, allSpecies);
-
- }
-
- if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC)) {
-
- // Vrac / Hors vrac column
-
- addComboEnumColumnToModel(columnModel,
- SpeciesBatchTableModel.VRAC_HORS_VRAC,
- VracHorsVracEnum.values());
- }
-
- if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY)) {
-
- // WeightCategory column
-
- Decorator<WeightCategory> decorator =
- getDecorator(WeightCategory.class,
- DecoratorService.BY_NAME);
-
- List<WeightCategory> data =
- persistenceService.getAllWeightCategory();
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT_CATEGORY,
- decorator, data);
- }
-
- if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_SEX)) {
-
- // Sex column
-
- Decorator<Sex> decorator =
- getDecorator(Sex.class, DecoratorService.BY_NAME);
-
- List<Sex> data = persistenceService.getAllSex();
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SEX,
- decorator, data);
- }
-
- if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_MATURITY)) {
-
- // Maturity column
-
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.MATURITY,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_AGE)) {
-
- // Age column
-
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.AGE,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Weight column
-
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Computed weight column (from frequencies)
-
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_WEIGHT);
- }
-
- { // Computed number column (from frequencies)
-
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_NUMBER);
- }
-
- { // Sample weight column
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.SAMPLE_WEIGHT);
- }
-
- { // SamplingRatio column
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.SAMPLING_RATIO);
- }
-
- { // Comment column
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.COMMENT);
- }
-
- { // File column
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.FILE);
- }
- return columnModel;
- }
-
- @Override
- protected void onRowModified(SpeciesBatchRowModel row,
- String propertyName,
- Object oldValue,
- Object newValue) {
-
- if (RECOMPUTE_TOTAL_WEIGHT.contains(propertyName)) {
-
- // Need to recompute totalHorsVracWeight
- recomputeTotalHorsVrac();
- }
-
- SpeciesTabUIModel model = getModel();
-
- SpeciesBatchTreeModel samplingTreeModel = model.getSamplingTreeModel();
-
- if (SAMPLING_PROPERTIES.contains(propertyName)) {
-
- // Need to rebuilt this row sampling tree path (and then recompute
- // old super - samplingRatio and new super - samplingRatio)
-
- // old node of the previous sampling def for this row
- // and remove it from any cache
- SpeciesBatchTreeNode oldNode = samplingTreeModel.removeNodeFromCache(row);
-
- boolean rowWasValid = row.isValid();
- if (oldNode != null && rowWasValid) {
-
- // remove this row from his super sampling
- recomputeSuperSamplingRatio(samplingTreeModel, oldNode);
- }
-
- // get new sampling node
- SpeciesBatchTreeNode newNode = samplingTreeModel.getSamplingNode(row);
-
- // check this row is valid
- boolean rowValid = samplingTreeModel.isValid(row, newNode);
-
- // push this state back to the row
- row.setValid(rowValid);
-
- if (rowValid) {
-
- // can add it to his super-sampling
- recomputeSuperSamplingRatio(samplingTreeModel, newNode);
- } else {
-
- if (rowWasValid) {
-
- row.setSampleWeight(null);
- row.setSamplingRatio(null);
-
- getTableModel().updateSamplingRatio(Sets.newHashSet(row));
- }
- }
- }
-
- if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName)) {
-
- // Need to recompute the super - samplingRatio
-
- SpeciesBatchTreeNode node = samplingTreeModel.getSamplingNode(row);
-
- boolean rowWasValid = row.isValid();
-
- // check this row is valid
- boolean rowValid = samplingTreeModel.isValid(row, node);
-
- // push this state back to the row
- row.setValid(rowValid);
-
- if (rowValid) {
- recomputeSuperSamplingRatio(samplingTreeModel, node);
- } else {
- if (rowWasValid) {
-
- // must remove this row from his super-sampling
- recomputeSuperSamplingRatio(samplingTreeModel, node);
-
- row.setSampleWeight(null);
- row.setSamplingRatio(null);
-
- getTableModel().updateSamplingRatio(Sets.newHashSet(row));
- }
- }
- }
- }
-
- @Override
- protected void onRowValidStateChanged(SpeciesBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- int rowIndex = getTableModel().getRowIndex(row);
-
- if (rowIndex > -1) {
- getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
- }
- }
-
- @Override
- protected void onRowModifyStateChanged(SpeciesBatchRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- }
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- public void beforeInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("beforeInit: " + ui);
- }
-
- SpeciesTabUIModel model = new SpeciesTabUIModel();
- ui.setContextValue(model);
-
- fishingOperationMonitor.setBean(model);
- }
-
- @Override
- public void afterInitUI() {
-
- if (log.isInfoEnabled()) {
- log.info("afterInit: " + ui);
- }
-
- initUI(ui);
-
- //TODO Will come from protocol
- List<String> samplingOrder = Lists.newArrayList(
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
- SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SEX
- );
-
- getModel().setSamplingOrder(samplingOrder);
-
- JXTable table = getTable();
-
- // create table column model
- TableColumnModel columnModel = createTableColumnModel();
-
- // create table model
- SpeciesBatchTableModel tableModel =
- new SpeciesBatchTableModel(columnModel);
-
- table.setModel(tableModel);
- table.setColumnModel(columnModel);
- installTableKeyListener(columnModel, table);
-
- table.getTableHeader().setReorderingAllowed(false);
-
-
- Highlighter readOnlyHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
- HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY);
-
- table.addHighlighter(readOnlyHighlighter);
- Highlighter validHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
- new HighlightPredicate.AndHighlightPredicate(HighlightPredicate.EDITABLE, new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
-
- boolean result = false;
- if (adapter.isEditable()) {
- int rowIndex = adapter.convertRowIndexToModel(adapter.row);
- SpeciesBatchRowModel row = getTableModel().getEntry(rowIndex);
- result = !row.isValid();
- }
- return result;
- }
- }), Color.RED);
- table.addHighlighter(validHighlighter);
-
- // when model datas change let's propagate it table model
- listenRowsFromModel();
-
- // save when row chaged and was modified
- ListSelectionListener listener = new TableRowModificationListener<SpeciesBatchRowModel>(
- getTableModel(), getRowMonitor()) {
- @Override
- protected void saveSelectedRow() {
- saveSelectedRowIfRequired();
- }
- };
- table.getSelectionModel().addListSelectionListener(listener);
-
- // always scroll to selected row
- SwingUtil.scrollToTableSelection(getTable());
- }
-
- @Override
- public void onCloseUI() {
- if (log.isInfoEnabled()) {
- log.info("closing: " + ui);
- }
- }
-
- //------------------------------------------------------------------------//
- //-- Public methods --//
- //------------------------------------------------------------------------//
-
- public void saveSelectedRowIfRequired(FocusEvent event) {
-
- Component oppositeComponent = event.getOppositeComponent();
-
- JXTable parentContainer = null;
-
- if (oppositeComponent != null) {
-
- // check out if still on table
- parentContainer = SwingUtil.getParentContainer(
- oppositeComponent, JXTable.class);
- }
-
- if (parentContainer == null) {
-
- // out of the table can save
- if (getModel().getFishingOperation()!=null) {
- saveSelectedRowIfRequired();
- }
- }
- }
-
- public void selectFishingOperation(FishingOperation bean) {
-
- JXTable table = ui.getTable();
-
- if (table.isEditing()) {
-
- // make sure to stop editor
- table.editingCanceled(null);
- }
-
- if (fishingOperationMonitor.wasModified()) {
-
- // previous fishingOperation was modified, let's save it
- SpeciesTabUIModel traitMonitorBean =
- (SpeciesTabUIModel) fishingOperationMonitor.getBean();
-
- FishingOperation fishingOperation = traitMonitorBean.toBean();
-
- if (log.isInfoEnabled()) {
- log.info("FishingOperation " + fishingOperation.getId() +
- " was modified, will save it.");
- }
-
- persistenceService.saveFishingOperation(fishingOperation);
- }
-
- // make sure selection is empty (will remove bean from monitor)
- table.clearSelection();
-
- boolean empty = bean == null;
-
- SpeciesTabUIModel model = getModel();
-
- List<SpeciesBatchRowModel> rows;
-
- if (empty) {
- rows = null;
- bean = new FishingOperation();
- model.setFishingOperation(null);
- } else {
-
- if (log.isInfoEnabled()) {
- log.info("Get species batch for fishingOperation: " + bean.getId());
- }
- rows = Lists.newArrayList();
-
- if (!TuttiEntities.isNew(bean)) {
- List<SpeciesBatch> catches =
- persistenceService.getAllSpeciesBatch(bean.getId());
- for (SpeciesBatch aBatch : catches) {
- List<SpeciesBatchFrequency> frequencies =
- persistenceService.getAllSpeciesBatchFrequency(aBatch.getId());
- SpeciesBatchRowModel entry =
- new SpeciesBatchRowModel(aBatch, frequencies);
- rows.add(entry);
- }
- }
- model.setFishingOperation(bean);
- }
-
- model.fromBean(bean);
- model.setRows(rows);
-
- fishingOperationMonitor.clearModified();
- }
-
- //------------------------------------------------------------------------//
- //-- Internal methods --//
- //------------------------------------------------------------------------//
-
- protected void recomputeSuperSamplingRatio(SpeciesBatchTreeModel samplingTreeModel,
- SpeciesBatchTreeNode node) {
-
- SpeciesBatchTreeNode superSamplingNode = node.getParent();
-
- Preconditions.checkNotNull(superSamplingNode,
- "Super sampling node can't be null");
-
- SpeciesBatchTreeModel.SamplingContext samplingContext =
- samplingTreeModel.createSamplingContext(superSamplingNode);
-
- float samplingTotalWeight = samplingContext.getTotalWeight();
- Float superSamplingTotalWeight;
- SpeciesBatchRowModel superSamplingRow =
- samplingContext.getSuperSamplingRow();
- if (superSamplingRow == null) {
-
- // Use directly the batch total weight (means no super-sampling)
-
- superSamplingTotalWeight = getModel().getTotalWeight();
- } else {
- superSamplingTotalWeight = superSamplingRow.getWeight();
- }
-
- if (log.isInfoEnabled()) {
- log.info("Super sampling total weight: " +
- superSamplingTotalWeight);
- }
-
- Float samplingRatio = null;
- if (superSamplingTotalWeight != null) {
- samplingRatio = samplingTotalWeight / superSamplingTotalWeight;
- }
-
- if (log.isInfoEnabled()) {
- log.info("Sampling ratio: " + samplingRatio);
- }
-
- samplingContext.applyNewSampleValues(samplingTotalWeight,
- samplingRatio);
-
- getTableModel().updateSamplingRatio(samplingContext.getSamplingRows());
- }
-
-
- protected void recomputeTotalHorsVrac() {
-
- // recompute total hors vrac
- Float totalHorsVrac = 0f;
- Float totalVrac = 0f;
-
- for (SpeciesBatchRowModel batch : getModel().getRows()) {
- VracHorsVracEnum vracHorsVrac = batch.getVracHorsVrac();
- if (vracHorsVrac == null) {
-
- // can't sum anything
- } else if (vracHorsVrac == VracHorsVracEnum.HORS_VRAC) {
- Float weight = batch.getWeight();
- if (weight != null) {
- totalHorsVrac += weight;
- }
- } else if (vracHorsVrac == VracHorsVracEnum.VRAC) {
- Float weight = batch.getWeight();
- if (weight != null) {
- totalVrac += weight;
- }
- }
- }
- if (log.isInfoEnabled()) {
- log.info("New total vrac / hors vrac: " +
- totalVrac + " / " + totalHorsVrac);
- }
- getModel().setTotalHorsVracWeight(totalHorsVrac);
- //TODO Should we also set the total vrac weight ?
-// getModel().setTotalVracWeight(totalVrac);
- }
-
- protected void saveSelectedRowIfRequired() {
-
- TuttiBeanMonitor<SpeciesBatchRowModel> rowMonitor = getRowMonitor();
-
- SpeciesBatchRowModel bean = rowMonitor.getBean();
- if (bean != null) {
-
- if (bean.isValid()) {
- // there is a valid bean attached to the monitor
-
- if (rowMonitor.wasModified()) {
-
- // monitored bean was modified, save it
- if (log.isInfoEnabled()) {
- log.info("Row " + bean + " was modified, will save it");
- }
-
- saveRow(bean);
-
- // clear modified flag on the monitor
- rowMonitor.clearModified();
- }
- } else {
-
- // row is not valid can not save it
-
- SpeciesBatch catchBean = bean.toBean();
-
- FishingOperation fishingOperation = getModel().getFishingOperation();
-
- if (!TuttiEntities.isNew(catchBean)) {
-
- // remove this
- persistenceService.deleteSpeciesBatch(catchBean.getId());
- }
- }
- }
- }
-
- protected void saveRow(SpeciesBatchRowModel row) {
-
- SpeciesBatch catchBean = row.toBean();
-
- FishingOperation fishingOperation = getModel().getFishingOperation();
- catchBean.setFishingOperation(fishingOperation);
- if (log.isInfoEnabled()) {
- log.info("Selected fishingOperation: " + fishingOperation.getId());
- }
-
- if (TuttiEntities.isNew(catchBean)) {
-
- catchBean = persistenceService.createSpeciesBatch(catchBean);
- row.setId(catchBean.getId());
- } else {
- persistenceService.saveSpeciesBatch(catchBean);
- }
-
- List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
-
- List<SpeciesBatchFrequency> frequency =
- SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
-
- if (log.isInfoEnabled()) {
- log.info("Will save " + frequency.size() + " frequencies.");
- }
- frequency = persistenceService.saveSpeciesBatchFrequency(
- catchBean.getId(), frequency);
-
- // push it back to row model
- frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
- row.setFrequency(frequencyRows);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java 2012-12-13 01:57:28 UTC (rev 55)
@@ -1,184 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderModelBuilder;
-
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, SpeciesBatchRowModel, SpeciesTabUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight";
-
- public static final String PROPERTY_SAMPLE_VRAC_WEIGHT = "sampleVracWeight";
-
- public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
-
- /**
- * Editing fishing operation.
- *
- * @since 0.2
- */
- protected FishingOperation fishingOperation;
-
- /**
- * Total Weight filled in screen.
- *
- * @since 0.2
- */
- protected Float totalWeight;
-
- /**
- * Total vrac Weight filled in screen.
- *
- * @since 0.2
- */
- protected Float totalVracWeight;
-
- /**
- * Total sample vrac Weight filled in screen.
- *
- * @since 0.2
- */
- protected Float sampleVracWeight;
-
- /**
- * Total hors vrac Weight computed by hros vrac rows.
- *
- * @since 0.2
- */
- protected Float totalHorsVracWeight;
-
- /**
- * Sampling order (sets by protocol).
- *
- * @since 0.2
- */
- protected List<String> samplingOrder;
-
- /**
- * Tree of sampling for batch rows.
- *
- * @since 0.2
- */
- protected final SpeciesBatchTreeModel samplingTreeModel;
-
- protected static final Binder<FishingOperation, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, SpeciesTabUIModel.class)
- .addProperty("speciesTotalWeight", PROPERTY_TOTAL_WEIGHT)
- .addProperty("speciesTotalHorsVracWeight", PROPERTY_TOTAL_HORS_VRAC_WEIGHT)
- .addProperty("speciesTotalVracWeight", PROPERTY_TOTAL_VRAC_WEIGHT)
- .addProperty("speciesSampleVracWeight", PROPERTY_SAMPLE_VRAC_WEIGHT)
- .addProperty("id", PROPERTY_ID)
- .toBinder();
-
- protected static final Binder<SpeciesTabUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, FishingOperation.class)
- .addProperty(PROPERTY_TOTAL_WEIGHT, "speciesTotalWeight")
- .addProperty(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, "speciesTotalHorsVracWeight")
- .addProperty(PROPERTY_TOTAL_VRAC_WEIGHT, "speciesTotalVracWeight")
- .addProperty(PROPERTY_SAMPLE_VRAC_WEIGHT, "speciesSampleVracWeight")
- .toBinder();
-
- public SpeciesTabUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
- this.samplingTreeModel = new SpeciesBatchTreeModel();
- }
-
- public FishingOperation getFishingOperation() {
- return fishingOperation;
- }
-
- public void setFishingOperation(FishingOperation fishingOperation) {
- this.fishingOperation = fishingOperation;
- }
-
- public SpeciesBatchTreeModel getSamplingTreeModel() {
- return samplingTreeModel;
- }
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getTotalVracWeight() {
- return totalVracWeight;
- }
-
- public void setTotalVracWeight(Float totalVracWeight) {
- Object oldValue = getTotalVracWeight();
- this.totalVracWeight = totalVracWeight;
- firePropertyChange(PROPERTY_TOTAL_VRAC_WEIGHT, oldValue, totalVracWeight);
- }
-
- public Float getSampleVracWeight() {
- return sampleVracWeight;
- }
-
- public void setSampleVracWeight(Float sampleVracWeight) {
- Object oldValue = getSampleVracWeight();
- this.sampleVracWeight = sampleVracWeight;
- firePropertyChange(PROPERTY_SAMPLE_VRAC_WEIGHT, oldValue, sampleVracWeight);
- }
-
- public Float getTotalHorsVracWeight() {
- return totalHorsVracWeight;
- }
-
- public void setTotalHorsVracWeight(Float totalHorsVracWeight) {
- Object oldValue = getTotalHorsVracWeight();
- this.totalHorsVracWeight = totalHorsVracWeight;
- firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
- }
-
- public List<String> getSamplingOrder() {
- return samplingOrder;
- }
-
- public void setSamplingOrder(List<String> samplingOrder) {
- this.samplingOrder = samplingOrder;
- samplingTreeModel.setSamplingOrder(samplingOrder.toArray(new String[samplingOrder.size()]));
- }
-
- @Override
- protected FishingOperation newEntity() {
- return fishingOperation;
- }
-}
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-12 22:50:50 UTC (rev 54)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-13 01:57:28 UTC (rev 55)
@@ -43,8 +43,6 @@
tutti.config.ui.showNumberEditorButton=Afficher le pavé numérique de saisie
tutti.label.benthos.sampleTotalWeight=Poids total échantillonné
tutti.label.benthos.totalWeight=Poids total
-tutti.label.captureAccidentel.sampleTotalWeight=Poids total échantillonné
-tutti.label.captureAccidentel.totalWeight=Poids total
tutti.label.comment=Commentaire
tutti.label.cruise=Campagne
tutti.label.cruise.beginDate=Date de début
@@ -68,25 +66,18 @@
tutti.label.fishingOperation.gearDate=Date
tutti.label.fishingOperation.gearLatitude=Latitude
tutti.label.fishingOperation.gearLongitude=Longitude
-tutti.label.fishingOperation.gearShootingDate=Date
tutti.label.fishingOperation.gearShootingEnd=Fin de traine
tutti.label.fishingOperation.gearShootingEndBottomSalinity=Salinité de fond fin de traine
tutti.label.fishingOperation.gearShootingEndBottomTemperature=Température de fond fin de traine
tutti.label.fishingOperation.gearShootingEndDepth=Profondeur fin de traine
tutti.label.fishingOperation.gearShootingEndSurfaceSalinity=Salinité de surface fin de traine
tutti.label.fishingOperation.gearShootingEndSurfaceTemperature=Temperature de surface fin de traine
-tutti.label.fishingOperation.gearShootingLatitude=Latitude
-tutti.label.fishingOperation.gearShootingLongitude=Longitude
tutti.label.fishingOperation.gearShootingStart=Début de traine
tutti.label.fishingOperation.gearShootingStartBottomSalinity=Salinité de fond début de traine
tutti.label.fishingOperation.gearShootingStartBottomTemperature=Température de fond début de traine
tutti.label.fishingOperation.gearShootingStartDepth=Profondeur début de traine
-tutti.label.fishingOperation.gearShootingStartLatitude=Latitude début de traine
-tutti.label.fishingOperation.gearShootingStartLongitude=Longitude début de traine
tutti.label.fishingOperation.gearShootingStartSurfaceSalinity=Salinité de surface début de traine
tutti.label.fishingOperation.gearShootingStartSurfaceTemperature=Temperature de surface début de traine
-tutti.label.fishingOperation.gearShootingStartTime=Début de traine
-tutti.label.fishingOperation.gearShootingTime=Heure
tutti.label.fishingOperation.gearTime=Heure
tutti.label.fishingOperation.geometrieMesuree=Géométrie mesurée
tutti.label.fishingOperation.localite=Localité
@@ -102,7 +93,6 @@
tutti.label.fishingOperation.windDirection=Direction du vent
tutti.label.frequencyConfiguration.maxStep=Classe max
tutti.label.frequencyConfiguration.minStep=Classe min
-tutti.label.frequencyConfiguration.mode=Mode de saisie
tutti.label.frequencyConfiguration.mode.autoGen=Génération des classes
tutti.label.frequencyConfiguration.mode.autoGen.tip=Mode où toutes les classes de taille sont générées
tutti.label.frequencyConfiguration.mode.rafale=Mode "rafale"
@@ -115,13 +105,11 @@
tutti.label.list.gear=Engin(s)
tutti.label.list.headOfMission=Chef(s) de mission
tutti.label.list.headOfSortRoom=Reponsable(s) de salle de tri
-tutti.label.list.saisisseur=Nom des saisisseurs
tutti.label.list.vessel=Navire(s)
-tutti.label.macroDechet.sampleTotalWeight=Poids total échantillonné
-tutti.label.macroDechet.totalWeight=Poids total
+tutti.label.macroWaste.totalWeight=Poids total
tutti.label.no.fishingOperation.selected=< Aucun trait sélectionné >
-tutti.label.plancton.sampleTotalWeight=Poids total échantillonné
-tutti.label.plancton.totalWeight=Poids total
+tutti.label.plankton.sampleTotalWeight=Poids total échantillonné
+tutti.label.plankton.totalWeight=Poids total
tutti.label.program=Série de campagne
tutti.label.program.name=Nom
tutti.label.program.zone=Zone
@@ -155,26 +143,35 @@
tutti.menu.synchronisationImport.tip=Effectuer des imports
tutti.menu.synchronisations=Synchronisation
tutti.menu.synchronisations.tip=Import/Export
-tutti.table.benthos.header.number=Nombre observé
-tutti.table.benthos.header.speciesByCode=Espèce
-tutti.table.benthos.header.weight=Poids observé
-tutti.table.captureAccidentel.header.number=Nombre observé
-tutti.table.captureAccidentel.header.speciesByCode=Espèce
-tutti.table.captureAccidentel.header.weight=Poids observé
-tutti.table.macroDechet.header.number=Nombre observé
-tutti.table.macroDechet.header.speciesByCode=Espèce
-tutti.table.macroDechet.header.weight=Poids observé
-tutti.table.plancton.header.number=Nombre observé
-tutti.table.plancton.header.speciesByCode=Espèce
-tutti.table.plancton.header.weight=Poids observé
+tutti.table.benthos.batch.header.comment=Commentaire
+tutti.table.benthos.batch.header.elevationRate=Fraction d'élévation
+tutti.table.benthos.batch.header.file=Pièces jointes
+tutti.table.benthos.batch.header.sampleWeight=Poids échantillonné
+tutti.table.benthos.batch.header.speciesByCode=Espèce
+tutti.table.benthos.batch.header.speciesByGenusCode=Espèce
+tutti.table.benthos.batch.header.toConfirm=A Confirmer
+tutti.table.benthos.batch.header.weight=Poids
+tutti.table.macrowaste.batch.header.comment=Commentaire
+tutti.table.macrowaste.batch.header.file=Pièces jointes
+tutti.table.macrowaste.batch.header.speciesByCode=Espèce
+tutti.table.macrowaste.batch.header.speciesByGenusCode=Espèce
+tutti.table.macrowaste.batch.header.weight=Poids
+tutti.table.plankton.batch.header.comment=Commentaire
+tutti.table.plankton.batch.header.elevationRate=Fraction d'élévation
+tutti.table.plankton.batch.header.file=Pièces jointes
+tutti.table.plankton.batch.header.sampleWeight=Poids échantillonné
+tutti.table.plankton.batch.header.speciesByCode=Espèce
+tutti.table.plankton.batch.header.speciesByGenusCode=Espèce
+tutti.table.plankton.batch.header.toConfirm=A Confirmer
+tutti.table.plankton.batch.header.weight=Poids
tutti.table.species.batch.header.age=Age
tutti.table.species.batch.header.comment=Commentaire
tutti.table.species.batch.header.computedNumber=Nombre calculé
tutti.table.species.batch.header.computedWeight=Poids calculé
-tutti.table.species.batch.header.elevationRate=Fraction d'él
+tutti.table.species.batch.header.elevationRate=Fraction d'élévation
tutti.table.species.batch.header.file=Pièces jointes
tutti.table.species.batch.header.maturity=Maturité
-tutti.table.species.batch.header.sampleWeight=Poids échan
+tutti.table.species.batch.header.sampleWeight=Poids échantillonné
tutti.table.species.batch.header.sex=Sexe
tutti.table.species.batch.header.speciesByCode=Espèce
tutti.table.species.batch.header.speciesByGenusCode=Espèce
@@ -191,8 +188,8 @@
tutti.title.create.cruise=Créer une nouvelle campagne
tutti.title.create.program=Créer une nouvelle série de campagne
tutti.title.edit.cruise=Editer une campagne existante
+tutti.title.edit.operations=Saisie des opérations de pêches (%s)
tutti.title.edit.program=Editer une série de campagne existante
-tutti.title.fill.catches=Saisie des captures
tutti.title.frequency=Saisie des mensurations
tutti.title.home=Sélection de la campagne
tutti.title.noSelectedCruise=Pas de campagne sélectionné
1
0
r54 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species
by tchemit@users.forge.codelutin.com Dec. 12, 2012
by tchemit@users.forge.codelutin.com Dec. 12, 2012
Dec. 12, 2012
Author: tchemit
Date: 2012-12-12 23:50:50 +0100 (Wed, 12 Dec 2012)
New Revision: 54
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/54
Log:
continue species batch screen
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-12 22:50:16 UTC (rev 53)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-12 22:50:50 UTC (rev 54)
@@ -366,12 +366,6 @@
computedNumber);
}
- //TODO Use validator
- @Override
- public boolean isValid() {
- return species != null && weight != null;
- }
-
public int getRowCount() {
return frequency == null ? 0 : frequency.size();
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-12 22:50:16 UTC (rev 53)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-12 22:50:50 UTC (rev 54)
@@ -134,7 +134,11 @@
@Override
protected SpeciesBatchRowModel createNewRow() {
- return new SpeciesBatchRowModel();
+ SpeciesBatchRowModel result = new SpeciesBatchRowModel();
+
+ // by default empty row is not valid
+ result.setValid(false);
+ return result;
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-12 22:50:16 UTC (rev 53)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-12 22:50:50 UTC (rev 54)
@@ -24,11 +24,16 @@
* #L%
*/
+import com.google.common.collect.HashMultimap;
import com.google.common.collect.Maps;
+import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import org.apache.commons.collections.CollectionUtils;
import java.io.Serializable;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -67,14 +72,13 @@
*
* @since 0.2
*/
- protected final Map<SpeciesBatchTreeNode, SpeciesBatchRowModel> nodeToRow;
+ protected final Multimap<SpeciesBatchTreeNode, SpeciesBatchRowModel> nodeToRow;
-
public SpeciesBatchTreeModel(String... samplingOrder) {
this.samplingOrder = samplingOrder;
root = new SpeciesBatchTreeNode();
rowToNode = Maps.newHashMap();
- nodeToRow = Maps.newHashMap();
+ nodeToRow = HashMultimap.create();
}
public void populate(List<SpeciesBatchRowModel> rows) {
@@ -85,7 +89,11 @@
SpeciesBatchTreeNode node = getSamplingNode(row);
- nodeToRow.put(node, row);
+ // check if row is valid
+ boolean rowIsValid = isValid(row, node);
+
+ // set it in row
+ row.setValid(rowIsValid);
}
}
@@ -107,12 +115,11 @@
nodeToRow.clear();
}
-
public SpeciesBatchTreeNode removeNodeFromCache(SpeciesBatchRowModel row) {
SpeciesBatchTreeNode result = rowToNode.remove(row);
if (result != null) {
- nodeToRow.remove(result);
+ nodeToRow.remove(result, row);
}
return result;
}
@@ -127,8 +134,17 @@
// not in cache must build the path
result = getSamplingNode(root, 0, row);
- // and add it in cache
- rowToNode.put(row, result);
+ if (result == root) {
+
+ // this means an empty row, so no node for it
+ result = null;
+
+ } else {
+
+ // found a row with a sampling, add it in cache
+ rowToNode.put(row, result);
+ nodeToRow.put(result, row);
+ }
}
return result;
}
@@ -173,16 +189,26 @@
Set<SpeciesBatchRowModel> childRows = Sets.newHashSet();
- SpeciesBatchRowModel superSamplingRow = nodeToRow.get(rootNode);
+ SpeciesBatchRowModel superSamplingRow = getNodeToRow(rootNode);
+
float totalWeight = 0f;
for (int i = 0, nbChildren = rootNode.getChildCount(); i < nbChildren; i++) {
SpeciesBatchTreeNode node = rootNode.getChildAt(i);
- SpeciesBatchRowModel row = nodeToRow.get(node);
+
+ SpeciesBatchRowModel row = getNodeToRow(node);
if (row != null) {
- childRows.add(row);
- Float weight = row.getWeight();
- if (weight != null) {
- totalWeight += weight;
+ VracHorsVracEnum vracHorsVrac = row.getVracHorsVrac();
+ if (VracHorsVracEnum.HORS_VRAC.equals(vracHorsVrac)) {
+
+ // never take account of a such child
+
+ } else {
+
+ childRows.add(row);
+ Float weight = row.getWeight();
+ if (weight != null) {
+ totalWeight += weight;
+ }
}
}
}
@@ -193,6 +219,34 @@
return result;
}
+ public SpeciesBatchRowModel getNodeToRow(SpeciesBatchTreeNode node) {
+ Collection<SpeciesBatchRowModel> rows = nodeToRow.get(node);
+
+ SpeciesBatchRowModel result = null;
+ if (CollectionUtils.isNotEmpty(rows)) {
+ for (SpeciesBatchRowModel next : rows) {
+ if (next.isValid()) {
+ result = next;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ public boolean isValid(SpeciesBatchRowModel row, SpeciesBatchTreeNode newNode) {
+
+ // row must be on a sampling and having a weight
+ boolean result = row.getWeight() != null && newNode != null;
+
+ // make sure there is not already another row for this node
+ if (result && CollectionUtils.size(nodeToRow.get(newNode)) > 1) {
+ result = false;
+ }
+
+ return result;
+ }
+
public static class SamplingContext {
private final SpeciesBatchTreeNode rootNode;
@@ -228,5 +282,14 @@
public float getTotalWeight() {
return totalWeight;
}
+
+ public void applyNewSampleValues(float samplingWeight,
+ Float samplingRatio) {
+
+ for (SpeciesBatchRowModel row : samplingRows) {
+ row.setSampleWeight(samplingWeight);
+ row.setSamplingRatio(samplingRatio);
+ }
+ }
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java 2012-12-12 22:50:16 UTC (rev 53)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java 2012-12-12 22:50:50 UTC (rev 54)
@@ -29,6 +29,7 @@
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import java.io.Serializable;
+import java.util.Arrays;
/**
* Defines a node of a species catches sampling.
@@ -159,4 +160,16 @@
return (SpeciesBatchTreeNode) super.getPreviousLeaf();
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof SpeciesBatchTreeNode)) return false;
+
+ SpeciesBatchTreeNode that = (SpeciesBatchTreeNode) o;
+
+ Object[] path = getUserObjectPath();
+ Object[] path2 = that.getUserObjectPath();
+ return Arrays.equals(path, path2);
+ }
+
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java 2012-12-12 22:50:16 UTC (rev 53)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java 2012-12-12 22:50:50 UTC (rev 54)
@@ -93,6 +93,7 @@
}
SpeciesFrequencyRowModel result = new SpeciesFrequencyRowModel();
result.setLengthStep(defaultStep);
+ result.setValid(false);
return result;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java 2012-12-12 22:50:16 UTC (rev 53)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java 2012-12-12 22:50:50 UTC (rev 54)
@@ -134,6 +134,18 @@
}
}
+ @Override
+ protected void onRowValidStateChanged(SpeciesFrequencyRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(SpeciesFrequencyRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
//------------------------------------------------------------------------//
//-- AbstractTuttiUIHandler methods --//
//------------------------------------------------------------------------//
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-12 22:50:16 UTC (rev 53)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-12 22:50:50 UTC (rev 54)
@@ -47,7 +47,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
import org.nuiton.util.beans.BeanMonitor;
import org.nuiton.util.decorator.Decorator;
@@ -114,8 +116,8 @@
SpeciesBatchRowModel.PROPERTY_MATURITY,
SpeciesBatchRowModel.PROPERTY_AGE,
SpeciesBatchRowModel.PROPERTY_WEIGHT,
- SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
+// SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+// SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
SpeciesBatchRowModel.PROPERTY_COMMENT,
SpeciesBatchRowModel.PROPERTY_FREQUENCY);
this.ui = ui;
@@ -156,6 +158,15 @@
}
@Override
+ protected String[] getRowPropertiesToIgnore() {
+ return new String[]{
+ SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ SpeciesBatchRowModel.PROPERTY_FREQUENCY
+ };
+ }
+
+ @Override
protected TableColumnModel createTableColumnModel() {
List<String> samplingOrder = getModel().getSamplingOrder();
@@ -318,9 +329,8 @@
SpeciesBatchTreeModel samplingTreeModel = model.getSamplingTreeModel();
- if (SAMPLING_PROPERTIES.contains(propertyName) && row.isValid()) {
+ if (SAMPLING_PROPERTIES.contains(propertyName)) {
-
// Need to rebuilt this row sampling tree path (and then recompute
// old super - samplingRatio and new super - samplingRatio)
@@ -328,23 +338,86 @@
// and remove it from any cache
SpeciesBatchTreeNode oldNode = samplingTreeModel.removeNodeFromCache(row);
+ boolean rowWasValid = row.isValid();
+ if (oldNode != null && rowWasValid) {
+
+ // remove this row from his super sampling
+ recomputeSuperSamplingRatio(samplingTreeModel, oldNode);
+ }
+
// get new sampling node
SpeciesBatchTreeNode newNode = samplingTreeModel.getSamplingNode(row);
- moveSamplingNode(samplingTreeModel, row, oldNode, newNode);
+ // check this row is valid
+ boolean rowValid = samplingTreeModel.isValid(row, newNode);
+
+ // push this state back to the row
+ row.setValid(rowValid);
+
+ if (rowValid) {
+
+ // can add it to his super-sampling
+ recomputeSuperSamplingRatio(samplingTreeModel, newNode);
+ } else {
+
+ if (rowWasValid) {
+
+ row.setSampleWeight(null);
+ row.setSamplingRatio(null);
+
+ getTableModel().updateSamplingRatio(Sets.newHashSet(row));
+ }
+ }
}
- if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName) &&
- row.isValid()) {
+ if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName)) {
// Need to recompute the super - samplingRatio
SpeciesBatchTreeNode node = samplingTreeModel.getSamplingNode(row);
- recomputeSuperSamplingRatio(samplingTreeModel, row, node);
+ boolean rowWasValid = row.isValid();
+
+ // check this row is valid
+ boolean rowValid = samplingTreeModel.isValid(row, node);
+
+ // push this state back to the row
+ row.setValid(rowValid);
+
+ if (rowValid) {
+ recomputeSuperSamplingRatio(samplingTreeModel, node);
+ } else {
+ if (rowWasValid) {
+
+ // must remove this row from his super-sampling
+ recomputeSuperSamplingRatio(samplingTreeModel, node);
+
+ row.setSampleWeight(null);
+ row.setSamplingRatio(null);
+
+ getTableModel().updateSamplingRatio(Sets.newHashSet(row));
+ }
+ }
}
}
+ @Override
+ protected void onRowValidStateChanged(SpeciesBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ int rowIndex = getTableModel().getRowIndex(row);
+
+ if (rowIndex > -1) {
+ getTableModel().fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+ }
+
+ @Override
+ protected void onRowModifyStateChanged(SpeciesBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ }
+
//------------------------------------------------------------------------//
//-- AbstractTuttiUIHandler methods --//
//------------------------------------------------------------------------//
@@ -396,9 +469,27 @@
table.getTableHeader().setReorderingAllowed(false);
- table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(
- HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
+ Highlighter readOnlyHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY);
+
+ table.addHighlighter(readOnlyHighlighter);
+ Highlighter validHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ new HighlightPredicate.AndHighlightPredicate(HighlightPredicate.EDITABLE, new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+
+ boolean result = false;
+ if (adapter.isEditable()) {
+ int rowIndex = adapter.convertRowIndexToModel(adapter.row);
+ SpeciesBatchRowModel row = getTableModel().getEntry(rowIndex);
+ result = !row.isValid();
+ }
+ return result;
+ }
+ }), Color.RED);
+ table.addHighlighter(validHighlighter);
+
// when model datas change let's propagate it table model
listenRowsFromModel();
@@ -443,7 +534,9 @@
if (parentContainer == null) {
// out of the table can save
- saveSelectedRowIfRequired();
+ if (getModel().getFishingOperation()!=null) {
+ saveSelectedRowIfRequired();
+ }
}
}
@@ -517,23 +610,7 @@
//-- Internal methods --//
//------------------------------------------------------------------------//
- protected void moveSamplingNode(SpeciesBatchTreeModel samplingTreeModel,
- SpeciesBatchRowModel row,
- SpeciesBatchTreeNode oldNode,
- SpeciesBatchTreeNode newNode) {
-
- if (oldNode != null) {
-
- recomputeSuperSamplingRatio(samplingTreeModel, row, oldNode);
-
- }
-
- recomputeSuperSamplingRatio(samplingTreeModel, row, newNode);
-
- }
-
protected void recomputeSuperSamplingRatio(SpeciesBatchTreeModel samplingTreeModel,
- SpeciesBatchRowModel row,
SpeciesBatchTreeNode node) {
SpeciesBatchTreeNode superSamplingNode = node.getParent();
@@ -571,8 +648,10 @@
log.info("Sampling ratio: " + samplingRatio);
}
+ samplingContext.applyNewSampleValues(samplingTotalWeight,
+ samplingRatio);
+
getTableModel().updateSamplingRatio(samplingContext.getSamplingRows());
-
}
@@ -613,21 +692,36 @@
TuttiBeanMonitor<SpeciesBatchRowModel> rowMonitor = getRowMonitor();
SpeciesBatchRowModel bean = rowMonitor.getBean();
- if (bean != null && bean.isValid()) {
+ if (bean != null) {
- // there is a valid bean attached to the monitor
+ if (bean.isValid()) {
+ // there is a valid bean attached to the monitor
- if (rowMonitor.wasModified()) {
+ if (rowMonitor.wasModified()) {
- // monitored bean was modified, save it
- if (log.isInfoEnabled()) {
- log.info("Row " + bean + " was modified, will save it");
+ // monitored bean was modified, save it
+ if (log.isInfoEnabled()) {
+ log.info("Row " + bean + " was modified, will save it");
+ }
+
+ saveRow(bean);
+
+ // clear modified flag on the monitor
+ rowMonitor.clearModified();
}
+ } else {
- saveRow(bean);
+ // row is not valid can not save it
- // clear modified flag on the monitor
- rowMonitor.clearModified();
+ SpeciesBatch catchBean = bean.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+
+ if (!TuttiEntities.isNew(catchBean)) {
+
+ // remove this
+ persistenceService.deleteSpeciesBatch(catchBean.getId());
+ }
}
}
}
1
0
r53 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table
by tchemit@users.forge.codelutin.com Dec. 12, 2012
by tchemit@users.forge.codelutin.com Dec. 12, 2012
Dec. 12, 2012
Author: tchemit
Date: 2012-12-12 23:50:16 +0100 (Wed, 12 Dec 2012)
New Revision: 53
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/53
Log:
improve row modification cinematic
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-12 22:43:46 UTC (rev 52)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-12 22:50:16 UTC (rev 53)
@@ -25,6 +25,7 @@
*/
import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
@@ -35,6 +36,7 @@
import jaxx.runtime.swing.editor.bean.BeanUIUtil;
import jaxx.runtime.swing.editor.cell.NumberCellEditor;
import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
@@ -57,6 +59,7 @@
import java.beans.PropertyChangeListener;
import java.util.Enumeration;
import java.util.List;
+import java.util.Set;
import static org.nuiton.i18n.I18n._;
@@ -90,21 +93,55 @@
Object oldValue,
Object newValue);
+ protected abstract void onRowValidStateChanged(R row,
+ Boolean oldValue,
+ Boolean newValue);
+
+ protected abstract void onRowModifyStateChanged(R row,
+ Boolean oldValue,
+ Boolean newValue);
+
+ protected String[] getRowPropertiesToIgnore() {
+ return ArrayUtils.EMPTY_STRING_ARRAY;
+ }
+
protected AbstractTuttiTableUIHandler(TuttiUIContext context,
String... properties) {
super(context);
+
rowMonitor = new TuttiBeanMonitor<R>(properties);
// listen when bean is changed
rowMonitor.addPropertyChangeListener(TuttiBeanMonitor.PROPERTY_BEAN, new PropertyChangeListener() {
+
+ final Set<String> propertiesToSkip =
+ Sets.newHashSet(getRowPropertiesToIgnore());
+
final PropertyChangeListener l = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
+ String propertyName = evt.getPropertyName();
+
R row = (R) evt.getSource();
- onRowModified(row,
- evt.getPropertyName(),
- evt.getOldValue(),
- evt.getNewValue());
+
+ Object oldValue = evt.getOldValue();
+ Object newValue = evt.getNewValue();
+
+ if (AbstractTuttiBeanUIModel.PROPERTY_VALID.equals(propertyName)) {
+ onRowValidStateChanged(row,
+ (Boolean) oldValue,
+ (Boolean) newValue);
+ } else if (AbstractTuttiBeanUIModel.PROPERTY_MODIFY.equals(propertyName)) {
+ onRowModifyStateChanged(row,
+ (Boolean) oldValue,
+ (Boolean) newValue);
+ } else if (!propertiesToSkip.contains(propertyName)) {
+
+ onRowModified(row,
+ propertyName,
+ oldValue,
+ newValue);
+ }
}
};
1
0
r52 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table
by tchemit@users.forge.codelutin.com Dec. 12, 2012
by tchemit@users.forge.codelutin.com Dec. 12, 2012
Dec. 12, 2012
Author: tchemit
Date: 2012-12-12 23:43:46 +0100 (Wed, 12 Dec 2012)
New Revision: 52
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/52
Log:
add method to get index of a row
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2012-12-12 22:43:03 UTC (rev 51)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2012-12-12 22:43:46 UTC (rev 52)
@@ -132,7 +132,7 @@
fireTableRowsInserted(rowIndex, rowIndex);
}
- public int updateRow(R row) {
+ public final int updateRow(R row) {
Preconditions.checkNotNull(row, "Row can not be null.");
List<R> data = getRows();
@@ -157,6 +157,11 @@
return (ColumnIdentifier<R>) column.getIdentifier();
}
+ public final int getRowIndex(R row) {
+ int result = rows == null ? -1 : rows.indexOf(row);
+ return result;
+ }
+
public final R getEntry(int rowIndex) {
SwingUtil.ensureRowIndex(this, rowIndex);
List<R> data = getRows();
1
0
r51 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table
by tchemit@users.forge.codelutin.com Dec. 12, 2012
by tchemit@users.forge.codelutin.com Dec. 12, 2012
Dec. 12, 2012
Author: tchemit
Date: 2012-12-12 23:43:03 +0100 (Wed, 12 Dec 2012)
New Revision: 51
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/51
Log:
fix row to monitor when selection is empty
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java 2012-12-12 22:26:24 UTC (rev 50)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java 2012-12-12 22:43:03 UTC (rev 51)
@@ -64,17 +64,21 @@
// save selected entry if required
saveSelectedRow();
- if (log.isInfoEnabled()) {
- log.info("New selected row: " + selectedRow);
- }
-
R entry;
- if (selectedRow == -1) {
+ if (source.isSelectionEmpty()) {
+
// no selection
entry = null;
+ if (log.isInfoEnabled()) {
+ log.info("Selection is now empty.");
+ }
} else {
entry = tableModel.getEntry(selectedRow);
+
+ if (log.isInfoEnabled()) {
+ log.info("New selected row: " + selectedRow);
+ }
}
if (log.isInfoEnabled()) {
1
0
r50 - in trunk: tutti-persistence/src/main/java/fr/ifremer/tutti/persistence tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence tutti-service/src/main/java/fr/ifremer/tutti/service
by tchemit@users.forge.codelutin.com Dec. 12, 2012
by tchemit@users.forge.codelutin.com Dec. 12, 2012
Dec. 12, 2012
Author: tchemit
Date: 2012-12-12 23:26:24 +0100 (Wed, 12 Dec 2012)
New Revision: 50
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/50
Log:
add delete species batch (for not valid one when saving them)
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-12 22:25:46 UTC (rev 49)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-12 22:26:24 UTC (rev 50)
@@ -142,6 +142,8 @@
SpeciesBatch saveSpeciesBatch(SpeciesBatch bean);
+ void deleteSpeciesBatch(String id);
+
List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(
String speciesBatchId);
@@ -195,5 +197,4 @@
AccidentelBatch createAccidentelBatch(AccidentelBatch bean);
AccidentelBatch saveAccidentelBatch(AccidentelBatch bean);
-
}
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-12 22:25:46 UTC (rev 49)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-12 22:26:24 UTC (rev 50)
@@ -37,12 +37,12 @@
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.FishingOperationAware;
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
@@ -362,6 +362,11 @@
}
@Override
+ public void deleteSpeciesBatch(String id) {
+ remove(SpeciesBatch.class, id);
+ }
+
+ @Override
public List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(final String speciesBatchId) {
List<SpeciesBatchFrequency> result = Lists.newArrayList(Iterables.filter(getData(SpeciesBatchFrequency.class), new Predicate<SpeciesBatchFrequency>() {
@Override
@@ -725,6 +730,14 @@
return result;
}
+ protected <B extends IdAware> void remove(Class<B> type, String id) {
+ Preconditions.checkNotNull(id, "Can't delete a null id");
+ B bean = getBean(type, id);
+ Preconditions.checkNotNull(bean, "Can't delete a null bean");
+ cache.remove(type, bean);
+ persistToFile(type);
+ }
+
protected <B extends IdAware> B getBean(Class<B> type, String id) {
B result = TuttiEntities.findById(getData(type), id);
return result;
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-12 22:25:46 UTC (rev 49)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-12 22:26:24 UTC (rev 50)
@@ -28,21 +28,21 @@
import fr.ifremer.tutti.persistence.TuttiPersistence;
import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.Strata;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.SeaState;
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.Strata;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -311,6 +311,12 @@
}
@Override
+ public void deleteSpeciesBatch(String id) {
+ checkDriverExists();
+ driver.deleteSpeciesBatch(id);
+ }
+
+ @Override
public List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(String speciesBatchId) {
checkDriverExists();
return driver.getAllSpeciesBatchFrequency(speciesBatchId);
1
0
r49 - trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities
by tchemit@users.forge.codelutin.com Dec. 12, 2012
by tchemit@users.forge.codelutin.com Dec. 12, 2012
Dec. 12, 2012
Author: tchemit
Date: 2012-12-12 23:25:46 +0100 (Wed, 12 Dec 2012)
New Revision: 49
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/49
Log:
make identiy of entity on his id
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-12-12 17:28:37 UTC (rev 48)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-12-12 22:25:46 UTC (rev 49)
@@ -59,4 +59,20 @@
protected <B> B getChild(List<B> child, int index) {
return CollectionUtil.getOrNull(child, index);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof AbstractTuttiEntity)) return false;
+
+ AbstractTuttiEntity that = (AbstractTuttiEntity) o;
+
+ return !(id != null ? !id.equals(that.id) : that.id != null);
+
+ }
+
+ @Override
+ public int hashCode() {
+ return id != null ? id.hashCode() : 0;
+ }
}
\ No newline at end of file
1
0
r48 - in trunk/tutti-ui-swing/src/test: . resources
by tchemit@users.forge.codelutin.com Dec. 12, 2012
by tchemit@users.forge.codelutin.com Dec. 12, 2012
Dec. 12, 2012
Author: tchemit
Date: 2012-12-12 18:28:37 +0100 (Wed, 12 Dec 2012)
New Revision: 48
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/48
Log:
make tests works on jenkins
Added:
trunk/tutti-ui-swing/src/test/resources/
trunk/tutti-ui-swing/src/test/resources/log4j.properties
Copied: trunk/tutti-ui-swing/src/test/resources/log4j.properties (from rev 46, trunk/tutti-ui-swing/src/main/resources/log4j.properties)
===================================================================
--- trunk/tutti-ui-swing/src/test/resources/log4j.properties (rev 0)
+++ trunk/tutti-ui-swing/src/test/resources/log4j.properties 2012-12-12 17:28:37 UTC (rev 48)
@@ -0,0 +1,33 @@
+###
+# #%L
+# Tutti :: UI
+# $Id$
+# $HeadURL$
+# %%
+# Copyright (C) 2012 Ifremer
+# %%
+# 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%
+###
+# Global logging configuration
+log4j.rootLogger=ERROR, stdout
+
+# Console output
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+
+# tutti levels
+log4j.logger.fr.ifremer=INFO
1
0
r47 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content: . operation operation/accidental operation/benthos operation/macrowaste operation/plankton operation/species
by tchemit@users.forge.codelutin.com Dec. 12, 2012
by tchemit@users.forge.codelutin.com Dec. 12, 2012
Dec. 12, 2012
Author: tchemit
Date: 2012-12-12 18:22:58 +0100 (Wed, 12 Dec 2012)
New Revision: 47
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/47
Log:
move last ui from catches package to operation package
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-12 17:06:45 UTC (rev 46)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-12 17:22:58 UTC (rev 47)
@@ -28,10 +28,10 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.accidentel.AccidentelTabUI
- fr.ifremer.tutti.ui.swing.content.catches.benthos.BenthosTabUI
- fr.ifremer.tutti.ui.swing.content.catches.macrodechet.MacroDechetTabUI
- fr.ifremer.tutti.ui.swing.content.catches.plancton.PlanctonTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.accidental.AccidentelTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.benthos.BenthosTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.macrowaste.MacroDechetTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.plankton.PlanctonTabUI
fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesTabUI
jaxx.runtime.swing.editor.bean.BeanComboBox
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#totalWeightLabel {
+ text: "tutti.label.captureAccidentel.totalWeight";
+ labelFor: {totalWeightField};
+}
+
+#totalWeightField {
+ property: "totalWeight";
+ model: {model.getTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text: "tutti.label.captureAccidentel.sampleTotalWeight";
+ labelFor: {totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property: "sampleTotalWeight";
+ model: {model.getSampleTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model: {getContextValue(TableModel.class)};
+ columnModel: {getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<AccidentelTabUIModel, AccidentelTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public AccidentelTabUI(FishingOperationsUI parentUI) {
+ AccidentelTabUIHandler handler = new AccidentelTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <AccidentelTabUIHandler id='handler'
+ initializer='getContextValue(AccidentelTabUIHandler.class)'/>
+
+ <AccidentelTabUIModel id='model'
+ initializer='getContextValue(AccidentelTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.operation.accidental;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentelTabUIHandler extends AbstractTuttiUIHandler<AccidentelTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(AccidentelTabUIHandler.class);
+
+ private final AccidentelTabUI ui;
+
+ private final FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public AccidentelTabUIHandler(FishingOperationsUI parentUi, AccidentelTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ AccidentelTabUIModel model = new AccidentelTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+// col.setCellRenderer(newTableCellRender(Species.class));
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.captureAccidentel.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final AccidentelTableModel tableModel = new AccidentelTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(AccidentelTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ AccidentelTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected AccidentelTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ AccidentelTabUIModel model = ui.getModel();
+
+ List<AccidentelBatch> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new FishingOperation();
+ } else {
+ catches = persistenceService.getAllAccidentelBatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.operation.accidental;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentelTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<AccidentelBatch> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<AccidentelBatch> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<AccidentelBatch> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
+ AccidentelTabUIModel.class).copy(bean, this);
+ }
+
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
+ BinderFactory.newBinder(AccidentelTabUIModel.class,
+ FishingOperation.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.operation.accidental;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class AccidentelTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<SpeciesBatch> data;
+
+ protected final TableColumnModel columnModel;
+
+ public AccidentelTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<SpeciesBatch> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new SpeciesBatch());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/accidental/AccidentelTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.benthos.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.benthos.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosTabUIModel, BenthosTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public BenthosTabUI(FishingOperationsUI parentUI) {
+ BenthosTabUIHandler handler = new BenthosTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <BenthosTabUIHandler id='handler'
+ initializer='getContextValue(BenthosTabUIHandler.class)'/>
+
+ <BenthosTabUIModel id='model'
+ initializer='getContextValue(BenthosTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.operation.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTabUIHandler extends AbstractTuttiUIHandler<BenthosTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(BenthosTabUIHandler.class);
+
+ private final BenthosTabUI ui;
+
+ private final FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public BenthosTabUIHandler(FishingOperationsUI parentUi, BenthosTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ BenthosTabUIModel model = new BenthosTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+// col.setCellRenderer(newTableCellRender(Species.class));
+ col.setHeaderValue(_("tutti.table.benthos.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.benthos.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.benthos.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final BenthosTableModel tableModel = new BenthosTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(BenthosTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ BenthosTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected BenthosTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ BenthosTabUIModel model = ui.getModel();
+
+ List<BenthosBatch> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new FishingOperation();
+ } else {
+ catches = persistenceService.getAllBenthosBatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.operation.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<BenthosBatch> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<BenthosBatch> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<BenthosBatch> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
+ BenthosTabUIModel.class).copy(bean, this);
+ }
+
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
+ BinderFactory.newBinder(BenthosTabUIModel.class,
+ FishingOperation.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.operation.benthos;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class BenthosTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<SpeciesBatch> data;
+
+ protected final TableColumnModel columnModel;
+
+ public BenthosTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<SpeciesBatch> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new SpeciesBatch());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/benthos/BenthosTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.macroDechet.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.macroDechet.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroDechetTabUIModel, MacroDechetTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public MacroDechetTabUI(FishingOperationsUI parentUI) {
+ MacroDechetTabUIHandler handler = new MacroDechetTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <MacroDechetTabUIHandler id='handler'
+ initializer='getContextValue(MacroDechetTabUIHandler.class)'/>
+
+ <MacroDechetTabUIModel id='model'
+ initializer='getContextValue(MacroDechetTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTabUIHandler extends AbstractTuttiUIHandler<MacroDechetTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(MacroDechetTabUIHandler.class);
+
+ private final MacroDechetTabUI ui;
+
+ private final FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public MacroDechetTabUIHandler(FishingOperationsUI parentUi, MacroDechetTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ MacroDechetTabUIModel model = new MacroDechetTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+// col.setCellRenderer(newTableCellRender(Species.class));
+ col.setHeaderValue(_("tutti.table.macroDechet.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.macroDechet.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.macroDechet.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final MacroDechetTableModel tableModel = new MacroDechetTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(MacroDechetTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ MacroDechetTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected MacroDechetTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ MacroDechetTabUIModel model = ui.getModel();
+
+ List<MacroDechetBatch> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new FishingOperation();
+ } else {
+ catches = persistenceService.getAllMacroDechetBatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<MacroDechetBatch> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<MacroDechetBatch> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<MacroDechetBatch> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
+ MacroDechetTabUIModel.class).copy(bean, this);
+ }
+
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
+ BinderFactory.newBinder(MacroDechetTabUIModel.class,
+ FishingOperation.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.operation.macrowaste;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class MacroDechetTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<SpeciesBatch> data;
+
+ protected final TableColumnModel columnModel;
+
+ public MacroDechetTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<SpeciesBatch> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new SpeciesBatch());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/macrowaste/MacroDechetTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
+ bean:{model};
+ showReset:true;
+}
+
+#totalWeightLabel {
+ text:"tutti.label.plancton.totalWeight";
+ labelFor:{totalWeightField};
+}
+
+#totalWeightField {
+ property:"totalWeight";
+ model:{model.getTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#sampleTotalWeightLabel {
+ text:"tutti.label.plancton.sampleTotalWeight";
+ labelFor:{totalWeightField};
+}
+
+#sampleTotalWeightField {
+ property:"sampleTotalWeight";
+ model:{model.getSampleTotalWeight()};
+ useFloat:false;
+ numberPattern:{INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ model:{getContextValue(TableModel.class)};
+ columnModel:{getContextValue(TableColumnModel.class)};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,98 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanctonTabUIModel, PlanctonTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.table.TableModel
+ javax.swing.table.TableColumnModel
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public PlanctonTabUI(FishingOperationsUI parentUI) {
+ PlanctonTabUIHandler handler = new PlanctonTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <PlanctonTabUIHandler id='handler'
+ initializer='getContextValue(PlanctonTabUIHandler.class)'/>
+
+ <PlanctonTabUIModel id='model'
+ initializer='getContextValue(PlanctonTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='sampleTotalWeight' component='sampleTotalWeightField'/>
+ </BeanValidator>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids total échantillonné -->
+ <row>
+ <cell>
+ <JLabel id='sampleTotalWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleTotalWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JTable id='table'/>
+ </JScrollPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,182 @@
+package fr.ifremer.tutti.ui.swing.content.operation.plankton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTabUIHandler extends AbstractTuttiUIHandler<PlanctonTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(PlanctonTabUIHandler.class);
+
+ private final PlanctonTabUI ui;
+
+ private final FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public PlanctonTabUIHandler(FishingOperationsUI parentUi, PlanctonTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ PlanctonTabUIModel model = new PlanctonTabUIModel();
+ ui.setContextValue(model);
+
+ JTable tb = new JTable();
+
+ TableCellEditor defaultEditor = tb.getDefaultEditor(String.class);
+ TableCellRenderer defaultRenderer = tb.getDefaultRenderer(Object.class);
+
+ // prepare the table column model
+ TableColumnModel columnModel = new DefaultTableColumnModel();
+
+ TableColumn col;
+
+ // species (by code) column
+
+ col = new TableColumn(0);
+
+ JComboBox speciesEditor = new JComboBox();
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+ SwingUtil.fillComboBox(speciesEditor, allSpecies, null);
+// col.setCellEditor();
+// col.setCellRenderer(newTableCellRender(Species.class));
+ col.setHeaderValue(_("tutti.table.plancton.header.speciesByCode"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("speciesByCode");
+ columnModel.addColumn(col);
+
+ // Poids observé
+ col = new TableColumn(1);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.plancton.header.weight"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("weight");
+ columnModel.addColumn(col);
+
+ // Nombre observé
+ col = new TableColumn(2);
+ col.setCellEditor(defaultEditor);
+ col.setCellRenderer(defaultRenderer);
+ col.setHeaderValue(_("tutti.table.plancton.header.number"));
+// col.setHeaderRenderer(SwingUtil.newStringTableCellRenderer(dRender,50, true));
+ col.setIdentifier("computedNumber");
+ columnModel.addColumn(col);
+
+ ui.setContextValue(columnModel);
+
+ final PlanctonTableModel tableModel = new PlanctonTableModel(columnModel);
+ ui.setContextValue(tableModel);
+
+ model.addPropertyChangeListener(PlanctonTabUIModel.PROPERTY_CATCHES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ tableModel.setData((List<SpeciesBatch>) evt.getNewValue());
+ }
+ });
+
+ }
+
+ @Override
+ public void afterInitUI() {
+ PlanctonTabUIModel model = ui.getModel();
+
+ initUI(ui);
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected PlanctonTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ PlanctonTabUIModel model = ui.getModel();
+
+ List<PlanctonBatch> catches;
+
+ if (empty) {
+ catches = null;
+ bean = new FishingOperation();
+ } else {
+ catches = persistenceService.getAllPlanctonBatch(bean.getId());
+ }
+
+ model.fromBean(bean);
+ model.setCatches(catches);
+ }
+
+ public void cancel() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition");
+ }
+ }
+
+ public void save() {
+ if (log.isInfoEnabled()) {
+ log.info("Will save");
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.content.operation.plankton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import org.jdesktop.beans.AbstractSerializableBean;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTabUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_SAMPLE_TOTAL_WEIGHT = "sampleTotalWeight";
+
+ public static final String PROPERTY_CATCHES = "catches";
+
+ protected Float totalWeight;
+
+ protected Float sampleTotalWeight;
+
+ protected List<PlanctonBatch> catches;
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getSampleTotalWeight() {
+ return sampleTotalWeight;
+ }
+
+ public void setSampleTotalWeight(Float sampleTotalWeight) {
+ Object oldValue = getSampleTotalWeight();
+ this.sampleTotalWeight = sampleTotalWeight;
+ firePropertyChange(PROPERTY_SAMPLE_TOTAL_WEIGHT, oldValue, sampleTotalWeight);
+ }
+
+ public List<PlanctonBatch> getCatches() {
+ return catches;
+ }
+
+ public void setCatches(List<PlanctonBatch> catches) {
+ Object oldValue = getCatches();
+ this.catches = catches;
+ firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
+ }
+
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
+ PlanctonTabUIModel.class).copy(bean, this);
+ }
+
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
+ BinderFactory.newBinder(PlanctonTabUIModel.class,
+ FishingOperation.class).copy(this, result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java (from rev 46, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -0,0 +1,78 @@
+package fr.ifremer.tutti.ui.swing.content.operation.plankton;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class PlanctonTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ protected List<SpeciesBatch> data;
+
+ protected final TableColumnModel columnModel;
+
+ public PlanctonTableModel(TableColumnModel columnModel) {
+ this.columnModel = columnModel;
+ }
+
+ public void setData(List<SpeciesBatch> data) {
+ if (data == null) {
+ data = Lists.newArrayList();
+ data.add(new SpeciesBatch());
+ }
+ this.data = data;
+ fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return data == null ? 0 : data.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnModel.getColumnCount();
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/plankton/PlanctonTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-12 17:06:45 UTC (rev 46)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-12 17:22:58 UTC (rev 47)
@@ -318,8 +318,9 @@
SpeciesBatchTreeModel samplingTreeModel = model.getSamplingTreeModel();
- if (SAMPLING_PROPERTIES.contains(propertyName)) {
+ if (SAMPLING_PROPERTIES.contains(propertyName) && row.isValid()) {
+
// Need to rebuilt this row sampling tree path (and then recompute
// old super - samplingRatio and new super - samplingRatio)
@@ -333,7 +334,8 @@
moveSamplingNode(samplingTreeModel, row, oldNode, newNode);
}
- if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName)) {
+ if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName) &&
+ row.isValid()) {
// Need to recompute the super - samplingRatio
1
0
Dec. 12, 2012
Author: tchemit
Date: 2012-12-12 18:06:45 +0100 (Wed, 12 Dec 2012)
New Revision: 46
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/46
Log:
- move frequency to their correct pakcage
- being to implement the sampling logic for species batch
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiBeanMonitor.java
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-12 17:06:45 UTC (rev 46)
@@ -33,7 +33,7 @@
actionIcon: "add";
}
-#traitComboBox {
+#fishingOperationComboBox {
property: "selectedFishingOperation";
selectedItem: {model.getSelectedFishingOperation()};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-12 17:06:45 UTC (rev 46)
@@ -62,7 +62,7 @@
<!-- FishingOperations fishingOperation -->
<row>
<cell anchor='west' weightx='1.0'>
- <BeanComboBox id='traitComboBox' constructorParams='this'
+ <BeanComboBox id='fishingOperationComboBox' constructorParams='this'
genericType='FishingOperation'/>
</cell>
<cell anchor='east'>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -25,8 +25,8 @@
*/
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
@@ -48,13 +48,15 @@
public class FishingOperationsUIHandler extends AbstractTuttiUIHandler<FishingOperationsUIModel> {
/** Logger. */
- private static final Log log = LogFactory.getLog(FishingOperationsUIHandler.class);
+ private static final Log log =
+ LogFactory.getLog(FishingOperationsUIHandler.class);
private final FishingOperationsUI ui;
private final PersistenceService persistenceService;
- public FishingOperationsUIHandler(TuttiUIContext context, FishingOperationsUI ui) {
+ public FishingOperationsUIHandler(TuttiUIContext context,
+ FishingOperationsUI ui) {
super(context);
this.ui = ui;
persistenceService = context.getService(PersistenceService.class);
@@ -63,6 +65,9 @@
@Override
public void beforeInitUI() {
+ if (log.isInfoEnabled()) {
+ log.info("for " + ui);
+ }
FishingOperationsUIModel model = new FishingOperationsUIModel();
String cruiseId = context.getCruiseId();
@@ -71,11 +76,13 @@
Cruise cruise = persistenceService.getCruise(cruiseId);
model.setCruise(cruise);
- List<FishingOperation> fishingOperations = persistenceService.getAllFishingOperation(cruiseId);
+ List<FishingOperation> fishingOperations =
+ persistenceService.getAllFishingOperation(cruiseId);
model.setFishingOperation(fishingOperations);
if (log.isInfoEnabled()) {
- log.info("Loaded " + fishingOperations.size() + " fishingOperation(s).");
+ log.info("Loaded " + fishingOperations.size() +
+ " fishingOperation(s).");
}
ui.setContextValue(model);
@@ -90,7 +97,7 @@
List<FishingOperation> fishingOperations = model.getFishingOperation();
- initBeanComboBox(ui.getTraitComboBox(),
+ initBeanComboBox(ui.getFishingOperationComboBox(),
fishingOperations,
model.getSelectedFishingOperation());
@@ -104,8 +111,8 @@
model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_FISHING_OPERATION, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- ui.getTraitComboBox().setData(null);
- ui.getTraitComboBox().setData((List<FishingOperation>) evt.getNewValue());
+ ui.getFishingOperationComboBox().setData(null);
+ ui.getFishingOperationComboBox().setData((List<FishingOperation>) evt.getNewValue());
}
});
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -25,7 +25,6 @@
*/
import com.google.common.base.Preconditions;
-import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -32,7 +32,6 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
import org.apache.commons.collections.CollectionUtils;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -101,7 +101,7 @@
n_("tutti.table.species.batch.header.sampleWeight"),
n_("tutti.table.species.batch.header.sampleWeight"));
- public static final ColumnIdentifier<SpeciesBatchRowModel> ELEVATION_RATIO = ColumnIdentifier.newId(
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SAMPLING_RATIO = ColumnIdentifier.newId(
SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
n_("tutti.table.species.batch.header.elevationRate"),
n_("tutti.table.species.batch.header.elevationRate"));
@@ -122,12 +122,9 @@
public SpeciesBatchTableModel(TableColumnModel columnModel) {
super(columnModel);
- // TODO This will be dynamic by the protocol...
setNoneEditableCols(
- AGE,
- MATURITY,
SAMPLE_WEIGHT,
- ELEVATION_RATIO,
+ SAMPLING_RATIO,
FILE
);
noneEditableColIfNoSpecies = Sets.newHashSet();
@@ -177,6 +174,17 @@
}
}
+ public void updateSamplingRatio(Set<SpeciesBatchRowModel> rows) {
+ for (SpeciesBatchRowModel row : rows) {
+ int rowIndex = getRows().indexOf(row);
+ fireTableCellUpdated(rowIndex,
+ SAMPLE_WEIGHT,
+ SAMPLING_RATIO);
+ }
+
+
+ }
+
@Override
protected boolean isCellEditable(int rowIndex,
int columnIndex,
@@ -196,5 +204,4 @@
}
return result;
}
-
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -24,12 +24,14 @@
* #L%
*/
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import java.io.Serializable;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* @author tchemit <chemit(a)codelutin.com>
@@ -51,52 +53,180 @@
*
* @since 0.2
*/
- protected final String[] samplingOrder;
+ protected String[] samplingOrder;
/**
- * Samplings view as a linear list (to display in the table).
+ * Mapping from row to node.
*
* @since 0.2
*/
- protected final List<SpeciesBatchTreeNode> lines;
+ protected final Map<SpeciesBatchRowModel, SpeciesBatchTreeNode> rowToNode;
+ /**
+ * Mapping from node to row.
+ *
+ * @since 0.2
+ */
+ protected final Map<SpeciesBatchTreeNode, SpeciesBatchRowModel> nodeToRow;
+
+
public SpeciesBatchTreeModel(String... samplingOrder) {
this.samplingOrder = samplingOrder;
root = new SpeciesBatchTreeNode();
- lines = Lists.newArrayList();
+ rowToNode = Maps.newHashMap();
+ nodeToRow = Maps.newHashMap();
}
- public SpeciesBatchTreeNode getNode(int rowIndex) {
- return lines.get(rowIndex);
+ public void populate(List<SpeciesBatchRowModel> rows) {
+
+ clear();
+
+ for (SpeciesBatchRowModel row : rows) {
+
+ SpeciesBatchTreeNode node = getSamplingNode(row);
+
+ nodeToRow.put(node, row);
+ }
}
- public int getSize() {
- return lines.size();
+ public String[] getSamplingOrder() {
+ return samplingOrder;
}
- public void populate(List<SpeciesBatch> data) {
+ public void setSamplingOrder(String... samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ clear();
+ }
+ protected void clear() {
// clear tree representation
root.removeAllChildren();
- // clear linear representation
- lines.clear();
+ // clear mappings
+ rowToNode.clear();
+ nodeToRow.clear();
}
- public Object[] getSamplingKey(SpeciesBatch bean) {
- List<Object> result = Lists.newArrayList();
- for (String s : samplingOrder) {
- Object property = TuttiUIUtil.getProperty(bean, s);
- if (property == null) {
- // stop findind sample key
- break;
+
+ public SpeciesBatchTreeNode removeNodeFromCache(SpeciesBatchRowModel row) {
+ SpeciesBatchTreeNode result = rowToNode.remove(row);
+ if (result != null) {
+
+ nodeToRow.remove(result);
+ }
+ return result;
+ }
+
+ public SpeciesBatchTreeNode getSamplingNode(SpeciesBatchRowModel row) {
+
+ // search frist in cache
+ SpeciesBatchTreeNode result = rowToNode.get(row);
+
+ if (result == null) {
+
+ // not in cache must build the path
+ result = getSamplingNode(root, 0, row);
+
+ // and add it in cache
+ rowToNode.put(row, result);
+ }
+ return result;
+ }
+
+ protected SpeciesBatchTreeNode getSamplingNode(SpeciesBatchTreeNode node,
+ int samplingIndex,
+ SpeciesBatchRowModel row) {
+
+ String samplingKey = samplingOrder[samplingIndex];
+
+ Serializable samplingValue = (Serializable)
+ TuttiUIUtil.getProperty(row, samplingKey);
+
+ SpeciesBatchTreeNode result;
+
+ if (samplingValue == null) {
+
+ // was already on last sampling node
+ result = node;
+ } else {
+
+ result = node.getChild(samplingValue);
+
+ if (result == null) {
+
+ // new node, creates it and add it as child of current node
+ result = new SpeciesBatchTreeNode(samplingKey, samplingValue);
+ node.add(result);
}
- result.add(property);
+
+ if (samplingIndex < samplingOrder.length) {
+
+ // can try to find yet another sampling level
+ result = getSamplingNode(result, samplingIndex + 1, row);
+ }
}
- return result.toArray();
+
+ return result;
}
- public String[] getSamplingDefinition(SpeciesBatch bean) {
- return null;
+ public SamplingContext createSamplingContext(SpeciesBatchTreeNode rootNode) {
+
+ Set<SpeciesBatchRowModel> childRows = Sets.newHashSet();
+
+ SpeciesBatchRowModel superSamplingRow = nodeToRow.get(rootNode);
+ float totalWeight = 0f;
+ for (int i = 0, nbChildren = rootNode.getChildCount(); i < nbChildren; i++) {
+ SpeciesBatchTreeNode node = rootNode.getChildAt(i);
+ SpeciesBatchRowModel row = nodeToRow.get(node);
+ if (row != null) {
+ childRows.add(row);
+ Float weight = row.getWeight();
+ if (weight != null) {
+ totalWeight += weight;
+ }
+ }
+ }
+ SamplingContext result = new SamplingContext(rootNode,
+ superSamplingRow,
+ childRows,
+ totalWeight);
+ return result;
}
+
+ public static class SamplingContext {
+
+ private final SpeciesBatchTreeNode rootNode;
+
+ private final SpeciesBatchRowModel superSamplingRow;
+
+ private final Set<SpeciesBatchRowModel> samplingRows;
+
+ private final float totalWeight;
+
+ public SamplingContext(SpeciesBatchTreeNode rootNode,
+ SpeciesBatchRowModel superSamplingRow,
+ Set<SpeciesBatchRowModel> samplingRows,
+ float totalWeight) {
+ this.rootNode = rootNode;
+ this.superSamplingRow = superSamplingRow;
+ this.samplingRows = samplingRows;
+ this.totalWeight = totalWeight;
+ }
+
+ public SpeciesBatchTreeNode getRootNode() {
+ return rootNode;
+ }
+
+ public SpeciesBatchRowModel getSuperSamplingRow() {
+ return superSamplingRow;
+ }
+
+ public Set<SpeciesBatchRowModel> getSamplingRows() {
+ return samplingRows;
+ }
+
+ public float getTotalWeight() {
+ return totalWeight;
+ }
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -24,20 +24,18 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import org.apache.commons.lang3.ObjectUtils;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import java.io.Serializable;
/**
- * Defines a node of a species catches.
+ * Defines a node of a species catches sampling.
* <p/>
- * UserObject is the {@link SpeciesBatch}. It can be null on two cases:
- * <ul>
- * <li>On root node</li>
- * <li>For node on a path of sampling but with no filled data </li>
- * </ul>
+ * A path in the tree gives a sampling path.
+ * <p/>
+ * UserObject is the {@code samplingValue}. It can be null only on root node.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
@@ -53,43 +51,55 @@
*
* @since 0.2
*/
- protected final String samplingPropertyKey;
+ protected final String samplingKey;
- /**
- * Property value defining the sampling.
- * <p/>
- * <strong>Note:</strong> can be null (only for root node).
- *
- * @since 0.2
- */
- protected final Serializable samplingPropertyValue;
-
public SpeciesBatchTreeNode() {
- this(null, null, null);
+ this(null, null);
}
- public SpeciesBatchTreeNode(SpeciesBatch userObject,
- String samplingPropertyKey,
- Serializable samplingPropertyValue) {
- this.samplingPropertyKey = samplingPropertyKey;
- this.samplingPropertyValue = samplingPropertyValue;
- setUserObject(userObject);
+ public SpeciesBatchTreeNode(String samplingKey,
+ Serializable samplingValue) {
+ this.samplingKey = samplingKey;
+ setUserObject(samplingValue);
}
public String getSamplingPropertyKey() {
- return samplingPropertyKey;
+ return samplingKey;
}
- public Serializable getSamplingPropertyValue() {
- return samplingPropertyValue;
+ public boolean matchSamplingValue(Serializable value) {
+ Serializable samplingValue = getUserObject();
+
+ boolean result = ObjectUtils.equals(value, samplingValue);
+ return result;
}
+ public SpeciesBatchTreeNode getChild(Serializable samplingValue) {
+ SpeciesBatchTreeNode result = null;
+
+ for (int i = 0, max = getChildCount(); i < max; i++) {
+ SpeciesBatchTreeNode child = getChildAt(i);
+ if (child.matchSamplingValue(samplingValue)) {
+
+ // found matching child
+ result = child;
+ break;
+ }
+ }
+ return result;
+ }
+
@Override
- public SpeciesBatch getUserObject() {
- return (SpeciesBatch) super.getUserObject();
+ public Serializable getUserObject() {
+ return (Serializable) super.getUserObject();
}
@Override
+ public SpeciesBatchTreeNode getChildAt(int index) {
+ return (SpeciesBatchTreeNode) super.getChildAt(index);
+ }
+
+ @Override
public SpeciesBatchTreeNode getParent() {
return (SpeciesBatchTreeNode) super.getParent();
}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,169 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import com.google.common.collect.Ordering;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.List;
+
+/**
+ * Represents a batch frequency row.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, SpeciesFrequencyRowModel> implements Comparable<SpeciesFrequencyRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_LENGTH_STEP = "lengthStep";
+
+ public static final String PROPERTY_NUMBER = "number";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
+
+ /**
+ * Length step.
+ *
+ * @since 0.2
+ */
+ protected Float lengthStep;
+
+ /**
+ * Count of fishes for this lengthStep.
+ *
+ * @since 0.2
+ */
+ protected Integer number;
+
+ /**
+ * Weight of fishes observed.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Computed weight from number + relation taille-poids.
+ *
+ * @since 0.2
+ */
+ protected Float computedWeight;
+
+ protected static final Binder<SpeciesBatchFrequency, SpeciesFrequencyRowModel> fromBeanBinder =
+ BinderFactory.newBinder(SpeciesBatchFrequency.class,
+ SpeciesFrequencyRowModel.class);
+
+ protected static final Binder<SpeciesFrequencyRowModel, SpeciesBatchFrequency> toBeanBinder =
+ BinderFactory.newBinder(SpeciesFrequencyRowModel.class,
+ SpeciesBatchFrequency.class);
+
+ private static final Ordering<Float> ordering = Ordering.natural().nullsFirst();
+
+ public static List<SpeciesFrequencyRowModel> fromBeans(List<SpeciesBatchFrequency> frequency) {
+ List<SpeciesFrequencyRowModel> result = Lists.newArrayList();
+ for (SpeciesBatchFrequency b : frequency) {
+ SpeciesFrequencyRowModel model = new SpeciesFrequencyRowModel();
+ fromBeanBinder.copy(b, model);
+ result.add(model);
+ }
+ return result;
+ }
+
+ public static List<SpeciesBatchFrequency> toBeans(List<SpeciesFrequencyRowModel> frequency, SpeciesBatch batch) {
+ List<SpeciesBatchFrequency> result = Lists.newArrayList();
+ for (SpeciesFrequencyRowModel b : frequency) {
+ SpeciesBatchFrequency model = new SpeciesBatchFrequency();
+ toBeanBinder.copy(b, model);
+ model.setBatch(batch);
+ result.add(model);
+ }
+ return result;
+ }
+
+ public SpeciesFrequencyRowModel() {
+ super(SpeciesBatchFrequency.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public Float getLengthStep() {
+ return lengthStep;
+ }
+
+ public void setLengthStep(Float lengthStep) {
+ Object oldValue = getLengthStep();
+ this.lengthStep = lengthStep;
+ firePropertyChange(PROPERTY_LENGTH_STEP, oldValue, lengthStep);
+ }
+
+ public Integer getNumber() {
+ return number;
+ }
+
+ public void setNumber(Integer number) {
+ Object oldValue = getNumber();
+ this.number = number;
+ firePropertyChange(PROPERTY_NUMBER, oldValue, number);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public Float getComputedWeight() {
+ return computedWeight;
+ }
+
+ public void setComputedWeight(Float computedWeight) {
+ Object oldValue = getComputedWeight();
+ this.computedWeight = computedWeight;
+ firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue, computedWeight);
+ }
+
+ //TODO Use validator
+ @Override
+ public boolean isValid() {
+ return lengthStep != null && number != null;
+ }
+
+ @Override
+ public int compareTo(SpeciesFrequencyRowModel o) {
+ int result = ordering.compare(lengthStep, o.lengthStep);
+ return result;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,145 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+import java.util.List;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Model of the species frequency table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyTableModel extends AbstractTuttiTableModel<SpeciesFrequencyRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> LENGTH_STEP = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_LENGTH_STEP,
+ n_("tutti.table.species.frequency.header.lengthStep"),
+ n_("tutti.table.species.frequency.header.lengthStep"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> NUMBER = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_NUMBER,
+ n_("tutti.table.species.frequency.header.number"),
+ n_("tutti.table.species.frequency.header.number"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> WEIGHT = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.species.frequency.header.weight"),
+ n_("tutti.table.species.frequency.header.weight"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT,
+ n_("tutti.table.species.frequency.header.computedWeight"),
+ n_("tutti.table.species.frequency.header.computedWeight"));
+
+ private final SpeciesFrequencyUIModel uiModel;
+
+ private final Map<Float, SpeciesFrequencyRowModel> rowCache;
+
+ public SpeciesFrequencyTableModel(TableColumnModel columnModel,
+ SpeciesFrequencyUIModel uiModel) {
+ super(columnModel);
+ this.uiModel = uiModel;
+ this.rowCache = Maps.newTreeMap();
+ setNoneEditableCols(COMPUTED_WEIGHT);
+ }
+
+ @Override
+ protected SpeciesFrequencyRowModel createNewRow() {
+ Float defaultStep = null;
+
+ int rowCount = getRowCount();
+ if (rowCount > 0) {
+
+ SpeciesFrequencyRowModel rowModel = getEntry(rowCount - 1);
+ Float lengthStep = rowModel.getLengthStep();
+ if (lengthStep != null) {
+ defaultStep = uiModel.getLengthStep(
+ lengthStep + uiModel.getStep());
+ }
+ }
+ SpeciesFrequencyRowModel result = new SpeciesFrequencyRowModel();
+ result.setLengthStep(defaultStep);
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<SpeciesFrequencyRowModel> propertyName,
+ SpeciesFrequencyRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+ // TODO Rebuild the computedWeight if possible...
+ }
+
+ public Map<Float, SpeciesFrequencyRowModel> getRowCache() {
+ return rowCache;
+ }
+
+ @Override
+ protected void onRowsChanged(List<SpeciesFrequencyRowModel> data) {
+
+ // rebuild row cache
+ rowCache.clear();
+
+ for (SpeciesFrequencyRowModel row : data) {
+ Float lengthStep = row.getLengthStep();
+ if (lengthStep != null) {
+ rowCache.put(lengthStep, row);
+ }
+ }
+ }
+
+ @Override
+ protected void onRowAdded(int rowIndex, SpeciesFrequencyRowModel newValue) {
+
+ Preconditions.checkNotNull(newValue, "can't add a null row");
+
+ // add new row to cache
+ Float lengthStep = newValue.getLengthStep();
+
+ Preconditions.checkNotNull(lengthStep,
+ "can't add a null lengthStep row");
+
+ float roundLenghtValue = uiModel.getLengthStep(lengthStep);
+
+ if (!rowCache.containsKey(roundLenghtValue)) {
+
+ rowCache.put(roundLenghtValue, newValue);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,141 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+}
+
+#stepLabel {
+ text: "tutti.label.frequencyConfiguration.step";
+ labelFor: {stepField};
+}
+
+#stepField {
+ property: "step";
+ model: {model.getStep()};
+ useFloat: true;
+ numberPattern: {DECIMAL1_PATTERN};
+ bean: {model};
+}
+
+#minStepLabel {
+ text: "tutti.label.frequencyConfiguration.minStep";
+ labelFor: {minStepField};
+}
+
+#minStepField {
+ property: "minStep";
+ model: {model.getMinStep()};
+ useFloat: true;
+ showReset: true;
+ numberPattern: {DECIMAL1_PATTERN};
+ bean: {model};
+}
+
+#maxStepLabel {
+ text: "tutti.label.frequencyConfiguration.maxStep";
+ labelFor: {maxStepField};
+}
+
+#maxStepField {
+ property: "maxStep";
+ model: {model.getMaxStep()};
+ useFloat: true;
+ showReset: true;
+ numberPattern: {DECIMAL1_PATTERN};
+ bean: {model};
+}
+
+#rafaleStepLabel {
+ text: "tutti.label.frequencyConfiguration.rafaleStep";
+ labelFor: {rafaleStepField};
+}
+
+#rafaleStepField {
+ modelType: {Float.class};
+ useFloat: true;
+ showReset: true;
+ numberPattern: {DECIMAL1_PATTERN};
+}
+
+#generateButton {
+ actionIcon: "generate";
+ text: "tutti.action.generate";
+ enabled: {model.isCanGenerate()};
+}
+
+#configurationPanel {
+ border: {new TitledBorder(null, _("tutti.legend.frequencyConfiguration"))};
+}
+
+#modeConfigurationLayout {
+ selected: {String.valueOf(mode.getSelectedValue())};
+}
+
+#modeConfigurationPanel {
+ layout: {modeConfigurationLayout};
+}
+
+#simpleModeButton {
+ text: "tutti.label.frequencyConfiguration.mode.simple";
+ toolTipText: "tutti.label.frequencyConfiguration.mode.simple.tip";
+ value: "simpleMode";
+ selected: {model.isSimpleMode()};
+ buttonGroup: "mode";
+}
+
+#simpleModeLabel {
+ text: "tutti.label.frequencyConfiguration.no.configuration";
+ horizontalAlignment: {JLabel.CENTER};
+ enabled: false;
+}
+
+#autoGenModeButton {
+ text: "tutti.label.frequencyConfiguration.mode.autoGen";
+ toolTipText: "tutti.label.frequencyConfiguration.mode.autoGen.tip";
+ value: "autoGenMode";
+ selected: {model.isAutoGenMode()};
+ buttonGroup: "mode";
+}
+
+#rafaleModeButton {
+ text: "tutti.label.frequencyConfiguration.mode.rafale";
+ toolTipText: "tutti.label.frequencyConfiguration.mode.rafale.tip";
+ value: "rafaleMode";
+ selected: {model.isRafaleMode()};
+ buttonGroup: "mode";
+}
+
+#closeButton {
+ actionIcon: "close";
+ text: "tutti.action.close";
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,167 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesFrequencyUIModel, SpeciesFrequencyUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchRowModel
+
+ jaxx.runtime.swing.CardLayout2Ext
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.swing.editor.NumberEditor
+
+ org.jdesktop.swingx.JXTable
+
+ javax.swing.ListSelectionModel
+ javax.swing.SwingConstants
+
+ java.awt.Color
+ java.awt.Dimension
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+ public SpeciesFrequencyUI(TuttiUIContext context) {
+ SpeciesFrequencyUIHandler handler = new SpeciesFrequencyUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ public void editBatch(SpeciesBatchRowModel row) {
+ handler.editBatch(row);
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <SpeciesFrequencyUIHandler id='handler'
+ initializer='getContextValue(SpeciesFrequencyUIHandler.class)'/>
+
+ <SpeciesFrequencyUIModel id='model'
+ initializer='getContextValue(SpeciesFrequencyUIModel.class)'/>
+
+ <CardLayout2Ext id='modeConfigurationLayout'
+ constructorParams='this, "modeConfigurationPanel"'/>
+
+ <JPanel id='configurationPanel' layout='{new BorderLayout()}' constraints='BorderLayout.NORTH'>
+
+ <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.CENTER'>
+ <VBox id='modePanel' constraints='BorderLayout.WEST'
+ verticalAlignment='{SwingConstants.CENTER}'>
+ <JRadioButton id='simpleModeButton'
+ onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE)'/>
+ <JRadioButton id='autoGenModeButton'
+ onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.AUTO_GEN)'/>
+ <JRadioButton id='rafaleModeButton'
+ onActionPerformed='model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.RAFALE)'/>
+ </VBox>
+
+ <JPanel id='modeConfigurationPanel' constraints='BorderLayout.CENTER'>
+ <JPanel id='simpleModePanel' constraints='"simpleMode"'
+ layout='{new BorderLayout()}'>
+ <JLabel id='simpleModeLabel' constraints='BorderLayout.CENTER'/>
+ </JPanel>
+ <JPanel id='autoGenModePanel' constraints='"autoGenMode"'>
+ <Table fill='both' constraints='BorderLayout.SOUTH'>
+ <!-- Min step-->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='minStepLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='minStepField' constructorParams='this'/>
+ </cell>
+ </row>
+ <!-- Max step-->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='maxStepLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='maxStepField' constructorParams='this'/>
+ </cell>
+ </row>
+ <!-- Actions -->
+ <row>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JButton id='generateButton'
+ onActionPerformed='handler.generateLengthSteps()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ <JPanel id='rafaleModePanel' constraints='"rafaleMode"'>
+ <Table fill='both' constraints='BorderLayout.SOUTH'>
+ <!-- Rafale step-->
+ <row>
+ <cell weightx='1.0'>
+ <JLabel id='rafaleStepLabel'/>
+ </cell>
+ </row>
+ <row>
+ <cell weightx='1.0'>
+ <NumberEditor id='rafaleStepField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </JPanel>
+ </JPanel>
+ <Table fill='both' constraints='BorderLayout.SOUTH'>
+ <row>
+ <cell columns='2'>
+ <JSeparator/>
+ </cell>
+ </row>
+ <!-- Step -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='stepLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='stepField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table'/>
+ </JScrollPane>
+
+ <!-- actions -->
+ <JPanel id='actionPanel' layout='{new GridLayout(1, 0)}'
+ constraints='BorderLayout.SOUTH'>
+ <JButton id='closeButton' onActionPerformed='handler.close()'/>
+ </JPanel>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,350 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+
+import javax.swing.JDialog;
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<SpeciesFrequencyRowModel, SpeciesFrequencyUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SpeciesFrequencyUIHandler.class);
+
+ private final SpeciesFrequencyUI ui;
+
+ public SpeciesFrequencyUIHandler(TuttiUIContext context,
+ SpeciesFrequencyUI ui) {
+ super(context,
+ SpeciesFrequencyRowModel.PROPERTY_LENGTH_STEP,
+ SpeciesFrequencyRowModel.PROPERTY_NUMBER,
+ SpeciesFrequencyRowModel.PROPERTY_WEIGHT,
+ SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT);
+ this.ui = ui;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ protected SpeciesFrequencyUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ protected SpeciesFrequencyTableModel getTableModel() {
+ return (SpeciesFrequencyTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
+
+ { // LengthStep
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.LENGTH_STEP,
+ TuttiUI.DECIMAL1_PATTERN);
+ }
+
+ { // Number
+
+ addIntegerColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.NUMBER,
+ TuttiUI.INT_6_DIGITS_PATTERN);
+ }
+
+ { // Weight
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // ComputedWeight
+
+ addFloatColumnToModel(columnModel,
+ SpeciesFrequencyTableModel.COMPUTED_WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(SpeciesFrequencyRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+ if (SpeciesFrequencyRowModel.PROPERTY_NUMBER.equals(propertyName)) {
+
+ // Need to recompute the computedWeight
+ computeComputedWeight(row);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public void beforeInitUI() {
+
+ SpeciesFrequencyUIModel model = new SpeciesFrequencyUIModel();
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ SpeciesFrequencyUIModel model = getModel();
+
+ // create table model
+ SpeciesFrequencyTableModel tableModel =
+ new SpeciesFrequencyTableModel(columnModel, model);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ installTableKeyListener(columnModel, table);
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+ table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
+
+ // when model datas change let's propagate it table model
+ listenRowsFromModel();
+
+ //TODO Should it come from PROTOCOL or config ?
+ model.setStep(.5f);
+
+ model.setMinStep(10f);
+ model.setMaxStep(20f);
+
+ //TODO Configure this ?
+ model.setConfigurationMode(SpeciesFrequencyUIModel.ConfigurationMode.SIMPLE);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
+
+ ui.getRafaleStepField().getTextField().addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ e.consume();
+ Float step = (Float) ui.getRafaleStepField().getModel();
+
+ applyRafaleStep(step);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
+ public void generateLengthSteps() {
+
+ SpeciesFrequencyUIModel model = getModel();
+
+ Map<Float, SpeciesFrequencyRowModel> rowsByStep =
+ getTableModel().getRowCache();
+
+ Float minStep = model.getLengthStep(model.getMinStep());
+ Float maxStep = model.getLengthStep(model.getMaxStep());
+
+ for (float i = minStep, step = model.getStep(); i <= maxStep; i += step) {
+ if (!rowsByStep.containsKey(i)) {
+
+ // add it
+ SpeciesFrequencyRowModel newRow = new SpeciesFrequencyRowModel();
+ newRow.setLengthStep(i);
+ rowsByStep.put(i, newRow);
+ }
+ }
+
+ List<SpeciesFrequencyRowModel> rows =
+ Lists.newArrayList(rowsByStep.values());
+
+ model.setRows(rows);
+ }
+
+ public void applyRafaleStep(Float step) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will apply rafale step: " + step);
+ }
+ SpeciesFrequencyUIModel model = getModel();
+ SpeciesFrequencyTableModel tableModel = getTableModel();
+
+ Map<Float, SpeciesFrequencyRowModel> rowsByStep = tableModel.getRowCache();
+
+ float aroundLengthStep = model.getLengthStep(step);
+
+ SpeciesFrequencyRowModel row = rowsByStep.get(aroundLengthStep);
+
+ int rowIndex;
+
+ if (row != null) {
+
+ // increments current row
+ Integer number = row.getNumber();
+ row.setNumber((number == null ? 0 : number) + 1);
+ rowIndex = tableModel.updateRow(row);
+
+ } else {
+
+ // create a new row
+ row = new SpeciesFrequencyRowModel();
+ row.setLengthStep(aroundLengthStep);
+ row.setNumber(1);
+
+ // get new index
+ List<Float> steps = Lists.newArrayList(rowsByStep.keySet());
+ steps.add(aroundLengthStep);
+
+ Collections.sort(steps);
+
+ rowIndex = steps.indexOf(aroundLengthStep);
+
+ tableModel.addNewRow(rowIndex, row);
+ }
+
+ getTable().scrollRowToVisible(rowIndex);
+ }
+
+ public void editBatch(SpeciesBatchRowModel row) {
+
+ List<SpeciesFrequencyRowModel> frequency = null;
+ if (row != null) {
+ frequency = row.getFrequency();
+ }
+
+ List<SpeciesFrequencyRowModel> editFrequency;
+ if (CollectionUtils.isEmpty(frequency)) {
+
+ // new list
+ editFrequency = Lists.newArrayList();
+ } else {
+
+ editFrequency = Lists.newArrayList(frequency);
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Will edit batch row: " + row + " with " +
+ editFrequency.size() + " frequency");
+ }
+ getModel().setRows(editFrequency);
+
+ // keep batch (will be used to push back editing entry)
+ getModel().setBatch(row);
+ }
+
+ public void close() {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will close UI " + ui);
+ }
+
+ // transfer rows to editor
+
+ List<SpeciesFrequencyRowModel> frequency = Lists.newArrayList();
+ for (SpeciesFrequencyRowModel row : getModel().getRows()) {
+ if (row.isValid()) {
+
+ // can keep this row
+ frequency.add(row);
+ }
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Push back " + frequency.size() +
+ " frequency to batch " + getModel().getBatch());
+ }
+
+ // push back to batch
+ getModel().getBatch().setFrequency(frequency);
+
+ ui.editBatch(null);
+
+ SwingUtil.getParentContainer(ui, JDialog.class).setVisible(false);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected void computeComputedWeight(SpeciesFrequencyRowModel row) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will recompute computed weight for frequency: " + row);
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java (from rev 41, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,174 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyUIModel extends AbstractTuttiTableUIModel<SpeciesBatchRowModel, SpeciesFrequencyRowModel, SpeciesFrequencyUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_CONFIGURATION_MODE = "configurationMode";
+
+ public static final String PROPERTY_STEP = "step";
+
+ private static final String PROPERTY_MIN_STEP = "minStep";
+
+ private static final String PROPERTY_MAX_STEP = "maxStep";
+
+ public static final String PROPERTY_CAN_GENERATE = "canGenerate";
+
+ public static final String PROPERTY_SIMPLE_MODE = "simpleMode";
+
+ public static final String PROPERTY_AUTO_GEN_MODE = "autoGenMode";
+
+ public static final String PROPERTY_RAFALE_MODE = "rafaleMode";
+
+ public static enum ConfigurationMode {
+ SIMPLE,
+ AUTO_GEN,
+ RAFALE
+ }
+
+ /**
+ * Fill mode.
+ *
+ * @since 0.2
+ */
+ protected ConfigurationMode configurationMode;
+
+ /**
+ * Batch that contains frequencies.
+ *
+ * @since 0.2
+ */
+ protected SpeciesBatchRowModel batch;
+
+ /**
+ * Default step to increment length step.
+ *
+ * @since 0.2
+ */
+ protected float step;
+
+ /**
+ * Min step to auto generate length steps.
+ *
+ * @since 0.2
+ */
+ protected Float minStep;
+
+ /**
+ * Max step to auto generate length steps.
+ *
+ * @since 0.2
+ */
+ protected Float maxStep;
+
+ public SpeciesFrequencyUIModel() {
+ super(SpeciesBatchRowModel.class, null, null);
+ }
+
+ public ConfigurationMode getConfigurationMode() {
+ return configurationMode;
+ }
+
+ public void setConfigurationMode(ConfigurationMode configurationMode) {
+ Object oldValue = getConfigurationMode();
+ this.configurationMode = configurationMode;
+ firePropertyChange(PROPERTY_CONFIGURATION_MODE, oldValue, configurationMode);
+ firePropertyChange(PROPERTY_SIMPLE_MODE, null, isSimpleMode());
+ firePropertyChange(PROPERTY_AUTO_GEN_MODE, null, isAutoGenMode());
+ firePropertyChange(PROPERTY_RAFALE_MODE, null, isRafaleMode());
+ }
+
+ public float getStep() {
+ return step;
+ }
+
+ public void setStep(float step) {
+ Object oldValue = getStep();
+ this.step = step;
+ firePropertyChange(PROPERTY_STEP, oldValue, step);
+ }
+
+ public Float getMinStep() {
+ return minStep;
+ }
+
+ public void setMinStep(Float minStep) {
+ Object oldValue = getMinStep();
+ this.minStep = minStep;
+ firePropertyChange(PROPERTY_MIN_STEP, oldValue, minStep);
+ firePropertyChange(PROPERTY_CAN_GENERATE, null, isCanGenerate());
+ }
+
+ public Float getMaxStep() {
+ return maxStep;
+ }
+
+ public void setMaxStep(Float maxStep) {
+ Object oldValue = getMaxStep();
+ this.maxStep = maxStep;
+ firePropertyChange(PROPERTY_MAX_STEP, oldValue, maxStep);
+ firePropertyChange(PROPERTY_CAN_GENERATE, null, isCanGenerate());
+ }
+
+ public boolean isSimpleMode() {
+ return ConfigurationMode.SIMPLE == configurationMode;
+ }
+
+ public boolean isAutoGenMode() {
+ return ConfigurationMode.AUTO_GEN == configurationMode;
+ }
+
+ public boolean isRafaleMode() {
+ return ConfigurationMode.RAFALE == configurationMode;
+ }
+
+ public boolean isCanGenerate() {
+ return minStep != null && maxStep != null && maxStep > minStep;
+ }
+
+ public SpeciesBatchRowModel getBatch() {
+ return batch;
+ }
+
+ public void setBatch(SpeciesBatchRowModel batch) {
+ this.batch = batch;
+ }
+
+ public float getLengthStep(float lengthStep) {
+ int intValue = (int) (lengthStep * 10);
+ int intStep = (int) (step * 10);
+ int correctIntStep = intValue - (intValue % intStep);
+ float result = correctIntStep / 10f;
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css 2012-12-12 17:06:45 UTC (rev 46)
@@ -71,10 +71,8 @@
}
#totalHorsVracWeightField {
- property: "totalHorsVracWeight";
- model: {model.getTotalHorsVracWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
+ text: {getStringValue(model.getTotalHorsVracWeight())};
+ editable: false;
}
#table {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx 2012-12-12 17:06:45 UTC (rev 46)
@@ -29,7 +29,7 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
- fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesFrequencyUI
org.jdesktop.swingx.JXTable
@@ -43,6 +43,7 @@
java.awt.Color
static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
</import>
<script><![CDATA[
@@ -106,7 +107,7 @@
<JLabel id='totalHorsVracWeightLabel'/>
</cell>
<cell>
- <NumberEditor id='totalHorsVracWeightField' constructorParams='this'/>
+ <JTextField id='totalHorsVracWeightField'/>
</cell>
</row>
</Table>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -24,7 +24,9 @@
* #L%
*/
+import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
@@ -37,9 +39,10 @@
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
-import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.tutti.ui.swing.util.table.TableRowModificationListener;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -49,9 +52,13 @@
import org.nuiton.util.beans.BeanMonitor;
import org.nuiton.util.decorator.Decorator;
+import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableColumnModel;
import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
import java.util.List;
+import java.util.Set;
/**
* @author tchemit <chemit(a)codelutin.com>
@@ -62,18 +69,45 @@
/** Logger. */
private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
+ public static final Set<String> RECOMPUTE_TOTAL_WEIGHT = Sets.newHashSet(
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT
+ );
+
+ public static final Set<String> SAMPLING_PROPERTIES = Sets.newHashSet(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX,
+ SpeciesBatchRowModel.PROPERTY_MATURITY,
+ SpeciesBatchRowModel.PROPERTY_AGE
+ );
+
+ /**
+ * UI.
+ *
+ * @since 0.2
+ */
private final SpeciesTabUI ui;
- private final FishingOperationsUI parentUi;
-
+ /**
+ * Persistence service.
+ *
+ * @since 0.2
+ */
private final PersistenceService persistenceService;
- private final BeanMonitor traitMonitor;
+ /**
+ * To monitor changes on the fishing operation.
+ *
+ * @since 0.2
+ */
+ private final BeanMonitor fishingOperationMonitor;
public SpeciesTabUIHandler(FishingOperationsUI parentUi, SpeciesTabUI ui) {
super(parentUi.getHandler().getContext(),
+ SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
SpeciesBatchRowModel.PROPERTY_SPECIES,
- SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
SpeciesBatchRowModel.PROPERTY_SEX,
@@ -85,9 +119,8 @@
SpeciesBatchRowModel.PROPERTY_COMMENT,
SpeciesBatchRowModel.PROPERTY_FREQUENCY);
this.ui = ui;
- this.parentUi = parentUi;
this.persistenceService = context.getService(PersistenceService.class);
- traitMonitor = new BeanMonitor(
+ this.fishingOperationMonitor = new BeanMonitor(
SpeciesTabUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
SpeciesTabUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
SpeciesTabUIModel.PROPERTY_TOTAL_VRAC_WEIGHT,
@@ -95,9 +128,13 @@
);
}
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTableUIHandler methods --//
+ //------------------------------------------------------------------------//
+
@Override
- protected JXTable getTable() {
- return ui.getTable();
+ protected SpeciesTabUIModel getModel() {
+ return ui.getModel();
}
@Override
@@ -106,24 +143,242 @@
}
@Override
- protected SpeciesTabUIModel getModel() {
- return ui.getModel();
+ protected JXTable getTable() {
+ return ui.getTable();
}
@Override
+ protected void onModelRowsChanged(List<SpeciesBatchRowModel> rows) {
+ super.onModelRowsChanged(rows);
+
+ // build the new sampling tree from the new rows to edit
+ getModel().getSamplingTreeModel().populate(rows);
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ List<String> samplingOrder = getModel().getSamplingOrder();
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ {
+ // Species to confirm column
+
+ addBooleanColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ {
+ // Species (by code) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ {
+ // Species (by genusCode) column
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC)) {
+
+ // Vrac / Hors vrac column
+
+ addComboEnumColumnToModel(columnModel,
+ SpeciesBatchTableModel.VRAC_HORS_VRAC,
+ VracHorsVracEnum.values());
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY)) {
+
+ // WeightCategory column
+
+ Decorator<WeightCategory> decorator =
+ getDecorator(WeightCategory.class,
+ DecoratorService.BY_NAME);
+
+ List<WeightCategory> data =
+ persistenceService.getAllWeightCategory();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.WEIGHT_CATEGORY,
+ decorator, data);
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_SEX)) {
+
+ // Sex column
+
+ Decorator<Sex> decorator =
+ getDecorator(Sex.class, DecoratorService.BY_NAME);
+
+ List<Sex> data = persistenceService.getAllSex();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SEX,
+ decorator, data);
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_MATURITY)) {
+
+ // Maturity column
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.MATURITY,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ if (samplingOrder.contains(SpeciesBatchRowModel.PROPERTY_AGE)) {
+
+ // Age column
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.AGE,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Weight column
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Computed weight column (from frequencies)
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_WEIGHT);
+ }
+
+ { // Computed number column (from frequencies)
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_NUMBER);
+ }
+
+ { // Sample weight column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.SAMPLE_WEIGHT);
+ }
+
+ { // SamplingRatio column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.SAMPLING_RATIO);
+ }
+
+ { // Comment column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.COMMENT);
+ }
+
+ { // File column
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.FILE);
+ }
+ return columnModel;
+ }
+
+ @Override
+ protected void onRowModified(SpeciesBatchRowModel row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+
+ if (RECOMPUTE_TOTAL_WEIGHT.contains(propertyName)) {
+
+ // Need to recompute totalHorsVracWeight
+ recomputeTotalHorsVrac();
+ }
+
+ SpeciesTabUIModel model = getModel();
+
+ SpeciesBatchTreeModel samplingTreeModel = model.getSamplingTreeModel();
+
+ if (SAMPLING_PROPERTIES.contains(propertyName)) {
+
+ // Need to rebuilt this row sampling tree path (and then recompute
+ // old super - samplingRatio and new super - samplingRatio)
+
+ // old node of the previous sampling def for this row
+ // and remove it from any cache
+ SpeciesBatchTreeNode oldNode = samplingTreeModel.removeNodeFromCache(row);
+
+ // get new sampling node
+ SpeciesBatchTreeNode newNode = samplingTreeModel.getSamplingNode(row);
+
+ moveSamplingNode(samplingTreeModel, row, oldNode, newNode);
+ }
+
+ if (SpeciesBatchRowModel.PROPERTY_WEIGHT.equals(propertyName)) {
+
+ // Need to recompute the super - samplingRatio
+
+ SpeciesBatchTreeNode node = samplingTreeModel.getSamplingNode(row);
+
+ recomputeSuperSamplingRatio(samplingTreeModel, row, node);
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
public void beforeInitUI() {
+ if (log.isInfoEnabled()) {
+ log.info("beforeInit: " + ui);
+ }
+
SpeciesTabUIModel model = new SpeciesTabUIModel();
ui.setContextValue(model);
- traitMonitor.setBean(model);
+ fishingOperationMonitor.setBean(model);
}
@Override
public void afterInitUI() {
+ if (log.isInfoEnabled()) {
+ log.info("afterInit: " + ui);
+ }
+
initUI(ui);
+ //TODO Will come from protocol
+ List<String> samplingOrder = Lists.newArrayList(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX
+ );
+
+ getModel().setSamplingOrder(samplingOrder);
+
JXTable table = getTable();
// create table column model
@@ -146,7 +401,14 @@
listenRowsFromModel();
// save when row chaged and was modified
- listenRowModification(table);
+ ListSelectionListener listener = new TableRowModificationListener<SpeciesBatchRowModel>(
+ getTableModel(), getRowMonitor()) {
+ @Override
+ protected void saveSelectedRow() {
+ saveSelectedRowIfRequired();
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(listener);
// always scroll to selected row
SwingUtil.scrollToTableSelection(getTable());
@@ -154,41 +416,33 @@
@Override
public void onCloseUI() {
+ if (log.isInfoEnabled()) {
+ log.info("closing: " + ui);
+ }
}
- @Override
- protected void saveRow(SpeciesBatchRowModel row) {
- SpeciesBatch catchBean = row.toBean();
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
- FishingOperation fishingOperation = getModel().getTrait();
- catchBean.setFishingOperation(fishingOperation);
- if (log.isInfoEnabled()) {
- log.info("Selected fishingOperation: " + fishingOperation.getId());
- }
+ public void saveSelectedRowIfRequired(FocusEvent event) {
- if (TuttiEntities.isNew(catchBean)) {
+ Component oppositeComponent = event.getOppositeComponent();
- catchBean = persistenceService.createSpeciesBatch(catchBean);
- row.setId(catchBean.getId());
- } else {
- persistenceService.saveSpeciesBatch(catchBean);
- }
+ JXTable parentContainer = null;
- List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
+ if (oppositeComponent != null) {
- List<SpeciesBatchFrequency> frequency =
- SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
-
- if (log.isInfoEnabled()) {
- log.info("Will save " + frequency.size() + " frequencies.");
+ // check out if still on table
+ parentContainer = SwingUtil.getParentContainer(
+ oppositeComponent, JXTable.class);
}
- frequency = persistenceService.saveSpeciesBatchFrequency(
- catchBean.getId(), frequency);
+ if (parentContainer == null) {
- // push it back to row model
- frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
- row.setFrequency(frequencyRows);
+ // out of the table can save
+ saveSelectedRowIfRequired();
+ }
}
public void selectFishingOperation(FishingOperation bean) {
@@ -201,11 +455,11 @@
table.editingCanceled(null);
}
- if (traitMonitor.wasModified()) {
+ if (fishingOperationMonitor.wasModified()) {
// previous fishingOperation was modified, let's save it
SpeciesTabUIModel traitMonitorBean =
- (SpeciesTabUIModel) traitMonitor.getBean();
+ (SpeciesTabUIModel) fishingOperationMonitor.getBean();
FishingOperation fishingOperation = traitMonitorBean.toBean();
@@ -229,7 +483,7 @@
if (empty) {
rows = null;
bean = new FishingOperation();
- model.setTrait(null);
+ model.setFishingOperation(null);
} else {
if (log.isInfoEnabled()) {
@@ -248,146 +502,165 @@
rows.add(entry);
}
}
- model.setTrait(bean);
+ model.setFishingOperation(bean);
}
model.fromBean(bean);
model.setRows(rows);
- listenModifcationOnFirstRow();
-
- traitMonitor.clearModified();
+ fishingOperationMonitor.clearModified();
}
- @Override
- protected TableColumnModel createTableColumnModel() {
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
- DefaultTableColumnModelExt columnModel =
- new DefaultTableColumnModelExt();
+ protected void moveSamplingNode(SpeciesBatchTreeModel samplingTreeModel,
+ SpeciesBatchRowModel row,
+ SpeciesBatchTreeNode oldNode,
+ SpeciesBatchTreeNode newNode) {
- { // Species to confirm
+ if (oldNode != null) {
- addBooleanColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
- getTable());
+ recomputeSuperSamplingRatio(samplingTreeModel, row, oldNode);
+
}
- List<Species> allSpecies = persistenceService.getAllSpecies();
+ recomputeSuperSamplingRatio(samplingTreeModel, row, newNode);
- { // Species (by code)
+ }
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_CODE);
+ protected void recomputeSuperSamplingRatio(SpeciesBatchTreeModel samplingTreeModel,
+ SpeciesBatchRowModel row,
+ SpeciesBatchTreeNode node) {
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_CODE,
- decorator, allSpecies);
- }
+ SpeciesBatchTreeNode superSamplingNode = node.getParent();
- { // Species (by genusCode)
+ Preconditions.checkNotNull(superSamplingNode,
+ "Super sampling node can't be null");
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_GENUS);
+ SpeciesBatchTreeModel.SamplingContext samplingContext =
+ samplingTreeModel.createSamplingContext(superSamplingNode);
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
- decorator, allSpecies);
+ float samplingTotalWeight = samplingContext.getTotalWeight();
+ Float superSamplingTotalWeight;
+ SpeciesBatchRowModel superSamplingRow =
+ samplingContext.getSuperSamplingRow();
+ if (superSamplingRow == null) {
+ // Use directly the batch total weight (means no super-sampling)
+
+ superSamplingTotalWeight = getModel().getTotalWeight();
+ } else {
+ superSamplingTotalWeight = superSamplingRow.getWeight();
}
- { // Vrac / Hors vrac
+ if (log.isInfoEnabled()) {
+ log.info("Super sampling total weight: " +
+ superSamplingTotalWeight);
+ }
- addComboEnumColumnToModel(columnModel,
- SpeciesBatchTableModel.VRAC_HORS_VRAC,
- VracHorsVracEnum.values());
+ Float samplingRatio = null;
+ if (superSamplingTotalWeight != null) {
+ samplingRatio = samplingTotalWeight / superSamplingTotalWeight;
}
- { // Catégorie de poids
+ if (log.isInfoEnabled()) {
+ log.info("Sampling ratio: " + samplingRatio);
+ }
- Decorator<WeightCategory> decorator =
- getDecorator(WeightCategory.class,
- DecoratorService.BY_NAME);
+ getTableModel().updateSamplingRatio(samplingContext.getSamplingRows());
- List<WeightCategory> data =
- persistenceService.getAllWeightCategory();
+ }
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT_CATEGORY,
- decorator, data);
- }
- { // Sex
+ protected void recomputeTotalHorsVrac() {
- Decorator<Sex> decorator =
- getDecorator(Sex.class, DecoratorService.BY_NAME);
+ // recompute total hors vrac
+ Float totalHorsVrac = 0f;
+ Float totalVrac = 0f;
- List<Sex> data = persistenceService.getAllSex();
+ for (SpeciesBatchRowModel batch : getModel().getRows()) {
+ VracHorsVracEnum vracHorsVrac = batch.getVracHorsVrac();
+ if (vracHorsVrac == null) {
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SEX,
- decorator, data);
+ // can't sum anything
+ } else if (vracHorsVrac == VracHorsVracEnum.HORS_VRAC) {
+ Float weight = batch.getWeight();
+ if (weight != null) {
+ totalHorsVrac += weight;
+ }
+ } else if (vracHorsVrac == VracHorsVracEnum.VRAC) {
+ Float weight = batch.getWeight();
+ if (weight != null) {
+ totalVrac += weight;
+ }
+ }
}
+ if (log.isInfoEnabled()) {
+ log.info("New total vrac / hors vrac: " +
+ totalVrac + " / " + totalHorsVrac);
+ }
+ getModel().setTotalHorsVracWeight(totalHorsVrac);
+ //TODO Should we also set the total vrac weight ?
+// getModel().setTotalVracWeight(totalVrac);
+ }
- { // Maturity
+ protected void saveSelectedRowIfRequired() {
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.MATURITY,
- TuttiUI.DECIMAL3_PATTERN);
- }
+ TuttiBeanMonitor<SpeciesBatchRowModel> rowMonitor = getRowMonitor();
- { // Age
+ SpeciesBatchRowModel bean = rowMonitor.getBean();
+ if (bean != null && bean.isValid()) {
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.AGE,
- TuttiUI.DECIMAL3_PATTERN);
- }
+ // there is a valid bean attached to the monitor
- { // Poids observé
+ if (rowMonitor.wasModified()) {
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
+ // monitored bean was modified, save it
+ if (log.isInfoEnabled()) {
+ log.info("Row " + bean + " was modified, will save it");
+ }
- { // Poids calculé
+ saveRow(bean);
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_WEIGHT);
+ // clear modified flag on the monitor
+ rowMonitor.clearModified();
+ }
}
+ }
- { // Nombre calculé
+ protected void saveRow(SpeciesBatchRowModel row) {
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_NUMBER);
+ SpeciesBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
}
- { // Poids d'échantillon
+ if (TuttiEntities.isNew(catchBean)) {
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.SAMPLE_WEIGHT);
+ catchBean = persistenceService.createSpeciesBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveSpeciesBatch(catchBean);
}
- { // Fraction d'élévation
+ List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.ELEVATION_RATIO);
- }
+ List<SpeciesBatchFrequency> frequency =
+ SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
- { // Commentaire
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.COMMENT);
+ if (log.isInfoEnabled()) {
+ log.info("Will save " + frequency.size() + " frequencies.");
}
+ frequency = persistenceService.saveSpeciesBatchFrequency(
+ catchBean.getId(), frequency);
- { // Pièces-jointes
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.FILE);
- }
- return columnModel;
+ // push it back to row model
+ frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
+ row.setFrequency(frequencyRows);
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -29,6 +29,8 @@
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderModelBuilder;
+import java.util.List;
+
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
@@ -45,16 +47,55 @@
public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
- protected FishingOperation trait;
+ /**
+ * Editing fishing operation.
+ *
+ * @since 0.2
+ */
+ protected FishingOperation fishingOperation;
+ /**
+ * Total Weight filled in screen.
+ *
+ * @since 0.2
+ */
protected Float totalWeight;
+ /**
+ * Total vrac Weight filled in screen.
+ *
+ * @since 0.2
+ */
protected Float totalVracWeight;
+ /**
+ * Total sample vrac Weight filled in screen.
+ *
+ * @since 0.2
+ */
protected Float sampleVracWeight;
+ /**
+ * Total hors vrac Weight computed by hros vrac rows.
+ *
+ * @since 0.2
+ */
protected Float totalHorsVracWeight;
+ /**
+ * Sampling order (sets by protocol).
+ *
+ * @since 0.2
+ */
+ protected List<String> samplingOrder;
+
+ /**
+ * Tree of sampling for batch rows.
+ *
+ * @since 0.2
+ */
+ protected final SpeciesBatchTreeModel samplingTreeModel;
+
protected static final Binder<FishingOperation, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, SpeciesTabUIModel.class)
.addProperty("speciesTotalWeight", PROPERTY_TOTAL_WEIGHT)
.addProperty("speciesTotalHorsVracWeight", PROPERTY_TOTAL_HORS_VRAC_WEIGHT)
@@ -72,16 +113,21 @@
public SpeciesTabUIModel() {
super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ this.samplingTreeModel = new SpeciesBatchTreeModel();
}
- public FishingOperation getTrait() {
- return trait;
+ public FishingOperation getFishingOperation() {
+ return fishingOperation;
}
- public void setTrait(FishingOperation trait) {
- this.trait = trait;
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
}
+ public SpeciesBatchTreeModel getSamplingTreeModel() {
+ return samplingTreeModel;
+ }
+
public Float getTotalWeight() {
return totalWeight;
}
@@ -122,9 +168,17 @@
firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
}
+ public List<String> getSamplingOrder() {
+ return samplingOrder;
+ }
+
+ public void setSamplingOrder(List<String> samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ samplingTreeModel.setSamplingOrder(samplingOrder.toArray(new String[samplingOrder.size()]));
+ }
+
@Override
protected FishingOperation newEntity() {
- return trait;
+ return fishingOperation;
}
-
}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiBeanMonitor.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiBeanMonitor.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiBeanMonitor.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,82 @@
+package fr.ifremer.tutti.ui.swing.util;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 org.jdesktop.beans.AbstractBean;
+import org.nuiton.util.beans.BeanMonitor;
+import org.nuiton.util.beans.PropertyDiff;
+
+import java.util.Map;
+
+/**
+ * To monitor a bean and know when it changes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class TuttiBeanMonitor<B> extends AbstractBean {
+
+ public static final String PROPERTY_BEAN = "bean";
+
+ BeanMonitor monitor;
+
+ public TuttiBeanMonitor(String... properties) {
+ this.monitor = new BeanMonitor(properties);
+ }
+
+ public B getBean() {
+ return (B) monitor.getBean();
+ }
+
+ public void setBean(B bean) {
+ Object oldValue = getBean();
+ monitor.setBean(bean);
+ firePropertyChange(PROPERTY_BEAN, oldValue, bean);
+ }
+
+ public BeanMonitor getMonitor() {
+ return monitor;
+ }
+
+ public boolean wasModified() {
+ return monitor.wasModified();
+ }
+
+ public String[] getModifiedProperties() {
+ return monitor.getModifiedProperties();
+ }
+
+ public Map<String, Object> getOriginalValues() {
+ return monitor.getOriginalValues();
+ }
+
+ public PropertyDiff[] getPropertyDiffs() {
+ return monitor.getPropertyDiffs();
+ }
+
+ public void clearModified() {
+ monitor.clearModified();
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiBeanMonitor.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -28,33 +28,28 @@
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.JAXXWidgetUtil;
import jaxx.runtime.swing.editor.EnumEditor;
import jaxx.runtime.swing.editor.bean.BeanUIUtil;
import jaxx.runtime.swing.editor.cell.NumberCellEditor;
import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
-import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
import org.jdesktop.swingx.table.TableColumnExt;
-import org.nuiton.util.beans.BeanMonitor;
import org.nuiton.util.decorator.Decorator;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.border.LineBorder;
-import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import java.awt.Color;
-import java.awt.Component;
-import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
@@ -82,12 +77,53 @@
*
* @since 0.2
*/
- private final BeanMonitor rowMonitor;
+ private final TuttiBeanMonitor<R> rowMonitor;
+ protected abstract JTable getTable();
+
+ protected abstract AbstractTuttiTableModel<R> getTableModel();
+
+ protected abstract TableColumnModel createTableColumnModel();
+
+ protected abstract void onRowModified(R row,
+ String propertyName,
+ Object oldValue,
+ Object newValue);
+
protected AbstractTuttiTableUIHandler(TuttiUIContext context,
String... properties) {
super(context);
- rowMonitor = new BeanMonitor(properties);
+ rowMonitor = new TuttiBeanMonitor<R>(properties);
+
+ // listen when bean is changed
+ rowMonitor.addPropertyChangeListener(TuttiBeanMonitor.PROPERTY_BEAN, new PropertyChangeListener() {
+ final PropertyChangeListener l = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ R row = (R) evt.getSource();
+ onRowModified(row,
+ evt.getPropertyName(),
+ evt.getOldValue(),
+ evt.getNewValue());
+ }
+ };
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ R oldValue = (R) evt.getOldValue();
+ R newValue = (R) evt.getNewValue();
+ if (log.isInfoEnabled()) {
+ log.info("Monitor row changed from " +
+ oldValue + " to " + newValue);
+ }
+ if (oldValue != null) {
+ oldValue.removePropertyChangeListener(l);
+ }
+ if (newValue != null) {
+ newValue.addPropertyChangeListener(l);
+ }
+ }
+ });
}
protected KeyListener installTableKeyListener(TableColumnModel columnModel,
@@ -221,8 +257,7 @@
protected <B extends Enum<B>> void addComboEnumColumnToModel(TableColumnModel model,
ColumnIdentifier<R> identifier,
B[] data) {
- EnumEditor<B> comboBox =
- EnumEditor.newEditor(data);
+ EnumEditor<B> comboBox = EnumEditor.newEditor(data);
BeanUIUtil.decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION);
TableCellEditor editor = new ComboBoxCellEditor(comboBox);
@@ -236,11 +271,15 @@
getModel().addPropertyChangeListener(AbstractTuttiTableUIModel.PROPERTY_ROWS, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- getTableModel().setRows((List<R>) evt.getNewValue());
+ onModelRowsChanged((List<R>) evt.getNewValue());
}
});
}
+ protected void onModelRowsChanged(List<R> rows) {
+ getTableModel().setRows(rows);
+ }
+
protected <O> TableCellRenderer newTableCellRender(Class<O> type) {
return newTableCellRender(type, null);
@@ -262,71 +301,8 @@
return result;
}
- protected void listenRowModification(JTable table) {
- ListSelectionListener listener = new TableRowModificationListener(
- getTableModel(), rowMonitor) {
- @Override
- protected void saveSelectedRow() {
- saveSelectedRowIfRequired();
- }
- };
- table.getSelectionModel().addListSelectionListener(listener);
+ protected TuttiBeanMonitor<R> getRowMonitor() {
+ return rowMonitor;
}
- public void saveSelectedRowIfRequired(FocusEvent event) {
-
- Component oppositeComponent = event.getOppositeComponent();
-
- JXTable parentContainer = null;
-
- if (oppositeComponent != null) {
-
- // check out if still on table
- parentContainer = SwingUtil.getParentContainer(
- oppositeComponent, JXTable.class);
- }
-
- if (parentContainer == null) {
-
- // out of the table can save
- saveSelectedRowIfRequired();
- }
- }
-
- public void saveSelectedRowIfRequired() {
-
- R bean = (R) rowMonitor.getBean();
- if (bean != null && bean.isValid()) {
-
- // there is a valid bean attached to the monitor
-
- if (rowMonitor.wasModified()) {
-
- // monitored bean was modified, save it
- if (log.isInfoEnabled()) {
- log.info("Row " + bean + " was modified, will save it");
- }
-
- saveRow(bean);
-
- // clear modified flag on the monitor
- rowMonitor.clearModified();
- }
- }
- }
-
- protected abstract void saveRow(R row);
-
- protected abstract TableColumnModel createTableColumnModel();
-
- protected abstract JTable getTable();
-
- protected abstract AbstractTuttiTableModel<R> getTableModel();
-
- protected void listenModifcationOnFirstRow() {
- List<R> rows = getTableModel().getRows();
- if (CollectionUtils.isNotEmpty(rows)) {
- rowMonitor.setBean(rows.get(0));
- }
- }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java 2012-12-12 16:52:40 UTC (rev 45)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/TableRowModificationListener.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -24,32 +24,33 @@
* #L%
*/
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.beans.BeanMonitor;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
+import java.io.Serializable;
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public abstract class TableRowModificationListener implements ListSelectionListener {
+public abstract class TableRowModificationListener<R extends Serializable> implements ListSelectionListener {
/** Logger. */
private static final Log log =
LogFactory.getLog(TableRowModificationListener.class);
- private final AbstractTuttiTableModel tableModel;
+ private final AbstractTuttiTableModel<R> tableModel;
- private final BeanMonitor beanMonitor;
+ private final TuttiBeanMonitor<R> beanMonitor;
protected abstract void saveSelectedRow();
- public TableRowModificationListener(AbstractTuttiTableModel tableModel,
- BeanMonitor beanMonitor) {
+ public TableRowModificationListener(AbstractTuttiTableModel<R> tableModel,
+ TuttiBeanMonitor<R> beanMonitor) {
this.tableModel = tableModel;
this.beanMonitor = beanMonitor;
}
@@ -67,7 +68,7 @@
log.info("New selected row: " + selectedRow);
}
- Object entry;
+ R entry;
if (selectedRow == -1) {
// no selection
Copied: trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java (from rev 41, trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModelTest.java)
===================================================================
--- trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java (rev 0)
+++ trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java 2012-12-12 17:06:45 UTC (rev 46)
@@ -0,0 +1,66 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyRowModelTest {
+
+ @Test
+ public void compareTo() throws Exception {
+
+ SpeciesFrequencyRowModel s0 = new SpeciesFrequencyRowModel();
+ SpeciesFrequencyRowModel s1 = new SpeciesFrequencyRowModel();
+
+ // s0=null, s1=null
+ Assert.assertTrue(s0.compareTo(s1) == 0);
+
+ // s0=1, s1=null
+ s0.setLengthStep(1f);
+ Assert.assertTrue(s0.compareTo(s1) > 0);
+
+ // s0=null, s1=1
+ s0.setLengthStep(null);
+ s1.setLengthStep(1f);
+ Assert.assertTrue(s0.compareTo(s1) < 0);
+
+ // s0=2, s1=1
+ s0.setLengthStep(2f);
+ Assert.assertTrue(s0.compareTo(s1) > 0);
+
+ // s0=2, s1=2
+ s1.setLengthStep(2f);
+ Assert.assertTrue(s0.compareTo(s1) == 0);
+
+ // s0=2, s1=3
+ s1.setLengthStep(3f);
+ Assert.assertTrue(s0.compareTo(s1) < 0);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesFrequencyRowModelTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r45 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation
by kmorin@users.forge.codelutin.com Dec. 12, 2012
by kmorin@users.forge.codelutin.com Dec. 12, 2012
Dec. 12, 2012
Author: kmorin
Date: 2012-12-12 17:52:40 +0100 (Wed, 12 Dec 2012)
New Revision: 45
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/45
Log:
d?\195?\169commente du code comment?\195?\169 par erreur
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-12 16:25:25 UTC (rev 44)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-12 16:52:40 UTC (rev 45)
@@ -134,35 +134,30 @@
public void selectFishingOperation(FishingOperation bean) {
-// boolean empty = bean == null;
-//
-// FishingOperationTabUIModel model = getModel();
-//
-// // clean previous selection
-// ui.getSaisisseurList().getList().clearSelection();
-//
-// if (empty) {
-//
-// model.fromBean(new FishingOperation());
-// } else {
-//
-// model.fromBean(bean);
-// }
-//
-// // update saisissuer selection
-// List<Person> saisisseur = model.getSaisisseur();
-// if (CollectionUtils.isNotEmpty(saisisseur)) {
-// updateIndices(ui.getSaisisseurList(), saisisseur);
-// }
-//
-// // update model empty property
-// model.setEmpty(empty);
-//
-// // reload bean in validator (? really mandatory?)
-//// ui.getValidator().reloadBean();
-//
-// // if new fishingOperation can already cancel his creation
-// model.setModify(!empty && model.isCreate());
+ boolean empty = bean == null;
+
+ FishingOperationTabUIModel model = getModel();
+
+ if (empty) {
+
+ model.fromBean(new FishingOperation());
+ } else {
+
+ model.fromBean(bean);
+ }
+
+ // update saisissuer selection
+ List<Person> saisisseur = model.getSaisisseur();
+ ui.getSaisisseurList().getModel().setSelected(saisisseur);
+
+ // update model empty property
+ model.setEmpty(empty);
+
+ // reload bean in validator (? really mandatory?)
+// ui.getValidator().reloadBean();
+
+ // if new fishingOperation can already cancel his creation
+ model.setModify(!empty && model.isCreate());
}
public void cancel() {
1
0
r44 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise
by kmorin@users.forge.codelutin.com Dec. 12, 2012
by kmorin@users.forge.codelutin.com Dec. 12, 2012
Dec. 12, 2012
Author: kmorin
Date: 2012-12-12 17:25:25 +0100 (Wed, 12 Dec 2012)
New Revision: 44
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/44
Log:
refs #1790 - style
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-12 15:15:39 UTC (rev 43)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-12 16:25:25 UTC (rev 44)
@@ -36,11 +36,6 @@
bean: {model};
}
-JList {
- selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
- model: {new DefaultListModel()};
-}
-
NumberEditor {
autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
@@ -140,21 +135,25 @@
#vesselList {
beanType: {Vessel.class};
property: "vessel";
+ border: {BorderFactory.createTitledBorder(_("tutti.label.list.vessel"))};
}
#gearList {
beanType: {Gear.class};
property: "gear";
+ border: {BorderFactory.createTitledBorder(_("tutti.label.list.gear"))};
}
#headOfMissionList {
beanType: {Person.class};
property: "headOfMission";
+ border: {BorderFactory.createTitledBorder(_("tutti.label.list.headOfMission"))};
}
#headOfSortRoomList {
beanType: {Person.class};
property: "headOfSortRoom";
+ border: {BorderFactory.createTitledBorder(_("tutti.label.list.headOfSortRoom"))};
}
#commentPane {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2012-12-12 15:15:39 UTC (rev 43)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2012-12-12 16:25:25 UTC (rev 44)
@@ -166,19 +166,7 @@
<row weighty='0.3'>
<cell columns='6'>
<JPanel layout='{new GridLayout(1, 0)}'>
-<!-- <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
- onFocusGained='vesselList.requestFocus()'>
- <JList id='vesselList'
- onValueChanged='handler.selectListData(event, "vessel")'/>
- <BeanListHeader id='vesselHeader' genericType='Vessel'/>
- </JScrollPane>-->
<BeanDoubleList id='vesselList' genericType='Vessel'/>
-<!-- <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
- onFocusGained='gearList.requestFocus()'>
- <JList id='gearList'
- onValueChanged='handler.selectListData(event, "gear")'/>
- <BeanListHeader id='gearHeader' genericType='Gear'/>
- </JScrollPane>-->
<BeanDoubleList id='gearList' genericType='Gear'/>
</JPanel>
</cell>
@@ -188,24 +176,7 @@
<row weighty='0.3'>
<cell columns='6'>
<JPanel layout='{new GridLayout(1, 0)}'>
-
-<!-- <JScrollPane id='headOfMissionPane'
- columnHeaderView="{headOfMissionHeader}"
- onFocusGained='headOfMissionList.requestFocus()'>
- <JList id='headOfMissionList'
- onValueChanged='handler.selectListData(event, "headOfMission")'/>
- <BeanListHeader id='headOfMissionHeader'
- genericType='Person'/>
- </JScrollPane>-->
<BeanDoubleList id='headOfMissionList' genericType='Person'/>
-<!-- <JScrollPane id='headOfSortRoomPane'
- columnHeaderView="{headOfSortRoomHeader}"
- onFocusGained='headOfSortRoomList.requestFocus()'>
- <JList id='headOfSortRoomList'
- onValueChanged='handler.selectListData(event, "headOfSortRoom")'/>
- <BeanListHeader id='headOfSortRoomHeader'
- genericType='Person'/>
- </JScrollPane>-->
<BeanDoubleList id='headOfSortRoomList' genericType='Person'/>
</JPanel>
</cell>
1
0
Author: kmorin
Date: 2012-12-12 16:15:39 +0100 (Wed, 12 Dec 2012)
New Revision: 43
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/43
Log:
refs #1790 - utilisation de jaxx 2.5.8-SNAPSHOT pour avoir le widget de double liste
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-12-12 15:14:19 UTC (rev 42)
+++ trunk/pom.xml 2012-12-12 15:15:39 UTC (rev 43)
@@ -90,7 +90,7 @@
<h2Version>1.3.168</h2Version>
<postgresqlVersion>9.1-901-1.jdbc4</postgresqlVersion>
- <jaxxVersion>2.5.7</jaxxVersion>
+ <jaxxVersion>2.5.8-SNAPSHOT</jaxxVersion>
<swingXVersion>1.6.4</swingXVersion>
<xworkVersion>2.3.4.1</xworkVersion>
1
0
r42 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing: . content/cruise content/operation
by kmorin@users.forge.codelutin.com Dec. 12, 2012
by kmorin@users.forge.codelutin.com Dec. 12, 2012
Dec. 12, 2012
Author: kmorin
Date: 2012-12-12 16:14:19 +0100 (Wed, 12 Dec 2012)
New Revision: 42
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/42
Log:
refs #1790
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-12 15:14:19 UTC (rev 42)
@@ -62,6 +62,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import jaxx.runtime.swing.editor.bean.BeanDoubleList;
/**
* Contract of any UI handler.
@@ -188,11 +189,11 @@
* @param listHeader le component graphique à initialiser
*/
protected <E extends IdAware> void initBeanList(
- BeanListHeader<E> listHeader,
+ BeanDoubleList<E> list,
List<E> data,
List<E> selectedData) {
- Class<E> beanType = listHeader.getBeanType();
+ Class<E> beanType = list.getBeanType();
DecoratorService decoratorService =
context.getService(DecoratorService.class);
@@ -204,15 +205,15 @@
}
// add data list to combo box
- listHeader.init((JXPathDecorator<E>) decorator, data);
+ list.init((JXPathDecorator<E>) decorator, data, selectedData);
+
+// OneClicListSelectionModel.installModel(listHeader.getList());
- OneClicListSelectionModel.installModel(listHeader.getList());
+// updateIndices(listHeader.getList(), selectedData);
- updateIndices(listHeader.getList(), selectedData);
-
if (log.isDebugEnabled()) {
log.debug("Jlist [" + beanType.getName() + "] : " +
- listHeader.getData().size());
+ list.getUniverseList().getModel().getSize());
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-12 15:14:19 UTC (rev 42)
@@ -32,9 +32,8 @@
bean: {model};
}
-BeanListHeader {
- showReset: true;
- i18nPrefix: "tutti.property.";
+BeanDoubleList {
+ bean: {model};
}
JList {
@@ -138,48 +137,24 @@
numberPattern: {INT_1_DIGITS_PATTERN};
}
-#vesselPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#vesselHeader {
- labelText: {_("tutti.label.list.vessel")};
- list: {vesselList};
+#vesselList {
beanType: {Vessel.class};
+ property: "vessel";
}
-#gearPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#gearHeader {
- labelText: {_("tutti.label.list.gear")};
- list: {gearList};
+#gearList {
beanType: {Gear.class};
+ property: "gear";
}
-#headOfMissionPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#headOfMissionHeader {
- labelText: {_("tutti.label.list.headOfMission")};
- list: {headOfMissionList};
+#headOfMissionList {
beanType: {Person.class};
+ property: "headOfMission";
}
-#headOfSortRoomPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#headOfSortRoomHeader {
- labelText: {_("tutti.label.list.headOfSortRoom")};
- list: {headOfSortRoomList};
+#headOfSortRoomList {
beanType: {Person.class};
+ property: "headOfSortRoom";
}
#commentPane {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2012-12-12 15:14:19 UTC (rev 42)
@@ -35,6 +35,7 @@
jaxx.runtime.swing.editor.NumberEditor
jaxx.runtime.swing.editor.bean.BeanComboBox
jaxx.runtime.swing.editor.bean.BeanListHeader
+ jaxx.runtime.swing.editor.bean.BeanDoubleList
jaxx.runtime.validator.swing.SwingValidatorUtil
jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
@@ -81,10 +82,10 @@
<field name='country' component='countryComboBox'/>
<field name='beginDate' component='beginDateField'/>
<field name='endDate' component='endDateField'/>
- <field name='vessel' component='vesselPane'/>
- <field name='gear' component='gearPane'/>
- <field name='headOfMission' component='headOfMissionPane'/>
- <field name='headOfSortRoom' component='headOfSortRoomPane'/>
+ <field name='vessel' component='vesselList'/>
+ <field name='gear' component='gearList'/>
+ <field name='headOfMission' component='headOfMissionList'/>
+ <field name='headOfSortRoom' component='headOfSortRoomList'/>
<field name='comment' component='commentField'/>
</BeanValidator>
@@ -165,18 +166,20 @@
<row weighty='0.3'>
<cell columns='6'>
<JPanel layout='{new GridLayout(1, 0)}'>
- <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
+<!-- <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
onFocusGained='vesselList.requestFocus()'>
<JList id='vesselList'
onValueChanged='handler.selectListData(event, "vessel")'/>
<BeanListHeader id='vesselHeader' genericType='Vessel'/>
- </JScrollPane>
- <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
+ </JScrollPane>-->
+ <BeanDoubleList id='vesselList' genericType='Vessel'/>
+<!-- <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
onFocusGained='gearList.requestFocus()'>
<JList id='gearList'
onValueChanged='handler.selectListData(event, "gear")'/>
<BeanListHeader id='gearHeader' genericType='Gear'/>
- </JScrollPane>
+ </JScrollPane>-->
+ <BeanDoubleList id='gearList' genericType='Gear'/>
</JPanel>
</cell>
</row>
@@ -186,22 +189,24 @@
<cell columns='6'>
<JPanel layout='{new GridLayout(1, 0)}'>
- <JScrollPane id='headOfMissionPane'
+<!-- <JScrollPane id='headOfMissionPane'
columnHeaderView="{headOfMissionHeader}"
onFocusGained='headOfMissionList.requestFocus()'>
<JList id='headOfMissionList'
onValueChanged='handler.selectListData(event, "headOfMission")'/>
<BeanListHeader id='headOfMissionHeader'
genericType='Person'/>
- </JScrollPane>
- <JScrollPane id='headOfSortRoomPane'
+ </JScrollPane>-->
+ <BeanDoubleList id='headOfMissionList' genericType='Person'/>
+<!-- <JScrollPane id='headOfSortRoomPane'
columnHeaderView="{headOfSortRoomHeader}"
onFocusGained='headOfSortRoomList.requestFocus()'>
<JList id='headOfSortRoomList'
onValueChanged='handler.selectListData(event, "headOfSortRoom")'/>
<BeanListHeader id='headOfSortRoomHeader'
genericType='Person'/>
- </JScrollPane>
+ </JScrollPane>-->
+ <BeanDoubleList id='headOfSortRoomList' genericType='Person'/>
</JPanel>
</cell>
</row>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2012-12-12 15:14:19 UTC (rev 42)
@@ -98,19 +98,19 @@
persistenceService.getAllCountry(),
model.getCountry());
- initBeanList(ui.getVesselHeader(),
+ initBeanList(ui.getVesselList(),
persistenceService.getAllVessel(),
model.getVessel());
- initBeanList(ui.getGearHeader(),
+ initBeanList(ui.getGearList(),
persistenceService.getAllGear(),
model.getGear());
- initBeanList(ui.getHeadOfMissionHeader(),
+ initBeanList(ui.getHeadOfMissionList(),
users,
model.getHeadOfMission());
- initBeanList(ui.getHeadOfSortRoomHeader(),
+ initBeanList(ui.getHeadOfSortRoomList(),
users,
model.getHeadOfSortRoom());
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css 2012-12-12 15:14:19 UTC (rev 42)
@@ -32,9 +32,8 @@
bean: {model};
}
-BeanListHeader {
- showReset: true;
- i18nPrefix: "tutti.property.";
+BeanDoubleList {
+ bean: {model};
}
JList {
@@ -331,15 +330,9 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#saisisseurPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#saisisseurHeader {
- labelText: {_("tutti.label.list.saisisseur")};
- list: {saisisseurList};
+#saisisseurList {
beanType: {Person.class};
+ property: "saisisseur";
}
#commentPane {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-12 15:14:19 UTC (rev 42)
@@ -35,6 +35,7 @@
jaxx.runtime.swing.editor.bean.BeanComboBox
jaxx.runtime.swing.editor.bean.BeanListHeader
+ jaxx.runtime.swing.editor.bean.BeanDoubleList
jaxx.runtime.swing.editor.NumberEditor
jaxx.runtime.swing.editor.TimeEditor
@@ -80,7 +81,7 @@
component='fishingOperationNumberField'/>
<field name='date' component='dateField'/>
<field name='comment' component='commentField'/>
- <field name='saisisseur' component='saisisseurPane'/>
+ <field name='saisisseur' component='saisisseurList'/>
</BeanValidator>
<JPanel id='traitPane' constraints='BorderLayout.CENTER'
@@ -272,13 +273,14 @@
<!-- Saisisseur -->
<row weighty='0.3'>
<cell columns='6'>
- <JScrollPane id='saisisseurPane'
+<!-- <JScrollPane id='saisisseurPane'
columnHeaderView="{saisisseurHeader}"
onFocusGained='saisisseurList.requestFocus()'>
<JList id='saisisseurList'
onValueChanged='handler.selectListData(event, "saisisseur")'/>
<BeanListHeader id='saisisseurHeader' genericType='Person'/>
- </JScrollPane>
+ </JScrollPane>-->
+ <BeanDoubleList id='saisisseurList' genericType='Person'/>
</cell>
</row>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-11 14:29:06 UTC (rev 41)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-12 15:14:19 UTC (rev 42)
@@ -102,7 +102,7 @@
initUI(ui);
- initBeanList(ui.getSaisisseurHeader(),
+ initBeanList(ui.getSaisisseurList(),
persistenceService.getAllPerson(),
model.getSaisisseur());
@@ -134,35 +134,35 @@
public void selectFishingOperation(FishingOperation bean) {
- boolean empty = bean == null;
-
- FishingOperationTabUIModel model = getModel();
-
- // clean previous selection
- ui.getSaisisseurHeader().getList().clearSelection();
-
- if (empty) {
-
- model.fromBean(new FishingOperation());
- } else {
-
- model.fromBean(bean);
- }
-
- // update saisissuer selection
- List<Person> saisisseur = model.getSaisisseur();
- if (CollectionUtils.isNotEmpty(saisisseur)) {
- updateIndices(ui.getSaisisseurList(), saisisseur);
- }
-
- // update model empty property
- model.setEmpty(empty);
-
- // reload bean in validator (? really mandatory?)
-// ui.getValidator().reloadBean();
-
- // if new fishingOperation can already cancel his creation
- model.setModify(!empty && model.isCreate());
+// boolean empty = bean == null;
+//
+// FishingOperationTabUIModel model = getModel();
+//
+// // clean previous selection
+// ui.getSaisisseurList().getList().clearSelection();
+//
+// if (empty) {
+//
+// model.fromBean(new FishingOperation());
+// } else {
+//
+// model.fromBean(bean);
+// }
+//
+// // update saisissuer selection
+// List<Person> saisisseur = model.getSaisisseur();
+// if (CollectionUtils.isNotEmpty(saisisseur)) {
+// updateIndices(ui.getSaisisseurList(), saisisseur);
+// }
+//
+// // update model empty property
+// model.setEmpty(empty);
+//
+// // reload bean in validator (? really mandatory?)
+//// ui.getValidator().reloadBean();
+//
+// // if new fishingOperation can already cancel his creation
+// model.setModify(!empty && model.isCreate());
}
public void cancel() {
1
0
r41 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/content java/fr/ifremer/tutti/ui/swing/content/catches/species java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency java/fr/ifremer/tutti/ui/swing/content/operation java/fr/ifremer/tutti/ui/swing/content/operation/species resources/fr/ifremer/tutti/ui/swing/content
by tchemit@users.forge.codelutin.com Dec. 11, 2012
by tchemit@users.forge.codelutin.com Dec. 11, 2012
Dec. 11, 2012
Author: tchemit
Date: 2012-12-11 15:29:06 +0100 (Tue, 11 Dec 2012)
New Revision: 41
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/41
Log:
move species to his correct package + remove obsolete packages
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,256 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.base.Preconditions;
-import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JTable;
-import javax.swing.border.LineBorder;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Frame;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Component to render and edit frequency stuff from batch table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class FrequencyCellComponent extends JButton {
-
- private static final long serialVersionUID = 1L;
-
- public static final String ROW_INDEX = "rowIndex";
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(FrequencyCellComponent.class);
-
- public FrequencyCellComponent() {
- setContentAreaFilled(false);
- setOpaque(false);
- setIcon(SwingUtil.createActionIcon("show-frequency"));
- }
-
- public static TableCellRenderer newRender() {
- return new FrequencyCellRenderer();
- }
-
- public static TableCellEditor newEditor(SpeciesFrequencyUI ui) {
- return new FrequencyCellEditor(ui);
- }
-
- public static class FrequencyCellEditor extends AbstractCellEditor implements TableCellEditor {
-
- private static final long serialVersionUID = 1L;
-
- protected final FrequencyCellComponent component;
-
- protected final SpeciesFrequencyUI ui;
-
- protected Frame frame;
-
- protected JTable table;
-
- protected SpeciesBatchTableModel tableModel;
-
- protected ColumnIdentifier<SpeciesBatchRowModel> columnIdentifier;
-
- protected SpeciesBatchRowModel editRow;
-
- protected Integer rowIndex;
-
- protected Integer columnIndex;
-
- public FrequencyCellEditor(SpeciesFrequencyUI ui) {
- this.ui = ui;
- component = new FrequencyCellComponent();
- component.setBorder(new LineBorder(Color.BLACK));
- component.addKeyListener(new KeyAdapter() {
- @Override
- public void keyReleased(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER ||
- e.getKeyCode() == KeyEvent.VK_SPACE) {
- e.consume();
- startEdit();
- }
- }
- });
-
- component.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- e.consume();
- startEdit();
- }
- });
- }
-
- protected void startEdit() {
-
- Preconditions.checkNotNull(tableModel, "No table model assigned.");
-
- // open frequency dialog
-
- Preconditions.checkNotNull(editRow, "No editRow found.");
-
- if (log.isInfoEnabled()) {
- log.info("Will edit frequencies for row: " + rowIndex);
- }
-
- if (frame == null) {
- frame = SwingUtil.getParentContainer(ui, Frame.class);
- }
-
- ui.editBatch(editRow);
-
- // open frequency dialog
- TuttiUIUtil.openInDialog(ui, frame, _("tutti.title.frequency"), true, null);
-
- // at close, synch back frequencies
-
- editRow.updateTotalFromFrequencies();
-
- int r = rowIndex;
- int c = columnIndex;
-
- // stop edition
- stopCellEditing();
-
- // reselect this cell
- AbstractSelectTableAction.doSelectCell(table, r, c);
- }
-
- @Override
- public Component getTableCellEditorComponent(JTable table,
- Object value,
- boolean isSelected,
- int row,
- int column) {
- if (tableModel == null) {
- tableModel = (SpeciesBatchTableModel) table.getModel();
- this.table = table;
- columnIdentifier = tableModel.getPropertyName(column);
- }
- String text;
- if (value == null) {
- text = " - ";
- } else {
- text = String.valueOf(value);
- }
- component.setText(text);
-
- rowIndex = row;
- columnIndex = column;
-
- editRow = tableModel.getEntry(row);
-
- return component;
- }
-
- @Override
- public Object getCellEditorValue() {
-
- Preconditions.checkNotNull(editRow, "No editRow found in editor.");
-
- Object result;
- if (columnIdentifier == SpeciesBatchTableModel.COMPUTED_NUMBER) {
- result = editRow.getComputedNumber();
- } else {
- result = editRow.getComputedWeight();
- }
- if (log.isInfoEnabled()) {
- log.info("editor value (" + columnIdentifier + "): " + result);
- }
-
- return result;
- }
-
- @Override
- public boolean stopCellEditing() {
- boolean b = super.stopCellEditing();
- if (b) {
- rowIndex = null;
- editRow = null;
- columnIndex = null;
- }
- return b;
- }
-
- @Override
- public void cancelCellEditing() {
- super.cancelCellEditing();
- rowIndex = null;
- columnIndex = null;
- editRow = null;
- }
- }
-
- public static class FrequencyCellRenderer implements TableCellRenderer {
-
- protected final FrequencyCellComponent component;
-
- public FrequencyCellRenderer() {
- component = new FrequencyCellComponent();
- }
-
- @Override
- public Component getTableCellRendererComponent(JTable table,
- Object value,
- boolean isSelected,
- boolean hasFocus,
- int row,
- int column) {
-
- String text;
- if (value == null) {
- text = " - ";
- } else {
- text = String.valueOf(value);
- }
- boolean editable = table.isCellEditable(row, column);
- component.setEnabled(editable);
- component.setText(text);
- return component;
- }
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,379 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
-import org.apache.commons.collections.CollectionUtils;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Represents a species batch (i.e a row in the batch table).
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class SpeciesBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, SpeciesBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_SPECIES = "species";
-
- public static final String PROPERTY_SPECIES_TO_CONFIRM = "speciesToConfirm";
-
- public static final String PROPERTY_VRAC_HORS_VRAC = "vracHorsVrac";
-
- public static final String PROPERTY_WEIGHT_CATEGORY = "weightCategory";
-
- public static final String PROPERTY_SEX = "sex";
-
- public static final String PROPERTY_MATURITY = "maturity";
-
- public static final String PROPERTY_AGE = "age";
-
- public static final String PROPERTY_WEIGHT = "weight";
-
- public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
-
- public static final String PROPERTY_SAMPLING_RATIO = "samplingRatio";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_FREQUENCY = "frequency";
-
- public static final String PROPERTY_COMPUTED_NUMBER = "computedNumber";
-
- public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
-
- /**
- * Species observed.
- *
- * @since 0.2
- */
- protected Species species;
-
- /**
- * Is the species need to be confirmed?.
- *
- * @since 0.2
- */
- protected boolean speciesToConfirm;
-
- /**
- * Is catch is vrac or horsVrac?.
- *
- * @since 0.2
- */
- protected VracHorsVracEnum vracHorsVrac;
-
- /**
- * Weight category (can be null).
- *
- * @since 0.2
- */
- protected WeightCategory weightCategory;
-
- /**
- * Sex (can be null).
- *
- * @since 0.2
- */
- protected Sex sex;
-
- /**
- * Maturity (can be null).
- *
- * @since 0.2
- */
- protected Float maturity;
-
- /**
- * Age (can be null).
- *
- * @since 0.2
- */
- protected Float age;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Total computed weight (from frequencies).
- *
- * @since 0.2
- */
- protected Float computedWeight;
-
- /**
- * Total computed number (from frequencies).
- *
- * @since 0.2
- */
- protected Float computedNumber;
-
- /**
- * Sample weight.
- *
- * @since 0.2
- */
- protected Float sampleWeight;
-
- /**
- * Elevation ratio.
- *
- * @since 0.2
- */
- protected Float samplingRatio;
-
- /**
- * Comment on this catches.
- *
- * @since 0.2
- */
- protected String comment;
-
- /**
- * List of frequencies observed for this batch.
- *
- * @since 0.2
- */
- protected List<SpeciesFrequencyRowModel> frequency;
-
- protected static final Binder<SpeciesBatch, SpeciesBatchRowModel> fromBeanBinder =
- BinderFactory.newBinder(SpeciesBatch.class,
- SpeciesBatchRowModel.class);
-
- protected static final Binder<SpeciesBatchRowModel, SpeciesBatch> toBeanBinder =
- BinderFactory.newBinder(SpeciesBatchRowModel.class,
- SpeciesBatch.class);
-
- public SpeciesBatchRowModel() {
- super(SpeciesBatch.class, fromBeanBinder, toBeanBinder);
- frequency = Lists.newArrayList();
- }
-
- public SpeciesBatchRowModel(SpeciesBatch aBatch,
- List<SpeciesBatchFrequency> frequencies) {
- this();
- fromBean(aBatch);
- List<SpeciesFrequencyRowModel> frequencyRows =
- SpeciesFrequencyRowModel.fromBeans(frequencies);
- frequency.addAll(frequencyRows);
- Collections.sort(frequency);
- updateTotalFromFrequencies();
- }
-
- public void updateTotalFromFrequencies() {
- Float totalNumber = null;
- Float totalWeight = null;
- if (CollectionUtils.isNotEmpty(frequency)) {
- totalNumber = 0f;
- totalWeight = 0f;
- for (SpeciesFrequencyRowModel frequencyModel : frequency) {
- totalNumber += frequencyModel.getNumber();
- Float w = frequencyModel.getWeight();
- if (w == null) {
-
- // can't sum when a null value appears
- totalWeight = null;
- } else if (totalWeight != null) {
-
- // still can sum weights
- totalWeight += w;
- }
- }
- }
-
- setComputedNumber(totalNumber);
- setComputedWeight(totalWeight);
- }
-
- public Species getSpecies() {
- return species;
- }
-
- public void setSpecies(Species species) {
- Object oldValue = getSpecies();
- this.species = species;
- firePropertyChange(PROPERTY_SPECIES, oldValue, species);
- }
-
- public Boolean getSpeciesToConfirm() {
- return speciesToConfirm;
- }
-
- public void setSpeciesToConfirm(Boolean speciesToConfirm) {
- Object oldValue = getSpeciesToConfirm();
- this.speciesToConfirm = speciesToConfirm;
- firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
- }
-
- public VracHorsVracEnum getVracHorsVrac() {
- return vracHorsVrac;
- }
-
- public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) {
- Object oldValue = getVracHorsVrac();
- this.vracHorsVrac = vracHorsVrac;
- firePropertyChange(PROPERTY_VRAC_HORS_VRAC, oldValue, vracHorsVrac);
- }
-
- public WeightCategory getWeightCategory() {
- return weightCategory;
- }
-
- public void setWeightCategory(WeightCategory weightCategory) {
- Object oldValue = getWeightCategory();
- this.weightCategory = weightCategory;
- firePropertyChange(PROPERTY_WEIGHT_CATEGORY, oldValue, weightCategory);
- }
-
- public Sex getSex() {
- return sex;
- }
-
- public void setSex(Sex sex) {
- Object oldValue = getSex();
- this.sex = sex;
- firePropertyChange(PROPERTY_SEX, oldValue, sex);
- }
-
- public Float getMaturity() {
- return maturity;
- }
-
- public void setMaturity(Float maturity) {
- Object oldValue = getMaturity();
- this.maturity = maturity;
- firePropertyChange(PROPERTY_MATURITY, oldValue, maturity);
- }
-
- public Float getAge() {
- return age;
- }
-
- public void setAge(Float age) {
- Object oldValue = getAge();
- this.age = age;
- firePropertyChange(PROPERTY_AGE, oldValue, age);
- }
-
- public Float getWeight() {
- return weight;
- }
-
- public void setWeight(Float weight) {
- Object oldValue = getWeight();
- this.weight = weight;
- firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
- }
-
- public Float getSampleWeight() {
- return sampleWeight;
- }
-
- public void setSampleWeight(Float sampleWeight) {
- Object oldValue = getSampleWeight();
- this.sampleWeight = sampleWeight;
- firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
- }
-
- public Float getSamplingRatio() {
- return samplingRatio;
- }
-
- public void setSamplingRatio(Float samplingRatio) {
- Object oldValue = getSamplingRatio();
- this.samplingRatio = samplingRatio;
- firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<SpeciesFrequencyRowModel> getFrequency() {
- return frequency;
- }
-
- public void setFrequency(List<SpeciesFrequencyRowModel> frequency) {
- Object oldValue = getFrequency();
- this.frequency = frequency;
- firePropertyChange(PROPERTY_FREQUENCY, oldValue, frequency);
- }
-
- public Float getComputedWeight() {
- return computedWeight;
- }
-
- public void setComputedWeight(Float computedWeight) {
- Object oldValue = getComputedWeight();
- this.computedWeight = computedWeight;
- firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue,
- computedWeight);
- }
-
- public Float getComputedNumber() {
- return computedNumber;
- }
-
- public void setComputedNumber(Float computedNumber) {
- Object oldValue = getComputedNumber();
- this.computedNumber = computedNumber;
- firePropertyChange(PROPERTY_COMPUTED_NUMBER, oldValue,
- computedNumber);
- }
-
- //TODO Use validator
- @Override
- public boolean isValid() {
- return species != null && weight != null;
- }
-
- public int getRowCount() {
- return frequency == null ? 0 : frequency.size();
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,200 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.collect.Sets;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-
-import javax.swing.table.TableColumnModel;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesBatchTableModel extends AbstractTuttiTableModel<SpeciesBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- n_("tutti.table.species.batch.header.toConfirm"),
- n_("tutti.table.species.batch.header.toConfirm"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.species.batch.header.speciesByCode"),
- n_("tutti.table.species.batch.header.speciesByCode"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- n_("tutti.table.species.batch.header.speciesByGenusCode"),
- n_("tutti.table.species.batch.header.speciesByGenusCode"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> VRAC_HORS_VRAC = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
- n_("tutti.table.species.batch.header.vracHorsVrac"),
- n_("tutti.table.species.batch.header.vracHorsVrac"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT_CATEGORY = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
- n_("tutti.table.species.batch.header.weightCategory"),
- n_("tutti.table.species.batch.header.weightCategory"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SEX = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SEX,
- n_("tutti.table.species.batch.header.sex"),
- n_("tutti.table.species.batch.header.sex"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> MATURITY = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_MATURITY,
- n_("tutti.table.species.batch.header.maturity"),
- n_("tutti.table.species.batch.header.maturity"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> AGE = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_AGE,
- n_("tutti.table.species.batch.header.age"),
- n_("tutti.table.species.batch.header.age"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_WEIGHT,
- n_("tutti.table.species.batch.header.weight"),
- n_("tutti.table.species.batch.header.weight"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_COMPUTED_WEIGHT,
- n_("tutti.table.species.batch.header.computedWeight"),
- n_("tutti.table.species.batch.header.computedWeight"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_NUMBER = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_COMPUTED_NUMBER,
- n_("tutti.table.species.batch.header.computedNumber"),
- n_("tutti.table.species.batch.header.computedNumber"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- n_("tutti.table.species.batch.header.sampleWeight"),
- n_("tutti.table.species.batch.header.sampleWeight"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> ELEVATION_RATIO = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
- n_("tutti.table.species.batch.header.elevationRate"),
- n_("tutti.table.species.batch.header.elevationRate"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> COMMENT = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_COMMENT,
- n_("tutti.table.species.batch.header.comment"),
- n_("tutti.table.species.batch.header.comment"));
-
- public static final ColumnIdentifier<SpeciesBatchRowModel> FILE = ColumnIdentifier.newId(
- null,
- n_("tutti.table.species.batch.header.file"),
- n_("tutti.table.species.batch.header.file"));
-
-
- protected final Set<ColumnIdentifier<SpeciesBatchRowModel>> noneEditableColIfNoSpecies;
-
- public SpeciesBatchTableModel(TableColumnModel columnModel) {
- super(columnModel);
-
- // TODO This will be dynamic by the protocol...
- setNoneEditableCols(
- AGE,
- MATURITY,
- SAMPLE_WEIGHT,
- ELEVATION_RATIO,
- FILE
- );
- noneEditableColIfNoSpecies = Sets.newHashSet();
- noneEditableColIfNoSpecies.add(COMPUTED_NUMBER);
- noneEditableColIfNoSpecies.add(COMPUTED_WEIGHT);
- }
-
- @Override
- protected SpeciesBatchRowModel createNewRow() {
- return new SpeciesBatchRowModel();
- }
-
- @Override
- public void setValueAt(Object aValue,
- int rowIndex,
- int columnIndex,
- ColumnIdentifier<SpeciesBatchRowModel> propertyName,
- SpeciesBatchRowModel entry) {
- super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
-
- if (propertyName == SPECIES_BY_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- SPECIES_BY_GENUS_CODE,
- COMPUTED_NUMBER,
- COMPUTED_WEIGHT);
-
- } else if (propertyName == SPECIES_BY_GENUS_CODE) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- SPECIES_BY_CODE,
- COMPUTED_NUMBER,
- COMPUTED_WEIGHT);
- } else if (propertyName == COMPUTED_NUMBER) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- COMPUTED_WEIGHT);
-
- } else if (propertyName == COMPUTED_WEIGHT) {
-
- // update also other columns
- fireTableCellUpdated(rowIndex,
- COMPUTED_NUMBER);
- }
- }
-
- @Override
- protected boolean isCellEditable(int rowIndex,
- int columnIndex,
- ColumnIdentifier<SpeciesBatchRowModel> propertyName) {
-
- boolean result = super.isCellEditable(rowIndex,
- columnIndex,
- propertyName);
- if (result) {
-
- if (noneEditableColIfNoSpecies.contains(propertyName)) {
-
- // must have filled a species to edit this column
- SpeciesBatchRowModel entry = getEntry(rowIndex);
- result = entry.getSpecies() != null;
- }
- }
- return result;
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,102 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class SpeciesBatchTreeModel implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Root node (with no sampling on it.
- *
- * @since 0.2
- */
- protected final SpeciesBatchTreeNode root;
-
- /**
- * Property which are used to sub sampling.
- *
- * @since 0.2
- */
- protected final String[] samplingOrder;
-
- /**
- * Samplings view as a linear list (to display in the table).
- *
- * @since 0.2
- */
- protected final List<SpeciesBatchTreeNode> lines;
-
- public SpeciesBatchTreeModel(String... samplingOrder) {
- this.samplingOrder = samplingOrder;
- root = new SpeciesBatchTreeNode();
- lines = Lists.newArrayList();
- }
-
- public SpeciesBatchTreeNode getNode(int rowIndex) {
- return lines.get(rowIndex);
- }
-
- public int getSize() {
- return lines.size();
- }
-
- public void populate(List<SpeciesBatch> data) {
-
- // clear tree representation
- root.removeAllChildren();
-
- // clear linear representation
- lines.clear();
- }
-
- public Object[] getSamplingKey(SpeciesBatch bean) {
- List<Object> result = Lists.newArrayList();
- for (String s : samplingOrder) {
- Object property = TuttiUIUtil.getProperty(bean, s);
- if (property == null) {
- // stop findind sample key
- break;
- }
- result.add(property);
- }
- return result.toArray();
- }
-
- public String[] getSamplingDefinition(SpeciesBatch bean) {
- return null;
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,152 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreeNode;
-import java.io.Serializable;
-
-/**
- * Defines a node of a species catches.
- * <p/>
- * UserObject is the {@link SpeciesBatch}. It can be null on two cases:
- * <ul>
- * <li>On root node</li>
- * <li>For node on a path of sampling but with no filled data </li>
- * </ul>
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class SpeciesBatchTreeNode extends DefaultMutableTreeNode {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Property name defining the sampling.
- * <p/>
- * <strong>Note:</strong> can be null (only for root node).
- *
- * @since 0.2
- */
- protected final String samplingPropertyKey;
-
- /**
- * Property value defining the sampling.
- * <p/>
- * <strong>Note:</strong> can be null (only for root node).
- *
- * @since 0.2
- */
- protected final Serializable samplingPropertyValue;
-
- public SpeciesBatchTreeNode() {
- this(null, null, null);
- }
-
- public SpeciesBatchTreeNode(SpeciesBatch userObject,
- String samplingPropertyKey,
- Serializable samplingPropertyValue) {
- this.samplingPropertyKey = samplingPropertyKey;
- this.samplingPropertyValue = samplingPropertyValue;
- setUserObject(userObject);
- }
-
- public String getSamplingPropertyKey() {
- return samplingPropertyKey;
- }
-
- public Serializable getSamplingPropertyValue() {
- return samplingPropertyValue;
- }
-
- @Override
- public SpeciesBatch getUserObject() {
- return (SpeciesBatch) super.getUserObject();
- }
-
- @Override
- public SpeciesBatchTreeNode getParent() {
- return (SpeciesBatchTreeNode) super.getParent();
- }
-
- @Override
- public SpeciesBatchTreeNode getRoot() {
- return (SpeciesBatchTreeNode) super.getRoot();
- }
-
- @Override
- public SpeciesBatchTreeNode getFirstChild() {
- return (SpeciesBatchTreeNode) super.getFirstChild();
- }
-
- @Override
- public SpeciesBatchTreeNode getLastChild() {
- return (SpeciesBatchTreeNode) super.getLastChild();
- }
-
- @Override
- public SpeciesBatchTreeNode getChildAfter(TreeNode aChild) {
- return (SpeciesBatchTreeNode) super.getChildAfter(aChild);
- }
-
- @Override
- public SpeciesBatchTreeNode getChildBefore(TreeNode aChild) {
- return (SpeciesBatchTreeNode) super.getChildBefore(aChild);
- }
-
- @Override
- public SpeciesBatchTreeNode getNextSibling() {
- return (SpeciesBatchTreeNode) super.getNextSibling();
- }
-
- @Override
- public SpeciesBatchTreeNode getPreviousSibling() {
- return (SpeciesBatchTreeNode) super.getPreviousSibling();
- }
-
- @Override
- public SpeciesBatchTreeNode getFirstLeaf() {
- return (SpeciesBatchTreeNode) super.getFirstLeaf();
- }
-
- @Override
- public SpeciesBatchTreeNode getLastLeaf() {
- return (SpeciesBatchTreeNode) super.getLastLeaf();
- }
-
- @Override
- public SpeciesBatchTreeNode getNextLeaf() {
- return (SpeciesBatchTreeNode) super.getNextLeaf();
- }
-
- @Override
- public SpeciesBatchTreeNode getPreviousLeaf() {
- return (SpeciesBatchTreeNode) super.getPreviousLeaf();
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,85 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-NumberEditor {
- autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
- bean: {model};
- showReset: true;
-}
-
-#totalWeightLabel {
- text: "tutti.label.species.totalWeight";
- labelFor: {totalWeightField};
-}
-
-#totalWeightField {
- property: "totalWeight";
- model: {model.getTotalWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#totalVracWeightLabel {
- text: "tutti.label.species.totalVracWeight";
- labelFor: {totalVracWeightField};
-}
-
-#totalVracWeightField {
- property: "totalVracWeight";
- model: {model.getTotalVracWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#sampleVracWeightLabel {
- text: "tutti.label.species.sampleVracWeight";
- labelFor: {sampleVracWeightField};
-}
-
-#sampleVracWeightField {
- property: "sampleVracWeight";
- model: {model.getSampleVracWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#totalHorsVracWeightLabel {
- text: "tutti.label.species.totalHorsVracWeight";
- labelFor: {totalHorsVracWeightField};
-}
-
-#totalHorsVracWeightField {
- property: "totalHorsVracWeight";
- model: {model.getTotalHorsVracWeight()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#table {
- selectionMode: {ListSelectionModel.SINGLE_SELECTION};
- selectionBackground: {null};
- selectionForeground: {Color.BLACK};
- sortable: false;
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,118 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
- fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
- fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI
-
- org.jdesktop.swingx.JXTable
-
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.ListSelectionModel
-
- java.awt.Color
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
-public SpeciesTabUI(FishingOperationsUI parentUI) {
- SpeciesTabUIHandler handler = new SpeciesTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <SpeciesTabUIHandler id='handler'
- initializer='getContextValue(SpeciesTabUIHandler.class)'/>
-
- <SpeciesTabUIModel id='model'
- initializer='getContextValue(SpeciesTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='totalWeight' component='totalWeightField'/>
- <field name='totalVracWeight' component='totalVracWeightField'/>
- <field name='sampleVracWeight' component='sampleVracWeightField'/>
- <field name='totalHorsVracWeight' component='totalHorsVracWeightField'/>
- </BeanValidator>
-
- <SpeciesFrequencyUI id='frequencyUI' constructorParams='handler.getContext()'/>
-
- <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
-
- <!-- Poids total / Poids total vrac -->
- <row>
- <cell anchor='west'>
- <JLabel id='totalWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalWeightField' constructorParams='this'/>
- </cell>
- <cell anchor='west'>
- <JLabel id='totalVracWeightLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='totalVracWeightField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Poids échantillonné vrac / Poids total hors vrac -->
- <row>
- <cell>
- <JLabel id='sampleVracWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='sampleVracWeightField' constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='totalHorsVracWeightLabel'/>
- </cell>
- <cell>
- <NumberEditor id='totalHorsVracWeightField' constructorParams='this'/>
- </cell>
- </row>
- </Table>
-
- <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
- <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
- </JScrollPane>
-
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,393 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
-import fr.ifremer.tutti.persistence.entities.referential.Sex;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
-import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
-import org.nuiton.util.beans.BeanMonitor;
-import org.nuiton.util.decorator.Decorator;
-
-import javax.swing.table.TableColumnModel;
-import java.awt.Color;
-import java.util.List;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTabUIHandler extends AbstractTuttiTableUIHandler<SpeciesBatchRowModel, SpeciesTabUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
-
- private final SpeciesTabUI ui;
-
- private final FishingOperationsUI parentUi;
-
- private final PersistenceService persistenceService;
-
- private final BeanMonitor traitMonitor;
-
- public SpeciesTabUIHandler(FishingOperationsUI parentUi, SpeciesTabUI ui) {
- super(parentUi.getHandler().getContext(),
- SpeciesBatchRowModel.PROPERTY_SPECIES,
- SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
- SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
- SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
- SpeciesBatchRowModel.PROPERTY_SEX,
- SpeciesBatchRowModel.PROPERTY_MATURITY,
- SpeciesBatchRowModel.PROPERTY_AGE,
- SpeciesBatchRowModel.PROPERTY_WEIGHT,
- SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
- SpeciesBatchRowModel.PROPERTY_COMMENT,
- SpeciesBatchRowModel.PROPERTY_FREQUENCY);
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- traitMonitor = new BeanMonitor(
- SpeciesTabUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
- SpeciesTabUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
- SpeciesTabUIModel.PROPERTY_TOTAL_VRAC_WEIGHT,
- SpeciesTabUIModel.PROPERTY_TOTAL_WEIGHT
- );
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getTable();
- }
-
- @Override
- protected SpeciesBatchTableModel getTableModel() {
- return (SpeciesBatchTableModel) getTable().getModel();
- }
-
- @Override
- protected SpeciesTabUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- public void beforeInitUI() {
-
- SpeciesTabUIModel model = new SpeciesTabUIModel();
- ui.setContextValue(model);
-
- traitMonitor.setBean(model);
- }
-
- @Override
- public void afterInitUI() {
-
- initUI(ui);
-
- JXTable table = getTable();
-
- // create table column model
- TableColumnModel columnModel = createTableColumnModel();
-
- // create table model
- SpeciesBatchTableModel tableModel =
- new SpeciesBatchTableModel(columnModel);
-
- table.setModel(tableModel);
- table.setColumnModel(columnModel);
- installTableKeyListener(columnModel, table);
-
- table.getTableHeader().setReorderingAllowed(false);
-
- table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(
- HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
-
- // when model datas change let's propagate it table model
- listenRowsFromModel();
-
- // save when row chaged and was modified
- listenRowModification(table);
-
- // always scroll to selected row
- SwingUtil.scrollToTableSelection(getTable());
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected void saveRow(SpeciesBatchRowModel row) {
- SpeciesBatch catchBean = row.toBean();
-
- FishingOperation fishingOperation = getModel().getTrait();
- catchBean.setFishingOperation(fishingOperation);
- if (log.isInfoEnabled()) {
- log.info("Selected fishingOperation: " + fishingOperation.getId());
- }
-
- if (TuttiEntities.isNew(catchBean)) {
-
- catchBean = persistenceService.createSpeciesBatch(catchBean);
- row.setId(catchBean.getId());
- } else {
- persistenceService.saveSpeciesBatch(catchBean);
- }
-
- List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
-
- List<SpeciesBatchFrequency> frequency =
- SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
-
- if (log.isInfoEnabled()) {
- log.info("Will save " + frequency.size() + " frequencies.");
- }
- frequency = persistenceService.saveSpeciesBatchFrequency(
- catchBean.getId(), frequency);
-
-
- // push it back to row model
- frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
- row.setFrequency(frequencyRows);
- }
-
- public void selectFishingOperation(FishingOperation bean) {
-
- JXTable table = ui.getTable();
-
- if (table.isEditing()) {
-
- // make sure to stop editor
- table.editingCanceled(null);
- }
-
- if (traitMonitor.wasModified()) {
-
- // previous fishingOperation was modified, let's save it
- SpeciesTabUIModel traitMonitorBean =
- (SpeciesTabUIModel) traitMonitor.getBean();
-
- FishingOperation fishingOperation = traitMonitorBean.toBean();
-
- if (log.isInfoEnabled()) {
- log.info("FishingOperation " + fishingOperation.getId() +
- " was modified, will save it.");
- }
-
- persistenceService.saveFishingOperation(fishingOperation);
- }
-
- // make sure selection is empty (will remove bean from monitor)
- table.clearSelection();
-
- boolean empty = bean == null;
-
- SpeciesTabUIModel model = getModel();
-
- List<SpeciesBatchRowModel> rows;
-
- if (empty) {
- rows = null;
- bean = new FishingOperation();
- model.setTrait(null);
- } else {
-
- if (log.isInfoEnabled()) {
- log.info("Get species batch for fishingOperation: " + bean.getId());
- }
- rows = Lists.newArrayList();
-
- if (!TuttiEntities.isNew(bean)) {
- List<SpeciesBatch> catches =
- persistenceService.getAllSpeciesBatch(bean.getId());
- for (SpeciesBatch aBatch : catches) {
- List<SpeciesBatchFrequency> frequencies =
- persistenceService.getAllSpeciesBatchFrequency(aBatch.getId());
- SpeciesBatchRowModel entry =
- new SpeciesBatchRowModel(aBatch, frequencies);
- rows.add(entry);
- }
- }
- model.setTrait(bean);
- }
-
- model.fromBean(bean);
- model.setRows(rows);
-
- listenModifcationOnFirstRow();
-
- traitMonitor.clearModified();
- }
-
- @Override
- protected TableColumnModel createTableColumnModel() {
-
- DefaultTableColumnModelExt columnModel =
- new DefaultTableColumnModelExt();
-
- { // Species to confirm
-
- addBooleanColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
- getTable());
- }
-
- List<Species> allSpecies = persistenceService.getAllSpecies();
-
- { // Species (by code)
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_CODE);
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_CODE,
- decorator, allSpecies);
- }
-
- { // Species (by genusCode)
-
- Decorator<Species> decorator = getDecorator(
- Species.class, DecoratorService.SPECIES_BY_GENUS);
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
- decorator, allSpecies);
-
- }
-
- { // Vrac / Hors vrac
-
- addComboEnumColumnToModel(columnModel,
- SpeciesBatchTableModel.VRAC_HORS_VRAC,
- VracHorsVracEnum.values());
- }
-
- { // Catégorie de poids
-
- Decorator<WeightCategory> decorator =
- getDecorator(WeightCategory.class,
- DecoratorService.BY_NAME);
-
- List<WeightCategory> data =
- persistenceService.getAllWeightCategory();
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT_CATEGORY,
- decorator, data);
- }
-
- { // Sex
-
- Decorator<Sex> decorator =
- getDecorator(Sex.class, DecoratorService.BY_NAME);
-
- List<Sex> data = persistenceService.getAllSex();
-
- addComboDataColumnToModel(columnModel,
- SpeciesBatchTableModel.SEX,
- decorator, data);
- }
-
- { // Maturity
-
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.MATURITY,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Age
-
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.AGE,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Poids observé
-
- addFloatColumnToModel(columnModel,
- SpeciesBatchTableModel.WEIGHT,
- TuttiUI.DECIMAL3_PATTERN);
- }
-
- { // Poids calculé
-
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_WEIGHT);
- }
-
- { // Nombre calculé
-
- addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
- FrequencyCellComponent.newRender(),
- SpeciesBatchTableModel.COMPUTED_NUMBER);
- }
-
- { // Poids d'échantillon
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.SAMPLE_WEIGHT);
- }
-
- { // Fraction d'élévation
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.ELEVATION_RATIO);
- }
-
- { // Commentaire
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.COMMENT);
- }
-
- { // Pièces-jointes
-
- addColumnToModel(columnModel,
- SpeciesBatchTableModel.FILE);
- }
- return columnModel;
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -1,130 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderModelBuilder;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SpeciesTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, SpeciesBatchRowModel, SpeciesTabUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
-
- public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight";
-
- public static final String PROPERTY_SAMPLE_VRAC_WEIGHT = "sampleVracWeight";
-
- public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
-
- protected FishingOperation trait;
-
- protected Float totalWeight;
-
- protected Float totalVracWeight;
-
- protected Float sampleVracWeight;
-
- protected Float totalHorsVracWeight;
-
- protected static final Binder<FishingOperation, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, SpeciesTabUIModel.class)
- .addProperty("speciesTotalWeight", PROPERTY_TOTAL_WEIGHT)
- .addProperty("speciesTotalHorsVracWeight", PROPERTY_TOTAL_HORS_VRAC_WEIGHT)
- .addProperty("speciesTotalVracWeight", PROPERTY_TOTAL_VRAC_WEIGHT)
- .addProperty("speciesSampleVracWeight", PROPERTY_SAMPLE_VRAC_WEIGHT)
- .addProperty("id", PROPERTY_ID)
- .toBinder();
-
- protected static final Binder<SpeciesTabUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, FishingOperation.class)
- .addProperty(PROPERTY_TOTAL_WEIGHT, "speciesTotalWeight")
- .addProperty(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, "speciesTotalHorsVracWeight")
- .addProperty(PROPERTY_TOTAL_VRAC_WEIGHT, "speciesTotalVracWeight")
- .addProperty(PROPERTY_SAMPLE_VRAC_WEIGHT, "speciesSampleVracWeight")
- .toBinder();
-
- public SpeciesTabUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
- }
-
- public FishingOperation getTrait() {
- return trait;
- }
-
- public void setTrait(FishingOperation trait) {
- this.trait = trait;
- }
-
- public Float getTotalWeight() {
- return totalWeight;
- }
-
- public void setTotalWeight(Float totalWeight) {
- Object oldValue = getTotalWeight();
- this.totalWeight = totalWeight;
- firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
- }
-
- public Float getTotalVracWeight() {
- return totalVracWeight;
- }
-
- public void setTotalVracWeight(Float totalVracWeight) {
- Object oldValue = getTotalVracWeight();
- this.totalVracWeight = totalVracWeight;
- firePropertyChange(PROPERTY_TOTAL_VRAC_WEIGHT, oldValue, totalVracWeight);
- }
-
- public Float getSampleVracWeight() {
- return sampleVracWeight;
- }
-
- public void setSampleVracWeight(Float sampleVracWeight) {
- Object oldValue = getSampleVracWeight();
- this.sampleVracWeight = sampleVracWeight;
- firePropertyChange(PROPERTY_SAMPLE_VRAC_WEIGHT, oldValue, sampleVracWeight);
- }
-
- public Float getTotalHorsVracWeight() {
- return totalHorsVracWeight;
- }
-
- public void setTotalHorsVracWeight(Float totalHorsVracWeight) {
- Object oldValue = getTotalHorsVracWeight();
- this.totalHorsVracWeight = totalHorsVracWeight;
- firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
- }
-
- @Override
- protected FishingOperation newEntity() {
- return trait;
- }
-
-}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
@@ -26,7 +26,7 @@
<import>
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchRowModel
jaxx.runtime.swing.CardLayout2Ext
jaxx.runtime.swing.editor.bean.BeanComboBox
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -27,7 +27,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import jaxx.runtime.SwingUtil;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
/**
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
@@ -32,7 +32,7 @@
fr.ifremer.tutti.ui.swing.content.catches.benthos.BenthosTabUI
fr.ifremer.tutti.ui.swing.content.catches.macrodechet.MacroDechetTabUI
fr.ifremer.tutti.ui.swing.content.catches.plancton.PlanctonTabUI
- fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTabUI
+ fr.ifremer.tutti.ui.swing.content.operation.species.SpeciesTabUI
jaxx.runtime.swing.editor.bean.BeanComboBox
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,256 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.base.Preconditions;
+import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.JButton;
+import javax.swing.JTable;
+import javax.swing.border.LineBorder;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Frame;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Component to render and edit frequency stuff from batch table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class FrequencyCellComponent extends JButton {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String ROW_INDEX = "rowIndex";
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(FrequencyCellComponent.class);
+
+ public FrequencyCellComponent() {
+ setContentAreaFilled(false);
+ setOpaque(false);
+ setIcon(SwingUtil.createActionIcon("show-frequency"));
+ }
+
+ public static TableCellRenderer newRender() {
+ return new FrequencyCellRenderer();
+ }
+
+ public static TableCellEditor newEditor(SpeciesFrequencyUI ui) {
+ return new FrequencyCellEditor(ui);
+ }
+
+ public static class FrequencyCellEditor extends AbstractCellEditor implements TableCellEditor {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final FrequencyCellComponent component;
+
+ protected final SpeciesFrequencyUI ui;
+
+ protected Frame frame;
+
+ protected JTable table;
+
+ protected SpeciesBatchTableModel tableModel;
+
+ protected ColumnIdentifier<SpeciesBatchRowModel> columnIdentifier;
+
+ protected SpeciesBatchRowModel editRow;
+
+ protected Integer rowIndex;
+
+ protected Integer columnIndex;
+
+ public FrequencyCellEditor(SpeciesFrequencyUI ui) {
+ this.ui = ui;
+ component = new FrequencyCellComponent();
+ component.setBorder(new LineBorder(Color.BLACK));
+ component.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER ||
+ e.getKeyCode() == KeyEvent.VK_SPACE) {
+ e.consume();
+ startEdit();
+ }
+ }
+ });
+
+ component.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ e.consume();
+ startEdit();
+ }
+ });
+ }
+
+ protected void startEdit() {
+
+ Preconditions.checkNotNull(tableModel, "No table model assigned.");
+
+ // open frequency dialog
+
+ Preconditions.checkNotNull(editRow, "No editRow found.");
+
+ if (log.isInfoEnabled()) {
+ log.info("Will edit frequencies for row: " + rowIndex);
+ }
+
+ if (frame == null) {
+ frame = SwingUtil.getParentContainer(ui, Frame.class);
+ }
+
+ ui.editBatch(editRow);
+
+ // open frequency dialog
+ TuttiUIUtil.openInDialog(ui, frame, _("tutti.title.frequency"), true, null);
+
+ // at close, synch back frequencies
+
+ editRow.updateTotalFromFrequencies();
+
+ int r = rowIndex;
+ int c = columnIndex;
+
+ // stop edition
+ stopCellEditing();
+
+ // reselect this cell
+ AbstractSelectTableAction.doSelectCell(table, r, c);
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ int row,
+ int column) {
+ if (tableModel == null) {
+ tableModel = (SpeciesBatchTableModel) table.getModel();
+ this.table = table;
+ columnIdentifier = tableModel.getPropertyName(column);
+ }
+ String text;
+ if (value == null) {
+ text = " - ";
+ } else {
+ text = String.valueOf(value);
+ }
+ component.setText(text);
+
+ rowIndex = row;
+ columnIndex = column;
+
+ editRow = tableModel.getEntry(row);
+
+ return component;
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+
+ Preconditions.checkNotNull(editRow, "No editRow found in editor.");
+
+ Object result;
+ if (columnIdentifier == SpeciesBatchTableModel.COMPUTED_NUMBER) {
+ result = editRow.getComputedNumber();
+ } else {
+ result = editRow.getComputedWeight();
+ }
+ if (log.isInfoEnabled()) {
+ log.info("editor value (" + columnIdentifier + "): " + result);
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean stopCellEditing() {
+ boolean b = super.stopCellEditing();
+ if (b) {
+ rowIndex = null;
+ editRow = null;
+ columnIndex = null;
+ }
+ return b;
+ }
+
+ @Override
+ public void cancelCellEditing() {
+ super.cancelCellEditing();
+ rowIndex = null;
+ columnIndex = null;
+ editRow = null;
+ }
+ }
+
+ public static class FrequencyCellRenderer implements TableCellRenderer {
+
+ protected final FrequencyCellComponent component;
+
+ public FrequencyCellRenderer() {
+ component = new FrequencyCellComponent();
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row,
+ int column) {
+
+ String text;
+ if (value == null) {
+ text = " - ";
+ } else {
+ text = String.valueOf(value);
+ }
+ boolean editable = table.isCellEditable(row, column);
+ component.setEnabled(editable);
+ component.setText(text);
+ return component;
+ }
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/FrequencyCellComponent.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,379 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
+import fr.ifremer.tutti.persistence.entities.referential.Sex;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
+import org.apache.commons.collections.CollectionUtils;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Represents a species batch (i.e a row in the batch table).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, SpeciesBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_SPECIES = "species";
+
+ public static final String PROPERTY_SPECIES_TO_CONFIRM = "speciesToConfirm";
+
+ public static final String PROPERTY_VRAC_HORS_VRAC = "vracHorsVrac";
+
+ public static final String PROPERTY_WEIGHT_CATEGORY = "weightCategory";
+
+ public static final String PROPERTY_SEX = "sex";
+
+ public static final String PROPERTY_MATURITY = "maturity";
+
+ public static final String PROPERTY_AGE = "age";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
+
+ public static final String PROPERTY_SAMPLING_RATIO = "samplingRatio";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_FREQUENCY = "frequency";
+
+ public static final String PROPERTY_COMPUTED_NUMBER = "computedNumber";
+
+ public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
+
+ /**
+ * Species observed.
+ *
+ * @since 0.2
+ */
+ protected Species species;
+
+ /**
+ * Is the species need to be confirmed?.
+ *
+ * @since 0.2
+ */
+ protected boolean speciesToConfirm;
+
+ /**
+ * Is catch is vrac or horsVrac?.
+ *
+ * @since 0.2
+ */
+ protected VracHorsVracEnum vracHorsVrac;
+
+ /**
+ * Weight category (can be null).
+ *
+ * @since 0.2
+ */
+ protected WeightCategory weightCategory;
+
+ /**
+ * Sex (can be null).
+ *
+ * @since 0.2
+ */
+ protected Sex sex;
+
+ /**
+ * Maturity (can be null).
+ *
+ * @since 0.2
+ */
+ protected Float maturity;
+
+ /**
+ * Age (can be null).
+ *
+ * @since 0.2
+ */
+ protected Float age;
+
+ /**
+ * Observed weight.
+ *
+ * @since 0.2
+ */
+ protected Float weight;
+
+ /**
+ * Total computed weight (from frequencies).
+ *
+ * @since 0.2
+ */
+ protected Float computedWeight;
+
+ /**
+ * Total computed number (from frequencies).
+ *
+ * @since 0.2
+ */
+ protected Float computedNumber;
+
+ /**
+ * Sample weight.
+ *
+ * @since 0.2
+ */
+ protected Float sampleWeight;
+
+ /**
+ * Elevation ratio.
+ *
+ * @since 0.2
+ */
+ protected Float samplingRatio;
+
+ /**
+ * Comment on this catches.
+ *
+ * @since 0.2
+ */
+ protected String comment;
+
+ /**
+ * List of frequencies observed for this batch.
+ *
+ * @since 0.2
+ */
+ protected List<SpeciesFrequencyRowModel> frequency;
+
+ protected static final Binder<SpeciesBatch, SpeciesBatchRowModel> fromBeanBinder =
+ BinderFactory.newBinder(SpeciesBatch.class,
+ SpeciesBatchRowModel.class);
+
+ protected static final Binder<SpeciesBatchRowModel, SpeciesBatch> toBeanBinder =
+ BinderFactory.newBinder(SpeciesBatchRowModel.class,
+ SpeciesBatch.class);
+
+ public SpeciesBatchRowModel() {
+ super(SpeciesBatch.class, fromBeanBinder, toBeanBinder);
+ frequency = Lists.newArrayList();
+ }
+
+ public SpeciesBatchRowModel(SpeciesBatch aBatch,
+ List<SpeciesBatchFrequency> frequencies) {
+ this();
+ fromBean(aBatch);
+ List<SpeciesFrequencyRowModel> frequencyRows =
+ SpeciesFrequencyRowModel.fromBeans(frequencies);
+ frequency.addAll(frequencyRows);
+ Collections.sort(frequency);
+ updateTotalFromFrequencies();
+ }
+
+ public void updateTotalFromFrequencies() {
+ Float totalNumber = null;
+ Float totalWeight = null;
+ if (CollectionUtils.isNotEmpty(frequency)) {
+ totalNumber = 0f;
+ totalWeight = 0f;
+ for (SpeciesFrequencyRowModel frequencyModel : frequency) {
+ totalNumber += frequencyModel.getNumber();
+ Float w = frequencyModel.getWeight();
+ if (w == null) {
+
+ // can't sum when a null value appears
+ totalWeight = null;
+ } else if (totalWeight != null) {
+
+ // still can sum weights
+ totalWeight += w;
+ }
+ }
+ }
+
+ setComputedNumber(totalNumber);
+ setComputedWeight(totalWeight);
+ }
+
+ public Species getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(Species species) {
+ Object oldValue = getSpecies();
+ this.species = species;
+ firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ }
+
+ public Boolean getSpeciesToConfirm() {
+ return speciesToConfirm;
+ }
+
+ public void setSpeciesToConfirm(Boolean speciesToConfirm) {
+ Object oldValue = getSpeciesToConfirm();
+ this.speciesToConfirm = speciesToConfirm;
+ firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
+ }
+
+ public VracHorsVracEnum getVracHorsVrac() {
+ return vracHorsVrac;
+ }
+
+ public void setVracHorsVrac(VracHorsVracEnum vracHorsVrac) {
+ Object oldValue = getVracHorsVrac();
+ this.vracHorsVrac = vracHorsVrac;
+ firePropertyChange(PROPERTY_VRAC_HORS_VRAC, oldValue, vracHorsVrac);
+ }
+
+ public WeightCategory getWeightCategory() {
+ return weightCategory;
+ }
+
+ public void setWeightCategory(WeightCategory weightCategory) {
+ Object oldValue = getWeightCategory();
+ this.weightCategory = weightCategory;
+ firePropertyChange(PROPERTY_WEIGHT_CATEGORY, oldValue, weightCategory);
+ }
+
+ public Sex getSex() {
+ return sex;
+ }
+
+ public void setSex(Sex sex) {
+ Object oldValue = getSex();
+ this.sex = sex;
+ firePropertyChange(PROPERTY_SEX, oldValue, sex);
+ }
+
+ public Float getMaturity() {
+ return maturity;
+ }
+
+ public void setMaturity(Float maturity) {
+ Object oldValue = getMaturity();
+ this.maturity = maturity;
+ firePropertyChange(PROPERTY_MATURITY, oldValue, maturity);
+ }
+
+ public Float getAge() {
+ return age;
+ }
+
+ public void setAge(Float age) {
+ Object oldValue = getAge();
+ this.age = age;
+ firePropertyChange(PROPERTY_AGE, oldValue, age);
+ }
+
+ public Float getWeight() {
+ return weight;
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ this.weight = weight;
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+ public Float getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(Float sampleWeight) {
+ Object oldValue = getSampleWeight();
+ this.sampleWeight = sampleWeight;
+ firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
+ }
+
+ public Float getSamplingRatio() {
+ return samplingRatio;
+ }
+
+ public void setSamplingRatio(Float samplingRatio) {
+ Object oldValue = getSamplingRatio();
+ this.samplingRatio = samplingRatio;
+ firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public List<SpeciesFrequencyRowModel> getFrequency() {
+ return frequency;
+ }
+
+ public void setFrequency(List<SpeciesFrequencyRowModel> frequency) {
+ Object oldValue = getFrequency();
+ this.frequency = frequency;
+ firePropertyChange(PROPERTY_FREQUENCY, oldValue, frequency);
+ }
+
+ public Float getComputedWeight() {
+ return computedWeight;
+ }
+
+ public void setComputedWeight(Float computedWeight) {
+ Object oldValue = getComputedWeight();
+ this.computedWeight = computedWeight;
+ firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue,
+ computedWeight);
+ }
+
+ public Float getComputedNumber() {
+ return computedNumber;
+ }
+
+ public void setComputedNumber(Float computedNumber) {
+ Object oldValue = getComputedNumber();
+ this.computedNumber = computedNumber;
+ firePropertyChange(PROPERTY_COMPUTED_NUMBER, oldValue,
+ computedNumber);
+ }
+
+ //TODO Use validator
+ @Override
+ public boolean isValid() {
+ return species != null && weight != null;
+ }
+
+ public int getRowCount() {
+ return frequency == null ? 0 : frequency.size();
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,200 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Sets;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+
+import javax.swing.table.TableColumnModel;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesBatchTableModel extends AbstractTuttiTableModel<SpeciesBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ n_("tutti.table.species.batch.header.toConfirm"),
+ n_("tutti.table.species.batch.header.toConfirm"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.species.batch.header.speciesByCode"),
+ n_("tutti.table.species.batch.header.speciesByCode"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.species.batch.header.speciesByGenusCode"),
+ n_("tutti.table.species.batch.header.speciesByGenusCode"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> VRAC_HORS_VRAC = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ n_("tutti.table.species.batch.header.vracHorsVrac"),
+ n_("tutti.table.species.batch.header.vracHorsVrac"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT_CATEGORY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ n_("tutti.table.species.batch.header.weightCategory"),
+ n_("tutti.table.species.batch.header.weightCategory"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SEX = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SEX,
+ n_("tutti.table.species.batch.header.sex"),
+ n_("tutti.table.species.batch.header.sex"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> MATURITY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_MATURITY,
+ n_("tutti.table.species.batch.header.maturity"),
+ n_("tutti.table.species.batch.header.maturity"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> AGE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_AGE,
+ n_("tutti.table.species.batch.header.age"),
+ n_("tutti.table.species.batch.header.age"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.species.batch.header.weight"),
+ n_("tutti.table.species.batch.header.weight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMPUTED_WEIGHT,
+ n_("tutti.table.species.batch.header.computedWeight"),
+ n_("tutti.table.species.batch.header.computedWeight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_NUMBER = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMPUTED_NUMBER,
+ n_("tutti.table.species.batch.header.computedNumber"),
+ n_("tutti.table.species.batch.header.computedNumber"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ n_("tutti.table.species.batch.header.sampleWeight"),
+ n_("tutti.table.species.batch.header.sampleWeight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> ELEVATION_RATIO = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ n_("tutti.table.species.batch.header.elevationRate"),
+ n_("tutti.table.species.batch.header.elevationRate"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.species.batch.header.comment"),
+ n_("tutti.table.species.batch.header.comment"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> FILE = ColumnIdentifier.newId(
+ null,
+ n_("tutti.table.species.batch.header.file"),
+ n_("tutti.table.species.batch.header.file"));
+
+
+ protected final Set<ColumnIdentifier<SpeciesBatchRowModel>> noneEditableColIfNoSpecies;
+
+ public SpeciesBatchTableModel(TableColumnModel columnModel) {
+ super(columnModel);
+
+ // TODO This will be dynamic by the protocol...
+ setNoneEditableCols(
+ AGE,
+ MATURITY,
+ SAMPLE_WEIGHT,
+ ELEVATION_RATIO,
+ FILE
+ );
+ noneEditableColIfNoSpecies = Sets.newHashSet();
+ noneEditableColIfNoSpecies.add(COMPUTED_NUMBER);
+ noneEditableColIfNoSpecies.add(COMPUTED_WEIGHT);
+ }
+
+ @Override
+ protected SpeciesBatchRowModel createNewRow() {
+ return new SpeciesBatchRowModel();
+ }
+
+ @Override
+ public void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<SpeciesBatchRowModel> propertyName,
+ SpeciesBatchRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+
+ if (propertyName == SPECIES_BY_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_GENUS_CODE,
+ COMPUTED_NUMBER,
+ COMPUTED_WEIGHT);
+
+ } else if (propertyName == SPECIES_BY_GENUS_CODE) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SPECIES_BY_CODE,
+ COMPUTED_NUMBER,
+ COMPUTED_WEIGHT);
+ } else if (propertyName == COMPUTED_NUMBER) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ COMPUTED_WEIGHT);
+
+ } else if (propertyName == COMPUTED_WEIGHT) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ COMPUTED_NUMBER);
+ }
+ }
+
+ @Override
+ protected boolean isCellEditable(int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<SpeciesBatchRowModel> propertyName) {
+
+ boolean result = super.isCellEditable(rowIndex,
+ columnIndex,
+ propertyName);
+ if (result) {
+
+ if (noneEditableColIfNoSpecies.contains(propertyName)) {
+
+ // must have filled a species to edit this column
+ SpeciesBatchRowModel entry = getEntry(rowIndex);
+ result = entry.getSpecies() != null;
+ }
+ }
+ return result;
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTableModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,102 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesBatchTreeModel implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Root node (with no sampling on it.
+ *
+ * @since 0.2
+ */
+ protected final SpeciesBatchTreeNode root;
+
+ /**
+ * Property which are used to sub sampling.
+ *
+ * @since 0.2
+ */
+ protected final String[] samplingOrder;
+
+ /**
+ * Samplings view as a linear list (to display in the table).
+ *
+ * @since 0.2
+ */
+ protected final List<SpeciesBatchTreeNode> lines;
+
+ public SpeciesBatchTreeModel(String... samplingOrder) {
+ this.samplingOrder = samplingOrder;
+ root = new SpeciesBatchTreeNode();
+ lines = Lists.newArrayList();
+ }
+
+ public SpeciesBatchTreeNode getNode(int rowIndex) {
+ return lines.get(rowIndex);
+ }
+
+ public int getSize() {
+ return lines.size();
+ }
+
+ public void populate(List<SpeciesBatch> data) {
+
+ // clear tree representation
+ root.removeAllChildren();
+
+ // clear linear representation
+ lines.clear();
+ }
+
+ public Object[] getSamplingKey(SpeciesBatch bean) {
+ List<Object> result = Lists.newArrayList();
+ for (String s : samplingOrder) {
+ Object property = TuttiUIUtil.getProperty(bean, s);
+ if (property == null) {
+ // stop findind sample key
+ break;
+ }
+ result.add(property);
+ }
+ return result.toArray();
+ }
+
+ public String[] getSamplingDefinition(SpeciesBatch bean) {
+ return null;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeNode.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,152 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+import java.io.Serializable;
+
+/**
+ * Defines a node of a species catches.
+ * <p/>
+ * UserObject is the {@link SpeciesBatch}. It can be null on two cases:
+ * <ul>
+ * <li>On root node</li>
+ * <li>For node on a path of sampling but with no filled data </li>
+ * </ul>
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesBatchTreeNode extends DefaultMutableTreeNode {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Property name defining the sampling.
+ * <p/>
+ * <strong>Note:</strong> can be null (only for root node).
+ *
+ * @since 0.2
+ */
+ protected final String samplingPropertyKey;
+
+ /**
+ * Property value defining the sampling.
+ * <p/>
+ * <strong>Note:</strong> can be null (only for root node).
+ *
+ * @since 0.2
+ */
+ protected final Serializable samplingPropertyValue;
+
+ public SpeciesBatchTreeNode() {
+ this(null, null, null);
+ }
+
+ public SpeciesBatchTreeNode(SpeciesBatch userObject,
+ String samplingPropertyKey,
+ Serializable samplingPropertyValue) {
+ this.samplingPropertyKey = samplingPropertyKey;
+ this.samplingPropertyValue = samplingPropertyValue;
+ setUserObject(userObject);
+ }
+
+ public String getSamplingPropertyKey() {
+ return samplingPropertyKey;
+ }
+
+ public Serializable getSamplingPropertyValue() {
+ return samplingPropertyValue;
+ }
+
+ @Override
+ public SpeciesBatch getUserObject() {
+ return (SpeciesBatch) super.getUserObject();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getParent() {
+ return (SpeciesBatchTreeNode) super.getParent();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getRoot() {
+ return (SpeciesBatchTreeNode) super.getRoot();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getFirstChild() {
+ return (SpeciesBatchTreeNode) super.getFirstChild();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getLastChild() {
+ return (SpeciesBatchTreeNode) super.getLastChild();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getChildAfter(TreeNode aChild) {
+ return (SpeciesBatchTreeNode) super.getChildAfter(aChild);
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getChildBefore(TreeNode aChild) {
+ return (SpeciesBatchTreeNode) super.getChildBefore(aChild);
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getNextSibling() {
+ return (SpeciesBatchTreeNode) super.getNextSibling();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getPreviousSibling() {
+ return (SpeciesBatchTreeNode) super.getPreviousSibling();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getFirstLeaf() {
+ return (SpeciesBatchTreeNode) super.getFirstLeaf();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getLastLeaf() {
+ return (SpeciesBatchTreeNode) super.getLastLeaf();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getNextLeaf() {
+ return (SpeciesBatchTreeNode) super.getNextLeaf();
+ }
+
+ @Override
+ public SpeciesBatchTreeNode getPreviousLeaf() {
+ return (SpeciesBatchTreeNode) super.getPreviousLeaf();
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesBatchTreeNode.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,85 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#totalWeightLabel {
+ text: "tutti.label.species.totalWeight";
+ labelFor: {totalWeightField};
+}
+
+#totalWeightField {
+ property: "totalWeight";
+ model: {model.getTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#totalVracWeightLabel {
+ text: "tutti.label.species.totalVracWeight";
+ labelFor: {totalVracWeightField};
+}
+
+#totalVracWeightField {
+ property: "totalVracWeight";
+ model: {model.getTotalVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#sampleVracWeightLabel {
+ text: "tutti.label.species.sampleVracWeight";
+ labelFor: {sampleVracWeightField};
+}
+
+#sampleVracWeightField {
+ property: "sampleVracWeight";
+ model: {model.getSampleVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#totalHorsVracWeightLabel {
+ text: "tutti.label.species.totalHorsVracWeight";
+ labelFor: {totalHorsVracWeightField};
+}
+
+#totalHorsVracWeightField {
+ property: "totalHorsVracWeight";
+ model: {model.getTotalHorsVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#table {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx (from rev 40, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,118 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI
+
+ org.jdesktop.swingx.JXTable
+
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ javax.swing.ListSelectionModel
+
+ java.awt.Color
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+public SpeciesTabUI(FishingOperationsUI parentUI) {
+ SpeciesTabUIHandler handler = new SpeciesTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <SpeciesTabUIHandler id='handler'
+ initializer='getContextValue(SpeciesTabUIHandler.class)'/>
+
+ <SpeciesTabUIModel id='model'
+ initializer='getContextValue(SpeciesTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='totalWeight' component='totalWeightField'/>
+ <field name='totalVracWeight' component='totalVracWeightField'/>
+ <field name='sampleVracWeight' component='sampleVracWeightField'/>
+ <field name='totalHorsVracWeight' component='totalHorsVracWeightField'/>
+ </BeanValidator>
+
+ <SpeciesFrequencyUI id='frequencyUI' constructorParams='handler.getContext()'/>
+
+ <Table id='form' fill='both' constraints='BorderLayout.NORTH'>
+
+ <!-- Poids total / Poids total vrac -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='totalWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalWeightField' constructorParams='this'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='totalVracWeightLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='totalVracWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Poids échantillonné vrac / Poids total hors vrac -->
+ <row>
+ <cell>
+ <JLabel id='sampleVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='sampleVracWeightField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='totalHorsVracWeightLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='totalHorsVracWeightField' constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
+ <JXTable id='table' onFocusLost='handler.saveSelectedRowIfRequired(event);'/>
+ </JScrollPane>
+
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java (from rev 40, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,393 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
+import fr.ifremer.tutti.persistence.entities.referential.Sex;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.TuttiUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
+import org.nuiton.util.beans.BeanMonitor;
+import org.nuiton.util.decorator.Decorator;
+
+import javax.swing.table.TableColumnModel;
+import java.awt.Color;
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTabUIHandler extends AbstractTuttiTableUIHandler<SpeciesBatchRowModel, SpeciesTabUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
+
+ private final SpeciesTabUI ui;
+
+ private final FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ private final BeanMonitor traitMonitor;
+
+ public SpeciesTabUIHandler(FishingOperationsUI parentUi, SpeciesTabUI ui) {
+ super(parentUi.getHandler().getContext(),
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ SpeciesBatchRowModel.PROPERTY_SEX,
+ SpeciesBatchRowModel.PROPERTY_MATURITY,
+ SpeciesBatchRowModel.PROPERTY_AGE,
+ SpeciesBatchRowModel.PROPERTY_WEIGHT,
+ SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
+ SpeciesBatchRowModel.PROPERTY_COMMENT,
+ SpeciesBatchRowModel.PROPERTY_FREQUENCY);
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ traitMonitor = new BeanMonitor(
+ SpeciesTabUIModel.PROPERTY_SAMPLE_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_HORS_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_VRAC_WEIGHT,
+ SpeciesTabUIModel.PROPERTY_TOTAL_WEIGHT
+ );
+ }
+
+ @Override
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
+ protected SpeciesBatchTableModel getTableModel() {
+ return (SpeciesBatchTableModel) getTable().getModel();
+ }
+
+ @Override
+ protected SpeciesTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ SpeciesTabUIModel model = new SpeciesTabUIModel();
+ ui.setContextValue(model);
+
+ traitMonitor.setBean(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ JXTable table = getTable();
+
+ // create table column model
+ TableColumnModel columnModel = createTableColumnModel();
+
+ // create table model
+ SpeciesBatchTableModel tableModel =
+ new SpeciesBatchTableModel(columnModel);
+
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+ installTableKeyListener(columnModel, table);
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+ table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
+
+ // when model datas change let's propagate it table model
+ listenRowsFromModel();
+
+ // save when row chaged and was modified
+ listenRowModification(table);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected void saveRow(SpeciesBatchRowModel row) {
+ SpeciesBatch catchBean = row.toBean();
+
+ FishingOperation fishingOperation = getModel().getTrait();
+ catchBean.setFishingOperation(fishingOperation);
+ if (log.isInfoEnabled()) {
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
+ }
+
+ if (TuttiEntities.isNew(catchBean)) {
+
+ catchBean = persistenceService.createSpeciesBatch(catchBean);
+ row.setId(catchBean.getId());
+ } else {
+ persistenceService.saveSpeciesBatch(catchBean);
+ }
+
+ List<SpeciesFrequencyRowModel> frequencyRows = row.getFrequency();
+
+ List<SpeciesBatchFrequency> frequency =
+ SpeciesFrequencyRowModel.toBeans(frequencyRows, catchBean);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will save " + frequency.size() + " frequencies.");
+ }
+ frequency = persistenceService.saveSpeciesBatchFrequency(
+ catchBean.getId(), frequency);
+
+
+ // push it back to row model
+ frequencyRows = SpeciesFrequencyRowModel.fromBeans(frequency);
+ row.setFrequency(frequencyRows);
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ JXTable table = ui.getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ if (traitMonitor.wasModified()) {
+
+ // previous fishingOperation was modified, let's save it
+ SpeciesTabUIModel traitMonitorBean =
+ (SpeciesTabUIModel) traitMonitor.getBean();
+
+ FishingOperation fishingOperation = traitMonitorBean.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("FishingOperation " + fishingOperation.getId() +
+ " was modified, will save it.");
+ }
+
+ persistenceService.saveFishingOperation(fishingOperation);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+
+ boolean empty = bean == null;
+
+ SpeciesTabUIModel model = getModel();
+
+ List<SpeciesBatchRowModel> rows;
+
+ if (empty) {
+ rows = null;
+ bean = new FishingOperation();
+ model.setTrait(null);
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Get species batch for fishingOperation: " + bean.getId());
+ }
+ rows = Lists.newArrayList();
+
+ if (!TuttiEntities.isNew(bean)) {
+ List<SpeciesBatch> catches =
+ persistenceService.getAllSpeciesBatch(bean.getId());
+ for (SpeciesBatch aBatch : catches) {
+ List<SpeciesBatchFrequency> frequencies =
+ persistenceService.getAllSpeciesBatchFrequency(aBatch.getId());
+ SpeciesBatchRowModel entry =
+ new SpeciesBatchRowModel(aBatch, frequencies);
+ rows.add(entry);
+ }
+ }
+ model.setTrait(bean);
+ }
+
+ model.fromBean(bean);
+ model.setRows(rows);
+
+ listenModifcationOnFirstRow();
+
+ traitMonitor.clearModified();
+ }
+
+ @Override
+ protected TableColumnModel createTableColumnModel() {
+
+ DefaultTableColumnModelExt columnModel =
+ new DefaultTableColumnModelExt();
+
+ { // Species to confirm
+
+ addBooleanColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
+ }
+
+ List<Species> allSpecies = persistenceService.getAllSpecies();
+
+ { // Species (by code)
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_CODE);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_CODE,
+ decorator, allSpecies);
+ }
+
+ { // Species (by genusCode)
+
+ Decorator<Species> decorator = getDecorator(
+ Species.class, DecoratorService.SPECIES_BY_GENUS);
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
+ decorator, allSpecies);
+
+ }
+
+ { // Vrac / Hors vrac
+
+ addComboEnumColumnToModel(columnModel,
+ SpeciesBatchTableModel.VRAC_HORS_VRAC,
+ VracHorsVracEnum.values());
+ }
+
+ { // Catégorie de poids
+
+ Decorator<WeightCategory> decorator =
+ getDecorator(WeightCategory.class,
+ DecoratorService.BY_NAME);
+
+ List<WeightCategory> data =
+ persistenceService.getAllWeightCategory();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.WEIGHT_CATEGORY,
+ decorator, data);
+ }
+
+ { // Sex
+
+ Decorator<Sex> decorator =
+ getDecorator(Sex.class, DecoratorService.BY_NAME);
+
+ List<Sex> data = persistenceService.getAllSex();
+
+ addComboDataColumnToModel(columnModel,
+ SpeciesBatchTableModel.SEX,
+ decorator, data);
+ }
+
+ { // Maturity
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.MATURITY,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Age
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.AGE,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Poids observé
+
+ addFloatColumnToModel(columnModel,
+ SpeciesBatchTableModel.WEIGHT,
+ TuttiUI.DECIMAL3_PATTERN);
+ }
+
+ { // Poids calculé
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_WEIGHT);
+ }
+
+ { // Nombre calculé
+
+ addColumnToModel(columnModel,
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
+ FrequencyCellComponent.newRender(),
+ SpeciesBatchTableModel.COMPUTED_NUMBER);
+ }
+
+ { // Poids d'échantillon
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.SAMPLE_WEIGHT);
+ }
+
+ { // Fraction d'élévation
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.ELEVATION_RATIO);
+ }
+
+ { // Commentaire
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.COMMENT);
+ }
+
+ { // Pièces-jointes
+
+ addColumnToModel(columnModel,
+ SpeciesBatchTableModel.FILE);
+ }
+ return columnModel;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java 2012-12-11 14:29:06 UTC (rev 41)
@@ -0,0 +1,130 @@
+package fr.ifremer.tutti.ui.swing.content.operation.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderModelBuilder;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SpeciesTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, SpeciesBatchRowModel, SpeciesTabUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight";
+
+ public static final String PROPERTY_TOTAL_VRAC_WEIGHT = "totalVracWeight";
+
+ public static final String PROPERTY_SAMPLE_VRAC_WEIGHT = "sampleVracWeight";
+
+ public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
+
+ protected FishingOperation trait;
+
+ protected Float totalWeight;
+
+ protected Float totalVracWeight;
+
+ protected Float sampleVracWeight;
+
+ protected Float totalHorsVracWeight;
+
+ protected static final Binder<FishingOperation, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, SpeciesTabUIModel.class)
+ .addProperty("speciesTotalWeight", PROPERTY_TOTAL_WEIGHT)
+ .addProperty("speciesTotalHorsVracWeight", PROPERTY_TOTAL_HORS_VRAC_WEIGHT)
+ .addProperty("speciesTotalVracWeight", PROPERTY_TOTAL_VRAC_WEIGHT)
+ .addProperty("speciesSampleVracWeight", PROPERTY_SAMPLE_VRAC_WEIGHT)
+ .addProperty("id", PROPERTY_ID)
+ .toBinder();
+
+ protected static final Binder<SpeciesTabUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, FishingOperation.class)
+ .addProperty(PROPERTY_TOTAL_WEIGHT, "speciesTotalWeight")
+ .addProperty(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, "speciesTotalHorsVracWeight")
+ .addProperty(PROPERTY_TOTAL_VRAC_WEIGHT, "speciesTotalVracWeight")
+ .addProperty(PROPERTY_SAMPLE_VRAC_WEIGHT, "speciesSampleVracWeight")
+ .toBinder();
+
+ public SpeciesTabUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public FishingOperation getTrait() {
+ return trait;
+ }
+
+ public void setTrait(FishingOperation trait) {
+ this.trait = trait;
+ }
+
+ public Float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public void setTotalWeight(Float totalWeight) {
+ Object oldValue = getTotalWeight();
+ this.totalWeight = totalWeight;
+ firePropertyChange(PROPERTY_TOTAL_WEIGHT, oldValue, totalWeight);
+ }
+
+ public Float getTotalVracWeight() {
+ return totalVracWeight;
+ }
+
+ public void setTotalVracWeight(Float totalVracWeight) {
+ Object oldValue = getTotalVracWeight();
+ this.totalVracWeight = totalVracWeight;
+ firePropertyChange(PROPERTY_TOTAL_VRAC_WEIGHT, oldValue, totalVracWeight);
+ }
+
+ public Float getSampleVracWeight() {
+ return sampleVracWeight;
+ }
+
+ public void setSampleVracWeight(Float sampleVracWeight) {
+ Object oldValue = getSampleVracWeight();
+ this.sampleVracWeight = sampleVracWeight;
+ firePropertyChange(PROPERTY_SAMPLE_VRAC_WEIGHT, oldValue, sampleVracWeight);
+ }
+
+ public Float getTotalHorsVracWeight() {
+ return totalHorsVracWeight;
+ }
+
+ public void setTotalHorsVracWeight(Float totalHorsVracWeight) {
+ Object oldValue = getTotalHorsVracWeight();
+ this.totalHorsVracWeight = totalHorsVracWeight;
+ firePropertyChange(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, oldValue, totalHorsVracWeight);
+ }
+
+ @Override
+ protected FishingOperation newEntity() {
+ return trait;
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/species/SpeciesTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
Dec. 11, 2012
Author: tchemit
Date: 2012-12-11 15:19:11 +0100 (Tue, 11 Dec 2012)
New Revision: 40
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/40
Log:
rename ScientificCruise to Cruise
move ui to correct packages
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.referential.Strata;
@@ -107,22 +107,22 @@
Program saveProgram(Program bean);
//------------------------------------------------------------------------//
- //-- ScientificCruise methods --//
+ //-- Cruise methods --//
//------------------------------------------------------------------------//
- List<ScientificCruise> getAllScientificCruise(String programId);
+ List<Cruise> getAllCruise(String programId);
- ScientificCruise getScientificCruise(String id);
+ Cruise getCruise(String id);
- ScientificCruise createScientificCruise(ScientificCruise bean);
+ Cruise createCruise(Cruise bean);
- ScientificCruise saveScientificCruise(ScientificCruise bean);
+ Cruise saveCruise(Cruise bean);
//------------------------------------------------------------------------//
//-- FishingOperation methods --//
//------------------------------------------------------------------------//
- List<FishingOperation> getAllFishingOperation(String scientificCruiseId);
+ List<FishingOperation> getAllFishingOperation(String cruiseId);
FishingOperation getFishingOperation(String id);
Modified: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
===================================================================
--- trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-11 14:19:11 UTC (rev 40)
@@ -4,7 +4,7 @@
fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch
fr.ifremer.tutti.persistence.entities.data.PlanctonBatch
fr.ifremer.tutti.persistence.entities.data.Program
-fr.ifremer.tutti.persistence.entities.data.ScientificCruise
+fr.ifremer.tutti.persistence.entities.data.Cruise
fr.ifremer.tutti.persistence.entities.data.SpeciesBatch
fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency
fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
===================================================================
--- trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,8 +28,8 @@
model.tagvalue.noPCS=true
model.tagvalue.beanSuperClass=fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity
-fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.gear.stereotype=ordered
-fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.headOfMission.stereotype=ordered
-fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.headOfSortRoom.stereotype=ordered
-fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.vessel.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.gear.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.headOfMission.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.headOfSortRoom.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.vessel.stereotype=ordered
fr.ifremer.tutti.persistence.entities.data.FishingOperation.attribute.saisisseur.stereotype=ordered
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -42,7 +42,7 @@
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
@@ -267,14 +267,14 @@
}
//------------------------------------------------------------------------//
- //-- ScientificCruise methods --//
+ //-- Cruise methods --//
//------------------------------------------------------------------------//
@Override
- public List<ScientificCruise> getAllScientificCruise(final String programId) {
- List<ScientificCruise> result = Lists.newArrayList(Iterables.filter(getData(ScientificCruise.class), new Predicate<ScientificCruise>() {
+ public List<Cruise> getAllCruise(final String programId) {
+ List<Cruise> result = Lists.newArrayList(Iterables.filter(getData(Cruise.class), new Predicate<Cruise>() {
@Override
- public boolean apply(ScientificCruise input) {
+ public boolean apply(Cruise input) {
return programId.equals(input.getProgram().getId());
}
}));
@@ -282,20 +282,20 @@
}
@Override
- public ScientificCruise getScientificCruise(String id) {
- ScientificCruise result = getBean(ScientificCruise.class, id);
+ public Cruise getCruise(String id) {
+ Cruise result = getBean(Cruise.class, id);
return result;
}
@Override
- public ScientificCruise createScientificCruise(ScientificCruise bean) {
- ScientificCruise result = create(ScientificCruise.class, bean);
+ public Cruise createCruise(Cruise bean) {
+ Cruise result = create(Cruise.class, bean);
return result;
}
@Override
- public ScientificCruise saveScientificCruise(ScientificCruise bean) {
- ScientificCruise result = save(ScientificCruise.class, bean);
+ public Cruise saveCruise(Cruise bean) {
+ Cruise result = save(Cruise.class, bean);
return result;
}
@@ -304,11 +304,11 @@
//------------------------------------------------------------------------//
@Override
- public List<FishingOperation> getAllFishingOperation(final String scientificCruiseId) {
+ public List<FishingOperation> getAllFishingOperation(final String cruiseId) {
List<FishingOperation> result = Lists.newArrayList(Iterables.filter(getData(FishingOperation.class), new Predicate<FishingOperation>() {
@Override
public boolean apply(FishingOperation input) {
- return scientificCruiseId.equals(input.getScientificCruise().getId());
+ return cruiseId.equals(input.getCruise().getId());
}
}));
return result;
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Strata;
@@ -85,7 +85,7 @@
protected void loadDecorators() {
registerMultiJXPathDecorator(Program.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(ScientificCruise.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Cruise.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(FishingOperation.class, "${stationNumber}$s#${fishingOperationNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - ");
registerMultiJXPathDecorator(Zone.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(Vessel.class, "${name}$s#", "#", " - ");
@@ -112,7 +112,7 @@
n_("tutti.property.stationNumber");
n_("tutti.property.date");
n_("tutti.property.program");
- n_("tutti.property.scientificCruise");
+ n_("tutti.property.cruise");
n_("tutti.property.fishingOperation");
n_("tutti.property.zone");
n_("tutti.property.vessel");
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -29,7 +29,7 @@
import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
@@ -227,31 +227,31 @@
}
//------------------------------------------------------------------------//
- //-- ScientificCruise methods --//
+ //-- Cruise methods --//
//------------------------------------------------------------------------//
@Override
- public List<ScientificCruise> getAllScientificCruise(String programId) {
+ public List<Cruise> getAllCruise(String programId) {
checkDriverExists();
- return driver.getAllScientificCruise(programId);
+ return driver.getAllCruise(programId);
}
@Override
- public ScientificCruise getScientificCruise(String id) {
+ public Cruise getCruise(String id) {
checkDriverExists();
- return driver.getScientificCruise(id);
+ return driver.getCruise(id);
}
@Override
- public ScientificCruise createScientificCruise(ScientificCruise bean) {
+ public Cruise createCruise(Cruise bean) {
checkDriverExists();
- return driver.createScientificCruise(bean);
+ return driver.createCruise(bean);
}
@Override
- public ScientificCruise saveScientificCruise(ScientificCruise bean) {
+ public Cruise saveCruise(Cruise bean) {
checkDriverExists();
- return driver.saveScientificCruise(bean);
+ return driver.saveCruise(bean);
}
//------------------------------------------------------------------------//
@@ -259,9 +259,9 @@
//------------------------------------------------------------------------//
@Override
- public List<FishingOperation> getAllFishingOperation(String scientificCruiseId) {
+ public List<FishingOperation> getAllFishingOperation(String cruiseId) {
checkDriverExists();
- return driver.getAllFishingOperation(scientificCruiseId);
+ return driver.getAllFishingOperation(cruiseId);
}
@Override
Modified: trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
===================================================================
--- trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-11 14:19:11 UTC (rev 40)
@@ -6,6 +6,7 @@
tutti.property.beaufortScale=Vent beaufort
tutti.property.codeMemo=Code Memo
tutti.property.country=Pays
+tutti.property.cruise=Campagne
tutti.property.date=Date
tutti.property.firstName=Prénom
tutti.property.fishingOperation=Trait
@@ -14,7 +15,6 @@
tutti.property.lastName=Nom de Famille
tutti.property.name=Nom
tutti.property.program=Série de campagne
-tutti.property.scientificCruise=Campagne
tutti.property.seaState=État de la mer
tutti.property.stationNumber=Numéro de station
tutti.property.strata=Strate d'association
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -65,15 +65,15 @@
text: "tutti.action.selectCampaign";
toolTipText: "tutti.action.selectCampaign.tip";
mnemonic: S;
- enabled: {model.getScreen() != TuttiScreen.SELECT_SCIENTIFIC_CRUISE};
- /*actionIcon: "scientificCruise";*/
+ enabled: {model.getScreen() != TuttiScreen.SELECT_CRUISE};
+ /*actionIcon: "cruise";*/
}
#menuActionFillCatches {
text: "tutti.action.fillCatches";
toolTipText: "tutti.action.fillCatches.tip";
mnemonic: C;
- enabled: {model.getScreen() != TuttiScreen.FILL_FISHING_OPERATION && model.isScientificCruiseContextFilled()};
+ enabled: {model.getScreen() != TuttiScreen.FILL_FISHING_OPERATION && model.isCruiseContextFilled()};
/*actionIcon: "catches";*/
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -25,15 +25,15 @@
*/
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.config.TuttiServiceConfigOption;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
import fr.ifremer.tutti.ui.swing.config.TuttiConfigOption;
-import fr.ifremer.tutti.ui.swing.content.campaign.EditScientificCruiseUI;
-import fr.ifremer.tutti.ui.swing.content.campaign.EditProgramUI;
-import fr.ifremer.tutti.ui.swing.content.campaign.SelectScientificCruiseUI;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.program.EditProgramUI;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
@@ -82,7 +82,7 @@
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if (propertyName.equals(TuttiUIContext.PROPERTY_PROGRAM_ID) ||
- propertyName.equals(TuttiUIContext.PROPERTY_SCIENTIFIC_CRUISE_ID)) {
+ propertyName.equals(TuttiUIContext.PROPERTY_CRUISE_ID)) {
// change the ui title
changeTitle();
@@ -111,14 +111,14 @@
TuttiScreen screen;
- if (context.isScientificCruiseContextFilled()) {
+ if (context.isCruiseContextFilled()) {
// direct fill catches screen
screen = TuttiScreen.FILL_FISHING_OPERATION;
} else {
- // go to select scientificCruise screen
- screen = TuttiScreen.SELECT_SCIENTIFIC_CRUISE;
+ // go to select cruise screen
+ screen = TuttiScreen.SELECT_CRUISE;
}
context.setScreen(screen);
@@ -159,8 +159,8 @@
@Override
public void run() {
- if (TuttiScreen.SELECT_SCIENTIFIC_CRUISE == context.getScreen()) {
- // Reselect home scientificCruise
+ if (TuttiScreen.SELECT_CRUISE == context.getScreen()) {
+ // Reselect home cruise
// SelectCampaignUI homeUI = (SelectCampaignUI) currentBody;
// homeUI.getHandler().selectCampaign();
}
@@ -230,7 +230,7 @@
}
public void showSelectCampaign() {
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
}
public void showFillCatches() {
@@ -320,16 +320,16 @@
closeCurrentBody();
String surveyId = context.getProgramId();
- String campaignId = context.getScientificCruiseId();
+ String campaignId = context.getCruiseId();
JComponent screenUI;
String screenTitle;
switch (screen) {
default:
- case SELECT_SCIENTIFIC_CRUISE:
+ case SELECT_CRUISE:
- screenUI = new SelectScientificCruiseUI(context);
+ screenUI = new SelectCruiseUI(context);
screenTitle = _("tutti.title.home");
break;
@@ -344,15 +344,15 @@
screenUI = new EditProgramUI(context);
break;
- case EDIT_SCIENTIFIC_CRUISE:
+ case EDIT_CRUISE:
if (campaignId == null) {
- screenTitle = _("tutti.title.create.scientificCruise");
+ screenTitle = _("tutti.title.create.cruise");
} else {
- screenTitle = _("tutti.title.edit.scientificCruise");
+ screenTitle = _("tutti.title.edit.cruise");
}
- screenUI = new EditScientificCruiseUI(context);
+ screenUI = new EditCruiseUI(context);
break;
case FILL_FISHING_OPERATION:
@@ -371,7 +371,7 @@
ErrorDialogUI.showError(e);
// go back to home
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
} finally {
// free ui
@@ -435,7 +435,7 @@
if (surveyId == null) {
- // no program selected (so neither scientificCruise)
+ // no program selected (so neither cruise)
title = _("tutti.title.noSelectedProgram");
@@ -447,22 +447,22 @@
title = _("tutti.title.selectedProgram", program.getName()) + " / ";
- String campaignId = context.getScientificCruiseId();
+ String campaignId = context.getCruiseId();
if (campaignId == null) {
- // no selected scientificCruise
+ // no selected cruise
- title += _("tutti.title.noSelectedScientificCruise");
+ title += _("tutti.title.noSelectedCruise");
} else {
- // selected scientificCruise
- ScientificCruise scientificCruise;
- scientificCruise = persistenceService.getScientificCruise(campaignId);
+ // selected cruise
+ Cruise cruise;
+ cruise = persistenceService.getCruise(campaignId);
- title += _("tutti.title.selectedScientificCruise", scientificCruise.getName());
+ title += _("tutti.title.selectedCruise", cruise.getName());
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -33,11 +33,11 @@
public enum TuttiScreen {
/**
- * To select program and scientificCruise.
+ * To select program and cruise.
*
* @since 0.1
*/
- SELECT_SCIENTIFIC_CRUISE,
+ SELECT_CRUISE,
/**
* To edit a program.
@@ -47,11 +47,11 @@
EDIT_PROGRAM,
/**
- * To edit a scientificCruise.
+ * To edit a cruise.
*
* @since 0.1
*/
- EDIT_SCIENTIFIC_CRUISE,
+ EDIT_CRUISE,
/**
* To edit a protocol.
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -26,7 +26,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.TuttiService;
@@ -57,11 +57,11 @@
public static final String PROPERTY_PROGRAM_ID = "programId";
- public static final String PROPERTY_SCIENTIFIC_CRUISE_ID = "scientificCruiseId";
+ public static final String PROPERTY_CRUISE_ID = "cruiseId";
public static final String PROPERTY_SCREEN = "screen";
- public static final String PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED = "scientificCruiseContextFilled";
+ public static final String PROPERTY_CRUISE_CONTEXT_FILLED = "cruiseContextFilled";
/**
* Application context (only one for all the application).
@@ -99,11 +99,11 @@
protected String programId;
/**
- * Id of last selected scientificCruise (can be null if none ever selected).
+ * Id of last selected cruise (can be null if none ever selected).
*
* @since 0.1
*/
- protected String scientificCruiseId;
+ protected String cruiseId;
/**
* Current screen displayed in ui.
@@ -142,13 +142,13 @@
return programId;
}
- public String getScientificCruiseId() {
- return scientificCruiseId;
+ public String getCruiseId() {
+ return cruiseId;
}
- public boolean isScientificCruiseContextFilled() {
+ public boolean isCruiseContextFilled() {
return StringUtils.isNotBlank(programId) &&
- StringUtils.isNotBlank(scientificCruiseId);
+ StringUtils.isNotBlank(cruiseId);
}
public TuttiScreen getScreen() {
@@ -156,25 +156,25 @@
}
public void setProgramId(String programId) {
- boolean oldValue = isScientificCruiseContextFilled();
+ boolean oldValue = isCruiseContextFilled();
this.programId = programId;
// always propagate the change
firePropertyChange(PROPERTY_PROGRAM_ID, null, programId);
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED,
- oldValue, isScientificCruiseContextFilled());
+ firePropertyChange(PROPERTY_CRUISE_CONTEXT_FILLED,
+ oldValue, isCruiseContextFilled());
}
- public void setScientificCruiseId(String scientificCruiseId) {
- boolean oldValue = isScientificCruiseContextFilled();
+ public void setCruiseId(String cruiseId) {
+ boolean oldValue = isCruiseContextFilled();
- this.scientificCruiseId = scientificCruiseId;
+ this.cruiseId = cruiseId;
// always propagate the change
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_ID, null, scientificCruiseId);
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED,
- oldValue, isScientificCruiseContextFilled());
+ firePropertyChange(PROPERTY_CRUISE_ID, null, cruiseId);
+ firePropertyChange(PROPERTY_CRUISE_CONTEXT_FILLED,
+ oldValue, isCruiseContextFilled());
}
public void setScreen(TuttiScreen screen) {
@@ -191,10 +191,10 @@
setProgramId(getConfig().getProgramId());
}
- if (scientificCruiseId == null) {
+ if (cruiseId == null) {
// load it from config
- setScientificCruiseId(getConfig().getScientificCruiseId());
+ setCruiseId(getConfig().getCruiseId());
}
//check if programId is sane
@@ -208,7 +208,7 @@
// not found in this db
setProgramId(null);
- setScientificCruiseId(null);
+ setCruiseId(null);
if (log.isWarnEnabled()) {
log.warn("Remove invalid programId: " + programId);
@@ -221,31 +221,31 @@
setProgramId(programId);
- // test scientificCruiseId
- if (scientificCruiseId != null) {
+ // test cruiseId
+ if (cruiseId != null) {
- ScientificCruise campaign =
- persistenceService.getScientificCruise(scientificCruiseId);
+ Cruise campaign =
+ persistenceService.getCruise(cruiseId);
if (campaign != null &&
!campaign.getProgram().getId().equals(programId)) {
- // not matchin program, reset scientificCruise id
+ // not matchin program, reset cruise id
campaign = null;
}
if (campaign == null) {
// not found in this db
- setScientificCruiseId(null);
+ setCruiseId(null);
if (log.isWarnEnabled()) {
- log.warn("Remove invalid scientificCruiseId: " + scientificCruiseId);
+ log.warn("Remove invalid cruiseId: " + cruiseId);
}
} else {
if (log.isInfoEnabled()) {
- log.info("ScientificCruiseId valid: " + scientificCruiseId);
+ log.info("CruiseId valid: " + cruiseId);
}
}
}
@@ -259,7 +259,7 @@
addPropertyChangeListener(new PropertyChangeListener() {
Set<String> acceptedProperties = Sets.newHashSet(
- PROPERTY_PROGRAM_ID, PROPERTY_SCIENTIFIC_CRUISE_ID);
+ PROPERTY_PROGRAM_ID, PROPERTY_CRUISE_ID);
@Override
public void propertyChange(PropertyChangeEvent evt) {
@@ -276,7 +276,7 @@
// Clear data references
programId = null;
- scientificCruiseId = null;
+ cruiseId = null;
IOUtils.closeQuietly(serviceContext);
@@ -292,11 +292,11 @@
protected void saveContextToConfig() {
if (log.isInfoEnabled()) {
- log.info("Save config (programId: " + programId + ", scientificCruiseId: " +
- scientificCruiseId + ")");
+ log.info("Save config (programId: " + programId + ", cruiseId: " +
+ cruiseId + ")");
}
config.setProgramId(programId);
- config.setScientificCruiseId(scientificCruiseId);
+ config.setCruiseId(cruiseId);
config.save();
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -126,8 +126,8 @@
return applicationConfig.getOption(TuttiConfigOption.PROGRAM_ID.getKey());
}
- public String getScientificCruiseId() {
- return applicationConfig.getOption(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey());
+ public String getCruiseId() {
+ return applicationConfig.getOption(TuttiConfigOption.CRUISE_ID.getKey());
}
public KeyStroke getShortCut(String actionName) {
@@ -173,13 +173,13 @@
}
- public void setScientificCruiseId(String scientificCruiseId) {
- if (scientificCruiseId == null) {
+ public void setCruiseId(String cruiseId) {
+ if (cruiseId == null) {
Properties options = applicationConfig.getOptions();
- options.remove(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey());
+ options.remove(TuttiConfigOption.CRUISE_ID.getKey());
applicationConfig.setOptions(options);
} else {
- applicationConfig.setOption(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey(), scientificCruiseId);
+ applicationConfig.setOption(TuttiConfigOption.CRUISE_ID.getKey(), cruiseId);
}
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -48,8 +48,8 @@
null,
String.class
),
- SCIENTIFIC_CRUISE_ID("tutti.scientificCruiseId",
- n_("tutti.config.scientificCruiseId"),
+ CRUISE_ID("tutti.cruiseId",
+ n_("tutti.config.cruiseId"),
null,
String.class
),
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,94 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-#splitPane {
- orientation: {JSplitPane.VERTICAL_SPLIT};
- resizeWeight: 0.3;
- oneTouchExpandable: true;
- continuousLayout: true;
-}
-
-#form {
- border: {BorderFactory.createTitledBorder((String)null)};
-}
-
-#nameLabel {
- text: "tutti.label.program.name";
- labelFor: {nameField};
-}
-
-#nameField {
- text: {model.getName()};
-}
-
-#commentPane {
- columnHeaderView: {new JLabel(_("tutti.label.comment"))};
- minimumSize: {new Dimension(10,50)};
-}
-
-#commentField {
- text: {getStringValue(model.getComment())};
-}
-
-#zoneLabel {
- text: "tutti.label.program.zone";
- labelFor: {zoneComboBox};
-}
-
-#zoneComboBox {
- property: "zone";
- selectedItem: {model.getZone()};
-}
-
-#saveButton {
- text: "tutti.action.save";
- enabled: {model.isModify() && model.isValid()};
- actionIcon: "save";
-}
-
-#cancelButton {
- text: "tutti.action.cancel";
- actionIcon: "cancel";
-}
-
-#messagePanel {
- border: {BorderFactory.createTitledBorder("Messages")};
- height: 200;
- width: 500;
-}
-
-#errorTable {
- rowSelectionAllowed: true;
- autoCreateRowSorter: true;
- autoResizeMode: 2;
- cellSelectionEnabled: false;
- selectionMode: 0;
- model: {errorTableModel};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,125 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditProgramUIModel, EditProgramUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.Zone
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- java.awt.Dimension
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
-
- </import>
-
- <script><![CDATA[
-
- public EditProgramUI(TuttiUIContext context) {
- EditProgramUIHandler handler = new EditProgramUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
- <EditProgramUIHandler id='handler'
- initializer='getContextValue(EditProgramUIHandler.class)'/>
-
- <EditProgramUIModel id='model'
- initializer='getContextValue(EditProgramUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='name' component='nameField'/>
- <field name='zone' component='zoneComboBox'/>
- <field name='comment' component='commentField'/>
- </BeanValidator>
-
- <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
-
- <Table id='form' fill='both'>
-
- <!-- program name -->
- <row>
- <cell anchor='west'>
- <JLabel id='nameLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JTextField id='nameField'
- onKeyReleased='handler.setText(event, "name")'/>
- </cell>
- </row>
-
- <!-- program zone -->
- <row>
- <cell>
- <JLabel id='zoneLabel'/>
- </cell>
- <cell>
- <BeanComboBox id='zoneComboBox' constructorParams='this'
- genericType='Zone'/>
- </cell>
- </row>
-
- <!-- program comment -->
- <row weighty='0.8'>
- <cell columns='2'>
- <JScrollPane id='commentPane'
- onFocusGained='commentField.requestFocus()'>
- <JTextArea id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </cell>
- </row>
-
- <!-- actions -->
- <row anchor='south'>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1, 0)}'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
- </JPanel>
- </cell>
- </row>
- </Table>
-
- <!-- validation messages -->
- <JPanel id='messagePanel' layout='{new GridLayout()}'>
- <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
- <JTable id='errorTable' />
- </JScrollPane>
- </JPanel>
- </JSplitPane>
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,135 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
-import jaxx.runtime.validator.swing.SwingValidatorUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Handler of UI {@link EditProgramUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EditProgramUIHandler extends AbstractTuttiUIHandler<EditProgramUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(EditProgramUIHandler.class);
-
- private final EditProgramUI ui;
-
- private final PersistenceService persistenceService;
-
- public EditProgramUIHandler(TuttiUIContext context, EditProgramUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- EditProgramUIModel model = new EditProgramUIModel();
-
- String surveyId = context.getProgramId();
- if (surveyId == null) {
-
- if (log.isInfoEnabled()) {
- log.info("Edit new program");
- }
- } else {
-
- if (log.isInfoEnabled()) {
- log.info("Edit existing program " + surveyId);
- }
- // load existing program
- Program program = persistenceService.getProgram(surveyId);
-
- model.fromBean(program);
- }
-
- listModelIsModify(model);
-
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- EditProgramUIModel model = ui.getModel();
- initBeanComboBox(ui.getZoneComboBox(),
- persistenceService.getAllZone(),
- model.getZone());
-
- SwingValidatorUtil.installUI(ui.getErrorTable(),
- new SwingValidatorMessageTableRenderer());
-
- listenValidatorValid(ui.getValidator(), model);
-
- // if new program can already cancel his creation
- model.setModify(model.isCreate());
- }
-
- @Override
- public void onCloseUI() {
- ui.getValidator().setBean(null);
- }
-
- @Override
- protected EditProgramUIModel getModel() {
- return ui.getModel();
- }
-
- public void cancel() {
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
- }
-
- public void save() {
-
- EditProgramUIModel model = ui.getModel();
-
- Program bean = model.toBean();
-
- Program saved;
- if (TuttiEntities.isNew(bean)) {
-
- saved = persistenceService.createProgram(bean);
- } else {
- saved = persistenceService.saveProgram(bean);
- }
-
- context.setProgramId(saved.getId());
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,97 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-/**
- * Bean to edit a program.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EditProgramUIModel extends AbstractTuttiBeanUIModel<Program, EditProgramUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_ZONE = "zone";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_NAME = "name";
-
- protected String name;
-
- protected String comment;
-
- protected Zone zone;
-
- protected static Binder<EditProgramUIModel, Program> toBeanBinder =
- BinderFactory.newBinder(EditProgramUIModel.class,
- Program.class);
-
- protected static Binder<Program, EditProgramUIModel> fromBeanBinder =
- BinderFactory.newBinder(Program.class, EditProgramUIModel.class);
-
-
- public EditProgramUIModel() {
- super(Program.class, fromBeanBinder, toBeanBinder);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- Object oldValue = getName();
- this.name = name;
- firePropertyChange(PROPERTY_NAME, oldValue, name);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public Zone getZone() {
- return zone;
- }
-
- public void setZone(Zone zone) {
- Object oldValue = getZone();
- this.zone = zone;
- firePropertyChange(PROPERTY_ZONE, oldValue, zone);
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,223 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-JToolBar {
- floatable: false;
-}
-
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-BeanListHeader {
- showReset: true;
- i18nPrefix: "tutti.property.";
-}
-
-JList {
- selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
- model: {new DefaultListModel()};
-}
-
-NumberEditor {
- autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
- bean: {model};
- showReset: true;
-}
-
-#splitPane {
- orientation: {JSplitPane.VERTICAL_SPLIT};
- resizeWeight: 0.3;
- oneTouchExpandable: true;
- continuousLayout: true;
-}
-
-#nameLabel {
- text: "tutti.label.scientificCruise.name";
- labelFor: {nameField};
-}
-
-#nameField {
- text: {model.getName()};
-}
-
-#yearLabel {
- text: "tutti.label.scientificCruise.year";
- labelFor: {yearField};
-}
-
-#yearField {
- property: "year";
- model: {model.getYear()};
- useFloat: false;
- numberPattern: {INT_4_DIGITS_PATTERN};
-}
-
-#surveyPartLabel {
- text: "tutti.label.scientificCruise.surveyPart";
- labelFor: {surveyPartField};
-}
-
-#surveyPartField {
- text: {model.getSurveyPart()};
-}
-
-#countryLabel {
- text: "tutti.label.scientificCruise.country";
- labelFor: {countryComboBox};
-}
-
-#countryComboBox {
- property: "country";
- selectedItem: {model.getCountry()};
-}
-
-#programLabel {
- text: "tutti.label.scientificCruise.program";
- labelFor: {surveyComboBox};
-}
-
-#surveyComboBox {
- property: "program";
- selectedItem: {model.getProgram()};
-}
-
-#beginDateLabel {
- text: "tutti.label.scientificCruise.beginDate";
- labelFor: {beginDateField};
-}
-
-#beginDateField {
- date: {model.getBeginDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#endDateLabel {
- text: "tutti.label.scientificCruise.endDate";
- labelFor: {endDateField};
-}
-
-#endDateField {
- date: {model.getEndDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#pocheLabel {
- text: "tutti.label.scientificCruise.poche";
- labelFor: {pocheField};
-}
-
-#pocheField {
- property: "poche";
- model: {model.getPoche()};
- useFloat: false;
- numberPattern: {INT_1_DIGITS_PATTERN};
-}
-
-#vesselPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#vesselHeader {
- labelText: {_("tutti.label.list.vessel")};
- list: {vesselList};
- beanType: {Vessel.class};
-}
-
-#gearPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#gearHeader {
- labelText: {_("tutti.label.list.gear")};
- list: {gearList};
- beanType: {Gear.class};
-}
-
-#headOfMissionPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#headOfMissionHeader {
- labelText: {_("tutti.label.list.headOfMission")};
- list: {headOfMissionList};
- beanType: {Person.class};
-}
-
-#headOfSortRoomPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#headOfSortRoomHeader {
- labelText: {_("tutti.label.list.headOfSortRoom")};
- list: {headOfSortRoomList};
- beanType: {Person.class};
-}
-
-#commentPane {
- columnHeaderView: {new JLabel(_("tutti.label.comment"))};
- minimumSize: {new Dimension(10,50)};
-}
-
-#commentField {
- text: {model.getComment()};
-}
-
-#saveButton {
- actionIcon: "save";
- text: "tutti.action.save";
- enabled: {model.isModify() && model.isValid()};
-}
-
-#cancelButton {
- actionIcon: "cancel";
- text: "tutti.action.cancel";
-}
-
-#generateNameButton {
- actionIcon: "generate";
- text: "tutti.action.generateCampaignName";
- enabled: {model.isCanGenerateName()};
-}
-#messagePanel {
- border: {BorderFactory.createTitledBorder("Messages")};
- height: 200;
- width: 500;
-}
-
-#errorTable {
- rowSelectionAllowed: true;
- autoCreateRowSorter: true;
- autoResizeMode: 2;
- cellSelectionEnabled: false;
- selectionMode: 0;
- model: {errorTableModel};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,238 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditScientificCruiseUIModel, EditScientificCruiseUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.Program
- fr.ifremer.tutti.persistence.entities.referential.Country
- fr.ifremer.tutti.persistence.entities.referential.Gear
- fr.ifremer.tutti.persistence.entities.referential.Person
- fr.ifremer.tutti.persistence.entities.referential.Vessel
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.NumberEditor
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.swing.editor.bean.BeanListHeader
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- org.jdesktop.swingx.JXDatePicker
-
- javax.swing.DefaultListModel
- javax.swing.ListSelectionModel
-
- java.awt.Dimension
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
- </import>
-
- <script><![CDATA[
-
- public EditScientificCruiseUI(TuttiUIContext context) {
- EditScientificCruiseUIHandler handler = new EditScientificCruiseUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
- <EditScientificCruiseUIHandler id='handler'
- initializer='getContextValue(EditScientificCruiseUIHandler.class)'/>
-
- <EditScientificCruiseUIModel id='model'
- initializer='getContextValue(EditScientificCruiseUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='program' component='surveyComboBox'/>
- <field name='year' component='yearField'/>
- <field name='surveyPart' component='surveyPartField'/>
- <field name='name' component='nameField'/>
- <field name='poche' component='pocheField'/>
- <field name='country' component='countryComboBox'/>
- <field name='beginDate' component='beginDateField'/>
- <field name='endDate' component='endDateField'/>
- <field name='vessel' component='vesselPane'/>
- <field name='gear' component='gearPane'/>
- <field name='headOfMission' component='headOfMissionPane'/>
- <field name='headOfSortRoom' component='headOfSortRoomPane'/>
- <field name='comment' component='commentField'/>
- </BeanValidator>
-
- <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
- <Table fill='both'>
-
- <!-- scientificCruise program / year /program part / name -->
- <row>
- <cell anchor='west'>
- <JLabel id='programLabel'/>
- </cell>
- <cell weightx='0.3'>
- <BeanComboBox id='surveyComboBox' constructorParams='this'
- genericType='Program'/>
- </cell>
- <cell anchor='west'>
- <JLabel id='yearLabel'/>
- </cell>
- <cell weightx='0.3'>
- <NumberEditor id='yearField' constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='surveyPartLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JTextField id='surveyPartField'
- onKeyReleased='handler.setText(event, "surveyPart")'/>
- </cell>
- </row>
-
- <!-- scientificCruise name -->
- <row>
- <cell>
- <JLabel id='nameLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JTextField id='nameField'
- onKeyReleased='handler.setText(event, "name")'/>
- </cell>
- <cell columns='2'>
- <JButton id='generateNameButton'
- onActionPerformed='handler.generateCampaignName()'/>
- </cell>
- <cell>
- <JLabel id='pocheLabel'/>
- </cell>
- <cell weightx='0.3'>
- <NumberEditor id='pocheField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- scientificCruise country / begin date / end date -->
- <row>
- <cell>
- <JLabel id='countryLabel'/>
- </cell>
- <cell weightx='0.3'>
- <BeanComboBox id='countryComboBox' constructorParams='this'
- genericType='Country'/>
- </cell>
- <cell>
- <JLabel id='beginDateLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JXDatePicker id='beginDateField'
- onActionPerformed='handler.setDate(event, "beginDate")'/>
- </cell>
- <cell>
- <JLabel id='endDateLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JXDatePicker id='endDateField'
- onActionPerformed='handler.setDate(event, "endDate")'/>
- </cell>
- </row>
-
- <!-- scientificCruise vessel / gear -->
- <row weighty='0.3'>
- <cell columns='6'>
- <JPanel layout='{new GridLayout(1, 0)}'>
- <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
- onFocusGained='vesselList.requestFocus()'>
- <JList id='vesselList'
- onValueChanged='handler.selectListData(event, "vessel")'/>
- <BeanListHeader id='vesselHeader' genericType='Vessel'/>
- </JScrollPane>
- <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
- onFocusGained='gearList.requestFocus()'>
- <JList id='gearList'
- onValueChanged='handler.selectListData(event, "gear")'/>
- <BeanListHeader id='gearHeader' genericType='Gear'/>
- </JScrollPane>
- </JPanel>
- </cell>
- </row>
-
- <!-- scientificCruise headOfMission / headOfSortRoom -->
- <row weighty='0.3'>
- <cell columns='6'>
- <JPanel layout='{new GridLayout(1, 0)}'>
-
- <JScrollPane id='headOfMissionPane'
- columnHeaderView="{headOfMissionHeader}"
- onFocusGained='headOfMissionList.requestFocus()'>
- <JList id='headOfMissionList'
- onValueChanged='handler.selectListData(event, "headOfMission")'/>
- <BeanListHeader id='headOfMissionHeader'
- genericType='Person'/>
- </JScrollPane>
- <JScrollPane id='headOfSortRoomPane'
- columnHeaderView="{headOfSortRoomHeader}"
- onFocusGained='headOfSortRoomList.requestFocus()'>
- <JList id='headOfSortRoomList'
- onValueChanged='handler.selectListData(event, "headOfSortRoom")'/>
- <BeanListHeader id='headOfSortRoomHeader'
- genericType='Person'/>
- </JScrollPane>
- </JPanel>
- </cell>
- </row>
-
- <!-- scientificCruise comment -->
- <row weighty='0.3'>
- <cell columns='6'>
- <JScrollPane id='commentPane'
- onFocusGained='commentField.requestFocus()'>
- <JTextArea id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </cell>
- </row>
-
- <!-- Form Actions -->
- <row>
- <cell columns='6'>
- <JPanel layout='{new GridLayout(1, 0)}'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
- </JPanel>
- </cell>
- </row>
- </Table>
-
- <JPanel id='messagePanel' layout='{new GridLayout()}'>
- <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
- <JTable id='errorTable' />
- </JScrollPane>
- </JPanel>
- </JSplitPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,176 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
-import jaxx.runtime.validator.swing.SwingValidatorUtil;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.List;
-
-/**
- * Handler of UI {@link EditScientificCruiseUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EditScientificCruiseUIHandler extends AbstractTuttiUIHandler<EditScientificCruiseUIModel> {
-
- private final EditScientificCruiseUI ui;
-
- private final PersistenceService persistenceService;
-
- public EditScientificCruiseUIHandler(TuttiUIContext context, EditScientificCruiseUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- EditScientificCruiseUIModel model = new EditScientificCruiseUIModel();
-
- String campaignId = context.getScientificCruiseId();
- if (campaignId == null) {
-
- // create new scientificCruise
- Program program =
- persistenceService.getProgram(context.getProgramId());
- model.setProgram(program);
- model.setPoche(1);
- } else {
-
- // load existing program
- ScientificCruise scientificCruise =
- persistenceService.getScientificCruise(campaignId);
-
- model.fromBean(scientificCruise);
- }
- listModelIsModify(model);
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- initUI(ui);
-
- List<Person> users = persistenceService.getAllPerson();
-
- EditScientificCruiseUIModel model = ui.getModel();
-
- initBeanComboBox(ui.getSurveyComboBox(),
- persistenceService.getAllProgram(),
- model.getProgram());
-
- initBeanComboBox(ui.getCountryComboBox(),
- persistenceService.getAllCountry(),
- model.getCountry());
-
- initBeanList(ui.getVesselHeader(),
- persistenceService.getAllVessel(),
- model.getVessel());
-
- initBeanList(ui.getGearHeader(),
- persistenceService.getAllGear(),
- model.getGear());
-
- initBeanList(ui.getHeadOfMissionHeader(),
- users,
- model.getHeadOfMission());
-
- initBeanList(ui.getHeadOfSortRoomHeader(),
- users,
- model.getHeadOfSortRoom());
-
- SwingValidatorUtil.installUI(ui.getErrorTable(),
- new SwingValidatorMessageTableRenderer());
-
- listenValidatorValid(ui.getValidator(), model);
-
- // if new fishingOperation can already cancel his creation
- model.setModify(model.isCreate());
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected EditScientificCruiseUIModel getModel() {
- return ui.getModel();
- }
-
- public void cancel() {
-
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
- }
-
- public void save() {
-
- EditScientificCruiseUIModel model = ui.getModel();
-
- ScientificCruise bean = model.toBean();
-
- ScientificCruise saved;
- if (TuttiEntities.isNew(bean)) {
-
- saved = persistenceService.createScientificCruise(bean);
- } else {
- saved = persistenceService.saveScientificCruise(bean);
- }
-
- context.setProgramId(saved.getProgram().getId());
- context.setScientificCruiseId(saved.getId());
-
- context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
- }
-
- public static final String scientificCruiseNameFormat = "%1$s_%2$s";
-
- public void generateCampaignName() {
-
- EditScientificCruiseUIModel model = getModel();
- Program program = model.getProgram();
- Integer year = model.getYear();
- String name = String.format(scientificCruiseNameFormat, program.getName(), year);
-
- String surveyPart = model.getSurveyPart();
- if (StringUtils.isNotEmpty(surveyPart)) {
- name += "_" + surveyPart;
- }
- model.setName(name);
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,247 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * Model of UI {@link EditScientificCruiseUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EditScientificCruiseUIModel extends AbstractTuttiBeanUIModel<ScientificCruise, EditScientificCruiseUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_PROGRAM = "program";
-
- public static final String PROPERTY_NAME = "name";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_COUNTRY = "country";
-
- public static final String PROPERTY_SURVEY_PART = "surveyPart";
-
- public static final String PROPERTY_VESSEL = "vessel";
-
- public static final String PROPERTY_GEAR = "gear";
-
- public static final String PROPERTY_HEAD_OF_MISSION = "headOfMission";
-
- public static final String PROPERTY_HEAD_OF_SORT_ROOM = "headOfSortRoom";
-
- public static final String PROPERTY_YEAR = "year";
-
- public static final String PROPERTY_POCHE = "poche";
-
- public static final String PROPERTY_BEGIN_DATE = "beginDate";
-
- public static final String PROPERTY_END_DATE = "endDate";
-
- public static final String PROPERTY_CAN_GENERATE_NAME = "canGenerateName";
-
- protected Program program;
-
- protected Country country;
-
- protected String name;
-
- protected String surveyPart;
-
- protected List<Vessel> vessel;
-
- protected List<Gear> gear;
-
- protected List<Person> headOfMission;
-
- protected List<Person> headOfSortRoom;
-
- protected String comment;
-
- protected Integer year;
-
- protected Integer poche;
-
- protected Date beginDate;
-
- protected Date endDate;
-
- protected static Binder<EditScientificCruiseUIModel, ScientificCruise> toBeanBinder =
- BinderFactory.newBinder(EditScientificCruiseUIModel.class,
- ScientificCruise.class);
-
- protected static Binder<ScientificCruise, EditScientificCruiseUIModel> fromBeanBinder =
- BinderFactory.newBinder(ScientificCruise.class, EditScientificCruiseUIModel.class);
-
- public EditScientificCruiseUIModel() {
- super(ScientificCruise.class, fromBeanBinder, toBeanBinder);
- }
-
- public Program getProgram() {
- return program;
- }
-
- public void setProgram(Program program) {
- Object oldValue = getProgram();
- this.program = program;
- firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
- firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- Object oldValue = getName();
- this.name = name;
- firePropertyChange(PROPERTY_NAME, oldValue, name);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public Country getCountry() {
- return country;
- }
-
- public void setCountry(Country country) {
- Object oldValue = getCountry();
- this.country = country;
- firePropertyChange(PROPERTY_COUNTRY, oldValue, country);
- }
-
- public String getSurveyPart() {
- return surveyPart;
- }
-
- public void setSurveyPart(String surveyPart) {
- Object oldValue = getSurveyPart();
- this.surveyPart = surveyPart;
- firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart);
- }
-
- public Integer getYear() {
- return year;
- }
-
- public void setYear(Integer year) {
- Object oldValue = getYear();
- this.year = year;
- firePropertyChange(PROPERTY_YEAR, oldValue, year);
- firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
- }
-
- public Integer getPoche() {
- return poche;
- }
-
- public void setPoche(Integer poche) {
- Object oldValue = getPoche();
- this.poche = poche;
- firePropertyChange(PROPERTY_POCHE, oldValue, poche);
- }
-
- public Date getBeginDate() {
- return beginDate;
- }
-
- public void setBeginDate(Date beginDate) {
- Object oldValue = getBeginDate();
- this.beginDate = beginDate;
- firePropertyChange(PROPERTY_BEGIN_DATE, oldValue, beginDate);
- }
-
- public Date getEndDate() {
- return endDate;
- }
-
- public void setEndDate(Date endDate) {
- Object oldValue = getEndDate();
- this.endDate = endDate;
- firePropertyChange(PROPERTY_END_DATE, oldValue, endDate);
- }
-
- public List<Vessel> getVessel() {
- return vessel;
- }
-
- public void setVessel(List<Vessel> vessel) {
- this.vessel = vessel;
- firePropertyChange(PROPERTY_VESSEL, null, vessel);
- }
-
- public List<Gear> getGear() {
- return gear;
- }
-
- public void setGear(List<Gear> gear) {
- this.gear = gear;
- firePropertyChange(PROPERTY_GEAR, null, gear);
- }
-
- public List<Person> getHeadOfMission() {
- return headOfMission;
- }
-
- public void setHeadOfMission(List<Person> headOfMission) {
- this.headOfMission = headOfMission;
- firePropertyChange(PROPERTY_HEAD_OF_MISSION, null, headOfMission);
- }
-
- public List<Person> getHeadOfSortRoom() {
- return headOfSortRoom;
- }
-
- public void setHeadOfSortRoom(List<Person> headOfSortRoom) {
- this.headOfSortRoom = headOfSortRoom;
- firePropertyChange(PROPERTY_HEAD_OF_SORT_ROOM, null, headOfSortRoom);
- }
-
- public boolean isCanGenerateName() {
- return program != null && year != null;
- }
-
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,77 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-#programLabel {
- text: "tutti.label.program";
-}
-
-#programCombobox {
- property: "program";
- selectedItem: {model.getProgram()};
-}
-
-#editProgramButton {
- enabled: {model.isProgramFound()};
- text: "tutti.action.edit";
- actionIcon: "edit";
-}
-
-#newProgramButton {
- text: "tutti.action.new";
- actionIcon: "add";
-}
-
-#scientificCruiseLabel {
- text: "tutti.label.scientificCruise";
- labelFor: {scientificCruiseCombobox};
-}
-
-#scientificCruiseCombobox {
- property: "scientificCruise";
- enabled: {model.isProgramFound()};
- selectedItem: {model.getScientificCruise()};
-}
-
-#editScientificCruiseButton {
- enabled: {model.isProgramFound() && model.isScientificCruiseFound()};
- text: "tutti.action.edit";
- actionIcon: "edit";
-}
-
-#newScientificCruiseButton {
- actionIcon: "add";
- enabled: {model.isProgramFound()};
- text: "tutti.action.new";
-}
-
-#showFishingOperationsButton {
- text: "tutti.action.catches";
- enabled: {uiContext.isScientificCruiseContextFilled()};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,102 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<SelectScientificCruiseUIModel, SelectScientificCruiseUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.Program
- fr.ifremer.tutti.persistence.entities.data.ScientificCruise
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
- protected TuttiUIContext uiContext;
-
- public SelectScientificCruiseUI(TuttiUIContext context) {
- this.uiContext = context;
- SelectScientificCruiseUIHandler handler =
- new SelectScientificCruiseUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
- <SelectScientificCruiseUIHandler id='handler'
- initializer='getContextValue(SelectScientificCruiseUIHandler.class)'/>
-
- <SelectScientificCruiseUIModel id='model'
- initializer='getContextValue(SelectScientificCruiseUIModel.class)'/>
-
- <Table fill='both' constraints='BorderLayout.CENTER'>
- <row>
- <cell anchor='west'>
- <JLabel id='programLabel'/>
- </cell>
- <cell weightx='1.0'>
- <BeanComboBox id='programCombobox' constructorParams='this'
- genericType='Program'/>
- </cell>
- <cell>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='editProgramButton'
- onActionPerformed='handler.showSelectedProgram()'/>
- <JButton id='newProgramButton'
- onActionPerformed='handler.showNewProgram()'/>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id='scientificCruiseLabel'/>
- </cell>
- <cell>
- <BeanComboBox id='scientificCruiseCombobox' constructorParams='this'
- genericType='ScientificCruise'/>
- </cell>
- <cell>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='editScientificCruiseButton'
- onActionPerformed='handler.showSelectedScientificCruise()'/>
- <JButton id='newScientificCruiseButton'
- onActionPerformed='handler.showNewScientificCruise()'/>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell columns='3'>
- <JButton id='showFishingOperationsButton'
- onActionPerformed='handler.showFishingOperations()'/>
- </cell>
- </row>
- </Table>
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,204 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.swing.editor.bean.BeanComboBox;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-/**
- * Main ui content to select scientificCruise.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SelectScientificCruiseUIHandler extends AbstractTuttiUIHandler<SelectScientificCruiseUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(SelectScientificCruiseUIHandler.class);
-
- protected final PersistenceService persistenceService;
-
- protected final SelectScientificCruiseUI ui;
-
- public SelectScientificCruiseUIHandler(TuttiUIContext context, SelectScientificCruiseUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- protected SelectScientificCruiseUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- public void beforeInitUI() {
- SelectScientificCruiseUIModel model = new SelectScientificCruiseUIModel();
-
- List<Program> allPrograms = persistenceService.getAllProgram();
-
- model.setPrograms(allPrograms);
-
- if (allPrograms.isEmpty()) {
- // do nothing
-
- if (log.isDebugEnabled()) {
- log.debug("No program found.");
- }
- } else {
-
- // get selected program (if any)
-
- String surveyId = context.getProgramId();
- Program selectedProgram = null;
- List<ScientificCruise> allScientificCruises = null;
- if (surveyId != null) {
- selectedProgram = TuttiEntities.findById(allPrograms, surveyId);
- allScientificCruises = persistenceService.getAllScientificCruise(surveyId);
- }
-
- model.setProgram(selectedProgram);
- model.setScientificCruises(allScientificCruises);
-
- if (CollectionUtils.isEmpty(allScientificCruises)) {
-
- // nothing to select
- } else {
- String campaignId = context.getScientificCruiseId();
-
- ScientificCruise selectedCampaign = null;
- if (campaignId != null) {
- selectedCampaign =
- TuttiEntities.findById(allScientificCruises, campaignId);
- }
- model.setScientificCruise(selectedCampaign);
- }
- }
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- SelectScientificCruiseUIModel model = ui.getModel();
-
- initBeanComboBox(ui.getProgramCombobox(),
- model.getPrograms(),
- model.getProgram());
-
- initBeanComboBox(ui.getScientificCruiseCombobox(),
- model.getScientificCruises(),
- model.getScientificCruise());
-
- model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_PROGRAM, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- Program newValue = (Program) evt.getNewValue();
- boolean noSurvey = newValue == null;
- context.setProgramId(noSurvey ? null : newValue.getId());
- List<ScientificCruise> campaigns;
- if (noSurvey) {
- campaigns = Lists.newArrayList();
- } else {
- campaigns = persistenceService.getAllScientificCruise(newValue.getId());
- }
- SelectScientificCruiseUIModel model = (SelectScientificCruiseUIModel) evt.getSource();
- model.setScientificCruises(campaigns);
- model.setScientificCruise(null);
- }
- });
-
- model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_SCIENTIFIC_CRUISES, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- // reload combo box
- BeanComboBox<ScientificCruise> combobox = ui.getScientificCruiseCombobox();
- List<ScientificCruise> campaigns = (List<ScientificCruise>) evt.getNewValue();
- combobox.setData(null);
- combobox.setData(campaigns);
- }
- });
-
- model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_SCIENTIFIC_CRUISE, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- ScientificCruise newValue = (ScientificCruise) evt.getNewValue();
- context.setScientificCruiseId(newValue == null ? null : newValue.getId());
- }
- });
- }
-
- @Override
- public void onCloseUI() {
- PropertyChangeListener[] listeners = ui.getModel().getPropertyChangeListeners();
- for (PropertyChangeListener listener : listeners) {
- getModel().removePropertyChangeListener(listener);
- }
- }
-
- public void showFishingOperations() {
-
- context.setScreen(TuttiScreen.FILL_FISHING_OPERATION);
- }
-
- public void showSelectedProgram() {
-
- Program program = getModel().getProgram();
- context.setProgramId(program.getId());
- context.setScreen(TuttiScreen.EDIT_PROGRAM);
- }
-
- public void showNewProgram() {
- context.setProgramId(null);
- context.setScientificCruiseId(null);
- context.setScreen(TuttiScreen.EDIT_PROGRAM);
- }
-
- public void showSelectedScientificCruise() {
- ScientificCruise scientificCruise = getModel().getScientificCruise();
- context.setScientificCruiseId(scientificCruise.getId());
- context.setScreen(TuttiScreen.EDIT_SCIENTIFIC_CRUISE);
- }
-
- public void showNewScientificCruise() {
- context.setScientificCruiseId(null);
- context.setScreen(TuttiScreen.EDIT_SCIENTIFIC_CRUISE);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,123 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import org.jdesktop.beans.AbstractSerializableBean;
-
-import java.util.List;
-
-/**
- * Model of ui {@link SelectScientificCruiseUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SelectScientificCruiseUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_PROGRAMS = "programs";
-
- public static final String PROPERTY_PROGRAM = "program";
-
- public static final String PROPERTY_SCIENTIFIC_CRUISES = "scientificCruises";
-
- public static final String PROPERTY_SCIENTIFIC_CRUISE = "scientificCruise";
-
- public static final String PROPERTY_PROGRAM_FOUND = "programFound";
-
- public static final String PROPERTY_SCIENTIFIC_CRUISE_FOUND = "scientificCruiseFound";
-
- protected List<Program> programs;
-
- protected Program program;
-
- protected List<ScientificCruise> scientificCruises;
-
- protected ScientificCruise scientificCruise;
-
- public List<Program> getPrograms() {
- return programs;
- }
-
- public void setPrograms(List<Program> programs) {
- Object oldValue = getPrograms();
- this.programs = programs;
-
- // nullify program
-// setProgram(null);
- firePropertyChange(PROPERTY_PROGRAMS, oldValue, programs);
- }
-
- public Program getProgram() {
- return program;
- }
-
- public void setProgram(Program program) {
- Program oldValue = getProgram();
- this.program = program;
-
- // nullify scientificCruises
-// setScientificCruises(null);
-
- firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
- firePropertyChange(PROPERTY_PROGRAM_FOUND, oldValue != null, program != null);
- }
-
- public boolean isProgramFound() {
- return program != null;
- }
-
- public List<ScientificCruise> getScientificCruises() {
- return scientificCruises;
- }
-
- public void setScientificCruises(List<ScientificCruise> scientificCruises) {
- Object oldValue = getScientificCruises();
- this.scientificCruises = scientificCruises;
-
- // nullify scientificCruise
-// setScientificCruise(null);
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISES, oldValue, scientificCruises);
- }
-
- public ScientificCruise getScientificCruise() {
- return scientificCruise;
- }
-
- public void setScientificCruise(ScientificCruise scientificCruise) {
- ScientificCruise oldValue = getScientificCruise();
- this.scientificCruise = scientificCruise;
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE, oldValue, scientificCruise);
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_FOUND, oldValue != null, scientificCruise != null);
- }
-
- public boolean isScientificCruiseFound() {
- return scientificCruise != null;
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,538 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-JToolBar {
- floatable: false;
-}
-
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-BeanListHeader {
- showReset: true;
- i18nPrefix: "tutti.property.";
-}
-
-JList {
- selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
- model: {new DefaultListModel()};
-}
-
-NumberEditor {
- autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
- bean: {model};
- showReset: true;
-}
-
-SimpleTimeEditor {
- bean: {model};
-}
-
-#stationNumberLabel {
- text: "tutti.label.fishingOperation.stationNumber";
- labelFor: {stationNumberField};
-}
-
-#stationNumberField {
- property: "stationNumber";
- model: {model.getStationNumber()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#fishingOperationNumberLabel {
- text: "tutti.label.fishingOperation.fishingOperationNumber";
- labelFor: {fishingOperationNumberField};
-}
-
-#fishingOperationNumberField {
- property: "fishingOperationNumber";
- model: {model.getFishingOperationNumber()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#dateLabel {
- text: "tutti.label.fishingOperation.date";
- labelFor: {dateField};
-}
-
-#dateField {
- date: {model.getDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#strataLabel {
- text: "tutti.label.fishingOperation.strata";
- labelFor: {strataComboBox};
-}
-
-#strataComboBox {
- property: "strata";
- selectedItem: {model.getStrata()};
-}
-
-#subStrataLabel {
- text: "tutti.label.fishingOperation.subStrata";
- labelFor: {subStrataComboBox};
-}
-
-#subStrataComboBox {
- property: "subStrata";
- selectedItem: {model.getSubStrata()};
-}
-
-#localiteLabel {
- text: "tutti.label.fishingOperation.localite";
- labelFor: {localiteField};
-}
-
-#localiteField {
- text: {model.getLocalite()};
-}
-
-#gearLongitudeLabel {
- text: "tutti.label.fishingOperation.gearLongitude";
-}
-
-#gearLatitudeLabel {
- text: "tutti.label.fishingOperation.gearLatitude";
-}
-
-#gearDateLabel {
- text: "tutti.label.fishingOperation.gearDate";
-}
-
-#gearTimeLabel {
- text: "tutti.label.fishingOperation.gearTime";
-}
-
-#gearShootingStartLabel {
- text: "tutti.label.fishingOperation.gearShootingStart";
-}
-
-#gearShootingEndLabel {
- text: "tutti.label.fishingOperation.gearShootingEnd";
-}
-
-#gearShootingStartLongitudeField {
- text: {getStringValue(model.getGearShootingStartLongitude())};
-}
-
-#gearShootingStartLatitudeField {
- text: {getStringValue(model.getGearShootingStartLatitude())};
-}
-
-#gearShootingStartDateField {
- date: {model.getGearShootingStartDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#gearShootingStartTimeField {
- property: "gearShootingStartDate";
- date: {model.getGearShootingStartDate()};
-}
-
-#gearShootingEndLongitudeField {
- text: {getStringValue(model.getGearShootingEndLongitude())};
-}
-
-#gearShootingEndLatitudeField {
- text: {getStringValue(model.getGearShootingEndLatitude())};
-}
-
-#gearShootingEndDateField {
- date: {model.getGearShootingEndDate()};
- formats: {"dd/MM/yyyy"};
-}
-
-#gearShootingEndTimeField {
- property: "gearShootingEndDate";
- date: {model.getGearShootingEndDate()};
-}
-
-#fishingOperationValidPanel {
- floatable: false;
- borderPainted: false;
- opaque: false;
-}
-
-#resetValidStateButton {
- actionIcon: "reset";
- text: "tutti.action.reset.fishingOperationValidState";
-}
-
-#fishingOperationValidRadio {
- text: "tutti.label.fishingOperation.fishingOperationValid";
- selected: {model.getFishingOperationValid() == Boolean.TRUE};
- buttonGroup: "fishingOperationValid";
-}
-
-#fishingOperationInvalidRadio {
- text: "tutti.label.fishingOperation.fishingOperationInvalid";
- selected: {model.getFishingOperationValid() == Boolean.FALSE};
- buttonGroup: "fishingOperationValid";
-}
-#fishingOperationResetRadio {
- selected: {model.getFishingOperationValid() == null};
- buttonGroup: "fishingOperationValid";
-}
-
-#fishingOperationRectiligneCheckBox {
- text: "tutti.label.fishingOperation.fishingOperationRectiligne";
- selected: {model.isFishingOperationRectiligne()};
-}
-
-#distanceChaluteeLabel {
- text: "tutti.label.fishingOperation.distanceChalutee";
- labelFor: {distanceChaluteeField};
-}
-
-#distanceChaluteeField {
- property: "distanceChalutee";
- model: {model.getDistanceChalutee()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
- enabled: {!model.isFishingOperationRectiligne()};
-}
-
-#beaufortScaleLabel {
- text: "tutti.label.fishingOperation.beaufortScale";
- labelFor: {beaufortScaleComboBox};
-}
-
-#beaufortScaleComboBox {
- property: "beaufortScale";
- selectedItem: {model.getBeaufortScale()};
-}
-
-#windDirectionLabel {
- text: "tutti.label.fishingOperation.windDirection";
- labelFor: {windDirectionField};
-}
-
-#windDirectionField {
- property: "windDirection";
- model: {model.getWindDirection()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#seaStateLabel {
- text: "tutti.label.fishingOperation.seaState";
- labelFor: {seaStateComboBox};
-}
-
-#seaStateComboBox {
- property: "seaState";
- selectedItem: {model.getSeaState()};
-}
-
-#ouvertureHorizontaleLabel {
- text: "tutti.label.fishingOperation.ouvertureHorizontale";
- labelFor: {ouvertureHorizontaleField};
-}
-
-#ouvertureHorizontaleVerticaleLabel {
- text: "tutti.label.fishingOperation.ouvertureHorizontaleVerticale";
-}
-
-#ouvertureHorizontaleField {
- property: "ouvertureHorizontale";
- model: {model.getOuvertureHorizontale()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#ouvertureVerticaleLabel {
- text: "tutti.label.fishingOperation.ouvertureVerticale";
- labelFor: {ouvertureVerticaleField};
-}
-
-#ouvertureVerticaleField {
- property: "ouvertureVerticale";
- model: {model.getOuvertureVerticale()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#geometrieMesureeCheckBox {
- text: "tutti.label.fishingOperation.geometrieMesuree";
- selected: {model.isGeometrieMesuree()};
-}
-
-#longueurFunesLabel {
- text: "tutti.label.fishingOperation.longueurFunes";
- labelFor: {longueurFunesField};
-}
-
-#longueurFunesBrasLabel {
- text: "tutti.label.fishingOperation.longueurFunesBras";
-}
-
-#longueurFunesField {
- property: "longueurFunes";
- model: {model.getLongueurFunes()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#longueurBrasLabel {
- text: "tutti.label.fishingOperation.longueurBras";
- labelFor: {longueurBrasField};
-}
-
-#longueurBrasField {
- property: "longueurBras";
- model: {model.getLongueurBras()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#systemeFermetureCulCheckBox {
- text: "tutti.label.fishingOperation.systemeFermetureCul";
- selected: {model.isSystemeFermetureCul()};
-}
-
-#dureeLabel {
- text: "tutti.label.fishingOperation.duree";
- labelFor: {dureeField};
-}
-
-#dureeField {
- property: "duree";
- model: {model.getDuree()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#saisisseurPane {
- horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#saisisseurHeader {
- labelText: {_("tutti.label.list.saisisseur")};
- list: {saisisseurList};
- beanType: {Person.class};
-}
-
-#commentPane {
- columnHeaderView: {new JLabel(_("tutti.label.comment"))};
- minimumSize: {new Dimension(10,50)};
-}
-
-#commentField {
- text: {model.getComment()};
-}
-
-#gearShootingStartDepthLabel {
- text: "tutti.label.fishingOperation.gearShootingStartDepth";
- labelFor: {gearShootingStartDepthField};
-}
-
-#gearShootingStartDepthField {
- property: "gearShootingStartDepth";
- model: {model.getGearShootingStartDepth()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndDepthLabel {
- text: "tutti.label.fishingOperation.gearShootingEndDepth";
- labelFor: {gearShootingEndDepthField};
-}
-
-#gearShootingEndDepthField {
- property: "gearShootingEndDepth";
- model: {model.getGearShootingEndDepth()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartSurfaceTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingStartSurfaceTemperature";
- labelFor: {gearShootingStartSurfaceTemperatureField};
-}
-
-#gearShootingStartSurfaceTemperatureField {
- property: "gearShootingStartSurfaceTemperature";
- model: {model.getGearShootingStartSurfaceTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndSurfaceTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingEndSurfaceTemperature";
- labelFor: {gearShootingEndSurfaceTemperatureField};
-}
-
-#gearShootingEndSurfaceTemperatureField {
- property: "gearShootingEndSurfaceTemperature";
- model: {model.getGearShootingEndSurfaceTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingStartBottomTemperature";
- labelFor: {gearShootingStartBottomTemperatureField};
-}
-
-#gearShootingStartBottomTemperatureField {
- property: "gearShootingStartBottomTemperature";
- model: {model.getGearShootingStartBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.gearShootingEndBottomTemperature";
- labelFor: {gearShootingEndBottomTemperatureField};
-}
-
-#gearShootingEndBottomTemperatureField {
- property: "gearShootingEndBottomTemperature";
- model: {model.getGearShootingEndBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#averageBottomTemperatureLabel {
- text: "tutti.label.fishingOperation.averageBottomTemperature";
- labelFor: {averageBottomTemperatureField};
-}
-
-#averageBottomTemperatureField {
- property: "averageBottomTemperature";
- model: {model.getAverageBottomTemperature()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartSurfaceSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingStartSurfaceSalinity";
- labelFor: {gearShootingStartSurfaceSalinityField};
-}
-
-#gearShootingStartSurfaceSalinityField {
- property: "gearShootingStartSurfaceSalinity";
- model: {model.getGearShootingStartSurfaceSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndSurfaceSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingEndSurfaceSalinity";
- labelFor: {gearShootingEndSurfaceSalinityField};
-}
-
-#gearShootingEndSurfaceSalinityField {
- property: "gearShootingEndSurfaceSalinity";
- model: {model.getGearShootingEndSurfaceSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartBottomSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingStartBottomSalinity";
- labelFor: {gearShootingStartBottomSalinityField};
-}
-
-#gearShootingStartBottomSalinityField {
- property: "gearShootingStartBottomSalinity";
- model: {model.getGearShootingStartBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndBottomSalinityLabel {
- text: "tutti.label.fishingOperation.gearShootingEndBottomSalinity";
- labelFor: {gearShootingEndBottomSalinityField};
-}
-
-#gearShootingEndBottomSalinityField {
- property: "gearShootingEndBottomSalinity";
- model: {model.getGearShootingEndBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#averageBottomSalinityLabel {
- text: "tutti.label.fishingOperation.averageBottomSalinity";
- labelFor: {averageBottomSalinityField};
-}
-
-#averageBottomSalinityField {
- property: "averageBottomSalinity";
- model: {model.getAverageBottomSalinity()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
-#noTraitPane {
- text: "tutti.label.no.fishingOperation.selected";
- horizontalAlignment: {JLabel.CENTER};
-}
-
-#saveButton {
- actionIcon: "save";
- text: "tutti.action.save";
- enabled: {model.isModify() && model.isValid()};
-}
-
-#cancelButton {
- actionIcon: "cancel";
- text: "tutti.action.cancel";
- enabled: {model.isModify()};
-}
-
-#importPupitriButton {
- actionIcon: "pupitri-import";
- text: "tutti.action.pupitri-import";
-}
-
-#importCasinoButton {
- actionIcon: "casino-import";
- text: "tutti.action.casino-import";
-}
-
-#messagePanel {
- border: {BorderFactory.createTitledBorder("Messages")};
- height: 200;
- width: 500;
-}
-
-#errorTable {
- rowSelectionAllowed: true;
- autoCreateRowSorter: true;
- autoResizeMode: 2;
- cellSelectionEnabled: false;
- selectionMode: 0;
- model: {errorTableModel};
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,550 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<FishingOperationTabUIModel, FishingOperationTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
- fr.ifremer.tutti.persistence.entities.referential.SeaState
- fr.ifremer.tutti.persistence.entities.referential.Strata
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
- fr.ifremer.tutti.persistence.entities.referential.Person
-
- fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.swing.editor.bean.BeanListHeader
- jaxx.runtime.swing.editor.NumberEditor
- jaxx.runtime.swing.editor.TimeEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- org.jdesktop.swingx.JXDatePicker
-
- java.awt.Dimension
-
- javax.swing.DefaultListModel
- javax.swing.ListSelectionModel
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
- </import>
-
- <script><![CDATA[
-
-public FishingOperationTabUI(FishingOperationsUI parentUI) {
- FishingOperationTabUIHandler handler = new FishingOperationTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <FishingOperationTabUIHandler id='handler'
- initializer='getContextValue(FishingOperationTabUIHandler.class)'/>
-
- <FishingOperationTabUIModel id='model'
- initializer='getContextValue(FishingOperationTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='stationNumber' component='stationNumberField'/>
- <field name='fishingOperationNumber'
- component='fishingOperationNumberField'/>
- <field name='date' component='dateField'/>
- <field name='comment' component='commentField'/>
- <field name='saisisseur' component='saisisseurPane'/>
- </BeanValidator>
-
- <JPanel id='traitPane' constraints='BorderLayout.CENTER'
- layout='{new BorderLayout()}'>
-
- <JTabbedPane id='traitTabPane' constraints='BorderLayout.CENTER'>
- <tab id='traitGeneralTab'
- title='tutti.label.tab.fishingOperation.general'>
- <Table fill='both' id='generalForm'>
-
- <!-- Numero station / Numéro trait / Date -->
- <row>
- <cell anchor='west'>
- <JLabel id='stationNumberLabel'/>
- </cell>
- <cell weightx='0.3'>
- <NumberEditor id='stationNumberField' constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='fishingOperationNumberLabel'/>
- </cell>
- <cell weightx='0.3'>
- <NumberEditor id='fishingOperationNumberField'
- constructorParams='this'/>
- </cell>
- <cell>
- <JLabel id='dateLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JXDatePicker id='dateField'
- onActionPerformed='handler.setDate(event, "date")'/>
- </cell>
- </row>
-
- <!-- Strate d'association / Sous Strate / Localité -->
- <row>
- <cell>
- <JLabel id='strataLabel'/>
- </cell>
- <cell weightx='0.3'>
- <BeanComboBox id='strataComboBox' constructorParams='this'
- genericType='Strata'/>
- </cell>
- <cell>
- <JLabel id='subStrataLabel'/>
- </cell>
- <cell weightx='0.3'>
- <BeanComboBox id='subStrataComboBox' constructorParams='this'
- genericType='Strata'/>
- </cell>
- <cell>
- <JLabel id='localiteLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JTextField id='localiteField'
- onKeyReleased='handler.setText(event, "localite")'/>
- </cell>
- </row>
-
- <!-- début de traine long-lat-date-heure
- fin de traine long-lat-date-heure -->
- <row>
- <cell columns='6'>
- <JPanel layout="{new BorderLayout()}">
- <Table id="gearCaracteristicsTable" fill="both" weightx='1'
- constraints='BorderLayout.CENTER'>
- <row>
- <cell>
- <JLabel/>
- </cell>
- <cell>
- <JLabel id='gearLongitudeLabel'/>
- </cell>
- <cell>
- <JLabel id='gearLatitudeLabel'/>
- </cell>
- <cell>
- <JLabel id='gearDateLabel'/>
- </cell>
- <cell>
- <JLabel id='gearTimeLabel'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel id='gearShootingStartLabel'/>
- </cell>
- <cell>
- <JTextField id='gearShootingStartLongitudeField'
- onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JTextField id='gearShootingStartLatitudeLabel'
- onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JXDatePicker id='gearShootingStartDateField'
- onActionPerformed='handler.setDate(event, "gearShootingStartDate")'/>
- </cell>
- <cell>
- <SimpleTimeEditor id='gearShootingStartTimeField'
- constructorParams='this'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id='gearShootingEndLabel'/>
- </cell>
- <cell>
- <JTextField id='gearShootingEndLongitudeField'
- onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JTextField id='gearShootingEndLatitudeLabel'
- onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- <cell>
- <JXDatePicker id='gearShootingEndDateField'
- onActionPerformed='handler.setDate(event, "gearShootingEndDate")'/>
- </cell>
- <cell>
- <SimpleTimeEditor id='gearShootingEndTimeField'
- constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- </row>
-
- <!-- Fishing operation valid / invalid-->
- <row>
- <cell columns="2">
- <JToolBar id='fishingOperationValidPanel'
- layout='{new BorderLayout()}'>
- <JButton id='resetValidStateButton'
- constraints='BorderLayout.WEST'
- onActionPerformed="model.setFishingOperationValid(null)"/>
- <JRadioButton id='fishingOperationResetRadio'
- constraints='BorderLayout.EAST'/>
- </JToolBar>
- </cell>
- <cell columns="2">
- <JRadioButton id='fishingOperationValidRadio'
- onActionPerformed='model.setFishingOperationValid(Boolean.TRUE)'/>
- </cell>
- <cell columns="2">
- <JRadioButton id='fishingOperationInvalidRadio'
- onActionPerformed='model.setFishingOperationValid(Boolean.FALSE)'/>
- </cell>
- </row>
-
- <!-- FishingOperation rectiligne / distance chalutee / durée -->
- <row>
- <cell>
- <JCheckBox id='fishingOperationRectiligneCheckBox'
- onItemStateChanged='handler.setBoolean(event, "fishingOperationRectiligne")'/>
- </cell>
- <cell columns="3">
- <JPanel layout="{new BorderLayout()}">
- <JLabel id='distanceChaluteeLabel'
- constraints='BorderLayout.WEST'/>
- <NumberEditor id='distanceChaluteeField'
- constraints='BorderLayout.CENTER'
- constructorParams='this'/>
- </JPanel>
- </cell>
- <cell anchor='west'>
- <JLabel id='dureeLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='dureeField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Actions d'import -->
- <row>
- <cell columns='6'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='importPupitriButton'
- onActionPerformed='handler.importPupitri()'/>
- <JButton id='importCasinoButton'
- onActionPerformed='handler.importCasino()'/>
- </JPanel>
- </cell>
- </row>
-
- <!-- Saisisseur -->
- <row weighty='0.3'>
- <cell columns='6'>
- <JScrollPane id='saisisseurPane'
- columnHeaderView="{saisisseurHeader}"
- onFocusGained='saisisseurList.requestFocus()'>
- <JList id='saisisseurList'
- onValueChanged='handler.selectListData(event, "saisisseur")'/>
- <BeanListHeader id='saisisseurHeader' genericType='Person'/>
- </JScrollPane>
- </cell>
- </row>
-
- <!-- Commentaire -->
- <row weighty='0.3'>
- <cell columns='6'>
- <JScrollPane id='commentPane'
- onFocusGained='commentField.requestFocus()'>
- <JTextArea id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </tab>
-
- <tab id='traitGearShootingTab'
- title='tutti.label.tab.fishingOperation.gearShooting'>
-
- <Table fill='both' id='gearShootingForm'>
-
- <!-- GearShootingStart Depth -->
- <row>
- <cell>
- <JLabel id='gearShootingStartDepthLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartDepthField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEnd Depth -->
- <row>
- <cell>
- <JLabel id='gearShootingEndDepthLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndDepthField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Ouverture horizontale -->
- <row>
- <cell anchor='west'>
- <JLabel id='ouvertureHorizontaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='ouvertureHorizontaleField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Ouverture verticale -->
- <row>
- <cell anchor='west'>
- <JLabel id='ouvertureVerticaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='ouvertureVerticaleField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Longueur funes -->
- <row>
- <cell anchor='west'>
- <JLabel id='longueurFunesLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='longueurFunesField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Longueur bras -->
- <row>
- <cell anchor='west'>
- <JLabel id='longueurBrasLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='longueurBrasField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Système de fermeture du cul / Geometrie mesuree -->
- <row>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JCheckBox id='systemeFermetureCulCheckBox'
- onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/>
- <JCheckBox id='geometrieMesureeCheckBox'
- onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
- </JPanel>
- </cell>
- </row>
- </Table>
- </tab>
-
- <tab id='environmentTab'
- title='tutti.label.tab.fishingOperation.environment'>
-
- <Table fill='both' id='environmentForm'>
-
- <!-- Beaufort scale -->
- <row>
- <cell anchor='west'>
- <JLabel id='beaufortScaleLabel'/>
- </cell>
- <cell weightx='1.0'>
- <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
- genericType='BeaufortScale'/>
- </cell>
- </row>
-
- <!-- Wind direction -->
- <row>
- <cell anchor='west'>
- <JLabel id='windDirectionLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='windDirectionField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Sea state-->
- <row>
- <cell anchor='west'>
- <JLabel id='seaStateLabel'/>
- </cell>
- <cell fill='horizontal'>
- <BeanComboBox id='seaStateComboBox' constructorParams='this'
- genericType='SeaState'/>
- </cell>
- </row>
- </Table>
- </tab>
-
- <tab id='traitHydrologyTabContent'
- title='tutti.label.tab.fishingOperation.hydrology'>
-
- <Table fill='both' id='hydrologyForm'>
-
- <!-- GearShootingStartSurfaceTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingStartSurfaceTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartSurfaceTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndSurfaceTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingEndSurfaceTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndSurfaceTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartBottomTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingStartBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndBottomTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingEndBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- AverageBottomTemperature -->
- <row>
- <cell>
- <JLabel id='averageBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='averageBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartSurfaceSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingStartSurfaceSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartSurfaceSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndSurfaceSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingEndSurfaceSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndSurfaceSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartBottomSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingStartBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndBottomSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingEndBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- AverageBottomSalinity -->
- <row>
- <cell>
- <JLabel id='averageBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='averageBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- </Table>
- </tab>
- </JTabbedPane>
-
- <!-- Actions -->
- <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'>
- <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.CENTER'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
- </JPanel>
- </JPanel>
-
- </JPanel>
-
- <JLabel id='noTraitPane'/>
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,242 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import java.awt.BorderLayout;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-/**
- * Handler for UI {@link FishingOperationTabUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishingOperationTabUIHandler extends AbstractTuttiUIHandler<FishingOperationTabUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(FishingOperationTabUIHandler.class);
-
- private final FishingOperationTabUI ui;
-
- private final FishingOperationsUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public FishingOperationTabUIHandler(FishingOperationsUI parentUi, FishingOperationTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- FishingOperationTabUIModel model = new FishingOperationTabUIModel();
- model.addPropertyChangeListener(FishingOperationTabUIModel.PROPERTY_EMPTY, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- JPanel form = ui.getTraitPane();
- JLabel noContentPane = ui.getNoTraitPane();
-
- Boolean empty = (Boolean) evt.getNewValue();
- ui.remove(form);
- ui.remove(noContentPane);
- if (empty) {
- ui.add(noContentPane, BorderLayout.CENTER);
- } else {
- ui.add(form, BorderLayout.CENTER);
- }
- ui.repaint();
- }
- });
-
- listModelIsModify(model);
-
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- ui.getFishingOperationValidPanel().remove(
- ui.getFishingOperationResetRadio());
-
- FishingOperationTabUIModel model = ui.getModel();
-
- initUI(ui);
-
- initBeanList(ui.getSaisisseurHeader(),
- persistenceService.getAllPerson(),
- model.getSaisisseur());
-
- initBeanComboBox(ui.getBeaufortScaleComboBox(),
- persistenceService.getAllBeaufortScale(),
- model.getBeaufortScale());
-
- initBeanComboBox(ui.getStrataComboBox(),
- persistenceService.getAllStrata(),
- model.getStrata());
-
- initBeanComboBox(ui.getSeaStateComboBox(),
- persistenceService.getAllSeaState(),
- model.getSeaState());
-
- model.setEmpty(true);
-
- listenValidatorValid(ui.getValidator(), getModel());
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected FishingOperationTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectFishingOperation(FishingOperation bean) {
-
- boolean empty = bean == null;
-
- FishingOperationTabUIModel model = getModel();
-
- // clean previous selection
- ui.getSaisisseurHeader().getList().clearSelection();
-
- if (empty) {
-
- model.fromBean(new FishingOperation());
- } else {
-
- model.fromBean(bean);
- }
-
- // update saisissuer selection
- List<Person> saisisseur = model.getSaisisseur();
- if (CollectionUtils.isNotEmpty(saisisseur)) {
- updateIndices(ui.getSaisisseurList(), saisisseur);
- }
-
- // update model empty property
- model.setEmpty(empty);
-
- // reload bean in validator (? really mandatory?)
-// ui.getValidator().reloadBean();
-
- // if new fishingOperation can already cancel his creation
- model.setModify(!empty && model.isCreate());
- }
-
- public void cancel() {
-
- String id = getModel().getId();
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition for fishingOperation: " + id);
- }
- boolean newBean = StringUtils.isBlank(id);
-
- if (newBean) {
-
- // cancel to create a new fishingOperation
- parentUi.getHandler().selectFishingOperation(null);
-
- } else {
-
- // reselect in ui the fishingOperation
- FishingOperation selectedFishingOperation = parentUi.getModel().getSelectedFishingOperation();
- parentUi.getHandler().selectFishingOperation(selectedFishingOperation);
- }
- }
-
- public void save() {
-
- // get fishingOperation to save
- FishingOperation toSave = getModel().toBean();
-
- if (log.isInfoEnabled()) {
- log.info("Save edition for fishingOperation: " + toSave.getId());
- }
-
- // keep selected tab (to resotre it after save)
- int selectedIndex = ui.getTraitTabPane().getSelectedIndex();
-
- // persist current fishingOperation
- parentUi.getHandler().saveFishingOperation(toSave);
-
- // reselect current tab
- ui.getTraitTabPane().setSelectedIndex(selectedIndex);
-
- getModel().setModify(false);
- }
-
- public void importPupitri() {
- //TODO
- }
-
- public void importCasino() {
- //TODO
- }
-
- public void setGearShootingStartLatitude(String text) {
- getModel().setGearShootingStartLatitude(Float.valueOf(text));
- }
-
- public void setGearShootingStartLongitude(String text) {
- getModel().setGearShootingStartLongitude(Float.valueOf(text));
- }
-
-// public void setGearShootingStartTime(String text) {
-// getModel().setGearShootingStartTime(Integer.valueOf(text));
-// }
-
- public void setGearShootingEndLatitude(String text) {
- getModel().setGearShootingEndLatitude(Float.valueOf(text));
- }
-
- public void setGearShootingEndLongitude(String text) {
- getModel().setGearShootingEndLongitude(Float.valueOf(text));
- }
-
-// public void setGearShootingEndTime(String text) {
-// getModel().setGearShootingEndTime(Integer.valueOf(text));
-// }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,633 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.SeaState;
-import fr.ifremer.tutti.persistence.entities.referential.Strata;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * Model for UI {@link FishingOperationTabUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishingOperationTabUIModel extends AbstractTuttiBeanUIModel<FishingOperation, FishingOperationTabUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_EMPTY = "empty";
-
- public static final String PROPERTY_STATION_NUMBER = "stationNumber";
-
- public static final String PROPERTY_FISHING_OPERATION_NUMBER = "fishingOperationNumber";
-
- public static final String PROPERTY_DATE = "date";
-
- public static final String PROPERTY_STRATA = "strata";
-
- public static final String PROPERTY_SUB_STRATA = "subStrata";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
-
- public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
-
- public static final String PROPERTY_WIND_DIRECTION = "windDirection";
-
- public static final String PROPERTY_SEA_STATE = "seaState";
-
- public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale";
-
- public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale";
-
- public static final String PROPERTY_GEOMETRIE_MESUREE = "geometrieMesuree";
-
- public static final String PROPERTY_LONGUEUR_FUNES = "longueurFunes";
-
- public static final String PROPERTY_LONGUEUR_BRAS = "longueurBras";
-
- public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
-
- public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne";
-
- public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee";
-
- public static final String PROPERTY_DUREE = "duree";
-
- public static final String PROPERTY_FISHING_OPERATION_VALID = "fishingOperationValid";
-
- public static final String PROPERTY_LOCALITE = "localite";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_SAISISSEUR = "saisisseur";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE = "gearShootingStartSurfaceTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE = "gearShootingEndSurfaceTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE = "gearShootingStartBottomTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE = "gearShootingEndBottomTemperature";
-
- public static final String PROPERTY_AVERAGE_BOTTOM_TEMPERATURE = "averageBottomTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY = "gearShootingStartSurfaceSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY = "gearShootingEndSurfaceSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY = "gearShootingStartBottomSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY = "gearShootingEndBottomSalinity";
-
- public static final String PROPERTY_AVERAGE_BOTTOM_SALINITY = "averageBottomSalinity";
-
- protected boolean empty;
-
- protected ScientificCruise scientificCruise;
-
- protected Integer stationNumber;
-
- protected Integer fishingOperationNumber;
-
- protected Date date;
-
- protected Strata strata;
-
- protected Strata subStrata;
-
- protected Float gearShootingStartLatitude;
-
- protected Float gearShootingStartLongitude;
-
- protected Date gearShootingStartDate;
-
- protected Integer gearShootingStartTime;
-
- protected Float gearShootingStartDepth;
-
- protected Float gearShootingEndLatitude;
-
- protected Float gearShootingEndLongitude;
-
- protected Date gearShootingEndDate;
-
- protected Integer gearShootingEndTime;
-
- protected Float gearShootingEndDepth;
-
- protected BeaufortScale beaufortScale;
-
- protected Integer windDirection;
-
- protected SeaState seaState;
-
- protected Float ouvertureHorizontale;
-
- protected Float ouvertureVerticale;
-
- protected boolean geometrieMesuree;
-
- protected Float longueurFunes;
-
- protected Float longueurBras;
-
- protected boolean systemeFermetureCul;
-
- protected boolean fishingOperationRectiligne;
-
- protected Float distanceChalutee;
-
- protected Float duree;
-
- protected Boolean fishingOperationValid;
-
- protected String localite;
-
- protected String comment;
-
- protected List<Person> saisisseur;
-
- protected Float gearShootingStartSurfaceTemperature;
-
- protected Float gearShootingEndSurfaceTemperature;
-
- protected Float gearShootingStartBottomTemperature;
-
- protected Float gearShootingEndBottomTemperature;
-
- protected Float averageBottomTemperature;
-
- protected Float gearShootingStartSurfaceSalinity;
-
- protected Float gearShootingEndSurfaceSalinity;
-
- protected Float gearShootingStartBottomSalinity;
-
- protected Float gearShootingEndBottomSalinity;
-
- protected Float averageBottomSalinity;
-
- protected static Binder<FishingOperationTabUIModel, FishingOperation> toBeanBinder =
- BinderFactory.newBinder(FishingOperationTabUIModel.class,
- FishingOperation.class);
-
- protected static Binder<FishingOperation, FishingOperationTabUIModel> fromBeanBinder =
- BinderFactory.newBinder(FishingOperation.class, FishingOperationTabUIModel.class);
-
- public FishingOperationTabUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
- }
-
- public boolean isEmpty() {
- return empty;
- }
-
- public void setEmpty(boolean empty) {
- Object oldValue = isEmpty();
- this.empty = empty;
- firePropertyChange(PROPERTY_EMPTY, oldValue, empty);
- }
-
- public ScientificCruise getScientificCruise() {
- return scientificCruise;
- }
-
- public void setScientificCruise(ScientificCruise scientificCruise) {
- this.scientificCruise = scientificCruise;
- }
-
- public Integer getStationNumber() {
- return stationNumber;
- }
-
- public void setStationNumber(Integer stationNumber) {
- Object oldValue = getStationNumber();
- this.stationNumber = stationNumber;
- firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
- }
-
- public Integer getFishingOperationNumber() {
- return fishingOperationNumber;
- }
-
- public void setFishingOperationNumber(Integer fishingOperationNumber) {
- Object oldValue = getFishingOperationNumber();
- this.fishingOperationNumber = fishingOperationNumber;
- firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber);
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- Object oldValue = getDate();
- this.date = date;
- firePropertyChange(PROPERTY_DATE, oldValue, date);
- }
-
- public Strata getStrata() {
- return strata;
- }
-
- public void setStrata(Strata strata) {
- Object oldValue = getStrata();
- this.strata = strata;
- firePropertyChange(PROPERTY_STRATA, oldValue, strata);
- }
-
- public Strata getSubStrata() {
- return subStrata;
- }
-
- public void setSubStrata(Strata subStrata) {
- Object oldValue = getSubStrata();
- this.subStrata = subStrata;
- firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata);
- }
-
- public Float getGearShootingStartLatitude() {
- return gearShootingStartLatitude;
- }
-
- public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
- Object oldValue = getGearShootingStartLatitude();
- this.gearShootingStartLatitude = gearShootingStartLatitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude);
- }
-
- public Float getGearShootingStartLongitude() {
- return gearShootingStartLongitude;
- }
-
- public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
- Object oldValue = getGearShootingStartLongitude();
- this.gearShootingStartLongitude = gearShootingStartLongitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude);
- }
-
- public Date getGearShootingStartDate() {
- return gearShootingStartDate;
- }
-
- public void setGearShootingStartDate(Date gearShootingStartDate) {
- Object oldValue = getGearShootingStartDate();
- this.gearShootingStartDate = gearShootingStartDate;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, gearShootingStartDate);
- }
-
- public Float getGearShootingStartDepth() {
- return gearShootingStartDepth;
- }
-
- public void setGearShootingStartDepth(Float gearShootingStartDepth) {
- Object oldValue = getGearShootingStartDepth();
- this.gearShootingStartDepth = gearShootingStartDepth;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DEPTH, oldValue, gearShootingStartDepth);
- }
-
- public Float getGearShootingEndLatitude() {
- return gearShootingEndLatitude;
- }
-
- public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
- Object oldValue = getGearShootingEndLatitude();
- this.gearShootingEndLatitude = gearShootingEndLatitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude);
- }
-
- public Float getGearShootingEndLongitude() {
- return gearShootingEndLongitude;
- }
-
- public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
- Object oldValue = getGearShootingEndLongitude();
- this.gearShootingEndLongitude = gearShootingEndLongitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude);
- }
-
- public Date getGearShootingEndDate() {
- return gearShootingEndDate;
- }
-
- public void setGearShootingEndDate(Date gearShootingEndDate) {
- Object oldValue = getGearShootingEndDate();
- this.gearShootingEndDate = gearShootingEndDate;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate);
- }
-
- public Float getGearShootingEndDepth() {
- return gearShootingEndDepth;
- }
-
- public void setGearShootingEndDepth(Float gearShootingEndDepth) {
- Object oldValue = getGearShootingEndDepth();
- this.gearShootingEndDepth = gearShootingEndDepth;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth);
- }
-
- public BeaufortScale getBeaufortScale() {
- return beaufortScale;
- }
-
- public void setBeaufortScale(BeaufortScale beaufortScale) {
- Object oldValue = getBeaufortScale();
- this.beaufortScale = beaufortScale;
- firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
- }
-
- public Integer getWindDirection() {
- return windDirection;
- }
-
- public void setWindDirection(Integer windDirection) {
- Object oldValue = getWindDirection();
- this.windDirection = windDirection;
- firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
- }
-
- public SeaState getSeaState() {
- return seaState;
- }
-
- public void setSeaState(SeaState seaState) {
- Object oldValue = getSeaState();
- this.seaState = seaState;
- firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
- }
-
- public Float getOuvertureHorizontale() {
- return ouvertureHorizontale;
- }
-
- public void setOuvertureHorizontale(Float ouvertureHorizontale) {
- Object oldValue = getOuvertureHorizontale();
- this.ouvertureHorizontale = ouvertureHorizontale;
- firePropertyChange(PROPERTY_OUVERTURE_HORIZONTALE, oldValue, ouvertureHorizontale);
- }
-
- public Float getOuvertureVerticale() {
- return ouvertureVerticale;
- }
-
- public void setOuvertureVerticale(Float ouvertureVerticale) {
- Object oldValue = getOuvertureVerticale();
- this.ouvertureVerticale = ouvertureVerticale;
- firePropertyChange(PROPERTY_OUVERTURE_VERTICALE, oldValue, ouvertureVerticale);
- }
-
- public boolean isGeometrieMesuree() {
- return geometrieMesuree;
- }
-
- public void setGeometrieMesuree(boolean geometrieMesuree) {
- Object oldValue = isGeometrieMesuree();
- this.geometrieMesuree = geometrieMesuree;
- firePropertyChange(PROPERTY_GEOMETRIE_MESUREE, oldValue, geometrieMesuree);
- }
-
- public Float getLongueurFunes() {
- return longueurFunes;
- }
-
- public void setLongueurFunes(Float longueurFunes) {
- Object oldValue = getLongueurFunes();
- this.longueurFunes = longueurFunes;
- firePropertyChange(PROPERTY_LONGUEUR_FUNES, oldValue, longueurFunes);
- }
-
- public Float getLongueurBras() {
- return longueurBras;
- }
-
- public void setLongueurBras(Float longueurBras) {
- Object oldValue = getLongueurBras();
- this.longueurBras = longueurBras;
- firePropertyChange(PROPERTY_LONGUEUR_BRAS, oldValue, longueurBras);
- }
-
- public boolean isSystemeFermetureCul() {
- return systemeFermetureCul;
- }
-
- public void setSystemeFermetureCul(boolean systemeFermetureCul) {
- Object oldValue = isSystemeFermetureCul();
- this.systemeFermetureCul = systemeFermetureCul;
- firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul);
- }
-
- public boolean isFishingOperationRectiligne() {
- return fishingOperationRectiligne;
- }
-
- public void setFishingOperationRectiligne(boolean fishingOperationRectiligne) {
- Object oldValue = isFishingOperationRectiligne();
- this.fishingOperationRectiligne = fishingOperationRectiligne;
- firePropertyChange(PROPERTY_FISHING_OPERATION_RECTILIGNE, oldValue, fishingOperationRectiligne);
- }
-
- public Float getDistanceChalutee() {
- return distanceChalutee;
- }
-
- public void setDistanceChalutee(Float distanceChalutee) {
- Object oldValue = getDistanceChalutee();
- this.distanceChalutee = distanceChalutee;
- firePropertyChange(PROPERTY_DISTANCE_CHALUTEE, oldValue, distanceChalutee);
- }
-
- public Float getDuree() {
- return duree;
- }
-
- public void setDuree(Float duree) {
- Object oldValue = getDuree();
- this.duree = duree;
- firePropertyChange(PROPERTY_DUREE, oldValue, duree);
- }
-
- public Boolean getFishingOperationValid() {
- return fishingOperationValid;
- }
-
- public void setFishingOperationValid(Boolean fishingOperationValid) {
- Object oldValue = getFishingOperationValid();
- this.fishingOperationValid = fishingOperationValid;
- firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid);
- }
-
- public String getLocalite() {
- return localite;
- }
-
- public void setLocalite(String localite) {
- Object oldValue = getLocalite();
- this.localite = localite;
- firePropertyChange(PROPERTY_LOCALITE, oldValue, localite);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<Person> getSaisisseur() {
- return saisisseur;
- }
-
- public void setSaisisseur(List<Person> saisisseur) {
- this.saisisseur = saisisseur;
- firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
- }
-
- public Float getGearShootingStartSurfaceTemperature() {
- return gearShootingStartSurfaceTemperature;
- }
-
- public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) {
- Object oldValue = getGearShootingStartSurfaceTemperature();
- this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE, oldValue, gearShootingStartSurfaceTemperature);
- }
-
- public Float getGearShootingEndSurfaceTemperature() {
- return gearShootingEndSurfaceTemperature;
- }
-
- public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) {
- Object oldValue = getGearShootingEndSurfaceTemperature();
- this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE, oldValue, gearShootingEndSurfaceTemperature);
- }
-
- public Float getGearShootingStartBottomTemperature() {
- return gearShootingStartBottomTemperature;
- }
-
- public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) {
- Object oldValue = getGearShootingStartBottomTemperature();
- this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE, oldValue, gearShootingStartBottomTemperature);
- }
-
- public Float getGearShootingEndBottomTemperature() {
- return gearShootingEndBottomTemperature;
- }
-
- public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) {
- Object oldValue = getGearShootingEndBottomTemperature();
- this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE, oldValue, gearShootingEndBottomTemperature);
- }
-
- public Float getAverageBottomTemperature() {
- return averageBottomTemperature;
- }
-
- public void setAverageBottomTemperature(Float averageBottomTemperature) {
- Object oldValue = getAverageBottomTemperature();
- this.averageBottomTemperature = averageBottomTemperature;
- firePropertyChange(PROPERTY_AVERAGE_BOTTOM_TEMPERATURE, oldValue, averageBottomTemperature);
- }
-
- public Float getGearShootingStartSurfaceSalinity() {
- return gearShootingStartSurfaceSalinity;
- }
-
- public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) {
- Object oldValue = getGearShootingStartSurfaceSalinity();
- this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY, oldValue, gearShootingStartSurfaceSalinity);
- }
-
- public Float getGearShootingEndSurfaceSalinity() {
- return gearShootingEndSurfaceSalinity;
- }
-
- public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) {
- Object oldValue = getGearShootingEndSurfaceSalinity();
- this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY, oldValue, gearShootingEndSurfaceSalinity);
- }
-
- public Float getGearShootingStartBottomSalinity() {
- return gearShootingStartBottomSalinity;
- }
-
- public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) {
- Object oldValue = getGearShootingStartBottomSalinity();
- this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY, oldValue, gearShootingStartBottomSalinity);
- }
-
- public Float getGearShootingEndBottomSalinity() {
- return gearShootingEndBottomSalinity;
- }
-
- public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) {
- Object oldValue = getGearShootingEndBottomSalinity();
- this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY, oldValue, gearShootingEndBottomSalinity);
- }
-
- public Float getAverageBottomSalinity() {
- return averageBottomSalinity;
- }
-
- public void setAverageBottomSalinity(Float averageBottomSalinity) {
- Object oldValue = getAverageBottomSalinity();
- this.averageBottomSalinity = averageBottomSalinity;
- firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity);
- }
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,64 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-BeanComboBox {
- showReset: true;
- i18nPrefix: "tutti.property.";
- bean: {model};
-}
-
-#newFishingOperationButton {
- text: "tutti.action.new";
- actionIcon: "add";
-}
-
-#traitComboBox {
- property: "selectedFishingOperation";
- selectedItem: {model.getSelectedFishingOperation()};
-}
-
-#speciesTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#benthosTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#planctonTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#macroDechetTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#accidentelTab {
- enabled: {model.getSelectedFishingOperation() != null};
-}
-
-#observationIndividuelTab {
- enabled: {false};
- /*enabled: {model.getSelectedFishingOperation() != null};*/
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,99 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<FishingOperationsUIModel, FishingOperationsUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.FishingOperation
-
- fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.accidentel.AccidentelTabUI
- fr.ifremer.tutti.ui.swing.content.catches.benthos.BenthosTabUI
- fr.ifremer.tutti.ui.swing.content.catches.macrodechet.MacroDechetTabUI
- fr.ifremer.tutti.ui.swing.content.catches.plancton.PlanctonTabUI
- fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTabUI
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-public FishingOperationsUI(TuttiUIContext context) {
- FishingOperationsUIHandler handler = new FishingOperationsUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-protected void $afterCompleteSetup() {
- handler.afterInitUI();
-}
- ]]></script>
-
- <FishingOperationsUIHandler id='handler'
- initializer='getContextValue(FishingOperationsUIHandler.class)'/>
-
- <FishingOperationsUIModel id='model'
- initializer='getContextValue(FishingOperationsUIModel.class)'/>
-
- <Table fill='both' id='topPanel' constraints='BorderLayout.NORTH'>
-
- <!-- FishingOperations fishingOperation -->
- <row>
- <cell anchor='west' weightx='1.0'>
- <BeanComboBox id='traitComboBox' constructorParams='this'
- genericType='FishingOperation'/>
- </cell>
- <cell anchor='east'>
- <JButton id='newFishingOperationButton'
- onActionPerformed='getHandler().createNewFishingOperation()'/>
- </cell>
- </row>
- </Table>
-
- <JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'>
- <tab id='traitTab' title='tutti.label.tab.fishingOperation'>
- <FishingOperationTabUI id='fishingOperationTabContent' constructorParams='this'/>
- </tab>
- <tab id='speciesTab' title='tutti.label.tab.species'>
- <SpeciesTabUI id='speciesTabContent' constructorParams='this'/>
- </tab>
- <tab id='benthosTab' title='tutti.label.tab.benthos'>
- <BenthosTabUI id='benthosTabContent' constructorParams='this'/>
- </tab>
- <tab id='planctonTab' title='tutti.label.tab.plancton'>
- <PlanctonTabUI id='planctonTabContent' constructorParams='this'/>
- </tab>
- <tab id='macroDechetTab' title='tutti.label.tab.macroDechet'>
- <MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/>
- </tab>
- <tab id='accidentelTab' title='tutti.label.tab.accidentel'>
- <AccidentelTabUI id='accidentelTabContent' constructorParams='this'/>
- </tab>
- <tab id='observationIndividuelTab' title='tutti.label.tab.observationIndividuel'>
- <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
- </tab>
- </JTabbedPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,209 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import org.apache.commons.lang.time.DateUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Date;
-import java.util.List;
-
-/**
- * Handler of UI {@link FishingOperationsUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishingOperationsUIHandler extends AbstractTuttiUIHandler<FishingOperationsUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(FishingOperationsUIHandler.class);
-
- private final FishingOperationsUI ui;
-
- private final PersistenceService persistenceService;
-
- public FishingOperationsUIHandler(TuttiUIContext context, FishingOperationsUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- FishingOperationsUIModel model = new FishingOperationsUIModel();
-
- String campaignId = context.getScientificCruiseId();
-
- // load existing scientificCruise
- ScientificCruise scientificCruise = persistenceService.getScientificCruise(campaignId);
- model.setScientificCruise(scientificCruise);
-
- List<FishingOperation> fishingOperations = persistenceService.getAllFishingOperation(campaignId);
- model.setFishingOperation(fishingOperations);
-
- if (log.isInfoEnabled()) {
- log.info("Loaded " + fishingOperations.size() + " fishingOperation(s).");
- }
-
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- FishingOperationsUIModel model = getModel();
-
- initUI(ui);
-
- List<FishingOperation> fishingOperations = model.getFishingOperation();
-
- initBeanComboBox(ui.getTraitComboBox(),
- fishingOperations,
- model.getSelectedFishingOperation());
-
- model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_SELECTED_FISHING_OPERATION, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- selectFishingOperation((FishingOperation) evt.getNewValue());
- }
- });
-
- model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_FISHING_OPERATION, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- ui.getTraitComboBox().setData(null);
- ui.getTraitComboBox().setData((List<FishingOperation>) evt.getNewValue());
- }
- });
-
- if (!fishingOperations.isEmpty()) {
-
- model.setSelectedFishingOperation(fishingOperations.get(0));
- }
- }
-
- @Override
- public void onCloseUI() {
-
- // ui will be saved so we do not want to keep selected tab indexes
- ui.getTabPane().setSelectedIndex(0);
- ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
-
- // when quitting ui, let's de-select fishingOperation (will save any changes)
- selectFishingOperation(null);
- }
-
- @Override
- protected FishingOperationsUIModel getModel() {
- return ui.getModel();
- }
-
- public void createNewFishingOperation() {
-
- // deselect selected fishingOperation
- getModel().setSelectedFishingOperation(null);
-
- // use a new empty fishingOperation
- FishingOperation newFishingOperation = new FishingOperation();
- newFishingOperation.setScientificCruise(getModel().getScientificCruise());
-
- // by default use the current day with no time information
- Date currentDate = new Date();
- currentDate = DateUtils.setHours(currentDate, 0);
- currentDate = DateUtils.setMinutes(currentDate, 0);
-
- newFishingOperation.setDate(currentDate);
- newFishingOperation.setGearShootingStartDate(currentDate);
- newFishingOperation.setGearShootingEndDate(currentDate);
- selectFishingOperation(newFishingOperation);
- }
-
- public void selectFishingOperation(FishingOperation fishingOperation) {
-
- if (log.isInfoEnabled()) {
- log.info("New selected fishingOperation: " + fishingOperation);
- }
- // back to fishingOperation tab
- ui.getTabPane().setSelectedIndex(0);
-
- // back to general tab of fishingOperation tabs
- ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
-
- // propagate fishingOperation to his tabs
- ui.getFishingOperationTabContent().selectFishingOperation(fishingOperation);
- ui.getSpeciesTabContent().selectFishingOperation(fishingOperation);
- ui.getBenthosTabContent().selectFishingOperation(fishingOperation);
- ui.getPlanctonTabContent().selectFishingOperation(fishingOperation);
- ui.getMacroDechetTabContent().selectFishingOperation(fishingOperation);
- ui.getAccidentelTabContent().selectFishingOperation(fishingOperation);
-
- // repaint tabs
- ui.getTabPane().repaint();
-// ui.getObservationIndividuelTabContent().selectFishingOperation(selectedFishingOperation);
- }
-
- public void saveFishingOperation(FishingOperation toSave) {
-
- // persist the fishingOperation
-
- boolean create = toSave.getId() == null;
-
- FishingOperation savedFishingOperation;
- if (create) {
- savedFishingOperation = persistenceService.createFishingOperation(toSave);
- } else {
- savedFishingOperation = persistenceService.saveFishingOperation(toSave);
- }
-
- FishingOperationsUIModel model = getModel();
-
- // add the saved fishingOperation to fishingOperation list
-
- List<FishingOperation> data = model.getFishingOperation();
-
- FishingOperation existingFishingOperation = TuttiEntities.findById(data, savedFishingOperation.getId());
- if (existingFishingOperation != null) {
- data.remove(existingFishingOperation);
- }
- data.add(savedFishingOperation);
-
- // update model fishingOperation list
- model.setFishingOperation(data);
-
- // update model selected fishingOperation
- model.setSelectedFishingOperation(savedFishingOperation);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,83 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.ScientificCruise;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import org.jdesktop.beans.AbstractSerializableBean;
-
-import java.util.List;
-
-/**
- * Model fo UI {@link FishingOperationsUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class FishingOperationsUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_FISHING_OPERATION = "fishingOperation";
-
- public static final String PROPERTY_SELECTED_FISHING_OPERATION = "selectedFishingOperation";
-
- public static final String PROPERTY_SCIENTIFIC_CRUISE = "scientificCruise";
-
- protected List<FishingOperation> fishingOperation;
-
- protected FishingOperation selectedFishingOperation;
-
- protected ScientificCruise scientificCruise;
-
- public List<FishingOperation> getFishingOperation() {
- return fishingOperation;
- }
-
- public void setFishingOperation(List<FishingOperation> fishingOperation) {
- this.fishingOperation = fishingOperation;
- firePropertyChange(PROPERTY_FISHING_OPERATION, null, fishingOperation);
- }
-
- public FishingOperation getSelectedFishingOperation() {
- return selectedFishingOperation;
- }
-
- public void setSelectedFishingOperation(FishingOperation selectedFishingOperation) {
- Object oldValue = getSelectedFishingOperation();
- this.selectedFishingOperation = selectedFishingOperation;
- firePropertyChange(PROPERTY_SELECTED_FISHING_OPERATION, oldValue, selectedFishingOperation);
- }
-
- public ScientificCruise getScientificCruise() {
- return scientificCruise;
- }
-
- public void setScientificCruise(ScientificCruise scientificCruise) {
- Object oldValue = getScientificCruise();
- this.scientificCruise = scientificCruise;
- firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE, oldValue, scientificCruise);
- }
-}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,7 +28,7 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,7 +28,7 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,7 +28,7 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,7 +28,7 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -28,7 +28,7 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
+ fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI
org.jdesktop.swingx.JXTable
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -36,7 +36,7 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,223 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+JToolBar {
+ floatable: false;
+}
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+BeanListHeader {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+}
+
+JList {
+ selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
+ model: {new DefaultListModel()};
+}
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#splitPane {
+ orientation: {JSplitPane.VERTICAL_SPLIT};
+ resizeWeight: 0.3;
+ oneTouchExpandable: true;
+ continuousLayout: true;
+}
+
+#nameLabel {
+ text: "tutti.label.cruise.name";
+ labelFor: {nameField};
+}
+
+#nameField {
+ text: {model.getName()};
+}
+
+#yearLabel {
+ text: "tutti.label.cruise.year";
+ labelFor: {yearField};
+}
+
+#yearField {
+ property: "year";
+ model: {model.getYear()};
+ useFloat: false;
+ numberPattern: {INT_4_DIGITS_PATTERN};
+}
+
+#surveyPartLabel {
+ text: "tutti.label.cruise.surveyPart";
+ labelFor: {surveyPartField};
+}
+
+#surveyPartField {
+ text: {model.getSurveyPart()};
+}
+
+#countryLabel {
+ text: "tutti.label.cruise.country";
+ labelFor: {countryComboBox};
+}
+
+#countryComboBox {
+ property: "country";
+ selectedItem: {model.getCountry()};
+}
+
+#programLabel {
+ text: "tutti.label.cruise.program";
+ labelFor: {surveyComboBox};
+}
+
+#surveyComboBox {
+ property: "program";
+ selectedItem: {model.getProgram()};
+}
+
+#beginDateLabel {
+ text: "tutti.label.cruise.beginDate";
+ labelFor: {beginDateField};
+}
+
+#beginDateField {
+ date: {model.getBeginDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#endDateLabel {
+ text: "tutti.label.cruise.endDate";
+ labelFor: {endDateField};
+}
+
+#endDateField {
+ date: {model.getEndDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#pocheLabel {
+ text: "tutti.label.cruise.poche";
+ labelFor: {pocheField};
+}
+
+#pocheField {
+ property: "poche";
+ model: {model.getPoche()};
+ useFloat: false;
+ numberPattern: {INT_1_DIGITS_PATTERN};
+}
+
+#vesselPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#vesselHeader {
+ labelText: {_("tutti.label.list.vessel")};
+ list: {vesselList};
+ beanType: {Vessel.class};
+}
+
+#gearPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#gearHeader {
+ labelText: {_("tutti.label.list.gear")};
+ list: {gearList};
+ beanType: {Gear.class};
+}
+
+#headOfMissionPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#headOfMissionHeader {
+ labelText: {_("tutti.label.list.headOfMission")};
+ list: {headOfMissionList};
+ beanType: {Person.class};
+}
+
+#headOfSortRoomPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#headOfSortRoomHeader {
+ labelText: {_("tutti.label.list.headOfSortRoom")};
+ list: {headOfSortRoomList};
+ beanType: {Person.class};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {model.getComment()};
+}
+
+#saveButton {
+ actionIcon: "save";
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+}
+
+#cancelButton {
+ actionIcon: "cancel";
+ text: "tutti.action.cancel";
+}
+
+#generateNameButton {
+ actionIcon: "generate";
+ text: "tutti.action.generateCampaignName";
+ enabled: {model.isCanGenerateName()};
+}
+#messagePanel {
+ border: {BorderFactory.createTitledBorder("Messages")};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,238 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditCruiseUIModel, EditCruiseUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.Program
+ fr.ifremer.tutti.persistence.entities.referential.Country
+ fr.ifremer.tutti.persistence.entities.referential.Gear
+ fr.ifremer.tutti.persistence.entities.referential.Person
+ fr.ifremer.tutti.persistence.entities.referential.Vessel
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.NumberEditor
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.swing.editor.bean.BeanListHeader
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXDatePicker
+
+ javax.swing.DefaultListModel
+ javax.swing.ListSelectionModel
+
+ java.awt.Dimension
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+ public EditCruiseUI(TuttiUIContext context) {
+ EditCruiseUIHandler handler = new EditCruiseUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <EditCruiseUIHandler id='handler'
+ initializer='getContextValue(EditCruiseUIHandler.class)'/>
+
+ <EditCruiseUIModel id='model'
+ initializer='getContextValue(EditCruiseUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='program' component='surveyComboBox'/>
+ <field name='year' component='yearField'/>
+ <field name='surveyPart' component='surveyPartField'/>
+ <field name='name' component='nameField'/>
+ <field name='poche' component='pocheField'/>
+ <field name='country' component='countryComboBox'/>
+ <field name='beginDate' component='beginDateField'/>
+ <field name='endDate' component='endDateField'/>
+ <field name='vessel' component='vesselPane'/>
+ <field name='gear' component='gearPane'/>
+ <field name='headOfMission' component='headOfMissionPane'/>
+ <field name='headOfSortRoom' component='headOfSortRoomPane'/>
+ <field name='comment' component='commentField'/>
+ </BeanValidator>
+
+ <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
+ <Table fill='both'>
+
+ <!-- cruise program / year /program part / name -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='programLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='surveyComboBox' constructorParams='this'
+ genericType='Program'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='yearLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='yearField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='surveyPartLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JTextField id='surveyPartField'
+ onKeyReleased='handler.setText(event, "surveyPart")'/>
+ </cell>
+ </row>
+
+ <!-- cruise name -->
+ <row>
+ <cell>
+ <JLabel id='nameLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JTextField id='nameField'
+ onKeyReleased='handler.setText(event, "name")'/>
+ </cell>
+ <cell columns='2'>
+ <JButton id='generateNameButton'
+ onActionPerformed='handler.generateCampaignName()'/>
+ </cell>
+ <cell>
+ <JLabel id='pocheLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='pocheField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- cruise country / begin date / end date -->
+ <row>
+ <cell>
+ <JLabel id='countryLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='countryComboBox' constructorParams='this'
+ genericType='Country'/>
+ </cell>
+ <cell>
+ <JLabel id='beginDateLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JXDatePicker id='beginDateField'
+ onActionPerformed='handler.setDate(event, "beginDate")'/>
+ </cell>
+ <cell>
+ <JLabel id='endDateLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JXDatePicker id='endDateField'
+ onActionPerformed='handler.setDate(event, "endDate")'/>
+ </cell>
+ </row>
+
+ <!-- cruise vessel / gear -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
+ onFocusGained='vesselList.requestFocus()'>
+ <JList id='vesselList'
+ onValueChanged='handler.selectListData(event, "vessel")'/>
+ <BeanListHeader id='vesselHeader' genericType='Vessel'/>
+ </JScrollPane>
+ <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
+ onFocusGained='gearList.requestFocus()'>
+ <JList id='gearList'
+ onValueChanged='handler.selectListData(event, "gear")'/>
+ <BeanListHeader id='gearHeader' genericType='Gear'/>
+ </JScrollPane>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- cruise headOfMission / headOfSortRoom -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+
+ <JScrollPane id='headOfMissionPane'
+ columnHeaderView="{headOfMissionHeader}"
+ onFocusGained='headOfMissionList.requestFocus()'>
+ <JList id='headOfMissionList'
+ onValueChanged='handler.selectListData(event, "headOfMission")'/>
+ <BeanListHeader id='headOfMissionHeader'
+ genericType='Person'/>
+ </JScrollPane>
+ <JScrollPane id='headOfSortRoomPane'
+ columnHeaderView="{headOfSortRoomHeader}"
+ onFocusGained='headOfSortRoomList.requestFocus()'>
+ <JList id='headOfSortRoomList'
+ onValueChanged='handler.selectListData(event, "headOfSortRoom")'/>
+ <BeanListHeader id='headOfSortRoomHeader'
+ genericType='Person'/>
+ </JScrollPane>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- cruise comment -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+
+ <!-- Form Actions -->
+ <row>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+
+ <JPanel id='messagePanel' layout='{new GridLayout()}'>
+ <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
+ <JTable id='errorTable' />
+ </JScrollPane>
+ </JPanel>
+ </JSplitPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,176 @@
+package fr.ifremer.tutti.ui.swing.content.cruise;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
+import jaxx.runtime.validator.swing.SwingValidatorUtil;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.List;
+
+/**
+ * Handler of UI {@link EditCruiseUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditCruiseUIHandler extends AbstractTuttiUIHandler<EditCruiseUIModel> {
+
+ private final EditCruiseUI ui;
+
+ private final PersistenceService persistenceService;
+
+ public EditCruiseUIHandler(TuttiUIContext context, EditCruiseUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ EditCruiseUIModel model = new EditCruiseUIModel();
+
+ String campaignId = context.getCruiseId();
+ if (campaignId == null) {
+
+ // create new cruise
+ Program program =
+ persistenceService.getProgram(context.getProgramId());
+ model.setProgram(program);
+ model.setPoche(1);
+ } else {
+
+ // load existing program
+ Cruise cruise =
+ persistenceService.getCruise(campaignId);
+
+ model.fromBean(cruise);
+ }
+ listModelIsModify(model);
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ List<Person> users = persistenceService.getAllPerson();
+
+ EditCruiseUIModel model = ui.getModel();
+
+ initBeanComboBox(ui.getSurveyComboBox(),
+ persistenceService.getAllProgram(),
+ model.getProgram());
+
+ initBeanComboBox(ui.getCountryComboBox(),
+ persistenceService.getAllCountry(),
+ model.getCountry());
+
+ initBeanList(ui.getVesselHeader(),
+ persistenceService.getAllVessel(),
+ model.getVessel());
+
+ initBeanList(ui.getGearHeader(),
+ persistenceService.getAllGear(),
+ model.getGear());
+
+ initBeanList(ui.getHeadOfMissionHeader(),
+ users,
+ model.getHeadOfMission());
+
+ initBeanList(ui.getHeadOfSortRoomHeader(),
+ users,
+ model.getHeadOfSortRoom());
+
+ SwingValidatorUtil.installUI(ui.getErrorTable(),
+ new SwingValidatorMessageTableRenderer());
+
+ listenValidatorValid(ui.getValidator(), model);
+
+ // if new fishingOperation can already cancel his creation
+ model.setModify(model.isCreate());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected EditCruiseUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void cancel() {
+
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+
+ public void save() {
+
+ EditCruiseUIModel model = ui.getModel();
+
+ Cruise bean = model.toBean();
+
+ Cruise saved;
+ if (TuttiEntities.isNew(bean)) {
+
+ saved = persistenceService.createCruise(bean);
+ } else {
+ saved = persistenceService.saveCruise(bean);
+ }
+
+ context.setProgramId(saved.getProgram().getId());
+ context.setCruiseId(saved.getId());
+
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+
+ public static final String cruiseNameFormat = "%1$s_%2$s";
+
+ public void generateCampaignName() {
+
+ EditCruiseUIModel model = getModel();
+ Program program = model.getProgram();
+ Integer year = model.getYear();
+ String name = String.format(cruiseNameFormat, program.getName(), year);
+
+ String surveyPart = model.getSurveyPart();
+ if (StringUtils.isNotEmpty(surveyPart)) {
+ name += "_" + surveyPart;
+ }
+ model.setName(name);
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,247 @@
+package fr.ifremer.tutti.ui.swing.content.cruise;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Model of UI {@link EditCruiseUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditCruiseUIModel extends AbstractTuttiBeanUIModel<Cruise, EditCruiseUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_PROGRAM = "program";
+
+ public static final String PROPERTY_NAME = "name";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_COUNTRY = "country";
+
+ public static final String PROPERTY_SURVEY_PART = "surveyPart";
+
+ public static final String PROPERTY_VESSEL = "vessel";
+
+ public static final String PROPERTY_GEAR = "gear";
+
+ public static final String PROPERTY_HEAD_OF_MISSION = "headOfMission";
+
+ public static final String PROPERTY_HEAD_OF_SORT_ROOM = "headOfSortRoom";
+
+ public static final String PROPERTY_YEAR = "year";
+
+ public static final String PROPERTY_POCHE = "poche";
+
+ public static final String PROPERTY_BEGIN_DATE = "beginDate";
+
+ public static final String PROPERTY_END_DATE = "endDate";
+
+ public static final String PROPERTY_CAN_GENERATE_NAME = "canGenerateName";
+
+ protected Program program;
+
+ protected Country country;
+
+ protected String name;
+
+ protected String surveyPart;
+
+ protected List<Vessel> vessel;
+
+ protected List<Gear> gear;
+
+ protected List<Person> headOfMission;
+
+ protected List<Person> headOfSortRoom;
+
+ protected String comment;
+
+ protected Integer year;
+
+ protected Integer poche;
+
+ protected Date beginDate;
+
+ protected Date endDate;
+
+ protected static Binder<EditCruiseUIModel, Cruise> toBeanBinder =
+ BinderFactory.newBinder(EditCruiseUIModel.class,
+ Cruise.class);
+
+ protected static Binder<Cruise, EditCruiseUIModel> fromBeanBinder =
+ BinderFactory.newBinder(Cruise.class, EditCruiseUIModel.class);
+
+ public EditCruiseUIModel() {
+ super(Cruise.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public Program getProgram() {
+ return program;
+ }
+
+ public void setProgram(Program program) {
+ Object oldValue = getProgram();
+ this.program = program;
+ firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
+ firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ Object oldValue = getName();
+ this.name = name;
+ firePropertyChange(PROPERTY_NAME, oldValue, name);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public Country getCountry() {
+ return country;
+ }
+
+ public void setCountry(Country country) {
+ Object oldValue = getCountry();
+ this.country = country;
+ firePropertyChange(PROPERTY_COUNTRY, oldValue, country);
+ }
+
+ public String getSurveyPart() {
+ return surveyPart;
+ }
+
+ public void setSurveyPart(String surveyPart) {
+ Object oldValue = getSurveyPart();
+ this.surveyPart = surveyPart;
+ firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart);
+ }
+
+ public Integer getYear() {
+ return year;
+ }
+
+ public void setYear(Integer year) {
+ Object oldValue = getYear();
+ this.year = year;
+ firePropertyChange(PROPERTY_YEAR, oldValue, year);
+ firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
+ }
+
+ public Integer getPoche() {
+ return poche;
+ }
+
+ public void setPoche(Integer poche) {
+ Object oldValue = getPoche();
+ this.poche = poche;
+ firePropertyChange(PROPERTY_POCHE, oldValue, poche);
+ }
+
+ public Date getBeginDate() {
+ return beginDate;
+ }
+
+ public void setBeginDate(Date beginDate) {
+ Object oldValue = getBeginDate();
+ this.beginDate = beginDate;
+ firePropertyChange(PROPERTY_BEGIN_DATE, oldValue, beginDate);
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public void setEndDate(Date endDate) {
+ Object oldValue = getEndDate();
+ this.endDate = endDate;
+ firePropertyChange(PROPERTY_END_DATE, oldValue, endDate);
+ }
+
+ public List<Vessel> getVessel() {
+ return vessel;
+ }
+
+ public void setVessel(List<Vessel> vessel) {
+ this.vessel = vessel;
+ firePropertyChange(PROPERTY_VESSEL, null, vessel);
+ }
+
+ public List<Gear> getGear() {
+ return gear;
+ }
+
+ public void setGear(List<Gear> gear) {
+ this.gear = gear;
+ firePropertyChange(PROPERTY_GEAR, null, gear);
+ }
+
+ public List<Person> getHeadOfMission() {
+ return headOfMission;
+ }
+
+ public void setHeadOfMission(List<Person> headOfMission) {
+ this.headOfMission = headOfMission;
+ firePropertyChange(PROPERTY_HEAD_OF_MISSION, null, headOfMission);
+ }
+
+ public List<Person> getHeadOfSortRoom() {
+ return headOfSortRoom;
+ }
+
+ public void setHeadOfSortRoom(List<Person> headOfSortRoom) {
+ this.headOfSortRoom = headOfSortRoom;
+ firePropertyChange(PROPERTY_HEAD_OF_SORT_ROOM, null, headOfSortRoom);
+ }
+
+ public boolean isCanGenerateName() {
+ return program != null && year != null;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,77 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+#programLabel {
+ text: "tutti.label.program";
+}
+
+#programCombobox {
+ property: "program";
+ selectedItem: {model.getProgram()};
+}
+
+#editProgramButton {
+ enabled: {model.isProgramFound()};
+ text: "tutti.action.edit";
+ actionIcon: "edit";
+}
+
+#newProgramButton {
+ text: "tutti.action.new";
+ actionIcon: "add";
+}
+
+#cruiseLabel {
+ text: "tutti.label.cruise";
+ labelFor: {cruiseCombobox};
+}
+
+#cruiseCombobox {
+ property: "cruise";
+ enabled: {model.isProgramFound()};
+ selectedItem: {model.getCruise()};
+}
+
+#editCruiseButton {
+ enabled: {model.isProgramFound() && model.isCruiseFound()};
+ text: "tutti.action.edit";
+ actionIcon: "edit";
+}
+
+#newCruiseButton {
+ actionIcon: "add";
+ enabled: {model.isProgramFound()};
+ text: "tutti.action.new";
+}
+
+#showFishingOperationsButton {
+ text: "tutti.action.catches";
+ enabled: {uiContext.isCruiseContextFilled()};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,102 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<SelectCruiseUIModel, SelectCruiseUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.Program
+ fr.ifremer.tutti.persistence.entities.data.Cruise
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+ protected TuttiUIContext uiContext;
+
+ public SelectCruiseUI(TuttiUIContext context) {
+ this.uiContext = context;
+ SelectCruiseUIHandler handler =
+ new SelectCruiseUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <SelectCruiseUIHandler id='handler'
+ initializer='getContextValue(SelectCruiseUIHandler.class)'/>
+
+ <SelectCruiseUIModel id='model'
+ initializer='getContextValue(SelectCruiseUIModel.class)'/>
+
+ <Table fill='both' constraints='BorderLayout.CENTER'>
+ <row>
+ <cell anchor='west'>
+ <JLabel id='programLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <BeanComboBox id='programCombobox' constructorParams='this'
+ genericType='Program'/>
+ </cell>
+ <cell>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='editProgramButton'
+ onActionPerformed='handler.showSelectedProgram()'/>
+ <JButton id='newProgramButton'
+ onActionPerformed='handler.showNewProgram()'/>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='cruiseLabel'/>
+ </cell>
+ <cell>
+ <BeanComboBox id='cruiseCombobox' constructorParams='this'
+ genericType='Cruise'/>
+ </cell>
+ <cell>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='editCruiseButton'
+ onActionPerformed='handler.showSelectedCruise()'/>
+ <JButton id='newCruiseButton'
+ onActionPerformed='handler.showNewCruise()'/>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell columns='3'>
+ <JButton id='showFishingOperationsButton'
+ onActionPerformed='handler.showFishingOperations()'/>
+ </cell>
+ </row>
+ </Table>
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,204 @@
+package fr.ifremer.tutti.ui.swing.content.home;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.swing.editor.bean.BeanComboBox;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+/**
+ * Main ui content to select cruise.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SelectCruiseUIHandler extends AbstractTuttiUIHandler<SelectCruiseUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SelectCruiseUIHandler.class);
+
+ protected final PersistenceService persistenceService;
+
+ protected final SelectCruiseUI ui;
+
+ public SelectCruiseUIHandler(TuttiUIContext context, SelectCruiseUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ protected SelectCruiseUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ public void beforeInitUI() {
+ SelectCruiseUIModel model = new SelectCruiseUIModel();
+
+ List<Program> allPrograms = persistenceService.getAllProgram();
+
+ model.setPrograms(allPrograms);
+
+ if (allPrograms.isEmpty()) {
+ // do nothing
+
+ if (log.isDebugEnabled()) {
+ log.debug("No program found.");
+ }
+ } else {
+
+ // get selected program (if any)
+
+ String programId = context.getProgramId();
+ Program selectedProgram = null;
+ List<Cruise> allCruises = null;
+ if (programId != null) {
+ selectedProgram = TuttiEntities.findById(allPrograms, programId);
+ allCruises = persistenceService.getAllCruise(programId);
+ }
+
+ model.setProgram(selectedProgram);
+ model.setCruises(allCruises);
+
+ if (CollectionUtils.isEmpty(allCruises)) {
+
+ // nothing to select
+ } else {
+ String cruiseId = context.getCruiseId();
+
+ Cruise selectedCampaign = null;
+ if (cruiseId != null) {
+ selectedCampaign =
+ TuttiEntities.findById(allCruises, cruiseId);
+ }
+ model.setCruise(selectedCampaign);
+ }
+ }
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ SelectCruiseUIModel model = ui.getModel();
+
+ initBeanComboBox(ui.getProgramCombobox(),
+ model.getPrograms(),
+ model.getProgram());
+
+ initBeanComboBox(ui.getCruiseCombobox(),
+ model.getCruises(),
+ model.getCruise());
+
+ model.addPropertyChangeListener(SelectCruiseUIModel.PROPERTY_PROGRAM, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Program newValue = (Program) evt.getNewValue();
+ boolean noProgram = newValue == null;
+ context.setProgramId(noProgram ? null : newValue.getId());
+ List<Cruise> campaigns;
+ if (noProgram) {
+ campaigns = Lists.newArrayList();
+ } else {
+ campaigns = persistenceService.getAllCruise(newValue.getId());
+ }
+ SelectCruiseUIModel model = (SelectCruiseUIModel) evt.getSource();
+ model.setCruises(campaigns);
+ model.setCruise(null);
+ }
+ });
+
+ model.addPropertyChangeListener(SelectCruiseUIModel.PROPERTY_CRUISES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ // reload combo box
+ BeanComboBox<Cruise> combobox = ui.getCruiseCombobox();
+ List<Cruise> campaigns = (List<Cruise>) evt.getNewValue();
+ combobox.setData(null);
+ combobox.setData(campaigns);
+ }
+ });
+
+ model.addPropertyChangeListener(SelectCruiseUIModel.PROPERTY_CRUISE, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Cruise newValue = (Cruise) evt.getNewValue();
+ context.setCruiseId(newValue == null ? null : newValue.getId());
+ }
+ });
+ }
+
+ @Override
+ public void onCloseUI() {
+ PropertyChangeListener[] listeners = ui.getModel().getPropertyChangeListeners();
+ for (PropertyChangeListener listener : listeners) {
+ getModel().removePropertyChangeListener(listener);
+ }
+ }
+
+ public void showFishingOperations() {
+
+ context.setScreen(TuttiScreen.FILL_FISHING_OPERATION);
+ }
+
+ public void showSelectedProgram() {
+
+ Program program = getModel().getProgram();
+ context.setProgramId(program.getId());
+ context.setScreen(TuttiScreen.EDIT_PROGRAM);
+ }
+
+ public void showNewProgram() {
+ context.setProgramId(null);
+ context.setCruiseId(null);
+ context.setScreen(TuttiScreen.EDIT_PROGRAM);
+ }
+
+ public void showSelectedCruise() {
+ Cruise cruise = getModel().getCruise();
+ context.setCruiseId(cruise.getId());
+ context.setScreen(TuttiScreen.EDIT_CRUISE);
+ }
+
+ public void showNewCruise() {
+ context.setCruiseId(null);
+ context.setScreen(TuttiScreen.EDIT_CRUISE);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,123 @@
+package fr.ifremer.tutti.ui.swing.content.home;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import org.jdesktop.beans.AbstractSerializableBean;
+
+import java.util.List;
+
+/**
+ * Model of ui {@link SelectCruiseUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SelectCruiseUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_PROGRAMS = "programs";
+
+ public static final String PROPERTY_PROGRAM = "program";
+
+ public static final String PROPERTY_CRUISES = "cruises";
+
+ public static final String PROPERTY_CRUISE = "cruise";
+
+ public static final String PROPERTY_PROGRAM_FOUND = "programFound";
+
+ public static final String PROPERTY_CRUISE_FOUND = "cruiseFound";
+
+ protected List<Program> programs;
+
+ protected Program program;
+
+ protected List<Cruise> cruises;
+
+ protected Cruise cruise;
+
+ public List<Program> getPrograms() {
+ return programs;
+ }
+
+ public void setPrograms(List<Program> programs) {
+ Object oldValue = getPrograms();
+ this.programs = programs;
+
+ // nullify program
+// setProgram(null);
+ firePropertyChange(PROPERTY_PROGRAMS, oldValue, programs);
+ }
+
+ public Program getProgram() {
+ return program;
+ }
+
+ public void setProgram(Program program) {
+ Program oldValue = getProgram();
+ this.program = program;
+
+ // nullify cruises
+// setCruises(null);
+
+ firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
+ firePropertyChange(PROPERTY_PROGRAM_FOUND, oldValue != null, program != null);
+ }
+
+ public boolean isProgramFound() {
+ return program != null;
+ }
+
+ public List<Cruise> getCruises() {
+ return cruises;
+ }
+
+ public void setCruises(List<Cruise> cruises) {
+ Object oldValue = getCruises();
+ this.cruises = cruises;
+
+ // nullify cruise
+// setCruise(null);
+ firePropertyChange(PROPERTY_CRUISES, oldValue, cruises);
+ }
+
+ public Cruise getCruise() {
+ return cruise;
+ }
+
+ public void setCruise(Cruise cruise) {
+ Cruise oldValue = getCruise();
+ this.cruise = cruise;
+ firePropertyChange(PROPERTY_CRUISE, oldValue, cruise);
+ firePropertyChange(PROPERTY_CRUISE_FOUND, oldValue != null, cruise != null);
+ }
+
+ public boolean isCruiseFound() {
+ return cruise != null;
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,538 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+JToolBar {
+ floatable: false;
+}
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+BeanListHeader {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+}
+
+JList {
+ selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
+ model: {new DefaultListModel()};
+}
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+SimpleTimeEditor {
+ bean: {model};
+}
+
+#stationNumberLabel {
+ text: "tutti.label.fishingOperation.stationNumber";
+ labelFor: {stationNumberField};
+}
+
+#stationNumberField {
+ property: "stationNumber";
+ model: {model.getStationNumber()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#fishingOperationNumberLabel {
+ text: "tutti.label.fishingOperation.fishingOperationNumber";
+ labelFor: {fishingOperationNumberField};
+}
+
+#fishingOperationNumberField {
+ property: "fishingOperationNumber";
+ model: {model.getFishingOperationNumber()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#dateLabel {
+ text: "tutti.label.fishingOperation.date";
+ labelFor: {dateField};
+}
+
+#dateField {
+ date: {model.getDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#strataLabel {
+ text: "tutti.label.fishingOperation.strata";
+ labelFor: {strataComboBox};
+}
+
+#strataComboBox {
+ property: "strata";
+ selectedItem: {model.getStrata()};
+}
+
+#subStrataLabel {
+ text: "tutti.label.fishingOperation.subStrata";
+ labelFor: {subStrataComboBox};
+}
+
+#subStrataComboBox {
+ property: "subStrata";
+ selectedItem: {model.getSubStrata()};
+}
+
+#localiteLabel {
+ text: "tutti.label.fishingOperation.localite";
+ labelFor: {localiteField};
+}
+
+#localiteField {
+ text: {model.getLocalite()};
+}
+
+#gearLongitudeLabel {
+ text: "tutti.label.fishingOperation.gearLongitude";
+}
+
+#gearLatitudeLabel {
+ text: "tutti.label.fishingOperation.gearLatitude";
+}
+
+#gearDateLabel {
+ text: "tutti.label.fishingOperation.gearDate";
+}
+
+#gearTimeLabel {
+ text: "tutti.label.fishingOperation.gearTime";
+}
+
+#gearShootingStartLabel {
+ text: "tutti.label.fishingOperation.gearShootingStart";
+}
+
+#gearShootingEndLabel {
+ text: "tutti.label.fishingOperation.gearShootingEnd";
+}
+
+#gearShootingStartLongitudeField {
+ text: {getStringValue(model.getGearShootingStartLongitude())};
+}
+
+#gearShootingStartLatitudeField {
+ text: {getStringValue(model.getGearShootingStartLatitude())};
+}
+
+#gearShootingStartDateField {
+ date: {model.getGearShootingStartDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#gearShootingStartTimeField {
+ property: "gearShootingStartDate";
+ date: {model.getGearShootingStartDate()};
+}
+
+#gearShootingEndLongitudeField {
+ text: {getStringValue(model.getGearShootingEndLongitude())};
+}
+
+#gearShootingEndLatitudeField {
+ text: {getStringValue(model.getGearShootingEndLatitude())};
+}
+
+#gearShootingEndDateField {
+ date: {model.getGearShootingEndDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#gearShootingEndTimeField {
+ property: "gearShootingEndDate";
+ date: {model.getGearShootingEndDate()};
+}
+
+#fishingOperationValidPanel {
+ floatable: false;
+ borderPainted: false;
+ opaque: false;
+}
+
+#resetValidStateButton {
+ actionIcon: "reset";
+ text: "tutti.action.reset.fishingOperationValidState";
+}
+
+#fishingOperationValidRadio {
+ text: "tutti.label.fishingOperation.fishingOperationValid";
+ selected: {model.getFishingOperationValid() == Boolean.TRUE};
+ buttonGroup: "fishingOperationValid";
+}
+
+#fishingOperationInvalidRadio {
+ text: "tutti.label.fishingOperation.fishingOperationInvalid";
+ selected: {model.getFishingOperationValid() == Boolean.FALSE};
+ buttonGroup: "fishingOperationValid";
+}
+#fishingOperationResetRadio {
+ selected: {model.getFishingOperationValid() == null};
+ buttonGroup: "fishingOperationValid";
+}
+
+#fishingOperationRectiligneCheckBox {
+ text: "tutti.label.fishingOperation.fishingOperationRectiligne";
+ selected: {model.isFishingOperationRectiligne()};
+}
+
+#distanceChaluteeLabel {
+ text: "tutti.label.fishingOperation.distanceChalutee";
+ labelFor: {distanceChaluteeField};
+}
+
+#distanceChaluteeField {
+ property: "distanceChalutee";
+ model: {model.getDistanceChalutee()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+ enabled: {!model.isFishingOperationRectiligne()};
+}
+
+#beaufortScaleLabel {
+ text: "tutti.label.fishingOperation.beaufortScale";
+ labelFor: {beaufortScaleComboBox};
+}
+
+#beaufortScaleComboBox {
+ property: "beaufortScale";
+ selectedItem: {model.getBeaufortScale()};
+}
+
+#windDirectionLabel {
+ text: "tutti.label.fishingOperation.windDirection";
+ labelFor: {windDirectionField};
+}
+
+#windDirectionField {
+ property: "windDirection";
+ model: {model.getWindDirection()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#seaStateLabel {
+ text: "tutti.label.fishingOperation.seaState";
+ labelFor: {seaStateComboBox};
+}
+
+#seaStateComboBox {
+ property: "seaState";
+ selectedItem: {model.getSeaState()};
+}
+
+#ouvertureHorizontaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureHorizontale";
+ labelFor: {ouvertureHorizontaleField};
+}
+
+#ouvertureHorizontaleVerticaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureHorizontaleVerticale";
+}
+
+#ouvertureHorizontaleField {
+ property: "ouvertureHorizontale";
+ model: {model.getOuvertureHorizontale()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#ouvertureVerticaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureVerticale";
+ labelFor: {ouvertureVerticaleField};
+}
+
+#ouvertureVerticaleField {
+ property: "ouvertureVerticale";
+ model: {model.getOuvertureVerticale()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#geometrieMesureeCheckBox {
+ text: "tutti.label.fishingOperation.geometrieMesuree";
+ selected: {model.isGeometrieMesuree()};
+}
+
+#longueurFunesLabel {
+ text: "tutti.label.fishingOperation.longueurFunes";
+ labelFor: {longueurFunesField};
+}
+
+#longueurFunesBrasLabel {
+ text: "tutti.label.fishingOperation.longueurFunesBras";
+}
+
+#longueurFunesField {
+ property: "longueurFunes";
+ model: {model.getLongueurFunes()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#longueurBrasLabel {
+ text: "tutti.label.fishingOperation.longueurBras";
+ labelFor: {longueurBrasField};
+}
+
+#longueurBrasField {
+ property: "longueurBras";
+ model: {model.getLongueurBras()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#systemeFermetureCulCheckBox {
+ text: "tutti.label.fishingOperation.systemeFermetureCul";
+ selected: {model.isSystemeFermetureCul()};
+}
+
+#dureeLabel {
+ text: "tutti.label.fishingOperation.duree";
+ labelFor: {dureeField};
+}
+
+#dureeField {
+ property: "duree";
+ model: {model.getDuree()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#saisisseurPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#saisisseurHeader {
+ labelText: {_("tutti.label.list.saisisseur")};
+ list: {saisisseurList};
+ beanType: {Person.class};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {model.getComment()};
+}
+
+#gearShootingStartDepthLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartDepth";
+ labelFor: {gearShootingStartDepthField};
+}
+
+#gearShootingStartDepthField {
+ property: "gearShootingStartDepth";
+ model: {model.getGearShootingStartDepth()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndDepthLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndDepth";
+ labelFor: {gearShootingEndDepthField};
+}
+
+#gearShootingEndDepthField {
+ property: "gearShootingEndDepth";
+ model: {model.getGearShootingEndDepth()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartSurfaceTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartSurfaceTemperature";
+ labelFor: {gearShootingStartSurfaceTemperatureField};
+}
+
+#gearShootingStartSurfaceTemperatureField {
+ property: "gearShootingStartSurfaceTemperature";
+ model: {model.getGearShootingStartSurfaceTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndSurfaceTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndSurfaceTemperature";
+ labelFor: {gearShootingEndSurfaceTemperatureField};
+}
+
+#gearShootingEndSurfaceTemperatureField {
+ property: "gearShootingEndSurfaceTemperature";
+ model: {model.getGearShootingEndSurfaceTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartBottomTemperature";
+ labelFor: {gearShootingStartBottomTemperatureField};
+}
+
+#gearShootingStartBottomTemperatureField {
+ property: "gearShootingStartBottomTemperature";
+ model: {model.getGearShootingStartBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndBottomTemperature";
+ labelFor: {gearShootingEndBottomTemperatureField};
+}
+
+#gearShootingEndBottomTemperatureField {
+ property: "gearShootingEndBottomTemperature";
+ model: {model.getGearShootingEndBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#averageBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.averageBottomTemperature";
+ labelFor: {averageBottomTemperatureField};
+}
+
+#averageBottomTemperatureField {
+ property: "averageBottomTemperature";
+ model: {model.getAverageBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartSurfaceSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartSurfaceSalinity";
+ labelFor: {gearShootingStartSurfaceSalinityField};
+}
+
+#gearShootingStartSurfaceSalinityField {
+ property: "gearShootingStartSurfaceSalinity";
+ model: {model.getGearShootingStartSurfaceSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndSurfaceSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndSurfaceSalinity";
+ labelFor: {gearShootingEndSurfaceSalinityField};
+}
+
+#gearShootingEndSurfaceSalinityField {
+ property: "gearShootingEndSurfaceSalinity";
+ model: {model.getGearShootingEndSurfaceSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartBottomSalinity";
+ labelFor: {gearShootingStartBottomSalinityField};
+}
+
+#gearShootingStartBottomSalinityField {
+ property: "gearShootingStartBottomSalinity";
+ model: {model.getGearShootingStartBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndBottomSalinity";
+ labelFor: {gearShootingEndBottomSalinityField};
+}
+
+#gearShootingEndBottomSalinityField {
+ property: "gearShootingEndBottomSalinity";
+ model: {model.getGearShootingEndBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#averageBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.averageBottomSalinity";
+ labelFor: {averageBottomSalinityField};
+}
+
+#averageBottomSalinityField {
+ property: "averageBottomSalinity";
+ model: {model.getAverageBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#noTraitPane {
+ text: "tutti.label.no.fishingOperation.selected";
+ horizontalAlignment: {JLabel.CENTER};
+}
+
+#saveButton {
+ actionIcon: "save";
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+}
+
+#cancelButton {
+ actionIcon: "cancel";
+ text: "tutti.action.cancel";
+ enabled: {model.isModify()};
+}
+
+#importPupitriButton {
+ actionIcon: "pupitri-import";
+ text: "tutti.action.pupitri-import";
+}
+
+#importCasinoButton {
+ actionIcon: "casino-import";
+ text: "tutti.action.casino-import";
+}
+
+#messagePanel {
+ border: {BorderFactory.createTitledBorder("Messages")};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,550 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<FishingOperationTabUIModel, FishingOperationTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
+ fr.ifremer.tutti.persistence.entities.referential.SeaState
+ fr.ifremer.tutti.persistence.entities.referential.Strata
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+ fr.ifremer.tutti.persistence.entities.referential.Person
+
+ fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.swing.editor.bean.BeanListHeader
+ jaxx.runtime.swing.editor.NumberEditor
+ jaxx.runtime.swing.editor.TimeEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXDatePicker
+
+ java.awt.Dimension
+
+ javax.swing.DefaultListModel
+ javax.swing.ListSelectionModel
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+public FishingOperationTabUI(FishingOperationsUI parentUI) {
+ FishingOperationTabUIHandler handler = new FishingOperationTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <FishingOperationTabUIHandler id='handler'
+ initializer='getContextValue(FishingOperationTabUIHandler.class)'/>
+
+ <FishingOperationTabUIModel id='model'
+ initializer='getContextValue(FishingOperationTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='stationNumber' component='stationNumberField'/>
+ <field name='fishingOperationNumber'
+ component='fishingOperationNumberField'/>
+ <field name='date' component='dateField'/>
+ <field name='comment' component='commentField'/>
+ <field name='saisisseur' component='saisisseurPane'/>
+ </BeanValidator>
+
+ <JPanel id='traitPane' constraints='BorderLayout.CENTER'
+ layout='{new BorderLayout()}'>
+
+ <JTabbedPane id='traitTabPane' constraints='BorderLayout.CENTER'>
+ <tab id='traitGeneralTab'
+ title='tutti.label.tab.fishingOperation.general'>
+ <Table fill='both' id='generalForm'>
+
+ <!-- Numero station / Numéro trait / Date -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='stationNumberLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='stationNumberField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='fishingOperationNumberLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='fishingOperationNumberField'
+ constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='dateLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JXDatePicker id='dateField'
+ onActionPerformed='handler.setDate(event, "date")'/>
+ </cell>
+ </row>
+
+ <!-- Strate d'association / Sous Strate / Localité -->
+ <row>
+ <cell>
+ <JLabel id='strataLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='strataComboBox' constructorParams='this'
+ genericType='Strata'/>
+ </cell>
+ <cell>
+ <JLabel id='subStrataLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='subStrataComboBox' constructorParams='this'
+ genericType='Strata'/>
+ </cell>
+ <cell>
+ <JLabel id='localiteLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JTextField id='localiteField'
+ onKeyReleased='handler.setText(event, "localite")'/>
+ </cell>
+ </row>
+
+ <!-- début de traine long-lat-date-heure
+ fin de traine long-lat-date-heure -->
+ <row>
+ <cell columns='6'>
+ <JPanel layout="{new BorderLayout()}">
+ <Table id="gearCaracteristicsTable" fill="both" weightx='1'
+ constraints='BorderLayout.CENTER'>
+ <row>
+ <cell>
+ <JLabel/>
+ </cell>
+ <cell>
+ <JLabel id='gearLongitudeLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearLatitudeLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearDateLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearTimeLabel'/>
+ </cell>
+ </row>
+
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingStartLongitudeField'
+ onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingStartLatitudeLabel'
+ onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JXDatePicker id='gearShootingStartDateField'
+ onActionPerformed='handler.setDate(event, "gearShootingStartDate")'/>
+ </cell>
+ <cell>
+ <SimpleTimeEditor id='gearShootingStartTimeField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingEndLongitudeField'
+ onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingEndLatitudeLabel'
+ onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JXDatePicker id='gearShootingEndDateField'
+ onActionPerformed='handler.setDate(event, "gearShootingEndDate")'/>
+ </cell>
+ <cell>
+ <SimpleTimeEditor id='gearShootingEndTimeField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- Fishing operation valid / invalid-->
+ <row>
+ <cell columns="2">
+ <JToolBar id='fishingOperationValidPanel'
+ layout='{new BorderLayout()}'>
+ <JButton id='resetValidStateButton'
+ constraints='BorderLayout.WEST'
+ onActionPerformed="model.setFishingOperationValid(null)"/>
+ <JRadioButton id='fishingOperationResetRadio'
+ constraints='BorderLayout.EAST'/>
+ </JToolBar>
+ </cell>
+ <cell columns="2">
+ <JRadioButton id='fishingOperationValidRadio'
+ onActionPerformed='model.setFishingOperationValid(Boolean.TRUE)'/>
+ </cell>
+ <cell columns="2">
+ <JRadioButton id='fishingOperationInvalidRadio'
+ onActionPerformed='model.setFishingOperationValid(Boolean.FALSE)'/>
+ </cell>
+ </row>
+
+ <!-- FishingOperation rectiligne / distance chalutee / durée -->
+ <row>
+ <cell>
+ <JCheckBox id='fishingOperationRectiligneCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "fishingOperationRectiligne")'/>
+ </cell>
+ <cell columns="3">
+ <JPanel layout="{new BorderLayout()}">
+ <JLabel id='distanceChaluteeLabel'
+ constraints='BorderLayout.WEST'/>
+ <NumberEditor id='distanceChaluteeField'
+ constraints='BorderLayout.CENTER'
+ constructorParams='this'/>
+ </JPanel>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='dureeLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='dureeField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Actions d'import -->
+ <row>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='importPupitriButton'
+ onActionPerformed='handler.importPupitri()'/>
+ <JButton id='importCasinoButton'
+ onActionPerformed='handler.importCasino()'/>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- Saisisseur -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JScrollPane id='saisisseurPane'
+ columnHeaderView="{saisisseurHeader}"
+ onFocusGained='saisisseurList.requestFocus()'>
+ <JList id='saisisseurList'
+ onValueChanged='handler.selectListData(event, "saisisseur")'/>
+ <BeanListHeader id='saisisseurHeader' genericType='Person'/>
+ </JScrollPane>
+ </cell>
+ </row>
+
+ <!-- Commentaire -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </tab>
+
+ <tab id='traitGearShootingTab'
+ title='tutti.label.tab.fishingOperation.gearShooting'>
+
+ <Table fill='both' id='gearShootingForm'>
+
+ <!-- GearShootingStart Depth -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartDepthLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartDepthField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEnd Depth -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndDepthLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndDepthField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Ouverture horizontale -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='ouvertureHorizontaleLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='ouvertureHorizontaleField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Ouverture verticale -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='ouvertureVerticaleLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='ouvertureVerticaleField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Longueur funes -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='longueurFunesLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='longueurFunesField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Longueur bras -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='longueurBrasLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='longueurBrasField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Système de fermeture du cul / Geometrie mesuree -->
+ <row>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JCheckBox id='systemeFermetureCulCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/>
+ <JCheckBox id='geometrieMesureeCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+ </tab>
+
+ <tab id='environmentTab'
+ title='tutti.label.tab.fishingOperation.environment'>
+
+ <Table fill='both' id='environmentForm'>
+
+ <!-- Beaufort scale -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='beaufortScaleLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
+ genericType='BeaufortScale'/>
+ </cell>
+ </row>
+
+ <!-- Wind direction -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='windDirectionLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='windDirectionField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Sea state-->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='seaStateLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <BeanComboBox id='seaStateComboBox' constructorParams='this'
+ genericType='SeaState'/>
+ </cell>
+ </row>
+ </Table>
+ </tab>
+
+ <tab id='traitHydrologyTabContent'
+ title='tutti.label.tab.fishingOperation.hydrology'>
+
+ <Table fill='both' id='hydrologyForm'>
+
+ <!-- GearShootingStartSurfaceTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartSurfaceTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartSurfaceTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndSurfaceTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndSurfaceTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndSurfaceTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- AverageBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='averageBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='averageBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartSurfaceSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartSurfaceSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartSurfaceSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndSurfaceSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndSurfaceSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndSurfaceSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- AverageBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='averageBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='averageBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ </Table>
+ </tab>
+ </JTabbedPane>
+
+ <!-- Actions -->
+ <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'>
+ <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.CENTER'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+ </JPanel>
+
+ </JPanel>
+
+ <JLabel id='noTraitPane'/>
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,242 @@
+package fr.ifremer.tutti.ui.swing.content.operation;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import java.awt.BorderLayout;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+/**
+ * Handler for UI {@link FishingOperationTabUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationTabUIHandler extends AbstractTuttiUIHandler<FishingOperationTabUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(FishingOperationTabUIHandler.class);
+
+ private final FishingOperationTabUI ui;
+
+ private final FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public FishingOperationTabUIHandler(FishingOperationsUI parentUi, FishingOperationTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ FishingOperationTabUIModel model = new FishingOperationTabUIModel();
+ model.addPropertyChangeListener(FishingOperationTabUIModel.PROPERTY_EMPTY, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ JPanel form = ui.getTraitPane();
+ JLabel noContentPane = ui.getNoTraitPane();
+
+ Boolean empty = (Boolean) evt.getNewValue();
+ ui.remove(form);
+ ui.remove(noContentPane);
+ if (empty) {
+ ui.add(noContentPane, BorderLayout.CENTER);
+ } else {
+ ui.add(form, BorderLayout.CENTER);
+ }
+ ui.repaint();
+ }
+ });
+
+ listModelIsModify(model);
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ ui.getFishingOperationValidPanel().remove(
+ ui.getFishingOperationResetRadio());
+
+ FishingOperationTabUIModel model = ui.getModel();
+
+ initUI(ui);
+
+ initBeanList(ui.getSaisisseurHeader(),
+ persistenceService.getAllPerson(),
+ model.getSaisisseur());
+
+ initBeanComboBox(ui.getBeaufortScaleComboBox(),
+ persistenceService.getAllBeaufortScale(),
+ model.getBeaufortScale());
+
+ initBeanComboBox(ui.getStrataComboBox(),
+ persistenceService.getAllStrata(),
+ model.getStrata());
+
+ initBeanComboBox(ui.getSeaStateComboBox(),
+ persistenceService.getAllSeaState(),
+ model.getSeaState());
+
+ model.setEmpty(true);
+
+ listenValidatorValid(ui.getValidator(), getModel());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected FishingOperationTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ FishingOperationTabUIModel model = getModel();
+
+ // clean previous selection
+ ui.getSaisisseurHeader().getList().clearSelection();
+
+ if (empty) {
+
+ model.fromBean(new FishingOperation());
+ } else {
+
+ model.fromBean(bean);
+ }
+
+ // update saisissuer selection
+ List<Person> saisisseur = model.getSaisisseur();
+ if (CollectionUtils.isNotEmpty(saisisseur)) {
+ updateIndices(ui.getSaisisseurList(), saisisseur);
+ }
+
+ // update model empty property
+ model.setEmpty(empty);
+
+ // reload bean in validator (? really mandatory?)
+// ui.getValidator().reloadBean();
+
+ // if new fishingOperation can already cancel his creation
+ model.setModify(!empty && model.isCreate());
+ }
+
+ public void cancel() {
+
+ String id = getModel().getId();
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition for fishingOperation: " + id);
+ }
+ boolean newBean = StringUtils.isBlank(id);
+
+ if (newBean) {
+
+ // cancel to create a new fishingOperation
+ parentUi.getHandler().selectFishingOperation(null);
+
+ } else {
+
+ // reselect in ui the fishingOperation
+ FishingOperation selectedFishingOperation = parentUi.getModel().getSelectedFishingOperation();
+ parentUi.getHandler().selectFishingOperation(selectedFishingOperation);
+ }
+ }
+
+ public void save() {
+
+ // get fishingOperation to save
+ FishingOperation toSave = getModel().toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("Save edition for fishingOperation: " + toSave.getId());
+ }
+
+ // keep selected tab (to resotre it after save)
+ int selectedIndex = ui.getTraitTabPane().getSelectedIndex();
+
+ // persist current fishingOperation
+ parentUi.getHandler().saveFishingOperation(toSave);
+
+ // reselect current tab
+ ui.getTraitTabPane().setSelectedIndex(selectedIndex);
+
+ getModel().setModify(false);
+ }
+
+ public void importPupitri() {
+ //TODO
+ }
+
+ public void importCasino() {
+ //TODO
+ }
+
+ public void setGearShootingStartLatitude(String text) {
+ getModel().setGearShootingStartLatitude(Float.valueOf(text));
+ }
+
+ public void setGearShootingStartLongitude(String text) {
+ getModel().setGearShootingStartLongitude(Float.valueOf(text));
+ }
+
+// public void setGearShootingStartTime(String text) {
+// getModel().setGearShootingStartTime(Integer.valueOf(text));
+// }
+
+ public void setGearShootingEndLatitude(String text) {
+ getModel().setGearShootingEndLatitude(Float.valueOf(text));
+ }
+
+ public void setGearShootingEndLongitude(String text) {
+ getModel().setGearShootingEndLongitude(Float.valueOf(text));
+ }
+
+// public void setGearShootingEndTime(String text) {
+// getModel().setGearShootingEndTime(Integer.valueOf(text));
+// }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,633 @@
+package fr.ifremer.tutti.ui.swing.content.operation;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.SeaState;
+import fr.ifremer.tutti.persistence.entities.referential.Strata;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Model for UI {@link FishingOperationTabUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationTabUIModel extends AbstractTuttiBeanUIModel<FishingOperation, FishingOperationTabUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_EMPTY = "empty";
+
+ public static final String PROPERTY_STATION_NUMBER = "stationNumber";
+
+ public static final String PROPERTY_FISHING_OPERATION_NUMBER = "fishingOperationNumber";
+
+ public static final String PROPERTY_DATE = "date";
+
+ public static final String PROPERTY_STRATA = "strata";
+
+ public static final String PROPERTY_SUB_STRATA = "subStrata";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
+
+ public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
+
+ public static final String PROPERTY_WIND_DIRECTION = "windDirection";
+
+ public static final String PROPERTY_SEA_STATE = "seaState";
+
+ public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale";
+
+ public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale";
+
+ public static final String PROPERTY_GEOMETRIE_MESUREE = "geometrieMesuree";
+
+ public static final String PROPERTY_LONGUEUR_FUNES = "longueurFunes";
+
+ public static final String PROPERTY_LONGUEUR_BRAS = "longueurBras";
+
+ public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
+
+ public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne";
+
+ public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee";
+
+ public static final String PROPERTY_DUREE = "duree";
+
+ public static final String PROPERTY_FISHING_OPERATION_VALID = "fishingOperationValid";
+
+ public static final String PROPERTY_LOCALITE = "localite";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_SAISISSEUR = "saisisseur";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE = "gearShootingStartSurfaceTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE = "gearShootingEndSurfaceTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE = "gearShootingStartBottomTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE = "gearShootingEndBottomTemperature";
+
+ public static final String PROPERTY_AVERAGE_BOTTOM_TEMPERATURE = "averageBottomTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY = "gearShootingStartSurfaceSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY = "gearShootingEndSurfaceSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY = "gearShootingStartBottomSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY = "gearShootingEndBottomSalinity";
+
+ public static final String PROPERTY_AVERAGE_BOTTOM_SALINITY = "averageBottomSalinity";
+
+ protected boolean empty;
+
+ protected Cruise cruise;
+
+ protected Integer stationNumber;
+
+ protected Integer fishingOperationNumber;
+
+ protected Date date;
+
+ protected Strata strata;
+
+ protected Strata subStrata;
+
+ protected Float gearShootingStartLatitude;
+
+ protected Float gearShootingStartLongitude;
+
+ protected Date gearShootingStartDate;
+
+ protected Integer gearShootingStartTime;
+
+ protected Float gearShootingStartDepth;
+
+ protected Float gearShootingEndLatitude;
+
+ protected Float gearShootingEndLongitude;
+
+ protected Date gearShootingEndDate;
+
+ protected Integer gearShootingEndTime;
+
+ protected Float gearShootingEndDepth;
+
+ protected BeaufortScale beaufortScale;
+
+ protected Integer windDirection;
+
+ protected SeaState seaState;
+
+ protected Float ouvertureHorizontale;
+
+ protected Float ouvertureVerticale;
+
+ protected boolean geometrieMesuree;
+
+ protected Float longueurFunes;
+
+ protected Float longueurBras;
+
+ protected boolean systemeFermetureCul;
+
+ protected boolean fishingOperationRectiligne;
+
+ protected Float distanceChalutee;
+
+ protected Float duree;
+
+ protected Boolean fishingOperationValid;
+
+ protected String localite;
+
+ protected String comment;
+
+ protected List<Person> saisisseur;
+
+ protected Float gearShootingStartSurfaceTemperature;
+
+ protected Float gearShootingEndSurfaceTemperature;
+
+ protected Float gearShootingStartBottomTemperature;
+
+ protected Float gearShootingEndBottomTemperature;
+
+ protected Float averageBottomTemperature;
+
+ protected Float gearShootingStartSurfaceSalinity;
+
+ protected Float gearShootingEndSurfaceSalinity;
+
+ protected Float gearShootingStartBottomSalinity;
+
+ protected Float gearShootingEndBottomSalinity;
+
+ protected Float averageBottomSalinity;
+
+ protected static Binder<FishingOperationTabUIModel, FishingOperation> toBeanBinder =
+ BinderFactory.newBinder(FishingOperationTabUIModel.class,
+ FishingOperation.class);
+
+ protected static Binder<FishingOperation, FishingOperationTabUIModel> fromBeanBinder =
+ BinderFactory.newBinder(FishingOperation.class, FishingOperationTabUIModel.class);
+
+ public FishingOperationTabUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public boolean isEmpty() {
+ return empty;
+ }
+
+ public void setEmpty(boolean empty) {
+ Object oldValue = isEmpty();
+ this.empty = empty;
+ firePropertyChange(PROPERTY_EMPTY, oldValue, empty);
+ }
+
+ public Cruise getCruise() {
+ return cruise;
+ }
+
+ public void setCruise(Cruise cruise) {
+ this.cruise = cruise;
+ }
+
+ public Integer getStationNumber() {
+ return stationNumber;
+ }
+
+ public void setStationNumber(Integer stationNumber) {
+ Object oldValue = getStationNumber();
+ this.stationNumber = stationNumber;
+ firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
+ }
+
+ public Integer getFishingOperationNumber() {
+ return fishingOperationNumber;
+ }
+
+ public void setFishingOperationNumber(Integer fishingOperationNumber) {
+ Object oldValue = getFishingOperationNumber();
+ this.fishingOperationNumber = fishingOperationNumber;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber);
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ Object oldValue = getDate();
+ this.date = date;
+ firePropertyChange(PROPERTY_DATE, oldValue, date);
+ }
+
+ public Strata getStrata() {
+ return strata;
+ }
+
+ public void setStrata(Strata strata) {
+ Object oldValue = getStrata();
+ this.strata = strata;
+ firePropertyChange(PROPERTY_STRATA, oldValue, strata);
+ }
+
+ public Strata getSubStrata() {
+ return subStrata;
+ }
+
+ public void setSubStrata(Strata subStrata) {
+ Object oldValue = getSubStrata();
+ this.subStrata = subStrata;
+ firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata);
+ }
+
+ public Float getGearShootingStartLatitude() {
+ return gearShootingStartLatitude;
+ }
+
+ public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
+ Object oldValue = getGearShootingStartLatitude();
+ this.gearShootingStartLatitude = gearShootingStartLatitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude);
+ }
+
+ public Float getGearShootingStartLongitude() {
+ return gearShootingStartLongitude;
+ }
+
+ public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
+ Object oldValue = getGearShootingStartLongitude();
+ this.gearShootingStartLongitude = gearShootingStartLongitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude);
+ }
+
+ public Date getGearShootingStartDate() {
+ return gearShootingStartDate;
+ }
+
+ public void setGearShootingStartDate(Date gearShootingStartDate) {
+ Object oldValue = getGearShootingStartDate();
+ this.gearShootingStartDate = gearShootingStartDate;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, gearShootingStartDate);
+ }
+
+ public Float getGearShootingStartDepth() {
+ return gearShootingStartDepth;
+ }
+
+ public void setGearShootingStartDepth(Float gearShootingStartDepth) {
+ Object oldValue = getGearShootingStartDepth();
+ this.gearShootingStartDepth = gearShootingStartDepth;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DEPTH, oldValue, gearShootingStartDepth);
+ }
+
+ public Float getGearShootingEndLatitude() {
+ return gearShootingEndLatitude;
+ }
+
+ public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
+ Object oldValue = getGearShootingEndLatitude();
+ this.gearShootingEndLatitude = gearShootingEndLatitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude);
+ }
+
+ public Float getGearShootingEndLongitude() {
+ return gearShootingEndLongitude;
+ }
+
+ public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
+ Object oldValue = getGearShootingEndLongitude();
+ this.gearShootingEndLongitude = gearShootingEndLongitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude);
+ }
+
+ public Date getGearShootingEndDate() {
+ return gearShootingEndDate;
+ }
+
+ public void setGearShootingEndDate(Date gearShootingEndDate) {
+ Object oldValue = getGearShootingEndDate();
+ this.gearShootingEndDate = gearShootingEndDate;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate);
+ }
+
+ public Float getGearShootingEndDepth() {
+ return gearShootingEndDepth;
+ }
+
+ public void setGearShootingEndDepth(Float gearShootingEndDepth) {
+ Object oldValue = getGearShootingEndDepth();
+ this.gearShootingEndDepth = gearShootingEndDepth;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth);
+ }
+
+ public BeaufortScale getBeaufortScale() {
+ return beaufortScale;
+ }
+
+ public void setBeaufortScale(BeaufortScale beaufortScale) {
+ Object oldValue = getBeaufortScale();
+ this.beaufortScale = beaufortScale;
+ firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
+ }
+
+ public Integer getWindDirection() {
+ return windDirection;
+ }
+
+ public void setWindDirection(Integer windDirection) {
+ Object oldValue = getWindDirection();
+ this.windDirection = windDirection;
+ firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
+ }
+
+ public SeaState getSeaState() {
+ return seaState;
+ }
+
+ public void setSeaState(SeaState seaState) {
+ Object oldValue = getSeaState();
+ this.seaState = seaState;
+ firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
+ }
+
+ public Float getOuvertureHorizontale() {
+ return ouvertureHorizontale;
+ }
+
+ public void setOuvertureHorizontale(Float ouvertureHorizontale) {
+ Object oldValue = getOuvertureHorizontale();
+ this.ouvertureHorizontale = ouvertureHorizontale;
+ firePropertyChange(PROPERTY_OUVERTURE_HORIZONTALE, oldValue, ouvertureHorizontale);
+ }
+
+ public Float getOuvertureVerticale() {
+ return ouvertureVerticale;
+ }
+
+ public void setOuvertureVerticale(Float ouvertureVerticale) {
+ Object oldValue = getOuvertureVerticale();
+ this.ouvertureVerticale = ouvertureVerticale;
+ firePropertyChange(PROPERTY_OUVERTURE_VERTICALE, oldValue, ouvertureVerticale);
+ }
+
+ public boolean isGeometrieMesuree() {
+ return geometrieMesuree;
+ }
+
+ public void setGeometrieMesuree(boolean geometrieMesuree) {
+ Object oldValue = isGeometrieMesuree();
+ this.geometrieMesuree = geometrieMesuree;
+ firePropertyChange(PROPERTY_GEOMETRIE_MESUREE, oldValue, geometrieMesuree);
+ }
+
+ public Float getLongueurFunes() {
+ return longueurFunes;
+ }
+
+ public void setLongueurFunes(Float longueurFunes) {
+ Object oldValue = getLongueurFunes();
+ this.longueurFunes = longueurFunes;
+ firePropertyChange(PROPERTY_LONGUEUR_FUNES, oldValue, longueurFunes);
+ }
+
+ public Float getLongueurBras() {
+ return longueurBras;
+ }
+
+ public void setLongueurBras(Float longueurBras) {
+ Object oldValue = getLongueurBras();
+ this.longueurBras = longueurBras;
+ firePropertyChange(PROPERTY_LONGUEUR_BRAS, oldValue, longueurBras);
+ }
+
+ public boolean isSystemeFermetureCul() {
+ return systemeFermetureCul;
+ }
+
+ public void setSystemeFermetureCul(boolean systemeFermetureCul) {
+ Object oldValue = isSystemeFermetureCul();
+ this.systemeFermetureCul = systemeFermetureCul;
+ firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul);
+ }
+
+ public boolean isFishingOperationRectiligne() {
+ return fishingOperationRectiligne;
+ }
+
+ public void setFishingOperationRectiligne(boolean fishingOperationRectiligne) {
+ Object oldValue = isFishingOperationRectiligne();
+ this.fishingOperationRectiligne = fishingOperationRectiligne;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_RECTILIGNE, oldValue, fishingOperationRectiligne);
+ }
+
+ public Float getDistanceChalutee() {
+ return distanceChalutee;
+ }
+
+ public void setDistanceChalutee(Float distanceChalutee) {
+ Object oldValue = getDistanceChalutee();
+ this.distanceChalutee = distanceChalutee;
+ firePropertyChange(PROPERTY_DISTANCE_CHALUTEE, oldValue, distanceChalutee);
+ }
+
+ public Float getDuree() {
+ return duree;
+ }
+
+ public void setDuree(Float duree) {
+ Object oldValue = getDuree();
+ this.duree = duree;
+ firePropertyChange(PROPERTY_DUREE, oldValue, duree);
+ }
+
+ public Boolean getFishingOperationValid() {
+ return fishingOperationValid;
+ }
+
+ public void setFishingOperationValid(Boolean fishingOperationValid) {
+ Object oldValue = getFishingOperationValid();
+ this.fishingOperationValid = fishingOperationValid;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid);
+ }
+
+ public String getLocalite() {
+ return localite;
+ }
+
+ public void setLocalite(String localite) {
+ Object oldValue = getLocalite();
+ this.localite = localite;
+ firePropertyChange(PROPERTY_LOCALITE, oldValue, localite);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public List<Person> getSaisisseur() {
+ return saisisseur;
+ }
+
+ public void setSaisisseur(List<Person> saisisseur) {
+ this.saisisseur = saisisseur;
+ firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
+ }
+
+ public Float getGearShootingStartSurfaceTemperature() {
+ return gearShootingStartSurfaceTemperature;
+ }
+
+ public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) {
+ Object oldValue = getGearShootingStartSurfaceTemperature();
+ this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE, oldValue, gearShootingStartSurfaceTemperature);
+ }
+
+ public Float getGearShootingEndSurfaceTemperature() {
+ return gearShootingEndSurfaceTemperature;
+ }
+
+ public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) {
+ Object oldValue = getGearShootingEndSurfaceTemperature();
+ this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE, oldValue, gearShootingEndSurfaceTemperature);
+ }
+
+ public Float getGearShootingStartBottomTemperature() {
+ return gearShootingStartBottomTemperature;
+ }
+
+ public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) {
+ Object oldValue = getGearShootingStartBottomTemperature();
+ this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE, oldValue, gearShootingStartBottomTemperature);
+ }
+
+ public Float getGearShootingEndBottomTemperature() {
+ return gearShootingEndBottomTemperature;
+ }
+
+ public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) {
+ Object oldValue = getGearShootingEndBottomTemperature();
+ this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE, oldValue, gearShootingEndBottomTemperature);
+ }
+
+ public Float getAverageBottomTemperature() {
+ return averageBottomTemperature;
+ }
+
+ public void setAverageBottomTemperature(Float averageBottomTemperature) {
+ Object oldValue = getAverageBottomTemperature();
+ this.averageBottomTemperature = averageBottomTemperature;
+ firePropertyChange(PROPERTY_AVERAGE_BOTTOM_TEMPERATURE, oldValue, averageBottomTemperature);
+ }
+
+ public Float getGearShootingStartSurfaceSalinity() {
+ return gearShootingStartSurfaceSalinity;
+ }
+
+ public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) {
+ Object oldValue = getGearShootingStartSurfaceSalinity();
+ this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY, oldValue, gearShootingStartSurfaceSalinity);
+ }
+
+ public Float getGearShootingEndSurfaceSalinity() {
+ return gearShootingEndSurfaceSalinity;
+ }
+
+ public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) {
+ Object oldValue = getGearShootingEndSurfaceSalinity();
+ this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY, oldValue, gearShootingEndSurfaceSalinity);
+ }
+
+ public Float getGearShootingStartBottomSalinity() {
+ return gearShootingStartBottomSalinity;
+ }
+
+ public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) {
+ Object oldValue = getGearShootingStartBottomSalinity();
+ this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY, oldValue, gearShootingStartBottomSalinity);
+ }
+
+ public Float getGearShootingEndBottomSalinity() {
+ return gearShootingEndBottomSalinity;
+ }
+
+ public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) {
+ Object oldValue = getGearShootingEndBottomSalinity();
+ this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY, oldValue, gearShootingEndBottomSalinity);
+ }
+
+ public Float getAverageBottomSalinity() {
+ return averageBottomSalinity;
+ }
+
+ public void setAverageBottomSalinity(Float averageBottomSalinity) {
+ Object oldValue = getAverageBottomSalinity();
+ this.averageBottomSalinity = averageBottomSalinity;
+ firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity);
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,64 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+#newFishingOperationButton {
+ text: "tutti.action.new";
+ actionIcon: "add";
+}
+
+#traitComboBox {
+ property: "selectedFishingOperation";
+ selectedItem: {model.getSelectedFishingOperation()};
+}
+
+#speciesTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#benthosTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#planctonTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#macroDechetTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#accidentelTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#observationIndividuelTab {
+ enabled: {false};
+ /*enabled: {model.getSelectedFishingOperation() != null};*/
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,99 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<FishingOperationsUIModel, FishingOperationsUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.accidentel.AccidentelTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.benthos.BenthosTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.macrodechet.MacroDechetTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.plancton.PlanctonTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTabUI
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+public FishingOperationsUI(TuttiUIContext context) {
+ FishingOperationsUIHandler handler = new FishingOperationsUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+}
+ ]]></script>
+
+ <FishingOperationsUIHandler id='handler'
+ initializer='getContextValue(FishingOperationsUIHandler.class)'/>
+
+ <FishingOperationsUIModel id='model'
+ initializer='getContextValue(FishingOperationsUIModel.class)'/>
+
+ <Table fill='both' id='topPanel' constraints='BorderLayout.NORTH'>
+
+ <!-- FishingOperations fishingOperation -->
+ <row>
+ <cell anchor='west' weightx='1.0'>
+ <BeanComboBox id='traitComboBox' constructorParams='this'
+ genericType='FishingOperation'/>
+ </cell>
+ <cell anchor='east'>
+ <JButton id='newFishingOperationButton'
+ onActionPerformed='getHandler().createNewFishingOperation()'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'>
+ <tab id='traitTab' title='tutti.label.tab.fishingOperation'>
+ <FishingOperationTabUI id='fishingOperationTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='speciesTab' title='tutti.label.tab.species'>
+ <SpeciesTabUI id='speciesTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='benthosTab' title='tutti.label.tab.benthos'>
+ <BenthosTabUI id='benthosTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='planctonTab' title='tutti.label.tab.plancton'>
+ <PlanctonTabUI id='planctonTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='macroDechetTab' title='tutti.label.tab.macroDechet'>
+ <MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='accidentelTab' title='tutti.label.tab.accidentel'>
+ <AccidentelTabUI id='accidentelTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='observationIndividuelTab' title='tutti.label.tab.observationIndividuel'>
+ <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
+ </tab>
+ </JTabbedPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,209 @@
+package fr.ifremer.tutti.ui.swing.content.operation;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Handler of UI {@link FishingOperationsUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationsUIHandler extends AbstractTuttiUIHandler<FishingOperationsUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(FishingOperationsUIHandler.class);
+
+ private final FishingOperationsUI ui;
+
+ private final PersistenceService persistenceService;
+
+ public FishingOperationsUIHandler(TuttiUIContext context, FishingOperationsUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ FishingOperationsUIModel model = new FishingOperationsUIModel();
+
+ String cruiseId = context.getCruiseId();
+
+ // load existing cruise
+ Cruise cruise = persistenceService.getCruise(cruiseId);
+ model.setCruise(cruise);
+
+ List<FishingOperation> fishingOperations = persistenceService.getAllFishingOperation(cruiseId);
+ model.setFishingOperation(fishingOperations);
+
+ if (log.isInfoEnabled()) {
+ log.info("Loaded " + fishingOperations.size() + " fishingOperation(s).");
+ }
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ FishingOperationsUIModel model = getModel();
+
+ initUI(ui);
+
+ List<FishingOperation> fishingOperations = model.getFishingOperation();
+
+ initBeanComboBox(ui.getTraitComboBox(),
+ fishingOperations,
+ model.getSelectedFishingOperation());
+
+ model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_SELECTED_FISHING_OPERATION, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ selectFishingOperation((FishingOperation) evt.getNewValue());
+ }
+ });
+
+ model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_FISHING_OPERATION, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ ui.getTraitComboBox().setData(null);
+ ui.getTraitComboBox().setData((List<FishingOperation>) evt.getNewValue());
+ }
+ });
+
+ if (!fishingOperations.isEmpty()) {
+
+ model.setSelectedFishingOperation(fishingOperations.get(0));
+ }
+ }
+
+ @Override
+ public void onCloseUI() {
+
+ // ui will be saved so we do not want to keep selected tab indexes
+ ui.getTabPane().setSelectedIndex(0);
+ ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
+
+ // when quitting ui, let's de-select fishingOperation (will save any changes)
+ selectFishingOperation(null);
+ }
+
+ @Override
+ protected FishingOperationsUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void createNewFishingOperation() {
+
+ // deselect selected fishingOperation
+ getModel().setSelectedFishingOperation(null);
+
+ // use a new empty fishingOperation
+ FishingOperation newFishingOperation = new FishingOperation();
+ newFishingOperation.setCruise(getModel().getCruise());
+
+ // by default use the current day with no time information
+ Date currentDate = new Date();
+ currentDate = DateUtils.setHours(currentDate, 0);
+ currentDate = DateUtils.setMinutes(currentDate, 0);
+
+ newFishingOperation.setDate(currentDate);
+ newFishingOperation.setGearShootingStartDate(currentDate);
+ newFishingOperation.setGearShootingEndDate(currentDate);
+ selectFishingOperation(newFishingOperation);
+ }
+
+ public void selectFishingOperation(FishingOperation fishingOperation) {
+
+ if (log.isInfoEnabled()) {
+ log.info("New selected fishingOperation: " + fishingOperation);
+ }
+ // back to fishingOperation tab
+ ui.getTabPane().setSelectedIndex(0);
+
+ // back to general tab of fishingOperation tabs
+ ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
+
+ // propagate fishingOperation to his tabs
+ ui.getFishingOperationTabContent().selectFishingOperation(fishingOperation);
+ ui.getSpeciesTabContent().selectFishingOperation(fishingOperation);
+ ui.getBenthosTabContent().selectFishingOperation(fishingOperation);
+ ui.getPlanctonTabContent().selectFishingOperation(fishingOperation);
+ ui.getMacroDechetTabContent().selectFishingOperation(fishingOperation);
+ ui.getAccidentelTabContent().selectFishingOperation(fishingOperation);
+
+ // repaint tabs
+ ui.getTabPane().repaint();
+// ui.getObservationIndividuelTabContent().selectFishingOperation(selectedFishingOperation);
+ }
+
+ public void saveFishingOperation(FishingOperation toSave) {
+
+ // persist the fishingOperation
+
+ boolean create = toSave.getId() == null;
+
+ FishingOperation savedFishingOperation;
+ if (create) {
+ savedFishingOperation = persistenceService.createFishingOperation(toSave);
+ } else {
+ savedFishingOperation = persistenceService.saveFishingOperation(toSave);
+ }
+
+ FishingOperationsUIModel model = getModel();
+
+ // add the saved fishingOperation to fishingOperation list
+
+ List<FishingOperation> data = model.getFishingOperation();
+
+ FishingOperation existingFishingOperation = TuttiEntities.findById(data, savedFishingOperation.getId());
+ if (existingFishingOperation != null) {
+ data.remove(existingFishingOperation);
+ }
+ data.add(savedFishingOperation);
+
+ // update model fishingOperation list
+ model.setFishingOperation(data);
+
+ // update model selected fishingOperation
+ model.setSelectedFishingOperation(savedFishingOperation);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,83 @@
+package fr.ifremer.tutti.ui.swing.content.operation;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import org.jdesktop.beans.AbstractSerializableBean;
+
+import java.util.List;
+
+/**
+ * Model fo UI {@link FishingOperationsUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationsUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_FISHING_OPERATION = "fishingOperation";
+
+ public static final String PROPERTY_SELECTED_FISHING_OPERATION = "selectedFishingOperation";
+
+ public static final String PROPERTY_CRUISE = "cruise";
+
+ protected List<FishingOperation> fishingOperation;
+
+ protected FishingOperation selectedFishingOperation;
+
+ protected Cruise cruise;
+
+ public List<FishingOperation> getFishingOperation() {
+ return fishingOperation;
+ }
+
+ public void setFishingOperation(List<FishingOperation> fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ firePropertyChange(PROPERTY_FISHING_OPERATION, null, fishingOperation);
+ }
+
+ public FishingOperation getSelectedFishingOperation() {
+ return selectedFishingOperation;
+ }
+
+ public void setSelectedFishingOperation(FishingOperation selectedFishingOperation) {
+ Object oldValue = getSelectedFishingOperation();
+ this.selectedFishingOperation = selectedFishingOperation;
+ firePropertyChange(PROPERTY_SELECTED_FISHING_OPERATION, oldValue, selectedFishingOperation);
+ }
+
+ public Cruise getCruise() {
+ return cruise;
+ }
+
+ public void setCruise(Cruise cruise) {
+ Object oldValue = getCruise();
+ this.cruise = cruise;
+ firePropertyChange(PROPERTY_CRUISE, oldValue, cruise);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,94 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+#splitPane {
+ orientation: {JSplitPane.VERTICAL_SPLIT};
+ resizeWeight: 0.3;
+ oneTouchExpandable: true;
+ continuousLayout: true;
+}
+
+#form {
+ border: {BorderFactory.createTitledBorder((String)null)};
+}
+
+#nameLabel {
+ text: "tutti.label.program.name";
+ labelFor: {nameField};
+}
+
+#nameField {
+ text: {model.getName()};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {getStringValue(model.getComment())};
+}
+
+#zoneLabel {
+ text: "tutti.label.program.zone";
+ labelFor: {zoneComboBox};
+}
+
+#zoneComboBox {
+ property: "zone";
+ selectedItem: {model.getZone()};
+}
+
+#saveButton {
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+ actionIcon: "save";
+}
+
+#cancelButton {
+ text: "tutti.action.cancel";
+ actionIcon: "cancel";
+}
+
+#messagePanel {
+ border: {BorderFactory.createTitledBorder("Messages")};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,125 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditProgramUIModel, EditProgramUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.Zone
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ java.awt.Dimension
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+
+ </import>
+
+ <script><![CDATA[
+
+ public EditProgramUI(TuttiUIContext context) {
+ EditProgramUIHandler handler = new EditProgramUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <EditProgramUIHandler id='handler'
+ initializer='getContextValue(EditProgramUIHandler.class)'/>
+
+ <EditProgramUIModel id='model'
+ initializer='getContextValue(EditProgramUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='name' component='nameField'/>
+ <field name='zone' component='zoneComboBox'/>
+ <field name='comment' component='commentField'/>
+ </BeanValidator>
+
+ <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
+
+ <Table id='form' fill='both'>
+
+ <!-- program name -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='nameLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='nameField'
+ onKeyReleased='handler.setText(event, "name")'/>
+ </cell>
+ </row>
+
+ <!-- program zone -->
+ <row>
+ <cell>
+ <JLabel id='zoneLabel'/>
+ </cell>
+ <cell>
+ <BeanComboBox id='zoneComboBox' constructorParams='this'
+ genericType='Zone'/>
+ </cell>
+ </row>
+
+ <!-- program comment -->
+ <row weighty='0.8'>
+ <cell columns='2'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+
+ <!-- actions -->
+ <row anchor='south'>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+
+ <!-- validation messages -->
+ <JPanel id='messagePanel' layout='{new GridLayout()}'>
+ <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
+ <JTable id='errorTable' />
+ </JScrollPane>
+ </JPanel>
+ </JSplitPane>
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,135 @@
+package fr.ifremer.tutti.ui.swing.content.program;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
+import jaxx.runtime.validator.swing.SwingValidatorUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Handler of UI {@link EditProgramUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditProgramUIHandler extends AbstractTuttiUIHandler<EditProgramUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditProgramUIHandler.class);
+
+ private final EditProgramUI ui;
+
+ private final PersistenceService persistenceService;
+
+ public EditProgramUIHandler(TuttiUIContext context, EditProgramUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ EditProgramUIModel model = new EditProgramUIModel();
+
+ String surveyId = context.getProgramId();
+ if (surveyId == null) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Edit new program");
+ }
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Edit existing program " + surveyId);
+ }
+ // load existing program
+ Program program = persistenceService.getProgram(surveyId);
+
+ model.fromBean(program);
+ }
+
+ listModelIsModify(model);
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ EditProgramUIModel model = ui.getModel();
+ initBeanComboBox(ui.getZoneComboBox(),
+ persistenceService.getAllZone(),
+ model.getZone());
+
+ SwingValidatorUtil.installUI(ui.getErrorTable(),
+ new SwingValidatorMessageTableRenderer());
+
+ listenValidatorValid(ui.getValidator(), model);
+
+ // if new program can already cancel his creation
+ model.setModify(model.isCreate());
+ }
+
+ @Override
+ public void onCloseUI() {
+ ui.getValidator().setBean(null);
+ }
+
+ @Override
+ protected EditProgramUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void cancel() {
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+
+ public void save() {
+
+ EditProgramUIModel model = ui.getModel();
+
+ Program bean = model.toBean();
+
+ Program saved;
+ if (TuttiEntities.isNew(bean)) {
+
+ saved = persistenceService.createProgram(bean);
+ } else {
+ saved = persistenceService.saveProgram(bean);
+ }
+
+ context.setProgramId(saved.getId());
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java (from rev 39, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,97 @@
+package fr.ifremer.tutti.ui.swing.content.program;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * Bean to edit a program.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditProgramUIModel extends AbstractTuttiBeanUIModel<Program, EditProgramUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_ZONE = "zone";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_NAME = "name";
+
+ protected String name;
+
+ protected String comment;
+
+ protected Zone zone;
+
+ protected static Binder<EditProgramUIModel, Program> toBeanBinder =
+ BinderFactory.newBinder(EditProgramUIModel.class,
+ Program.class);
+
+ protected static Binder<Program, EditProgramUIModel> fromBeanBinder =
+ BinderFactory.newBinder(Program.class, EditProgramUIModel.class);
+
+
+ public EditProgramUIModel() {
+ super(Program.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ Object oldValue = getName();
+ this.name = name;
+ firePropertyChange(PROPERTY_NAME, oldValue, name);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public Zone getZone() {
+ return zone;
+ }
+
+ public void setZone(Zone zone) {
+ Object oldValue = getZone();
+ this.zone = zone;
+ firePropertyChange(PROPERTY_ZONE, oldValue, zone);
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="name">
-
- <field-validator type="requiredstring" short-circuit="true">
- <message>tutti.validator.error.program.name.required</message>
- </field-validator>
-
- </field>
-
- <field name="zone">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.program.zone.required</message>
- </field-validator>
-
- </field>
-</validators>
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="name">
- <field-validator type="requiredstring" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.name.required</message>
- </field-validator>
- </field>
-
- <field name="program">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.program.required</message>
- </field-validator>
- </field>
-
- <field name="year">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.year.required</message>
- </field-validator>
- </field>
-
- <field name="poche">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.poche.required</message>
- </field-validator>
- </field>
-
- <field name="beginDate">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.beginDate.required</message>
- </field-validator>
- </field>
-
- <field name="endDate">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.endDate.required</message>
- </field-validator>
- </field>
-
-
- <field name="country">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.scientificCruise.country.required</message>
- </field-validator>
- </field>
-
- <field name="vessel">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ vessel != null && !vessel.empty ]]>
- </param>
- <message>tutti.validator.error.scientificCruise.vessel.required</message>
- </field-validator>
- </field>
-
- <field name="gear">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ gear != null && !gear.empty ]]>
- </param>
- <message>tutti.validator.error.scientificCruise.gear.required</message>
- </field-validator>
- </field>
-
- <field name="headOfMission">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ headOfMission != null && !headOfMission.empty ]]>
- </param>
- <message>tutti.validator.error.scientificCruise.headOfMission.required</message>
- </field-validator>
- </field>
-
- <field name="headOfSortRoom">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ headOfSortRoom != null && !headOfSortRoom.empty ]]>
- </param>
- <message>tutti.validator.error.scientificCruise.headOfSortRoom.required</message>
- </field-validator>
- </field>
-
-</validators>
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="stationNumber">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.stationNumber.required</message>
- </field-validator>
-
- </field>
-
- <field name="date">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.date.required</message>
- </field-validator>
-
- </field>
-</validators>
Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml (from rev 39, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml (rev 0)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="name">
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>tutti.validator.error.cruise.name.required</message>
+ </field-validator>
+ </field>
+
+ <field name="program">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.program.required</message>
+ </field-validator>
+ </field>
+
+ <field name="year">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.year.required</message>
+ </field-validator>
+ </field>
+
+ <field name="poche">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.poche.required</message>
+ </field-validator>
+ </field>
+
+ <field name="beginDate">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.beginDate.required</message>
+ </field-validator>
+ </field>
+
+ <field name="endDate">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.endDate.required</message>
+ </field-validator>
+ </field>
+
+
+ <field name="country">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.country.required</message>
+ </field-validator>
+ </field>
+
+ <field name="vessel">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ vessel != null && !vessel.empty ]]>
+ </param>
+ <message>tutti.validator.error.cruise.vessel.required</message>
+ </field-validator>
+ </field>
+
+ <field name="gear">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gear != null && !gear.empty ]]>
+ </param>
+ <message>tutti.validator.error.cruise.gear.required</message>
+ </field-validator>
+ </field>
+
+ <field name="headOfMission">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ headOfMission != null && !headOfMission.empty ]]>
+ </param>
+ <message>tutti.validator.error.cruise.headOfMission.required</message>
+ </field-validator>
+ </field>
+
+ <field name="headOfSortRoom">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ headOfSortRoom != null && !headOfSortRoom.empty ]]>
+ </param>
+ <message>tutti.validator.error.cruise.headOfSortRoom.required</message>
+ </field-validator>
+ </field>
+
+</validators>
Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml (from rev 39, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml (rev 0)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="stationNumber">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.stationNumber.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="date">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.date.required</message>
+ </field-validator>
+
+ </field>
+</validators>
Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationTabUIModel-error-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml (from rev 39, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml (rev 0)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml 2012-12-11 14:19:11 UTC (rev 40)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="name">
+
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>tutti.validator.error.program.name.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="zone">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.program.zone.required</message>
+ </field-validator>
+
+ </field>
+</validators>
Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-10 13:33:13 UTC (rev 39)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-11 14:19:11 UTC (rev 40)
@@ -36,8 +36,8 @@
tutti.config.category.other.description=Autres options
tutti.config.category.shortcuts=Raccourcis
tutti.config.category.shortcuts.description=Liste des raccourcis clavier
+tutti.config.cruiseId=Identifiant de la dernière campagne utilisée
tutti.config.programId=Identifiant de la dernière série de campagne utilisée
-tutti.config.scientificCruiseId=Identifiant de la dernière campagne utilisée
tutti.config.ui.autoPopupNumberEditor=Toujours afficher le pavé numérique lors de l'édition d'un nombre
tutti.config.ui.config=Chemin du fichier de configuration des interfaces graphiques
tutti.config.ui.showNumberEditorButton=Afficher le pavé numérique de saisie
@@ -46,6 +46,15 @@
tutti.label.captureAccidentel.sampleTotalWeight=Poids total échantillonné
tutti.label.captureAccidentel.totalWeight=Poids total
tutti.label.comment=Commentaire
+tutti.label.cruise=Campagne
+tutti.label.cruise.beginDate=Date de début
+tutti.label.cruise.country=Pays
+tutti.label.cruise.endDate=Date de fin
+tutti.label.cruise.name=Nom
+tutti.label.cruise.poche=Nombre de poches
+tutti.label.cruise.program=Série
+tutti.label.cruise.surveyPart=Série partielle
+tutti.label.cruise.year=Année
tutti.label.fishingOperation.averageBottomSalinity=Salinité de fond moyenne
tutti.label.fishingOperation.averageBottomTemperature=Température de fond moyenne
tutti.label.fishingOperation.beaufortScale=Force du vent
@@ -116,15 +125,6 @@
tutti.label.program=Série de campagne
tutti.label.program.name=Nom
tutti.label.program.zone=Zone
-tutti.label.scientificCruise=Campagne
-tutti.label.scientificCruise.beginDate=Date de début
-tutti.label.scientificCruise.country=Pays
-tutti.label.scientificCruise.endDate=Date de fin
-tutti.label.scientificCruise.name=Nom
-tutti.label.scientificCruise.poche=Nombre de poches
-tutti.label.scientificCruise.program=Série
-tutti.label.scientificCruise.surveyPart=Série partielle
-tutti.label.scientificCruise.year=Année
tutti.label.species.sampleVracWeight=Poids total vrac échant.
tutti.label.species.totalHorsVracWeight=Poids total hors vrac
tutti.label.species.totalVracWeight=Poids total vrac
@@ -188,30 +188,30 @@
tutti.table.species.frequency.header.weight=Poids observé
tutti.timeeditor.H=H
tutti.title.about=À propos de Tutti
+tutti.title.create.cruise=Créer une nouvelle campagne
tutti.title.create.program=Créer une nouvelle série de campagne
-tutti.title.create.scientificCruise=Créer une nouvelle campagne
+tutti.title.edit.cruise=Editer une campagne existante
tutti.title.edit.program=Editer une série de campagne existante
-tutti.title.edit.scientificCruise=Editer une campagne existante
tutti.title.fill.catches=Saisie des captures
tutti.title.frequency=Saisie des mensurations
tutti.title.home=Sélection de la campagne
+tutti.title.noSelectedCruise=Pas de campagne sélectionné
tutti.title.noSelectedProgram=Pas de série de campagne sélectionné
-tutti.title.noSelectedScientificCruise=Pas de campagne sélectionné
+tutti.title.selectedCruise=Campagne %s
tutti.title.selectedProgram=Série de campagne %s
-tutti.title.selectedScientificCruise=Campagne %s
tutti.to.be.done=< A FAIRE >
+tutti.validator.error.cruise.beginDate.required=La date de début est obligatoire
+tutti.validator.error.cruise.country.required=Le pays est obligatoire
+tutti.validator.error.cruise.endDate.required=La date de fin est obligatoire
+tutti.validator.error.cruise.gear.required=Au moins un engin doit être sélectionné
+tutti.validator.error.cruise.headOfMission.required=Au moins un chef de mission doit être sélectionné
+tutti.validator.error.cruise.headOfSortRoom.required=Au moins un responsable de salle de tri doit être sélectionné
+tutti.validator.error.cruise.name.required=Le nom de la campagne est obligatoire
+tutti.validator.error.cruise.poche.required=Le nombre de poche est obligatoire
+tutti.validator.error.cruise.program.required=La série est obligatoire
+tutti.validator.error.cruise.vessel.required=Au moins un bateau doit être sélectionné
+tutti.validator.error.cruise.year.required=L'année est obligatoire
tutti.validator.error.fishingOperation.date.required=La date du fishingOperation est obligatoire
tutti.validator.error.fishingOperation.stationNumber.required=Le numéro de station est obligatoire
tutti.validator.error.program.name.required=Le nom de la série est obligatoire
tutti.validator.error.program.zone.required=La zone de la série est obligatoire
-tutti.validator.error.scientificCruise.beginDate.required=La date de début est obligatoire
-tutti.validator.error.scientificCruise.country.required=Le pays est obligatoire
-tutti.validator.error.scientificCruise.endDate.required=La date de fin est obligatoire
-tutti.validator.error.scientificCruise.gear.required=Au moins un engin doit être sélectionné
-tutti.validator.error.scientificCruise.headOfMission.required=Au moins un chef de mission doit être sélectionné
-tutti.validator.error.scientificCruise.headOfSortRoom.required=Au moins un responsable de salle de tri doit être sélectionné
-tutti.validator.error.scientificCruise.name.required=Le nom de la campagne est obligatoire
-tutti.validator.error.scientificCruise.poche.required=Le nombre de poche est obligatoire
-tutti.validator.error.scientificCruise.program.required=La série est obligatoire
-tutti.validator.error.scientificCruise.vessel.required=Au moins un bateau doit être sélectionné
-tutti.validator.error.scientificCruise.year.required=L'année est obligatoire
1
0
r39 - in trunk: tutti-persistence/src/main/xmi tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor tutti-ui-swing/src/main/resources/i18n tutti-ui-swing/src/main/resources/icons
by tchemit@users.forge.codelutin.com Dec. 10, 2012
by tchemit@users.forge.codelutin.com Dec. 10, 2012
Dec. 10, 2012
Author: tchemit
Date: 2012-12-10 14:33:13 +0100 (Mon, 10 Dec 2012)
New Revision: 39
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/39
Log:
introduce SimpleTimeEditor (will be later in jaxx ?)
use it for fishingOperation
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorModel.java
Modified:
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
trunk/tutti-ui-swing/src/main/resources/icons/action-reset.png
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-10 06:59:02 UTC (rev 38)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
@@ -32,9 +32,9 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor;
import jaxx.runtime.swing.OneClicListSelectionModel;
import jaxx.runtime.swing.editor.NumberEditor;
-import jaxx.runtime.swing.editor.TimeEditor;
import jaxx.runtime.swing.editor.bean.BeanComboBox;
import jaxx.runtime.swing.editor.bean.BeanListHeader;
import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
@@ -142,8 +142,8 @@
initNumberEditor((NumberEditor) component);
} else if (component instanceof JXDatePicker) {
initDatePicker((JXDatePicker) component);
- } else if (component instanceof TimeEditor) {
- initTimeEditor((TimeEditor) component);
+ } else if (component instanceof SimpleTimeEditor) {
+ initTimeEditor((SimpleTimeEditor) component);
}
}
}
@@ -230,10 +230,10 @@
}
}
- protected void initTimeEditor(TimeEditor editor) {
+ protected void initTimeEditor(SimpleTimeEditor editor) {
if (log.isDebugEnabled()) {
log.debug("init time editor " + editor.getName() +
- " for property " + editor.getProperty());
+ " for property " + editor.getModel().getProperty());
}
editor.init();
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css 2012-12-10 06:59:02 UTC (rev 38)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css 2012-12-10 13:33:13 UTC (rev 39)
@@ -49,6 +49,10 @@
showReset: true;
}
+SimpleTimeEditor {
+ bean: {model};
+}
+
#stationNumberLabel {
text: "tutti.label.fishingOperation.stationNumber";
labelFor: {stationNumberField};
@@ -150,7 +154,8 @@
}
#gearShootingStartTimeField {
- text: {getStringValue(model.getGearShootingStartTime())};
+ property: "gearShootingStartDate";
+ date: {model.getGearShootingStartDate()};
}
#gearShootingEndLongitudeField {
@@ -167,7 +172,8 @@
}
#gearShootingEndTimeField {
- text: {getStringValue(model.getGearShootingEndTime())};
+ property: "gearShootingEndDate";
+ date: {model.getGearShootingEndDate()};
}
#fishingOperationValidPanel {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx 2012-12-10 06:59:02 UTC (rev 38)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx 2012-12-10 13:33:13 UTC (rev 39)
@@ -31,9 +31,12 @@
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.persistence.entities.referential.Person
+ fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor
+
jaxx.runtime.swing.editor.bean.BeanComboBox
jaxx.runtime.swing.editor.bean.BeanListHeader
jaxx.runtime.swing.editor.NumberEditor
+ jaxx.runtime.swing.editor.TimeEditor
jaxx.runtime.validator.swing.SwingValidatorUtil
jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
@@ -179,8 +182,8 @@
onActionPerformed='handler.setDate(event, "gearShootingStartDate")'/>
</cell>
<cell>
- <JTextField id='gearShootingStartTimeField'
- onKeyReleased='handler.setGearShootingStartTime(((JTextField)event.getSource()).getText())'/>
+ <SimpleTimeEditor id='gearShootingStartTimeField'
+ constructorParams='this'/>
</cell>
</row>
<row>
@@ -200,8 +203,8 @@
onActionPerformed='handler.setDate(event, "gearShootingEndDate")'/>
</cell>
<cell>
- <JTextField id='gearShootingEndTimeField'
- onKeyReleased='handler.setGearShootingEndTime(((JTextField)event.getSource()).getText())'/>
+ <SimpleTimeEditor id='gearShootingEndTimeField'
+ constructorParams='this'/>
</cell>
</row>
</Table>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java 2012-12-10 06:59:02 UTC (rev 38)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
@@ -224,9 +224,9 @@
getModel().setGearShootingStartLongitude(Float.valueOf(text));
}
- public void setGearShootingStartTime(String text) {
- getModel().setGearShootingStartTime(Integer.valueOf(text));
- }
+// public void setGearShootingStartTime(String text) {
+// getModel().setGearShootingStartTime(Integer.valueOf(text));
+// }
public void setGearShootingEndLatitude(String text) {
getModel().setGearShootingEndLatitude(Float.valueOf(text));
@@ -236,7 +236,7 @@
getModel().setGearShootingEndLongitude(Float.valueOf(text));
}
- public void setGearShootingEndTime(String text) {
- getModel().setGearShootingEndTime(Integer.valueOf(text));
- }
+// public void setGearShootingEndTime(String text) {
+// getModel().setGearShootingEndTime(Integer.valueOf(text));
+// }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java 2012-12-10 06:59:02 UTC (rev 38)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java 2012-12-10 13:33:13 UTC (rev 39)
@@ -65,16 +65,12 @@
public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate";
- public static final String PROPERTY_GEAR_SHOOTING_START_TIME = "gearShootingStartTime";
-
public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth";
public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude";
public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude";
- public static final String PROPERTY_GEAR_SHOOTING_END_TIME = "gearShootingEndTime";
-
public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate";
public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
@@ -326,16 +322,6 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, gearShootingStartDate);
}
- public Integer getGearShootingStartTime() {
- return gearShootingStartTime;
- }
-
- public void setGearShootingStartTime(Integer gearShootingStartTime) {
- Object oldValue = getGearShootingStartTime();
- this.gearShootingStartTime = gearShootingStartTime;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_TIME, oldValue, gearShootingStartTime);
- }
-
public Float getGearShootingStartDepth() {
return gearShootingStartDepth;
}
@@ -376,16 +362,6 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate);
}
- public Integer getGearShootingEndTime() {
- return gearShootingEndTime;
- }
-
- public void setGearShootingEndTime(Integer gearShootingEndTime) {
- Object oldValue = getGearShootingEndTime();
- this.gearShootingEndTime = gearShootingEndTime;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_TIME, oldValue, gearShootingEndTime);
- }
-
public Float getGearShootingEndDepth() {
return gearShootingEndDepth;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java 2012-12-10 06:59:02 UTC (rev 38)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java 2012-12-10 13:33:13 UTC (rev 39)
@@ -30,6 +30,7 @@
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -138,7 +139,15 @@
// use a new empty fishingOperation
FishingOperation newFishingOperation = new FishingOperation();
newFishingOperation.setScientificCruise(getModel().getScientificCruise());
- newFishingOperation.setDate(new Date());
+
+ // by default use the current day with no time information
+ Date currentDate = new Date();
+ currentDate = DateUtils.setHours(currentDate, 0);
+ currentDate = DateUtils.setMinutes(currentDate, 0);
+
+ newFishingOperation.setDate(currentDate);
+ newFishingOperation.setGearShootingStartDate(currentDate);
+ newFishingOperation.setGearShootingEndDate(currentDate);
selectFishingOperation(newFishingOperation);
}
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.css 2012-12-10 13:33:13 UTC (rev 39)
@@ -0,0 +1,45 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+#hour {
+ value:{model.getTimeModel() / 60};
+ enabled:{isEnabled()};
+ model:{new SpinnerNumberModel(0, 0, 23, 1)};
+}
+
+#labelH {
+ text:"tutti.timeeditor.H";
+ horizontalAlignment:center;
+}
+
+#minuteModel {
+ calendarField:{java.util.Calendar.MINUTE};
+ value:{handler.setMinuteModel(model.getDate())};
+}
+
+#minute {
+ enabled:{isEnabled()};
+ model:{minuteModel};
+}
+
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.jaxx 2012-12-10 13:33:13 UTC (rev 39)
@@ -0,0 +1,62 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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 constraints='BorderLayout.NORTH' fill='horizontal' insets='0'>
+ <import>
+ java.io.Serializable
+ java.util.Date
+ java.awt.BorderLayout
+ javax.swing.SpinnerNumberModel
+ javax.swing.DefaultBoundedRangeModel
+ </import>
+
+ <!-- ui handler -->
+ <SimpleTimeEditorModel id='model'/>
+
+ <!-- spinner minute editor -->
+ <SpinnerDateModel id="minuteModel"/>
+
+ <SimpleTimeEditorHandler id='handler' constructorParams='this'/>
+
+ <script><![CDATA[
+public void init() { handler.init(); }
+public void setBean(Serializable bean) { model.setBean(bean); }
+public void setProperty(String property ) { model.setProperty(property); }
+public void setDate(Date date) { model.setDate(date); }
+]]>
+ </script>
+
+ <row>
+ <cell weightx='0.5'>
+ <JSpinner id='hour'
+ onStateChanged='handler.updateTimeModelFromHour((Integer)hour.getValue())'/>
+ </cell>
+ <cell>
+ <JLabel id='labelH'/>
+ </cell>
+ <cell weightx='0.5'>
+ <JSpinner id='minute'
+ onStateChanged='handler.updateTimeModelFromMinute(minuteModel.getDate())'/>
+ </cell>
+ </row>
+</Table>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorHandler.java 2012-12-10 13:33:13 UTC (rev 39)
@@ -0,0 +1,271 @@
+package fr.ifremer.tutti.ui.swing.util.editor;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JSpinner;
+import javax.swing.SpinnerDateModel;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since TODO
+ */
+public class SimpleTimeEditorHandler {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SimpleTimeEditorHandler.class);
+
+ private final SimpleTimeEditor editor;
+
+ private final SimpleTimeEditorModel model;
+
+ /** the mutator method on the property of boxed bean in the editor */
+ protected Method mutator;
+
+ protected final Calendar calendarDate;
+
+ protected final Calendar calendarMinute;
+
+ protected final Calendar calendarHour;
+
+ public SimpleTimeEditorHandler(SimpleTimeEditor editor) {
+ this.editor = editor;
+ this.model = editor.getModel();
+ this.calendarMinute = Calendar.getInstance();
+ this.calendarHour = Calendar.getInstance();
+ this.calendarDate = Calendar.getInstance();
+ }
+
+ public void init() {
+
+ if (model.getBean() == null) {
+ throw new NullPointerException("can not have a null bean in ui " + editor);
+ }
+
+ editor.getMinute().setEditor(new JSpinner.DateEditor(editor.getMinute(), "mm"));
+// editor.getHour().setEditor(new JSpinner.DateEditor(editor.getHour(), "HH"));
+
+
+// TuttiUIUtil.autoSelectOnFocus(minuteEditor.getTextField());
+// JSpinner.NumberEditor hourEditor = (JSpinner.NumberEditor) editor.getHour().getEditor();
+// TuttiUIUtil.autoSelectOnFocus(hourEditor.getTextField());
+
+ // listen when date changes (should come from outside)
+ model.addPropertyChangeListener(SimpleTimeEditorModel.PROPERTY_DATE, new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Date date = (Date) evt.getNewValue();
+
+ if (date != null) {
+ calendarDate.setTime(date);
+ int hours = calendarDate.get(Calendar.HOUR_OF_DAY);
+ int minutes = calendarDate.get(Calendar.MINUTE);
+ if (log.isDebugEnabled()) {
+ log.debug("date changed : new value " + hours + ":" + minutes);
+ }
+ model.setTimeModel(hours * 60 + minutes);
+ }
+
+ }
+ });
+
+ // When time model change, let's push it back in bean
+ model.addPropertyChangeListener(SimpleTimeEditorModel.PROPERTY_TIME_MODEL, new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Integer time = (Integer) evt.getNewValue();
+
+ int hours = time / 60;
+ int minutes = time % 60;
+
+ calendarDate.set(Calendar.HOUR_OF_DAY, hours);
+ calendarDate.set(Calendar.MINUTE, minutes);
+
+ // push it back into the bean
+
+ Date newValue = calendarDate.getTime();
+
+ if (log.isDebugEnabled()) {
+ log.debug(model.getProperty() + " on " + model.getBean().getClass() + " :: " + newValue);
+ }
+
+ try {
+ getMutator().invoke(model.getBean(), newValue);
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ }
+
+ public SimpleTimeEditor getEditor() {
+ return editor;
+ }
+
+ protected Date setMinuteModel(Date incomingDate) {
+ if (incomingDate == null) {
+ incomingDate = new Date();
+ calendarMinute.setTime(incomingDate);
+ calendarMinute.set(Calendar.HOUR_OF_DAY, 0);
+ calendarMinute.set(Calendar.MINUTE, 0);
+ } else {
+ calendarMinute.setTime(incomingDate);
+ calendarMinute.set(Calendar.HOUR_OF_DAY, 0);
+ }
+ incomingDate = calendarMinute.getTime();
+ return incomingDate;
+ }
+
+ public void updateTimeModelFromHour(Integer hour) {
+ model.setTimeModel(hour * 60 + model.getMinute());
+ }
+
+ public void updateTimeModelFromMinute(Date minuteDate) {
+
+ calendarMinute.setTime(minuteDate);
+ int newHour = calendarMinute.get(Calendar.HOUR_OF_DAY);
+ int newMinute = calendarMinute.get(Calendar.MINUTE);
+
+ int oldHour = model.getHour();
+ int oldMinute = model.getMinute();
+
+ if (oldHour == newHour && oldMinute == newMinute) {
+
+ // do nothing, same data
+ if (log.isDebugEnabled()) {
+ log.debug("Do not update time model , stay on same time = " + oldHour + ":" + oldMinute);
+ }
+ return;
+ }
+
+ // by default stay on same hour
+ int hour = oldHour;
+
+ // by default, use the new minute data
+ int minute = newMinute;
+
+ if (log.isDebugEnabled()) {
+ log.debug("hh:mm (old from dateModel) = " + oldHour + ":" + oldMinute);
+ log.debug("hh:mm (new from minuteModel) = " + newHour + ":" + newMinute);
+ }
+
+ SpinnerDateModel minuteModel = editor.getMinuteModel();
+
+ if (newMinute == 0) {
+
+ // minute pass to zero (check if a new hour is required)
+ if (newHour == 1) {
+
+ if (oldHour == 23) {
+
+ // can't pass from 23:59 to 0:00, stay on 23:59
+ if (log.isDebugEnabled()) {
+ log.debug("Do not update time model , stay on hh:mm = " + oldHour + ":" + oldMinute);
+ }
+ minuteModel.setValue(minuteModel.getPreviousValue());
+ return;
+ }
+ hour = (oldHour + 1) % 24;
+ }
+ } else if (newMinute == 59) {
+
+ // minute pass to 59 (check if a new hour is required)
+
+ if (newHour == 23) {
+
+ if (oldHour == 0) {
+
+ // can't pass from 0:00 to 23:59, stay on 0:00
+ if (log.isDebugEnabled()) {
+ log.debug("Do not update time model , stay on hh:mm = " + oldHour + ":" + oldMinute);
+ }
+ minuteModel.setValue(minuteModel.getNextValue());
+ return;
+ }
+
+ // decrease hour
+ hour = (oldHour - 1) % 24;
+ }
+ }
+
+ // date has changed
+ if (log.isDebugEnabled()) {
+ log.debug("Update time model to hh:mm = " + hour + ":" + minute);
+ }
+ model.setTimeModel(hour * 60 + minute);
+ }
+
+ protected void setDate(Date oldValue, Date newValue) {
+ if (model.getBean() != null) {
+
+ if (log.isDebugEnabled()) {
+ log.debug(model.getProperty() + " on " + model.getBean().getClass() + " :: " + oldValue + " to " + newValue);
+ }
+
+ try {
+ getMutator().invoke(model.getBean(), newValue);
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ protected Method getMutator() {
+ if (mutator == null) {
+ Object bean = model.getBean();
+ if (bean == null) {
+ throw new NullPointerException("could not find bean in " + editor);
+ }
+ String property = model.getProperty();
+ if (property == null) {
+ throw new NullPointerException("could not find property in " + editor);
+ }
+
+ try {
+ PropertyDescriptor descriptor = PropertyUtils.getPropertyDescriptor(bean, property);
+ mutator = descriptor.getWriteMethod();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return mutator;
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorModel.java 2012-12-10 13:33:13 UTC (rev 39)
@@ -0,0 +1,111 @@
+package fr.ifremer.tutti.ui.swing.util.editor;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 org.jdesktop.beans.AbstractSerializableBean;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SimpleTimeEditorModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_DATE = "date";
+
+ public static final String PROPERTY_TIME_MODEL = "timeModel";
+
+ public static final String PROPERTY_PROPERTY = "property";
+
+ public static final String PROPERTY_BEAN = "bean";
+
+ /** Bean where to push data. */
+ protected Serializable bean;
+
+ /** Property of the bean to use. */
+ protected String property;
+
+ /** Time model in minutes. */
+ protected Integer timeModel = 0;
+
+ /** Real date which contains the edited time. */
+ protected Date date;
+
+ public Serializable getBean() {
+ return bean;
+ }
+
+ public void setBean(Serializable bean) {
+ Object oldValue = getBean();
+ this.bean = bean;
+ firePropertyChange(PROPERTY_BEAN, oldValue, bean);
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(String property) {
+ Object oldValue = getProperty();
+ this.property = property;
+ firePropertyChange(PROPERTY_PROPERTY, oldValue, property);
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ Object oldValue = getDate();
+ this.date = date;
+ firePropertyChange(PROPERTY_DATE, oldValue, date);
+ }
+
+ public Integer getTimeModel() {
+ return timeModel;
+ }
+
+ public void setTimeModel(Integer timeModel) {
+ if (timeModel == null) {
+ timeModel = 0;
+ }
+ Object oldValue = getTimeModel();
+ this.timeModel = timeModel;
+ firePropertyChange(PROPERTY_TIME_MODEL, oldValue, timeModel);
+ }
+
+ public int getMinute() {
+ return timeModel % 60;
+ }
+
+ public int getHour() {
+ return timeModel / 60;
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-10 06:59:02 UTC (rev 38)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-10 13:33:13 UTC (rev 39)
@@ -186,6 +186,7 @@
tutti.table.species.frequency.header.lengthStep=Classe de taille
tutti.table.species.frequency.header.number=Nombre
tutti.table.species.frequency.header.weight=Poids observé
+tutti.timeeditor.H=H
tutti.title.about=À propos de Tutti
tutti.title.create.program=Créer une nouvelle série de campagne
tutti.title.create.scientificCruise=Créer une nouvelle campagne
Property changes on: trunk/tutti-ui-swing/src/main/resources/icons/action-reset.png
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0
r38 - in trunk: tutti-persistence/src/main/xmi tutti-service/src/main/java/fr/ifremer/tutti/service tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency tutti-ui-swing/src/main/resources/i18n tutti-ui-swing/src/main/resources/icons
by tchemit@users.forge.codelutin.com Dec. 10, 2012
by tchemit@users.forge.codelutin.com Dec. 10, 2012
Dec. 10, 2012
Author: tchemit
Date: 2012-12-10 07:59:02 +0100 (Mon, 10 Dec 2012)
New Revision: 38
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/38
Log:
- fix decoration
- refactor fishingOperation screen (still need to add pmfm table)
Added:
trunk/tutti-ui-swing/src/main/resources/icons/action-reset.png
Modified:
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-10 02:45:40 UTC (rev 37)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-10 06:59:02 UTC (rev 38)
@@ -86,7 +86,7 @@
registerMultiJXPathDecorator(Program.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(ScientificCruise.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(FishingOperation.class, "${stationNumber}$s#${traitNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - ");
+ registerMultiJXPathDecorator(FishingOperation.class, "${stationNumber}$s#${fishingOperationNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - ");
registerMultiJXPathDecorator(Zone.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(Vessel.class, "${name}$s#", "#", " - ");
registerMultiJXPathDecorator(Country.class, "${name}$s", "#", " - ");
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css 2012-12-10 02:45:40 UTC (rev 37)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css 2012-12-10 06:59:02 UTC (rev 38)
@@ -54,10 +54,6 @@
labelFor: {stationNumberField};
}
-#stationNumberTraitNumberLabel {
- text: "tutti.label.fishingOperation.stationNumberTraitNumber";
-}
-
#stationNumberField {
property: "stationNumber";
model: {model.getStationNumber()};
@@ -65,14 +61,14 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#traitNumberLabel {
- text: "tutti.label.fishingOperation.traitNumber";
- labelFor: {traitNumberField};
+#fishingOperationNumberLabel {
+ text: "tutti.label.fishingOperation.fishingOperationNumber";
+ labelFor: {fishingOperationNumberField};
}
-#traitNumberField {
- property: "traitNumber";
- model: {model.getTraitNumber()};
+#fishingOperationNumberField {
+ property: "fishingOperationNumber";
+ model: {model.getFishingOperationNumber()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
}
@@ -97,6 +93,128 @@
selectedItem: {model.getStrata()};
}
+#subStrataLabel {
+ text: "tutti.label.fishingOperation.subStrata";
+ labelFor: {subStrataComboBox};
+}
+
+#subStrataComboBox {
+ property: "subStrata";
+ selectedItem: {model.getSubStrata()};
+}
+
+#localiteLabel {
+ text: "tutti.label.fishingOperation.localite";
+ labelFor: {localiteField};
+}
+
+#localiteField {
+ text: {model.getLocalite()};
+}
+
+#gearLongitudeLabel {
+ text: "tutti.label.fishingOperation.gearLongitude";
+}
+
+#gearLatitudeLabel {
+ text: "tutti.label.fishingOperation.gearLatitude";
+}
+
+#gearDateLabel {
+ text: "tutti.label.fishingOperation.gearDate";
+}
+
+#gearTimeLabel {
+ text: "tutti.label.fishingOperation.gearTime";
+}
+
+#gearShootingStartLabel {
+ text: "tutti.label.fishingOperation.gearShootingStart";
+}
+
+#gearShootingEndLabel {
+ text: "tutti.label.fishingOperation.gearShootingEnd";
+}
+
+#gearShootingStartLongitudeField {
+ text: {getStringValue(model.getGearShootingStartLongitude())};
+}
+
+#gearShootingStartLatitudeField {
+ text: {getStringValue(model.getGearShootingStartLatitude())};
+}
+
+#gearShootingStartDateField {
+ date: {model.getGearShootingStartDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#gearShootingStartTimeField {
+ text: {getStringValue(model.getGearShootingStartTime())};
+}
+
+#gearShootingEndLongitudeField {
+ text: {getStringValue(model.getGearShootingEndLongitude())};
+}
+
+#gearShootingEndLatitudeField {
+ text: {getStringValue(model.getGearShootingEndLatitude())};
+}
+
+#gearShootingEndDateField {
+ date: {model.getGearShootingEndDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#gearShootingEndTimeField {
+ text: {getStringValue(model.getGearShootingEndTime())};
+}
+
+#fishingOperationValidPanel {
+ floatable: false;
+ borderPainted: false;
+ opaque: false;
+}
+
+#resetValidStateButton {
+ actionIcon: "reset";
+ text: "tutti.action.reset.fishingOperationValidState";
+}
+
+#fishingOperationValidRadio {
+ text: "tutti.label.fishingOperation.fishingOperationValid";
+ selected: {model.getFishingOperationValid() == Boolean.TRUE};
+ buttonGroup: "fishingOperationValid";
+}
+
+#fishingOperationInvalidRadio {
+ text: "tutti.label.fishingOperation.fishingOperationInvalid";
+ selected: {model.getFishingOperationValid() == Boolean.FALSE};
+ buttonGroup: "fishingOperationValid";
+}
+#fishingOperationResetRadio {
+ selected: {model.getFishingOperationValid() == null};
+ buttonGroup: "fishingOperationValid";
+}
+
+#fishingOperationRectiligneCheckBox {
+ text: "tutti.label.fishingOperation.fishingOperationRectiligne";
+ selected: {model.isFishingOperationRectiligne()};
+}
+
+#distanceChaluteeLabel {
+ text: "tutti.label.fishingOperation.distanceChalutee";
+ labelFor: {distanceChaluteeField};
+}
+
+#distanceChaluteeField {
+ property: "distanceChalutee";
+ model: {model.getDistanceChalutee()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+ enabled: {!model.isFishingOperationRectiligne()};
+}
+
#beaufortScaleLabel {
text: "tutti.label.fishingOperation.beaufortScale";
labelFor: {beaufortScaleComboBox};
@@ -195,27 +313,6 @@
selected: {model.isSystemeFermetureCul()};
}
-#traitRectiligneCheckBox {
- text: "tutti.label.fishingOperation.traitRectiligne";
- selected: {model.isTraitRectiligne()};
-}
-
-#distanceChaluteeLabel {
- text: "tutti.label.fishingOperation.distanceChalutee";
- labelFor: {distanceChaluteeField};
-}
-
-#distanceChaluteeDureeLabel {
- text: "tutti.label.fishingOperation.distanceChaluteeDuree";
-}
-
-#distanceChaluteeField {
- property: "distanceChalutee";
- model: {model.getDistanceChalutee()};
- useFloat: false;
- numberPattern: {INT_6_DIGITS_PATTERN};
-}
-
#dureeLabel {
text: "tutti.label.fishingOperation.duree";
labelFor: {dureeField};
@@ -228,20 +325,6 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#traitValidCheckBox {
- text: "tutti.label.fishingOperation.traitValid";
- selected: {model.isTraitValid()};
-}
-
-#localiteLabel {
- text: "tutti.label.fishingOperation.localite";
- labelFor: {localiteField};
-}
-
-#localiteField {
- text: {model.getLocalite()};
-}
-
#saisisseurPane {
horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
@@ -262,33 +345,6 @@
text: {model.getComment()};
}
-#gearShootingStartLongitudeLabel {
- text: "tutti.label.fishingOperation.gearShootingStartLongitude";
- labelFor: {gearShootingStartLongitudeField};
-}
-
-#gearShootingStartLongitudeField {
- text: {getStringValue(model.getGearShootingStartLongitude())};
-}
-
-#gearShootingStartLatitudeLabel {
- text: "tutti.label.fishingOperation.gearShootingStartLatitude";
- labelFor: {gearShootingStartLatitudeField};
-}
-
-#gearShootingStartLatitudeField {
- text: {getStringValue(model.getGearShootingStartLatitude())};
-}
-
-#gearShootingStartTimeLabel {
- text: "tutti.label.fishingOperation.gearShootingStartTime";
- labelFor: {gearShootingStartTimeField};
-}
-
-#gearShootingStartTimeField {
- text: {getStringValue(model.getGearShootingStartTime())};
-}
-
#gearShootingStartDepthLabel {
text: "tutti.label.fishingOperation.gearShootingStartDepth";
labelFor: {gearShootingStartDepthField};
@@ -301,33 +357,6 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
-#gearShootingEndLongitudeLabel {
- text: "tutti.label.fishingOperation.gearShootingEndLongitude";
- labelFor: {gearShootingEndLongitudeField};
-}
-
-#gearShootingEndLongitudeField {
- text: {getStringValue(model.getGearShootingEndLongitude())};
-}
-
-#gearShootingEndLatitudeLabel {
- text: "tutti.label.fishingOperation.gearShootingEndLatitude";
- labelFor: {gearShootingEndLatitudeField};
-}
-
-#gearShootingEndLatitudeField {
- text: {getStringValue(model.getGearShootingEndLatitude())};
-}
-
-#gearShootingEndTimeLabel {
- text: "tutti.label.fishingOperation.gearShootingEndTime";
- labelFor: {gearShootingEndTimeField};
-}
-
-#gearShootingEndTimeField {
- text: {getStringValue(model.getGearShootingEndTime())};
-}
-
#gearShootingEndDepthLabel {
text: "tutti.label.fishingOperation.gearShootingEndDepth";
labelFor: {gearShootingEndDepthField};
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx 2012-12-10 06:59:02 UTC (rev 38)
@@ -30,7 +30,6 @@
fr.ifremer.tutti.persistence.entities.referential.Strata
fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.persistence.entities.referential.Person
- fr.ifremer.tutti.ui.swing.TuttiUIContext
jaxx.runtime.swing.editor.bean.BeanComboBox
jaxx.runtime.swing.editor.bean.BeanListHeader
@@ -64,246 +63,225 @@
]]></script>
<FishingOperationTabUIHandler id='handler'
- initializer='getContextValue(FishingOperationTabUIHandler.class)'/>
+ initializer='getContextValue(FishingOperationTabUIHandler.class)'/>
<FishingOperationTabUIModel id='model'
- initializer='getContextValue(FishingOperationTabUIModel.class)'/>
+ initializer='getContextValue(FishingOperationTabUIModel.class)'/>
<SwingValidatorMessageTableModel id='errorTableModel'/>
<BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
<field name='stationNumber' component='stationNumberField'/>
- <field name='traitNumber' component='traitNumberField'/>
- <field name='date' component='dateField'/>
- <field name='comment' component='commentField'/>
- <field name='saisisseur' component='saisisseurPane'/>
+ <field name='fishingOperationNumber'
+ component='fishingOperationNumberField'/>
+ <field name='date' component='dateField'/>
+ <field name='comment' component='commentField'/>
+ <field name='saisisseur' component='saisisseurPane'/>
</BeanValidator>
<JPanel id='traitPane' constraints='BorderLayout.CENTER'
layout='{new BorderLayout()}'>
<JTabbedPane id='traitTabPane' constraints='BorderLayout.CENTER'>
- <tab id='traitGeneralTab' title='tutti.label.tab.fishingOperation.general'>
+ <tab id='traitGeneralTab'
+ title='tutti.label.tab.fishingOperation.general'>
<Table fill='both' id='generalForm'>
- <!-- Numero station -->
+ <!-- Numero station / Numéro trait / Date -->
<row>
<cell anchor='west'>
- <!--JLabel id='stationNumberLabel'/-->
- <JLabel id='stationNumberTraitNumberLabel'/>
+ <JLabel id='stationNumberLabel'/>
</cell>
- <cell weightx='1.0'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <NumberEditor id='stationNumberField' constructorParams='this'/>
- <NumberEditor id='traitNumberField' constructorParams='this'/>
- </JPanel>
+ <cell weightx='0.3'>
+ <NumberEditor id='stationNumberField' constructorParams='this'/>
</cell>
- </row>
-
- <!-- Numero fishingOperation / chalut -->
- <!--row>
<cell>
- <JLabel id='traitNumberLabel'/>
+ <JLabel id='fishingOperationNumberLabel'/>
</cell>
- <cell>
- <NumberEditor id='traitNumberField' constructorParams='this'/>
+ <cell weightx='0.3'>
+ <NumberEditor id='fishingOperationNumberField'
+ constructorParams='this'/>
</cell>
- </row-->
-
- <!-- Date -->
- <row>
<cell>
<JLabel id='dateLabel'/>
</cell>
- <cell>
+ <cell weightx='0.3'>
<JXDatePicker id='dateField'
onActionPerformed='handler.setDate(event, "date")'/>
</cell>
</row>
- <!-- Strate d'association -->
+ <!-- Strate d'association / Sous Strate / Localité -->
<row>
<cell>
<JLabel id='strataLabel'/>
</cell>
- <cell fill='horizontal'>
+ <cell weightx='0.3'>
<BeanComboBox id='strataComboBox' constructorParams='this'
genericType='Strata'/>
</cell>
- </row>
-
- <!-- Beaufort scale -->
- <row>
- <cell anchor='west'>
- <JLabel id='beaufortScaleLabel'/>
+ <cell>
+ <JLabel id='subStrataLabel'/>
</cell>
- <cell fill='horizontal'>
- <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
- genericType='BeaufortScale'/>
+ <cell weightx='0.3'>
+ <BeanComboBox id='subStrataComboBox' constructorParams='this'
+ genericType='Strata'/>
</cell>
- </row>
-
- <!-- Wind direction -->
- <row>
- <cell anchor='west'>
- <JLabel id='windDirectionLabel'/>
+ <cell>
+ <JLabel id='localiteLabel'/>
</cell>
- <cell fill='horizontal'>
- <NumberEditor id='windDirectionField' constructorParams='this'/>
+ <cell weightx='0.3'>
+ <JTextField id='localiteField'
+ onKeyReleased='handler.setText(event, "localite")'/>
</cell>
</row>
- <!-- Sea state-->
+ <!-- début de traine long-lat-date-heure
+ fin de traine long-lat-date-heure -->
<row>
- <cell anchor='west'>
- <JLabel id='seaStateLabel'/>
- </cell>
- <cell fill='horizontal'>
- <BeanComboBox id='seaStateComboBox' constructorParams='this'
- genericType='SeaState'/>
- </cell>
- </row>
+ <cell columns='6'>
+ <JPanel layout="{new BorderLayout()}">
+ <Table id="gearCaracteristicsTable" fill="both" weightx='1'
+ constraints='BorderLayout.CENTER'>
+ <row>
+ <cell>
+ <JLabel/>
+ </cell>
+ <cell>
+ <JLabel id='gearLongitudeLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearLatitudeLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearDateLabel'/>
+ </cell>
+ <cell>
+ <JLabel id='gearTimeLabel'/>
+ </cell>
+ </row>
- <!-- Ouverture horizontale -->
- <row>
- <cell anchor='west'>
- <JLabel id='ouvertureHorizontaleVerticaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <NumberEditor id='ouvertureHorizontaleField'
- constructorParams='this'/>
- <NumberEditor id='ouvertureVerticaleField'
- constructorParams='this'/>
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingStartLongitudeField'
+ onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingStartLatitudeLabel'
+ onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JXDatePicker id='gearShootingStartDateField'
+ onActionPerformed='handler.setDate(event, "gearShootingStartDate")'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingStartTimeField'
+ onKeyReleased='handler.setGearShootingStartTime(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingEndLongitudeField'
+ onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingEndLatitudeLabel'
+ onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ <cell>
+ <JXDatePicker id='gearShootingEndDateField'
+ onActionPerformed='handler.setDate(event, "gearShootingEndDate")'/>
+ </cell>
+ <cell>
+ <JTextField id='gearShootingEndTimeField'
+ onKeyReleased='handler.setGearShootingEndTime(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+ </Table>
</JPanel>
</cell>
</row>
- <!-- Ouverture verticale -->
- <!--row>
- <cell anchor='west'>
- <JLabel id='ouvertureVerticaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='ouvertureVerticaleField'
- constructorParams='this'/>
- </cell>
- </row-->
-
- <!-- Longueur funes -->
+ <!-- Fishing operation valid / invalid-->
<row>
- <cell anchor='west'>
- <JLabel id='longueurFunesBrasLabel'/>
+ <cell columns="2">
+ <JToolBar id='fishingOperationValidPanel'
+ layout='{new BorderLayout()}'>
+ <JButton id='resetValidStateButton'
+ constraints='BorderLayout.WEST'
+ onActionPerformed="model.setFishingOperationValid(null)"/>
+ <JRadioButton id='fishingOperationResetRadio'
+ constraints='BorderLayout.EAST'/>
+ </JToolBar>
</cell>
- <cell fill='horizontal'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <NumberEditor id='longueurFunesField' constructorParams='this'/>
- <NumberEditor id='longueurBrasField' constructorParams='this'/>
- </JPanel>
+ <cell columns="2">
+ <JRadioButton id='fishingOperationValidRadio'
+ onActionPerformed='model.setFishingOperationValid(Boolean.TRUE)'/>
</cell>
+ <cell columns="2">
+ <JRadioButton id='fishingOperationInvalidRadio'
+ onActionPerformed='model.setFishingOperationValid(Boolean.FALSE)'/>
+ </cell>
</row>
- <!-- Longueur bras -->
- <!--row>
- <cell anchor='west'>
- <JLabel id='longueurBrasLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='longueurBrasField' constructorParams='this'/>
- </cell>
- </row-->
-
- <!-- Distance chalutée -->
+ <!-- FishingOperation rectiligne / distance chalutee / durée -->
<row>
- <cell anchor='west'>
- <JLabel id='distanceChaluteeDureeLabel'/>
+ <cell>
+ <JCheckBox id='fishingOperationRectiligneCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "fishingOperationRectiligne")'/>
</cell>
- <cell fill='horizontal'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <NumberEditor id='distanceChaluteeField' constructorParams='this'/>
- <NumberEditor id='dureeField' constructorParams='this'/>
+ <cell columns="3">
+ <JPanel layout="{new BorderLayout()}">
+ <JLabel id='distanceChaluteeLabel'
+ constraints='BorderLayout.WEST'/>
+ <NumberEditor id='distanceChaluteeField'
+ constraints='BorderLayout.CENTER'
+ constructorParams='this'/>
</JPanel>
</cell>
- </row>
-
- <!-- Durée -->
- <!--row>
<cell anchor='west'>
<JLabel id='dureeLabel'/>
</cell>
<cell fill='horizontal'>
<NumberEditor id='dureeField' constructorParams='this'/>
</cell>
- </row-->
-
- <!-- Localité -->
- <row>
- <cell>
- <JLabel id='localiteLabel'/>
- </cell>
- <cell>
- <JTextField id='localiteField'
- onKeyReleased='handler.setText(event, "localite")'/>
- </cell>
</row>
- <!-- FishingOperation valide / Rectiligne -->
+ <!-- Actions d'import -->
<row>
- <cell columns='2'>
+ <cell columns='6'>
<JPanel layout='{new GridLayout(1,0)}'>
- <JCheckBox id='traitValidCheckBox'
- onItemStateChanged='handler.setBoolean(event, "traitValid")'/>
- <JCheckBox id='traitRectiligneCheckBox'
- onItemStateChanged='handler.setBoolean(event, "traitRectiligne")'/>
+ <JButton id='importPupitriButton'
+ onActionPerformed='handler.importPupitri()'/>
+ <JButton id='importCasinoButton'
+ onActionPerformed='handler.importCasino()'/>
</JPanel>
</cell>
</row>
- <!-- Système de fermeture du cul / Geometrie mesuree -->
- <row>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JCheckBox id='systemeFermetureCulCheckBox'
- onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/>
- <JCheckBox id='geometrieMesureeCheckBox'
- onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
- </JPanel>
- </cell>
- </row>
-
- <!-- FishingOperation rectiligne -->
- <!--row>
- <cell columns='2'>
- <JCheckBox id='traitRectiligneCheckBox'
- onItemStateChanged='handler.setBoolean(event, "traitRectiligne")'/>
- </cell>
- </row-->
-
- <!-- Geometrie mesuree -->
- <!--row>
- <cell columns='2'>
- <JCheckBox id='geometrieMesureeCheckBox'
- onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
- </cell>
- </row-->
-
<!-- Saisisseur -->
<row weighty='0.3'>
- <cell columns='2'>
+ <cell columns='6'>
<JScrollPane id='saisisseurPane'
columnHeaderView="{saisisseurHeader}"
onFocusGained='saisisseurList.requestFocus()'>
- <JList id='saisisseurList'
- onValueChanged='handler.selectListData(event, "saisisseur")'/>
- <BeanListHeader id='saisisseurHeader' genericType='Person'/>
- </JScrollPane>
+ <JList id='saisisseurList'
+ onValueChanged='handler.selectListData(event, "saisisseur")'/>
+ <BeanListHeader id='saisisseurHeader' genericType='Person'/>
+ </JScrollPane>
</cell>
</row>
<!-- Commentaire -->
<row weighty='0.3'>
- <cell columns='2'>
+ <cell columns='6'>
<JScrollPane id='commentPane'
onFocusGained='commentField.requestFocus()'>
<JTextArea id='commentField'
@@ -311,114 +289,133 @@
</JScrollPane>
</cell>
</row>
- <row>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='importPupitriButton'
- onActionPerformed='handler.importPupitri()'/>
- <JButton id='importCasinoButton'
- onActionPerformed='handler.importCasino()'/>
- </JPanel>
- </cell>
- </row>
</Table>
</tab>
- <tab id='traitGearShootingTab' title='tutti.label.tab.fishingOperation.gearShooting'>
+ <tab id='traitGearShootingTab'
+ title='tutti.label.tab.fishingOperation.gearShooting'>
<Table fill='both' id='gearShootingForm'>
- <!-- GearShootingStart Longitude -->
+ <!-- GearShootingStart Depth -->
<row>
<cell>
- <JLabel id='gearShootingStartLongitudeLabel'/>
+ <JLabel id='gearShootingStartDepthLabel'/>
</cell>
<cell weightx='1.0'>
- <JTextField id='gearShootingStartLongitudeField'
- onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/>
+ <NumberEditor id='gearShootingStartDepthField'
+ constructorParams='this'/>
</cell>
</row>
- <!-- GearShootingStart Latitude -->
+ <!-- GearShootingEnd Depth -->
<row>
<cell>
- <JLabel id='gearShootingStartLatitudeLabel'/>
+ <JLabel id='gearShootingEndDepthLabel'/>
</cell>
<cell weightx='1.0'>
- <JTextField id='gearShootingStartLatitudeField'
- onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/>
+ <NumberEditor id='gearShootingEndDepthField'
+ constructorParams='this'/>
</cell>
</row>
- <!-- GearShootingStart Time -->
+ <!-- Ouverture horizontale -->
<row>
- <cell>
- <JLabel id='gearShootingStartTimeLabel'/>
+ <cell anchor='west'>
+ <JLabel id='ouvertureHorizontaleLabel'/>
</cell>
- <cell weightx='1.0'>
- <JTextField id='gearShootingStartTimeField'
- onKeyReleased='handler.setGearShootingStartTime(((JTextField)event.getSource()).getText())'/>
+ <cell fill='horizontal'>
+ <NumberEditor id='ouvertureHorizontaleField'
+ constructorParams='this'/>
</cell>
</row>
- <!-- GearShootingStart Depth -->
+ <!-- Ouverture verticale -->
<row>
- <cell>
- <JLabel id='gearShootingStartDepthLabel'/>
+ <cell anchor='west'>
+ <JLabel id='ouvertureVerticaleLabel'/>
</cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartDepthField'
+ <cell fill='horizontal'>
+ <NumberEditor id='ouvertureVerticaleField'
constructorParams='this'/>
</cell>
</row>
- <!-- GearShootingEnd Longitude -->
+ <!-- Longueur funes -->
<row>
- <cell>
- <JLabel id='gearShootingEndLongitudeLabel'/>
+ <cell anchor='west'>
+ <JLabel id='longueurFunesLabel'/>
</cell>
- <cell weightx='1.0'>
- <JTextField id='gearShootingEndLongitudeField'
- onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/>
+ <cell fill='horizontal'>
+ <NumberEditor id='longueurFunesField' constructorParams='this'/>
</cell>
</row>
- <!-- GearShootingEnd Latitude -->
+ <!-- Longueur bras -->
<row>
- <cell>
- <JLabel id='gearShootingEndLatitudeLabel'/>
+ <cell anchor='west'>
+ <JLabel id='longueurBrasLabel'/>
</cell>
- <cell weightx='1.0'>
- <JTextField id='gearShootingEndLatitudeField'
- onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/>
+ <cell fill='horizontal'>
+ <NumberEditor id='longueurBrasField' constructorParams='this'/>
</cell>
</row>
- <!-- GearShootingEnd Time -->
+ <!-- Système de fermeture du cul / Geometrie mesuree -->
<row>
- <cell>
- <JLabel id='gearShootingEndTimeLabel'/>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JCheckBox id='systemeFermetureCulCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/>
+ <JCheckBox id='geometrieMesureeCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
+ </JPanel>
</cell>
+ </row>
+ </Table>
+ </tab>
+
+ <tab id='environmentTab'
+ title='tutti.label.tab.fishingOperation.environment'>
+
+ <Table fill='both' id='environmentForm'>
+
+ <!-- Beaufort scale -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='beaufortScaleLabel'/>
+ </cell>
<cell weightx='1.0'>
- <JTextField id='gearShootingEndTimeField'
- onKeyReleased='handler.setGearShootingEndTime(((JTextField)event.getSource()).getText())'/>
+ <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
+ genericType='BeaufortScale'/>
</cell>
</row>
- <!-- GearShootingEnd Depth -->
+ <!-- Wind direction -->
<row>
- <cell>
- <JLabel id='gearShootingEndDepthLabel'/>
+ <cell anchor='west'>
+ <JLabel id='windDirectionLabel'/>
</cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndDepthField'
- constructorParams='this'/>
+ <cell fill='horizontal'>
+ <NumberEditor id='windDirectionField' constructorParams='this'/>
</cell>
</row>
+
+ <!-- Sea state-->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='seaStateLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <BeanComboBox id='seaStateComboBox' constructorParams='this'
+ genericType='SeaState'/>
+ </cell>
+ </row>
</Table>
</tab>
- <tab id='traitHydrologyTabContent' title='tutti.label.tab.fishingOperation.hydrology'>
+ <tab id='traitHydrologyTabContent'
+ title='tutti.label.tab.fishingOperation.hydrology'>
<Table fill='both' id='hydrologyForm'>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java 2012-12-10 06:59:02 UTC (rev 38)
@@ -38,7 +38,6 @@
import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.sql.Date;
import java.util.List;
/**
@@ -96,6 +95,9 @@
@Override
public void afterInitUI() {
+ ui.getFishingOperationValidPanel().remove(
+ ui.getFishingOperationResetRadio());
+
FishingOperationTabUIModel model = ui.getModel();
initUI(ui);
@@ -134,7 +136,7 @@
boolean empty = bean == null;
- FishingOperationTabUIModel model = ui.getModel();
+ FishingOperationTabUIModel model = getModel();
// clean previous selection
ui.getSaisisseurHeader().getList().clearSelection();
@@ -165,7 +167,7 @@
public void cancel() {
- String id = ui.getModel().getId();
+ String id = getModel().getId();
if (log.isInfoEnabled()) {
log.info("Cancel edition for fishingOperation: " + id);
@@ -215,26 +217,26 @@
}
public void setGearShootingStartLatitude(String text) {
- ui.getModel().setGearShootingStartLatitude(Float.valueOf(text));
+ getModel().setGearShootingStartLatitude(Float.valueOf(text));
}
public void setGearShootingStartLongitude(String text) {
- ui.getModel().setGearShootingStartLongitude(Float.valueOf(text));
+ getModel().setGearShootingStartLongitude(Float.valueOf(text));
}
public void setGearShootingStartTime(String text) {
- ui.getModel().setGearShootingStartTime(Date.valueOf(text));
+ getModel().setGearShootingStartTime(Integer.valueOf(text));
}
public void setGearShootingEndLatitude(String text) {
- ui.getModel().setGearShootingEndLatitude(Float.valueOf(text));
+ getModel().setGearShootingEndLatitude(Float.valueOf(text));
}
public void setGearShootingEndLongitude(String text) {
- ui.getModel().setGearShootingEndLongitude(Float.valueOf(text));
+ getModel().setGearShootingEndLongitude(Float.valueOf(text));
}
public void setGearShootingEndTime(String text) {
- ui.getModel().setGearShootingEndTime(Date.valueOf(text));
+ getModel().setGearShootingEndTime(Integer.valueOf(text));
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java 2012-12-10 06:59:02 UTC (rev 38)
@@ -51,16 +51,20 @@
public static final String PROPERTY_STATION_NUMBER = "stationNumber";
- public static final String PROPERTY_TRAIT_NUMBER = "traitNumber";
+ public static final String PROPERTY_FISHING_OPERATION_NUMBER = "fishingOperationNumber";
public static final String PROPERTY_DATE = "date";
public static final String PROPERTY_STRATA = "strata";
+ public static final String PROPERTY_SUB_STRATA = "subStrata";
+
public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude";
public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude";
+ public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate";
+
public static final String PROPERTY_GEAR_SHOOTING_START_TIME = "gearShootingStartTime";
public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth";
@@ -71,6 +75,8 @@
public static final String PROPERTY_GEAR_SHOOTING_END_TIME = "gearShootingEndTime";
+ public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate";
+
public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
@@ -91,13 +97,13 @@
public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
- public static final String PROPERTY_TRAIT_RECTILIGNE = "traitRectiligne";
+ public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne";
public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee";
public static final String PROPERTY_DUREE = "duree";
- public static final String PROPERTY_TRAIT_VALID = "traitValid";
+ public static final String PROPERTY_FISHING_OPERATION_VALID = "fishingOperationValid";
public static final String PROPERTY_LOCALITE = "localite";
@@ -131,26 +137,32 @@
protected Integer stationNumber;
- protected Integer traitNumber;
+ protected Integer fishingOperationNumber;
protected Date date;
protected Strata strata;
+ protected Strata subStrata;
+
protected Float gearShootingStartLatitude;
protected Float gearShootingStartLongitude;
- protected Date gearShootingStartTime;
+ protected Date gearShootingStartDate;
+ protected Integer gearShootingStartTime;
+
protected Float gearShootingStartDepth;
protected Float gearShootingEndLatitude;
protected Float gearShootingEndLongitude;
- protected Date gearShootingEndTime;
+ protected Date gearShootingEndDate;
+ protected Integer gearShootingEndTime;
+
protected Float gearShootingEndDepth;
protected BeaufortScale beaufortScale;
@@ -171,13 +183,13 @@
protected boolean systemeFermetureCul;
- protected boolean traitRectiligne;
+ protected boolean fishingOperationRectiligne;
protected Float distanceChalutee;
protected Float duree;
- protected boolean traitValid;
+ protected Boolean fishingOperationValid;
protected String localite;
@@ -244,14 +256,14 @@
firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
}
- public Integer getTraitNumber() {
- return traitNumber;
+ public Integer getFishingOperationNumber() {
+ return fishingOperationNumber;
}
- public void setTraitNumber(Integer traitNumber) {
- Object oldValue = getTraitNumber();
- this.traitNumber = traitNumber;
- firePropertyChange(PROPERTY_TRAIT_NUMBER, oldValue, traitNumber);
+ public void setFishingOperationNumber(Integer fishingOperationNumber) {
+ Object oldValue = getFishingOperationNumber();
+ this.fishingOperationNumber = fishingOperationNumber;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber);
}
public Date getDate() {
@@ -274,6 +286,16 @@
firePropertyChange(PROPERTY_STRATA, oldValue, strata);
}
+ public Strata getSubStrata() {
+ return subStrata;
+ }
+
+ public void setSubStrata(Strata subStrata) {
+ Object oldValue = getSubStrata();
+ this.subStrata = subStrata;
+ firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata);
+ }
+
public Float getGearShootingStartLatitude() {
return gearShootingStartLatitude;
}
@@ -294,11 +316,21 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude);
}
- public Date getGearShootingStartTime() {
+ public Date getGearShootingStartDate() {
+ return gearShootingStartDate;
+ }
+
+ public void setGearShootingStartDate(Date gearShootingStartDate) {
+ Object oldValue = getGearShootingStartDate();
+ this.gearShootingStartDate = gearShootingStartDate;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, gearShootingStartDate);
+ }
+
+ public Integer getGearShootingStartTime() {
return gearShootingStartTime;
}
- public void setGearShootingStartTime(Date gearShootingStartTime) {
+ public void setGearShootingStartTime(Integer gearShootingStartTime) {
Object oldValue = getGearShootingStartTime();
this.gearShootingStartTime = gearShootingStartTime;
firePropertyChange(PROPERTY_GEAR_SHOOTING_START_TIME, oldValue, gearShootingStartTime);
@@ -334,11 +366,21 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude);
}
- public Date getGearShootingEndTime() {
+ public Date getGearShootingEndDate() {
+ return gearShootingEndDate;
+ }
+
+ public void setGearShootingEndDate(Date gearShootingEndDate) {
+ Object oldValue = getGearShootingEndDate();
+ this.gearShootingEndDate = gearShootingEndDate;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, gearShootingEndDate);
+ }
+
+ public Integer getGearShootingEndTime() {
return gearShootingEndTime;
}
- public void setGearShootingEndTime(Date gearShootingEndTime) {
+ public void setGearShootingEndTime(Integer gearShootingEndTime) {
Object oldValue = getGearShootingEndTime();
this.gearShootingEndTime = gearShootingEndTime;
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_TIME, oldValue, gearShootingEndTime);
@@ -444,14 +486,14 @@
firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul);
}
- public boolean isTraitRectiligne() {
- return traitRectiligne;
+ public boolean isFishingOperationRectiligne() {
+ return fishingOperationRectiligne;
}
- public void setTraitRectiligne(boolean traitRectiligne) {
- Object oldValue = isTraitRectiligne();
- this.traitRectiligne = traitRectiligne;
- firePropertyChange(PROPERTY_TRAIT_RECTILIGNE, oldValue, traitRectiligne);
+ public void setFishingOperationRectiligne(boolean fishingOperationRectiligne) {
+ Object oldValue = isFishingOperationRectiligne();
+ this.fishingOperationRectiligne = fishingOperationRectiligne;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_RECTILIGNE, oldValue, fishingOperationRectiligne);
}
public Float getDistanceChalutee() {
@@ -474,14 +516,14 @@
firePropertyChange(PROPERTY_DUREE, oldValue, duree);
}
- public boolean isTraitValid() {
- return traitValid;
+ public Boolean getFishingOperationValid() {
+ return fishingOperationValid;
}
- public void setTraitValid(boolean traitValid) {
- Object oldValue = isTraitValid();
- this.traitValid = traitValid;
- firePropertyChange(PROPERTY_TRAIT_VALID, oldValue, traitValid);
+ public void setFishingOperationValid(Boolean fishingOperationValid) {
+ Object oldValue = getFishingOperationValid();
+ this.fishingOperationValid = fishingOperationValid;
+ firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid);
}
public String getLocalite() {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-10 02:45:40 UTC (rev 37)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-10 06:59:02 UTC (rev 38)
@@ -25,7 +25,6 @@
NumberEditor {
autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
-
}
#stepLabel {
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-10 02:45:40 UTC (rev 37)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-10 06:59:02 UTC (rev 38)
@@ -22,6 +22,7 @@
tutti.action.reload.actions=Recharger les actions
tutti.action.reload.home=Reload home screen
tutti.action.reload.ui=Recharger l'interface graphique
+tutti.action.reset.fishingOperationValidState=Réinitialiser
tutti.action.save=Enregistrer
tutti.action.selectCampaign=Campagne
tutti.action.selectCampaign.tip=Sélectionner la campagne à utiliser
@@ -49,15 +50,25 @@
tutti.label.fishingOperation.averageBottomTemperature=Température de fond moyenne
tutti.label.fishingOperation.beaufortScale=Force du vent
tutti.label.fishingOperation.date=Date
-tutti.label.fishingOperation.distanceChaluteeDuree=Distance chalutée / Durée
+tutti.label.fishingOperation.distanceChalutee=Distance chalutée
+tutti.label.fishingOperation.duree=Durée
+tutti.label.fishingOperation.fishingOperationInvalid=Trait invalide
+tutti.label.fishingOperation.fishingOperationNumber=Numéro de Trait
+tutti.label.fishingOperation.fishingOperationRectiligne=Trait rectiligne
+tutti.label.fishingOperation.fishingOperationValid=Trait valide
+tutti.label.fishingOperation.gearDate=Date
+tutti.label.fishingOperation.gearLatitude=Latitude
+tutti.label.fishingOperation.gearLongitude=Longitude
+tutti.label.fishingOperation.gearShootingDate=Date
+tutti.label.fishingOperation.gearShootingEnd=Fin de traine
tutti.label.fishingOperation.gearShootingEndBottomSalinity=Salinité de fond fin de traine
tutti.label.fishingOperation.gearShootingEndBottomTemperature=Température de fond fin de traine
tutti.label.fishingOperation.gearShootingEndDepth=Profondeur fin de traine
-tutti.label.fishingOperation.gearShootingEndLatitude=Latitude fin de traine
-tutti.label.fishingOperation.gearShootingEndLongitude=Longitude fin de traine
tutti.label.fishingOperation.gearShootingEndSurfaceSalinity=Salinité de surface fin de traine
tutti.label.fishingOperation.gearShootingEndSurfaceTemperature=Temperature de surface fin de traine
-tutti.label.fishingOperation.gearShootingEndTime=Fin de traine
+tutti.label.fishingOperation.gearShootingLatitude=Latitude
+tutti.label.fishingOperation.gearShootingLongitude=Longitude
+tutti.label.fishingOperation.gearShootingStart=Début de traine
tutti.label.fishingOperation.gearShootingStartBottomSalinity=Salinité de fond début de traine
tutti.label.fishingOperation.gearShootingStartBottomTemperature=Température de fond début de traine
tutti.label.fishingOperation.gearShootingStartDepth=Profondeur début de traine
@@ -66,16 +77,19 @@
tutti.label.fishingOperation.gearShootingStartSurfaceSalinity=Salinité de surface début de traine
tutti.label.fishingOperation.gearShootingStartSurfaceTemperature=Temperature de surface début de traine
tutti.label.fishingOperation.gearShootingStartTime=Début de traine
+tutti.label.fishingOperation.gearShootingTime=Heure
+tutti.label.fishingOperation.gearTime=Heure
tutti.label.fishingOperation.geometrieMesuree=Géométrie mesurée
tutti.label.fishingOperation.localite=Localité
-tutti.label.fishingOperation.longueurFunesBras=Longueur des funes / bras
-tutti.label.fishingOperation.ouvertureHorizontaleVerticale=Ouverture horizontale / verticale
+tutti.label.fishingOperation.longueurBras=Longueur des funes
+tutti.label.fishingOperation.longueurFunes=Longueur des bras
+tutti.label.fishingOperation.ouvertureHorizontale=Ouverture horizontale
+tutti.label.fishingOperation.ouvertureVerticale=Ouverture verticale
tutti.label.fishingOperation.seaState=Etat de la mer
-tutti.label.fishingOperation.stationNumberTraitNumber=Numéro de la station / Trait
-tutti.label.fishingOperation.strata=Strate d'association
+tutti.label.fishingOperation.stationNumber=Numéro de la station
+tutti.label.fishingOperation.strata=Strate
+tutti.label.fishingOperation.subStrata=Sous strate
tutti.label.fishingOperation.systemeFermetureCul=Système de fermeture de cul
-tutti.label.fishingOperation.traitRectiligne=Trait rectiligne
-tutti.label.fishingOperation.traitValid=Trait valide
tutti.label.fishingOperation.windDirection=Direction du vent
tutti.label.frequencyConfiguration.maxStep=Classe max
tutti.label.frequencyConfiguration.minStep=Classe min
@@ -118,7 +132,8 @@
tutti.label.tab.accidentel=Captures accidentelles
tutti.label.tab.benthos=Benthos
tutti.label.tab.fishingOperation=Trait
-tutti.label.tab.fishingOperation.gearShooting=Données de traine
+tutti.label.tab.fishingOperation.environment=Environnement
+tutti.label.tab.fishingOperation.gearShooting=Mise en oeuvre de l'engin
tutti.label.tab.fishingOperation.general=Caractéristiques générales
tutti.label.tab.fishingOperation.hydrology=Paramètres hydrologiques
tutti.label.tab.macroDechet=Macro déchets
Added: trunk/tutti-ui-swing/src/main/resources/icons/action-reset.png
===================================================================
(Binary files differ)
Property changes on: trunk/tutti-ui-swing/src/main/resources/icons/action-reset.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
1
0
Dec. 10, 2012
Author: tchemit
Date: 2012-12-10 03:45:40 +0100 (Mon, 10 Dec 2012)
New Revision: 37
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/37
Log:
- introduce entity model
- rename entities (and part of their ui screen, still need to be finished (package are not correct)
Added:
trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
trunk/tutti-persistence/src/main/xmi/
trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/icons/action-generate.png
Removed:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/
trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/icons/action-generate-lengthSteps.png
Modified:
trunk/pom.xml
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java
trunk/tutti-persistence/pom.xml
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUI.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/pom.xml 2012-12-10 02:45:40 UTC (rev 37)
@@ -85,7 +85,7 @@
<nuitonUtilsVersion>2.6.4</nuitonUtilsVersion>
<nuitonI18nVersion>2.5</nuitonI18nVersion>
- <eugenePluginVersion>2.5.6</eugenePluginVersion>
+ <eugenePluginVersion>2.6-SNAPSHOT</eugenePluginVersion>
<hibernateVersion>3.6.10.Final</hibernateVersion>
<h2Version>1.3.168</h2Version>
<postgresqlVersion>9.1-901-1.jdbc4</postgresqlVersion>
Modified: trunk/tutti-persistence/pom.xml
===================================================================
--- trunk/tutti-persistence/pom.xml 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-persistence/pom.xml 2012-12-10 02:45:40 UTC (rev 37)
@@ -28,5 +28,37 @@
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton.eugene</groupId>
+ <artifactId>eugene-maven-plugin</artifactId>
+ <configuration>
+ <resolver>org.nuiton.util.FasterCachedResourceResolver</resolver>
+ <templates>
+ org.nuiton.eugene.java.JavaInterfaceTransformer,
+ org.nuiton.eugene.java.SimpleJavaBeanTransformer,
+ org.nuiton.eugene.java.JavaEnumerationTransformer
+ </templates>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <configuration>
+ <defaultPackage>fr.ifremer.tutti.persistence.entities</defaultPackage>
+ <fullPackagePath>fr.ifremer.tutti.persistence.entities</fullPackagePath>
+ <inputs>zargo</inputs>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+
</project>
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -26,21 +26,21 @@
import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.Strata;
-import fr.ifremer.tutti.persistence.entities.data.Survey;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.referential.Strata;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.SeaState;
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -92,49 +92,49 @@
List<Gear> getAllGear();
- List<TuttiUser> getAllTuttiUser();
+ List<Person> getAllPerson();
//------------------------------------------------------------------------//
- //-- Survey methods --//
+ //-- Program methods --//
//------------------------------------------------------------------------//
- List<Survey> getAllSurvey();
+ List<Program> getAllProgram();
- Survey getSurvey(String surveyId);
+ Program getProgram(String id);
- Survey createSurvey(Survey bean);
+ Program createProgram(Program bean);
- Survey saveSurvey(Survey bean);
+ Program saveProgram(Program bean);
//------------------------------------------------------------------------//
- //-- Campaign methods --//
+ //-- ScientificCruise methods --//
//------------------------------------------------------------------------//
- List<Campaign> getAllCampaign(String surveyId);
+ List<ScientificCruise> getAllScientificCruise(String programId);
- Campaign getCampaign(String campaignId);
+ ScientificCruise getScientificCruise(String id);
- Campaign createCampaign(Campaign bean);
+ ScientificCruise createScientificCruise(ScientificCruise bean);
- Campaign saveCampaign(Campaign bean);
+ ScientificCruise saveScientificCruise(ScientificCruise bean);
//------------------------------------------------------------------------//
- //-- Trait methods --//
+ //-- FishingOperation methods --//
//------------------------------------------------------------------------//
- List<Trait> getAllTrait(String campaignId);
+ List<FishingOperation> getAllFishingOperation(String scientificCruiseId);
- Trait getTrait(String traitId);
+ FishingOperation getFishingOperation(String id);
- Trait createTrait(Trait bean);
+ FishingOperation createFishingOperation(FishingOperation bean);
- Trait saveTrait(Trait bean);
+ FishingOperation saveFishingOperation(FishingOperation bean);
//------------------------------------------------------------------------//
//-- Species Batch methods --//
//------------------------------------------------------------------------//
- List<SpeciesBatch> getAllSpeciesBatch(String traitId);
+ List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId);
SpeciesBatch getSpeciesBatch(String id);
@@ -152,7 +152,7 @@
//-- Benthos Batch methods --//
//------------------------------------------------------------------------//
- List<BenthosBatch> getAllBenthosBatch(String traitId);
+ List<BenthosBatch> getAllBenthosBatch(String fishingOperationId);
BenthosBatch getBenthosBatch(String id);
@@ -164,7 +164,7 @@
//-- Plancton Batch methods --//
//------------------------------------------------------------------------//
- List<PlanctonBatch> getAllPlanctonBatch(String traitId);
+ List<PlanctonBatch> getAllPlanctonBatch(String fishingOperationId);
PlanctonBatch getPlanctonBatch(String id);
@@ -173,10 +173,10 @@
PlanctonBatch savePlanctonBatch(PlanctonBatch bean);
//------------------------------------------------------------------------//
- //-- Macrodechet Batch methods --//
+ //-- Macrodechet Batch methods --//
//------------------------------------------------------------------------//
- List<MacroDechetBatch> getAllMacroDechetBatch(String traitId);
+ List<MacroDechetBatch> getAllMacroDechetBatch(String fishingOperationId);
MacroDechetBatch getMacroDechetBatch(String id);
@@ -188,7 +188,7 @@
//-- Accidentel Batch methods --//
//------------------------------------------------------------------------//
- List<AccidentelBatch> getAllAccidentelBatch(String traitId);
+ List<AccidentelBatch> getAllAccidentelBatch(String fishingOperationId);
AccidentelBatch getAccidentelBatch(String id);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -24,7 +24,11 @@
* #L%
*/
+import org.nuiton.util.CollectionUtil;
+
import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
/**
* Abstract tutti entity.
@@ -32,7 +36,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public abstract class AbstractTuttiEntity implements Serializable {
+public abstract class AbstractTuttiEntity implements Serializable, IdAware {
private static final long serialVersionUID = 1L;
@@ -47,4 +51,12 @@
public void setId(String id) {
this.id = id;
}
+
+ protected <B> B getChild(Collection<B> child, int index) {
+ return CollectionUtil.getOrNull(child, index);
+ }
+
+ protected <B> B getChild(List<B> child, int index) {
+ return CollectionUtil.getOrNull(child, index);
+ }
}
\ No newline at end of file
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/CommentAware.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,38 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-/**
- * For any bean which can have a comment.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public interface CommentAware {
-
- String getComment();
-
- void setComment(String comment);
-}
Deleted: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/SpeciesAware.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,40 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.referential.Species;
-
-/**
- * For any bean which relies to a {@link Species}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public interface SpeciesAware {
-
- Species getSpecies();
-
- void setSpecies(Species species);
-}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -30,7 +30,7 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import fr.ifremer.tutti.persistence.entities.data.TraitAware;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperationAware;
import java.util.Collection;
import java.util.Collections;
@@ -49,7 +49,7 @@
// helper class does not instanciate
}
- public static <B extends AbstractTuttiEntity> List<String> toIds(List<B> list) {
+ public static <B extends IdAware> List<String> toIds(List<B> list) {
List<String> result = list == null ?
Collections.<String>emptyList() :
Lists.transform(list, new Function<B, String>() {
@@ -61,36 +61,36 @@
return result;
}
- public static <B extends AbstractTuttiEntity> Map<String, B> splitById(Iterable<B> list) {
+ public static <B extends IdAware> Map<String, B> splitById(Iterable<B> list) {
return Maps.uniqueIndex(list, GET_ID);
}
- public static final Function<AbstractTuttiEntity, String> GET_ID = new Function<AbstractTuttiEntity, String>() {
+ public static final Function<IdAware, String> GET_ID = new Function<IdAware, String>() {
@Override
- public String apply(AbstractTuttiEntity input) {
+ public String apply(IdAware input) {
return input.getId();
}
};
- public static <B extends AbstractTuttiEntity> boolean isNew(B bean) {
+ public static <B extends IdAware> boolean isNew(B bean) {
return bean.getId() == null;
}
- public static <B extends AbstractTuttiEntity> Predicate<B> newIdPredicate(String id) {
+ public static <B extends IdAware> Predicate<B> newIdPredicate(String id) {
return new IdPredicate<B>(id);
}
- public static <B extends AbstractTuttiEntity & TraitAware> Predicate<B> newTraitIdPredicate(String id) {
+ public static <B extends FishingOperationAware> Predicate<B> newTraitIdPredicate(String id) {
return new TraitIdPredicate<B>(id);
}
- public static <B extends AbstractTuttiEntity> B findById(Iterable<B> beans,
- String id) {
+ public static <B extends IdAware> B findById(Iterable<B> beans,
+ String id) {
B result = Iterables.tryFind(beans, newIdPredicate(id)).orNull();
return result;
}
- protected static class IdPredicate<B extends AbstractTuttiEntity> implements Predicate<B> {
+ protected static class IdPredicate<B extends IdAware> implements Predicate<B> {
private final String id;
@@ -104,7 +104,7 @@
}
}
- protected static class TraitIdPredicate<B extends AbstractTuttiEntity & TraitAware> implements Predicate<B> {
+ protected static class TraitIdPredicate<B extends FishingOperationAware> implements Predicate<B> {
private final String id;
@@ -114,15 +114,15 @@
@Override
public boolean apply(B input) {
- return id.equals(input.getTrait().getId());
+ return id.equals(input.getFishingOperation().getId());
}
}
- public static <B extends AbstractTuttiEntity> B newEntity(B entity) {
+ public static <B extends IdAware> B newEntity(B entity) {
return newEntity((Class<B>) entity.getClass());
}
- public static <B extends AbstractTuttiEntity> B newEntity(Class<B> type) {
+ public static <B extends IdAware> B newEntity(Class<B> type) {
try {
return type.newInstance();
} catch (Exception e) {
@@ -140,7 +140,7 @@
}
}
- public static <K,V> Function<K,V> newConstantFunction(final V value) {
+ public static <K, V> Function<K, V> newConstantFunction(final V value) {
return new Function<K, V>() {
@Override
public V apply(K input) {
Deleted: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity
===================================================================
--- trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,20 +0,0 @@
-fr.ifremer.tutti.persistence.entities.data.AccidentelBatch
-fr.ifremer.tutti.persistence.entities.data.BenthosBatch
-fr.ifremer.tutti.persistence.entities.data.Campaign
-fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch
-fr.ifremer.tutti.persistence.entities.data.PlanctonBatch
-fr.ifremer.tutti.persistence.entities.data.SpeciesBatch
-fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency
-fr.ifremer.tutti.persistence.entities.data.Strata
-fr.ifremer.tutti.persistence.entities.data.Survey
-fr.ifremer.tutti.persistence.entities.data.Trait
-fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
-fr.ifremer.tutti.persistence.entities.referential.Country
-fr.ifremer.tutti.persistence.entities.referential.Gear
-fr.ifremer.tutti.persistence.entities.referential.SeaState
-fr.ifremer.tutti.persistence.entities.referential.Sex
-fr.ifremer.tutti.persistence.entities.referential.Species
-fr.ifremer.tutti.persistence.entities.referential.TuttiUser
-fr.ifremer.tutti.persistence.entities.referential.Vessel
-fr.ifremer.tutti.persistence.entities.referential.WeightCategory
-fr.ifremer.tutti.persistence.entities.referential.Zone
\ No newline at end of file
Copied: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware (from rev 36, trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity)
===================================================================
--- trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware (rev 0)
+++ trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,20 @@
+fr.ifremer.tutti.persistence.entities.data.AccidentelBatch
+fr.ifremer.tutti.persistence.entities.data.BenthosBatch
+fr.ifremer.tutti.persistence.entities.data.FishingOperation
+fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch
+fr.ifremer.tutti.persistence.entities.data.PlanctonBatch
+fr.ifremer.tutti.persistence.entities.data.Program
+fr.ifremer.tutti.persistence.entities.data.ScientificCruise
+fr.ifremer.tutti.persistence.entities.data.SpeciesBatch
+fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency
+fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
+fr.ifremer.tutti.persistence.entities.referential.Country
+fr.ifremer.tutti.persistence.entities.referential.Gear
+fr.ifremer.tutti.persistence.entities.referential.Person
+fr.ifremer.tutti.persistence.entities.referential.SeaState
+fr.ifremer.tutti.persistence.entities.referential.Sex
+fr.ifremer.tutti.persistence.entities.referential.Species
+fr.ifremer.tutti.persistence.entities.referential.Strata
+fr.ifremer.tutti.persistence.entities.referential.Vessel
+fr.ifremer.tutti.persistence.entities.referential.WeightCategory
+fr.ifremer.tutti.persistence.entities.referential.Zone
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.IdAware
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
===================================================================
--- trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties (rev 0)
+++ trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,35 @@
+###
+# #%L
+# Tutti :: Persistence API
+# $Id$
+# $HeadURL$
+# %%
+# Copyright (C) 2012 Ifremer
+# %%
+# 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%
+###
+
+model.tagvalue.version=0.2
+model.tagvalue.constantPrefix=PROPERTY_
+model.tagvalue.doNotGenerateBooleanGetMethods=true
+model.tagvalue.noPCS=true
+model.tagvalue.beanSuperClass=fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity
+
+fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.gear.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.headOfMission.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.headOfSortRoom.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.ScientificCruise.attribute.vessel.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.FishingOperation.attribute.saisisseur.stereotype=ordered
Property changes on: trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Property changes on: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevFixtures.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -25,15 +25,15 @@
*/
import com.google.common.collect.ArrayListMultimap;
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
-import fr.ifremer.tutti.persistence.entities.data.Strata;
+import fr.ifremer.tutti.persistence.entities.IdAware;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Strata;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.SeaState;
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -49,7 +49,7 @@
*/
public class TuttiPersistenceDevFixtures {
- protected final ArrayListMultimap<Class<? extends AbstractTuttiEntity>, AbstractTuttiEntity> cache;
+ protected final ArrayListMultimap<Class<? extends IdAware>, IdAware> cache;
public TuttiPersistenceDevFixtures() {
@@ -84,11 +84,13 @@
v = new Vessel();
v.setId(UUID.randomUUID().toString());
v.setName("THALASSA");
+ v.setRegistrationCode("RegistrationCode1");
cache.put(Vessel.class, v);
v = new Vessel();
v.setId(UUID.randomUUID().toString());
v.setName("THALASSA-II");
+ v.setRegistrationCode("RegistrationCode2");
cache.put(Vessel.class, v);
Gear g;
@@ -103,37 +105,49 @@
g.setName("Gear-2");
cache.put(Gear.class, g);
- TuttiUser u;
+ Person u;
- u = new TuttiUser();
+ u = new Person();
u.setId(UUID.randomUUID().toString());
u.setName("Vincent Badts");
- cache.put(TuttiUser.class, u);
+ u.setFirstName("Vincent");
+ u.setLastName("Badts");
+ cache.put(Person.class, u);
- u = new TuttiUser();
+ u = new Person();
u.setId(UUID.randomUUID().toString());
u.setName("Jean claude Mahet");
- cache.put(TuttiUser.class, u);
+ u.setFirstName("Jean claude");
+ u.setLastName("Mahet");
+ cache.put(Person.class, u);
- u = new TuttiUser();
+ u = new Person();
u.setId(UUID.randomUUID().toString());
u.setName("Luisa Metral");
- cache.put(TuttiUser.class, u);
+ u.setFirstName("Luisa");
+ u.setLastName("Metral");
+ cache.put(Person.class, u);
- u = new TuttiUser();
+ u = new Person();
u.setId(UUID.randomUUID().toString());
u.setName("Jean Hervé Bourdeix");
- cache.put(TuttiUser.class, u);
+ u.setFirstName("Jean Hervé");
+ u.setLastName("Bourdeix");
+ cache.put(Person.class, u);
- u = new TuttiUser();
+ u = new Person();
u.setId(UUID.randomUUID().toString());
u.setName("Ysabelle Cheret");
- cache.put(TuttiUser.class, u);
+ u.setFirstName("Ysabelle");
+ u.setLastName("Cheret");
+ cache.put(Person.class, u);
- u = new TuttiUser();
+ u = new Person();
u.setId(UUID.randomUUID().toString());
u.setName("Blandine Brisset");
- cache.put(TuttiUser.class, u);
+ u.setFirstName("Blandine");
+ u.setLastName("Brisset");
+ cache.put(Person.class, u);
BeaufortScale bs;
@@ -262,8 +276,8 @@
return getData(Gear.class);
}
- public List<TuttiUser> user() {
- return getData(TuttiUser.class);
+ public List<Person> user() {
+ return getData(Person.class);
}
public List<Strata> strata() {
@@ -290,7 +304,7 @@
return getData(WeightCategory.class);
}
- protected <B extends AbstractTuttiEntity> List<B> getData(Class<B> entityType) {
+ protected <B extends IdAware> List<B> getData(Class<B> entityType) {
List<B> result = (List<B>) cache.get(entityType);
return result;
}
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -33,25 +33,26 @@
import com.google.common.collect.Maps;
import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig;
import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+import fr.ifremer.tutti.persistence.entities.IdAware;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperationAware;
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.Strata;
-import fr.ifremer.tutti.persistence.entities.data.Survey;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
-import fr.ifremer.tutti.persistence.entities.data.TraitAware;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.SeaState;
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
+import fr.ifremer.tutti.persistence.entities.referential.Strata;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -91,12 +92,12 @@
*
* @since 0.1
*/
- public static final List<Class<? extends AbstractTuttiEntity>> TYPES;
+ public static final List<Class<? extends IdAware>> TYPES;
static {
TYPES = Lists.newArrayList();
- for (AbstractTuttiEntity e : ServiceLoader.load(AbstractTuttiEntity.class)) {
+ for (IdAware e : ServiceLoader.load(IdAware.class)) {
TYPES.add(e.getClass());
}
@@ -117,14 +118,14 @@
*
* @since 0.1
*/
- protected final ArrayListMultimap<Class<? extends AbstractTuttiEntity>, AbstractTuttiEntity> cache = ArrayListMultimap.create();
+ protected final ArrayListMultimap<Class<? extends IdAware>, IdAware> cache = ArrayListMultimap.create();
/**
* Cache of binder.
*
* @since 0.2
*/
- protected final Map<Class<? extends AbstractTuttiEntity>, Binder<? extends AbstractTuttiEntity, ? extends AbstractTuttiEntity>> binderCache = Maps.newHashMap();
+ protected final Map<Class<? extends IdAware>, Binder<? extends IdAware, ? extends IdAware>> binderCache = Maps.newHashMap();
//------------------------------------------------------------------------//
//-- Technical methods --//
@@ -150,7 +151,7 @@
TuttiPersistenceDevFixtures fixtures =
new TuttiPersistenceDevFixtures();
- for (Class<? extends AbstractTuttiEntity> entityType : TYPES) {
+ for (Class<? extends IdAware> entityType : TYPES) {
loadEntities(entityType, fixtures);
}
}
@@ -160,7 +161,7 @@
binderCache.clear();
- for (Class<? extends AbstractTuttiEntity> entityType : cache.keySet()) {
+ for (Class<? extends IdAware> entityType : cache.keySet()) {
persistToFile(entityType);
}
}
@@ -213,8 +214,8 @@
}
@Override
- public List<TuttiUser> getAllTuttiUser() {
- List<TuttiUser> result = getDataInNewList(TuttiUser.class);
+ public List<Person> getAllPerson() {
+ List<Person> result = getDataInNewList(Person.class);
return result;
}
@@ -238,96 +239,96 @@
}
//------------------------------------------------------------------------//
- //-- Survey methods --//
+ //-- Program methods --//
//------------------------------------------------------------------------//
@Override
- public List<Survey> getAllSurvey() {
- List<Survey> result = getDataInNewList(Survey.class);
+ public List<Program> getAllProgram() {
+ List<Program> result = getDataInNewList(Program.class);
return result;
}
@Override
- public Survey getSurvey(String surveyId) {
- Survey result = getBean(Survey.class, surveyId);
+ public Program getProgram(String id) {
+ Program result = getBean(Program.class, id);
return result;
}
@Override
- public Survey createSurvey(Survey bean) {
- Survey result = create(Survey.class, bean);
+ public Program createProgram(Program bean) {
+ Program result = create(Program.class, bean);
return result;
}
@Override
- public Survey saveSurvey(Survey bean) {
- Survey result = save(Survey.class, bean);
+ public Program saveProgram(Program bean) {
+ Program result = save(Program.class, bean);
return result;
}
//------------------------------------------------------------------------//
- //-- Campaign methods --//
+ //-- ScientificCruise methods --//
//------------------------------------------------------------------------//
@Override
- public List<Campaign> getAllCampaign(final String surveyId) {
- List<Campaign> result = Lists.newArrayList(Iterables.filter(getData(Campaign.class), new Predicate<Campaign>() {
+ public List<ScientificCruise> getAllScientificCruise(final String programId) {
+ List<ScientificCruise> result = Lists.newArrayList(Iterables.filter(getData(ScientificCruise.class), new Predicate<ScientificCruise>() {
@Override
- public boolean apply(Campaign input) {
- return surveyId.equals(input.getSurvey().getId());
+ public boolean apply(ScientificCruise input) {
+ return programId.equals(input.getProgram().getId());
}
}));
return result;
}
@Override
- public Campaign getCampaign(String campaignId) {
- Campaign result = getBean(Campaign.class, campaignId);
+ public ScientificCruise getScientificCruise(String id) {
+ ScientificCruise result = getBean(ScientificCruise.class, id);
return result;
}
@Override
- public Campaign createCampaign(Campaign bean) {
- Campaign result = create(Campaign.class, bean);
+ public ScientificCruise createScientificCruise(ScientificCruise bean) {
+ ScientificCruise result = create(ScientificCruise.class, bean);
return result;
}
@Override
- public Campaign saveCampaign(Campaign bean) {
- Campaign result = save(Campaign.class, bean);
+ public ScientificCruise saveScientificCruise(ScientificCruise bean) {
+ ScientificCruise result = save(ScientificCruise.class, bean);
return result;
}
//------------------------------------------------------------------------//
- //-- Trait methods --//
+ //-- FishingOperation methods --//
//------------------------------------------------------------------------//
@Override
- public List<Trait> getAllTrait(final String campaignId) {
- List<Trait> result = Lists.newArrayList(Iterables.filter(getData(Trait.class), new Predicate<Trait>() {
+ public List<FishingOperation> getAllFishingOperation(final String scientificCruiseId) {
+ List<FishingOperation> result = Lists.newArrayList(Iterables.filter(getData(FishingOperation.class), new Predicate<FishingOperation>() {
@Override
- public boolean apply(Trait input) {
- return campaignId.equals(input.getCampaign().getId());
+ public boolean apply(FishingOperation input) {
+ return scientificCruiseId.equals(input.getScientificCruise().getId());
}
}));
return result;
}
@Override
- public Trait getTrait(String traitId) {
- Trait result = TuttiEntities.findById(getData(Trait.class), traitId);
+ public FishingOperation getFishingOperation(String id) {
+ FishingOperation result = TuttiEntities.findById(getData(FishingOperation.class), id);
return result;
}
@Override
- public Trait createTrait(Trait bean) {
- Trait result = create(Trait.class, bean);
+ public FishingOperation createFishingOperation(FishingOperation bean) {
+ FishingOperation result = create(FishingOperation.class, bean);
return result;
}
@Override
- public Trait saveTrait(Trait bean) {
- Trait result = save(Trait.class, bean);
+ public FishingOperation saveFishingOperation(FishingOperation bean) {
+ FishingOperation result = save(FishingOperation.class, bean);
return result;
}
@@ -336,9 +337,9 @@
//------------------------------------------------------------------------//
@Override
- public List<SpeciesBatch> getAllSpeciesBatch(final String traitId) {
+ public List<SpeciesBatch> getAllSpeciesBatch(final String fishingOperationId) {
List<SpeciesBatch> result = getAllTraitFilterBatches(
- SpeciesBatch.class, traitId);
+ SpeciesBatch.class, fishingOperationId);
return result;
}
@@ -391,9 +392,9 @@
//------------------------------------------------------------------------//
@Override
- public List<BenthosBatch> getAllBenthosBatch(String traitId) {
+ public List<BenthosBatch> getAllBenthosBatch(String fishingOperationId) {
List<BenthosBatch> result = getAllTraitFilterBatches(
- BenthosBatch.class, traitId);
+ BenthosBatch.class, fishingOperationId);
return result;
}
@@ -420,9 +421,9 @@
//------------------------------------------------------------------------//
@Override
- public List<PlanctonBatch> getAllPlanctonBatch(String traitId) {
+ public List<PlanctonBatch> getAllPlanctonBatch(String fishingOperationId) {
List<PlanctonBatch> result = getAllTraitFilterBatches(
- PlanctonBatch.class, traitId);
+ PlanctonBatch.class, fishingOperationId);
return result;
}
@@ -449,9 +450,9 @@
//------------------------------------------------------------------------//
@Override
- public List<MacroDechetBatch> getAllMacroDechetBatch(String traitId) {
+ public List<MacroDechetBatch> getAllMacroDechetBatch(String fishingOperationId) {
List<MacroDechetBatch> result = getAllTraitFilterBatches(
- MacroDechetBatch.class, traitId);
+ MacroDechetBatch.class, fishingOperationId);
return result;
}
@@ -478,9 +479,9 @@
//------------------------------------------------------------------------//
@Override
- public List<AccidentelBatch> getAllAccidentelBatch(String traitId) {
+ public List<AccidentelBatch> getAllAccidentelBatch(String fishingOperationId) {
List<AccidentelBatch> result = getAllTraitFilterBatches(
- AccidentelBatch.class, traitId);
+ AccidentelBatch.class, fishingOperationId);
return result;
}
@@ -506,7 +507,7 @@
//-- Internal methods --//
//------------------------------------------------------------------------//
- protected <B extends AbstractTuttiEntity> Binder<B, B> getBinder(Class<B> type) {
+ protected <B extends IdAware> Binder<B, B> getBinder(Class<B> type) {
Binder<B, B> result = (Binder<B, B>) binderCache.get(type);
if (result == null) {
result = BinderFactory.newBinder(type);
@@ -515,10 +516,10 @@
return result;
}
- protected <B extends AbstractTuttiEntity> void persist(Class<B> beanType,
- B source,
- B target,
- boolean synchFile) {
+ protected <B extends IdAware> void persist(Class<B> beanType,
+ B source,
+ B target,
+ boolean synchFile) {
getBinder(beanType).copyExcluding(source, target, AbstractTuttiEntity.PROPERTY_ID);
if (source.getId() == null) {
@@ -532,9 +533,9 @@
}
}
- protected <B extends AbstractTuttiEntity> List<B> persistList(Class<B> beanType,
- List<B> existingData,
- List<B> newData) {
+ protected <B extends IdAware> List<B> persistList(Class<B> beanType,
+ List<B> existingData,
+ List<B> newData) {
Map<B, B> toPersist = Maps.newHashMap();
@@ -589,8 +590,8 @@
return result;
}
- protected <B extends AbstractTuttiEntity> List<B> loadEntities(Class<B> entityType,
- TuttiPersistenceDevFixtures fix
+ protected <B extends IdAware> List<B> loadEntities(Class<B> entityType,
+ TuttiPersistenceDevFixtures fix
) throws IOException {
File storageFile = getStorageFile(entityType);
@@ -627,8 +628,8 @@
return result;
}
- protected <B extends AbstractTuttiEntity> List<B> loadEntities(Class<B> entityType,
- List<B> defaultList) throws IOException {
+ protected <B extends IdAware> List<B> loadEntities(Class<B> entityType,
+ List<B> defaultList) throws IOException {
File storageFile = getStorageFile(entityType);
List<B> result;
@@ -668,7 +669,7 @@
return result;
}
- protected <B extends AbstractTuttiEntity> void persistToFile(Class<B> entityType) {
+ protected <B extends IdAware> void persistToFile(Class<B> entityType) {
List<B> entities = getDataInNewList(entityType);
File storageFile = getStorageFile(entityType);
@@ -692,30 +693,30 @@
}
}
- protected <B extends AbstractTuttiEntity> List<B> getData(Class<B> entityType) {
+ protected <B extends IdAware> List<B> getData(Class<B> entityType) {
List<B> result = (List<B>) cache.get(entityType);
return result;
}
- protected <B extends AbstractTuttiEntity> List<B> getDataInNewList(Class<B> entityType) {
+ protected <B extends IdAware> List<B> getDataInNewList(Class<B> entityType) {
List<B> result = getData(entityType);
return Lists.newArrayList(result);
}
- protected <B extends AbstractTuttiEntity & TraitAware> List<B> getAllTraitFilterBatches(Class<B> beanType, String traitId) {
+ protected <B extends FishingOperationAware> List<B> getAllTraitFilterBatches(Class<B> beanType, String traitId) {
Predicate<B> predicate = TuttiEntities.newTraitIdPredicate(traitId);
List<B> result = Lists.newArrayList(Iterables.filter(getData(beanType), predicate));
return result;
}
- protected <B extends AbstractTuttiEntity> B create(Class<B> type, B bean) {
+ protected <B extends IdAware> B create(Class<B> type, B bean) {
Preconditions.checkNotNull(bean, "Can't persist a null bean");
B result = TuttiEntities.newEntity(bean);
persist(type, bean, result, true);
return result;
}
- protected <B extends AbstractTuttiEntity> B save(Class<B> type, B bean) {
+ protected <B extends IdAware> B save(Class<B> type, B bean) {
Preconditions.checkNotNull(bean, "Can't persist a null bean");
String id = bean.getId();
Preconditions.checkNotNull(id, "Can't save a bean with null id");
@@ -724,7 +725,7 @@
return result;
}
- protected <B extends AbstractTuttiEntity> B getBean(Class<B> type, String id) {
+ protected <B extends IdAware> B getBean(Class<B> type, String id) {
B result = TuttiEntities.findById(getData(type), id);
return result;
}
Modified: trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java
===================================================================
--- trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -28,7 +28,7 @@
import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.Survey;
+import fr.ifremer.tutti.persistence.entities.data.Program;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -128,21 +128,21 @@
persistence.open(config.getConfig());
Assert.assertTrue(storageDirectory.exists());
- int size = persistence.getAllSurvey().size();
+ int size = persistence.getAllProgram().size();
- Survey s = new Survey();
+ Program s = new Program();
s.setId("46de4ba5-3be6-4ab6-9f39-586b8e491fda");
s.setName("Serie 3");
s.setZone(persistence.getAllZone().get(0));
- persistence.createSurvey(s);
+ persistence.createProgram(s);
persistence.close();
Assert.assertTrue(storageDirectory.exists());
persistence.open(config.getConfig());
- Assert.assertEquals(size + 1, persistence.getAllSurvey().size());
+ Assert.assertEquals(size + 1, persistence.getAllProgram().size());
}
@Test
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -24,17 +24,17 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.Campaign;
-import fr.ifremer.tutti.persistence.entities.data.Strata;
-import fr.ifremer.tutti.persistence.entities.data.Survey;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Strata;
+import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.SeaState;
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -84,14 +84,14 @@
@Override
protected void loadDecorators() {
- registerMultiJXPathDecorator(Survey.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(Campaign.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(Trait.class, "${stationNumber}$s#${traitNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - ");
+ registerMultiJXPathDecorator(Program.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(ScientificCruise.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(FishingOperation.class, "${stationNumber}$s#${traitNumber}$s#${date}$td/%3$tm/%3$tY", "#", " - ");
registerMultiJXPathDecorator(Zone.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(Vessel.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Vessel.class, "${name}$s#", "#", " - ");
registerMultiJXPathDecorator(Country.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(Gear.class, "${name}$s", "#", " - ");
- registerMultiJXPathDecorator(TuttiUser.class, "${name}$s", "#", " - ");
+ registerMultiJXPathDecorator(Person.class, "${firstName}$s#${lastName}$s", "#", " ");
registerMultiJXPathDecorator(BeaufortScale.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(SeaState.class, "${name}$s", "#", " - ");
registerMultiJXPathDecorator(Strata.class, "${name}$s", "#", " - ");
@@ -107,11 +107,13 @@
static {
n_("tutti.property.name");
+ n_("tutti.property.firstName");
+ n_("tutti.property.lastName");
n_("tutti.property.stationNumber");
n_("tutti.property.date");
- n_("tutti.property.survey");
- n_("tutti.property.campaign");
- n_("tutti.property.trait");
+ n_("tutti.property.program");
+ n_("tutti.property.scientificCruise");
+ n_("tutti.property.fishingOperation");
n_("tutti.property.zone");
n_("tutti.property.vessel");
n_("tutti.property.country");
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -28,21 +28,21 @@
import fr.ifremer.tutti.persistence.TuttiPersistence;
import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.data.Campaign;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.Strata;
-import fr.ifremer.tutti.persistence.entities.data.Survey;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Strata;
import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.SeaState;
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.WeightCategory;
import fr.ifremer.tutti.persistence.entities.referential.Zone;
@@ -175,9 +175,9 @@
}
@Override
- public List<TuttiUser> getAllTuttiUser() {
+ public List<Person> getAllPerson() {
checkDriverExists();
- return driver.getAllTuttiUser();
+ return driver.getAllPerson();
}
@Override
@@ -199,87 +199,87 @@
}
//------------------------------------------------------------------------//
- //-- Survey methods --//
+ //-- Program methods --//
//------------------------------------------------------------------------//
@Override
- public List<Survey> getAllSurvey() {
+ public List<Program> getAllProgram() {
checkDriverExists();
- return driver.getAllSurvey();
+ return driver.getAllProgram();
}
@Override
- public Survey getSurvey(String surveyId) {
+ public Program getProgram(String id) {
checkDriverExists();
- return driver.getSurvey(surveyId);
+ return driver.getProgram(id);
}
@Override
- public Survey createSurvey(Survey bean) {
+ public Program createProgram(Program bean) {
checkDriverExists();
- return driver.createSurvey(bean);
+ return driver.createProgram(bean);
}
@Override
- public Survey saveSurvey(Survey bean) {
+ public Program saveProgram(Program bean) {
checkDriverExists();
- return driver.saveSurvey(bean);
+ return driver.saveProgram(bean);
}
//------------------------------------------------------------------------//
- //-- Campaign methods --//
+ //-- ScientificCruise methods --//
//------------------------------------------------------------------------//
@Override
- public List<Campaign> getAllCampaign(String surveyId) {
+ public List<ScientificCruise> getAllScientificCruise(String programId) {
checkDriverExists();
- return driver.getAllCampaign(surveyId);
+ return driver.getAllScientificCruise(programId);
}
@Override
- public Campaign getCampaign(String campaignId) {
+ public ScientificCruise getScientificCruise(String id) {
checkDriverExists();
- return driver.getCampaign(campaignId);
+ return driver.getScientificCruise(id);
}
@Override
- public Campaign createCampaign(Campaign bean) {
+ public ScientificCruise createScientificCruise(ScientificCruise bean) {
checkDriverExists();
- return driver.createCampaign(bean);
+ return driver.createScientificCruise(bean);
}
@Override
- public Campaign saveCampaign(Campaign bean) {
+ public ScientificCruise saveScientificCruise(ScientificCruise bean) {
checkDriverExists();
- return driver.saveCampaign(bean);
+ return driver.saveScientificCruise(bean);
}
//------------------------------------------------------------------------//
- //-- Trait methods --//
+ //-- FishingOperation methods --//
//------------------------------------------------------------------------//
@Override
- public List<Trait> getAllTrait(String campaignId) {
+ public List<FishingOperation> getAllFishingOperation(String scientificCruiseId) {
checkDriverExists();
- return driver.getAllTrait(campaignId);
+ return driver.getAllFishingOperation(scientificCruiseId);
}
@Override
- public Trait getTrait(String traitId) {
+ public FishingOperation getFishingOperation(String id) {
checkDriverExists();
- return driver.getTrait(traitId);
+ return driver.getFishingOperation(id);
}
@Override
- public Trait createTrait(Trait bean) {
+ public FishingOperation createFishingOperation(FishingOperation bean) {
checkDriverExists();
- return driver.createTrait(bean);
+ return driver.createFishingOperation(bean);
}
@Override
- public Trait saveTrait(Trait bean) {
+ public FishingOperation saveFishingOperation(FishingOperation bean) {
checkDriverExists();
- return driver.saveTrait(bean);
+ return driver.saveFishingOperation(bean);
}
//------------------------------------------------------------------------//
@@ -287,9 +287,9 @@
//------------------------------------------------------------------------//
@Override
- public List<SpeciesBatch> getAllSpeciesBatch(String traitId) {
+ public List<SpeciesBatch> getAllSpeciesBatch(String fishingOperationId) {
checkDriverExists();
- return driver.getAllSpeciesBatch(traitId);
+ return driver.getAllSpeciesBatch(fishingOperationId);
}
@Override
@@ -328,9 +328,9 @@
//------------------------------------------------------------------------//
@Override
- public List<BenthosBatch> getAllBenthosBatch(String traitId) {
+ public List<BenthosBatch> getAllBenthosBatch(String fishingOperationId) {
checkDriverExists();
- return driver.getAllBenthosBatch(traitId);
+ return driver.getAllBenthosBatch(fishingOperationId);
}
@Override
@@ -356,9 +356,9 @@
//------------------------------------------------------------------------//
@Override
- public List<PlanctonBatch> getAllPlanctonBatch(String traitId) {
+ public List<PlanctonBatch> getAllPlanctonBatch(String fishingOperationId) {
checkDriverExists();
- return driver.getAllPlanctonBatch(traitId);
+ return driver.getAllPlanctonBatch(fishingOperationId);
}
@Override
@@ -380,13 +380,13 @@
}
//------------------------------------------------------------------------//
- //-- Macrodechet Batch methods --//
+ //-- Macrodechet Batch methods --//
//------------------------------------------------------------------------//
@Override
- public List<MacroDechetBatch> getAllMacroDechetBatch(String traitId) {
+ public List<MacroDechetBatch> getAllMacroDechetBatch(String fishingOperationId) {
checkDriverExists();
- return driver.getAllMacroDechetBatch(traitId);
+ return driver.getAllMacroDechetBatch(fishingOperationId);
}
@Override
@@ -412,9 +412,9 @@
//------------------------------------------------------------------------//
@Override
- public List<AccidentelBatch> getAllAccidentelBatch(String traitId) {
+ public List<AccidentelBatch> getAllAccidentelBatch(String fishingOperationId) {
checkDriverExists();
- return driver.getAllAccidentelBatch(traitId);
+ return driver.getAllAccidentelBatch(fishingOperationId);
}
@Override
Modified: trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
===================================================================
--- trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2012-12-10 02:45:40 UTC (rev 37)
@@ -4,18 +4,20 @@
tutti.config.license.organizationName=Nom de l'organisation dans la licence
tutti.config.tmp.directory=Répertoire temporaire utilisée par l'application (est nettoyé à chaque démarrage de l'application)
tutti.property.beaufortScale=Vent beaufort
-tutti.property.campaign=Campagne
tutti.property.codeMemo=Code Memo
tutti.property.country=Pays
tutti.property.date=Date
+tutti.property.firstName=Prénom
+tutti.property.fishingOperation=Trait
tutti.property.gear=Engin
tutti.property.genusSpecies=Nom scientifique
+tutti.property.lastName=Nom de Famille
tutti.property.name=Nom
+tutti.property.program=Série de campagne
+tutti.property.scientificCruise=Campagne
tutti.property.seaState=État de la mer
tutti.property.stationNumber=Numéro de station
tutti.property.strata=Strate d'association
-tutti.property.survey=Série de campagne
-tutti.property.trait=Trait
tutti.property.user=Utilisateur
tutti.property.vessel=Navire
tutti.property.zone=Zone
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -27,7 +27,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
+import fr.ifremer.tutti.persistence.entities.IdAware;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
@@ -51,12 +51,14 @@
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.text.JTextComponent;
+import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -106,6 +108,12 @@
TuttiUIUtil.setProperty(getModel(), property, value);
}
+ public void setDate(ActionEvent event, String property) {
+ JXDatePicker field = (JXDatePicker) event.getSource();
+ Date value = field.getDate();
+ TuttiUIUtil.setProperty(getModel(), property, value);
+ }
+
public void selectListData(ListSelectionEvent event, String property) {
if (!event.getValueIsAdjusting()) {
JList list = (JList) event.getSource();
@@ -146,7 +154,7 @@
*
* @param comboBox le component graphique à initialiser
*/
- protected <E extends AbstractTuttiEntity> void initBeanComboBox(
+ protected <E extends IdAware> void initBeanComboBox(
BeanComboBox<E> comboBox,
List<E> data,
E selectedData) {
@@ -179,7 +187,7 @@
*
* @param listHeader le component graphique à initialiser
*/
- protected <E extends AbstractTuttiEntity> void initBeanList(
+ protected <E extends IdAware> void initBeanList(
BeanListHeader<E> listHeader,
List<E> data,
List<E> selectedData) {
@@ -213,6 +221,13 @@
log.debug("init number editor " + editor.getName());
}
editor.init();
+
+ // Force binding if value is already in model
+ Number model = editor.getModel();
+ if (model != null) {
+ editor.setModel(null);
+ editor.setModel(model);
+ }
}
protected void initTimeEditor(TimeEditor editor) {
@@ -231,8 +246,8 @@
picker.getEditor().setEditable(false);
}
- protected <B extends AbstractTuttiEntity> void updateIndices(JList jlist,
- List<B> list) {
+ protected <B extends IdAware> void updateIndices(JList jlist,
+ List<B> list) {
List<String> ids = TuttiEntities.toIds(list);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -21,104 +21,105 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
+
#mainFrame {
- title:"tutti.application.name";
- defaultCloseOperation:{JFrame.DO_NOTHING_ON_CLOSE};
+ title: "tutti.application.name";
+ defaultCloseOperation: {JFrame.DO_NOTHING_ON_CLOSE};
}
#menuFile {
- text:"tutti.menu.file";
- toolTipText:"tutti.menu.file.tip";
- mnemonic:F;
+ text: "tutti.menu.file";
+ toolTipText: "tutti.menu.file.tip";
+ mnemonic: F;
}
#menuFileConfiguration {
- text:"tutti.action.configuration";
- toolTipText:"tutti.action.configuration.tip";
- actionIcon:"config";
- mnemonic:C;
+ text: "tutti.action.configuration";
+ toolTipText: "tutti.action.configuration.tip";
+ actionIcon: "config";
+ mnemonic: C;
}
#menuFileExit {
- text:"tutti.action.exit";
- toolTipText:"tutti.action.exit.tip";
- actionIcon:"exit";
+ text: "tutti.action.exit";
+ toolTipText: "tutti.action.exit.tip";
+ actionIcon: "exit";
}
#menuActions {
- text:"tutti.menu.actions";
- toolTipText:"tutti.menu.actions.tip";
- mnemonic:A;
+ text: "tutti.menu.actions";
+ toolTipText: "tutti.menu.actions.tip";
+ mnemonic: A;
}
#menuActionManageProtocol {
- text:"tutti.action.manageProtocol";
- toolTipText:"tutti.action.manageProtocol.tip";
- mnemonic:P;
- enabled:{model.getScreen() != TuttiScreen.EDIT_PROTOCOL};
- /*actionIcon:"protocol";*/
+ text: "tutti.action.manageProtocol";
+ toolTipText: "tutti.action.manageProtocol.tip";
+ mnemonic: P;
+ enabled: {model.getScreen() != TuttiScreen.EDIT_PROTOCOL};
+ /*actionIcon: "protocol";*/
}
#menuActionSelectCampaign {
- text:"tutti.action.selectCampaign";
- toolTipText:"tutti.action.selectCampaign.tip";
- mnemonic:S;
- enabled:{model.getScreen() != TuttiScreen.SELECT_CAMPAIGN};
- /*actionIcon:"campaign";*/
+ text: "tutti.action.selectCampaign";
+ toolTipText: "tutti.action.selectCampaign.tip";
+ mnemonic: S;
+ enabled: {model.getScreen() != TuttiScreen.SELECT_SCIENTIFIC_CRUISE};
+ /*actionIcon: "scientificCruise";*/
}
#menuActionFillCatches {
- text:"tutti.action.fillCatches";
- toolTipText:"tutti.action.fillCatches.tip";
- mnemonic:C;
- enabled:{model.getScreen() != TuttiScreen.FILL_CATCHES && model.isCampaignContextFilled()};
- /*actionIcon:"catches";*/
+ text: "tutti.action.fillCatches";
+ toolTipText: "tutti.action.fillCatches.tip";
+ mnemonic: C;
+ enabled: {model.getScreen() != TuttiScreen.FILL_FISHING_OPERATION && model.isScientificCruiseContextFilled()};
+ /*actionIcon: "catches";*/
}
#menuSynchronisations {
- text:"tutti.menu.synchronisations";
- toolTipText:"tutti.menu.synchronisations.tip";
- mnemonic:S;
+ text: "tutti.menu.synchronisations";
+ toolTipText: "tutti.menu.synchronisations.tip";
+ mnemonic: S;
}
#menuSynchronisationImport {
- text:"tutti.menu.synchronisationImport";
- toolTipText:"tutti.menu.synchronisationImport.tip";
- mnemonic:I;
- enabled:false;
+ text: "tutti.menu.synchronisationImport";
+ toolTipText: "tutti.menu.synchronisationImport.tip";
+ mnemonic: I;
+ enabled: false;
}
#menuSynchronisationExport {
- text:"tutti.menu.synchronisationExport";
- toolTipText:"tutti.menu.synchronisationExport.tip";
- mnemonic:E;
- enabled:false;
+ text: "tutti.menu.synchronisationExport";
+ toolTipText: "tutti.menu.synchronisationExport.tip";
+ mnemonic: E;
+ enabled: false;
}
#menuSynchronisationAllegro {
- text:"tutti.menu.synchronisationAllegro";
- toolTipText:"tutti.menu.synchronisationAllegro.tip";
- mnemonic:A;
- enabled:false;
+ text: "tutti.menu.synchronisationAllegro";
+ toolTipText: "tutti.menu.synchronisationAllegro.tip";
+ mnemonic: A;
+ enabled: false;
}
#menuHelp {
- text:"tutti.menu.help";
- toolTipText:"tutti.menu.help.tip";
- mnemonic:E;
+ text: "tutti.menu.help";
+ toolTipText: "tutti.menu.help.tip";
+ mnemonic: E;
}
#menuHelpSite {
- text:"tutti.action.site";
- toolTipText:"tutti.action.site.tip";
- actionIcon:"site";
- mnemonic:S;
+ text: "tutti.action.site";
+ toolTipText: "tutti.action.site.tip";
+ actionIcon: "site";
+ mnemonic: S;
}
#menuHelpAbout {
- text:"tutti.action.about";
- toolTipText:"tutti.action.about.tip";
- actionIcon:"about";
- mnemonic:A;
+ text: "tutti.action.about";
+ toolTipText: "tutti.action.about.tip";
+ actionIcon: "about";
+ mnemonic: A;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -24,16 +24,16 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.Campaign;
-import fr.ifremer.tutti.persistence.entities.data.Survey;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.config.TuttiServiceConfigOption;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
import fr.ifremer.tutti.ui.swing.config.TuttiConfigOption;
-import fr.ifremer.tutti.ui.swing.content.campaign.EditCampaignUI;
-import fr.ifremer.tutti.ui.swing.content.campaign.EditSurveyUI;
-import fr.ifremer.tutti.ui.swing.content.campaign.SelectCampaignUI;
-import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import fr.ifremer.tutti.ui.swing.content.campaign.EditScientificCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.campaign.EditProgramUI;
+import fr.ifremer.tutti.ui.swing.content.campaign.SelectScientificCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
@@ -81,8 +81,8 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
- if (propertyName.equals(TuttiUIContext.PROPERTY_SURVEY_ID) ||
- propertyName.equals(TuttiUIContext.PROPERTY_CAMPAIGN_ID)) {
+ if (propertyName.equals(TuttiUIContext.PROPERTY_PROGRAM_ID) ||
+ propertyName.equals(TuttiUIContext.PROPERTY_SCIENTIFIC_CRUISE_ID)) {
// change the ui title
changeTitle();
@@ -111,14 +111,14 @@
TuttiScreen screen;
- if (context.isCampaignContextFilled()) {
+ if (context.isScientificCruiseContextFilled()) {
// direct fill catches screen
- screen = TuttiScreen.FILL_CATCHES;
+ screen = TuttiScreen.FILL_FISHING_OPERATION;
} else {
- // go to select campaign screen
- screen = TuttiScreen.SELECT_CAMPAIGN;
+ // go to select scientificCruise screen
+ screen = TuttiScreen.SELECT_SCIENTIFIC_CRUISE;
}
context.setScreen(screen);
@@ -159,8 +159,8 @@
@Override
public void run() {
- if (TuttiScreen.SELECT_CAMPAIGN == context.getScreen()) {
- // Reselect home campaign
+ if (TuttiScreen.SELECT_SCIENTIFIC_CRUISE == context.getScreen()) {
+ // Reselect home scientificCruise
// SelectCampaignUI homeUI = (SelectCampaignUI) currentBody;
// homeUI.getHandler().selectCampaign();
}
@@ -230,11 +230,11 @@
}
public void showSelectCampaign() {
- context.setScreen(TuttiScreen.SELECT_CAMPAIGN);
+ context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
}
public void showFillCatches() {
- context.setScreen(TuttiScreen.FILL_CATCHES);
+ context.setScreen(TuttiScreen.FILL_FISHING_OPERATION);
}
public void showImportScreen() {
@@ -319,46 +319,46 @@
closeCurrentBody();
- String surveyId = context.getSurveyId();
- String campaignId = context.getCampaignId();
+ String surveyId = context.getProgramId();
+ String campaignId = context.getScientificCruiseId();
JComponent screenUI;
String screenTitle;
switch (screen) {
default:
- case SELECT_CAMPAIGN:
+ case SELECT_SCIENTIFIC_CRUISE:
- screenUI = new SelectCampaignUI(context);
+ screenUI = new SelectScientificCruiseUI(context);
screenTitle = _("tutti.title.home");
break;
- case EDIT_SURVEY:
+ case EDIT_PROGRAM:
if (surveyId == null) {
- screenTitle = _("tutti.title.create.survey");
+ screenTitle = _("tutti.title.create.program");
} else {
- screenTitle = _("tutti.title.edit.survey");
+ screenTitle = _("tutti.title.edit.program");
}
- screenUI = new EditSurveyUI(context);
+ screenUI = new EditProgramUI(context);
break;
- case EDIT_CAMPAIGN:
+ case EDIT_SCIENTIFIC_CRUISE:
if (campaignId == null) {
- screenTitle = _("tutti.title.create.campaign");
+ screenTitle = _("tutti.title.create.scientificCruise");
} else {
- screenTitle = _("tutti.title.edit.campaign");
+ screenTitle = _("tutti.title.edit.scientificCruise");
}
- screenUI = new EditCampaignUI(context);
+ screenUI = new EditScientificCruiseUI(context);
break;
- case FILL_CATCHES:
+ case FILL_FISHING_OPERATION:
screenTitle = _("tutti.title.fill.catches");
- screenUI = new CatchesUI(context);
+ screenUI = new FishingOperationsUI(context);
break;
}
@@ -371,7 +371,7 @@
ErrorDialogUI.showError(e);
// go back to home
- context.setScreen(TuttiScreen.SELECT_CAMPAIGN);
+ context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
} finally {
// free ui
@@ -430,39 +430,39 @@
}
protected void changeTitle() {
- String surveyId = context.getSurveyId();
+ String surveyId = context.getProgramId();
String title;
if (surveyId == null) {
- // no survey selected (so neither campaign)
+ // no program selected (so neither scientificCruise)
- title = _("tutti.title.noSelectedSurvey");
+ title = _("tutti.title.noSelectedProgram");
} else {
- // selected survey
+ // selected program
- Survey survey = persistenceService.getSurvey(surveyId);
+ Program program = persistenceService.getProgram(surveyId);
- title = _("tutti.title.selectedSurvey", survey.getName()) + " / ";
+ title = _("tutti.title.selectedProgram", program.getName()) + " / ";
- String campaignId = context.getCampaignId();
+ String campaignId = context.getScientificCruiseId();
if (campaignId == null) {
- // no selected campaign
+ // no selected scientificCruise
- title += _("tutti.title.noSelectedCampaign");
+ title += _("tutti.title.noSelectedScientificCruise");
} else {
- // selected campaign
- Campaign campaign;
- campaign = persistenceService.getCampaign(campaignId);
+ // selected scientificCruise
+ ScientificCruise scientificCruise;
+ scientificCruise = persistenceService.getScientificCruise(campaignId);
- title += _("tutti.title.selectedCampaign", campaign.getName());
+ title += _("tutti.title.selectedScientificCruise", scientificCruise.getName());
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiScreen.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -33,25 +33,25 @@
public enum TuttiScreen {
/**
- * To select survey and campaign.
+ * To select program and scientificCruise.
*
* @since 0.1
*/
- SELECT_CAMPAIGN,
+ SELECT_SCIENTIFIC_CRUISE,
/**
- * To edit a survey.
+ * To edit a program.
*
* @since 0.1
*/
- EDIT_SURVEY,
+ EDIT_PROGRAM,
/**
- * To edit a campaign.
+ * To edit a scientificCruise.
*
* @since 0.1
*/
- EDIT_CAMPAIGN,
+ EDIT_SCIENTIFIC_CRUISE,
/**
* To edit a protocol.
@@ -65,5 +65,5 @@
*
* @since 0.1
*/
- FILL_CATCHES
+ FILL_FISHING_OPERATION
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUI.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUI.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUI.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -39,23 +39,37 @@
H getHandler();
/**
+ * Pattern to use for short numeric values in editors with max 1 digits.
+ *
+ * @since 0.2
+ */
+ public static final String INT_1_DIGITS_PATTERN = "\\d{0,1}";
+
+ /**
* Pattern to use for short numeric values in editors with max 3 digits.
*
- * @since 2.3
+ * @since 0.1
*/
public static final String INT_3_DIGITS_PATTERN = "\\d{0,3}";
/**
+ * Pattern to use for short numeric values in editors with max 4 digits.
+ *
+ * @since 0.2
+ */
+ public static final String INT_4_DIGITS_PATTERN = "\\d{0,4}";
+
+ /**
* Pattern to use for integer numeric values in editors with max 6 digits.
*
- * @since 2.3
+ * @since 0.1
*/
public static final String INT_6_DIGITS_PATTERN = "\\d{0,6}";
/**
* Pattern to use for integer numeric values in editors with max 7 digits.
*
- * @since 2.3
+ * @since 0.1
*/
public static final String INT_7_DIGITS_PATTERN = "\\d{0,7}";
@@ -63,7 +77,7 @@
* Pattern to use for decimal numeric values with 1 decimal digits in
* editors.
*
- * @since 2.3
+ * @since 0.1
*/
public static final String DECIMAL1_PATTERN = "\\d{0,6}|\\d{1,6}.\\d{0,1}";
@@ -71,7 +85,7 @@
* Pattern to use for decimal numeric values with 2 decimal digits in
* editors.
*
- * @since 2.3
+ * @since 0.1
*/
public static final String DECIMAL2_PATTERN = "\\d{0,6}|\\d{1,6}.\\d{0,2}";
@@ -79,7 +93,7 @@
* Pattern to use for decimal numeric values with 3 decimal digits in
* editors.
*
- * @since 2.3
+ * @since 0.1
*/
public static final String DECIMAL3_PATTERN = "\\d{0,6}|\\d{1,6}.\\d{0,3}";
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -26,8 +26,8 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.data.Campaign;
-import fr.ifremer.tutti.persistence.entities.data.Survey;
+import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.TuttiService;
import fr.ifremer.tutti.service.TuttiServiceContext;
@@ -55,13 +55,13 @@
/** Logger. */
private static final Log log = LogFactory.getLog(TuttiUIContext.class);
- public static final String PROPERTY_SURVEY_ID = "surveyId";
+ public static final String PROPERTY_PROGRAM_ID = "programId";
- public static final String PROPERTY_CAMPAIGN_ID = "campaignId";
+ public static final String PROPERTY_SCIENTIFIC_CRUISE_ID = "scientificCruiseId";
public static final String PROPERTY_SCREEN = "screen";
- public static final String PROPERTY_CAMPAIGN_CONTEXT_FILLED = "campaignContextFilled";
+ public static final String PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED = "scientificCruiseContextFilled";
/**
* Application context (only one for all the application).
@@ -92,18 +92,18 @@
protected final SwingSession swingSession;
/**
- * Id of last selected survey (can be null if none ever selected).
+ * Id of last selected program (can be null if none ever selected).
*
* @since 0.1
*/
- protected String surveyId;
+ protected String programId;
/**
- * Id of last selected campaign (can be null if none ever selected).
+ * Id of last selected scientificCruise (can be null if none ever selected).
*
* @since 0.1
*/
- protected String campaignId;
+ protected String scientificCruiseId;
/**
* Current screen displayed in ui.
@@ -138,43 +138,43 @@
return swingSession;
}
- public String getSurveyId() {
- return surveyId;
+ public String getProgramId() {
+ return programId;
}
- public String getCampaignId() {
- return campaignId;
+ public String getScientificCruiseId() {
+ return scientificCruiseId;
}
- public boolean isCampaignContextFilled() {
- return StringUtils.isNotBlank(surveyId) &&
- StringUtils.isNotBlank(campaignId);
+ public boolean isScientificCruiseContextFilled() {
+ return StringUtils.isNotBlank(programId) &&
+ StringUtils.isNotBlank(scientificCruiseId);
}
public TuttiScreen getScreen() {
return screen;
}
- public void setSurveyId(String surveyId) {
- boolean oldValue = isCampaignContextFilled();
+ public void setProgramId(String programId) {
+ boolean oldValue = isScientificCruiseContextFilled();
- this.surveyId = surveyId;
+ this.programId = programId;
// always propagate the change
- firePropertyChange(PROPERTY_SURVEY_ID, null, surveyId);
- firePropertyChange(PROPERTY_CAMPAIGN_CONTEXT_FILLED,
- oldValue, isCampaignContextFilled());
+ firePropertyChange(PROPERTY_PROGRAM_ID, null, programId);
+ firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED,
+ oldValue, isScientificCruiseContextFilled());
}
- public void setCampaignId(String campaignId) {
- boolean oldValue = isCampaignContextFilled();
+ public void setScientificCruiseId(String scientificCruiseId) {
+ boolean oldValue = isScientificCruiseContextFilled();
- this.campaignId = campaignId;
+ this.scientificCruiseId = scientificCruiseId;
// always propagate the change
- firePropertyChange(PROPERTY_CAMPAIGN_ID, null, campaignId);
- firePropertyChange(PROPERTY_CAMPAIGN_CONTEXT_FILLED,
- oldValue, isCampaignContextFilled());
+ firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_ID, null, scientificCruiseId);
+ firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_CONTEXT_FILLED,
+ oldValue, isScientificCruiseContextFilled());
}
public void setScreen(TuttiScreen screen) {
@@ -185,67 +185,67 @@
public void open() {
- if (surveyId == null) {
+ if (programId == null) {
// load it from config
- setSurveyId(getConfig().getSurveyId());
+ setProgramId(getConfig().getProgramId());
}
- if (campaignId == null) {
+ if (scientificCruiseId == null) {
// load it from config
- setCampaignId(getConfig().getCampaignId());
+ setScientificCruiseId(getConfig().getScientificCruiseId());
}
- //check if surveyId is sane
+ //check if programId is sane
PersistenceService persistenceService =
getService(PersistenceService.class);
- if (surveyId != null) {
+ if (programId != null) {
- Survey survey = persistenceService.getSurvey(surveyId);
- if (survey == null) {
+ Program program = persistenceService.getProgram(programId);
+ if (program == null) {
// not found in this db
- setSurveyId(null);
- setCampaignId(null);
+ setProgramId(null);
+ setScientificCruiseId(null);
if (log.isWarnEnabled()) {
- log.warn("Remove invalid surveyId: " + surveyId);
+ log.warn("Remove invalid programId: " + programId);
}
} else {
if (log.isInfoEnabled()) {
- log.info("SurveyId valid: " + surveyId);
+ log.info("ProgramId valid: " + programId);
}
- setSurveyId(surveyId);
+ setProgramId(programId);
- // test campaignId
- if (campaignId != null) {
+ // test scientificCruiseId
+ if (scientificCruiseId != null) {
- Campaign campaign =
- persistenceService.getCampaign(campaignId);
+ ScientificCruise campaign =
+ persistenceService.getScientificCruise(scientificCruiseId);
if (campaign != null &&
- !campaign.getSurvey().getId().equals(surveyId)) {
+ !campaign.getProgram().getId().equals(programId)) {
- // not matchin survey, reset campaign id
+ // not matchin program, reset scientificCruise id
campaign = null;
}
if (campaign == null) {
// not found in this db
- setCampaignId(null);
+ setScientificCruiseId(null);
if (log.isWarnEnabled()) {
- log.warn("Remove invalid campaignId: " + campaignId);
+ log.warn("Remove invalid scientificCruiseId: " + scientificCruiseId);
}
} else {
if (log.isInfoEnabled()) {
- log.info("CampaignId valid: " + campaignId);
+ log.info("ScientificCruiseId valid: " + scientificCruiseId);
}
}
}
@@ -255,11 +255,11 @@
// save back to config
saveContextToConfig();
- // list when surveyId or campaingId change to save the configuration
+ // list when programId or campaingId change to save the configuration
addPropertyChangeListener(new PropertyChangeListener() {
Set<String> acceptedProperties = Sets.newHashSet(
- PROPERTY_SURVEY_ID, PROPERTY_CAMPAIGN_ID);
+ PROPERTY_PROGRAM_ID, PROPERTY_SCIENTIFIC_CRUISE_ID);
@Override
public void propertyChange(PropertyChangeEvent evt) {
@@ -275,8 +275,8 @@
public void close() {
// Clear data references
- surveyId = null;
- campaignId = null;
+ programId = null;
+ scientificCruiseId = null;
IOUtils.closeQuietly(serviceContext);
@@ -292,11 +292,11 @@
protected void saveContextToConfig() {
if (log.isInfoEnabled()) {
- log.info("Save config (surveyId: " + surveyId + ", campaignId: " +
- campaignId + ")");
+ log.info("Save config (programId: " + programId + ", scientificCruiseId: " +
+ scientificCruiseId + ")");
}
- config.setSurveyId(surveyId);
- config.setCampaignId(campaignId);
+ config.setProgramId(programId);
+ config.setScientificCruiseId(scientificCruiseId);
config.save();
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfig.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -122,12 +122,12 @@
return applicationConfig.getOptionAsBoolean(TuttiConfigOption.SHOW_NUMBER_EDITOR_BUTTON.getKey());
}
- public String getSurveyId() {
- return applicationConfig.getOption(TuttiConfigOption.SURVEY_ID.getKey());
+ public String getProgramId() {
+ return applicationConfig.getOption(TuttiConfigOption.PROGRAM_ID.getKey());
}
- public String getCampaignId() {
- return applicationConfig.getOption(TuttiConfigOption.CAMPAIGN_ID.getKey());
+ public String getScientificCruiseId() {
+ return applicationConfig.getOption(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey());
}
public KeyStroke getShortCut(String actionName) {
@@ -160,26 +160,26 @@
return serviceConfig.getDataDirectory();
}
- public void setSurveyId(String surveyId) {
- if (surveyId == null) {
+ public void setProgramId(String programId) {
+ if (programId == null) {
Properties options = applicationConfig.getOptions();
- options.remove(TuttiConfigOption.SURVEY_ID.getKey());
+ options.remove(TuttiConfigOption.PROGRAM_ID.getKey());
applicationConfig.setOptions(options);
} else {
- applicationConfig.setOption(TuttiConfigOption.SURVEY_ID.getKey(), surveyId);
+ applicationConfig.setOption(TuttiConfigOption.PROGRAM_ID.getKey(), programId);
}
}
- public void setCampaignId(String campaignId) {
- if (campaignId == null) {
+ public void setScientificCruiseId(String scientificCruiseId) {
+ if (scientificCruiseId == null) {
Properties options = applicationConfig.getOptions();
- options.remove(TuttiConfigOption.CAMPAIGN_ID.getKey());
+ options.remove(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey());
applicationConfig.setOptions(options);
} else {
- applicationConfig.setOption(TuttiConfigOption.CAMPAIGN_ID.getKey(), campaignId);
+ applicationConfig.setOption(TuttiConfigOption.SCIENTIFIC_CRUISE_ID.getKey(), scientificCruiseId);
}
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/TuttiConfigOption.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -43,13 +43,13 @@
"${tutti.data.directory}/tuttiUI.xml",
File.class
),
- SURVEY_ID("tutti.surveyId",
- n_("tutti.config.surveyId"),
+ PROGRAM_ID("tutti.programId",
+ n_("tutti.config.programId"),
null,
String.class
),
- CAMPAIGN_ID("tutti.campaignId",
- n_("tutti.config.campaignId"),
+ SCIENTIFIC_CRUISE_ID("tutti.scientificCruiseId",
+ n_("tutti.config.scientificCruiseId"),
null,
String.class
),
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,172 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-JToolBar {
- floatable:false;
-}
-
-BeanComboBox {
- showReset:true;
- i18nPrefix:"tutti.property.";
- bean:{model};
-}
-
-BeanListHeader {
- showReset:true;
- i18nPrefix:"tutti.property.";
-}
-
-JList {
- selectionMode:{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
- model:{new DefaultListModel()};
-}
-
-#splitPane {
- orientation:{JSplitPane.VERTICAL_SPLIT};
- resizeWeight:0.3;
- oneTouchExpandable:true;
- continuousLayout:true;
-}
-
-#nameLabel {
- text:"tutti.label.campaign.name";
- labelFor:{nameField};
-}
-
-#nameField {
- text:{model.getName()};
-}
-
-#surveyPartLabel {
- text:"tutti.label.campaign.surveyPart";
- labelFor:{surveyPartField};
-}
-
-#surveyPartField {
- text:{model.getSurveyPart()};
-}
-
-#countryLabel {
- text:"tutti.label.campaign.country";
- labelFor:{countryComboBox};
-}
-
-#countryComboBox {
- property:"country";
- selectedItem:{model.getCountry()};
-}
-
-#surveyLabel {
- text:"tutti.label.campaign.survey";
- labelFor:{surveyComboBox};
-}
-
-#surveyComboBox {
- property:"survey";
- selectedItem:{model.getSurvey()};
-}
-
-#vesselPane {
- horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#vesselHeader {
- labelText:{_("tutti.label.list.vessel")};
- list:{vesselList};
- beanType:{Vessel.class};
-}
-
-#gearPane {
- horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#gearHeader {
- labelText:{_("tutti.label.list.gear")};
- list:{gearList};
- beanType:{Gear.class};
-}
-
-#headOfMissionPane {
- horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#headOfMissionHeader {
- labelText:{_("tutti.label.list.headOfMission")};
- list:{headOfMissionList};
- beanType:{TuttiUser.class};
-}
-
-#headOfSortRoomPane {
- horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#headOfSortRoomHeader {
- labelText:{_("tutti.label.list.headOfSortRoom")};
- list:{headOfSortRoomList};
- beanType:{TuttiUser.class};
-}
-
-#commentPane {
- columnHeaderView:{new JLabel(_("tutti.label.comment"))};
- minimumSize:{new Dimension(10,50)};
-}
-
-#commentField {
- text:{model.getComment()};
-}
-
-#saveButton {
- actionIcon:"save";
- text:"tutti.action.save";
- enabled:{model.isModify() && model.isValid()};
-}
-
-#cancelButton {
- actionIcon:"cancel";
- text:"tutti.action.cancel";
-}
-
-#importCasinoButton {
- actionIcon:"casino-import";
- text:"tutti.action.casino-import";
-}
-
-#messagePanel {
- border:{BorderFactory.createTitledBorder("Messages")};
- height:200;
- width:500;
-}
-
-#errorTable {
- rowSelectionAllowed:true;
- autoCreateRowSorter:true;
- autoResizeMode:2;
- cellSelectionEnabled:false;
- selectionMode:0;
- model:{errorTableModel};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,212 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditCampaignUIModel, EditCampaignUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.Survey
- fr.ifremer.tutti.persistence.entities.referential.Country
- fr.ifremer.tutti.persistence.entities.referential.Gear
- fr.ifremer.tutti.persistence.entities.referential.TuttiUser
- fr.ifremer.tutti.persistence.entities.referential.Vessel
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.swing.editor.bean.BeanListHeader
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- javax.swing.DefaultListModel
- javax.swing.ListSelectionModel
-
- java.awt.Dimension
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
- </import>
-
- <script><![CDATA[
-
- public EditCampaignUI(TuttiUIContext context) {
- EditCampaignUIHandler handler = new EditCampaignUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
- <EditCampaignUIHandler id='handler'
- initializer='getContextValue(EditCampaignUIHandler.class)'/>
-
- <EditCampaignUIModel id='model'
- initializer='getContextValue(EditCampaignUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='name' component='nameField'/>
- <field name='comment' component='commentField'/>
- <field name='surveyPart' component='surveyPartField'/>
- <field name='country' component='countryComboBox'/>
- <field name='survey' component='surveyComboBox'/>
- <field name='vessel' component='vesselPane'/>
- <field name='gear' component='gearPane'/>
- <field name='headOfMission' component='headOfMissionPane'/>
- <field name='headOfSortRoom' component='headOfSortRoomPane'/>
- </BeanValidator>
-
- <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
- <Table fill='both'>
-
- <!-- campaign survey -->
- <row>
- <cell anchor='west'>
- <JLabel id='surveyLabel'/>
- </cell>
- <cell weightx='1.0'>
- <BeanComboBox id='surveyComboBox' constructorParams='this'
- genericType='Survey'/>
- </cell>
- </row>
-
- <!-- campaign country -->
- <row>
- <cell>
- <JLabel id='countryLabel'/>
- </cell>
- <cell>
- <BeanComboBox id='countryComboBox' constructorParams='this'
- genericType='Country'/>
- </cell>
- </row>
-
- <!-- campaign name -->
- <row>
- <cell>
- <JLabel id='nameLabel'/>
- </cell>
- <cell>
- <JTextField id='nameField'
- onKeyReleased='handler.setText(event, "name")'/>
- </cell>
- </row>
-
- <!-- campaign survey part -->
- <row>
- <cell>
- <JLabel id='surveyPartLabel'/>
- </cell>
- <cell>
- <JTextField id='surveyPartField'
- onKeyReleased='handler.setText(event, "surveyPart")'/>
- </cell>
- </row>
-
- <!-- campaign vessel / gear -->
- <row weighty='0.3'>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1, 0)}'>
- <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
- onFocusGained='vesselList.requestFocus()'>
- <JList id='vesselList'
- onValueChanged='handler.selectListData(event, "vessel")'/>
- <BeanListHeader id='vesselHeader' genericType='Vessel'/>
- </JScrollPane>
- <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
- onFocusGained='gearList.requestFocus()'>
- <JList id='gearList'
- onValueChanged='handler.selectListData(event, "gear")'/>
- <BeanListHeader id='gearHeader' genericType='Gear'/>
- </JScrollPane>
- </JPanel>
- </cell>
- </row>
-
- <!-- campaign headOfMission / headOfSortRoom -->
- <row weighty='0.3'>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1, 0)}'>
-
- <JScrollPane id='headOfMissionPane'
- columnHeaderView="{headOfMissionHeader}"
- onFocusGained='headOfMissionList.requestFocus()'>
- <JList id='headOfMissionList'
- onValueChanged='handler.selectListData(event, "headOfMission")'/>
- <BeanListHeader id='headOfMissionHeader'
- genericType='TuttiUser'/>
- </JScrollPane>
- <JScrollPane id='headOfSortRoomPane'
- columnHeaderView="{headOfSortRoomHeader}"
- onFocusGained='headOfSortRoomList.requestFocus()'>
- <JList id='headOfSortRoomList'
- onValueChanged='handler.selectListData(event, "headOfSortRoom")'/>
- <BeanListHeader id='headOfSortRoomHeader'
- genericType='TuttiUser'/>
- </JScrollPane>
- </JPanel>
- </cell>
- </row>
-
- <!-- campaign comment -->
- <row weighty='0.3'>
- <cell columns='2'>
- <JScrollPane id='commentPane'
- onFocusGained='commentField.requestFocus()'>
- <JTextArea id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </cell>
- </row>
-
- <!-- Import Actions -->
- <row>
- <cell columns='2'>
- <JButton id='importCasinoButton'
- onActionPerformed='handler.importCasino()'/>
- </cell>
- </row>
-
- <!-- Form Actions -->
- <row>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1, 0)}'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
- </JPanel>
- </cell>
- </row>
- </Table>
- <JPanel id='messagePanel' layout='{new GridLayout()}'>
- <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
- <JTable id='errorTable' />
- </JScrollPane>
- </JPanel>
- </JSplitPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,158 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Campaign;
-import fr.ifremer.tutti.persistence.entities.data.Survey;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
-import jaxx.runtime.validator.swing.SwingValidatorUtil;
-
-import java.util.List;
-
-/**
- * Handler of UI {@link EditCampaignUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EditCampaignUIHandler extends AbstractTuttiUIHandler<EditCampaignUIModel> {
-
- private final EditCampaignUI ui;
-
- private final PersistenceService persistenceService;
-
- public EditCampaignUIHandler(TuttiUIContext context, EditCampaignUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- EditCampaignUIModel model = new EditCampaignUIModel();
-
- String campaignId = context.getCampaignId();
- if (campaignId == null) {
-
- Survey survey =
- persistenceService.getSurvey(context.getSurveyId());
- model.setSurvey(survey);
- } else {
-
- // load existing survey
- Campaign campaign = persistenceService.getCampaign(campaignId);
-
- model.fromBean(campaign);
- }
- listModelIsModify(model);
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- List<TuttiUser> users = persistenceService.getAllTuttiUser();
-
- EditCampaignUIModel model = ui.getModel();
-
- initBeanComboBox(ui.getSurveyComboBox(),
- persistenceService.getAllSurvey(),
- model.getSurvey());
-
- initBeanComboBox(ui.getCountryComboBox(),
- persistenceService.getAllCountry(),
- model.getCountry());
-
- initBeanList(ui.getVesselHeader(),
- persistenceService.getAllVessel(),
- model.getVessel());
-
- initBeanList(ui.getGearHeader(),
- persistenceService.getAllGear(),
- model.getGear());
-
- initBeanList(ui.getHeadOfMissionHeader(),
- users,
- model.getHeadOfMission());
-
- initBeanList(ui.getHeadOfSortRoomHeader(),
- users,
- model.getHeadOfSortRoom());
-
- SwingValidatorUtil.installUI(ui.getErrorTable(),
- new SwingValidatorMessageTableRenderer());
-
- listenValidatorValid(ui.getValidator(), model);
-
- // if new trait can already cancel his creation
- model.setModify(model.isCreate());
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected EditCampaignUIModel getModel() {
- return ui.getModel();
- }
-
- public void cancel() {
-
- context.setScreen(TuttiScreen.SELECT_CAMPAIGN);
- }
-
- public void save() {
-
- EditCampaignUIModel model = ui.getModel();
-
- Campaign bean = model.toBean();
-
- Campaign saved;
- if (TuttiEntities.isNew(bean)) {
-
- saved = persistenceService.createCampaign(bean);
- } else {
- saved = persistenceService.saveCampaign(bean);
- }
-
- context.setSurveyId(saved.getSurvey().getId());
- context.setCampaignId(saved.getId());
-
- context.setScreen(TuttiScreen.SELECT_CAMPAIGN);
- }
-
- public void importCasino() {
-
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,182 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.Campaign;
-import fr.ifremer.tutti.persistence.entities.data.Survey;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
-import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.List;
-
-/**
- * Model of UI {@link EditCampaignUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1O
- */
-public class EditCampaignUIModel extends AbstractTuttiBeanUIModel<Campaign, EditCampaignUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_SURVEY = "survey";
-
- public static final String PROPERTY_NAME = "name";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_COUNTRY = "country";
-
- public static final String PROPERTY_SURVEY_PART = "surveyPart";
-
- public static final String PROPERTY_VESSEL = "vessel";
-
- public static final String PROPERTY_GEAR = "gear";
-
- public static final String PROPERTY_HEAD_OF_MISSION = "headOfMission";
-
- public static final String PROPERTY_HEAD_OF_SORT_ROOM = "headOfSortRoom";
-
- protected Survey survey;
-
- protected Country country;
-
- protected String name;
-
- protected String surveyPart;
-
- protected List<Vessel> vessel;
-
- protected List<Gear> gear;
-
- protected List<TuttiUser> headOfMission;
-
- protected List<TuttiUser> headOfSortRoom;
-
- protected String comment;
-
- protected static Binder<EditCampaignUIModel, Campaign> toBeanBinder =
- BinderFactory.newBinder(EditCampaignUIModel.class,
- Campaign.class);
-
- protected static Binder<Campaign, EditCampaignUIModel> fromBeanBinder =
- BinderFactory.newBinder(Campaign.class, EditCampaignUIModel.class);
-
- public EditCampaignUIModel() {
- super(Campaign.class, fromBeanBinder, toBeanBinder);
- }
-
- public Survey getSurvey() {
- return survey;
- }
-
- public void setSurvey(Survey survey) {
- Object oldValue = getSurvey();
- this.survey = survey;
- firePropertyChange(PROPERTY_SURVEY, oldValue, survey);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- Object oldValue = getName();
- this.name = name;
- firePropertyChange(PROPERTY_NAME, oldValue, name);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public Country getCountry() {
- return country;
- }
-
- public void setCountry(Country country) {
- Object oldValue = getCountry();
- this.country = country;
- firePropertyChange(PROPERTY_COUNTRY, oldValue, country);
- }
-
- public String getSurveyPart() {
- return surveyPart;
- }
-
- public void setSurveyPart(String surveyPart) {
- Object oldValue = getSurveyPart();
- this.surveyPart = surveyPart;
- firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart);
- }
-
- public List<Vessel> getVessel() {
- return vessel;
- }
-
- public void setVessel(List<Vessel> vessel) {
- this.vessel = vessel;
- firePropertyChange(PROPERTY_VESSEL, null, vessel);
- }
-
- public List<Gear> getGear() {
- return gear;
- }
-
- public void setGear(List<Gear> gear) {
- this.gear = gear;
- firePropertyChange(PROPERTY_GEAR, null, gear);
- }
-
- public List<TuttiUser> getHeadOfMission() {
- return headOfMission;
- }
-
- public void setHeadOfMission(List<TuttiUser> headOfMission) {
- this.headOfMission = headOfMission;
- firePropertyChange(PROPERTY_HEAD_OF_MISSION, null, headOfMission);
- }
-
- public List<TuttiUser> getHeadOfSortRoom() {
- return headOfSortRoom;
- }
-
- public void setHeadOfSortRoom(List<TuttiUser> headOfSortRoom) {
- this.headOfSortRoom = headOfSortRoom;
- firePropertyChange(PROPERTY_HEAD_OF_SORT_ROOM, null, headOfSortRoom);
- }
-
-}
\ No newline at end of file
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,94 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+#splitPane {
+ orientation: {JSplitPane.VERTICAL_SPLIT};
+ resizeWeight: 0.3;
+ oneTouchExpandable: true;
+ continuousLayout: true;
+}
+
+#form {
+ border: {BorderFactory.createTitledBorder((String)null)};
+}
+
+#nameLabel {
+ text: "tutti.label.program.name";
+ labelFor: {nameField};
+}
+
+#nameField {
+ text: {model.getName()};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {getStringValue(model.getComment())};
+}
+
+#zoneLabel {
+ text: "tutti.label.program.zone";
+ labelFor: {zoneComboBox};
+}
+
+#zoneComboBox {
+ property: "zone";
+ selectedItem: {model.getZone()};
+}
+
+#saveButton {
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+ actionIcon: "save";
+}
+
+#cancelButton {
+ text: "tutti.action.cancel";
+ actionIcon: "cancel";
+}
+
+#messagePanel {
+ border: {BorderFactory.createTitledBorder("Messages")};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,125 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditProgramUIModel, EditProgramUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.Zone
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ java.awt.Dimension
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+
+ </import>
+
+ <script><![CDATA[
+
+ public EditProgramUI(TuttiUIContext context) {
+ EditProgramUIHandler handler = new EditProgramUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <EditProgramUIHandler id='handler'
+ initializer='getContextValue(EditProgramUIHandler.class)'/>
+
+ <EditProgramUIModel id='model'
+ initializer='getContextValue(EditProgramUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='name' component='nameField'/>
+ <field name='zone' component='zoneComboBox'/>
+ <field name='comment' component='commentField'/>
+ </BeanValidator>
+
+ <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
+
+ <Table id='form' fill='both'>
+
+ <!-- program name -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='nameLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='nameField'
+ onKeyReleased='handler.setText(event, "name")'/>
+ </cell>
+ </row>
+
+ <!-- program zone -->
+ <row>
+ <cell>
+ <JLabel id='zoneLabel'/>
+ </cell>
+ <cell>
+ <BeanComboBox id='zoneComboBox' constructorParams='this'
+ genericType='Zone'/>
+ </cell>
+ </row>
+
+ <!-- program comment -->
+ <row weighty='0.8'>
+ <cell columns='2'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+
+ <!-- actions -->
+ <row anchor='south'>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+
+ <!-- validation messages -->
+ <JPanel id='messagePanel' layout='{new GridLayout()}'>
+ <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
+ <JTable id='errorTable' />
+ </JScrollPane>
+ </JPanel>
+ </JSplitPane>
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,135 @@
+package fr.ifremer.tutti.ui.swing.content.campaign;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
+import jaxx.runtime.validator.swing.SwingValidatorUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Handler of UI {@link EditProgramUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditProgramUIHandler extends AbstractTuttiUIHandler<EditProgramUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditProgramUIHandler.class);
+
+ private final EditProgramUI ui;
+
+ private final PersistenceService persistenceService;
+
+ public EditProgramUIHandler(TuttiUIContext context, EditProgramUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ EditProgramUIModel model = new EditProgramUIModel();
+
+ String surveyId = context.getProgramId();
+ if (surveyId == null) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Edit new program");
+ }
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Edit existing program " + surveyId);
+ }
+ // load existing program
+ Program program = persistenceService.getProgram(surveyId);
+
+ model.fromBean(program);
+ }
+
+ listModelIsModify(model);
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ EditProgramUIModel model = ui.getModel();
+ initBeanComboBox(ui.getZoneComboBox(),
+ persistenceService.getAllZone(),
+ model.getZone());
+
+ SwingValidatorUtil.installUI(ui.getErrorTable(),
+ new SwingValidatorMessageTableRenderer());
+
+ listenValidatorValid(ui.getValidator(), model);
+
+ // if new program can already cancel his creation
+ model.setModify(model.isCreate());
+ }
+
+ @Override
+ public void onCloseUI() {
+ ui.getValidator().setBean(null);
+ }
+
+ @Override
+ protected EditProgramUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void cancel() {
+ context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
+ }
+
+ public void save() {
+
+ EditProgramUIModel model = ui.getModel();
+
+ Program bean = model.toBean();
+
+ Program saved;
+ if (TuttiEntities.isNew(bean)) {
+
+ saved = persistenceService.createProgram(bean);
+ } else {
+ saved = persistenceService.saveProgram(bean);
+ }
+
+ context.setProgramId(saved.getId());
+ context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,97 @@
+package fr.ifremer.tutti.ui.swing.content.campaign;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+/**
+ * Bean to edit a program.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditProgramUIModel extends AbstractTuttiBeanUIModel<Program, EditProgramUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_ZONE = "zone";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_NAME = "name";
+
+ protected String name;
+
+ protected String comment;
+
+ protected Zone zone;
+
+ protected static Binder<EditProgramUIModel, Program> toBeanBinder =
+ BinderFactory.newBinder(EditProgramUIModel.class,
+ Program.class);
+
+ protected static Binder<Program, EditProgramUIModel> fromBeanBinder =
+ BinderFactory.newBinder(Program.class, EditProgramUIModel.class);
+
+
+ public EditProgramUIModel() {
+ super(Program.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ Object oldValue = getName();
+ this.name = name;
+ firePropertyChange(PROPERTY_NAME, oldValue, name);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public Zone getZone() {
+ return zone;
+ }
+
+ public void setZone(Zone zone) {
+ Object oldValue = getZone();
+ this.zone = zone;
+ firePropertyChange(PROPERTY_ZONE, oldValue, zone);
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,223 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+JToolBar {
+ floatable: false;
+}
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+BeanListHeader {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+}
+
+JList {
+ selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
+ model: {new DefaultListModel()};
+}
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#splitPane {
+ orientation: {JSplitPane.VERTICAL_SPLIT};
+ resizeWeight: 0.3;
+ oneTouchExpandable: true;
+ continuousLayout: true;
+}
+
+#nameLabel {
+ text: "tutti.label.scientificCruise.name";
+ labelFor: {nameField};
+}
+
+#nameField {
+ text: {model.getName()};
+}
+
+#yearLabel {
+ text: "tutti.label.scientificCruise.year";
+ labelFor: {yearField};
+}
+
+#yearField {
+ property: "year";
+ model: {model.getYear()};
+ useFloat: false;
+ numberPattern: {INT_4_DIGITS_PATTERN};
+}
+
+#surveyPartLabel {
+ text: "tutti.label.scientificCruise.surveyPart";
+ labelFor: {surveyPartField};
+}
+
+#surveyPartField {
+ text: {model.getSurveyPart()};
+}
+
+#countryLabel {
+ text: "tutti.label.scientificCruise.country";
+ labelFor: {countryComboBox};
+}
+
+#countryComboBox {
+ property: "country";
+ selectedItem: {model.getCountry()};
+}
+
+#programLabel {
+ text: "tutti.label.scientificCruise.program";
+ labelFor: {surveyComboBox};
+}
+
+#surveyComboBox {
+ property: "program";
+ selectedItem: {model.getProgram()};
+}
+
+#beginDateLabel {
+ text: "tutti.label.scientificCruise.beginDate";
+ labelFor: {beginDateField};
+}
+
+#beginDateField {
+ date: {model.getBeginDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#endDateLabel {
+ text: "tutti.label.scientificCruise.endDate";
+ labelFor: {endDateField};
+}
+
+#endDateField {
+ date: {model.getEndDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#pocheLabel {
+ text: "tutti.label.scientificCruise.poche";
+ labelFor: {pocheField};
+}
+
+#pocheField {
+ property: "poche";
+ model: {model.getPoche()};
+ useFloat: false;
+ numberPattern: {INT_1_DIGITS_PATTERN};
+}
+
+#vesselPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#vesselHeader {
+ labelText: {_("tutti.label.list.vessel")};
+ list: {vesselList};
+ beanType: {Vessel.class};
+}
+
+#gearPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#gearHeader {
+ labelText: {_("tutti.label.list.gear")};
+ list: {gearList};
+ beanType: {Gear.class};
+}
+
+#headOfMissionPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#headOfMissionHeader {
+ labelText: {_("tutti.label.list.headOfMission")};
+ list: {headOfMissionList};
+ beanType: {Person.class};
+}
+
+#headOfSortRoomPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#headOfSortRoomHeader {
+ labelText: {_("tutti.label.list.headOfSortRoom")};
+ list: {headOfSortRoomList};
+ beanType: {Person.class};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {model.getComment()};
+}
+
+#saveButton {
+ actionIcon: "save";
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+}
+
+#cancelButton {
+ actionIcon: "cancel";
+ text: "tutti.action.cancel";
+}
+
+#generateNameButton {
+ actionIcon: "generate";
+ text: "tutti.action.generateCampaignName";
+ enabled: {model.isCanGenerateName()};
+}
+#messagePanel {
+ border: {BorderFactory.createTitledBorder("Messages")};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,238 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditScientificCruiseUIModel, EditScientificCruiseUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.Program
+ fr.ifremer.tutti.persistence.entities.referential.Country
+ fr.ifremer.tutti.persistence.entities.referential.Gear
+ fr.ifremer.tutti.persistence.entities.referential.Person
+ fr.ifremer.tutti.persistence.entities.referential.Vessel
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.NumberEditor
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.swing.editor.bean.BeanListHeader
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXDatePicker
+
+ javax.swing.DefaultListModel
+ javax.swing.ListSelectionModel
+
+ java.awt.Dimension
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+ public EditScientificCruiseUI(TuttiUIContext context) {
+ EditScientificCruiseUIHandler handler = new EditScientificCruiseUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <EditScientificCruiseUIHandler id='handler'
+ initializer='getContextValue(EditScientificCruiseUIHandler.class)'/>
+
+ <EditScientificCruiseUIModel id='model'
+ initializer='getContextValue(EditScientificCruiseUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='program' component='surveyComboBox'/>
+ <field name='year' component='yearField'/>
+ <field name='surveyPart' component='surveyPartField'/>
+ <field name='name' component='nameField'/>
+ <field name='poche' component='pocheField'/>
+ <field name='country' component='countryComboBox'/>
+ <field name='beginDate' component='beginDateField'/>
+ <field name='endDate' component='endDateField'/>
+ <field name='vessel' component='vesselPane'/>
+ <field name='gear' component='gearPane'/>
+ <field name='headOfMission' component='headOfMissionPane'/>
+ <field name='headOfSortRoom' component='headOfSortRoomPane'/>
+ <field name='comment' component='commentField'/>
+ </BeanValidator>
+
+ <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
+ <Table fill='both'>
+
+ <!-- scientificCruise program / year /program part / name -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='programLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='surveyComboBox' constructorParams='this'
+ genericType='Program'/>
+ </cell>
+ <cell anchor='west'>
+ <JLabel id='yearLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='yearField' constructorParams='this'/>
+ </cell>
+ <cell>
+ <JLabel id='surveyPartLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JTextField id='surveyPartField'
+ onKeyReleased='handler.setText(event, "surveyPart")'/>
+ </cell>
+ </row>
+
+ <!-- scientificCruise name -->
+ <row>
+ <cell>
+ <JLabel id='nameLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JTextField id='nameField'
+ onKeyReleased='handler.setText(event, "name")'/>
+ </cell>
+ <cell columns='2'>
+ <JButton id='generateNameButton'
+ onActionPerformed='handler.generateCampaignName()'/>
+ </cell>
+ <cell>
+ <JLabel id='pocheLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <NumberEditor id='pocheField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- scientificCruise country / begin date / end date -->
+ <row>
+ <cell>
+ <JLabel id='countryLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <BeanComboBox id='countryComboBox' constructorParams='this'
+ genericType='Country'/>
+ </cell>
+ <cell>
+ <JLabel id='beginDateLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JXDatePicker id='beginDateField'
+ onActionPerformed='handler.setDate(event, "beginDate")'/>
+ </cell>
+ <cell>
+ <JLabel id='endDateLabel'/>
+ </cell>
+ <cell weightx='0.3'>
+ <JXDatePicker id='endDateField'
+ onActionPerformed='handler.setDate(event, "endDate")'/>
+ </cell>
+ </row>
+
+ <!-- scientificCruise vessel / gear -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JScrollPane id='vesselPane' columnHeaderView="{vesselHeader}"
+ onFocusGained='vesselList.requestFocus()'>
+ <JList id='vesselList'
+ onValueChanged='handler.selectListData(event, "vessel")'/>
+ <BeanListHeader id='vesselHeader' genericType='Vessel'/>
+ </JScrollPane>
+ <JScrollPane id='gearPane' columnHeaderView="{gearHeader}"
+ onFocusGained='gearList.requestFocus()'>
+ <JList id='gearList'
+ onValueChanged='handler.selectListData(event, "gear")'/>
+ <BeanListHeader id='gearHeader' genericType='Gear'/>
+ </JScrollPane>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- scientificCruise headOfMission / headOfSortRoom -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+
+ <JScrollPane id='headOfMissionPane'
+ columnHeaderView="{headOfMissionHeader}"
+ onFocusGained='headOfMissionList.requestFocus()'>
+ <JList id='headOfMissionList'
+ onValueChanged='handler.selectListData(event, "headOfMission")'/>
+ <BeanListHeader id='headOfMissionHeader'
+ genericType='Person'/>
+ </JScrollPane>
+ <JScrollPane id='headOfSortRoomPane'
+ columnHeaderView="{headOfSortRoomHeader}"
+ onFocusGained='headOfSortRoomList.requestFocus()'>
+ <JList id='headOfSortRoomList'
+ onValueChanged='handler.selectListData(event, "headOfSortRoom")'/>
+ <BeanListHeader id='headOfSortRoomHeader'
+ genericType='Person'/>
+ </JScrollPane>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- scientificCruise comment -->
+ <row weighty='0.3'>
+ <cell columns='6'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+
+ <!-- Form Actions -->
+ <row>
+ <cell columns='6'>
+ <JPanel layout='{new GridLayout(1, 0)}'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+
+ <JPanel id='messagePanel' layout='{new GridLayout()}'>
+ <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
+ <JTable id='errorTable' />
+ </JScrollPane>
+ </JPanel>
+ </JSplitPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,176 @@
+package fr.ifremer.tutti.ui.swing.content.campaign;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
+import jaxx.runtime.validator.swing.SwingValidatorUtil;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.List;
+
+/**
+ * Handler of UI {@link EditScientificCruiseUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditScientificCruiseUIHandler extends AbstractTuttiUIHandler<EditScientificCruiseUIModel> {
+
+ private final EditScientificCruiseUI ui;
+
+ private final PersistenceService persistenceService;
+
+ public EditScientificCruiseUIHandler(TuttiUIContext context, EditScientificCruiseUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ EditScientificCruiseUIModel model = new EditScientificCruiseUIModel();
+
+ String campaignId = context.getScientificCruiseId();
+ if (campaignId == null) {
+
+ // create new scientificCruise
+ Program program =
+ persistenceService.getProgram(context.getProgramId());
+ model.setProgram(program);
+ model.setPoche(1);
+ } else {
+
+ // load existing program
+ ScientificCruise scientificCruise =
+ persistenceService.getScientificCruise(campaignId);
+
+ model.fromBean(scientificCruise);
+ }
+ listModelIsModify(model);
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ initUI(ui);
+
+ List<Person> users = persistenceService.getAllPerson();
+
+ EditScientificCruiseUIModel model = ui.getModel();
+
+ initBeanComboBox(ui.getSurveyComboBox(),
+ persistenceService.getAllProgram(),
+ model.getProgram());
+
+ initBeanComboBox(ui.getCountryComboBox(),
+ persistenceService.getAllCountry(),
+ model.getCountry());
+
+ initBeanList(ui.getVesselHeader(),
+ persistenceService.getAllVessel(),
+ model.getVessel());
+
+ initBeanList(ui.getGearHeader(),
+ persistenceService.getAllGear(),
+ model.getGear());
+
+ initBeanList(ui.getHeadOfMissionHeader(),
+ users,
+ model.getHeadOfMission());
+
+ initBeanList(ui.getHeadOfSortRoomHeader(),
+ users,
+ model.getHeadOfSortRoom());
+
+ SwingValidatorUtil.installUI(ui.getErrorTable(),
+ new SwingValidatorMessageTableRenderer());
+
+ listenValidatorValid(ui.getValidator(), model);
+
+ // if new fishingOperation can already cancel his creation
+ model.setModify(model.isCreate());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected EditScientificCruiseUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void cancel() {
+
+ context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
+ }
+
+ public void save() {
+
+ EditScientificCruiseUIModel model = ui.getModel();
+
+ ScientificCruise bean = model.toBean();
+
+ ScientificCruise saved;
+ if (TuttiEntities.isNew(bean)) {
+
+ saved = persistenceService.createScientificCruise(bean);
+ } else {
+ saved = persistenceService.saveScientificCruise(bean);
+ }
+
+ context.setProgramId(saved.getProgram().getId());
+ context.setScientificCruiseId(saved.getId());
+
+ context.setScreen(TuttiScreen.SELECT_SCIENTIFIC_CRUISE);
+ }
+
+ public static final String scientificCruiseNameFormat = "%1$s_%2$s";
+
+ public void generateCampaignName() {
+
+ EditScientificCruiseUIModel model = getModel();
+ Program program = model.getProgram();
+ Integer year = model.getYear();
+ String name = String.format(scientificCruiseNameFormat, program.getName(), year);
+
+ String surveyPart = model.getSurveyPart();
+ if (StringUtils.isNotEmpty(surveyPart)) {
+ name += "_" + surveyPart;
+ }
+ model.setName(name);
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,247 @@
+package fr.ifremer.tutti.ui.swing.content.campaign;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.referential.Country;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Model of UI {@link EditScientificCruiseUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EditScientificCruiseUIModel extends AbstractTuttiBeanUIModel<ScientificCruise, EditScientificCruiseUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_PROGRAM = "program";
+
+ public static final String PROPERTY_NAME = "name";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_COUNTRY = "country";
+
+ public static final String PROPERTY_SURVEY_PART = "surveyPart";
+
+ public static final String PROPERTY_VESSEL = "vessel";
+
+ public static final String PROPERTY_GEAR = "gear";
+
+ public static final String PROPERTY_HEAD_OF_MISSION = "headOfMission";
+
+ public static final String PROPERTY_HEAD_OF_SORT_ROOM = "headOfSortRoom";
+
+ public static final String PROPERTY_YEAR = "year";
+
+ public static final String PROPERTY_POCHE = "poche";
+
+ public static final String PROPERTY_BEGIN_DATE = "beginDate";
+
+ public static final String PROPERTY_END_DATE = "endDate";
+
+ public static final String PROPERTY_CAN_GENERATE_NAME = "canGenerateName";
+
+ protected Program program;
+
+ protected Country country;
+
+ protected String name;
+
+ protected String surveyPart;
+
+ protected List<Vessel> vessel;
+
+ protected List<Gear> gear;
+
+ protected List<Person> headOfMission;
+
+ protected List<Person> headOfSortRoom;
+
+ protected String comment;
+
+ protected Integer year;
+
+ protected Integer poche;
+
+ protected Date beginDate;
+
+ protected Date endDate;
+
+ protected static Binder<EditScientificCruiseUIModel, ScientificCruise> toBeanBinder =
+ BinderFactory.newBinder(EditScientificCruiseUIModel.class,
+ ScientificCruise.class);
+
+ protected static Binder<ScientificCruise, EditScientificCruiseUIModel> fromBeanBinder =
+ BinderFactory.newBinder(ScientificCruise.class, EditScientificCruiseUIModel.class);
+
+ public EditScientificCruiseUIModel() {
+ super(ScientificCruise.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public Program getProgram() {
+ return program;
+ }
+
+ public void setProgram(Program program) {
+ Object oldValue = getProgram();
+ this.program = program;
+ firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
+ firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ Object oldValue = getName();
+ this.name = name;
+ firePropertyChange(PROPERTY_NAME, oldValue, name);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public Country getCountry() {
+ return country;
+ }
+
+ public void setCountry(Country country) {
+ Object oldValue = getCountry();
+ this.country = country;
+ firePropertyChange(PROPERTY_COUNTRY, oldValue, country);
+ }
+
+ public String getSurveyPart() {
+ return surveyPart;
+ }
+
+ public void setSurveyPart(String surveyPart) {
+ Object oldValue = getSurveyPart();
+ this.surveyPart = surveyPart;
+ firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart);
+ }
+
+ public Integer getYear() {
+ return year;
+ }
+
+ public void setYear(Integer year) {
+ Object oldValue = getYear();
+ this.year = year;
+ firePropertyChange(PROPERTY_YEAR, oldValue, year);
+ firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
+ }
+
+ public Integer getPoche() {
+ return poche;
+ }
+
+ public void setPoche(Integer poche) {
+ Object oldValue = getPoche();
+ this.poche = poche;
+ firePropertyChange(PROPERTY_POCHE, oldValue, poche);
+ }
+
+ public Date getBeginDate() {
+ return beginDate;
+ }
+
+ public void setBeginDate(Date beginDate) {
+ Object oldValue = getBeginDate();
+ this.beginDate = beginDate;
+ firePropertyChange(PROPERTY_BEGIN_DATE, oldValue, beginDate);
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public void setEndDate(Date endDate) {
+ Object oldValue = getEndDate();
+ this.endDate = endDate;
+ firePropertyChange(PROPERTY_END_DATE, oldValue, endDate);
+ }
+
+ public List<Vessel> getVessel() {
+ return vessel;
+ }
+
+ public void setVessel(List<Vessel> vessel) {
+ this.vessel = vessel;
+ firePropertyChange(PROPERTY_VESSEL, null, vessel);
+ }
+
+ public List<Gear> getGear() {
+ return gear;
+ }
+
+ public void setGear(List<Gear> gear) {
+ this.gear = gear;
+ firePropertyChange(PROPERTY_GEAR, null, gear);
+ }
+
+ public List<Person> getHeadOfMission() {
+ return headOfMission;
+ }
+
+ public void setHeadOfMission(List<Person> headOfMission) {
+ this.headOfMission = headOfMission;
+ firePropertyChange(PROPERTY_HEAD_OF_MISSION, null, headOfMission);
+ }
+
+ public List<Person> getHeadOfSortRoom() {
+ return headOfSortRoom;
+ }
+
+ public void setHeadOfSortRoom(List<Person> headOfSortRoom) {
+ this.headOfSortRoom = headOfSortRoom;
+ firePropertyChange(PROPERTY_HEAD_OF_SORT_ROOM, null, headOfSortRoom);
+ }
+
+ public boolean isCanGenerateName() {
+ return program != null && year != null;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.css 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,94 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-BeanComboBox {
- showReset:true;
- i18nPrefix:"tutti.property.";
- bean:{model};
-}
-
-#splitPane {
- orientation:{JSplitPane.VERTICAL_SPLIT};
- resizeWeight:0.3;
- oneTouchExpandable:true;
- continuousLayout:true;
-}
-
-#form {
- border:{BorderFactory.createTitledBorder((String)null)};
-}
-
-#nameLabel {
- text:"tutti.label.survey.name";
- labelFor:{nameField};
-}
-
-#nameField {
- text:{model.getName()};
-}
-
-#commentPane {
- columnHeaderView:{new JLabel(_("tutti.label.comment"))};
- minimumSize:{new Dimension(10,50)};
-}
-
-#commentField {
- text:{getStringValue(model.getComment())};
-}
-
-#zoneLabel {
- text:"tutti.label.survey.zone";
- labelFor:{zoneComboBox};
-}
-
-#zoneComboBox {
- property:"zone";
- selectedItem:{model.getZone()};
-}
-
-#saveButton {
- text:"tutti.action.save";
- enabled:{model.isModify() && model.isValid()};
- actionIcon:"save";
-}
-
-#cancelButton {
- text:"tutti.action.cancel";
- actionIcon:"cancel";
-}
-
-#messagePanel {
- border:{BorderFactory.createTitledBorder("Messages")};
- height:200;
- width:500;
-}
-
-#errorTable {
- rowSelectionAllowed:true;
- autoCreateRowSorter:true;
- autoResizeMode:2;
- cellSelectionEnabled:false;
- selectionMode:0;
- model:{errorTableModel};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,125 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<EditSurveyUIModel, EditSurveyUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.Zone
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- java.awt.Dimension
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
-
- </import>
-
- <script><![CDATA[
-
- public EditSurveyUI(TuttiUIContext context) {
- EditSurveyUIHandler handler = new EditSurveyUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
- <EditSurveyUIHandler id='handler'
- initializer='getContextValue(EditSurveyUIHandler.class)'/>
-
- <EditSurveyUIModel id='model'
- initializer='getContextValue(EditSurveyUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='name' component='nameField'/>
- <field name='zone' component='zoneComboBox'/>
- <field name='comment' component='commentField'/>
- </BeanValidator>
-
- <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'>
-
- <Table id='form' fill='both'>
-
- <!-- survey name -->
- <row>
- <cell anchor='west'>
- <JLabel id='nameLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JTextField id='nameField'
- onKeyReleased='handler.setText(event, "name")'/>
- </cell>
- </row>
-
- <!-- survey zone -->
- <row>
- <cell>
- <JLabel id='zoneLabel'/>
- </cell>
- <cell>
- <BeanComboBox id='zoneComboBox' constructorParams='this'
- genericType='Zone'/>
- </cell>
- </row>
-
- <!-- survey comment -->
- <row weighty='0.8'>
- <cell columns='2'>
- <JScrollPane id='commentPane'
- onFocusGained='commentField.requestFocus()'>
- <JTextArea id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </cell>
- </row>
-
- <!-- actions -->
- <row anchor='south'>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1, 0)}'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
- </JPanel>
- </cell>
- </row>
- </Table>
-
- <!-- validation messages -->
- <JPanel id='messagePanel' layout='{new GridLayout()}'>
- <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'>
- <JTable id='errorTable' />
- </JScrollPane>
- </JPanel>
- </JSplitPane>
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,134 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.Survey;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer;
-import jaxx.runtime.validator.swing.SwingValidatorUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Handler of UI {@link EditSurveyUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EditSurveyUIHandler extends AbstractTuttiUIHandler<EditSurveyUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(EditSurveyUIHandler.class);
-
- private final EditSurveyUI ui;
-
- private final PersistenceService persistenceService;
-
- public EditSurveyUIHandler(TuttiUIContext context, EditSurveyUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- EditSurveyUIModel model = new EditSurveyUIModel();
-
- String surveyId = context.getSurveyId();
- if (surveyId == null) {
-
- if (log.isInfoEnabled()) {
- log.info("Edit new survey");
- }
- } else {
-
- if (log.isInfoEnabled()) {
- log.info("Edit existing survey " + surveyId);
- }
- // load existing survey
- Survey survey = persistenceService.getSurvey(surveyId);
-
- model.fromBean(survey);
- }
-
- listModelIsModify(model);
-
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- EditSurveyUIModel model = ui.getModel();
- initBeanComboBox(ui.getZoneComboBox(),
- persistenceService.getAllZone(),
- model.getZone());
-
- SwingValidatorUtil.installUI(ui.getErrorTable(),
- new SwingValidatorMessageTableRenderer());
-
- listenValidatorValid(ui.getValidator(), model);
-
- // if new survey can already cancel his creation
- model.setModify(model.isCreate());
- }
-
- @Override
- public void onCloseUI() {
- ui.getValidator().setBean(null);
- }
-
- @Override
- protected EditSurveyUIModel getModel() {
- return ui.getModel();
- }
-
- public void cancel() {
- context.setScreen(TuttiScreen.SELECT_CAMPAIGN);
- }
-
- public void save() {
-
- EditSurveyUIModel model = ui.getModel();
-
- Survey bean = model.toBean();
-
- Survey saved;
- if (TuttiEntities.isNew(bean)) {
-
- saved = persistenceService.createSurvey(bean);
- } else {
- saved = persistenceService.saveSurvey(bean);
- }
-
- context.setSurveyId(saved.getId());
- context.setScreen(TuttiScreen.SELECT_CAMPAIGN);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,97 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.Survey;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-/**
- * Bean to edit a survey.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EditSurveyUIModel extends AbstractTuttiBeanUIModel<Survey, EditSurveyUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_ZONE = "zone";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_NAME = "name";
-
- protected String name;
-
- protected String comment;
-
- protected Zone zone;
-
- protected static Binder<EditSurveyUIModel, Survey> toBeanBinder =
- BinderFactory.newBinder(EditSurveyUIModel.class,
- Survey.class);
-
- protected static Binder<Survey, EditSurveyUIModel> fromBeanBinder =
- BinderFactory.newBinder(Survey.class, EditSurveyUIModel.class);
-
-
- public EditSurveyUIModel() {
- super(Survey.class, fromBeanBinder, toBeanBinder);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- Object oldValue = getName();
- this.name = name;
- firePropertyChange(PROPERTY_NAME, oldValue, name);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public Zone getZone() {
- return zone;
- }
-
- public void setZone(Zone zone) {
- Object oldValue = getZone();
- this.zone = zone;
- firePropertyChange(PROPERTY_ZONE, oldValue, zone);
- }
-
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.css 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,77 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-BeanComboBox {
- showReset:true;
- i18nPrefix:"tutti.property.";
- bean:{model};
-}
-
-#surveyLabel {
- text: "tutti.label.survey";
-}
-
-#surveyCombobox {
- property:"survey";
- selectedItem:{model.getSurvey()};
-}
-
-#editSurveyButton {
- enabled: {model.isSurveyFound()};
- text: "tutti.action.edit";
- actionIcon:"edit";
-}
-
-#newSurveyButton {
- text: "tutti.action.new";
- actionIcon:"add";
-}
-
-#campaignLabel {
- text: "tutti.label.campaign";
- labelFor:{campaignCombobox};
-}
-
-#campaignCombobox {
- property:"campaign";
- enabled: {model.isSurveyFound()};
- selectedItem:{model.getCampaign()};
-}
-
-#editCampaignButton {
- enabled: {model.isSurveyFound() && model.isCampaignFound()};
- text: "tutti.action.edit";
- actionIcon:"edit";
-}
-
-#newCampaignButton {
- actionIcon:"add";
- enabled: {model.isSurveyFound()};
- text: "tutti.action.new";
-}
-
-#showCatchesButton {
- text: "tutti.action.catches";
- enabled: {uiContext.isCampaignContextFilled()};
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,104 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<SelectCampaignUIModel, SelectCampaignUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.Survey
- fr.ifremer.tutti.persistence.entities.data.Campaign
- fr.ifremer.tutti.persistence.entities.data.Trait
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-
- protected TuttiUIContext uiContext;
-
- public SelectCampaignUI(TuttiUIContext context) {
- this.uiContext = context;
- SelectCampaignUIHandler handler = new SelectCampaignUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
- <SelectCampaignUIHandler id='handler'
- initializer='getContextValue(SelectCampaignUIHandler.class)'/>
-
- <SelectCampaignUIModel id='model'
- initializer='getContextValue(SelectCampaignUIModel.class)'/>
-
- <Table fill='both' constraints='BorderLayout.CENTER'>
- <row>
- <cell anchor='west'>
- <JLabel id='surveyLabel'/>
- </cell>
- <cell weightx='1.0'>
- <BeanComboBox id='surveyCombobox' constructorParams='this'
- genericType='Survey'/>
- </cell>
- <cell>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='editSurveyButton'
- onActionPerformed='handler.showSelectedSurvey()'/>
- <JButton id='newSurveyButton'
- onActionPerformed='handler.showNewSurvey()'/>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel id='campaignLabel'/>
- </cell>
- <cell>
- <BeanComboBox id='campaignCombobox' constructorParams='this'
- genericType='Campaign'/>
- </cell>
- <cell>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JButton id='editCampaignButton'
- onActionPerformed='handler.showSelectedCampaign()'/>
- <JButton id='newCampaignButton'
- onActionPerformed='handler.showNewCampaign()'/>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell columns='3'>
- <!--JPanel layout='{new GridLayout(1,0)}'-->
- <JButton id='showCatchesButton'
- onActionPerformed='handler.showCatches()'/>
- <!--/JPanel-->
- </cell>
- </row>
- </Table>
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,201 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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 com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Campaign;
-import fr.ifremer.tutti.persistence.entities.data.Survey;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.swing.editor.bean.BeanComboBox;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-/**
- * Main ui content to select campaign.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SelectCampaignUIHandler extends AbstractTuttiUIHandler<SelectCampaignUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(SelectCampaignUIHandler.class);
-
- protected final PersistenceService persistenceService;
-
- protected final SelectCampaignUI ui;
-
- public SelectCampaignUIHandler(TuttiUIContext context, SelectCampaignUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- protected SelectCampaignUIModel getModel() {
- return ui.getModel();
- }
-
- @Override
- public void beforeInitUI() {
- SelectCampaignUIModel model = new SelectCampaignUIModel();
-
- List<Survey> allSurveys = persistenceService.getAllSurvey();
-
- model.setSurveys(allSurveys);
-
- if (allSurveys.isEmpty()) {
- // do nothing
-
- } else {
-
- // get selected survey (if any)
-
- String surveyId = context.getSurveyId();
- Survey selectedSurvey = null;
- List<Campaign> allCampaigns = null;
- if (surveyId != null) {
- selectedSurvey = TuttiEntities.findById(allSurveys, surveyId);
- allCampaigns = persistenceService.getAllCampaign(surveyId);
- }
-
- model.setSurvey(selectedSurvey);
- model.setCampaigns(allCampaigns);
-
- if (CollectionUtils.isEmpty(allCampaigns)) {
-
- // nothing to select
- } else {
- String campaignId = context.getCampaignId();
-
- Campaign selectedCampaign = null;
- if (campaignId != null) {
- selectedCampaign =
- TuttiEntities.findById(allCampaigns, campaignId);
- }
- model.setCampaign(selectedCampaign);
- }
- }
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- SelectCampaignUIModel model = ui.getModel();
-
- initBeanComboBox(ui.getSurveyCombobox(),
- model.getSurveys(),
- model.getSurvey());
-
- initBeanComboBox(ui.getCampaignCombobox(),
- model.getCampaigns(),
- model.getCampaign());
-
- model.addPropertyChangeListener("survey", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- Survey newValue = (Survey) evt.getNewValue();
- boolean noSurvey = newValue == null;
- context.setSurveyId(noSurvey ? null : newValue.getId());
- List<Campaign> campaigns;
- if (noSurvey) {
- campaigns = Lists.newArrayList();
- } else {
- campaigns = persistenceService.getAllCampaign(newValue.getId());
- }
- SelectCampaignUIModel model = (SelectCampaignUIModel) evt.getSource();
- model.setCampaigns(campaigns);
- model.setCampaign(null);
- }
- });
-
- model.addPropertyChangeListener("campaigns", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- // reload combo box
- BeanComboBox<Campaign> combobox = ui.getCampaignCombobox();
- List<Campaign> campaigns = (List<Campaign>) evt.getNewValue();
- combobox.setData(null);
- combobox.setData(campaigns);
- }
- });
-
- model.addPropertyChangeListener("campaign", new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- Campaign newValue = (Campaign) evt.getNewValue();
- context.setCampaignId(newValue == null ? null : newValue.getId());
- }
- });
- }
-
- @Override
- public void onCloseUI() {
- PropertyChangeListener[] listeners = ui.getModel().getPropertyChangeListeners();
- for (PropertyChangeListener listener : listeners) {
- getModel().removePropertyChangeListener(listener);
- }
- }
-
- public void showCatches() {
-
- context.setScreen(TuttiScreen.FILL_CATCHES);
- }
-
- public void showSelectedSurvey() {
-
- Survey survey = getModel().getSurvey();
- context.setSurveyId(survey.getId());
- context.setScreen(TuttiScreen.EDIT_SURVEY);
- }
-
- public void showNewSurvey() {
- context.setSurveyId(null);
- context.setCampaignId(null);
- context.setScreen(TuttiScreen.EDIT_SURVEY);
- }
-
- public void showSelectedCampaign() {
- Campaign campaign = getModel().getCampaign();
- context.setCampaignId(campaign.getId());
- context.setScreen(TuttiScreen.EDIT_CAMPAIGN);
- }
-
- public void showNewCampaign() {
- context.setCampaignId(null);
- context.setScreen(TuttiScreen.EDIT_CAMPAIGN);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,123 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.campaign;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.Campaign;
-import fr.ifremer.tutti.persistence.entities.data.Survey;
-import org.jdesktop.beans.AbstractSerializableBean;
-
-import java.util.List;
-
-/**
- * Model of ui {@link SelectCampaignUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class SelectCampaignUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_SURVEYS = "surveys";
-
- public static final String PROPERTY_SURVEY = "survey";
-
- public static final String PROPERTY_CAMPAIGNS = "campaigns";
-
- public static final String PROPERTY_CAMPAIGN = "campaign";
-
- public static final String PROPERTY_SURVEY_FOUND = "surveyFound";
-
- public static final String PROPERTY_CAMPAIGN_FOUND = "campaignFound";
-
- protected List<Survey> surveys;
-
- protected Survey survey;
-
- protected List<Campaign> campaigns;
-
- protected Campaign campaign;
-
- public List<Survey> getSurveys() {
- return surveys;
- }
-
- public void setSurveys(List<Survey> surveys) {
- Object oldValue = getSurveys();
- this.surveys = surveys;
-
- // nullify survey
-// setSurvey(null);
- firePropertyChange(PROPERTY_SURVEYS, oldValue, surveys);
- }
-
- public Survey getSurvey() {
- return survey;
- }
-
- public void setSurvey(Survey survey) {
- Survey oldValue = getSurvey();
- this.survey = survey;
-
- // nullify campaigns
-// setCampaigns(null);
-
- firePropertyChange(PROPERTY_SURVEY, oldValue, survey);
- firePropertyChange(PROPERTY_SURVEY_FOUND, oldValue != null, survey != null);
- }
-
- public boolean isSurveyFound() {
- return survey != null;
- }
-
- public List<Campaign> getCampaigns() {
- return campaigns;
- }
-
- public void setCampaigns(List<Campaign> campaigns) {
- Object oldValue = getCampaigns();
- this.campaigns = campaigns;
-
- // nullify campaign
-// setCampaign(null);
- firePropertyChange(PROPERTY_CAMPAIGNS, oldValue, campaigns);
- }
-
- public Campaign getCampaign() {
- return campaign;
- }
-
- public void setCampaign(Campaign campaign) {
- Campaign oldValue = getCampaign();
- this.campaign = campaign;
- firePropertyChange(PROPERTY_CAMPAIGN, oldValue, campaign);
- firePropertyChange(PROPERTY_CAMPAIGN_FOUND, oldValue != null, campaign != null);
- }
-
- public boolean isCampaignFound() {
- return campaign != null;
- }
-
-}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,77 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+#programLabel {
+ text: "tutti.label.program";
+}
+
+#programCombobox {
+ property: "program";
+ selectedItem: {model.getProgram()};
+}
+
+#editProgramButton {
+ enabled: {model.isProgramFound()};
+ text: "tutti.action.edit";
+ actionIcon: "edit";
+}
+
+#newProgramButton {
+ text: "tutti.action.new";
+ actionIcon: "add";
+}
+
+#scientificCruiseLabel {
+ text: "tutti.label.scientificCruise";
+ labelFor: {scientificCruiseCombobox};
+}
+
+#scientificCruiseCombobox {
+ property: "scientificCruise";
+ enabled: {model.isProgramFound()};
+ selectedItem: {model.getScientificCruise()};
+}
+
+#editScientificCruiseButton {
+ enabled: {model.isProgramFound() && model.isScientificCruiseFound()};
+ text: "tutti.action.edit";
+ actionIcon: "edit";
+}
+
+#newScientificCruiseButton {
+ actionIcon: "add";
+ enabled: {model.isProgramFound()};
+ text: "tutti.action.new";
+}
+
+#showFishingOperationsButton {
+ text: "tutti.action.catches";
+ enabled: {uiContext.isScientificCruiseContextFilled()};
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,102 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<SelectScientificCruiseUIModel, SelectScientificCruiseUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.Program
+ fr.ifremer.tutti.persistence.entities.data.ScientificCruise
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+
+ protected TuttiUIContext uiContext;
+
+ public SelectScientificCruiseUI(TuttiUIContext context) {
+ this.uiContext = context;
+ SelectScientificCruiseUIHandler handler =
+ new SelectScientificCruiseUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+ }
+
+ protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+ }
+ ]]></script>
+
+ <SelectScientificCruiseUIHandler id='handler'
+ initializer='getContextValue(SelectScientificCruiseUIHandler.class)'/>
+
+ <SelectScientificCruiseUIModel id='model'
+ initializer='getContextValue(SelectScientificCruiseUIModel.class)'/>
+
+ <Table fill='both' constraints='BorderLayout.CENTER'>
+ <row>
+ <cell anchor='west'>
+ <JLabel id='programLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <BeanComboBox id='programCombobox' constructorParams='this'
+ genericType='Program'/>
+ </cell>
+ <cell>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='editProgramButton'
+ onActionPerformed='handler.showSelectedProgram()'/>
+ <JButton id='newProgramButton'
+ onActionPerformed='handler.showNewProgram()'/>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel id='scientificCruiseLabel'/>
+ </cell>
+ <cell>
+ <BeanComboBox id='scientificCruiseCombobox' constructorParams='this'
+ genericType='ScientificCruise'/>
+ </cell>
+ <cell>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='editScientificCruiseButton'
+ onActionPerformed='handler.showSelectedScientificCruise()'/>
+ <JButton id='newScientificCruiseButton'
+ onActionPerformed='handler.showNewScientificCruise()'/>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell columns='3'>
+ <JButton id='showFishingOperationsButton'
+ onActionPerformed='handler.showFishingOperations()'/>
+ </cell>
+ </row>
+ </Table>
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,204 @@
+package fr.ifremer.tutti.ui.swing.content.campaign;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.swing.editor.bean.BeanComboBox;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+/**
+ * Main ui content to select scientificCruise.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SelectScientificCruiseUIHandler extends AbstractTuttiUIHandler<SelectScientificCruiseUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SelectScientificCruiseUIHandler.class);
+
+ protected final PersistenceService persistenceService;
+
+ protected final SelectScientificCruiseUI ui;
+
+ public SelectScientificCruiseUIHandler(TuttiUIContext context, SelectScientificCruiseUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ protected SelectScientificCruiseUIModel getModel() {
+ return ui.getModel();
+ }
+
+ @Override
+ public void beforeInitUI() {
+ SelectScientificCruiseUIModel model = new SelectScientificCruiseUIModel();
+
+ List<Program> allPrograms = persistenceService.getAllProgram();
+
+ model.setPrograms(allPrograms);
+
+ if (allPrograms.isEmpty()) {
+ // do nothing
+
+ if (log.isDebugEnabled()) {
+ log.debug("No program found.");
+ }
+ } else {
+
+ // get selected program (if any)
+
+ String surveyId = context.getProgramId();
+ Program selectedProgram = null;
+ List<ScientificCruise> allScientificCruises = null;
+ if (surveyId != null) {
+ selectedProgram = TuttiEntities.findById(allPrograms, surveyId);
+ allScientificCruises = persistenceService.getAllScientificCruise(surveyId);
+ }
+
+ model.setProgram(selectedProgram);
+ model.setScientificCruises(allScientificCruises);
+
+ if (CollectionUtils.isEmpty(allScientificCruises)) {
+
+ // nothing to select
+ } else {
+ String campaignId = context.getScientificCruiseId();
+
+ ScientificCruise selectedCampaign = null;
+ if (campaignId != null) {
+ selectedCampaign =
+ TuttiEntities.findById(allScientificCruises, campaignId);
+ }
+ model.setScientificCruise(selectedCampaign);
+ }
+ }
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ SelectScientificCruiseUIModel model = ui.getModel();
+
+ initBeanComboBox(ui.getProgramCombobox(),
+ model.getPrograms(),
+ model.getProgram());
+
+ initBeanComboBox(ui.getScientificCruiseCombobox(),
+ model.getScientificCruises(),
+ model.getScientificCruise());
+
+ model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_PROGRAM, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Program newValue = (Program) evt.getNewValue();
+ boolean noSurvey = newValue == null;
+ context.setProgramId(noSurvey ? null : newValue.getId());
+ List<ScientificCruise> campaigns;
+ if (noSurvey) {
+ campaigns = Lists.newArrayList();
+ } else {
+ campaigns = persistenceService.getAllScientificCruise(newValue.getId());
+ }
+ SelectScientificCruiseUIModel model = (SelectScientificCruiseUIModel) evt.getSource();
+ model.setScientificCruises(campaigns);
+ model.setScientificCruise(null);
+ }
+ });
+
+ model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_SCIENTIFIC_CRUISES, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ // reload combo box
+ BeanComboBox<ScientificCruise> combobox = ui.getScientificCruiseCombobox();
+ List<ScientificCruise> campaigns = (List<ScientificCruise>) evt.getNewValue();
+ combobox.setData(null);
+ combobox.setData(campaigns);
+ }
+ });
+
+ model.addPropertyChangeListener(SelectScientificCruiseUIModel.PROPERTY_SCIENTIFIC_CRUISE, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ ScientificCruise newValue = (ScientificCruise) evt.getNewValue();
+ context.setScientificCruiseId(newValue == null ? null : newValue.getId());
+ }
+ });
+ }
+
+ @Override
+ public void onCloseUI() {
+ PropertyChangeListener[] listeners = ui.getModel().getPropertyChangeListeners();
+ for (PropertyChangeListener listener : listeners) {
+ getModel().removePropertyChangeListener(listener);
+ }
+ }
+
+ public void showFishingOperations() {
+
+ context.setScreen(TuttiScreen.FILL_FISHING_OPERATION);
+ }
+
+ public void showSelectedProgram() {
+
+ Program program = getModel().getProgram();
+ context.setProgramId(program.getId());
+ context.setScreen(TuttiScreen.EDIT_PROGRAM);
+ }
+
+ public void showNewProgram() {
+ context.setProgramId(null);
+ context.setScientificCruiseId(null);
+ context.setScreen(TuttiScreen.EDIT_PROGRAM);
+ }
+
+ public void showSelectedScientificCruise() {
+ ScientificCruise scientificCruise = getModel().getScientificCruise();
+ context.setScientificCruiseId(scientificCruise.getId());
+ context.setScreen(TuttiScreen.EDIT_SCIENTIFIC_CRUISE);
+ }
+
+ public void showNewScientificCruise() {
+ context.setScientificCruiseId(null);
+ context.setScreen(TuttiScreen.EDIT_SCIENTIFIC_CRUISE);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectCampaignUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,123 @@
+package fr.ifremer.tutti.ui.swing.content.campaign;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import org.jdesktop.beans.AbstractSerializableBean;
+
+import java.util.List;
+
+/**
+ * Model of ui {@link SelectScientificCruiseUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class SelectScientificCruiseUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_PROGRAMS = "programs";
+
+ public static final String PROPERTY_PROGRAM = "program";
+
+ public static final String PROPERTY_SCIENTIFIC_CRUISES = "scientificCruises";
+
+ public static final String PROPERTY_SCIENTIFIC_CRUISE = "scientificCruise";
+
+ public static final String PROPERTY_PROGRAM_FOUND = "programFound";
+
+ public static final String PROPERTY_SCIENTIFIC_CRUISE_FOUND = "scientificCruiseFound";
+
+ protected List<Program> programs;
+
+ protected Program program;
+
+ protected List<ScientificCruise> scientificCruises;
+
+ protected ScientificCruise scientificCruise;
+
+ public List<Program> getPrograms() {
+ return programs;
+ }
+
+ public void setPrograms(List<Program> programs) {
+ Object oldValue = getPrograms();
+ this.programs = programs;
+
+ // nullify program
+// setProgram(null);
+ firePropertyChange(PROPERTY_PROGRAMS, oldValue, programs);
+ }
+
+ public Program getProgram() {
+ return program;
+ }
+
+ public void setProgram(Program program) {
+ Program oldValue = getProgram();
+ this.program = program;
+
+ // nullify scientificCruises
+// setScientificCruises(null);
+
+ firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
+ firePropertyChange(PROPERTY_PROGRAM_FOUND, oldValue != null, program != null);
+ }
+
+ public boolean isProgramFound() {
+ return program != null;
+ }
+
+ public List<ScientificCruise> getScientificCruises() {
+ return scientificCruises;
+ }
+
+ public void setScientificCruises(List<ScientificCruise> scientificCruises) {
+ Object oldValue = getScientificCruises();
+ this.scientificCruises = scientificCruises;
+
+ // nullify scientificCruise
+// setScientificCruise(null);
+ firePropertyChange(PROPERTY_SCIENTIFIC_CRUISES, oldValue, scientificCruises);
+ }
+
+ public ScientificCruise getScientificCruise() {
+ return scientificCruise;
+ }
+
+ public void setScientificCruise(ScientificCruise scientificCruise) {
+ ScientificCruise oldValue = getScientificCruise();
+ this.scientificCruise = scientificCruise;
+ firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE, oldValue, scientificCruise);
+ firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE_FOUND, oldValue != null, scientificCruise != null);
+ }
+
+ public boolean isScientificCruiseFound() {
+ return scientificCruise != null;
+ }
+
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/campaign/SelectScientificCruiseUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,64 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-BeanComboBox {
- showReset:true;
- i18nPrefix:"tutti.property.";
- bean:{model};
-}
-
-#newTraitButton {
- text:"tutti.action.new";
- actionIcon:"add";
-}
-
-#traitComboBox {
- property:"selectedTrait";
- selectedItem:{model.getSelectedTrait()};
-}
-
-#speciesTab {
- enabled:{model.getSelectedTrait() != null};
-}
-
-#benthosTab {
- enabled:{model.getSelectedTrait() != null};
-}
-
-#planctonTab {
- enabled:{model.getSelectedTrait() != null};
-}
-
-#macroDechetTab {
- enabled:{model.getSelectedTrait() != null};
-}
-
-#accidentelTab {
- enabled:{model.getSelectedTrait() != null};
-}
-
-#observationIndividuelTab {
- enabled:{false};
- /*enabled:{model.getSelectedTrait() != null};*/
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,99 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<CatchesUIModel, CatchesUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.data.Trait
-
- fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.accidentel.AccidentelTabUI
- fr.ifremer.tutti.ui.swing.content.catches.benthos.BenthosTabUI
- fr.ifremer.tutti.ui.swing.content.catches.macrodechet.MacroDechetTabUI
- fr.ifremer.tutti.ui.swing.content.catches.plancton.PlanctonTabUI
- fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTabUI
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
-
- static org.nuiton.i18n.I18n._
- </import>
-
- <script><![CDATA[
-public CatchesUI(TuttiUIContext context) {
- CatchesUIHandler handler = new CatchesUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-protected void $afterCompleteSetup() {
- handler.afterInitUI();
-}
- ]]></script>
-
- <CatchesUIHandler id='handler'
- initializer='getContextValue(CatchesUIHandler.class)'/>
-
- <CatchesUIModel id='model'
- initializer='getContextValue(CatchesUIModel.class)'/>
-
- <Table fill='both' id='topPanel' constraints='BorderLayout.NORTH'>
-
- <!-- catches trait -->
- <row>
- <cell anchor='west' weightx='1.0'>
- <BeanComboBox id='traitComboBox' constructorParams='this'
- genericType='Trait'/>
- </cell>
- <cell anchor='east'>
- <JButton id='newTraitButton'
- onActionPerformed='getHandler().createNewTrait()'/>
- </cell>
- </row>
- </Table>
-
- <JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'>
- <tab id='traitTab' title='tutti.label.tab.trait'>
- <TraitTabUI id='traitTabContent' constructorParams='this'/>
- </tab>
- <tab id='speciesTab' title='tutti.label.tab.species'>
- <SpeciesTabUI id='speciesTabContent' constructorParams='this'/>
- </tab>
- <tab id='benthosTab' title='tutti.label.tab.benthos'>
- <BenthosTabUI id='benthosTabContent' constructorParams='this'/>
- </tab>
- <tab id='planctonTab' title='tutti.label.tab.plancton'>
- <PlanctonTabUI id='planctonTabContent' constructorParams='this'/>
- </tab>
- <tab id='macroDechetTab' title='tutti.label.tab.macroDechet'>
- <MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/>
- </tab>
- <tab id='accidentelTab' title='tutti.label.tab.accidentel'>
- <AccidentelTabUI id='accidentelTabContent' constructorParams='this'/>
- </tab>
- <tab id='observationIndividuelTab' title='tutti.label.tab.observationIndividuel'>
- <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
- </tab>
- </JTabbedPane>
-
-</JPanel>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,200 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.Campaign;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Date;
-import java.util.List;
-
-/**
- * Handler of UI {@link CatchesUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class CatchesUIHandler extends AbstractTuttiUIHandler<CatchesUIModel> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(CatchesUIHandler.class);
-
- private final CatchesUI ui;
-
- private final PersistenceService persistenceService;
-
- public CatchesUIHandler(TuttiUIContext context, CatchesUI ui) {
- super(context);
- this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- CatchesUIModel model = new CatchesUIModel();
-
- String campaignId = context.getCampaignId();
-
- // load existing campaign
- Campaign campaign = persistenceService.getCampaign(campaignId);
- model.setCampaign(campaign);
-
- List<Trait> traits = persistenceService.getAllTrait(campaignId);
- model.setTrait(traits);
-
- if (log.isInfoEnabled()) {
- log.info("Loaded " + traits.size() + " trait(s).");
- }
-
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- CatchesUIModel model = ui.getModel();
-
- initUI(ui);
-
- List<Trait> traits = model.getTrait();
-
- initBeanComboBox(ui.getTraitComboBox(),
- traits,
- model.getSelectedTrait());
-
- model.addPropertyChangeListener(CatchesUIModel.PROPERTY_SELECTED_TRAIT, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- selectTrait((Trait) evt.getNewValue());
- }
- });
-
- model.addPropertyChangeListener(CatchesUIModel.PROPERTY_TRAIT, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- ui.getTraitComboBox().setData(null);
- ui.getTraitComboBox().setData((List<Trait>) evt.getNewValue());
- }
- });
-
- if (!traits.isEmpty()) {
-
- model.setSelectedTrait(traits.get(0));
- }
- }
-
- @Override
- public void onCloseUI() {
-
- // ui will be saved so we do not want to keep selected tab indexes
- ui.getTabPane().setSelectedIndex(0);
- ui.getTraitTabContent().getTraitTabPane().setSelectedIndex(0);
-
- // when quitting ui, let's de-select trait (will save any changes)
- selectTrait(null);
- }
-
- @Override
- protected CatchesUIModel getModel() {
- return ui.getModel();
- }
-
- public void createNewTrait() {
-
- // deselect selected trait
- ui.getModel().setSelectedTrait(null);
-
- // use a new empty trait
- Trait newTrait = new Trait();
- newTrait.setCampaign(ui.getModel().getCampaign());
- newTrait.setDate(new Date());
- selectTrait(newTrait);
- }
-
- public void selectTrait(Trait selectedTrait) {
-
- if (log.isInfoEnabled()) {
- log.info("New selected trait: " + selectedTrait);
- }
- // back to trait tab
- ui.getTabPane().setSelectedIndex(0);
-
- // back to general tab of trait tabs
- ui.getTraitTabContent().getTraitTabPane().setSelectedIndex(0);
-
- // propagate trait to his tabs
- ui.getTraitTabContent().selectTrait(selectedTrait);
- ui.getSpeciesTabContent().selectTrait(selectedTrait);
- ui.getBenthosTabContent().selectTrait(selectedTrait);
- ui.getPlanctonTabContent().selectTrait(selectedTrait);
- ui.getMacroDechetTabContent().selectTrait(selectedTrait);
- ui.getAccidentelTabContent().selectTrait(selectedTrait);
-
- // repaint tabs
- ui.getTabPane().repaint();
-// ui.getObservationIndividuelTabContent().selectTrait(selectedTrait);
- }
-
- public void saveTrait(Trait toSave) {
-
- // persist the trait
-
- boolean create = toSave.getId() == null;
-
- Trait savedTrait;
- if (create) {
- savedTrait = persistenceService.createTrait(toSave);
- } else {
- savedTrait = persistenceService.saveTrait(toSave);
- }
-
- CatchesUIModel model = ui.getModel();
-
- // add the saved trait to trait list
-
- List<Trait> data = model.getTrait();
-
- Trait existingTrait = TuttiEntities.findById(data, savedTrait.getId());
- if (existingTrait != null) {
- data.remove(existingTrait);
- }
- data.add(savedTrait);
-
- // update model trait list
- model.setTrait(data);
-
- // update model selected trait
- model.setSelectedTrait(savedTrait);
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,83 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.Campaign;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
-import org.jdesktop.beans.AbstractSerializableBean;
-
-import java.util.List;
-
-/**
- * Model fo UI {@link CatchesUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class CatchesUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_TRAIT = "trait";
-
- public static final String PROPERTY_SELECTED_TRAIT = "selectedTrait";
-
- public static final String PROPERTY_CAMPAIGN = "campaign";
-
- protected List<Trait> trait;
-
- protected Trait selectedTrait;
-
- protected Campaign campaign;
-
- public List<Trait> getTrait() {
- return trait;
- }
-
- public void setTrait(List<Trait> trait) {
- this.trait = trait;
- firePropertyChange(PROPERTY_TRAIT, null, trait);
- }
-
- public Trait getSelectedTrait() {
- return selectedTrait;
- }
-
- public void setSelectedTrait(Trait selectedTrait) {
- Object oldValue = getSelectedTrait();
- this.selectedTrait = selectedTrait;
- firePropertyChange(PROPERTY_SELECTED_TRAIT, oldValue, selectedTrait);
- }
-
- public Campaign getCampaign() {
- return campaign;
- }
-
- public void setCampaign(Campaign campaign) {
- Object oldValue = getCampaign();
- this.campaign = campaign;
- firePropertyChange(PROPERTY_CAMPAIGN, oldValue, campaign);
- }
-}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,503 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+JToolBar {
+ floatable: false;
+}
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+BeanListHeader {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+}
+
+JList {
+ selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
+ model: {new DefaultListModel()};
+}
+
+NumberEditor {
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
+}
+
+#stationNumberLabel {
+ text: "tutti.label.fishingOperation.stationNumber";
+ labelFor: {stationNumberField};
+}
+
+#stationNumberTraitNumberLabel {
+ text: "tutti.label.fishingOperation.stationNumberTraitNumber";
+}
+
+#stationNumberField {
+ property: "stationNumber";
+ model: {model.getStationNumber()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#traitNumberLabel {
+ text: "tutti.label.fishingOperation.traitNumber";
+ labelFor: {traitNumberField};
+}
+
+#traitNumberField {
+ property: "traitNumber";
+ model: {model.getTraitNumber()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#dateLabel {
+ text: "tutti.label.fishingOperation.date";
+ labelFor: {dateField};
+}
+
+#dateField {
+ date: {model.getDate()};
+ formats: {"dd/MM/yyyy"};
+}
+
+#strataLabel {
+ text: "tutti.label.fishingOperation.strata";
+ labelFor: {strataComboBox};
+}
+
+#strataComboBox {
+ property: "strata";
+ selectedItem: {model.getStrata()};
+}
+
+#beaufortScaleLabel {
+ text: "tutti.label.fishingOperation.beaufortScale";
+ labelFor: {beaufortScaleComboBox};
+}
+
+#beaufortScaleComboBox {
+ property: "beaufortScale";
+ selectedItem: {model.getBeaufortScale()};
+}
+
+#windDirectionLabel {
+ text: "tutti.label.fishingOperation.windDirection";
+ labelFor: {windDirectionField};
+}
+
+#windDirectionField {
+ property: "windDirection";
+ model: {model.getWindDirection()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#seaStateLabel {
+ text: "tutti.label.fishingOperation.seaState";
+ labelFor: {seaStateComboBox};
+}
+
+#seaStateComboBox {
+ property: "seaState";
+ selectedItem: {model.getSeaState()};
+}
+
+#ouvertureHorizontaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureHorizontale";
+ labelFor: {ouvertureHorizontaleField};
+}
+
+#ouvertureHorizontaleVerticaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureHorizontaleVerticale";
+}
+
+#ouvertureHorizontaleField {
+ property: "ouvertureHorizontale";
+ model: {model.getOuvertureHorizontale()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#ouvertureVerticaleLabel {
+ text: "tutti.label.fishingOperation.ouvertureVerticale";
+ labelFor: {ouvertureVerticaleField};
+}
+
+#ouvertureVerticaleField {
+ property: "ouvertureVerticale";
+ model: {model.getOuvertureVerticale()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#geometrieMesureeCheckBox {
+ text: "tutti.label.fishingOperation.geometrieMesuree";
+ selected: {model.isGeometrieMesuree()};
+}
+
+#longueurFunesLabel {
+ text: "tutti.label.fishingOperation.longueurFunes";
+ labelFor: {longueurFunesField};
+}
+
+#longueurFunesBrasLabel {
+ text: "tutti.label.fishingOperation.longueurFunesBras";
+}
+
+#longueurFunesField {
+ property: "longueurFunes";
+ model: {model.getLongueurFunes()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#longueurBrasLabel {
+ text: "tutti.label.fishingOperation.longueurBras";
+ labelFor: {longueurBrasField};
+}
+
+#longueurBrasField {
+ property: "longueurBras";
+ model: {model.getLongueurBras()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#systemeFermetureCulCheckBox {
+ text: "tutti.label.fishingOperation.systemeFermetureCul";
+ selected: {model.isSystemeFermetureCul()};
+}
+
+#traitRectiligneCheckBox {
+ text: "tutti.label.fishingOperation.traitRectiligne";
+ selected: {model.isTraitRectiligne()};
+}
+
+#distanceChaluteeLabel {
+ text: "tutti.label.fishingOperation.distanceChalutee";
+ labelFor: {distanceChaluteeField};
+}
+
+#distanceChaluteeDureeLabel {
+ text: "tutti.label.fishingOperation.distanceChaluteeDuree";
+}
+
+#distanceChaluteeField {
+ property: "distanceChalutee";
+ model: {model.getDistanceChalutee()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#dureeLabel {
+ text: "tutti.label.fishingOperation.duree";
+ labelFor: {dureeField};
+}
+
+#dureeField {
+ property: "duree";
+ model: {model.getDuree()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#traitValidCheckBox {
+ text: "tutti.label.fishingOperation.traitValid";
+ selected: {model.isTraitValid()};
+}
+
+#localiteLabel {
+ text: "tutti.label.fishingOperation.localite";
+ labelFor: {localiteField};
+}
+
+#localiteField {
+ text: {model.getLocalite()};
+}
+
+#saisisseurPane {
+ horizontalScrollBarPolicy: {JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
+ verticalScrollBarPolicy: {JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
+}
+
+#saisisseurHeader {
+ labelText: {_("tutti.label.list.saisisseur")};
+ list: {saisisseurList};
+ beanType: {Person.class};
+}
+
+#commentPane {
+ columnHeaderView: {new JLabel(_("tutti.label.comment"))};
+ minimumSize: {new Dimension(10,50)};
+}
+
+#commentField {
+ text: {model.getComment()};
+}
+
+#gearShootingStartLongitudeLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartLongitude";
+ labelFor: {gearShootingStartLongitudeField};
+}
+
+#gearShootingStartLongitudeField {
+ text: {getStringValue(model.getGearShootingStartLongitude())};
+}
+
+#gearShootingStartLatitudeLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartLatitude";
+ labelFor: {gearShootingStartLatitudeField};
+}
+
+#gearShootingStartLatitudeField {
+ text: {getStringValue(model.getGearShootingStartLatitude())};
+}
+
+#gearShootingStartTimeLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartTime";
+ labelFor: {gearShootingStartTimeField};
+}
+
+#gearShootingStartTimeField {
+ text: {getStringValue(model.getGearShootingStartTime())};
+}
+
+#gearShootingStartDepthLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartDepth";
+ labelFor: {gearShootingStartDepthField};
+}
+
+#gearShootingStartDepthField {
+ property: "gearShootingStartDepth";
+ model: {model.getGearShootingStartDepth()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndLongitudeLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndLongitude";
+ labelFor: {gearShootingEndLongitudeField};
+}
+
+#gearShootingEndLongitudeField {
+ text: {getStringValue(model.getGearShootingEndLongitude())};
+}
+
+#gearShootingEndLatitudeLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndLatitude";
+ labelFor: {gearShootingEndLatitudeField};
+}
+
+#gearShootingEndLatitudeField {
+ text: {getStringValue(model.getGearShootingEndLatitude())};
+}
+
+#gearShootingEndTimeLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndTime";
+ labelFor: {gearShootingEndTimeField};
+}
+
+#gearShootingEndTimeField {
+ text: {getStringValue(model.getGearShootingEndTime())};
+}
+
+#gearShootingEndDepthLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndDepth";
+ labelFor: {gearShootingEndDepthField};
+}
+
+#gearShootingEndDepthField {
+ property: "gearShootingEndDepth";
+ model: {model.getGearShootingEndDepth()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartSurfaceTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartSurfaceTemperature";
+ labelFor: {gearShootingStartSurfaceTemperatureField};
+}
+
+#gearShootingStartSurfaceTemperatureField {
+ property: "gearShootingStartSurfaceTemperature";
+ model: {model.getGearShootingStartSurfaceTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndSurfaceTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndSurfaceTemperature";
+ labelFor: {gearShootingEndSurfaceTemperatureField};
+}
+
+#gearShootingEndSurfaceTemperatureField {
+ property: "gearShootingEndSurfaceTemperature";
+ model: {model.getGearShootingEndSurfaceTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartBottomTemperature";
+ labelFor: {gearShootingStartBottomTemperatureField};
+}
+
+#gearShootingStartBottomTemperatureField {
+ property: "gearShootingStartBottomTemperature";
+ model: {model.getGearShootingStartBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndBottomTemperature";
+ labelFor: {gearShootingEndBottomTemperatureField};
+}
+
+#gearShootingEndBottomTemperatureField {
+ property: "gearShootingEndBottomTemperature";
+ model: {model.getGearShootingEndBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#averageBottomTemperatureLabel {
+ text: "tutti.label.fishingOperation.averageBottomTemperature";
+ labelFor: {averageBottomTemperatureField};
+}
+
+#averageBottomTemperatureField {
+ property: "averageBottomTemperature";
+ model: {model.getAverageBottomTemperature()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartSurfaceSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartSurfaceSalinity";
+ labelFor: {gearShootingStartSurfaceSalinityField};
+}
+
+#gearShootingStartSurfaceSalinityField {
+ property: "gearShootingStartSurfaceSalinity";
+ model: {model.getGearShootingStartSurfaceSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndSurfaceSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndSurfaceSalinity";
+ labelFor: {gearShootingEndSurfaceSalinityField};
+}
+
+#gearShootingEndSurfaceSalinityField {
+ property: "gearShootingEndSurfaceSalinity";
+ model: {model.getGearShootingEndSurfaceSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingStartBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingStartBottomSalinity";
+ labelFor: {gearShootingStartBottomSalinityField};
+}
+
+#gearShootingStartBottomSalinityField {
+ property: "gearShootingStartBottomSalinity";
+ model: {model.getGearShootingStartBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#gearShootingEndBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.gearShootingEndBottomSalinity";
+ labelFor: {gearShootingEndBottomSalinityField};
+}
+
+#gearShootingEndBottomSalinityField {
+ property: "gearShootingEndBottomSalinity";
+ model: {model.getGearShootingEndBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#averageBottomSalinityLabel {
+ text: "tutti.label.fishingOperation.averageBottomSalinity";
+ labelFor: {averageBottomSalinityField};
+}
+
+#averageBottomSalinityField {
+ property: "averageBottomSalinity";
+ model: {model.getAverageBottomSalinity()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
+}
+
+#noTraitPane {
+ text: "tutti.label.no.fishingOperation.selected";
+ horizontalAlignment: {JLabel.CENTER};
+}
+
+#saveButton {
+ actionIcon: "save";
+ text: "tutti.action.save";
+ enabled: {model.isModify() && model.isValid()};
+}
+
+#cancelButton {
+ actionIcon: "cancel";
+ text: "tutti.action.cancel";
+ enabled: {model.isModify()};
+}
+
+#importPupitriButton {
+ actionIcon: "pupitri-import";
+ text: "tutti.action.pupitri-import";
+}
+
+#importCasinoButton {
+ actionIcon: "casino-import";
+ text: "tutti.action.casino-import";
+}
+
+#messagePanel {
+ border: {BorderFactory.createTitledBorder("Messages")};
+ height: 200;
+ width: 500;
+}
+
+#errorTable {
+ rowSelectionAllowed: true;
+ autoCreateRowSorter: true;
+ autoResizeMode: 2;
+ cellSelectionEnabled: false;
+ selectionMode: 0;
+ model: {errorTableModel};
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,550 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<FishingOperationTabUIModel, FishingOperationTabUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
+ fr.ifremer.tutti.persistence.entities.referential.SeaState
+ fr.ifremer.tutti.persistence.entities.referential.Strata
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+ fr.ifremer.tutti.persistence.entities.referential.Person
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+ jaxx.runtime.swing.editor.bean.BeanListHeader
+ jaxx.runtime.swing.editor.NumberEditor
+
+ jaxx.runtime.validator.swing.SwingValidatorUtil
+ jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
+
+ org.jdesktop.swingx.JXDatePicker
+
+ java.awt.Dimension
+
+ javax.swing.DefaultListModel
+ javax.swing.ListSelectionModel
+
+ static org.nuiton.i18n.I18n._
+ static jaxx.runtime.SwingUtil.getStringValue
+ </import>
+
+ <script><![CDATA[
+
+public FishingOperationTabUI(FishingOperationsUI parentUI) {
+ FishingOperationTabUIHandler handler = new FishingOperationTabUIHandler(parentUI, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
+
+protected void $afterCompleteSetup() { handler.afterInitUI(); }
+ ]]></script>
+
+ <FishingOperationTabUIHandler id='handler'
+ initializer='getContextValue(FishingOperationTabUIHandler.class)'/>
+
+ <FishingOperationTabUIModel id='model'
+ initializer='getContextValue(FishingOperationTabUIModel.class)'/>
+
+ <SwingValidatorMessageTableModel id='errorTableModel'/>
+
+ <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
+ uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
+ <field name='stationNumber' component='stationNumberField'/>
+ <field name='traitNumber' component='traitNumberField'/>
+ <field name='date' component='dateField'/>
+ <field name='comment' component='commentField'/>
+ <field name='saisisseur' component='saisisseurPane'/>
+ </BeanValidator>
+
+ <JPanel id='traitPane' constraints='BorderLayout.CENTER'
+ layout='{new BorderLayout()}'>
+
+ <JTabbedPane id='traitTabPane' constraints='BorderLayout.CENTER'>
+ <tab id='traitGeneralTab' title='tutti.label.tab.fishingOperation.general'>
+ <Table fill='both' id='generalForm'>
+
+ <!-- Numero station -->
+ <row>
+ <cell anchor='west'>
+ <!--JLabel id='stationNumberLabel'/-->
+ <JLabel id='stationNumberTraitNumberLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <NumberEditor id='stationNumberField' constructorParams='this'/>
+ <NumberEditor id='traitNumberField' constructorParams='this'/>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- Numero fishingOperation / chalut -->
+ <!--row>
+ <cell>
+ <JLabel id='traitNumberLabel'/>
+ </cell>
+ <cell>
+ <NumberEditor id='traitNumberField' constructorParams='this'/>
+ </cell>
+ </row-->
+
+ <!-- Date -->
+ <row>
+ <cell>
+ <JLabel id='dateLabel'/>
+ </cell>
+ <cell>
+ <JXDatePicker id='dateField'
+ onActionPerformed='handler.setDate(event, "date")'/>
+ </cell>
+ </row>
+
+ <!-- Strate d'association -->
+ <row>
+ <cell>
+ <JLabel id='strataLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <BeanComboBox id='strataComboBox' constructorParams='this'
+ genericType='Strata'/>
+ </cell>
+ </row>
+
+ <!-- Beaufort scale -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='beaufortScaleLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
+ genericType='BeaufortScale'/>
+ </cell>
+ </row>
+
+ <!-- Wind direction -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='windDirectionLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='windDirectionField' constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- Sea state-->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='seaStateLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <BeanComboBox id='seaStateComboBox' constructorParams='this'
+ genericType='SeaState'/>
+ </cell>
+ </row>
+
+ <!-- Ouverture horizontale -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='ouvertureHorizontaleVerticaleLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <NumberEditor id='ouvertureHorizontaleField'
+ constructorParams='this'/>
+ <NumberEditor id='ouvertureVerticaleField'
+ constructorParams='this'/>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- Ouverture verticale -->
+ <!--row>
+ <cell anchor='west'>
+ <JLabel id='ouvertureVerticaleLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='ouvertureVerticaleField'
+ constructorParams='this'/>
+ </cell>
+ </row-->
+
+ <!-- Longueur funes -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='longueurFunesBrasLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <NumberEditor id='longueurFunesField' constructorParams='this'/>
+ <NumberEditor id='longueurBrasField' constructorParams='this'/>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- Longueur bras -->
+ <!--row>
+ <cell anchor='west'>
+ <JLabel id='longueurBrasLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='longueurBrasField' constructorParams='this'/>
+ </cell>
+ </row-->
+
+ <!-- Distance chalutée -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='distanceChaluteeDureeLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <NumberEditor id='distanceChaluteeField' constructorParams='this'/>
+ <NumberEditor id='dureeField' constructorParams='this'/>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- Durée -->
+ <!--row>
+ <cell anchor='west'>
+ <JLabel id='dureeLabel'/>
+ </cell>
+ <cell fill='horizontal'>
+ <NumberEditor id='dureeField' constructorParams='this'/>
+ </cell>
+ </row-->
+
+ <!-- Localité -->
+ <row>
+ <cell>
+ <JLabel id='localiteLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='localiteField'
+ onKeyReleased='handler.setText(event, "localite")'/>
+ </cell>
+ </row>
+
+ <!-- FishingOperation valide / Rectiligne -->
+ <row>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JCheckBox id='traitValidCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "traitValid")'/>
+ <JCheckBox id='traitRectiligneCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "traitRectiligne")'/>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- Système de fermeture du cul / Geometrie mesuree -->
+ <row>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JCheckBox id='systemeFermetureCulCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/>
+ <JCheckBox id='geometrieMesureeCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
+ </JPanel>
+ </cell>
+ </row>
+
+ <!-- FishingOperation rectiligne -->
+ <!--row>
+ <cell columns='2'>
+ <JCheckBox id='traitRectiligneCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "traitRectiligne")'/>
+ </cell>
+ </row-->
+
+ <!-- Geometrie mesuree -->
+ <!--row>
+ <cell columns='2'>
+ <JCheckBox id='geometrieMesureeCheckBox'
+ onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
+ </cell>
+ </row-->
+
+ <!-- Saisisseur -->
+ <row weighty='0.3'>
+ <cell columns='2'>
+ <JScrollPane id='saisisseurPane'
+ columnHeaderView="{saisisseurHeader}"
+ onFocusGained='saisisseurList.requestFocus()'>
+ <JList id='saisisseurList'
+ onValueChanged='handler.selectListData(event, "saisisseur")'/>
+ <BeanListHeader id='saisisseurHeader' genericType='Person'/>
+ </JScrollPane>
+ </cell>
+ </row>
+
+ <!-- Commentaire -->
+ <row weighty='0.3'>
+ <cell columns='2'>
+ <JScrollPane id='commentPane'
+ onFocusGained='commentField.requestFocus()'>
+ <JTextArea id='commentField'
+ onKeyReleased='handler.setText(event, "comment")'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell columns='2'>
+ <JPanel layout='{new GridLayout(1,0)}'>
+ <JButton id='importPupitriButton'
+ onActionPerformed='handler.importPupitri()'/>
+ <JButton id='importCasinoButton'
+ onActionPerformed='handler.importCasino()'/>
+ </JPanel>
+ </cell>
+ </row>
+ </Table>
+ </tab>
+
+ <tab id='traitGearShootingTab' title='tutti.label.tab.fishingOperation.gearShooting'>
+
+ <Table fill='both' id='gearShootingForm'>
+
+ <!-- GearShootingStart Longitude -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartLongitudeLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='gearShootingStartLongitudeField'
+ onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStart Latitude -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartLatitudeLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='gearShootingStartLatitudeField'
+ onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStart Time -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartTimeLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='gearShootingStartTimeField'
+ onKeyReleased='handler.setGearShootingStartTime(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStart Depth -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartDepthLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartDepthField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEnd Longitude -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndLongitudeLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='gearShootingEndLongitudeField'
+ onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEnd Latitude -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndLatitudeLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='gearShootingEndLatitudeField'
+ onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEnd Time -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndTimeLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <JTextField id='gearShootingEndTimeField'
+ onKeyReleased='handler.setGearShootingEndTime(((JTextField)event.getSource()).getText())'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEnd Depth -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndDepthLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndDepthField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+ </Table>
+ </tab>
+
+ <tab id='traitHydrologyTabContent' title='tutti.label.tab.fishingOperation.hydrology'>
+
+ <Table fill='both' id='hydrologyForm'>
+
+ <!-- GearShootingStartSurfaceTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartSurfaceTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartSurfaceTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndSurfaceTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndSurfaceTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndSurfaceTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- AverageBottomTemperature -->
+ <row>
+ <cell>
+ <JLabel id='averageBottomTemperatureLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='averageBottomTemperatureField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartSurfaceSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartSurfaceSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartSurfaceSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndSurfaceSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndSurfaceSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndSurfaceSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingStartBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingStartBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingStartBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- GearShootingEndBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='gearShootingEndBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='gearShootingEndBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ <!-- AverageBottomSalinity -->
+ <row>
+ <cell>
+ <JLabel id='averageBottomSalinityLabel'/>
+ </cell>
+ <cell weightx='1.0'>
+ <NumberEditor id='averageBottomSalinityField'
+ constructorParams='this'/>
+ </cell>
+ </row>
+
+ </Table>
+ </tab>
+ </JTabbedPane>
+
+ <!-- Actions -->
+ <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'>
+ <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.CENTER'>
+ <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
+ <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ </JPanel>
+ </JPanel>
+
+ </JPanel>
+
+ <JLabel id='noTraitPane'/>
+</JPanel>
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,240 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import java.awt.BorderLayout;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.sql.Date;
+import java.util.List;
+
+/**
+ * Handler for UI {@link FishingOperationTabUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationTabUIHandler extends AbstractTuttiUIHandler<FishingOperationTabUIModel> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(FishingOperationTabUIHandler.class);
+
+ private final FishingOperationTabUI ui;
+
+ private final FishingOperationsUI parentUi;
+
+ private final PersistenceService persistenceService;
+
+ public FishingOperationTabUIHandler(FishingOperationsUI parentUi, FishingOperationTabUI ui) {
+ super(parentUi.getHandler().getContext());
+ this.ui = ui;
+ this.parentUi = parentUi;
+ this.persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ FishingOperationTabUIModel model = new FishingOperationTabUIModel();
+ model.addPropertyChangeListener(FishingOperationTabUIModel.PROPERTY_EMPTY, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ JPanel form = ui.getTraitPane();
+ JLabel noContentPane = ui.getNoTraitPane();
+
+ Boolean empty = (Boolean) evt.getNewValue();
+ ui.remove(form);
+ ui.remove(noContentPane);
+ if (empty) {
+ ui.add(noContentPane, BorderLayout.CENTER);
+ } else {
+ ui.add(form, BorderLayout.CENTER);
+ }
+ ui.repaint();
+ }
+ });
+
+ listModelIsModify(model);
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ FishingOperationTabUIModel model = ui.getModel();
+
+ initUI(ui);
+
+ initBeanList(ui.getSaisisseurHeader(),
+ persistenceService.getAllPerson(),
+ model.getSaisisseur());
+
+ initBeanComboBox(ui.getBeaufortScaleComboBox(),
+ persistenceService.getAllBeaufortScale(),
+ model.getBeaufortScale());
+
+ initBeanComboBox(ui.getStrataComboBox(),
+ persistenceService.getAllStrata(),
+ model.getStrata());
+
+ initBeanComboBox(ui.getSeaStateComboBox(),
+ persistenceService.getAllSeaState(),
+ model.getSeaState());
+
+ model.setEmpty(true);
+
+ listenValidatorValid(ui.getValidator(), getModel());
+ }
+
+ @Override
+ public void onCloseUI() {
+ }
+
+ @Override
+ protected FishingOperationTabUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void selectFishingOperation(FishingOperation bean) {
+
+ boolean empty = bean == null;
+
+ FishingOperationTabUIModel model = ui.getModel();
+
+ // clean previous selection
+ ui.getSaisisseurHeader().getList().clearSelection();
+
+ if (empty) {
+
+ model.fromBean(new FishingOperation());
+ } else {
+
+ model.fromBean(bean);
+ }
+
+ // update saisissuer selection
+ List<Person> saisisseur = model.getSaisisseur();
+ if (CollectionUtils.isNotEmpty(saisisseur)) {
+ updateIndices(ui.getSaisisseurList(), saisisseur);
+ }
+
+ // update model empty property
+ model.setEmpty(empty);
+
+ // reload bean in validator (? really mandatory?)
+// ui.getValidator().reloadBean();
+
+ // if new fishingOperation can already cancel his creation
+ model.setModify(!empty && model.isCreate());
+ }
+
+ public void cancel() {
+
+ String id = ui.getModel().getId();
+
+ if (log.isInfoEnabled()) {
+ log.info("Cancel edition for fishingOperation: " + id);
+ }
+ boolean newBean = StringUtils.isBlank(id);
+
+ if (newBean) {
+
+ // cancel to create a new fishingOperation
+ parentUi.getHandler().selectFishingOperation(null);
+
+ } else {
+
+ // reselect in ui the fishingOperation
+ FishingOperation selectedFishingOperation = parentUi.getModel().getSelectedFishingOperation();
+ parentUi.getHandler().selectFishingOperation(selectedFishingOperation);
+ }
+ }
+
+ public void save() {
+
+ // get fishingOperation to save
+ FishingOperation toSave = getModel().toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("Save edition for fishingOperation: " + toSave.getId());
+ }
+
+ // keep selected tab (to resotre it after save)
+ int selectedIndex = ui.getTraitTabPane().getSelectedIndex();
+
+ // persist current fishingOperation
+ parentUi.getHandler().saveFishingOperation(toSave);
+
+ // reselect current tab
+ ui.getTraitTabPane().setSelectedIndex(selectedIndex);
+
+ getModel().setModify(false);
+ }
+
+ public void importPupitri() {
+ //TODO
+ }
+
+ public void importCasino() {
+ //TODO
+ }
+
+ public void setGearShootingStartLatitude(String text) {
+ ui.getModel().setGearShootingStartLatitude(Float.valueOf(text));
+ }
+
+ public void setGearShootingStartLongitude(String text) {
+ ui.getModel().setGearShootingStartLongitude(Float.valueOf(text));
+ }
+
+ public void setGearShootingStartTime(String text) {
+ ui.getModel().setGearShootingStartTime(Date.valueOf(text));
+ }
+
+ public void setGearShootingEndLatitude(String text) {
+ ui.getModel().setGearShootingEndLatitude(Float.valueOf(text));
+ }
+
+ public void setGearShootingEndLongitude(String text) {
+ ui.getModel().setGearShootingEndLongitude(Float.valueOf(text));
+ }
+
+ public void setGearShootingEndTime(String text) {
+ ui.getModel().setGearShootingEndTime(Date.valueOf(text));
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,615 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.SeaState;
+import fr.ifremer.tutti.persistence.entities.referential.Strata;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Model for UI {@link FishingOperationTabUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationTabUIModel extends AbstractTuttiBeanUIModel<FishingOperation, FishingOperationTabUIModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_EMPTY = "empty";
+
+ public static final String PROPERTY_STATION_NUMBER = "stationNumber";
+
+ public static final String PROPERTY_TRAIT_NUMBER = "traitNumber";
+
+ public static final String PROPERTY_DATE = "date";
+
+ public static final String PROPERTY_STRATA = "strata";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_TIME = "gearShootingStartTime";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_TIME = "gearShootingEndTime";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
+
+ public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
+
+ public static final String PROPERTY_WIND_DIRECTION = "windDirection";
+
+ public static final String PROPERTY_SEA_STATE = "seaState";
+
+ public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale";
+
+ public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale";
+
+ public static final String PROPERTY_GEOMETRIE_MESUREE = "geometrieMesuree";
+
+ public static final String PROPERTY_LONGUEUR_FUNES = "longueurFunes";
+
+ public static final String PROPERTY_LONGUEUR_BRAS = "longueurBras";
+
+ public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
+
+ public static final String PROPERTY_TRAIT_RECTILIGNE = "traitRectiligne";
+
+ public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee";
+
+ public static final String PROPERTY_DUREE = "duree";
+
+ public static final String PROPERTY_TRAIT_VALID = "traitValid";
+
+ public static final String PROPERTY_LOCALITE = "localite";
+
+ public static final String PROPERTY_COMMENT = "comment";
+
+ public static final String PROPERTY_SAISISSEUR = "saisisseur";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE = "gearShootingStartSurfaceTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE = "gearShootingEndSurfaceTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE = "gearShootingStartBottomTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE = "gearShootingEndBottomTemperature";
+
+ public static final String PROPERTY_AVERAGE_BOTTOM_TEMPERATURE = "averageBottomTemperature";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY = "gearShootingStartSurfaceSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY = "gearShootingEndSurfaceSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY = "gearShootingStartBottomSalinity";
+
+ public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY = "gearShootingEndBottomSalinity";
+
+ public static final String PROPERTY_AVERAGE_BOTTOM_SALINITY = "averageBottomSalinity";
+
+ protected boolean empty;
+
+ protected ScientificCruise scientificCruise;
+
+ protected Integer stationNumber;
+
+ protected Integer traitNumber;
+
+ protected Date date;
+
+ protected Strata strata;
+
+ protected Float gearShootingStartLatitude;
+
+ protected Float gearShootingStartLongitude;
+
+ protected Date gearShootingStartTime;
+
+ protected Float gearShootingStartDepth;
+
+ protected Float gearShootingEndLatitude;
+
+ protected Float gearShootingEndLongitude;
+
+ protected Date gearShootingEndTime;
+
+ protected Float gearShootingEndDepth;
+
+ protected BeaufortScale beaufortScale;
+
+ protected Integer windDirection;
+
+ protected SeaState seaState;
+
+ protected Float ouvertureHorizontale;
+
+ protected Float ouvertureVerticale;
+
+ protected boolean geometrieMesuree;
+
+ protected Float longueurFunes;
+
+ protected Float longueurBras;
+
+ protected boolean systemeFermetureCul;
+
+ protected boolean traitRectiligne;
+
+ protected Float distanceChalutee;
+
+ protected Float duree;
+
+ protected boolean traitValid;
+
+ protected String localite;
+
+ protected String comment;
+
+ protected List<Person> saisisseur;
+
+ protected Float gearShootingStartSurfaceTemperature;
+
+ protected Float gearShootingEndSurfaceTemperature;
+
+ protected Float gearShootingStartBottomTemperature;
+
+ protected Float gearShootingEndBottomTemperature;
+
+ protected Float averageBottomTemperature;
+
+ protected Float gearShootingStartSurfaceSalinity;
+
+ protected Float gearShootingEndSurfaceSalinity;
+
+ protected Float gearShootingStartBottomSalinity;
+
+ protected Float gearShootingEndBottomSalinity;
+
+ protected Float averageBottomSalinity;
+
+ protected static Binder<FishingOperationTabUIModel, FishingOperation> toBeanBinder =
+ BinderFactory.newBinder(FishingOperationTabUIModel.class,
+ FishingOperation.class);
+
+ protected static Binder<FishingOperation, FishingOperationTabUIModel> fromBeanBinder =
+ BinderFactory.newBinder(FishingOperation.class, FishingOperationTabUIModel.class);
+
+ public FishingOperationTabUIModel() {
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ }
+
+ public boolean isEmpty() {
+ return empty;
+ }
+
+ public void setEmpty(boolean empty) {
+ Object oldValue = isEmpty();
+ this.empty = empty;
+ firePropertyChange(PROPERTY_EMPTY, oldValue, empty);
+ }
+
+ public ScientificCruise getScientificCruise() {
+ return scientificCruise;
+ }
+
+ public void setScientificCruise(ScientificCruise scientificCruise) {
+ this.scientificCruise = scientificCruise;
+ }
+
+ public Integer getStationNumber() {
+ return stationNumber;
+ }
+
+ public void setStationNumber(Integer stationNumber) {
+ Object oldValue = getStationNumber();
+ this.stationNumber = stationNumber;
+ firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
+ }
+
+ public Integer getTraitNumber() {
+ return traitNumber;
+ }
+
+ public void setTraitNumber(Integer traitNumber) {
+ Object oldValue = getTraitNumber();
+ this.traitNumber = traitNumber;
+ firePropertyChange(PROPERTY_TRAIT_NUMBER, oldValue, traitNumber);
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ Object oldValue = getDate();
+ this.date = date;
+ firePropertyChange(PROPERTY_DATE, oldValue, date);
+ }
+
+ public Strata getStrata() {
+ return strata;
+ }
+
+ public void setStrata(Strata strata) {
+ Object oldValue = getStrata();
+ this.strata = strata;
+ firePropertyChange(PROPERTY_STRATA, oldValue, strata);
+ }
+
+ public Float getGearShootingStartLatitude() {
+ return gearShootingStartLatitude;
+ }
+
+ public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
+ Object oldValue = getGearShootingStartLatitude();
+ this.gearShootingStartLatitude = gearShootingStartLatitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude);
+ }
+
+ public Float getGearShootingStartLongitude() {
+ return gearShootingStartLongitude;
+ }
+
+ public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
+ Object oldValue = getGearShootingStartLongitude();
+ this.gearShootingStartLongitude = gearShootingStartLongitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude);
+ }
+
+ public Date getGearShootingStartTime() {
+ return gearShootingStartTime;
+ }
+
+ public void setGearShootingStartTime(Date gearShootingStartTime) {
+ Object oldValue = getGearShootingStartTime();
+ this.gearShootingStartTime = gearShootingStartTime;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_TIME, oldValue, gearShootingStartTime);
+ }
+
+ public Float getGearShootingStartDepth() {
+ return gearShootingStartDepth;
+ }
+
+ public void setGearShootingStartDepth(Float gearShootingStartDepth) {
+ Object oldValue = getGearShootingStartDepth();
+ this.gearShootingStartDepth = gearShootingStartDepth;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DEPTH, oldValue, gearShootingStartDepth);
+ }
+
+ public Float getGearShootingEndLatitude() {
+ return gearShootingEndLatitude;
+ }
+
+ public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
+ Object oldValue = getGearShootingEndLatitude();
+ this.gearShootingEndLatitude = gearShootingEndLatitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude);
+ }
+
+ public Float getGearShootingEndLongitude() {
+ return gearShootingEndLongitude;
+ }
+
+ public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
+ Object oldValue = getGearShootingEndLongitude();
+ this.gearShootingEndLongitude = gearShootingEndLongitude;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude);
+ }
+
+ public Date getGearShootingEndTime() {
+ return gearShootingEndTime;
+ }
+
+ public void setGearShootingEndTime(Date gearShootingEndTime) {
+ Object oldValue = getGearShootingEndTime();
+ this.gearShootingEndTime = gearShootingEndTime;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_TIME, oldValue, gearShootingEndTime);
+ }
+
+ public Float getGearShootingEndDepth() {
+ return gearShootingEndDepth;
+ }
+
+ public void setGearShootingEndDepth(Float gearShootingEndDepth) {
+ Object oldValue = getGearShootingEndDepth();
+ this.gearShootingEndDepth = gearShootingEndDepth;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth);
+ }
+
+ public BeaufortScale getBeaufortScale() {
+ return beaufortScale;
+ }
+
+ public void setBeaufortScale(BeaufortScale beaufortScale) {
+ Object oldValue = getBeaufortScale();
+ this.beaufortScale = beaufortScale;
+ firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
+ }
+
+ public Integer getWindDirection() {
+ return windDirection;
+ }
+
+ public void setWindDirection(Integer windDirection) {
+ Object oldValue = getWindDirection();
+ this.windDirection = windDirection;
+ firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
+ }
+
+ public SeaState getSeaState() {
+ return seaState;
+ }
+
+ public void setSeaState(SeaState seaState) {
+ Object oldValue = getSeaState();
+ this.seaState = seaState;
+ firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
+ }
+
+ public Float getOuvertureHorizontale() {
+ return ouvertureHorizontale;
+ }
+
+ public void setOuvertureHorizontale(Float ouvertureHorizontale) {
+ Object oldValue = getOuvertureHorizontale();
+ this.ouvertureHorizontale = ouvertureHorizontale;
+ firePropertyChange(PROPERTY_OUVERTURE_HORIZONTALE, oldValue, ouvertureHorizontale);
+ }
+
+ public Float getOuvertureVerticale() {
+ return ouvertureVerticale;
+ }
+
+ public void setOuvertureVerticale(Float ouvertureVerticale) {
+ Object oldValue = getOuvertureVerticale();
+ this.ouvertureVerticale = ouvertureVerticale;
+ firePropertyChange(PROPERTY_OUVERTURE_VERTICALE, oldValue, ouvertureVerticale);
+ }
+
+ public boolean isGeometrieMesuree() {
+ return geometrieMesuree;
+ }
+
+ public void setGeometrieMesuree(boolean geometrieMesuree) {
+ Object oldValue = isGeometrieMesuree();
+ this.geometrieMesuree = geometrieMesuree;
+ firePropertyChange(PROPERTY_GEOMETRIE_MESUREE, oldValue, geometrieMesuree);
+ }
+
+ public Float getLongueurFunes() {
+ return longueurFunes;
+ }
+
+ public void setLongueurFunes(Float longueurFunes) {
+ Object oldValue = getLongueurFunes();
+ this.longueurFunes = longueurFunes;
+ firePropertyChange(PROPERTY_LONGUEUR_FUNES, oldValue, longueurFunes);
+ }
+
+ public Float getLongueurBras() {
+ return longueurBras;
+ }
+
+ public void setLongueurBras(Float longueurBras) {
+ Object oldValue = getLongueurBras();
+ this.longueurBras = longueurBras;
+ firePropertyChange(PROPERTY_LONGUEUR_BRAS, oldValue, longueurBras);
+ }
+
+ public boolean isSystemeFermetureCul() {
+ return systemeFermetureCul;
+ }
+
+ public void setSystemeFermetureCul(boolean systemeFermetureCul) {
+ Object oldValue = isSystemeFermetureCul();
+ this.systemeFermetureCul = systemeFermetureCul;
+ firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul);
+ }
+
+ public boolean isTraitRectiligne() {
+ return traitRectiligne;
+ }
+
+ public void setTraitRectiligne(boolean traitRectiligne) {
+ Object oldValue = isTraitRectiligne();
+ this.traitRectiligne = traitRectiligne;
+ firePropertyChange(PROPERTY_TRAIT_RECTILIGNE, oldValue, traitRectiligne);
+ }
+
+ public Float getDistanceChalutee() {
+ return distanceChalutee;
+ }
+
+ public void setDistanceChalutee(Float distanceChalutee) {
+ Object oldValue = getDistanceChalutee();
+ this.distanceChalutee = distanceChalutee;
+ firePropertyChange(PROPERTY_DISTANCE_CHALUTEE, oldValue, distanceChalutee);
+ }
+
+ public Float getDuree() {
+ return duree;
+ }
+
+ public void setDuree(Float duree) {
+ Object oldValue = getDuree();
+ this.duree = duree;
+ firePropertyChange(PROPERTY_DUREE, oldValue, duree);
+ }
+
+ public boolean isTraitValid() {
+ return traitValid;
+ }
+
+ public void setTraitValid(boolean traitValid) {
+ Object oldValue = isTraitValid();
+ this.traitValid = traitValid;
+ firePropertyChange(PROPERTY_TRAIT_VALID, oldValue, traitValid);
+ }
+
+ public String getLocalite() {
+ return localite;
+ }
+
+ public void setLocalite(String localite) {
+ Object oldValue = getLocalite();
+ this.localite = localite;
+ firePropertyChange(PROPERTY_LOCALITE, oldValue, localite);
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ this.comment = comment;
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ public List<Person> getSaisisseur() {
+ return saisisseur;
+ }
+
+ public void setSaisisseur(List<Person> saisisseur) {
+ this.saisisseur = saisisseur;
+ firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
+ }
+
+ public Float getGearShootingStartSurfaceTemperature() {
+ return gearShootingStartSurfaceTemperature;
+ }
+
+ public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) {
+ Object oldValue = getGearShootingStartSurfaceTemperature();
+ this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE, oldValue, gearShootingStartSurfaceTemperature);
+ }
+
+ public Float getGearShootingEndSurfaceTemperature() {
+ return gearShootingEndSurfaceTemperature;
+ }
+
+ public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) {
+ Object oldValue = getGearShootingEndSurfaceTemperature();
+ this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE, oldValue, gearShootingEndSurfaceTemperature);
+ }
+
+ public Float getGearShootingStartBottomTemperature() {
+ return gearShootingStartBottomTemperature;
+ }
+
+ public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) {
+ Object oldValue = getGearShootingStartBottomTemperature();
+ this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE, oldValue, gearShootingStartBottomTemperature);
+ }
+
+ public Float getGearShootingEndBottomTemperature() {
+ return gearShootingEndBottomTemperature;
+ }
+
+ public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) {
+ Object oldValue = getGearShootingEndBottomTemperature();
+ this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE, oldValue, gearShootingEndBottomTemperature);
+ }
+
+ public Float getAverageBottomTemperature() {
+ return averageBottomTemperature;
+ }
+
+ public void setAverageBottomTemperature(Float averageBottomTemperature) {
+ Object oldValue = getAverageBottomTemperature();
+ this.averageBottomTemperature = averageBottomTemperature;
+ firePropertyChange(PROPERTY_AVERAGE_BOTTOM_TEMPERATURE, oldValue, averageBottomTemperature);
+ }
+
+ public Float getGearShootingStartSurfaceSalinity() {
+ return gearShootingStartSurfaceSalinity;
+ }
+
+ public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) {
+ Object oldValue = getGearShootingStartSurfaceSalinity();
+ this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY, oldValue, gearShootingStartSurfaceSalinity);
+ }
+
+ public Float getGearShootingEndSurfaceSalinity() {
+ return gearShootingEndSurfaceSalinity;
+ }
+
+ public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) {
+ Object oldValue = getGearShootingEndSurfaceSalinity();
+ this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY, oldValue, gearShootingEndSurfaceSalinity);
+ }
+
+ public Float getGearShootingStartBottomSalinity() {
+ return gearShootingStartBottomSalinity;
+ }
+
+ public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) {
+ Object oldValue = getGearShootingStartBottomSalinity();
+ this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY, oldValue, gearShootingStartBottomSalinity);
+ }
+
+ public Float getGearShootingEndBottomSalinity() {
+ return gearShootingEndBottomSalinity;
+ }
+
+ public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) {
+ Object oldValue = getGearShootingEndBottomSalinity();
+ this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity;
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY, oldValue, gearShootingEndBottomSalinity);
+ }
+
+ public Float getAverageBottomSalinity() {
+ return averageBottomSalinity;
+ }
+
+ public void setAverageBottomSalinity(Float averageBottomSalinity) {
+ Object oldValue = getAverageBottomSalinity();
+ this.averageBottomSalinity = averageBottomSalinity;
+ firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity);
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.css)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,64 @@
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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%
+ */
+
+BeanComboBox {
+ showReset: true;
+ i18nPrefix: "tutti.property.";
+ bean: {model};
+}
+
+#newFishingOperationButton {
+ text: "tutti.action.new";
+ actionIcon: "add";
+}
+
+#traitComboBox {
+ property: "selectedFishingOperation";
+ selectedItem: {model.getSelectedFishingOperation()};
+}
+
+#speciesTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#benthosTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#planctonTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#macroDechetTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#accidentelTab {
+ enabled: {model.getSelectedFishingOperation() != null};
+}
+
+#observationIndividuelTab {
+ enabled: {false};
+ /*enabled: {model.getSelectedFishingOperation() != null};*/
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUI.jaxx)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,99 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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='homePanel' layout='{new BorderLayout()}'
+ implements='fr.ifremer.tutti.ui.swing.TuttiUI<FishingOperationsUIModel, FishingOperationsUIHandler>'>
+
+ <import>
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
+
+ fr.ifremer.tutti.ui.swing.TuttiUIContext
+ fr.ifremer.tutti.ui.swing.content.catches.accidentel.AccidentelTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.benthos.BenthosTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.macrodechet.MacroDechetTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.plancton.PlanctonTabUI
+ fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesTabUI
+
+ jaxx.runtime.swing.editor.bean.BeanComboBox
+
+ static org.nuiton.i18n.I18n._
+ </import>
+
+ <script><![CDATA[
+public FishingOperationsUI(TuttiUIContext context) {
+ FishingOperationsUIHandler handler = new FishingOperationsUIHandler(context, this);
+ setContextValue(handler);
+ handler.beforeInitUI();
+}
+
+protected void $afterCompleteSetup() {
+ handler.afterInitUI();
+}
+ ]]></script>
+
+ <FishingOperationsUIHandler id='handler'
+ initializer='getContextValue(FishingOperationsUIHandler.class)'/>
+
+ <FishingOperationsUIModel id='model'
+ initializer='getContextValue(FishingOperationsUIModel.class)'/>
+
+ <Table fill='both' id='topPanel' constraints='BorderLayout.NORTH'>
+
+ <!-- FishingOperations fishingOperation -->
+ <row>
+ <cell anchor='west' weightx='1.0'>
+ <BeanComboBox id='traitComboBox' constructorParams='this'
+ genericType='FishingOperation'/>
+ </cell>
+ <cell anchor='east'>
+ <JButton id='newFishingOperationButton'
+ onActionPerformed='getHandler().createNewFishingOperation()'/>
+ </cell>
+ </row>
+ </Table>
+
+ <JTabbedPane id='tabPane' constraints='BorderLayout.CENTER'>
+ <tab id='traitTab' title='tutti.label.tab.fishingOperation'>
+ <FishingOperationTabUI id='fishingOperationTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='speciesTab' title='tutti.label.tab.species'>
+ <SpeciesTabUI id='speciesTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='benthosTab' title='tutti.label.tab.benthos'>
+ <BenthosTabUI id='benthosTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='planctonTab' title='tutti.label.tab.plancton'>
+ <PlanctonTabUI id='planctonTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='macroDechetTab' title='tutti.label.tab.macroDechet'>
+ <MacroDechetTabUI id='macroDechetTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='accidentelTab' title='tutti.label.tab.accidentel'>
+ <AccidentelTabUI id='accidentelTabContent' constructorParams='this'/>
+ </tab>
+ <tab id='observationIndividuelTab' title='tutti.label.tab.observationIndividuel'>
+ <JLabel text='tutti.to.be.done' horizontalAlignment='{JLabel.CENTER}'/>
+ </tab>
+ </JTabbedPane>
+
+</JPanel>
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUI.jaxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIHandler.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,200 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Handler of UI {@link FishingOperationsUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationsUIHandler extends AbstractTuttiUIHandler<FishingOperationsUIModel> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(FishingOperationsUIHandler.class);
+
+ private final FishingOperationsUI ui;
+
+ private final PersistenceService persistenceService;
+
+ public FishingOperationsUIHandler(TuttiUIContext context, FishingOperationsUI ui) {
+ super(context);
+ this.ui = ui;
+ persistenceService = context.getService(PersistenceService.class);
+ }
+
+ @Override
+ public void beforeInitUI() {
+
+ FishingOperationsUIModel model = new FishingOperationsUIModel();
+
+ String campaignId = context.getScientificCruiseId();
+
+ // load existing scientificCruise
+ ScientificCruise scientificCruise = persistenceService.getScientificCruise(campaignId);
+ model.setScientificCruise(scientificCruise);
+
+ List<FishingOperation> fishingOperations = persistenceService.getAllFishingOperation(campaignId);
+ model.setFishingOperation(fishingOperations);
+
+ if (log.isInfoEnabled()) {
+ log.info("Loaded " + fishingOperations.size() + " fishingOperation(s).");
+ }
+
+ ui.setContextValue(model);
+ }
+
+ @Override
+ public void afterInitUI() {
+
+ FishingOperationsUIModel model = getModel();
+
+ initUI(ui);
+
+ List<FishingOperation> fishingOperations = model.getFishingOperation();
+
+ initBeanComboBox(ui.getTraitComboBox(),
+ fishingOperations,
+ model.getSelectedFishingOperation());
+
+ model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_SELECTED_FISHING_OPERATION, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ selectFishingOperation((FishingOperation) evt.getNewValue());
+ }
+ });
+
+ model.addPropertyChangeListener(FishingOperationsUIModel.PROPERTY_FISHING_OPERATION, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ ui.getTraitComboBox().setData(null);
+ ui.getTraitComboBox().setData((List<FishingOperation>) evt.getNewValue());
+ }
+ });
+
+ if (!fishingOperations.isEmpty()) {
+
+ model.setSelectedFishingOperation(fishingOperations.get(0));
+ }
+ }
+
+ @Override
+ public void onCloseUI() {
+
+ // ui will be saved so we do not want to keep selected tab indexes
+ ui.getTabPane().setSelectedIndex(0);
+ ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
+
+ // when quitting ui, let's de-select fishingOperation (will save any changes)
+ selectFishingOperation(null);
+ }
+
+ @Override
+ protected FishingOperationsUIModel getModel() {
+ return ui.getModel();
+ }
+
+ public void createNewFishingOperation() {
+
+ // deselect selected fishingOperation
+ getModel().setSelectedFishingOperation(null);
+
+ // use a new empty fishingOperation
+ FishingOperation newFishingOperation = new FishingOperation();
+ newFishingOperation.setScientificCruise(getModel().getScientificCruise());
+ newFishingOperation.setDate(new Date());
+ selectFishingOperation(newFishingOperation);
+ }
+
+ public void selectFishingOperation(FishingOperation fishingOperation) {
+
+ if (log.isInfoEnabled()) {
+ log.info("New selected fishingOperation: " + fishingOperation);
+ }
+ // back to fishingOperation tab
+ ui.getTabPane().setSelectedIndex(0);
+
+ // back to general tab of fishingOperation tabs
+ ui.getFishingOperationTabContent().getTraitTabPane().setSelectedIndex(0);
+
+ // propagate fishingOperation to his tabs
+ ui.getFishingOperationTabContent().selectFishingOperation(fishingOperation);
+ ui.getSpeciesTabContent().selectFishingOperation(fishingOperation);
+ ui.getBenthosTabContent().selectFishingOperation(fishingOperation);
+ ui.getPlanctonTabContent().selectFishingOperation(fishingOperation);
+ ui.getMacroDechetTabContent().selectFishingOperation(fishingOperation);
+ ui.getAccidentelTabContent().selectFishingOperation(fishingOperation);
+
+ // repaint tabs
+ ui.getTabPane().repaint();
+// ui.getObservationIndividuelTabContent().selectFishingOperation(selectedFishingOperation);
+ }
+
+ public void saveFishingOperation(FishingOperation toSave) {
+
+ // persist the fishingOperation
+
+ boolean create = toSave.getId() == null;
+
+ FishingOperation savedFishingOperation;
+ if (create) {
+ savedFishingOperation = persistenceService.createFishingOperation(toSave);
+ } else {
+ savedFishingOperation = persistenceService.saveFishingOperation(toSave);
+ }
+
+ FishingOperationsUIModel model = getModel();
+
+ // add the saved fishingOperation to fishingOperation list
+
+ List<FishingOperation> data = model.getFishingOperation();
+
+ FishingOperation existingFishingOperation = TuttiEntities.findById(data, savedFishingOperation.getId());
+ if (existingFishingOperation != null) {
+ data.remove(existingFishingOperation);
+ }
+ data.add(savedFishingOperation);
+
+ // update model fishingOperation list
+ model.setFishingOperation(data);
+
+ // update model selected fishingOperation
+ model.setSelectedFishingOperation(savedFishingOperation);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java (from rev 36, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/CatchesUIModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,83 @@
+package fr.ifremer.tutti.ui.swing.content.catches;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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.ifremer.tutti.persistence.entities.data.ScientificCruise;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import org.jdesktop.beans.AbstractSerializableBean;
+
+import java.util.List;
+
+/**
+ * Model fo UI {@link FishingOperationsUI}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class FishingOperationsUIModel extends AbstractSerializableBean {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_FISHING_OPERATION = "fishingOperation";
+
+ public static final String PROPERTY_SELECTED_FISHING_OPERATION = "selectedFishingOperation";
+
+ public static final String PROPERTY_SCIENTIFIC_CRUISE = "scientificCruise";
+
+ protected List<FishingOperation> fishingOperation;
+
+ protected FishingOperation selectedFishingOperation;
+
+ protected ScientificCruise scientificCruise;
+
+ public List<FishingOperation> getFishingOperation() {
+ return fishingOperation;
+ }
+
+ public void setFishingOperation(List<FishingOperation> fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ firePropertyChange(PROPERTY_FISHING_OPERATION, null, fishingOperation);
+ }
+
+ public FishingOperation getSelectedFishingOperation() {
+ return selectedFishingOperation;
+ }
+
+ public void setSelectedFishingOperation(FishingOperation selectedFishingOperation) {
+ Object oldValue = getSelectedFishingOperation();
+ this.selectedFishingOperation = selectedFishingOperation;
+ firePropertyChange(PROPERTY_SELECTED_FISHING_OPERATION, oldValue, selectedFishingOperation);
+ }
+
+ public ScientificCruise getScientificCruise() {
+ return scientificCruise;
+ }
+
+ public void setScientificCruise(ScientificCruise scientificCruise) {
+ Object oldValue = getScientificCruise();
+ this.scientificCruise = scientificCruise;
+ firePropertyChange(PROPERTY_SCIENTIFIC_CRUISE, oldValue, scientificCruise);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationsUIModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,498 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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%
- */
-
-JToolBar {
- floatable:false;
-}
-
-BeanComboBox {
- showReset:true;
- i18nPrefix:"tutti.property.";
- bean:{model};
-}
-
-BeanListHeader {
- showReset:true;
- i18nPrefix:"tutti.property.";
-}
-
-JList {
- selectionMode:{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION};
- model:{new DefaultListModel()};
-}
-
-NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
-}
-
-#stationNumberLabel {
- text:"tutti.label.trait.stationNumber";
- labelFor:{stationNumberField};
-}
-
-#stationNumberTraitNumberLabel {
- text:"tutti.label.trait.stationNumberTraitNumber";
-}
-
-#stationNumberField {
- property:"stationNumber";
- model:{model.getStationNumber()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#traitNumberLabel {
- text:"tutti.label.trait.traitNumber";
- labelFor:{traitNumberField};
-}
-
-#traitNumberField {
- property:"traitNumber";
- model:{model.getTraitNumber()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#dateLabel {
- text:"tutti.label.trait.date";
- labelFor:{dateField};
-}
-
-#dateField {
- date:{model.getDate()};
- formats:{"dd/MM/yyyy"};
-}
-
-#strataLabel {
- text:"tutti.label.trait.strata";
- labelFor:{strataComboBox};
-}
-
-#strataComboBox {
- property:"strata";
- selectedItem:{model.getStrata()};
-}
-
-#beaufortScaleLabel {
- text:"tutti.label.trait.beaufortScale";
- labelFor:{beaufortScaleComboBox};
-}
-
-#beaufortScaleComboBox {
- property:"beaufortScale";
- selectedItem:{model.getBeaufortScale()};
-}
-
-#windDirectionLabel {
- text:"tutti.label.trait.windDirection";
- labelFor:{windDirectionField};
-}
-
-#windDirectionField {
- property:"windDirection";
- model:{model.getWindDirection()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#seaStateLabel {
- text:"tutti.label.trait.seaState";
- labelFor:{seaStateComboBox};
-}
-
-#seaStateComboBox {
- property:"seaState";
- selectedItem:{model.getSeaState()};
-}
-
-#ouvertureHorizontaleLabel {
- text:"tutti.label.trait.ouvertureHorizontale";
- labelFor:{ouvertureHorizontaleField};
-}
-
-#ouvertureHorizontaleVerticaleLabel {
- text:"tutti.label.trait.ouvertureHorizontaleVerticale";
-}
-
-#ouvertureHorizontaleField {
- property:"ouvertureHorizontale";
- model:{model.getOuvertureHorizontale()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#ouvertureVerticaleLabel {
- text:"tutti.label.trait.ouvertureVerticale";
- labelFor:{ouvertureVerticaleField};
-}
-
-#ouvertureVerticaleField {
- property:"ouvertureVerticale";
- model:{model.getOuvertureVerticale()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#geometrieMesureeCheckBox {
- text:"tutti.label.trait.geometrieMesuree";
- selected:{model.isGeometrieMesuree()};
-}
-
-#longueurFunesLabel {
- text:"tutti.label.trait.longueurFunes";
- labelFor:{longueurFunesField};
-}
-
-#longueurFunesBrasLabel {
- text:"tutti.label.trait.longueurFunesBras";
-}
-
-#longueurFunesField {
- property:"longueurFunes";
- model:{model.getLongueurFunes()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#longueurBrasLabel {
- text:"tutti.label.trait.longueurBras";
- labelFor:{longueurBrasField};
-}
-
-#longueurBrasField {
- property:"longueurBras";
- model:{model.getLongueurBras()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#systemeFermetureCulCheckBox {
- text:"tutti.label.trait.systemeFermetureCul";
- selected:{model.isSystemeFermetureCul()};
-}
-
-#traitRectiligneCheckBox {
- text:"tutti.label.trait.traitRectiligne";
- selected:{model.isTraitRectiligne()};
-}
-
-#distanceChaluteeLabel {
- text:"tutti.label.trait.distanceChalutee";
- labelFor:{distanceChaluteeField};
-}
-
-#distanceChaluteeDureeLabel {
- text:"tutti.label.trait.distanceChaluteeDuree";
-}
-
-#distanceChaluteeField {
- property:"distanceChalutee";
- model:{model.getDistanceChalutee()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#dureeLabel {
- text:"tutti.label.trait.duree";
- labelFor:{dureeField};
-}
-
-#dureeField {
- property:"duree";
- model:{model.getDuree()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#traitValidCheckBox {
- text:"tutti.label.trait.traitValid";
- selected:{model.isTraitValid()};
-}
-
-#localiteLabel {
- text:"tutti.label.trait.localite";
- labelFor:{localiteField};
-}
-
-#localiteField {
- text:{model.getLocalite()};
-}
-
-#saisisseurPane {
- horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER};
- verticalScrollBarPolicy:{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED};
-}
-
-#saisisseurHeader {
- labelText:{_("tutti.label.list.saisisseur")};
- list:{saisisseurList};
- beanType:{TuttiUser.class};
-}
-
-#commentPane {
- columnHeaderView:{new JLabel(_("tutti.label.comment"))};
- minimumSize:{new Dimension(10,50)};
-}
-
-#commentField {
- text:{model.getComment()};
-}
-
-#gearShootingStartLongitudeLabel {
- text:"tutti.label.trait.gearShootingStartLongitude";
- labelFor:{gearShootingStartLongitudeField};
-}
-
-#gearShootingStartLongitudeField {
- text:{getStringValue(model.getGearShootingStartLongitude())};
-}
-
-#gearShootingStartLatitudeLabel {
- text:"tutti.label.trait.gearShootingStartLatitude";
- labelFor:{gearShootingStartLatitudeField};
-}
-
-#gearShootingStartLatitudeField {
- text:{getStringValue(model.getGearShootingStartLatitude())};
-}
-
-#gearShootingStartTimeLabel {
- text:"tutti.label.trait.gearShootingStartTime";
- labelFor:{gearShootingStartTimeField};
-}
-
-#gearShootingStartTimeField {
- text:{getStringValue(model.getGearShootingStartTime())};
-}
-
-#gearShootingStartDepthLabel {
- text:"tutti.label.trait.gearShootingStartDepth";
- labelFor:{gearShootingStartDepthField};
-}
-
-#gearShootingStartDepthField {
- property:"gearShootingStartDepth";
- model:{model.getGearShootingStartDepth()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndLongitudeLabel {
- text:"tutti.label.trait.gearShootingEndLongitude";
- labelFor:{gearShootingEndLongitudeField};
-}
-
-#gearShootingEndLongitudeField {
- text:{getStringValue(model.getGearShootingEndLongitude())};
-}
-
-#gearShootingEndLatitudeLabel {
- text:"tutti.label.trait.gearShootingEndLatitude";
- labelFor:{gearShootingEndLatitudeField};
-}
-
-#gearShootingEndLatitudeField {
- text:{getStringValue(model.getGearShootingEndLatitude())};
-}
-
-#gearShootingEndTimeLabel {
- text:"tutti.label.trait.gearShootingEndTime";
- labelFor:{gearShootingEndTimeField};
-}
-
-#gearShootingEndTimeField {
- text:{getStringValue(model.getGearShootingEndTime())};
-}
-
-#gearShootingEndDepthLabel {
- text:"tutti.label.trait.gearShootingEndDepth";
- labelFor:{gearShootingEndDepthField};
-}
-
-#gearShootingEndDepthField {
- property:"gearShootingEndDepth";
- model:{model.getGearShootingEndDepth()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartSurfaceTemperatureLabel {
- text:"tutti.label.trait.gearShootingStartSurfaceTemperature";
- labelFor:{gearShootingStartSurfaceTemperatureField};
-}
-
-#gearShootingStartSurfaceTemperatureField {
- property:"gearShootingStartSurfaceTemperature";
- model:{model.getGearShootingStartSurfaceTemperature()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndSurfaceTemperatureLabel {
- text:"tutti.label.trait.gearShootingEndSurfaceTemperature";
- labelFor:{gearShootingEndSurfaceTemperatureField};
-}
-
-#gearShootingEndSurfaceTemperatureField {
- property:"gearShootingEndSurfaceTemperature";
- model:{model.getGearShootingEndSurfaceTemperature()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartBottomTemperatureLabel {
- text:"tutti.label.trait.gearShootingStartBottomTemperature";
- labelFor:{gearShootingStartBottomTemperatureField};
-}
-
-#gearShootingStartBottomTemperatureField {
- property:"gearShootingStartBottomTemperature";
- model:{model.getGearShootingStartBottomTemperature()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndBottomTemperatureLabel {
- text:"tutti.label.trait.gearShootingEndBottomTemperature";
- labelFor:{gearShootingEndBottomTemperatureField};
-}
-
-#gearShootingEndBottomTemperatureField {
- property:"gearShootingEndBottomTemperature";
- model:{model.getGearShootingEndBottomTemperature()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#averageBottomTemperatureLabel {
- text:"tutti.label.trait.averageBottomTemperature";
- labelFor:{averageBottomTemperatureField};
-}
-
-#averageBottomTemperatureField {
- property:"averageBottomTemperature";
- model:{model.getAverageBottomTemperature()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartSurfaceSalinityLabel {
- text:"tutti.label.trait.gearShootingStartSurfaceSalinity";
- labelFor:{gearShootingStartSurfaceSalinityField};
-}
-
-#gearShootingStartSurfaceSalinityField {
- property:"gearShootingStartSurfaceSalinity";
- model:{model.getGearShootingStartSurfaceSalinity()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndSurfaceSalinityLabel {
- text:"tutti.label.trait.gearShootingEndSurfaceSalinity";
- labelFor:{gearShootingEndSurfaceSalinityField};
-}
-
-#gearShootingEndSurfaceSalinityField {
- property:"gearShootingEndSurfaceSalinity";
- model:{model.getGearShootingEndSurfaceSalinity()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingStartBottomSalinityLabel {
- text:"tutti.label.trait.gearShootingStartBottomSalinity";
- labelFor:{gearShootingStartBottomSalinityField};
-}
-
-#gearShootingStartBottomSalinityField {
- property:"gearShootingStartBottomSalinity";
- model:{model.getGearShootingStartBottomSalinity()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#gearShootingEndBottomSalinityLabel {
- text:"tutti.label.trait.gearShootingEndBottomSalinity";
- labelFor:{gearShootingEndBottomSalinityField};
-}
-
-#gearShootingEndBottomSalinityField {
- property:"gearShootingEndBottomSalinity";
- model:{model.getGearShootingEndBottomSalinity()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#averageBottomSalinityLabel {
- text:"tutti.label.trait.averageBottomSalinity";
- labelFor:{averageBottomSalinityField};
-}
-
-#averageBottomSalinityField {
- property:"averageBottomSalinity";
- model:{model.getAverageBottomSalinity()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
-}
-
-#noTraitPane {
- text:"tutti.label.no.trait.selected";
- horizontalAlignment:{JLabel.CENTER};
-}
-
-#saveButton {
- actionIcon:"save";
- text:"tutti.action.save";
- enabled:{model.isModify() && model.isValid()};
-}
-
-#cancelButton {
- actionIcon:"cancel";
- text:"tutti.action.cancel";
- enabled:{model.isModify()};
-}
-
-#importPupitriButton {
- actionIcon:"pupitri-import";
- text:"tutti.action.pupitri-import";
-}
-
-#messagePanel {
- border:{BorderFactory.createTitledBorder("Messages")};
- height:200;
- width:500;
-}
-
-#errorTable {
- rowSelectionAllowed:true;
- autoCreateRowSorter:true;
- autoResizeMode:2;
- cellSelectionEnabled:false;
- selectionMode:0;
- model:{errorTableModel};
-}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,543 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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='homePanel' layout='{new BorderLayout()}'
- implements='fr.ifremer.tutti.ui.swing.TuttiUI<TraitTabUIModel, TraitTabUIHandler>'>
-
- <import>
- fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
- fr.ifremer.tutti.persistence.entities.referential.SeaState
- fr.ifremer.tutti.persistence.entities.data.Strata
- fr.ifremer.tutti.persistence.entities.data.Trait
- fr.ifremer.tutti.persistence.entities.referential.TuttiUser
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.editor.bean.BeanComboBox
- jaxx.runtime.swing.editor.bean.BeanListHeader
- jaxx.runtime.swing.editor.NumberEditor
-
- jaxx.runtime.validator.swing.SwingValidatorUtil
- jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
-
- org.jdesktop.swingx.JXDatePicker
-
- java.awt.Dimension
-
- javax.swing.DefaultListModel
- javax.swing.ListSelectionModel
-
- static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
- </import>
-
- <script><![CDATA[
-
-public TraitTabUI(CatchesUI parentUI) {
- TraitTabUIHandler handler = new TraitTabUIHandler(parentUI, this);
- setContextValue(handler);
- handler.beforeInitUI();
-}
-
-public void selectTrait(Trait trait) { handler.selectTrait(trait); }
-
-protected void $afterCompleteSetup() { handler.afterInitUI(); }
- ]]></script>
-
- <TraitTabUIHandler id='handler'
- initializer='getContextValue(TraitTabUIHandler.class)'/>
-
- <TraitTabUIModel id='model'
- initializer='getContextValue(TraitTabUIModel.class)'/>
-
- <SwingValidatorMessageTableModel id='errorTableModel'/>
-
- <BeanValidator id='validator' bean='model' errorTableModel='errorTableModel'
- uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='stationNumber' component='stationNumberField'/>
- <field name='traitNumber' component='traitNumberField'/>
- <field name='date' component='dateField'/>
- <field name='comment' component='commentField'/>
- <field name='saisisseur' component='saisisseurPane'/>
- </BeanValidator>
-
- <JPanel id='traitPane' constraints='BorderLayout.CENTER'
- layout='{new BorderLayout()}'>
-
- <JTabbedPane id='traitTabPane' constraints='BorderLayout.CENTER'>
- <tab id='traitGeneralTab' title='tutti.label.tab.trait.general'>
- <Table fill='both' id='generalForm'>
-
- <!-- Numero station -->
- <row>
- <cell anchor='west'>
- <!--JLabel id='stationNumberLabel'/-->
- <JLabel id='stationNumberTraitNumberLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <NumberEditor id='stationNumberField' constructorParams='this'/>
- <NumberEditor id='traitNumberField' constructorParams='this'/>
- </JPanel>
- </cell>
- </row>
-
- <!-- Numero trait / chalut -->
- <!--row>
- <cell>
- <JLabel id='traitNumberLabel'/>
- </cell>
- <cell>
- <NumberEditor id='traitNumberField' constructorParams='this'/>
- </cell>
- </row-->
-
- <!-- Date -->
- <row>
- <cell>
- <JLabel id='dateLabel'/>
- </cell>
- <cell>
- <JXDatePicker id='dateField'
- onActionPerformed='model.setDate(((JXDatePicker)event.getSource()).getDate())'/>
- </cell>
- </row>
-
- <!-- Strate d'association -->
- <row>
- <cell>
- <JLabel id='strataLabel'/>
- </cell>
- <cell fill='horizontal'>
- <BeanComboBox id='strataComboBox' constructorParams='this'
- genericType='Strata'/>
- </cell>
- </row>
-
- <!-- Beaufort scale -->
- <row>
- <cell anchor='west'>
- <JLabel id='beaufortScaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <BeanComboBox id='beaufortScaleComboBox' constructorParams='this'
- genericType='BeaufortScale'/>
- </cell>
- </row>
-
- <!-- Wind direction -->
- <row>
- <cell anchor='west'>
- <JLabel id='windDirectionLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='windDirectionField' constructorParams='this'/>
- </cell>
- </row>
-
- <!-- Sea state-->
- <row>
- <cell anchor='west'>
- <JLabel id='seaStateLabel'/>
- </cell>
- <cell fill='horizontal'>
- <BeanComboBox id='seaStateComboBox' constructorParams='this'
- genericType='SeaState'/>
- </cell>
- </row>
-
- <!-- Ouverture horizontale -->
- <row>
- <cell anchor='west'>
- <JLabel id='ouvertureHorizontaleVerticaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <NumberEditor id='ouvertureHorizontaleField'
- constructorParams='this'/>
- <NumberEditor id='ouvertureVerticaleField'
- constructorParams='this'/>
- </JPanel>
- </cell>
- </row>
-
- <!-- Ouverture verticale -->
- <!--row>
- <cell anchor='west'>
- <JLabel id='ouvertureVerticaleLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='ouvertureVerticaleField'
- constructorParams='this'/>
- </cell>
- </row-->
-
- <!-- Longueur funes -->
- <row>
- <cell anchor='west'>
- <JLabel id='longueurFunesBrasLabel'/>
- </cell>
- <cell fill='horizontal'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <NumberEditor id='longueurFunesField' constructorParams='this'/>
- <NumberEditor id='longueurBrasField' constructorParams='this'/>
- </JPanel>
- </cell>
- </row>
-
- <!-- Longueur bras -->
- <!--row>
- <cell anchor='west'>
- <JLabel id='longueurBrasLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='longueurBrasField' constructorParams='this'/>
- </cell>
- </row-->
-
- <!-- Distance chalutée -->
- <row>
- <cell anchor='west'>
- <JLabel id='distanceChaluteeDureeLabel'/>
- </cell>
- <cell fill='horizontal'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <NumberEditor id='distanceChaluteeField' constructorParams='this'/>
- <NumberEditor id='dureeField' constructorParams='this'/>
- </JPanel>
- </cell>
- </row>
-
- <!-- Durée -->
- <!--row>
- <cell anchor='west'>
- <JLabel id='dureeLabel'/>
- </cell>
- <cell fill='horizontal'>
- <NumberEditor id='dureeField' constructorParams='this'/>
- </cell>
- </row-->
-
- <!-- Localité -->
- <row>
- <cell>
- <JLabel id='localiteLabel'/>
- </cell>
- <cell>
- <JTextField id='localiteField'
- onKeyReleased='handler.setText(event, "localite")'/>
- </cell>
- </row>
-
- <!-- Trait valide / Rectiligne -->
- <row>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JCheckBox id='traitValidCheckBox'
- onItemStateChanged='handler.setBoolean(event, "traitValid")'/>
- <JCheckBox id='traitRectiligneCheckBox'
- onItemStateChanged='handler.setBoolean(event, "traitRectiligne")'/>
- </JPanel>
- </cell>
- </row>
-
- <!-- Système de fermeture du cul / Geometrie mesuree -->
- <row>
- <cell columns='2'>
- <JPanel layout='{new GridLayout(1,0)}'>
- <JCheckBox id='systemeFermetureCulCheckBox'
- onItemStateChanged='handler.setBoolean(event, "systemeFermetureCul")'/>
- <JCheckBox id='geometrieMesureeCheckBox'
- onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
- </JPanel>
- </cell>
- </row>
-
- <!-- Trait rectiligne -->
- <!--row>
- <cell columns='2'>
- <JCheckBox id='traitRectiligneCheckBox'
- onItemStateChanged='handler.setBoolean(event, "traitRectiligne")'/>
- </cell>
- </row-->
-
- <!-- Geometrie mesuree -->
- <!--row>
- <cell columns='2'>
- <JCheckBox id='geometrieMesureeCheckBox'
- onItemStateChanged='handler.setBoolean(event, "geometrieMesuree")'/>
- </cell>
- </row-->
-
- <!-- Saisisseur -->
- <row weighty='0.3'>
- <cell columns='2'>
- <JScrollPane id='saisisseurPane'
- columnHeaderView="{saisisseurHeader}"
- onFocusGained='saisisseurList.requestFocus()'>
- <JList id='saisisseurList'
- onValueChanged='handler.selectListData(event, "saisisseur")'/>
- <BeanListHeader id='saisisseurHeader' genericType='TuttiUser'/>
- </JScrollPane>
- </cell>
- </row>
-
- <!-- Commentaire -->
- <row weighty='0.3'>
- <cell columns='2'>
- <JScrollPane id='commentPane'
- onFocusGained='commentField.requestFocus()'>
- <JTextArea id='commentField'
- onKeyReleased='handler.setText(event, "comment")'/>
- </JScrollPane>
- </cell>
- </row>
- </Table>
- </tab>
-
- <tab id='traitGearShootingTab' title='tutti.label.tab.trait.gearShooting'>
-
- <Table fill='both' id='gearShootingForm'>
-
- <!-- GearShootingStart Longitude -->
- <row>
- <cell>
- <JLabel id='gearShootingStartLongitudeLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JTextField id='gearShootingStartLongitudeField'
- onKeyReleased='handler.setGearShootingStartLongitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- </row>
-
- <!-- GearShootingStart Latitude -->
- <row>
- <cell>
- <JLabel id='gearShootingStartLatitudeLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JTextField id='gearShootingStartLatitudeField'
- onKeyReleased='handler.setGearShootingStartLatitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- </row>
-
- <!-- GearShootingStart Time -->
- <row>
- <cell>
- <JLabel id='gearShootingStartTimeLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JTextField id='gearShootingStartTimeField'
- onKeyReleased='handler.setGearShootingStartTime(((JTextField)event.getSource()).getText())'/>
- </cell>
- </row>
-
- <!-- GearShootingStart Depth -->
- <row>
- <cell>
- <JLabel id='gearShootingStartDepthLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartDepthField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEnd Longitude -->
- <row>
- <cell>
- <JLabel id='gearShootingEndLongitudeLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JTextField id='gearShootingEndLongitudeField'
- onKeyReleased='handler.setGearShootingEndLongitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- </row>
-
- <!-- GearShootingEnd Latitude -->
- <row>
- <cell>
- <JLabel id='gearShootingEndLatitudeLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JTextField id='gearShootingEndLatitudeField'
- onKeyReleased='handler.setGearShootingEndLatitude(((JTextField)event.getSource()).getText())'/>
- </cell>
- </row>
-
- <!-- GearShootingEnd Time -->
- <row>
- <cell>
- <JLabel id='gearShootingEndTimeLabel'/>
- </cell>
- <cell weightx='1.0'>
- <JTextField id='gearShootingEndTimeField'
- onKeyReleased='handler.setGearShootingEndTime(((JTextField)event.getSource()).getText())'/>
- </cell>
- </row>
-
- <!-- GearShootingEnd Depth -->
- <row>
- <cell>
- <JLabel id='gearShootingEndDepthLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndDepthField'
- constructorParams='this'/>
- </cell>
- </row>
- </Table>
- </tab>
-
- <tab id='traitHydrologyTabContent' title='tutti.label.tab.trait.hydrology'>
-
- <Table fill='both' id='hydrologyForm'>
-
- <!-- GearShootingStartSurfaceTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingStartSurfaceTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartSurfaceTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndSurfaceTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingEndSurfaceTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndSurfaceTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartBottomTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingStartBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndBottomTemperature -->
- <row>
- <cell>
- <JLabel id='gearShootingEndBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- AverageBottomTemperature -->
- <row>
- <cell>
- <JLabel id='averageBottomTemperatureLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='averageBottomTemperatureField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartSurfaceSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingStartSurfaceSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartSurfaceSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndSurfaceSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingEndSurfaceSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndSurfaceSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingStartBottomSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingStartBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingStartBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- GearShootingEndBottomSalinity -->
- <row>
- <cell>
- <JLabel id='gearShootingEndBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='gearShootingEndBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- <!-- AverageBottomSalinity -->
- <row>
- <cell>
- <JLabel id='averageBottomSalinityLabel'/>
- </cell>
- <cell weightx='1.0'>
- <NumberEditor id='averageBottomSalinityField'
- constructorParams='this'/>
- </cell>
- </row>
-
- </Table>
- </tab>
- </JTabbedPane>
-
- <!-- Actions -->
- <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.SOUTH'>
- <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.NORTH'>
- <JButton id='importPupitriButton' onActionPerformed='handler.importPupitri()'/>
- </JPanel>
- <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.CENTER'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
- </JPanel>
- </JPanel>
-
- </JPanel>
-
- <JLabel id='noTraitPane'/>
-</JPanel>
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,234 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.Trait;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import java.awt.BorderLayout;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.sql.Date;
-import java.util.List;
-
-/**
- * Handler for UI {@link TraitTabUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class TraitTabUIHandler extends AbstractTuttiUIHandler<TraitTabUIModel> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(TraitTabUIHandler.class);
-
- private final TraitTabUI ui;
-
- private final CatchesUI parentUi;
-
- private final PersistenceService persistenceService;
-
- public TraitTabUIHandler(CatchesUI parentUi, TraitTabUI ui) {
- super(parentUi.getHandler().getContext());
- this.ui = ui;
- this.parentUi = parentUi;
- this.persistenceService = context.getService(PersistenceService.class);
- }
-
- @Override
- public void beforeInitUI() {
-
- TraitTabUIModel model = new TraitTabUIModel();
- model.addPropertyChangeListener(TraitTabUIModel.PROPERTY_EMPTY, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- JPanel form = ui.getTraitPane();
- JLabel noContentPane = ui.getNoTraitPane();
-
- Boolean empty = (Boolean) evt.getNewValue();
- ui.remove(form);
- ui.remove(noContentPane);
- if (empty) {
- ui.add(noContentPane, BorderLayout.CENTER);
- } else {
- ui.add(form, BorderLayout.CENTER);
- }
- ui.repaint();
- }
- });
-
- listModelIsModify(model);
-
- ui.setContextValue(model);
- }
-
- @Override
- public void afterInitUI() {
-
- TraitTabUIModel model = ui.getModel();
-
- initUI(ui);
-
- initBeanList(ui.getSaisisseurHeader(),
- persistenceService.getAllTuttiUser(),
- model.getSaisisseur());
-
- initBeanComboBox(ui.getBeaufortScaleComboBox(),
- persistenceService.getAllBeaufortScale(),
- model.getBeaufortScale());
-
- initBeanComboBox(ui.getStrataComboBox(),
- persistenceService.getAllStrata(),
- model.getStrata());
-
- initBeanComboBox(ui.getSeaStateComboBox(),
- persistenceService.getAllSeaState(),
- model.getSeaState());
-
- model.setEmpty(true);
-
- listenValidatorValid(ui.getValidator(), getModel());
- }
-
- @Override
- public void onCloseUI() {
- }
-
- @Override
- protected TraitTabUIModel getModel() {
- return ui.getModel();
- }
-
- public void selectTrait(Trait bean) {
-
- boolean empty = bean == null;
-
- TraitTabUIModel model = ui.getModel();
-
- // clean previous selection
- ui.getSaisisseurHeader().getList().clearSelection();
-
- if (empty) {
-
- model.fromBean(new Trait());
- } else {
-
- model.fromBean(bean);
- }
-
- // update saisissuer selection
- List<TuttiUser> saisisseur = model.getSaisisseur();
- if (CollectionUtils.isNotEmpty(saisisseur)) {
- updateIndices(ui.getSaisisseurList(), saisisseur);
- }
-
- // update model empty property
- model.setEmpty(empty);
-
- // reload bean in validator (? really mandatory?)
-// ui.getValidator().reloadBean();
-
- // if new trait can already cancel his creation
- model.setModify(!empty && model.isCreate());
- }
-
- public void cancel() {
-
- String id = ui.getModel().getId();
-
- if (log.isInfoEnabled()) {
- log.info("Cancel edition for trait: " + id);
- }
- boolean newBean = StringUtils.isBlank(id);
-
- if (newBean) {
-
- // cancel to create a new trait
- parentUi.getHandler().selectTrait(null);
-
- } else {
-
- // reselect in ui the trait
- Trait selectedTrait = parentUi.getModel().getSelectedTrait();
- parentUi.getHandler().selectTrait(selectedTrait);
- }
- }
-
- public void save() {
-
- // get trait to save
- Trait toSave = ui.getModel().toBean();
-
- if (log.isInfoEnabled()) {
- log.info("Save edition for trait: " + toSave.getId());
- }
-
- // keep selected tab (to resotre it after save)
- int selectedIndex = ui.getTraitTabPane().getSelectedIndex();
-
- // persist current trait
- parentUi.getHandler().saveTrait(toSave);
-
- // reselect current tab
- ui.getTraitTabPane().setSelectedIndex(selectedIndex);
- }
-
- public void importPupitri() {
- //TODO
- }
-
- public void setGearShootingStartLatitude(String text) {
- ui.getModel().setGearShootingStartLatitude(Float.valueOf(text));
- }
-
- public void setGearShootingStartLongitude(String text) {
- ui.getModel().setGearShootingStartLongitude(Float.valueOf(text));
- }
-
- public void setGearShootingStartTime(String text) {
- ui.getModel().setGearShootingStartTime(Date.valueOf(text));
- }
-
- public void setGearShootingEndLatitude(String text) {
- ui.getModel().setGearShootingEndLatitude(Float.valueOf(text));
- }
-
- public void setGearShootingEndLongitude(String text) {
- ui.getModel().setGearShootingEndLongitude(Float.valueOf(text));
- }
-
- public void setGearShootingEndTime(String text) {
- ui.getModel().setGearShootingEndTime(Date.valueOf(text));
- }
-}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,615 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.persistence.entities.data.Campaign;
-import fr.ifremer.tutti.persistence.entities.data.Strata;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
-import fr.ifremer.tutti.persistence.entities.referential.BeaufortScale;
-import fr.ifremer.tutti.persistence.entities.referential.SeaState;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiUser;
-import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * Model for UI {@link TraitTabUI}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class TraitTabUIModel extends AbstractTuttiBeanUIModel<Trait, TraitTabUIModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_EMPTY = "empty";
-
- public static final String PROPERTY_STATION_NUMBER = "stationNumber";
-
- public static final String PROPERTY_TRAIT_NUMBER = "traitNumber";
-
- public static final String PROPERTY_DATE = "date";
-
- public static final String PROPERTY_STRATA = "strata";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_TIME = "gearShootingStartTime";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_DEPTH = "gearShootingStartDepth";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_TIME = "gearShootingEndTime";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_DEPTH = "gearShootingEndDepth";
-
- public static final String PROPERTY_BEAUFORT_SCALE = "beaufortScale";
-
- public static final String PROPERTY_WIND_DIRECTION = "windDirection";
-
- public static final String PROPERTY_SEA_STATE = "seaState";
-
- public static final String PROPERTY_OUVERTURE_HORIZONTALE = "ouvertureHorizontale";
-
- public static final String PROPERTY_OUVERTURE_VERTICALE = "ouvertureVerticale";
-
- public static final String PROPERTY_GEOMETRIE_MESUREE = "geometrieMesuree";
-
- public static final String PROPERTY_LONGUEUR_FUNES = "longueurFunes";
-
- public static final String PROPERTY_LONGUEUR_BRAS = "longueurBras";
-
- public static final String PROPERTY_SYSTEME_FERMETURE_CUL = "systemeFermetureCul";
-
- public static final String PROPERTY_TRAIT_RECTILIGNE = "traitRectiligne";
-
- public static final String PROPERTY_DISTANCE_CHALUTEE = "distanceChalutee";
-
- public static final String PROPERTY_DUREE = "duree";
-
- public static final String PROPERTY_TRAIT_VALID = "traitValid";
-
- public static final String PROPERTY_LOCALITE = "localite";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_SAISISSEUR = "saisisseur";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE = "gearShootingStartSurfaceTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE = "gearShootingEndSurfaceTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE = "gearShootingStartBottomTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE = "gearShootingEndBottomTemperature";
-
- public static final String PROPERTY_AVERAGE_BOTTOM_TEMPERATURE = "averageBottomTemperature";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY = "gearShootingStartSurfaceSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY = "gearShootingEndSurfaceSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY = "gearShootingStartBottomSalinity";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY = "gearShootingEndBottomSalinity";
-
- public static final String PROPERTY_AVERAGE_BOTTOM_SALINITY = "averageBottomSalinity";
-
- protected boolean empty;
-
- protected Campaign campaign;
-
- protected Integer stationNumber;
-
- protected Integer traitNumber;
-
- protected Date date;
-
- protected Strata strata;
-
- protected Float gearShootingStartLatitude;
-
- protected Float gearShootingStartLongitude;
-
- protected Date gearShootingStartTime;
-
- protected Float gearShootingStartDepth;
-
- protected Float gearShootingEndLatitude;
-
- protected Float gearShootingEndLongitude;
-
- protected Date gearShootingEndTime;
-
- protected Float gearShootingEndDepth;
-
- protected BeaufortScale beaufortScale;
-
- protected Integer windDirection;
-
- protected SeaState seaState;
-
- protected Float ouvertureHorizontale;
-
- protected Float ouvertureVerticale;
-
- protected boolean geometrieMesuree;
-
- protected Float longueurFunes;
-
- protected Float longueurBras;
-
- protected boolean systemeFermetureCul;
-
- protected boolean traitRectiligne;
-
- protected Float distanceChalutee;
-
- protected Float duree;
-
- protected boolean traitValid;
-
- protected String localite;
-
- protected String comment;
-
- protected List<TuttiUser> saisisseur;
-
- protected Float gearShootingStartSurfaceTemperature;
-
- protected Float gearShootingEndSurfaceTemperature;
-
- protected Float gearShootingStartBottomTemperature;
-
- protected Float gearShootingEndBottomTemperature;
-
- protected Float averageBottomTemperature;
-
- protected Float gearShootingStartSurfaceSalinity;
-
- protected Float gearShootingEndSurfaceSalinity;
-
- protected Float gearShootingStartBottomSalinity;
-
- protected Float gearShootingEndBottomSalinity;
-
- protected Float averageBottomSalinity;
-
- protected static Binder<TraitTabUIModel, Trait> toBeanBinder =
- BinderFactory.newBinder(TraitTabUIModel.class,
- Trait.class);
-
- protected static Binder<Trait, TraitTabUIModel> fromBeanBinder =
- BinderFactory.newBinder(Trait.class, TraitTabUIModel.class);
-
- public TraitTabUIModel() {
- super(Trait.class, fromBeanBinder, toBeanBinder);
- }
-
- public boolean isEmpty() {
- return empty;
- }
-
- public void setEmpty(boolean empty) {
- Object oldValue = isEmpty();
- this.empty = empty;
- firePropertyChange(PROPERTY_EMPTY, oldValue, empty);
- }
-
- public Campaign getCampaign() {
- return campaign;
- }
-
- public void setCampaign(Campaign campaign) {
- this.campaign = campaign;
- }
-
- public Integer getStationNumber() {
- return stationNumber;
- }
-
- public void setStationNumber(Integer stationNumber) {
- Object oldValue = getStationNumber();
- this.stationNumber = stationNumber;
- firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
- }
-
- public Integer getTraitNumber() {
- return traitNumber;
- }
-
- public void setTraitNumber(Integer traitNumber) {
- Object oldValue = getTraitNumber();
- this.traitNumber = traitNumber;
- firePropertyChange(PROPERTY_TRAIT_NUMBER, oldValue, traitNumber);
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- Object oldValue = getDate();
- this.date = date;
- firePropertyChange(PROPERTY_DATE, oldValue, date);
- }
-
- public Strata getStrata() {
- return strata;
- }
-
- public void setStrata(Strata strata) {
- Object oldValue = getStrata();
- this.strata = strata;
- firePropertyChange(PROPERTY_STRATA, oldValue, strata);
- }
-
- public Float getGearShootingStartLatitude() {
- return gearShootingStartLatitude;
- }
-
- public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
- Object oldValue = getGearShootingStartLatitude();
- this.gearShootingStartLatitude = gearShootingStartLatitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude);
- }
-
- public Float getGearShootingStartLongitude() {
- return gearShootingStartLongitude;
- }
-
- public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
- Object oldValue = getGearShootingStartLongitude();
- this.gearShootingStartLongitude = gearShootingStartLongitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude);
- }
-
- public Date getGearShootingStartTime() {
- return gearShootingStartTime;
- }
-
- public void setGearShootingStartTime(Date gearShootingStartTime) {
- Object oldValue = getGearShootingStartTime();
- this.gearShootingStartTime = gearShootingStartTime;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_TIME, oldValue, gearShootingStartTime);
- }
-
- public Float getGearShootingStartDepth() {
- return gearShootingStartDepth;
- }
-
- public void setGearShootingStartDepth(Float gearShootingStartDepth) {
- Object oldValue = getGearShootingStartDepth();
- this.gearShootingStartDepth = gearShootingStartDepth;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DEPTH, oldValue, gearShootingStartDepth);
- }
-
- public Float getGearShootingEndLatitude() {
- return gearShootingEndLatitude;
- }
-
- public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
- Object oldValue = getGearShootingEndLatitude();
- this.gearShootingEndLatitude = gearShootingEndLatitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude);
- }
-
- public Float getGearShootingEndLongitude() {
- return gearShootingEndLongitude;
- }
-
- public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
- Object oldValue = getGearShootingEndLongitude();
- this.gearShootingEndLongitude = gearShootingEndLongitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude);
- }
-
- public Date getGearShootingEndTime() {
- return gearShootingEndTime;
- }
-
- public void setGearShootingEndTime(Date gearShootingEndTime) {
- Object oldValue = getGearShootingEndTime();
- this.gearShootingEndTime = gearShootingEndTime;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_TIME, oldValue, gearShootingEndTime);
- }
-
- public Float getGearShootingEndDepth() {
- return gearShootingEndDepth;
- }
-
- public void setGearShootingEndDepth(Float gearShootingEndDepth) {
- Object oldValue = getGearShootingEndDepth();
- this.gearShootingEndDepth = gearShootingEndDepth;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DEPTH, oldValue, gearShootingEndDepth);
- }
-
- public BeaufortScale getBeaufortScale() {
- return beaufortScale;
- }
-
- public void setBeaufortScale(BeaufortScale beaufortScale) {
- Object oldValue = getBeaufortScale();
- this.beaufortScale = beaufortScale;
- firePropertyChange(PROPERTY_BEAUFORT_SCALE, oldValue, beaufortScale);
- }
-
- public Integer getWindDirection() {
- return windDirection;
- }
-
- public void setWindDirection(Integer windDirection) {
- Object oldValue = getWindDirection();
- this.windDirection = windDirection;
- firePropertyChange(PROPERTY_WIND_DIRECTION, oldValue, windDirection);
- }
-
- public SeaState getSeaState() {
- return seaState;
- }
-
- public void setSeaState(SeaState seaState) {
- Object oldValue = getSeaState();
- this.seaState = seaState;
- firePropertyChange(PROPERTY_SEA_STATE, oldValue, seaState);
- }
-
- public Float getOuvertureHorizontale() {
- return ouvertureHorizontale;
- }
-
- public void setOuvertureHorizontale(Float ouvertureHorizontale) {
- Object oldValue = getOuvertureHorizontale();
- this.ouvertureHorizontale = ouvertureHorizontale;
- firePropertyChange(PROPERTY_OUVERTURE_HORIZONTALE, oldValue, ouvertureHorizontale);
- }
-
- public Float getOuvertureVerticale() {
- return ouvertureVerticale;
- }
-
- public void setOuvertureVerticale(Float ouvertureVerticale) {
- Object oldValue = getOuvertureVerticale();
- this.ouvertureVerticale = ouvertureVerticale;
- firePropertyChange(PROPERTY_OUVERTURE_VERTICALE, oldValue, ouvertureVerticale);
- }
-
- public boolean isGeometrieMesuree() {
- return geometrieMesuree;
- }
-
- public void setGeometrieMesuree(boolean geometrieMesuree) {
- Object oldValue = isGeometrieMesuree();
- this.geometrieMesuree = geometrieMesuree;
- firePropertyChange(PROPERTY_GEOMETRIE_MESUREE, oldValue, geometrieMesuree);
- }
-
- public Float getLongueurFunes() {
- return longueurFunes;
- }
-
- public void setLongueurFunes(Float longueurFunes) {
- Object oldValue = getLongueurFunes();
- this.longueurFunes = longueurFunes;
- firePropertyChange(PROPERTY_LONGUEUR_FUNES, oldValue, longueurFunes);
- }
-
- public Float getLongueurBras() {
- return longueurBras;
- }
-
- public void setLongueurBras(Float longueurBras) {
- Object oldValue = getLongueurBras();
- this.longueurBras = longueurBras;
- firePropertyChange(PROPERTY_LONGUEUR_BRAS, oldValue, longueurBras);
- }
-
- public boolean isSystemeFermetureCul() {
- return systemeFermetureCul;
- }
-
- public void setSystemeFermetureCul(boolean systemeFermetureCul) {
- Object oldValue = isSystemeFermetureCul();
- this.systemeFermetureCul = systemeFermetureCul;
- firePropertyChange(PROPERTY_SYSTEME_FERMETURE_CUL, oldValue, systemeFermetureCul);
- }
-
- public boolean isTraitRectiligne() {
- return traitRectiligne;
- }
-
- public void setTraitRectiligne(boolean traitRectiligne) {
- Object oldValue = isTraitRectiligne();
- this.traitRectiligne = traitRectiligne;
- firePropertyChange(PROPERTY_TRAIT_RECTILIGNE, oldValue, traitRectiligne);
- }
-
- public Float getDistanceChalutee() {
- return distanceChalutee;
- }
-
- public void setDistanceChalutee(Float distanceChalutee) {
- Object oldValue = getDistanceChalutee();
- this.distanceChalutee = distanceChalutee;
- firePropertyChange(PROPERTY_DISTANCE_CHALUTEE, oldValue, distanceChalutee);
- }
-
- public Float getDuree() {
- return duree;
- }
-
- public void setDuree(Float duree) {
- Object oldValue = getDuree();
- this.duree = duree;
- firePropertyChange(PROPERTY_DUREE, oldValue, duree);
- }
-
- public boolean isTraitValid() {
- return traitValid;
- }
-
- public void setTraitValid(boolean traitValid) {
- Object oldValue = isTraitValid();
- this.traitValid = traitValid;
- firePropertyChange(PROPERTY_TRAIT_VALID, oldValue, traitValid);
- }
-
- public String getLocalite() {
- return localite;
- }
-
- public void setLocalite(String localite) {
- Object oldValue = getLocalite();
- this.localite = localite;
- firePropertyChange(PROPERTY_LOCALITE, oldValue, localite);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<TuttiUser> getSaisisseur() {
- return saisisseur;
- }
-
- public void setSaisisseur(List<TuttiUser> saisisseur) {
- this.saisisseur = saisisseur;
- firePropertyChange(PROPERTY_SAISISSEUR, null, saisisseur);
- }
-
- public Float getGearShootingStartSurfaceTemperature() {
- return gearShootingStartSurfaceTemperature;
- }
-
- public void setGearShootingStartSurfaceTemperature(Float gearShootingStartSurfaceTemperature) {
- Object oldValue = getGearShootingStartSurfaceTemperature();
- this.gearShootingStartSurfaceTemperature = gearShootingStartSurfaceTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_TEMPERATURE, oldValue, gearShootingStartSurfaceTemperature);
- }
-
- public Float getGearShootingEndSurfaceTemperature() {
- return gearShootingEndSurfaceTemperature;
- }
-
- public void setGearShootingEndSurfaceTemperature(Float gearShootingEndSurfaceTemperature) {
- Object oldValue = getGearShootingEndSurfaceTemperature();
- this.gearShootingEndSurfaceTemperature = gearShootingEndSurfaceTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_TEMPERATURE, oldValue, gearShootingEndSurfaceTemperature);
- }
-
- public Float getGearShootingStartBottomTemperature() {
- return gearShootingStartBottomTemperature;
- }
-
- public void setGearShootingStartBottomTemperature(Float gearShootingStartBottomTemperature) {
- Object oldValue = getGearShootingStartBottomTemperature();
- this.gearShootingStartBottomTemperature = gearShootingStartBottomTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_TEMPERATURE, oldValue, gearShootingStartBottomTemperature);
- }
-
- public Float getGearShootingEndBottomTemperature() {
- return gearShootingEndBottomTemperature;
- }
-
- public void setGearShootingEndBottomTemperature(Float gearShootingEndBottomTemperature) {
- Object oldValue = getGearShootingEndBottomTemperature();
- this.gearShootingEndBottomTemperature = gearShootingEndBottomTemperature;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_TEMPERATURE, oldValue, gearShootingEndBottomTemperature);
- }
-
- public Float getAverageBottomTemperature() {
- return averageBottomTemperature;
- }
-
- public void setAverageBottomTemperature(Float averageBottomTemperature) {
- Object oldValue = getAverageBottomTemperature();
- this.averageBottomTemperature = averageBottomTemperature;
- firePropertyChange(PROPERTY_AVERAGE_BOTTOM_TEMPERATURE, oldValue, averageBottomTemperature);
- }
-
- public Float getGearShootingStartSurfaceSalinity() {
- return gearShootingStartSurfaceSalinity;
- }
-
- public void setGearShootingStartSurfaceSalinity(Float gearShootingStartSurfaceSalinity) {
- Object oldValue = getGearShootingStartSurfaceSalinity();
- this.gearShootingStartSurfaceSalinity = gearShootingStartSurfaceSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_SURFACE_SALINITY, oldValue, gearShootingStartSurfaceSalinity);
- }
-
- public Float getGearShootingEndSurfaceSalinity() {
- return gearShootingEndSurfaceSalinity;
- }
-
- public void setGearShootingEndSurfaceSalinity(Float gearShootingEndSurfaceSalinity) {
- Object oldValue = getGearShootingEndSurfaceSalinity();
- this.gearShootingEndSurfaceSalinity = gearShootingEndSurfaceSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_SURFACE_SALINITY, oldValue, gearShootingEndSurfaceSalinity);
- }
-
- public Float getGearShootingStartBottomSalinity() {
- return gearShootingStartBottomSalinity;
- }
-
- public void setGearShootingStartBottomSalinity(Float gearShootingStartBottomSalinity) {
- Object oldValue = getGearShootingStartBottomSalinity();
- this.gearShootingStartBottomSalinity = gearShootingStartBottomSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_BOTTOM_SALINITY, oldValue, gearShootingStartBottomSalinity);
- }
-
- public Float getGearShootingEndBottomSalinity() {
- return gearShootingEndBottomSalinity;
- }
-
- public void setGearShootingEndBottomSalinity(Float gearShootingEndBottomSalinity) {
- Object oldValue = getGearShootingEndBottomSalinity();
- this.gearShootingEndBottomSalinity = gearShootingEndBottomSalinity;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_BOTTOM_SALINITY, oldValue, gearShootingEndBottomSalinity);
- }
-
- public Float getAverageBottomSalinity() {
- return averageBottomSalinity;
- }
-
- public void setAverageBottomSalinity(Float averageBottomSalinity) {
- Object oldValue = getAverageBottomSalinity();
- this.averageBottomSalinity = averageBottomSalinity;
- firePropertyChange(PROPERTY_AVERAGE_BOTTOM_SALINITY, oldValue, averageBottomSalinity);
- }
-}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -23,37 +23,37 @@
*/
NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
}
#totalWeightLabel {
- text:"tutti.label.captureAccidentel.totalWeight";
- labelFor:{totalWeightField};
+ text: "tutti.label.captureAccidentel.totalWeight";
+ labelFor: {totalWeightField};
}
#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
+ property: "totalWeight";
+ model: {model.getTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
}
#sampleTotalWeightLabel {
- text:"tutti.label.captureAccidentel.sampleTotalWeight";
- labelFor:{totalWeightField};
+ text: "tutti.label.captureAccidentel.sampleTotalWeight";
+ labelFor: {totalWeightField};
}
#sampleTotalWeightField {
- property:"sampleTotalWeight";
- model:{model.getSampleTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
+ property: "sampleTotalWeight";
+ model: {model.getSampleTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
}
#table {
- model:{getContextValue(TableModel.class)};
- columnModel:{getContextValue(TableColumnModel.class)};
+ model: {getContextValue(TableModel.class)};
+ columnModel: {getContextValue(TableColumnModel.class)};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -25,10 +25,10 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<AccidentelTabUIModel, AccidentelTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.data.Trait
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+ fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
@@ -43,13 +43,13 @@
<script><![CDATA[
-public AccidentelTabUI(CatchesUI parentUI) {
+public AccidentelTabUI(FishingOperationsUI parentUI) {
AccidentelTabUIHandler handler = new AccidentelTabUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
}
-public void selectTrait(Trait trait) { handler.selectTrait(trait); }
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -25,12 +25,12 @@
*/
import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -59,11 +59,11 @@
private final AccidentelTabUI ui;
- private final CatchesUI parentUi;
+ private final FishingOperationsUI parentUi;
private final PersistenceService persistenceService;
- public AccidentelTabUIHandler(CatchesUI parentUi, AccidentelTabUI ui) {
+ public AccidentelTabUIHandler(FishingOperationsUI parentUi, AccidentelTabUI ui) {
super(parentUi.getHandler().getContext());
this.ui = ui;
this.parentUi = parentUi;
@@ -148,7 +148,7 @@
return ui.getModel();
}
- public void selectTrait(Trait bean) {
+ public void selectFishingOperation(FishingOperation bean) {
boolean empty = bean == null;
@@ -158,7 +158,7 @@
if (empty) {
catches = null;
- bean = new Trait();
+ bean = new FishingOperation();
} else {
catches = persistenceService.getAllAccidentelBatch(bean.getId());
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/accidentel/AccidentelTabUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -25,7 +25,7 @@
*/
import fr.ifremer.tutti.persistence.entities.data.AccidentelBatch;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.util.beans.BinderFactory;
@@ -81,15 +81,15 @@
firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
}
- public void fromBean(Trait bean) {
- BinderFactory.newBinder(Trait.class,
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
AccidentelTabUIModel.class).copy(bean, this);
}
- public Trait toBean() {
- Trait result = new Trait();
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
BinderFactory.newBinder(AccidentelTabUIModel.class,
- Trait.class).copy(this, result);
+ FishingOperation.class).copy(this, result);
return result;
}
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -25,10 +25,10 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<BenthosTabUIModel, BenthosTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.data.Trait
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+ fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
@@ -43,13 +43,13 @@
<script><![CDATA[
-public BenthosTabUI(CatchesUI parentUI) {
+public BenthosTabUI(FishingOperationsUI parentUI) {
BenthosTabUIHandler handler = new BenthosTabUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
}
-public void selectTrait(Trait trait) { handler.selectTrait(trait); }
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -25,12 +25,12 @@
*/
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -59,11 +59,11 @@
private final BenthosTabUI ui;
- private final CatchesUI parentUi;
+ private final FishingOperationsUI parentUi;
private final PersistenceService persistenceService;
- public BenthosTabUIHandler(CatchesUI parentUi, BenthosTabUI ui) {
+ public BenthosTabUIHandler(FishingOperationsUI parentUi, BenthosTabUI ui) {
super(parentUi.getHandler().getContext());
this.ui = ui;
this.parentUi = parentUi;
@@ -148,7 +148,7 @@
return ui.getModel();
}
- public void selectTrait(Trait bean) {
+ public void selectFishingOperation(FishingOperation bean) {
boolean empty = bean == null;
@@ -158,7 +158,7 @@
if (empty) {
catches = null;
- bean = new Trait();
+ bean = new FishingOperation();
} else {
catches = persistenceService.getAllBenthosBatch(bean.getId());
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/benthos/BenthosTabUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -25,7 +25,7 @@
*/
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.util.beans.BinderFactory;
@@ -81,15 +81,15 @@
firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
}
- public void fromBean(Trait bean) {
- BinderFactory.newBinder(Trait.class,
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
BenthosTabUIModel.class).copy(bean, this);
}
- public Trait toBean() {
- Trait result = new Trait();
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
BinderFactory.newBinder(BenthosTabUIModel.class,
- Trait.class).copy(this, result);
+ FishingOperation.class).copy(this, result);
return result;
}
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -25,10 +25,10 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<MacroDechetTabUIModel, MacroDechetTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.data.Trait
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+ fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
@@ -43,13 +43,13 @@
<script><![CDATA[
-public MacroDechetTabUI(CatchesUI parentUI) {
+public MacroDechetTabUI(FishingOperationsUI parentUI) {
MacroDechetTabUIHandler handler = new MacroDechetTabUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
}
-public void selectTrait(Trait trait) { handler.selectTrait(trait); }
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -24,13 +24,13 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -59,11 +59,11 @@
private final MacroDechetTabUI ui;
- private final CatchesUI parentUi;
+ private final FishingOperationsUI parentUi;
private final PersistenceService persistenceService;
- public MacroDechetTabUIHandler(CatchesUI parentUi, MacroDechetTabUI ui) {
+ public MacroDechetTabUIHandler(FishingOperationsUI parentUi, MacroDechetTabUI ui) {
super(parentUi.getHandler().getContext());
this.ui = ui;
this.parentUi = parentUi;
@@ -148,7 +148,7 @@
return ui.getModel();
}
- public void selectTrait(Trait bean) {
+ public void selectFishingOperation(FishingOperation bean) {
boolean empty = bean == null;
@@ -158,7 +158,7 @@
if (empty) {
catches = null;
- bean = new Trait();
+ bean = new FishingOperation();
} else {
catches = persistenceService.getAllMacroDechetBatch(bean.getId());
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/macrodechet/MacroDechetTabUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -24,8 +24,8 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.util.beans.BinderFactory;
@@ -81,15 +81,15 @@
firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
}
- public void fromBean(Trait bean) {
- BinderFactory.newBinder(Trait.class,
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
MacroDechetTabUIModel.class).copy(bean, this);
}
- public Trait toBean() {
- Trait result = new Trait();
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
BinderFactory.newBinder(MacroDechetTabUIModel.class,
- Trait.class).copy(this, result);
+ FishingOperation.class).copy(this, result);
return result;
}
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -25,10 +25,10 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<PlanctonTabUIModel, PlanctonTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.data.Trait
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+ fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
jaxx.runtime.swing.editor.NumberEditor
@@ -43,13 +43,13 @@
<script><![CDATA[
-public PlanctonTabUI(CatchesUI parentUI) {
+public PlanctonTabUI(FishingOperationsUI parentUI) {
PlanctonTabUIHandler handler = new PlanctonTabUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
}
-public void selectTrait(Trait trait) { handler.selectTrait(trait); }
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -25,12 +25,12 @@
*/
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -59,11 +59,11 @@
private final PlanctonTabUI ui;
- private final CatchesUI parentUi;
+ private final FishingOperationsUI parentUi;
private final PersistenceService persistenceService;
- public PlanctonTabUIHandler(CatchesUI parentUi, PlanctonTabUI ui) {
+ public PlanctonTabUIHandler(FishingOperationsUI parentUi, PlanctonTabUI ui) {
super(parentUi.getHandler().getContext());
this.ui = ui;
this.parentUi = parentUi;
@@ -148,7 +148,7 @@
return ui.getModel();
}
- public void selectTrait(Trait bean) {
+ public void selectFishingOperation(FishingOperation bean) {
boolean empty = bean == null;
@@ -158,7 +158,7 @@
if (empty) {
catches = null;
- bean = new Trait();
+ bean = new FishingOperation();
} else {
catches = persistenceService.getAllPlanctonBatch(bean.getId());
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/plancton/PlanctonTabUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -24,8 +24,8 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.PlanctonBatch;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.util.beans.BinderFactory;
@@ -81,15 +81,15 @@
firePropertyChange(PROPERTY_CATCHES, oldValue, catches);
}
- public void fromBean(Trait bean) {
- BinderFactory.newBinder(Trait.class,
+ public void fromBean(FishingOperation bean) {
+ BinderFactory.newBinder(FishingOperation.class,
PlanctonTabUIModel.class).copy(bean, this);
}
- public Trait toBean() {
- Trait result = new Trait();
+ public FishingOperation toBean() {
+ FishingOperation result = new FishingOperation();
BinderFactory.newBinder(PlanctonTabUIModel.class,
- Trait.class).copy(this, result);
+ FishingOperation.class).copy(this, result);
return result;
}
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -68,7 +68,7 @@
public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
- public static final String PROPERTY_ELEVATION_RATIO = "elevationRatio";
+ public static final String PROPERTY_SAMPLING_RATIO = "samplingRatio";
public static final String PROPERTY_COMMENT = "comment";
@@ -160,7 +160,7 @@
*
* @since 0.2
*/
- protected Float elevationRatio;
+ protected Float samplingRatio;
/**
* Comment on this catches.
@@ -315,14 +315,14 @@
firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
}
- public Float getElevationRatio() {
- return elevationRatio;
+ public Float getSamplingRatio() {
+ return samplingRatio;
}
- public void setElevationRatio(Float elevationRatio) {
- Object oldValue = getElevationRatio();
- this.elevationRatio = elevationRatio;
- firePropertyChange(PROPERTY_ELEVATION_RATIO, oldValue, elevationRatio);
+ public void setSamplingRatio(Float samplingRatio) {
+ Object oldValue = getSamplingRatio();
+ this.samplingRatio = samplingRatio;
+ firePropertyChange(PROPERTY_SAMPLING_RATIO, oldValue, samplingRatio);
}
public String getComment() {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -102,7 +102,7 @@
n_("tutti.table.species.batch.header.sampleWeight"));
public static final ColumnIdentifier<SpeciesBatchRowModel> ELEVATION_RATIO = ColumnIdentifier.newId(
- SpeciesBatchRowModel.PROPERTY_ELEVATION_RATIO,
+ SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
n_("tutti.table.species.batch.header.elevationRate"),
n_("tutti.table.species.batch.header.elevationRate"));
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -23,63 +23,63 @@
*/
NumberEditor {
- autoPopup:{handler.getConfig().isAutoPopupNumberEditor()};
- showPopupButton:{handler.getConfig().isShowNumberEditorButton()};
- bean:{model};
- showReset:true;
+ autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
+ showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
+ bean: {model};
+ showReset: true;
}
#totalWeightLabel {
- text:"tutti.label.species.totalWeight";
- labelFor:{totalWeightField};
+ text: "tutti.label.species.totalWeight";
+ labelFor: {totalWeightField};
}
#totalWeightField {
- property:"totalWeight";
- model:{model.getTotalWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
+ property: "totalWeight";
+ model: {model.getTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
}
#totalVracWeightLabel {
- text:"tutti.label.species.totalVracWeight";
- labelFor:{totalVracWeightField};
+ text: "tutti.label.species.totalVracWeight";
+ labelFor: {totalVracWeightField};
}
#totalVracWeightField {
- property:"totalVracWeight";
- model:{model.getTotalVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
+ property: "totalVracWeight";
+ model: {model.getTotalVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
}
#sampleVracWeightLabel {
- text:"tutti.label.species.sampleVracWeight";
- labelFor:{sampleVracWeightField};
+ text: "tutti.label.species.sampleVracWeight";
+ labelFor: {sampleVracWeightField};
}
#sampleVracWeightField {
- property:"sampleVracWeight";
- model:{model.getSampleVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
+ property: "sampleVracWeight";
+ model: {model.getSampleVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
}
#totalHorsVracWeightLabel {
- text:"tutti.label.species.totalHorsVracWeight";
- labelFor:{totalHorsVracWeightField};
+ text: "tutti.label.species.totalHorsVracWeight";
+ labelFor: {totalHorsVracWeightField};
}
#totalHorsVracWeightField {
- property:"totalHorsVracWeight";
- model:{model.getTotalHorsVracWeight()};
- useFloat:false;
- numberPattern:{INT_6_DIGITS_PATTERN};
+ property: "totalHorsVracWeight";
+ model: {model.getTotalHorsVracWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
}
#table {
- selectionMode:{ListSelectionModel.SINGLE_SELECTION};
- selectionBackground:{null};
- selectionForeground:{Color.BLACK};
- sortable:false;
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-10 02:45:40 UTC (rev 37)
@@ -25,10 +25,10 @@
implements='fr.ifremer.tutti.ui.swing.TuttiUI<SpeciesTabUIModel, SpeciesTabUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.data.Trait
+ fr.ifremer.tutti.persistence.entities.data.FishingOperation
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+ fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI
fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI
org.jdesktop.swingx.JXTable
@@ -47,22 +47,22 @@
<script><![CDATA[
-public SpeciesTabUI(CatchesUI parentUI) {
+public SpeciesTabUI(FishingOperationsUI parentUI) {
SpeciesTabUIHandler handler = new SpeciesTabUIHandler(parentUI, this);
setContextValue(handler);
handler.beforeInitUI();
}
-public void selectTrait(Trait trait) { handler.selectTrait(trait); }
+public void selectFishingOperation(FishingOperation fishingOperation) { handler.selectFishingOperation(fishingOperation); }
protected void $afterCompleteSetup() { handler.afterInitUI(); }
]]></script>
<SpeciesTabUIHandler id='handler'
- initializer='getContextValue(SpeciesTabUIHandler.class)'/>
+ initializer='getContextValue(SpeciesTabUIHandler.class)'/>
<SpeciesTabUIModel id='model'
- initializer='getContextValue(SpeciesTabUIModel.class)'/>
+ initializer='getContextValue(SpeciesTabUIModel.class)'/>
<SwingValidatorMessageTableModel id='errorTableModel'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -26,9 +26,9 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.Trait;
import fr.ifremer.tutti.persistence.entities.data.VracHorsVracEnum;
import fr.ifremer.tutti.persistence.entities.referential.Sex;
import fr.ifremer.tutti.persistence.entities.referential.Species;
@@ -36,7 +36,7 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
-import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
+import fr.ifremer.tutti.ui.swing.content.catches.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyRowModel;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
@@ -64,13 +64,13 @@
private final SpeciesTabUI ui;
- private final CatchesUI parentUi;
+ private final FishingOperationsUI parentUi;
private final PersistenceService persistenceService;
private final BeanMonitor traitMonitor;
- public SpeciesTabUIHandler(CatchesUI parentUi, SpeciesTabUI ui) {
+ public SpeciesTabUIHandler(FishingOperationsUI parentUi, SpeciesTabUI ui) {
super(parentUi.getHandler().getContext(),
SpeciesBatchRowModel.PROPERTY_SPECIES,
SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
@@ -81,7 +81,7 @@
SpeciesBatchRowModel.PROPERTY_AGE,
SpeciesBatchRowModel.PROPERTY_WEIGHT,
SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
- SpeciesBatchRowModel.PROPERTY_ELEVATION_RATIO,
+ SpeciesBatchRowModel.PROPERTY_SAMPLING_RATIO,
SpeciesBatchRowModel.PROPERTY_COMMENT,
SpeciesBatchRowModel.PROPERTY_FREQUENCY);
this.ui = ui;
@@ -160,10 +160,10 @@
protected void saveRow(SpeciesBatchRowModel row) {
SpeciesBatch catchBean = row.toBean();
- Trait trait = getModel().getTrait();
- catchBean.setTrait(trait);
+ FishingOperation fishingOperation = getModel().getTrait();
+ catchBean.setFishingOperation(fishingOperation);
if (log.isInfoEnabled()) {
- log.info("Selected trait: " + trait.getId());
+ log.info("Selected fishingOperation: " + fishingOperation.getId());
}
if (TuttiEntities.isNew(catchBean)) {
@@ -191,7 +191,7 @@
row.setFrequency(frequencyRows);
}
- public void selectTrait(Trait bean) {
+ public void selectFishingOperation(FishingOperation bean) {
JXTable table = ui.getTable();
@@ -203,18 +203,18 @@
if (traitMonitor.wasModified()) {
- // previous trait was modified, let's save it
+ // previous fishingOperation was modified, let's save it
SpeciesTabUIModel traitMonitorBean =
(SpeciesTabUIModel) traitMonitor.getBean();
- Trait trait = traitMonitorBean.toBean();
+ FishingOperation fishingOperation = traitMonitorBean.toBean();
if (log.isInfoEnabled()) {
- log.info("Trait " + trait.getId() +
+ log.info("FishingOperation " + fishingOperation.getId() +
" was modified, will save it.");
}
- persistenceService.saveTrait(trait);
+ persistenceService.saveFishingOperation(fishingOperation);
}
// make sure selection is empty (will remove bean from monitor)
@@ -228,12 +228,12 @@
if (empty) {
rows = null;
- bean = new Trait();
+ bean = new FishingOperation();
model.setTrait(null);
} else {
if (log.isInfoEnabled()) {
- log.info("Get species batch for trait: " + bean.getId());
+ log.info("Get species batch for fishingOperation: " + bean.getId());
}
rows = Lists.newArrayList();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIModel.java 2012-12-10 02:45:40 UTC (rev 37)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.data.Trait;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderModelBuilder;
@@ -33,7 +33,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class SpeciesTabUIModel extends AbstractTuttiTableUIModel<Trait, SpeciesBatchRowModel, SpeciesTabUIModel> {
+public class SpeciesTabUIModel extends AbstractTuttiTableUIModel<FishingOperation, SpeciesBatchRowModel, SpeciesTabUIModel> {
private static final long serialVersionUID = 1L;
@@ -45,7 +45,7 @@
public static final String PROPERTY_TOTAL_HORS_VRAC_WEIGHT = "totalHorsVracWeight";
- protected Trait trait;
+ protected FishingOperation trait;
protected Float totalWeight;
@@ -55,7 +55,7 @@
protected Float totalHorsVracWeight;
- protected static final Binder<Trait, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(Trait.class, SpeciesTabUIModel.class)
+ protected static final Binder<FishingOperation, SpeciesTabUIModel> fromBeanBinder = BinderModelBuilder.newEmptyBuilder(FishingOperation.class, SpeciesTabUIModel.class)
.addProperty("speciesTotalWeight", PROPERTY_TOTAL_WEIGHT)
.addProperty("speciesTotalHorsVracWeight", PROPERTY_TOTAL_HORS_VRAC_WEIGHT)
.addProperty("speciesTotalVracWeight", PROPERTY_TOTAL_VRAC_WEIGHT)
@@ -63,7 +63,7 @@
.addProperty("id", PROPERTY_ID)
.toBinder();
- protected static final Binder<SpeciesTabUIModel, Trait> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, Trait.class)
+ protected static final Binder<SpeciesTabUIModel, FishingOperation> toBeanBinder = BinderModelBuilder.newEmptyBuilder(SpeciesTabUIModel.class, FishingOperation.class)
.addProperty(PROPERTY_TOTAL_WEIGHT, "speciesTotalWeight")
.addProperty(PROPERTY_TOTAL_HORS_VRAC_WEIGHT, "speciesTotalHorsVracWeight")
.addProperty(PROPERTY_TOTAL_VRAC_WEIGHT, "speciesTotalVracWeight")
@@ -71,14 +71,14 @@
.toBinder();
public SpeciesTabUIModel() {
- super(Trait.class, fromBeanBinder, toBeanBinder);
+ super(FishingOperation.class, fromBeanBinder, toBeanBinder);
}
- public Trait getTrait() {
+ public FishingOperation getTrait() {
return trait;
}
- public void setTrait(Trait trait) {
+ public void setTrait(FishingOperation trait) {
this.trait = trait;
}
@@ -123,7 +123,7 @@
}
@Override
- protected Trait newEntity() {
+ protected FishingOperation newEntity() {
return trait;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-10 02:45:40 UTC (rev 37)
@@ -82,7 +82,7 @@
}
#generateButton {
- actionIcon: "generate-lengthSteps";
+ actionIcon: "generate";
text: "tutti.action.generate";
enabled: {model.isCanGenerate()};
}
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel-error-validation.xml 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel-error-validation.xml 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="name">
- <field-validator type="requiredstring" short-circuit="true">
- <message>tutti.validator.error.campaign.name.required</message>
- </field-validator>
- </field>
-
- <field name="survey">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.campaign.survey.required</message>
- </field-validator>
- </field>
-
- <field name="country">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.campaign.country.required</message>
- </field-validator>
- </field>
-
- <field name="vessel">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ vessel != null && !vessel.empty ]]>
- </param>
- <message>tutti.validator.error.campaign.vessel.required</message>
- </field-validator>
- </field>
-
- <field name="gear">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ gear != null && !gear.empty ]]>
- </param>
- <message>tutti.validator.error.campaign.gear.required</message>
- </field-validator>
- </field>
-
- <field name="headOfMission">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ headOfMission != null && !headOfMission.empty ]]>
- </param>
- <message>tutti.validator.error.campaign.headOfMission.required</message>
- </field-validator>
- </field>
-
- <field name="headOfSortRoom">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ headOfSortRoom != null && !headOfSortRoom.empty ]]>
- </param>
- <message>tutti.validator.error.campaign.headOfSortRoom.required</message>
- </field-validator>
- </field>
-
-</validators>
Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml (from rev 36, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml (rev 0)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="name">
+
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>tutti.validator.error.program.name.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="zone">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.program.zone.required</message>
+ </field-validator>
+
+ </field>
+</validators>
Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditProgramUIModel-error-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml (from rev 36, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditCampaignUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml (rev 0)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="name">
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>tutti.validator.error.scientificCruise.name.required</message>
+ </field-validator>
+ </field>
+
+ <field name="program">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.scientificCruise.program.required</message>
+ </field-validator>
+ </field>
+
+ <field name="year">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.scientificCruise.year.required</message>
+ </field-validator>
+ </field>
+
+ <field name="poche">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.scientificCruise.poche.required</message>
+ </field-validator>
+ </field>
+
+ <field name="beginDate">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.scientificCruise.beginDate.required</message>
+ </field-validator>
+ </field>
+
+ <field name="endDate">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.scientificCruise.endDate.required</message>
+ </field-validator>
+ </field>
+
+
+ <field name="country">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.scientificCruise.country.required</message>
+ </field-validator>
+ </field>
+
+ <field name="vessel">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ vessel != null && !vessel.empty ]]>
+ </param>
+ <message>tutti.validator.error.scientificCruise.vessel.required</message>
+ </field-validator>
+ </field>
+
+ <field name="gear">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gear != null && !gear.empty ]]>
+ </param>
+ <message>tutti.validator.error.scientificCruise.gear.required</message>
+ </field-validator>
+ </field>
+
+ <field name="headOfMission">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ headOfMission != null && !headOfMission.empty ]]>
+ </param>
+ <message>tutti.validator.error.scientificCruise.headOfMission.required</message>
+ </field-validator>
+ </field>
+
+ <field name="headOfSortRoom">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ headOfSortRoom != null && !headOfSortRoom.empty ]]>
+ </param>
+ <message>tutti.validator.error.scientificCruise.headOfSortRoom.required</message>
+ </field-validator>
+ </field>
+
+</validators>
Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditScientificCruiseUIModel-error-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel-error-validation.xml 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/campaign/EditSurveyUIModel-error-validation.xml 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="name">
-
- <field-validator type="requiredstring" short-circuit="true">
- <message>tutti.validator.error.survey.name.required</message>
- </field-validator>
-
- </field>
-
- <field name="zone">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.survey.zone.required</message>
- </field-validator>
-
- </field>
-</validators>
Copied: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml (from rev 36, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml (rev 0)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml 2012-12-10 02:45:40 UTC (rev 37)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="stationNumber">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.stationNumber.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="date">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.date.required</message>
+ </field-validator>
+
+ </field>
+</validators>
Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/FishingOperationTabUIModel-error-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel-error-validation.xml 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/catches/TraitTabUIModel-error-validation.xml 2012-12-10 02:45:40 UTC (rev 37)
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- 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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="stationNumber">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.trait.stationNumber.required</message>
- </field-validator>
-
- </field>
-
- <field name="date">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.trait.date.required</message>
- </field-validator>
-
- </field>
-</validators>
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-08 11:10:51 UTC (rev 36)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-10 02:45:40 UTC (rev 37)
@@ -14,6 +14,7 @@
tutti.action.fillCatches=Captures
tutti.action.fillCatches.tip=Saisir des captures
tutti.action.generate=Générer
+tutti.action.generateCampaignName=Générer le nom
tutti.action.manageProtocol=Protocole
tutti.action.manageProtocol.tip=Gérer les protocoles
tutti.action.new=Nouveau
@@ -28,27 +29,54 @@
tutti.action.site.tip=Accéder au site du projet Tutti
tutti.application.config=Configuration de l'application Tutti
tutti.application.name=Tutti
-tutti.config.campaignId=Identifiant de la dernière campagne utilisée
tutti.config.category.applications=Application
tutti.config.category.applications.description=Application
tutti.config.category.other=Autres
tutti.config.category.other.description=Autres options
tutti.config.category.shortcuts=Raccourcis
tutti.config.category.shortcuts.description=Liste des raccourcis clavier
-tutti.config.surveyId=Identifiant de la dernière série de campagne utilisée
+tutti.config.programId=Identifiant de la dernière série de campagne utilisée
+tutti.config.scientificCruiseId=Identifiant de la dernière campagne utilisée
tutti.config.ui.autoPopupNumberEditor=Toujours afficher le pavé numérique lors de l'édition d'un nombre
tutti.config.ui.config=Chemin du fichier de configuration des interfaces graphiques
tutti.config.ui.showNumberEditorButton=Afficher le pavé numérique de saisie
tutti.label.benthos.sampleTotalWeight=Poids total échantillonné
tutti.label.benthos.totalWeight=Poids total
-tutti.label.campaign=Campagne
-tutti.label.campaign.country=Pays
-tutti.label.campaign.name=Nom
-tutti.label.campaign.survey=Série
-tutti.label.campaign.surveyPart=Série partielle
tutti.label.captureAccidentel.sampleTotalWeight=Poids total échantillonné
tutti.label.captureAccidentel.totalWeight=Poids total
tutti.label.comment=Commentaire
+tutti.label.fishingOperation.averageBottomSalinity=Salinité de fond moyenne
+tutti.label.fishingOperation.averageBottomTemperature=Température de fond moyenne
+tutti.label.fishingOperation.beaufortScale=Force du vent
+tutti.label.fishingOperation.date=Date
+tutti.label.fishingOperation.distanceChaluteeDuree=Distance chalutée / Durée
+tutti.label.fishingOperation.gearShootingEndBottomSalinity=Salinité de fond fin de traine
+tutti.label.fishingOperation.gearShootingEndBottomTemperature=Température de fond fin de traine
+tutti.label.fishingOperation.gearShootingEndDepth=Profondeur fin de traine
+tutti.label.fishingOperation.gearShootingEndLatitude=Latitude fin de traine
+tutti.label.fishingOperation.gearShootingEndLongitude=Longitude fin de traine
+tutti.label.fishingOperation.gearShootingEndSurfaceSalinity=Salinité de surface fin de traine
+tutti.label.fishingOperation.gearShootingEndSurfaceTemperature=Temperature de surface fin de traine
+tutti.label.fishingOperation.gearShootingEndTime=Fin de traine
+tutti.label.fishingOperation.gearShootingStartBottomSalinity=Salinité de fond début de traine
+tutti.label.fishingOperation.gearShootingStartBottomTemperature=Température de fond début de traine
+tutti.label.fishingOperation.gearShootingStartDepth=Profondeur début de traine
+tutti.label.fishingOperation.gearShootingStartLatitude=Latitude début de traine
+tutti.label.fishingOperation.gearShootingStartLongitude=Longitude début de traine
+tutti.label.fishingOperation.gearShootingStartSurfaceSalinity=Salinité de surface début de traine
+tutti.label.fishingOperation.gearShootingStartSurfaceTemperature=Temperature de surface début de traine
+tutti.label.fishingOperation.gearShootingStartTime=Début de traine
+tutti.label.fishingOperation.geometrieMesuree=Géométrie mesurée
+tutti.label.fishingOperation.localite=Localité
+tutti.label.fishingOperation.longueurFunesBras=Longueur des funes / bras
+tutti.label.fishingOperation.ouvertureHorizontaleVerticale=Ouverture horizontale / verticale
+tutti.label.fishingOperation.seaState=Etat de la mer
+tutti.label.fishingOperation.stationNumberTraitNumber=Numéro de la station / Trait
+tutti.label.fishingOperation.strata=Strate d'association
+tutti.label.fishingOperation.systemeFermetureCul=Système de fermeture de cul
+tutti.label.fishingOperation.traitRectiligne=Trait rectiligne
+tutti.label.fishingOperation.traitValid=Trait valide
+tutti.label.fishingOperation.windDirection=Direction du vent
tutti.label.frequencyConfiguration.maxStep=Classe max
tutti.label.frequencyConfiguration.minStep=Classe min
tutti.label.frequencyConfiguration.mode=Mode de saisie
@@ -68,58 +96,35 @@
tutti.label.list.vessel=Navire(s)
tutti.label.macroDechet.sampleTotalWeight=Poids total échantillonné
tutti.label.macroDechet.totalWeight=Poids total
-tutti.label.no.trait.selected=< Aucun trait sélectionné >
+tutti.label.no.fishingOperation.selected=< Aucun trait sélectionné >
tutti.label.plancton.sampleTotalWeight=Poids total échantillonné
tutti.label.plancton.totalWeight=Poids total
+tutti.label.program=Série de campagne
+tutti.label.program.name=Nom
+tutti.label.program.zone=Zone
+tutti.label.scientificCruise=Campagne
+tutti.label.scientificCruise.beginDate=Date de début
+tutti.label.scientificCruise.country=Pays
+tutti.label.scientificCruise.endDate=Date de fin
+tutti.label.scientificCruise.name=Nom
+tutti.label.scientificCruise.poche=Nombre de poches
+tutti.label.scientificCruise.program=Série
+tutti.label.scientificCruise.surveyPart=Série partielle
+tutti.label.scientificCruise.year=Année
tutti.label.species.sampleVracWeight=Poids total vrac échant.
tutti.label.species.totalHorsVracWeight=Poids total hors vrac
tutti.label.species.totalVracWeight=Poids total vrac
tutti.label.species.totalWeight=Poids total
-tutti.label.survey=Série de campagne
-tutti.label.survey.name=Nom
-tutti.label.survey.zone=Zone
tutti.label.tab.accidentel=Captures accidentelles
tutti.label.tab.benthos=Benthos
+tutti.label.tab.fishingOperation=Trait
+tutti.label.tab.fishingOperation.gearShooting=Données de traine
+tutti.label.tab.fishingOperation.general=Caractéristiques générales
+tutti.label.tab.fishingOperation.hydrology=Paramètres hydrologiques
tutti.label.tab.macroDechet=Macro déchets
tutti.label.tab.observationIndividuel=Observations individuelles
tutti.label.tab.plancton=Plancton
tutti.label.tab.species=Espèces
-tutti.label.tab.trait=Trait
-tutti.label.tab.trait.gearShooting=Données de traine
-tutti.label.tab.trait.general=Caractéristiques générales
-tutti.label.tab.trait.hydrology=Paramètres hydrologiques
-tutti.label.trait.averageBottomSalinity=Salinité de fond moyenne
-tutti.label.trait.averageBottomTemperature=Température de fond moyenne
-tutti.label.trait.beaufortScale=Force du vent
-tutti.label.trait.date=Date
-tutti.label.trait.distanceChaluteeDuree=Distance chalutée / Durée
-tutti.label.trait.gearShootingEndBottomSalinity=Salinité de fond fin de traine
-tutti.label.trait.gearShootingEndBottomTemperature=Température de fond fin de traine
-tutti.label.trait.gearShootingEndDepth=Profondeur fin de traine
-tutti.label.trait.gearShootingEndLatitude=Latitude fin de traine
-tutti.label.trait.gearShootingEndLongitude=Longitude fin de traine
-tutti.label.trait.gearShootingEndSurfaceSalinity=Salinité de surface fin de traine
-tutti.label.trait.gearShootingEndSurfaceTemperature=Temperature de surface fin de traine
-tutti.label.trait.gearShootingEndTime=Fin de traine
-tutti.label.trait.gearShootingStartBottomSalinity=Salinité de fond début de traine
-tutti.label.trait.gearShootingStartBottomTemperature=Température de fond début de traine
-tutti.label.trait.gearShootingStartDepth=Profondeur début de traine
-tutti.label.trait.gearShootingStartLatitude=Latitude début de traine
-tutti.label.trait.gearShootingStartLongitude=Longitude début de traine
-tutti.label.trait.gearShootingStartSurfaceSalinity=Salinité de surface début de traine
-tutti.label.trait.gearShootingStartSurfaceTemperature=Temperature de surface début de traine
-tutti.label.trait.gearShootingStartTime=Début de traine
-tutti.label.trait.geometrieMesuree=Géométrie mesurée
-tutti.label.trait.localite=Localité
-tutti.label.trait.longueurFunesBras=Longueur des funes / bras
-tutti.label.trait.ouvertureHorizontaleVerticale=Ouverture horizontale / verticale
-tutti.label.trait.seaState=Etat de la mer
-tutti.label.trait.stationNumberTraitNumber=Numéro de la station / Trait
-tutti.label.trait.strata=Strate d'association
-tutti.label.trait.systemeFermetureCul=Système de fermeture de cul
-tutti.label.trait.traitRectiligne=Trait rectiligne
-tutti.label.trait.traitValid=Trait valide
-tutti.label.trait.windDirection=Direction du vent
tutti.legend.frequencyConfiguration=Configuration
tutti.menu.actions=Actions
tutti.menu.actions.tip=Actions
@@ -167,26 +172,30 @@
tutti.table.species.frequency.header.number=Nombre
tutti.table.species.frequency.header.weight=Poids observé
tutti.title.about=À propos de Tutti
-tutti.title.create.campaign=Créer une nouvelle campagne
-tutti.title.create.survey=Créer une nouvelle série de campagne
-tutti.title.edit.campaign=Editer une campagne existante
-tutti.title.edit.survey=Editer une série de campagne existante
+tutti.title.create.program=Créer une nouvelle série de campagne
+tutti.title.create.scientificCruise=Créer une nouvelle campagne
+tutti.title.edit.program=Editer une série de campagne existante
+tutti.title.edit.scientificCruise=Editer une campagne existante
tutti.title.fill.catches=Saisie des captures
tutti.title.frequency=Saisie des mensurations
tutti.title.home=Sélection de la campagne
-tutti.title.noSelectedCampaign=Pas de campagne sélectionné
-tutti.title.noSelectedSurvey=Pas de série de campagne sélectionné
-tutti.title.selectedCampaign=Campagne %s
-tutti.title.selectedSurvey=Série de campagne %s
+tutti.title.noSelectedProgram=Pas de série de campagne sélectionné
+tutti.title.noSelectedScientificCruise=Pas de campagne sélectionné
+tutti.title.selectedProgram=Série de campagne %s
+tutti.title.selectedScientificCruise=Campagne %s
tutti.to.be.done=< A FAIRE >
-tutti.validator.error.campaign.country.required=Le pays est obligatoire
-tutti.validator.error.campaign.gear.required=Au moins un engin doit être sélectionné
-tutti.validator.error.campaign.headOfMission.required=Au moins un chef de mission doit être sélectionné
-tutti.validator.error.campaign.headOfSortRoom.required=Au moins un responsable de salle de tri doit être sélectionné
-tutti.validator.error.campaign.name.required=Le nom de la campagne est obligatoire
-tutti.validator.error.campaign.survey.required=La série est obligatoire
-tutti.validator.error.campaign.vessel.required=Au moins un bateau doit être sélectionné
-tutti.validator.error.survey.name.required=Le nom de la série est obligatoire
-tutti.validator.error.survey.zone.required=La zone de la série est obligatoire
-tutti.validator.error.trait.date.required=La date du trait est obligatoire
-tutti.validator.error.trait.stationNumber.required=Le numéro de station est obligatoire
+tutti.validator.error.fishingOperation.date.required=La date du fishingOperation est obligatoire
+tutti.validator.error.fishingOperation.stationNumber.required=Le numéro de station est obligatoire
+tutti.validator.error.program.name.required=Le nom de la série est obligatoire
+tutti.validator.error.program.zone.required=La zone de la série est obligatoire
+tutti.validator.error.scientificCruise.beginDate.required=La date de début est obligatoire
+tutti.validator.error.scientificCruise.country.required=Le pays est obligatoire
+tutti.validator.error.scientificCruise.endDate.required=La date de fin est obligatoire
+tutti.validator.error.scientificCruise.gear.required=Au moins un engin doit être sélectionné
+tutti.validator.error.scientificCruise.headOfMission.required=Au moins un chef de mission doit être sélectionné
+tutti.validator.error.scientificCruise.headOfSortRoom.required=Au moins un responsable de salle de tri doit être sélectionné
+tutti.validator.error.scientificCruise.name.required=Le nom de la campagne est obligatoire
+tutti.validator.error.scientificCruise.poche.required=Le nombre de poche est obligatoire
+tutti.validator.error.scientificCruise.program.required=La série est obligatoire
+tutti.validator.error.scientificCruise.vessel.required=Au moins un bateau doit être sélectionné
+tutti.validator.error.scientificCruise.year.required=L'année est obligatoire
Deleted: trunk/tutti-ui-swing/src/main/resources/icons/action-generate-lengthSteps.png
===================================================================
(Binary files differ)
Copied: trunk/tutti-ui-swing/src/main/resources/icons/action-generate.png (from rev 36, trunk/tutti-ui-swing/src/main/resources/icons/action-generate-lengthSteps.png)
===================================================================
(Binary files differ)
Property changes on: trunk/tutti-ui-swing/src/main/resources/icons/action-generate.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0
Dec. 8, 2012
Author: tchemit
Date: 2012-12-08 12:10:51 +0100 (Sat, 08 Dec 2012)
New Revision: 36
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/36
Log:
- Always order species frequencies
- Simplify table api (remove some not usefull generics)
- continue species frequencies screen
Added:
trunk/tutti-ui-swing/src/main/resources/icons/action-generate-lengthSteps.png
trunk/tutti-ui-swing/src/test/
trunk/tutti-ui-swing/src/test/java/
trunk/tutti-ui-swing/src/test/java/fr/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/species/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModelTest.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java
Modified:
trunk/tutti-ui-swing/pom.xml
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java
Modified: trunk/tutti-ui-swing/pom.xml
===================================================================
--- trunk/tutti-ui-swing/pom.xml 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/pom.xml 2012-12-08 11:10:51 UTC (rev 36)
@@ -293,6 +293,11 @@
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
</dependencies>
<profiles>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -28,6 +28,7 @@
import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -92,7 +93,7 @@
protected SpeciesBatchTableModel tableModel;
- protected SpeciesBatchColumnIdentifier columnIdentifier;
+ protected ColumnIdentifier<SpeciesBatchRowModel> columnIdentifier;
protected SpeciesBatchRowModel editRow;
@@ -192,7 +193,7 @@
Preconditions.checkNotNull(editRow, "No editRow found in editor.");
Object result;
- if (columnIdentifier == SpeciesBatchColumnIdentifier.computedNumber) {
+ if (columnIdentifier == SpeciesBatchTableModel.COMPUTED_NUMBER) {
result = editRow.getComputedNumber();
} else {
result = editRow.getComputedWeight();
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -1,132 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public enum SpeciesBatchColumnIdentifier implements ColumnIdentifier<SpeciesBatchRowModel> {
-
- speciesToConfirm(
- n_("tutti.table.species.batch.header.toConfirm"),
- n_("tutti.table.species.batch.header.toConfirm")),
- speciesByCode(
- "species",
- n_("tutti.table.species.batch.header.speciesByCode"),
- n_("tutti.table.species.batch.header.speciesByCode")),
- speciesByGenusCode(
- "species",
- n_("tutti.table.species.batch.header.speciesByGenusCode"),
- n_("tutti.table.species.batch.header.speciesByGenusCode")),
- vracHorsVrac(
- n_("tutti.table.species.batch.header.vracHorsVrac"),
- n_("tutti.table.species.batch.header.vracHorsVrac")),
- weightCategory(
- n_("tutti.table.species.batch.header.weightCategory"),
- n_("tutti.table.species.batch.header.weightCategory")),
- sex(
- n_("tutti.table.species.batch.header.sex"),
- n_("tutti.table.species.batch.header.sex")),
- maturity(
- n_("tutti.table.species.batch.header.maturity"),
- n_("tutti.table.species.batch.header.maturity")),
- age(
- n_("tutti.table.species.batch.header.age"),
- n_("tutti.table.species.batch.header.age")),
- weight(
- n_("tutti.table.species.batch.header.weight"),
- n_("tutti.table.species.batch.header.weight")),
- computedWeight(
- n_("tutti.table.species.batch.header.computedWeight"),
- n_("tutti.table.species.batch.header.computedWeight")),
- computedNumber(
- n_("tutti.table.species.batch.header.computedNumber"),
- n_("tutti.table.species.batch.header.computedNumber")),
- sampleWeight(
- n_("tutti.table.species.batch.header.sampleWeight"),
- n_("tutti.table.species.batch.header.sampleWeight")),
- elevationRatio(
- n_("tutti.table.species.batch.header.elevationRate"),
- n_("tutti.table.species.batch.header.elevationRate")),
- comment(
- n_("tutti.table.species.batch.header.comment"),
- n_("tutti.table.species.batch.header.comment")),
- file(
- null,
- n_("tutti.table.species.batch.header.file"),
- n_("tutti.table.species.batch.header.file"));
-
- private final String propertyName;
-
- private final String headerI18nKey;
-
- private final String headerTipI18nKey;
-
- SpeciesBatchColumnIdentifier(String headerI18nKey, String headerTipI18nKey) {
- this("", headerI18nKey, headerTipI18nKey);
- }
-
- SpeciesBatchColumnIdentifier(String propertyName, String headerI18nKey, String headerTipI18nKey) {
- this.propertyName = "".equals(propertyName) ? name() : propertyName;
- this.headerI18nKey = headerI18nKey;
- this.headerTipI18nKey = headerTipI18nKey;
- }
-
- @Override
- public String getPropertyName() {
- return propertyName;
- }
-
- @Override
- public String getHeaderI18nKey() {
- return headerI18nKey;
- }
-
- @Override
- public String getHeaderTipI18nKey() {
- return headerTipI18nKey;
- }
-
- @Override
- public Object getValue(SpeciesBatchRowModel entry) {
- Object result = null;
- if (propertyName != null && entry != null) {
- result = TuttiUIUtil.getProperty(entry, propertyName);
- }
- return result;
- }
-
- @Override
- public void setValue(SpeciesBatchRowModel entry, Object value) {
- if (propertyName != null)
- TuttiUIUtil.setProperty(entry, propertyName, value);
- }
-}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -37,6 +37,7 @@
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
+import java.util.Collections;
import java.util.List;
/**
@@ -195,6 +196,7 @@
List<SpeciesFrequencyRowModel> frequencyRows =
SpeciesFrequencyRowModel.fromBeans(frequencies);
frequency.addAll(frequencyRows);
+ Collections.sort(frequency);
updateTotalFromFrequencies();
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -26,34 +26,113 @@
import com.google.common.collect.Sets;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import javax.swing.table.TableColumnModel;
import java.util.Set;
+import static org.nuiton.i18n.I18n.n_;
+
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class SpeciesBatchTableModel extends AbstractTuttiTableModel<SpeciesBatchRowModel, SpeciesBatchColumnIdentifier> {
+public class SpeciesBatchTableModel extends AbstractTuttiTableModel<SpeciesBatchRowModel> {
private static final long serialVersionUID = 1L;
- protected final Set<SpeciesBatchColumnIdentifier> noneEditableColIfNoSpecies = Sets.newHashSet(
- SpeciesBatchColumnIdentifier.computedNumber,
- SpeciesBatchColumnIdentifier.computedWeight
- );
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
+ n_("tutti.table.species.batch.header.toConfirm"),
+ n_("tutti.table.species.batch.header.toConfirm"));
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.species.batch.header.speciesByCode"),
+ n_("tutti.table.species.batch.header.speciesByCode"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SPECIES,
+ n_("tutti.table.species.batch.header.speciesByGenusCode"),
+ n_("tutti.table.species.batch.header.speciesByGenusCode"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> VRAC_HORS_VRAC = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_VRAC_HORS_VRAC,
+ n_("tutti.table.species.batch.header.vracHorsVrac"),
+ n_("tutti.table.species.batch.header.vracHorsVrac"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT_CATEGORY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_WEIGHT_CATEGORY,
+ n_("tutti.table.species.batch.header.weightCategory"),
+ n_("tutti.table.species.batch.header.weightCategory"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SEX = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SEX,
+ n_("tutti.table.species.batch.header.sex"),
+ n_("tutti.table.species.batch.header.sex"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> MATURITY = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_MATURITY,
+ n_("tutti.table.species.batch.header.maturity"),
+ n_("tutti.table.species.batch.header.maturity"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> AGE = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_AGE,
+ n_("tutti.table.species.batch.header.age"),
+ n_("tutti.table.species.batch.header.age"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.species.batch.header.weight"),
+ n_("tutti.table.species.batch.header.weight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMPUTED_WEIGHT,
+ n_("tutti.table.species.batch.header.computedWeight"),
+ n_("tutti.table.species.batch.header.computedWeight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMPUTED_NUMBER = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMPUTED_NUMBER,
+ n_("tutti.table.species.batch.header.computedNumber"),
+ n_("tutti.table.species.batch.header.computedNumber"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
+ n_("tutti.table.species.batch.header.sampleWeight"),
+ n_("tutti.table.species.batch.header.sampleWeight"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> ELEVATION_RATIO = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_ELEVATION_RATIO,
+ n_("tutti.table.species.batch.header.elevationRate"),
+ n_("tutti.table.species.batch.header.elevationRate"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> COMMENT = ColumnIdentifier.newId(
+ SpeciesBatchRowModel.PROPERTY_COMMENT,
+ n_("tutti.table.species.batch.header.comment"),
+ n_("tutti.table.species.batch.header.comment"));
+
+ public static final ColumnIdentifier<SpeciesBatchRowModel> FILE = ColumnIdentifier.newId(
+ null,
+ n_("tutti.table.species.batch.header.file"),
+ n_("tutti.table.species.batch.header.file"));
+
+
+ protected final Set<ColumnIdentifier<SpeciesBatchRowModel>> noneEditableColIfNoSpecies;
+
public SpeciesBatchTableModel(TableColumnModel columnModel) {
super(columnModel);
// TODO This will be dynamic by the protocol...
setNoneEditableCols(
- SpeciesBatchColumnIdentifier.age,
- SpeciesBatchColumnIdentifier.maturity,
- SpeciesBatchColumnIdentifier.sampleWeight,
- SpeciesBatchColumnIdentifier.elevationRatio,
- SpeciesBatchColumnIdentifier.file
+ AGE,
+ MATURITY,
+ SAMPLE_WEIGHT,
+ ELEVATION_RATIO,
+ FILE
);
+ noneEditableColIfNoSpecies = Sets.newHashSet();
+ noneEditableColIfNoSpecies.add(COMPUTED_NUMBER);
+ noneEditableColIfNoSpecies.add(COMPUTED_WEIGHT);
}
@Override
@@ -65,43 +144,43 @@
public void setValueAt(Object aValue,
int rowIndex,
int columnIndex,
- SpeciesBatchColumnIdentifier propertyName,
+ ColumnIdentifier<SpeciesBatchRowModel> propertyName,
SpeciesBatchRowModel entry) {
super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
- if (propertyName == SpeciesBatchColumnIdentifier.speciesByCode) {
+ if (propertyName == SPECIES_BY_CODE) {
// update also other columns
fireTableCellUpdated(rowIndex,
- SpeciesBatchColumnIdentifier.speciesByGenusCode,
- SpeciesBatchColumnIdentifier.computedNumber,
- SpeciesBatchColumnIdentifier.computedWeight);
+ SPECIES_BY_GENUS_CODE,
+ COMPUTED_NUMBER,
+ COMPUTED_WEIGHT);
- } else if (propertyName == SpeciesBatchColumnIdentifier.speciesByGenusCode) {
+ } else if (propertyName == SPECIES_BY_GENUS_CODE) {
// update also other columns
fireTableCellUpdated(rowIndex,
- SpeciesBatchColumnIdentifier.speciesByCode,
- SpeciesBatchColumnIdentifier.computedNumber,
- SpeciesBatchColumnIdentifier.computedWeight);
- } else if (propertyName == SpeciesBatchColumnIdentifier.computedNumber) {
+ SPECIES_BY_CODE,
+ COMPUTED_NUMBER,
+ COMPUTED_WEIGHT);
+ } else if (propertyName == COMPUTED_NUMBER) {
// update also other columns
fireTableCellUpdated(rowIndex,
- SpeciesBatchColumnIdentifier.computedWeight);
+ COMPUTED_WEIGHT);
- } else if (propertyName == SpeciesBatchColumnIdentifier.computedWeight) {
+ } else if (propertyName == COMPUTED_WEIGHT) {
// update also other columns
fireTableCellUpdated(rowIndex,
- SpeciesBatchColumnIdentifier.computedNumber);
+ COMPUTED_NUMBER);
}
}
@Override
protected boolean isCellEditable(int rowIndex,
int columnIndex,
- SpeciesBatchColumnIdentifier propertyName) {
+ ColumnIdentifier<SpeciesBatchRowModel> propertyName) {
boolean result = super.isCellEditable(rowIndex,
columnIndex,
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -57,7 +57,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class SpeciesTabUIHandler extends AbstractTuttiTableUIHandler<SpeciesBatchRowModel, SpeciesBatchColumnIdentifier, SpeciesBatchTableModel, SpeciesTabUIModel> {
+public class SpeciesTabUIHandler extends AbstractTuttiTableUIHandler<SpeciesBatchRowModel, SpeciesTabUIModel> {
/** Logger. */
private static final Log log = LogFactory.getLog(SpeciesTabUIHandler.class);
@@ -101,6 +101,11 @@
}
@Override
+ protected SpeciesBatchTableModel getTableModel() {
+ return (SpeciesBatchTableModel) getTable().getModel();
+ }
+
+ @Override
protected SpeciesTabUIModel getModel() {
return ui.getModel();
}
@@ -122,7 +127,7 @@
JXTable table = getTable();
// create table column model
- TableColumnModel columnModel = createTableColumnModel(table);
+ TableColumnModel columnModel = createTableColumnModel();
// create table model
SpeciesBatchTableModel tableModel =
@@ -134,7 +139,8 @@
table.getTableHeader().setReorderingAllowed(false);
- table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
+ table.addHighlighter(TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, Color.LIGHT_GRAY));
// when model datas change let's propagate it table model
listenRowsFromModel();
@@ -254,7 +260,7 @@
}
@Override
- protected TableColumnModel createTableColumnModel(JXTable table) {
+ protected TableColumnModel createTableColumnModel() {
DefaultTableColumnModelExt columnModel =
new DefaultTableColumnModelExt();
@@ -262,8 +268,8 @@
{ // Species to confirm
addBooleanColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.speciesToConfirm,
- table);
+ SpeciesBatchTableModel.SPECIES_TO_CONFIRM,
+ getTable());
}
List<Species> allSpecies = persistenceService.getAllSpecies();
@@ -274,7 +280,7 @@
Species.class, DecoratorService.SPECIES_BY_CODE);
addComboDataColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.speciesByCode,
+ SpeciesBatchTableModel.SPECIES_BY_CODE,
decorator, allSpecies);
}
@@ -284,7 +290,7 @@
Species.class, DecoratorService.SPECIES_BY_GENUS);
addComboDataColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.speciesByGenusCode,
+ SpeciesBatchTableModel.SPECIES_BY_GENUS_CODE,
decorator, allSpecies);
}
@@ -292,7 +298,7 @@
{ // Vrac / Hors vrac
addComboEnumColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.vracHorsVrac,
+ SpeciesBatchTableModel.VRAC_HORS_VRAC,
VracHorsVracEnum.values());
}
@@ -306,7 +312,7 @@
persistenceService.getAllWeightCategory();
addComboDataColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.weightCategory,
+ SpeciesBatchTableModel.WEIGHT_CATEGORY,
decorator, data);
}
@@ -318,28 +324,28 @@
List<Sex> data = persistenceService.getAllSex();
addComboDataColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.sex,
+ SpeciesBatchTableModel.SEX,
decorator, data);
}
{ // Maturity
addFloatColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.maturity,
+ SpeciesBatchTableModel.MATURITY,
TuttiUI.DECIMAL3_PATTERN);
}
{ // Age
addFloatColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.age,
+ SpeciesBatchTableModel.AGE,
TuttiUI.DECIMAL3_PATTERN);
}
{ // Poids observé
addFloatColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.weight,
+ SpeciesBatchTableModel.WEIGHT,
TuttiUI.DECIMAL3_PATTERN);
}
@@ -348,7 +354,7 @@
addColumnToModel(columnModel,
FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
FrequencyCellComponent.newRender(),
- SpeciesBatchColumnIdentifier.computedWeight);
+ SpeciesBatchTableModel.COMPUTED_WEIGHT);
}
{ // Nombre calculé
@@ -356,31 +362,31 @@
addColumnToModel(columnModel,
FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
FrequencyCellComponent.newRender(),
- SpeciesBatchColumnIdentifier.computedNumber);
+ SpeciesBatchTableModel.COMPUTED_NUMBER);
}
{ // Poids d'échantillon
addColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.sampleWeight);
+ SpeciesBatchTableModel.SAMPLE_WEIGHT);
}
{ // Fraction d'élévation
addColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.elevationRatio);
+ SpeciesBatchTableModel.ELEVATION_RATIO);
}
{ // Commentaire
addColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.comment);
+ SpeciesBatchTableModel.COMMENT);
}
{ // Pièces-jointes
addColumnToModel(columnModel,
- SpeciesBatchColumnIdentifier.file);
+ SpeciesBatchTableModel.FILE);
}
return columnModel;
}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.catches.species.frequency;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * 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.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public enum SpeciesFrequencyColumnIdentifier implements ColumnIdentifier<SpeciesFrequencyRowModel> {
-
- lengthStep(
- n_("tutti.table.species.frequency.header.lengthStep"),
- n_("tutti.table.species.frequency.header.lengthStep")),
- number(
- n_("tutti.table.species.frequency.header.number"),
- n_("tutti.table.species.frequency.header.number")),
- weight(
- n_("tutti.table.species.frequency.header.weight"),
- n_("tutti.table.species.frequency.header.weight")),
- computedWeight(
- n_("tutti.table.species.frequency.header.computedWeight"),
- n_("tutti.table.species.frequency.header.computedWeight"));
-
- private final String propertyName;
-
- private final String headerI18nKey;
-
- private final String headerTipI18nKey;
-
- SpeciesFrequencyColumnIdentifier(String headerI18nKey, String headerTipI18nKey) {
- this("", headerI18nKey, headerTipI18nKey);
- }
-
- SpeciesFrequencyColumnIdentifier(String propertyName, String headerI18nKey, String headerTipI18nKey) {
- this.propertyName = "".equals(propertyName) ? name() : propertyName;
- this.headerI18nKey = headerI18nKey;
- this.headerTipI18nKey = headerTipI18nKey;
- }
-
- @Override
- public String getPropertyName() {
- return propertyName;
- }
-
- @Override
- public String getHeaderI18nKey() {
- return headerI18nKey;
- }
-
- @Override
- public String getHeaderTipI18nKey() {
- return headerTipI18nKey;
- }
-
- @Override
- public Object getValue(SpeciesFrequencyRowModel entry) {
- Object result = null;
- if (entry != null) {
- result = TuttiUIUtil.getProperty(entry, propertyName);
- }
- return result;
- }
-
- @Override
- public void setValue(SpeciesFrequencyRowModel entry, Object value) {
- TuttiUIUtil.setProperty(entry, propertyName, value);
- }
-}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -25,6 +25,7 @@
*/
import com.google.common.collect.Lists;
+import com.google.common.collect.Ordering;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel;
@@ -39,7 +40,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class SpeciesFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, SpeciesFrequencyRowModel> {
+public class SpeciesFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, SpeciesFrequencyRowModel> implements Comparable<SpeciesFrequencyRowModel> {
private static final long serialVersionUID = 1L;
@@ -87,6 +88,8 @@
BinderFactory.newBinder(SpeciesFrequencyRowModel.class,
SpeciesBatchFrequency.class);
+ private static final Ordering<Float> ordering = Ordering.natural().nullsFirst();
+
public static List<SpeciesFrequencyRowModel> fromBeans(List<SpeciesBatchFrequency> frequency) {
List<SpeciesFrequencyRowModel> result = Lists.newArrayList();
for (SpeciesBatchFrequency b : frequency) {
@@ -157,4 +160,10 @@
public boolean isValid() {
return lengthStep != null && number != null;
}
+
+ @Override
+ public int compareTo(SpeciesFrequencyRowModel o) {
+ int result = ordering.compare(lengthStep, o.lengthStep);
+ return result;
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -27,30 +27,54 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import javax.swing.table.TableColumnModel;
import java.util.List;
import java.util.Map;
+import static org.nuiton.i18n.I18n.n_;
+
/**
* Model of the species frequency table.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class SpeciesFrequencyTableModel extends AbstractTuttiTableModel<SpeciesFrequencyRowModel, SpeciesFrequencyColumnIdentifier> {
+public class SpeciesFrequencyTableModel extends AbstractTuttiTableModel<SpeciesFrequencyRowModel> {
private static final long serialVersionUID = 1L;
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> LENGTH_STEP = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_LENGTH_STEP,
+ n_("tutti.table.species.frequency.header.lengthStep"),
+ n_("tutti.table.species.frequency.header.lengthStep"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> NUMBER = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_NUMBER,
+ n_("tutti.table.species.frequency.header.number"),
+ n_("tutti.table.species.frequency.header.number"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> WEIGHT = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_WEIGHT,
+ n_("tutti.table.species.frequency.header.weight"),
+ n_("tutti.table.species.frequency.header.weight"));
+
+ public static final ColumnIdentifier<SpeciesFrequencyRowModel> COMPUTED_WEIGHT = ColumnIdentifier.newId(
+ SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT,
+ n_("tutti.table.species.frequency.header.computedWeight"),
+ n_("tutti.table.species.frequency.header.computedWeight"));
+
private final SpeciesFrequencyUIModel uiModel;
private final Map<Float, SpeciesFrequencyRowModel> rowCache;
- public SpeciesFrequencyTableModel(TableColumnModel columnModel, SpeciesFrequencyUIModel uiModel) {
+ public SpeciesFrequencyTableModel(TableColumnModel columnModel,
+ SpeciesFrequencyUIModel uiModel) {
super(columnModel);
this.uiModel = uiModel;
this.rowCache = Maps.newTreeMap();
- setNoneEditableCols(SpeciesFrequencyColumnIdentifier.computedWeight);
+ setNoneEditableCols(COMPUTED_WEIGHT);
}
@Override
@@ -76,7 +100,7 @@
public void setValueAt(Object aValue,
int rowIndex,
int columnIndex,
- SpeciesFrequencyColumnIdentifier propertyName,
+ ColumnIdentifier<SpeciesFrequencyRowModel> propertyName,
SpeciesFrequencyRowModel entry) {
super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
// TODO Rebuild the computedWeight if possible...
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -51,7 +51,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<SpeciesFrequencyRowModel, SpeciesFrequencyColumnIdentifier, SpeciesFrequencyTableModel, SpeciesFrequencyUIModel> {
+public class SpeciesFrequencyUIHandler extends AbstractTuttiTableUIHandler<SpeciesFrequencyRowModel, SpeciesFrequencyUIModel> {
/** Logger. */
private static final Log log =
@@ -85,7 +85,7 @@
JXTable table = getTable();
// create table column model
- TableColumnModel columnModel = createTableColumnModel(table);
+ TableColumnModel columnModel = createTableColumnModel();
SpeciesFrequencyUIModel model = getModel();
@@ -141,18 +141,7 @@
@Override
protected void saveRow(SpeciesFrequencyRowModel row) {
-
// No persistence save from this screen
- Float lengthStep = row.getLengthStep();
- if (log.isInfoEnabled()) {
- log.info("Add row " + lengthStep + " to cache");
- }
-
- if (lengthStep != null) {
-
- // add it to cache
-
- }
}
@Override
@@ -161,6 +150,11 @@
}
@Override
+ protected SpeciesFrequencyTableModel getTableModel() {
+ return (SpeciesFrequencyTableModel) getTable().getModel();
+ }
+
+ @Override
protected SpeciesFrequencyUIModel getModel() {
return ui.getModel();
}
@@ -197,18 +191,23 @@
log.info("Will apply rafale step: " + step);
}
SpeciesFrequencyUIModel model = getModel();
- Map<Float, SpeciesFrequencyRowModel> rowsByStep = getTableModel().getRowCache();
+ SpeciesFrequencyTableModel tableModel = getTableModel();
+ Map<Float, SpeciesFrequencyRowModel> rowsByStep = tableModel.getRowCache();
+
float aroundLengthStep = model.getLengthStep(step);
SpeciesFrequencyRowModel row = rowsByStep.get(aroundLengthStep);
+ int rowIndex;
+
if (row != null) {
// increments current row
Integer number = row.getNumber();
row.setNumber((number == null ? 0 : number) + 1);
- getTableModel().updateRow(row);
+ rowIndex = tableModel.updateRow(row);
+
} else {
// create a new row
@@ -222,10 +221,12 @@
Collections.sort(steps);
- int indexRow = steps.indexOf(aroundLengthStep);
+ rowIndex = steps.indexOf(aroundLengthStep);
- getTableModel().addNewRow(indexRow, row);
+ tableModel.addNewRow(rowIndex, row);
}
+
+ getTable().scrollRowToVisible(rowIndex);
}
public void editBatch(SpeciesBatchRowModel row) {
@@ -286,35 +287,35 @@
}
@Override
- protected TableColumnModel createTableColumnModel(JXTable table) {
+ protected TableColumnModel createTableColumnModel() {
DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
{ // LengthStep
addFloatColumnToModel(columnModel,
- SpeciesFrequencyColumnIdentifier.lengthStep,
+ SpeciesFrequencyTableModel.LENGTH_STEP,
TuttiUI.DECIMAL1_PATTERN);
}
{ // Number
addIntegerColumnToModel(columnModel,
- SpeciesFrequencyColumnIdentifier.number,
+ SpeciesFrequencyTableModel.NUMBER,
TuttiUI.INT_6_DIGITS_PATTERN);
}
{ // weight
addFloatColumnToModel(columnModel,
- SpeciesFrequencyColumnIdentifier.weight,
+ SpeciesFrequencyTableModel.WEIGHT,
TuttiUI.DECIMAL3_PATTERN);
}
{ // computedWeight
addFloatColumnToModel(columnModel,
- SpeciesFrequencyColumnIdentifier.computedWeight,
+ SpeciesFrequencyTableModel.COMPUTED_WEIGHT,
TuttiUI.DECIMAL3_PATTERN);
}
return columnModel;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -39,12 +39,11 @@
import java.util.Set;
/**
- * TODO
- *
+ * @param <R> type of a row.
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public abstract class AbstractTuttiTableModel<R extends Serializable, C extends ColumnIdentifier<R>> extends AbstractTableModel {
+public abstract class AbstractTuttiTableModel<R extends Serializable> extends AbstractTableModel {
private static final long serialVersionUID = 1L;
@@ -64,7 +63,7 @@
*
* @since 0.2
*/
- protected final List<C> columnIdentifiers;
+ protected final List<ColumnIdentifier<R>> columnIdentifiers;
/**
* Data in the model.
@@ -78,7 +77,7 @@
*
* @since 0.2
*/
- protected Set<C> noneEditableCols;
+ protected Set<ColumnIdentifier<?>> noneEditableCols;
protected abstract R createNewRow();
@@ -89,7 +88,7 @@
for (int i = 0; i < nbcols; i++) {
TableColumn column = columnModel.getColumn(i);
columns[i] = column;
- columnIdentifiers.add((C) column.getIdentifier());
+ columnIdentifiers.add((ColumnIdentifier<R>) column.getIdentifier());
}
}
@@ -133,7 +132,7 @@
fireTableRowsInserted(rowIndex, rowIndex);
}
- public void updateRow(R row) {
+ public int updateRow(R row) {
Preconditions.checkNotNull(row, "Row can not be null.");
List<R> data = getRows();
@@ -142,6 +141,7 @@
int rowIndex = data.indexOf(row);
fireTableRowsUpdated(rowIndex, rowIndex);
+ return rowIndex;
}
protected void onRowsChanged(List<R> data) {
@@ -152,9 +152,9 @@
// by default do nothing
}
- public final C getPropertyName(int columnIndex) {
+ public final ColumnIdentifier<R> getPropertyName(int columnIndex) {
TableColumn column = getColumn(columnIndex);
- return (C) column.getIdentifier();
+ return (ColumnIdentifier<R>) column.getIdentifier();
}
public final R getEntry(int rowIndex) {
@@ -164,7 +164,7 @@
return result;
}
- public final void setNoneEditableCols(C... noneEditableCols) {
+ public final void setNoneEditableCols(ColumnIdentifier<?>... noneEditableCols) {
this.noneEditableCols = Sets.newHashSet(noneEditableCols);
}
@@ -181,7 +181,7 @@
@Override
public final Object getValueAt(int rowIndex, int columnIndex) {
R entry = getEntry(rowIndex);
- C propertyName = getPropertyName(columnIndex);
+ ColumnIdentifier<R> propertyName = getPropertyName(columnIndex);
Object result = getValueAt(rowIndex, columnIndex, propertyName, entry);
return result;
}
@@ -189,20 +189,20 @@
@Override
public final void setValueAt(Object aValue, int rowIndex, int columnIndex) {
R entry = getEntry(rowIndex);
- C propertyName = getPropertyName(columnIndex);
+ ColumnIdentifier<R> propertyName = getPropertyName(columnIndex);
setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
}
@Override
public final boolean isCellEditable(int rowIndex, int columnIndex) {
- C identifier = getPropertyName(columnIndex);
+ ColumnIdentifier<R> identifier = getPropertyName(columnIndex);
boolean result = isCellEditable(rowIndex, columnIndex, identifier);
return result;
}
protected Object getValueAt(int rowIndex,
int columnIndex,
- C propertyName,
+ ColumnIdentifier<R> propertyName,
R entry) {
Object result = propertyName.getValue(entry);
return result;
@@ -211,21 +211,21 @@
protected void setValueAt(Object aValue,
int rowIndex,
int columnIndex,
- C propertyName,
+ ColumnIdentifier<R> propertyName,
R entry) {
propertyName.setValue(entry, aValue);
}
protected boolean isCellEditable(int rowIndex,
int columnIndex,
- C propertyName) {
+ ColumnIdentifier<R> propertyName) {
boolean result = !noneEditableCols.contains(propertyName);
return result;
}
protected final void fireTableCellUpdated(int rowIndex,
- C... identifiers) {
- for (C identifier : identifiers) {
+ ColumnIdentifier... identifiers) {
+ for (ColumnIdentifier<?> identifier : identifiers) {
int columnIndex = getColumnIndex(identifier);
fireTableCellUpdated(rowIndex, columnIndex);
}
@@ -236,7 +236,7 @@
return columns[columnIndex];
}
- protected final int getColumnIndex(C property) {
+ protected final int getColumnIndex(ColumnIdentifier<?> property) {
int result = columnIdentifiers.indexOf(property);
return result;
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -66,10 +66,12 @@
import static org.nuiton.i18n.I18n._;
/**
+ * @param <R> type of a row
+ * @param <M> type of the ui model
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIModel, C extends ColumnIdentifier<R>, T extends AbstractTuttiTableModel<R, C>, M extends AbstractTuttiTableUIModel<?, R, M>> extends AbstractTuttiUIHandler<M> {
+public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIModel, M extends AbstractTuttiTableUIModel<?, R, M>> extends AbstractTuttiUIHandler<M> {
/** Logger. */
private static final Log log =
@@ -88,9 +90,10 @@
rowMonitor = new BeanMonitor(properties);
}
- protected KeyListener installTableKeyListener(TableColumnModel columnModel, JTable table) {
+ protected KeyListener installTableKeyListener(TableColumnModel columnModel,
+ JTable table) {
- T model = getTableModel();
+ AbstractTuttiTableModel<R> model = getTableModel();
final MoveToNextEditableCellAction nextCellAction =
MoveToNextEditableCellAction.newAction(model, table);
final MoveToPreviousEditableCellAction previousCellAction =
@@ -142,7 +145,7 @@
protected void addColumnToModel(TableColumnModel model,
TableCellEditor editor,
TableCellRenderer renderer,
- ColumnIdentifier identifier) {
+ ColumnIdentifier<R> identifier) {
TableColumn col = new TableColumnExt(model.getColumnCount());
col.setCellEditor(editor);
@@ -155,13 +158,13 @@
}
protected void addColumnToModel(TableColumnModel model,
- ColumnIdentifier identifier) {
+ ColumnIdentifier<R> identifier) {
addColumnToModel(model, null, null, identifier);
}
protected void addFloatColumnToModel(TableColumnModel model,
- ColumnIdentifier identifier,
+ ColumnIdentifier<R> identifier,
String numberPattern) {
NumberCellEditor<Float> editor =
@@ -175,7 +178,7 @@
}
protected void addIntegerColumnToModel(TableColumnModel model,
- ColumnIdentifier identifier,
+ ColumnIdentifier<R> identifier,
String numberPattern) {
NumberCellEditor<Integer> editor =
@@ -189,7 +192,7 @@
protected void addBooleanColumnToModel(TableColumnModel model,
- ColumnIdentifier identifier,
+ ColumnIdentifier<R> identifier,
JTable table) {
addColumnToModel(model,
@@ -199,7 +202,7 @@
}
protected <B> void addComboDataColumnToModel(TableColumnModel model,
- ColumnIdentifier identifier,
+ ColumnIdentifier<R> identifier,
Decorator<B> decorator, List<B> data) {
JComboBox comboBox = new JComboBox();
comboBox.setRenderer(newListCellRender(decorator));
@@ -216,7 +219,7 @@
}
protected <B extends Enum<B>> void addComboEnumColumnToModel(TableColumnModel model,
- ColumnIdentifier identifier,
+ ColumnIdentifier<R> identifier,
B[] data) {
EnumEditor<B> comboBox =
EnumEditor.newEditor(data);
@@ -314,13 +317,11 @@
protected abstract void saveRow(R row);
- protected abstract TableColumnModel createTableColumnModel(JXTable table);
+ protected abstract TableColumnModel createTableColumnModel();
protected abstract JTable getTable();
- protected T getTableModel() {
- return (T) getTable().getModel();
- }
+ protected abstract AbstractTuttiTableModel<R> getTableModel();
protected void listenModifcationOnFirstRow() {
List<R> rows = getTableModel().getRows();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -31,6 +31,9 @@
import java.util.List;
/**
+ * @param <E> type of incoming bean to edit
+ * @param <R> type of the row of the table model
+ * @param <B> type of this model
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java 2012-12-08 10:50:28 UTC (rev 35)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -24,21 +24,64 @@
* #L%
*/
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+
import java.io.Serializable;
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public interface ColumnIdentifier<R> extends Serializable {
+public class ColumnIdentifier<R> implements Serializable {
- String getPropertyName();
+ private static final long serialVersionUID = 1L;
- String getHeaderI18nKey();
+ private final String propertyName;
- String getHeaderTipI18nKey();
+ private final String headerI18nKey;
- void setValue(R entry, Object value);
+ private final String headerTipI18nKey;
- Object getValue(R entry);
+ public static <R> ColumnIdentifier<R> newId(String propertyName,
+ String headerI18nKey,
+ String headerTipI18nKey) {
+ return new ColumnIdentifier<R>(propertyName,
+ headerI18nKey,
+ headerTipI18nKey);
+ }
+
+ ColumnIdentifier(String propertyName,
+ String headerI18nKey,
+ String headerTipI18nKey) {
+ this.propertyName = propertyName;
+ this.headerI18nKey = headerI18nKey;
+ this.headerTipI18nKey = headerTipI18nKey;
+ }
+
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ public String getHeaderI18nKey() {
+ return headerI18nKey;
+ }
+
+ public String getHeaderTipI18nKey() {
+ return headerTipI18nKey;
+ }
+
+ public Object getValue(R entry) {
+ Object result = null;
+ if (propertyName != null && entry != null) {
+ result = TuttiUIUtil.getProperty(entry, propertyName);
+ }
+ return result;
+ }
+
+ public void setValue(R entry, Object value) {
+ if (propertyName != null) {
+ TuttiUIUtil.setProperty(entry, propertyName, value);
+ }
+ }
+
}
Added: trunk/tutti-ui-swing/src/main/resources/icons/action-generate-lengthSteps.png
===================================================================
(Binary files differ)
Property changes on: trunk/tutti-ui-swing/src/main/resources/icons/action-generate-lengthSteps.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModelTest.java
===================================================================
--- trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModelTest.java (rev 0)
+++ trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModelTest.java 2012-12-08 11:10:51 UTC (rev 36)
@@ -0,0 +1,66 @@
+package fr.ifremer.tutti.ui.swing.content.catches.species.frequency;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * 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 org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class SpeciesFrequencyRowModelTest {
+
+ @Test
+ public void compareTo() throws Exception {
+
+ SpeciesFrequencyRowModel s0 = new SpeciesFrequencyRowModel();
+ SpeciesFrequencyRowModel s1 = new SpeciesFrequencyRowModel();
+
+ // s0=null, s1=null
+ Assert.assertTrue(s0.compareTo(s1) == 0);
+
+ // s0=1, s1=null
+ s0.setLengthStep(1f);
+ Assert.assertTrue(s0.compareTo(s1) > 0);
+
+ // s0=null, s1=1
+ s0.setLengthStep(null);
+ s1.setLengthStep(1f);
+ Assert.assertTrue(s0.compareTo(s1) < 0);
+
+ // s0=2, s1=1
+ s0.setLengthStep(2f);
+ Assert.assertTrue(s0.compareTo(s1) > 0);
+
+ // s0=2, s1=2
+ s1.setLengthStep(2f);
+ Assert.assertTrue(s0.compareTo(s1) == 0);
+
+ // s0=2, s1=3
+ s1.setLengthStep(3f);
+ Assert.assertTrue(s0.compareTo(s1) < 0);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModelTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r35 - in trunk: tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities tutti-persistence/src/main/resources tutti-persistence/src/main/resources/META-INF tutti-persistence/src/main/resources/META-INF/services tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence
by tchemit@users.forge.codelutin.com Dec. 8, 2012
by tchemit@users.forge.codelutin.com Dec. 8, 2012
Dec. 8, 2012
Author: tchemit
Date: 2012-12-08 11:50:28 +0100 (Sat, 08 Dec 2012)
New Revision: 35
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/35
Log:
Improve persistence layer
Added:
trunk/tutti-persistence/src/main/resources/META-INF/
trunk/tutti-persistence/src/main/resources/META-INF/services/
trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity
Modified:
trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-12-07 14:48:55 UTC (rev 34)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2012-12-08 10:50:28 UTC (rev 35)
@@ -36,6 +36,8 @@
private static final long serialVersionUID = 1L;
+ public static final String PROPERTY_ID = "id";
+
protected String id;
public String getId() {
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2012-12-07 14:48:55 UTC (rev 34)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2012-12-08 10:50:28 UTC (rev 35)
@@ -32,6 +32,7 @@
import com.google.common.collect.Maps;
import fr.ifremer.tutti.persistence.entities.data.TraitAware;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -118,11 +119,33 @@
}
public static <B extends AbstractTuttiEntity> B newEntity(B entity) {
+ return newEntity((Class<B>) entity.getClass());
+ }
+
+ public static <B extends AbstractTuttiEntity> B newEntity(Class<B> type) {
try {
- Class<B> aClass = (Class<B>) entity.getClass();
- return aClass.newInstance();
+ return type.newInstance();
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
+
+ public static <K, V> void fillEntries(Map<K, V> map,
+ Collection<K> keys,
+ Function<K, V> function) {
+
+ for (K key : keys) {
+ V value = function.apply(key);
+ map.put(key, value);
+ }
+ }
+
+ public static <K,V> Function<K,V> newConstantFunction(final V value) {
+ return new Function<K, V>() {
+ @Override
+ public V apply(K input) {
+ return value;
+ }
+ };
+ }
}
Added: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity
===================================================================
--- trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity (rev 0)
+++ trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity 2012-12-08 10:50:28 UTC (rev 35)
@@ -0,0 +1,20 @@
+fr.ifremer.tutti.persistence.entities.data.AccidentelBatch
+fr.ifremer.tutti.persistence.entities.data.BenthosBatch
+fr.ifremer.tutti.persistence.entities.data.Campaign
+fr.ifremer.tutti.persistence.entities.data.MacroDechetBatch
+fr.ifremer.tutti.persistence.entities.data.PlanctonBatch
+fr.ifremer.tutti.persistence.entities.data.SpeciesBatch
+fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency
+fr.ifremer.tutti.persistence.entities.data.Strata
+fr.ifremer.tutti.persistence.entities.data.Survey
+fr.ifremer.tutti.persistence.entities.data.Trait
+fr.ifremer.tutti.persistence.entities.referential.BeaufortScale
+fr.ifremer.tutti.persistence.entities.referential.Country
+fr.ifremer.tutti.persistence.entities.referential.Gear
+fr.ifremer.tutti.persistence.entities.referential.SeaState
+fr.ifremer.tutti.persistence.entities.referential.Sex
+fr.ifremer.tutti.persistence.entities.referential.Species
+fr.ifremer.tutti.persistence.entities.referential.TuttiUser
+fr.ifremer.tutti.persistence.entities.referential.Vessel
+fr.ifremer.tutti.persistence.entities.referential.WeightCategory
+fr.ifremer.tutti.persistence.entities.referential.Zone
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/resources/META-INF/services/fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java
===================================================================
--- trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-07 14:48:55 UTC (rev 34)
+++ trunk/tutti-persistence-dev/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImpl.java 2012-12-08 10:50:28 UTC (rev 35)
@@ -30,6 +30,7 @@
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig;
import fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
@@ -59,6 +60,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.ApplicationConfig;
+import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
import java.io.File;
@@ -69,6 +71,7 @@
import java.io.ObjectOutputStream;
import java.util.List;
import java.util.Map;
+import java.util.ServiceLoader;
import java.util.UUID;
/**
@@ -83,32 +86,46 @@
private static final Log log =
LogFactory.getLog(TuttiPersistenceDevImpl.class);
- protected final ArrayListMultimap<Class<? extends AbstractTuttiEntity>, AbstractTuttiEntity> cache = ArrayListMultimap.create();
+ /**
+ * All entity types.
+ *
+ * @since 0.1
+ */
+ public static final List<Class<? extends AbstractTuttiEntity>> TYPES;
- public static final List<Class<? extends AbstractTuttiEntity>> TYPES = Lists.newArrayList(
- BeaufortScale.class,
- Campaign.class,
- Country.class,
- Gear.class,
- SeaState.class,
- Sex.class,
- Species.class,
- Survey.class,
- Trait.class,
- BenthosBatch.class,
- SpeciesBatch.class,
- SpeciesBatchFrequency.class,
- PlanctonBatch.class,
- MacroDechetBatch.class,
- AccidentelBatch.class,
- TuttiUser.class,
- Vessel.class,
- WeightCategory.class,
- Zone.class
- );
+ static {
+ TYPES = Lists.newArrayList();
+ for (AbstractTuttiEntity e : ServiceLoader.load(AbstractTuttiEntity.class)) {
+ TYPES.add(e.getClass());
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("Found " + TYPES.size() + " entity types.");
+ }
+ }
+
+ /**
+ * Persistence config.
+ *
+ * @since 0.1
+ */
protected TuttiPersistenceDevConfig config;
+ /**
+ * Cache of data.
+ *
+ * @since 0.1
+ */
+ protected final ArrayListMultimap<Class<? extends AbstractTuttiEntity>, AbstractTuttiEntity> cache = ArrayListMultimap.create();
+
+ /**
+ * Cache of binder.
+ *
+ * @since 0.2
+ */
+ protected final Map<Class<? extends AbstractTuttiEntity>, Binder<? extends AbstractTuttiEntity, ? extends AbstractTuttiEntity>> binderCache = Maps.newHashMap();
+
//------------------------------------------------------------------------//
//-- Technical methods --//
//------------------------------------------------------------------------//
@@ -118,7 +135,6 @@
return "Persistence Dev implementation";
}
-
@Override
public void open(ApplicationConfig config) throws IOException {
@@ -142,6 +158,8 @@
@Override
public void close() throws IOException {
+ binderCache.clear();
+
for (Class<? extends AbstractTuttiEntity> entityType : cache.keySet()) {
persistToFile(entityType);
}
@@ -219,7 +237,6 @@
return result;
}
-
//------------------------------------------------------------------------//
//-- Survey methods --//
//------------------------------------------------------------------------//
@@ -248,7 +265,6 @@
return result;
}
-
//------------------------------------------------------------------------//
//-- Campaign methods --//
//------------------------------------------------------------------------//
@@ -359,37 +375,14 @@
public List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId,
List<SpeciesBatchFrequency> frequencies) {
- // get back existing data
+ // get existing data
List<SpeciesBatchFrequency> existingData =
getAllSpeciesBatchFrequency(speciesBatchId);
- // index them by id
- Map<String, SpeciesBatchFrequency> existingById =
- TuttiEntities.splitById(existingData);
-
- List<SpeciesBatchFrequency> result = Lists.newArrayList();
-
- for (SpeciesBatchFrequency toSave : frequencies) {
-
- SpeciesBatchFrequency saved;
-
- if (TuttiEntities.isNew(toSave)) {
-
- // must create it
- saved = new SpeciesBatchFrequency();
- } else {
-
- // get existing data
- saved = existingById.get(toSave.getId());
- }
-
- // persist it
- persist(SpeciesBatchFrequency.class, toSave, saved);
-
- // store it back in result
- result.add(saved);
- }
-
+ List<SpeciesBatchFrequency> result =
+ persistList(SpeciesBatchFrequency.class,
+ existingData,
+ frequencies);
return result;
}
@@ -431,7 +424,6 @@
List<PlanctonBatch> result = getAllTraitFilterBatches(
PlanctonBatch.class, traitId);
return result;
-
}
@Override
@@ -514,18 +506,87 @@
//-- Internal methods --//
//------------------------------------------------------------------------//
+ protected <B extends AbstractTuttiEntity> Binder<B, B> getBinder(Class<B> type) {
+ Binder<B, B> result = (Binder<B, B>) binderCache.get(type);
+ if (result == null) {
+ result = BinderFactory.newBinder(type);
+ binderCache.put(type, result);
+ }
+ return result;
+ }
+
protected <B extends AbstractTuttiEntity> void persist(Class<B> beanType,
- B source, B target) {
+ B source,
+ B target,
+ boolean synchFile) {
- BinderFactory.newBinder(beanType).copyExcluding(
- source, target, "id");
+ getBinder(beanType).copyExcluding(source, target, AbstractTuttiEntity.PROPERTY_ID);
if (source.getId() == null) {
target.setId(UUID.randomUUID().toString());
}
if (!cache.containsValue(target)) {
cache.put(beanType, target);
}
+ if (synchFile) {
+ persistToFile(beanType);
+ }
+ }
+
+ protected <B extends AbstractTuttiEntity> List<B> persistList(Class<B> beanType,
+ List<B> existingData,
+ List<B> newData) {
+
+ Map<B, B> toPersist = Maps.newHashMap();
+
+ // mark all old entry to be dettach
+ TuttiEntities.fillEntries(toPersist,
+ existingData,
+ TuttiEntities.<B, B>newConstantFunction(null));
+
+ // index them by id
+ Map<String, B> existingById = TuttiEntities.splitById(existingData);
+
+ for (B toSave : newData) {
+
+ B saved;
+
+ if (TuttiEntities.isNew(toSave)) {
+
+ // must create it
+ saved = TuttiEntities.newEntity(beanType);
+ } else {
+
+ // get existing data
+ saved = existingById.get(toSave.getId());
+ }
+
+ // store it to be persist in one time
+ toPersist.put(toSave, saved);
+ }
+
+ // persist (entry with a value) and dettach (entry with no value)
+
+ List<B> result = Lists.newArrayList();
+
+ for (Map.Entry<B, B> entry : toPersist.entrySet()) {
+ B source = entry.getKey();
+ B target = entry.getValue();
+ if (target == null) {
+
+ // dettach entity
+ cache.remove(beanType, source);
+ } else {
+
+ // persist entity
+ persist(beanType, source, target, false);
+
+ // store it back in result
+ result.add(target);
+ }
+ }
persistToFile(beanType);
+
+ return result;
}
protected <B extends AbstractTuttiEntity> List<B> loadEntities(Class<B> entityType,
@@ -583,7 +644,6 @@
result = (List<B>) oos.readObject();
oos.close();
- return result;
} catch (ClassNotFoundException e) {
throw new RuntimeException("Could not find a class ", e);
} finally {
@@ -651,7 +711,7 @@
protected <B extends AbstractTuttiEntity> B create(Class<B> type, B bean) {
Preconditions.checkNotNull(bean, "Can't persist a null bean");
B result = TuttiEntities.newEntity(bean);
- persist(type, bean, result);
+ persist(type, bean, result, true);
return result;
}
@@ -660,7 +720,7 @@
String id = bean.getId();
Preconditions.checkNotNull(id, "Can't save a bean with null id");
B result = getBean(type, id);
- persist(type, bean, result);
+ persist(type, bean, result, true);
return result;
}
Modified: trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java
===================================================================
--- trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-12-07 14:48:55 UTC (rev 34)
+++ trunk/tutti-persistence-dev/src/test/java/fr/ifremer/tutti/persistence/TuttiPersistenceDevImplTest.java 2012-12-08 10:50:28 UTC (rev 35)
@@ -24,11 +24,15 @@
* #L%
*/
+import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.config.TuttiPersistenceDevConfig;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.data.Survey;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
@@ -37,6 +41,8 @@
import org.nuiton.util.ApplicationConfig;
import java.io.File;
+import java.io.IOException;
+import java.util.List;
/**
* @author tchemit <chemit(a)codelutin.com>
@@ -74,6 +80,13 @@
persistence = new TuttiPersistenceDevImpl();
}
+ @After
+ public void tearDown() throws IOException {
+ if (persistence != null) {
+ persistence.close();
+ }
+ }
+
@Test
public void open() throws Exception {
@@ -101,7 +114,8 @@
persistence.close();
Assert.assertTrue(storageDirectory.exists());
- Assert.assertEquals(fixtures.seaState().size(), persistence.getAllSeaState().size());
+ Assert.assertEquals(fixtures.seaState().size(),
+ persistence.getAllSeaState().size());
}
@Test
@@ -131,6 +145,67 @@
Assert.assertEquals(size + 1, persistence.getAllSurvey().size());
}
+ @Test
+ public void persistList() throws Exception {
+
+ persistence.open(config.getConfig());
+
+ SpeciesBatch batch = persistence.createSpeciesBatch(new SpeciesBatch());
+ String batchId = batch.getId();
+
+ SpeciesBatchFrequency f;
+
+ f = new SpeciesBatchFrequency();
+ f.setBatch(batch);
+ f.setLengthStep(10f);
+ f.setNumber(10);
+
+ List<SpeciesBatchFrequency> frequencyList = Lists.newArrayList();
+ frequencyList.add(f);
+
+ Assert.assertEquals(0, persistence.getAllSpeciesBatchFrequency(batchId).size());
+
+ persistence.saveSpeciesBatchFrequency(batchId, frequencyList);
+
+ frequencyList = persistence.getAllSpeciesBatchFrequency(batchId);
+ Assert.assertEquals(1, frequencyList.size());
+
+ f = frequencyList.get(0);
+ Assert.assertEquals(10, f.getNumber(), 0);
+ Assert.assertEquals(10f, f.getLengthStep(), 0);
+ Assert.assertNull(f.getWeight());
+
+ f.setLengthStep(12f);
+ f.setNumber(20);
+ f.setWeight(10f);
+
+ f = new SpeciesBatchFrequency();
+ f.setBatch(batch);
+ f.setLengthStep(30f);
+ f.setNumber(3);
+ f.setWeight(3f);
+
+ frequencyList.add(f);
+
+ persistence.saveSpeciesBatchFrequency(batchId, frequencyList);
+ frequencyList = persistence.getAllSpeciesBatchFrequency(batchId);
+ Assert.assertEquals(2, frequencyList.size());
+
+ f = frequencyList.get(0);
+ Assert.assertEquals(12f, f.getLengthStep(), 0);
+ Assert.assertEquals(20, f.getNumber(), 0);
+ Assert.assertEquals(10f, f.getWeight(), 0);
+
+ f = frequencyList.get(1);
+ Assert.assertEquals(30f, f.getLengthStep(), 0);
+ Assert.assertEquals(3, f.getNumber(), 0);
+ Assert.assertEquals(3f, f.getWeight(), 0);
+
+ frequencyList.clear();
+ persistence.saveSpeciesBatchFrequency(batchId, frequencyList);
+ Assert.assertEquals(0, persistence.getAllSpeciesBatchFrequency(batchId).size());
+ }
+
public static File getTestSpecificDirectory(Class<?> testClassName,
String methodName,
String classifier) {
1
0