This is an automated email from the git hooks/post-receive script. New commit to branch feature/7930 in repository tutti. See http://git.codelutin.com/tutti.git commit 57296e7ac5c78545905429f17fbf9cb959c3add3 Author: Kevin Morin <morin@codelutin.com> Date: Thu Feb 11 12:06:16 2016 +0100 - ajout des autres colonnes - modification de la taille max de la ligne précédente quand on modifie la taille min refs #7930 --- .../CalcifiedPiecesSamplingEditorRowModel.java | 80 ++++++++++++++++++++-- .../CalcifiedPiecesSamplingEditorTableModel.java | 45 ++++++++++-- .../CalcifiedPiecesSamplingEditorUIHandler.java | 38 +++++++--- .../MinSizePopupUIHandler.java | 3 - .../actions/AddSpeciesAction.java | 6 +- .../actions/SplitSpeciesAction.java | 16 +++-- .../resources/i18n/tutti-ui-swing_en_GB.properties | 10 +++ .../resources/i18n/tutti-ui-swing_fr_FR.properties | 18 +++-- 8 files changed, 182 insertions(+), 34 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorRowModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorRowModel.java index a808c7f..b19a893 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorRowModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorRowModel.java @@ -12,19 +12,39 @@ public class CalcifiedPiecesSamplingEditorRowModel extends AbstractSerializableB public static final String PROPERTY_SPECIES = "species"; + public static final String PROPERTY_MATURITY = "maturity"; + + public static final String PROPERTY_SEX = "sex"; + public static final String PROPERTY_MIN_SIZE = "minSize"; public static final String PROPERTY_MAX_SIZE = "maxSize"; - public static final String PROPERTY_MATURITY = "maturity"; + public static final String PROPERTY_MAX_BY_LENGHT_STEP = "maxByLenghtStep"; + + public static final String PROPERTY_SAMPLING_INTERVAL = "samplingInterval"; + + public static final String PROPERTY_OPERATION_LIMITATION = "operationLimitation"; + + public static final String PROPERTY_ZONE_LIMITATION = "zoneLimitation"; protected Species species; - protected int minSize; + protected Boolean maturity; + + protected boolean sex; + + protected Integer minSize; protected Integer maxSize; - protected Boolean maturity; + protected Integer maxByLenghtStep; + + protected Integer samplingInterval; + + protected Integer operationLimitation; + + protected Integer zoneLimitation; public Integer getMaxSize() { return maxSize; @@ -36,11 +56,11 @@ public class CalcifiedPiecesSamplingEditorRowModel extends AbstractSerializableB firePropertyChange(PROPERTY_MAX_SIZE, oldValue, maxSize); } - public int getMinSize() { + public Integer getMinSize() { return minSize; } - public void setMinSize(int minSize) { + public void setMinSize(Integer minSize) { Object oldValue = getMinSize(); this.minSize = minSize; firePropertyChange(PROPERTY_MIN_SIZE, oldValue, minSize); @@ -65,4 +85,54 @@ public class CalcifiedPiecesSamplingEditorRowModel extends AbstractSerializableB this.maturity = maturity; firePropertyChange(PROPERTY_MATURITY, oldValue, maturity); } + + public Integer getOperationLimitation() { + return operationLimitation; + } + + public void setOperationLimitation(Integer operationLimitation) { + Object oldValue = getOperationLimitation(); + this.operationLimitation = operationLimitation; + firePropertyChange(PROPERTY_OPERATION_LIMITATION, oldValue, operationLimitation); + } + + public Integer getMaxByLenghtStep() { + return maxByLenghtStep; + } + + public void setMaxByLenghtStep(Integer maxByLenghtStep) { + Object oldValue = getMaxByLenghtStep(); + this.maxByLenghtStep = maxByLenghtStep; + firePropertyChange(PROPERTY_MAX_BY_LENGHT_STEP, oldValue, maxByLenghtStep); + } + + public Integer getSamplingInterval() { + return samplingInterval; + } + + public void setSamplingInterval(Integer samplingInterval) { + Object oldValue = getSamplingInterval(); + this.samplingInterval = samplingInterval; + firePropertyChange(PROPERTY_SAMPLING_INTERVAL, oldValue, samplingInterval); + } + + public boolean isSex() { + return sex; + } + + public void setSex(boolean sex) { + Object oldValue = isSex(); + this.sex = sex; + firePropertyChange(PROPERTY_SEX, oldValue, sex); + } + + public Integer getZoneLimitation() { + return zoneLimitation; + } + + public void setZoneLimitation(Integer zoneLimitation) { + Object oldValue = getZoneLimitation(); + this.zoneLimitation = zoneLimitation; + firePropertyChange(PROPERTY_ZONE_LIMITATION, oldValue, zoneLimitation); + } } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorTableModel.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorTableModel.java index 1d8ffa4..6b55c7a 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorTableModel.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorTableModel.java @@ -21,6 +21,16 @@ public class CalcifiedPiecesSamplingEditorTableModel extends AbstractApplication n("tutti.editCps.table.header.species.field"), n("tutti.editCps.table.header.species.field.tip")); + public static final ColumnIdentifier<CalcifiedPiecesSamplingEditorRowModel> MATURITY = ColumnIdentifier.newId( + CalcifiedPiecesSamplingEditorRowModel.PROPERTY_MATURITY, + n("tutti.editCps.table.header.maturity.field"), + n("tutti.editCps.table.header.maturity.field.tip")); + + public static final ColumnIdentifier<CalcifiedPiecesSamplingEditorRowModel> SEX = ColumnIdentifier.newId( + CalcifiedPiecesSamplingEditorRowModel.PROPERTY_SEX, + n("tutti.editCps.table.header.sex.field"), + n("tutti.editCps.table.header.sex.field.tip")); + public static final ColumnIdentifier<CalcifiedPiecesSamplingEditorRowModel> MIN_SIZE = ColumnIdentifier.newId( CalcifiedPiecesSamplingEditorRowModel.PROPERTY_MIN_SIZE, n("tutti.editCps.table.header.minSize.field"), @@ -31,10 +41,26 @@ public class CalcifiedPiecesSamplingEditorTableModel extends AbstractApplication n("tutti.editCps.table.header.maxSize.field"), n("tutti.editCps.table.header.maxSize.field.tip")); - public static final ColumnIdentifier<CalcifiedPiecesSamplingEditorRowModel> MATURITY = ColumnIdentifier.newId( - CalcifiedPiecesSamplingEditorRowModel.PROPERTY_MATURITY, - n("tutti.editCps.table.header.maturity.field"), - n("tutti.editCps.table.header.maturity.field.tip")); + public static final ColumnIdentifier<CalcifiedPiecesSamplingEditorRowModel> MAX_BY_LENGHT_STEP = ColumnIdentifier.newId( + CalcifiedPiecesSamplingEditorRowModel.PROPERTY_MAX_BY_LENGHT_STEP, + n("tutti.editCps.table.header.maxByLengthStep.field"), + n("tutti.editCps.table.header.maxByLengthStep.field.tip")); + + public static final ColumnIdentifier<CalcifiedPiecesSamplingEditorRowModel> SAMPLING_INTERVAL = ColumnIdentifier.newId( + CalcifiedPiecesSamplingEditorRowModel.PROPERTY_SAMPLING_INTERVAL, + n("tutti.editCps.table.header.samplingInterval.field"), + n("tutti.editCps.table.header.samplingInterval.field.tip")); + + public static final ColumnIdentifier<CalcifiedPiecesSamplingEditorRowModel> OPERATION_LIMITATION = ColumnIdentifier.newId( + CalcifiedPiecesSamplingEditorRowModel.PROPERTY_OPERATION_LIMITATION, + n("tutti.editCps.table.header.operationLimitation.field"), + n("tutti.editCps.table.header.operationLimitation.field.tip")); + + public static final ColumnIdentifier<CalcifiedPiecesSamplingEditorRowModel> ZONE_LIMITATION = ColumnIdentifier.newId( + CalcifiedPiecesSamplingEditorRowModel.PROPERTY_ZONE_LIMITATION, + n("tutti.editCps.table.header.zoneLimitation.field"), + n("tutti.editCps.table.header.zoneLimitation.field.tip")); + public CalcifiedPiecesSamplingEditorTableModel(TableColumnModelExt columnModel) { super(columnModel, false, false); @@ -47,20 +73,27 @@ public class CalcifiedPiecesSamplingEditorTableModel extends AbstractApplication } public CalcifiedPiecesSamplingEditorRowModel createNewRow(Species species, - Boolean maturity) { - return createNewRow(species, maturity, 0, null); + Boolean maturity, + boolean sex) { + return createNewRow(species, maturity,sex, 0, null); } public CalcifiedPiecesSamplingEditorRowModel createNewRow(Species species, Boolean maturity, + boolean sex, int minSize, Integer maxSize) { CalcifiedPiecesSamplingEditorRowModel newRow = createNewRow(); newRow.setSpecies(species); newRow.setMaturity(maturity); + newRow.setSex(sex); newRow.setMinSize(minSize); newRow.setMaxSize(maxSize); + newRow.setMaxByLenghtStep(0); + newRow.setSamplingInterval(0); + newRow.setOperationLimitation(0); + newRow.setZoneLimitation(0); return newRow; } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorUIHandler.java index 040d037..581412f 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/CalcifiedPiecesSamplingEditorUIHandler.java @@ -8,6 +8,8 @@ import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel; import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler; import fr.ifremer.tutti.ui.swing.util.TuttiUI; import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.JAXXWidgetUtil; +import jaxx.runtime.swing.editor.cell.NumberCellEditor; import jaxx.runtime.validator.swing.SwingValidator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -19,9 +21,11 @@ import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.SwingConstants; +import javax.swing.border.LineBorder; import javax.swing.event.TableModelEvent; import javax.swing.table.JTableHeader; import javax.swing.table.TableCellRenderer; +import java.awt.Color; import java.awt.Component; import java.util.ArrayList; import java.util.List; @@ -55,15 +59,8 @@ public class CalcifiedPiecesSamplingEditorUIHandler extends AbstractTuttiUIHandl speciesColumn.putClientProperty(SpeciesAbleBatchRowHelper.SPECIES_DECORATOR, speciesDecorator); speciesColumn.setCellRenderer(newTableCellRender(speciesDecorator)); - addColumnToModel(columnModel, - null, - newTableCellRender(Boolean.class, DecoratorService.MATURITY), - CalcifiedPiecesSamplingEditorTableModel.MATURITY); - - addIntegerColumnToModel(columnModel, CalcifiedPiecesSamplingEditorTableModel.MIN_SIZE, TuttiUI.INT_6_DIGITS_PATTERN, cpsTable); - // renderer to display infinite instead of null - TableCellRenderer renderer = new TableCellRenderer() { + TableCellRenderer infiniteRenderer = new TableCellRenderer() { private final TableCellRenderer tableCellRenderer = cpsTable.getDefaultRenderer(Integer.class); @@ -79,7 +76,30 @@ public class CalcifiedPiecesSamplingEditorUIHandler extends AbstractTuttiUIHandl return result; } }; - addColumnToModel(columnModel, null, renderer, CalcifiedPiecesSamplingEditorTableModel.MAX_SIZE); + + // table cell number editor + NumberCellEditor editor = JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false); + editor.getNumberEditor().setSelectAllTextOnError(Boolean.valueOf(true)); + editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2)); + editor.getNumberEditor().setNumberPattern(TuttiUI.INT_6_DIGITS_PATTERN); + + addColumnToModel(columnModel, + null, + newTableCellRender(Boolean.class, DecoratorService.MATURITY), + CalcifiedPiecesSamplingEditorTableModel.MATURITY); + + addBooleanColumnToModel(columnModel, CalcifiedPiecesSamplingEditorTableModel.SEX, cpsTable); + + addIntegerColumnToModel(columnModel, CalcifiedPiecesSamplingEditorTableModel.MIN_SIZE, TuttiUI.INT_6_DIGITS_PATTERN, cpsTable); + + addColumnToModel(columnModel, null, infiniteRenderer, CalcifiedPiecesSamplingEditorTableModel.MAX_SIZE); + + addColumnToModel(columnModel, editor, infiniteRenderer, CalcifiedPiecesSamplingEditorTableModel.MAX_BY_LENGHT_STEP); + + addIntegerColumnToModel(columnModel, CalcifiedPiecesSamplingEditorTableModel.SAMPLING_INTERVAL, TuttiUI.INT_6_DIGITS_PATTERN, cpsTable); + + addColumnToModel(columnModel, editor, infiniteRenderer, CalcifiedPiecesSamplingEditorTableModel.OPERATION_LIMITATION); + addColumnToModel(columnModel, editor, infiniteRenderer, CalcifiedPiecesSamplingEditorTableModel.ZONE_LIMITATION); final CalcifiedPiecesSamplingEditorTableModel tableModel = diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/MinSizePopupUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/MinSizePopupUIHandler.java index 5e2cce6..05d4976 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/MinSizePopupUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/MinSizePopupUIHandler.java @@ -53,9 +53,6 @@ public class MinSizePopupUIHandler extends AbstractTuttiUIHandler<MinSizePopupUI @Override public void keyReleased(KeyEvent e) { super.keyReleased(e); - if (log.isInfoEnabled()) { - log.info("action key ? " + e.isActionKey() + " " + e.getKeyCode()); - } if (e.getKeyCode() == KeyEvent.VK_ENTER) { validate(); } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/actions/AddSpeciesAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/actions/AddSpeciesAction.java index a4cc115..57b0181 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/actions/AddSpeciesAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/actions/AddSpeciesAction.java @@ -32,14 +32,14 @@ public class AddSpeciesAction extends SimpleActionSupport<CalcifiedPiecesSamplin List<CalcifiedPiecesSamplingEditorRowModel> newRows = new ArrayList<>(); if (ui.getMaturityCheckBox().isSelected()) { - CalcifiedPiecesSamplingEditorRowModel newRow = tableModel.createNewRow(species, true); + CalcifiedPiecesSamplingEditorRowModel newRow = tableModel.createNewRow(species, true, true); newRows.add(newRow); - newRow = tableModel.createNewRow(species, false); + newRow = tableModel.createNewRow(species, false, true); newRows.add(newRow); } else { - CalcifiedPiecesSamplingEditorRowModel newRow = tableModel.createNewRow(species, null); + CalcifiedPiecesSamplingEditorRowModel newRow = tableModel.createNewRow(species, null, true); newRows.add(newRow); } diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/actions/SplitSpeciesAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/actions/SplitSpeciesAction.java index e8c0179..869508c 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/actions/SplitSpeciesAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/calcifiedpiecessampling/actions/SplitSpeciesAction.java @@ -53,13 +53,21 @@ public class SplitSpeciesAction extends SimpleActionSupport<CalcifiedPiecesSampl CalcifiedPiecesSamplingEditorRowModel newRow = tableModel.createNewRow(row.getSpecies(), row.getMaturity(), + row.isSex(), minSize, exMaxSize); - // newRow.addPropertyChangeListener(CalcifiedPiecesSamplingEditorRowModel.PROPERTY_MIN_SIZE, evt -> { - // row.setMaxSize(((int) evt.getNewValue()) - 1); - // tableModel.fireTableRowsInserted(row); - // }); + newRow.addPropertyChangeListener(CalcifiedPiecesSamplingEditorRowModel.PROPERTY_MIN_SIZE, evt -> { + + int newRowIndex = cpsRows.indexOf(evt.getSource()); + int previousRowIndex = newRowIndex - 1; + + CalcifiedPiecesSamplingEditorRowModel previousRow = cpsRows.get(previousRowIndex); + previousRow.setMaxSize(((int) evt.getNewValue()) - 1); + + tableModel.fireTableRowsUpdated(previousRowIndex, newRowIndex); + + }); cpsRows.add(selectedRow + 1, newRow); diff --git a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties index 288a20c..c3b2fa6 100644 --- a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties +++ b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties @@ -740,12 +740,22 @@ tutti.editCps.splitRow= tutti.editCps.splitRow.tip= tutti.editCps.table.header.maturity.field= tutti.editCps.table.header.maturity.field.tip= +tutti.editCps.table.header.maxByLengthStep.field= +tutti.editCps.table.header.maxByLengthStep.field.tip= tutti.editCps.table.header.maxSize.field= tutti.editCps.table.header.maxSize.field.tip= tutti.editCps.table.header.minSize.field= tutti.editCps.table.header.minSize.field.tip= +tutti.editCps.table.header.operationLimitation.field= +tutti.editCps.table.header.operationLimitation.field.tip= +tutti.editCps.table.header.samplingInterval.field= +tutti.editCps.table.header.samplingInterval.field.tip= +tutti.editCps.table.header.sex.field= +tutti.editCps.table.header.sex.field.tip= tutti.editCps.table.header.species.field= tutti.editCps.table.header.species.field.tip= +tutti.editCps.table.header.zoneLimitation.field= +tutti.editCps.table.header.zoneLimitation.field.tip= tutti.editCruise.action.closeEditCruise= tutti.editCruise.action.closeEditCruise.mnemonic= tutti.editCruise.action.closeEditCruise.tip= diff --git a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties index f955aa1..a25c689 100644 --- a/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties +++ b/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties @@ -702,12 +702,22 @@ tutti.editCps.splitRow=Ajouter un intervalle tutti.editCps.splitRow.tip=Ajouter un intervalle tutti.editCps.table.header.maturity.field=Maturité tutti.editCps.table.header.maturity.field.tip=Maturité -tutti.editCps.table.header.maxSize.field=Taille max -tutti.editCps.table.header.maxSize.field.tip=Taille maximale incluse -tutti.editCps.table.header.minSize.field=Taille min -tutti.editCps.table.header.minSize.field.tip=Taille minimale incluse +tutti.editCps.table.header.maxByLengthStep.field=Max / classe de taille +tutti.editCps.table.header.maxByLengthStep.field.tip= +tutti.editCps.table.header.maxSize.field=Taille max (mm) +tutti.editCps.table.header.maxSize.field.tip=Taille maximale incluse, en millimètres +tutti.editCps.table.header.minSize.field=Taille min (mm) +tutti.editCps.table.header.minSize.field.tip=Taille minimale incluse, en millimètres +tutti.editCps.table.header.operationLimitation.field=Limite / trait +tutti.editCps.table.header.operationLimitation.field.tip=Nombre limite de prélèvements par trait +tutti.editCps.table.header.samplingInterval.field=Prendre 1/n +tutti.editCps.table.header.samplingInterval.field.tip=Intervalle entre deux prélèvements +tutti.editCps.table.header.sex.field=Sexe +tutti.editCps.table.header.sex.field.tip=Prise en compte du sexe tutti.editCps.table.header.species.field=Espèce tutti.editCps.table.header.species.field.tip=Espèce +tutti.editCps.table.header.zoneLimitation.field=Limite / zone +tutti.editCps.table.header.zoneLimitation.field.tip=Nombre limite de prélèvements par zone tutti.editCruise.action.closeEditCruise=Fermer tutti.editCruise.action.closeEditCruise.mnemonic=F tutti.editCruise.action.closeEditCruise.tip=Fermer l'écran d'édition de campagne -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.