Author: tchemit Date: 2012-12-20 18:28:55 +0100 (Thu, 20 Dec 2012) New Revision: 100 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/100 Log: sauvegarde automatique du trait Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 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/catches/EditCatchesUI.jaxx Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2012-12-20 17:05:25 UTC (rev 99) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2012-12-20 17:28:55 UTC (rev 100) @@ -249,7 +249,7 @@ } #createFishingOperationActions { - visible: {model.isEmpty()}; + visible: {!model.isPersisted()}; } #saveButton { Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-20 17:05:25 UTC (rev 99) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2012-12-20 17:28:55 UTC (rev 100) @@ -380,7 +380,7 @@ " was modified, will save it."); } - parentUi.getHandler().saveFishingOperation(toSave); + persistenceService.saveFishingOperation(toSave); } } @@ -425,9 +425,6 @@ // update model empty property model.setEmpty(empty); - // if new fishingOperation can already cancel his creation - model.setModify(!empty && model.isCreate()); - //reset gear shooting GearShootingTabUI gearShootingTab = ui.getGearShootingTabContent(); gearShootingTab.getModel().setGearShootingCaracteristics(getDefaultGearShootingCaracteristics()); @@ -481,6 +478,9 @@ // keep selected tab (to resotre it after save) int selectedIndex = ui.getFishingOperationTabPane().getSelectedIndex(); + // clean auto-save monitor to avoid re-entrant code + fishingOperationMonitor.clearModified(); + // persist current fishingOperation parentUi.getHandler().saveFishingOperation(toSave); Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-20 17:05:25 UTC (rev 99) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2012-12-20 17:28:55 UTC (rev 100) @@ -25,19 +25,18 @@ */ import fr.ifremer.tutti.persistence.entities.CaracteristicMap; +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.referential.FishingOperationLocation; import fr.ifremer.tutti.persistence.entities.referential.Person; import fr.ifremer.tutti.ui.swing.AbstractTuttiBeanUIModel; import fr.ird.type.SexagecimalPosition; -import java.util.Collection; import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderFactory; import java.util.Date; import java.util.List; -import java.util.Map; /** * Model for UI {@link EditFishingOperationUI}. @@ -49,6 +48,8 @@ private static final long serialVersionUID = 1L; + public static final String PROPERTY_PERSISTED = "persisted"; + public static final String PROPERTY_EMPTY = "empty"; public static final String PROPERTY_STATION_NUMBER = "stationNumber"; @@ -93,6 +94,11 @@ public static final String PROPERTY_HYDROLOGY_CARACTERISTICS = "hydrologyCaracteristics"; + /** + * Flag when there is no fishing operation selected. + * + * @since 0.2 + */ protected boolean empty; protected Cruise cruise; @@ -152,7 +158,7 @@ protected CaracteristicMap environmentCaracteristics; protected CaracteristicMap hydrologyCaracteristics; - + protected FishingOperation fishingOperation; protected static Binder<EditFishingOperationUIModel, FishingOperation> toBeanBinder = @@ -172,8 +178,13 @@ public void setFishingOperation(FishingOperation fishingOperation) { this.fishingOperation = fishingOperation; + firePropertyChange(PROPERTY_PERSISTED, null, isPersisted()); } + public boolean isPersisted() { + return fishingOperation != null && !TuttiEntities.isNew(fishingOperation); + } + public boolean isEmpty() { return empty; } 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-20 17:05:25 UTC (rev 99) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2012-12-20 17:28:55 UTC (rev 100) @@ -36,8 +36,6 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.util.decorator.Decorator; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.Date; @@ -178,12 +176,6 @@ // back to general tab of fishingOperation tabs ui.getFishingOperationTabContent().getFishingOperationTabPane().setSelectedIndex(0); - ui.getTabPane().addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - } - }); - String fishingOperationText; if (fishingOperation == null) { Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-20 17:05:25 UTC (rev 99) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2012-12-20 17:28:55 UTC (rev 100) @@ -90,136 +90,132 @@ <tab id='catchesCaracteristicsTab' title='tutti.label.tab.catchesCaracteristics'> <JXTitledPanel id='catchesTabsFishingOperationReminderLabel'> - <Table id="catchesForm" fill='both' weightx='1'> - <row> - <cell> - <Table id='speciesTable' fill='both'> + <JPanel layout='{new BorderLayout()}'> + <Table id="catchesForm" fill='both' weightx='1' + constraints='BorderLayout.NORTH'> + <row> + <cell columns="2"> + <Table id='speciesTable' fill='both'> - <!-- Poids total / Poids total vrac --> - <row> - <cell anchor='west'> - <JLabel id='speciesTotalWeightLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='speciesTotalWeightField' - constructorParams='this'/> - </cell> - <cell anchor='west'> - <JLabel id='speciesTotalSortedWeightLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='speciesTotalSortedWeightField' - constructorParams='this'/> - </cell> - </row> + <!-- Poids total / Poids total vrac --> + <row> + <cell anchor='west'> + <JLabel id='speciesTotalWeightLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='speciesTotalWeightField' + constructorParams='this'/> + </cell> + <cell anchor='west'> + <JLabel id='speciesTotalSortedWeightLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='speciesTotalSortedWeightField' + constructorParams='this'/> + </cell> + </row> - <!-- Poids échantillonné vrac / Poids total hors vrac --> - <row> - <cell> - <JLabel id='speciesSampleSortedWeightLabel'/> - </cell> - <cell> - <NumberEditor id='speciesSampleSortedWeightField' - constructorParams='this'/> - </cell> - <cell> - <JLabel id='speciesTotalUnsortedWeightLabel'/> - </cell> - <cell> - <JTextField id='speciesTotalUnsortedWeightField'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell> - <Table id='benthosTable' fill='both'> + <!-- Poids échantillonné vrac / Poids total hors vrac --> + <row> + <cell> + <JLabel id='speciesSampleSortedWeightLabel'/> + </cell> + <cell> + <NumberEditor id='speciesSampleSortedWeightField' + constructorParams='this'/> + </cell> + <cell> + <JLabel id='speciesTotalUnsortedWeightLabel'/> + </cell> + <cell> + <JTextField id='speciesTotalUnsortedWeightField'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell weightx="0.5"> + <Table id='benthosTable' fill='both'> - <!-- Poids total --> - <row> - <cell anchor='west'> - <JLabel id='benthosTotalWeightLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='benthosTotalWeightField' - constructorParams='this'/> - </cell> - </row> + <!-- Poids total --> + <row> + <cell anchor='west'> + <JLabel id='benthosTotalWeightLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='benthosTotalWeightField' + constructorParams='this'/> + </cell> + </row> - <!-- Poids total échantillonné --> - <row> - <cell> - <JLabel id='benthosSampleTotalWeightLabel'/> - </cell> - <cell> - <NumberEditor id='benthosSampleTotalWeightField' - constructorParams='this'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell> - <Table id='planktonTable' fill='both'> + <!-- Poids total échantillonné --> + <row> + <cell> + <JLabel id='benthosSampleTotalWeightLabel'/> + </cell> + <cell> + <NumberEditor id='benthosSampleTotalWeightField' + constructorParams='this'/> + </cell> + </row> + </Table> + </cell> + <cell weightx="0.5"> + <Table id='planktonTable' fill='both'> - <!-- Poids total --> - <row> - <cell anchor='west'> - <JLabel id='planktonTotalWeightLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='planktonTotalWeightField' - constructorParams='this'/> - </cell> - </row> + <!-- Poids total --> + <row> + <cell anchor='west'> + <JLabel id='planktonTotalWeightLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='planktonTotalWeightField' + constructorParams='this'/> + </cell> + </row> - <!-- Poids total échantillonné --> - <row> - <cell> - <JLabel id='planktonSampleTotalWeightLabel'/> - </cell> - <cell> - <NumberEditor id='planktonSampleTotalWeightField' - constructorParams='this'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell> - <Table id='macroWasteTable' fill='both'> + <!-- Poids total échantillonné --> + <row> + <cell> + <JLabel id='planktonSampleTotalWeightLabel'/> + </cell> + <cell> + <NumberEditor id='planktonSampleTotalWeightField' + constructorParams='this'/> + </cell> + </row> + </Table> + </cell> + </row> + <row> + <cell columns="2"> + <Table id='macroWasteTable' fill='both'> - <!-- Poids total --> - <row> - <cell anchor='west'> - <JLabel id='macroWasteTotalWeightLabel'/> - </cell> - <cell weightx='1.0'> - <NumberEditor id='macroWasteTotalWeightField' - constructorParams='this'/> - </cell> - </row> - </Table> - </cell> - </row> - <row> - <cell> - - </cell> - </row> - <!-- Actions d'import --> - <row> - <cell columns='6'> - <JPanel layout='{new GridLayout(1,0)}'> - <JButton id='importPupitriButton' - onActionPerformed='handler.importPupitri()'/> - </JPanel> - </cell> - </row> - </Table> + <!-- Poids total --> + <row> + <cell anchor='west'> + <JLabel id='macroWasteTotalWeightLabel'/> + </cell> + <cell weightx='1.0'> + <NumberEditor id='macroWasteTotalWeightField' + constructorParams='this'/> + </cell> + </row> + </Table> + </cell> + </row> + <!-- Actions d'import --> + <row> + <cell columns='6'> + <JPanel layout='{new GridLayout(1,0)}'> + <JButton id='importPupitriButton' + onActionPerformed='handler.importPupitri()'/> + </JPanel> + </cell> + </row> + </Table> + </JPanel> </JXTitledPanel> </tab> <tab id='speciesTab' title='tutti.label.tab.species'> @@ -244,7 +240,7 @@ </tab> <tab id='accidentalTab' title='tutti.label.tab.accidentel'> <JXTitledPanel id='accidentalTabFishingOperationReminderLabel'> - <AccidentalBatchUI id='accidentalTabContent' constructorParams='this'/> + <AccidentalBatchUI id='accidentalTabContent' constructorParams='this'/> </JXTitledPanel> </tab> <tab id='observationIndividuelTab'
participants (1)
-
tchemit@users.forge.codelutin.com