r508 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/content/operation/catches/species java/fr/ifremer/tutti/ui/swing/util/table resources/i18n
Author: kmorin Date: 2013-03-01 11:53:27 +0100 (Fri, 01 Mar 2013) New Revision: 508 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/508 Log: fixes #1998 [ESPECE] - Gestion du MELAG Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateMelagAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/EnterMelagWeightDialog.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/EnterMelagWeightDialog.jaxx Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateMelagAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateMelagAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateMelagAction.java 2013-03-01 10:53:27 UTC (rev 508) @@ -0,0 +1,163 @@ + +package fr.ifremer.tutti.ui.swing.content.operation.catches.species; + +import com.google.common.collect.Maps; +import fr.ifremer.tutti.ui.swing.AbstractTuttiAction; +import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyRowModel; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.util.Map; +import javax.swing.JOptionPane; +import jaxx.runtime.JAXXUtil; +import jaxx.runtime.SwingUtil; +import org.apache.commons.lang3.StringUtils; +import org.nuiton.util.StringUtil; + +import static org.nuiton.i18n.I18n._; + +/** + * + * @author kmorin <kmorin@codelutin.com> + * @since 1.0.2 + */ +public class CreateMelagAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> { + + private static final long serialVersionUID = 1L; + + protected Map<SpeciesBatchRowModel, Float> selectedRows = Maps.newHashMap(); + + protected Float melagWeight = null; + + protected Float sampleMelagWeight = null; + + protected Float sortedWeight = null; + + public CreateMelagAction(SpeciesBatchUIHandler handler) { + super(handler, + "createMelag", + "batch-rename", + _("tutti.action.createMelag"), + _("tutti.action.createMelag.tip"), + false + ); + } + + @Override + protected boolean prepareAction(ActionEvent event) { + boolean result = super.prepareAction(event); + + SpeciesBatchUIHandler handler = getHandler(); + int[] selectedRowIndexes = handler.getTable().getSelectedRows(); + + SpeciesBatchTableModel tableModel = handler.getTableModel(); + + // sum of the weights already entered by the user + Float alreadyKnownWeights = 0f; + sortedWeight = 0f; + + for (int selectedRowIndex : selectedRowIndexes) { + SpeciesBatchRowModel selectedRow = + tableModel.getEntry(selectedRowIndex); + + Float sampleWeight = null; + if (selectedRow.getFinestCategory().getCategoryWeight() != null) { + alreadyKnownWeights += selectedRow.getFinestCategory().getCategoryWeight(); + + } else if (selectedRow.getFinestCategory().getComputedWeight() != null) { + alreadyKnownWeights += selectedRow.getFinestCategory().getComputedWeight(); + + } else if (selectedRow.getWeight() != null) { + sampleWeight = selectedRow.getWeight(); + + } else { + sampleWeight = 0f; + if (selectedRow.getFrequency() != null) { + for (SpeciesFrequencyRowModel frequency : selectedRow.getFrequency()) { + if (frequency.getWeight() == null) { + sampleWeight = 0f; + break; + } + sampleWeight += frequency.getWeight(); + } + } + } + + if (sampleWeight != null) { + if (sampleWeight == 0f) { + JOptionPane.showMessageDialog( + getUI(), + _("tutti.dialog.createMelag.error.message", selectedRowIndex + 1), + _("tutti.dialog.createMelag.error.title"), + JOptionPane.ERROR_MESSAGE); + + handler.getTable().getSelectionModel().setSelectionInterval(selectedRowIndex, selectedRowIndex); + result = false; + break; + + } else { + sortedWeight += sampleWeight; + } + } + + selectedRows.put(selectedRow, sampleWeight); + } + + if (result) { + melagWeight = openMelagWeightDialog(); + + if (melagWeight != null) { + // substract the weights that the user already entered + // they must not be used to compute the other weights + sampleMelagWeight = melagWeight - alreadyKnownWeights; + } + } + + return result && melagWeight != null; + } + + protected Float openMelagWeightDialog() { + Frame frame = SwingUtil.getParentContainer(getUI(), Frame.class); + + final EnterMelagWeightDialog dialog = new EnterMelagWeightDialog(frame, + getConfig().getShortcutClosePopup()); + SwingUtil.center(frame, dialog); + dialog.pack(); + dialog.setVisible(true); + + Float result = null; + if (dialog.getEditor().getModel() != null) { + result = dialog.getEditor().getModel().floatValue(); + } + return result; + } + + @Override + protected void doAction(ActionEvent event) throws Exception { + for (SpeciesBatchRowModel batch : selectedRows.keySet()) { + Float sampleWeight = selectedRows.get(batch); + if (sampleWeight != null) { + Float weight = sampleMelagWeight * sampleWeight / sortedWeight; + batch.getFinestCategory().setCategoryWeight(weight); + } + String comment = batch.getComment(); + if (StringUtils.isBlank(comment)) { + comment = ""; + + } else { + comment += "\n"; + } + comment += "issu d'un MELAG de " + melagWeight + "kg"; + batch.setComment(comment); + } + getHandler().saveRows(selectedRows.keySet()); + } + + @Override + protected void releaseAction(ActionEvent event) { + super.releaseAction(event); + getHandler().getTable().repaint(); + selectedRows.clear(); + melagWeight = null; + sortedWeight = null; + } +} Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/EnterMelagWeightDialog.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/EnterMelagWeightDialog.css (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/EnterMelagWeightDialog.css 2013-03-01 10:53:27 UTC (rev 508) @@ -0,0 +1,25 @@ +#dialog { + title: "tutti.dialog.createMelag.title"; +} + +#message { + text: "tutti.dialog.createMelag.message"; + horizontalAlignment: {JLabel.CENTER}; +} + +#editor { + useFloat: true; + useSign: false; + autoPopup: true; + showPopupButton: true; + showReset: true; +} + +#cancelButton { + text: "tutti.action.cancel"; +} + +#validateButton { + text: "tutti.action.validate"; + enabled: { editor.getModel() != null }; +} \ No newline at end of file Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/EnterMelagWeightDialog.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/EnterMelagWeightDialog.jaxx (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/EnterMelagWeightDialog.jaxx 2013-03-01 10:53:27 UTC (rev 508) @@ -0,0 +1,49 @@ +<JDialog id='dialog' layout='{new BorderLayout()}'> + <import> + java.awt.Component; + java.awt.event.WindowAdapter; + java.awt.event.WindowEvent; + javax.swing.JComponent + javax.swing.JRootPane; + javax.swing.KeyStroke; + jaxx.runtime.swing.editor.NumberEditor + </import> + + <script><![CDATA[ + +public EnterMelagWeightDialog(Frame frame, KeyStroke shortcutClosePopup) { + super(frame, true); + + // add a auto-close action + rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( + shortcutClosePopup, "close"); + + addWindowListener(new WindowAdapter() { + + @Override + public void windowClosed(WindowEvent e) { + Component ui = (Component) e.getSource(); + JAXXUtil.destroy(ui); + } + }); +} + + ]]></script> + + <Table id='table' fill='both' constraints='BorderLayout.CENTER'> + <row> + <cell insets='10, 10, 5, 10'> + <JLabel id='message'/> + </cell> + </row> + <row> + <cell insets='5, 10, 10, 10'> + <NumberEditor id='editor'/> + </cell> + </row> + </Table> + <JPanel layout='{new GridLayout(1,0)}' constraints='BorderLayout.SOUTH'> + <JButton id='cancelButton' onActionPerformed='editor.setModel(null); dispose();'/> + <JButton id='validateButton' onActionPerformed='dispose();'/> + </JPanel> +</JDialog> \ No newline at end of file Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2013-03-01 09:33:34 UTC (rev 507) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2013-03-01 10:53:27 UTC (rev 508) @@ -8,15 +8,15 @@ * %% * 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 + * 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 + * + * 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% @@ -131,8 +131,13 @@ enabled: {model.isTableViewModeAll() && model.isRenameSpeciesBatchEnabled()}; } +#createMelag { + _tuttiAction: {CreateMelagAction.class}; + enabled: {!model.isTableViewModeLeaf() && model.isCreateMelagEnabled()}; +} + #table { - selectionMode: {ListSelectionModel.SINGLE_SELECTION}; + selectionMode: {ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}; selectionBackground: {null}; selectionForeground: {Color.BLACK}; sortable: false; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-03-01 09:33:34 UTC (rev 507) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-03-01 10:53:27 UTC (rev 508) @@ -84,6 +84,7 @@ <JMenuItem id='removeSpeciesBatchMenu'/> <JMenuItem id='removeSpeciesSubBatchMenu'/> <JMenuItem id='renameSpeciesBatchMenu'/> + <JMenuItem id='createMelag'/> </JPopupMenu> <Table id='form' fill='both' constraints='BorderLayout.NORTH'> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-03-01 09:33:34 UTC (rev 507) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-03-01 10:53:27 UTC (rev 508) @@ -10,15 +10,15 @@ * %% * 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 + * 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 + * + * 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% @@ -83,10 +83,12 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.Serializable; +import java.util.Arrays; import java.util.EnumMap; import java.util.List; import java.util.Map; import java.util.Set; +import javax.swing.UIManager; import static org.nuiton.i18n.I18n._; import static org.nuiton.i18n.I18n.n_; @@ -634,7 +636,6 @@ new HighlightPredicate() { public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { - int rowIndex = adapter.convertRowIndexToModel(adapter.row); SpeciesBatchRowModel row = getTableModel().getEntry(adapter.row); return row.getSpeciesToConfirm(); } @@ -644,12 +645,20 @@ initBatchTable(table, columnModel, tableModel); + // highlight only the species column if the row is selected + Highlighter selectedHighlighter = TuttiUIUtil.newBackgroundColorHighlighter( + new HighlightPredicate.AndHighlightPredicate( + HighlightPredicate.IS_SELECTED, + new HighlightPredicate.IdentifierHighlightPredicate(SpeciesBatchTableModel.SPECIES)), + UIManager.getColor("Table[Enabled+Selected].textBackground")); + + table.addHighlighter(selectedHighlighter); + // paint the cell in dark orange if the row is to confirm and the cell is not editable attachmentHighlighter = TuttiUIUtil.newBackgroundColorHighlighter( new HighlightPredicate() { public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { - int rowIndex = adapter.convertRowIndexToModel(adapter.row); SpeciesBatchRowModel row = getTableModel().getEntry(adapter.row); return row.getSpeciesToConfirm() && !adapter.isEditable(); } @@ -841,7 +850,7 @@ } - protected void saveRows(Iterable<SpeciesBatchRowModel> rows) { + public void saveRows(Iterable<SpeciesBatchRowModel> rows) { for (SpeciesBatchRowModel row : rows) { saveRow(row); } @@ -910,44 +919,6 @@ row.setFrequency(frequencyRows); } - protected void recomputeTotalUnsortedWeight() { - - // recompute total hors vrac - Float totalHorsVrac = 0f; - Float totalVrac = 0f; - - for (SpeciesBatchRowModel batch : getModel().getRows()) { - CaracteristicQualitativeValue vracHorsVrac = - batch.getSortedUnsortedCategoryValue(); - - if (vracHorsVrac == null) { - - // can't sum anything - } else { - boolean unsorted = "unsorted".equals(vracHorsVrac.getName()); - if (unsorted) { - Float weight = batch.getWeight(); - if (weight != null) { - totalHorsVrac += weight; - } - } else { - Float weight = batch.getWeight(); - if (weight != null) { - totalVrac += weight; - } - } - } - } - if (log.isInfoEnabled()) { - log.info("New total vrac / hors vrac: " + - totalVrac + " / " + totalHorsVrac); - } - ui.getSpeciesTotalUnsortedWeightField() - .setText(JAXXUtil.getStringValue(totalHorsVrac)); - //TODO Should we also set the total vrac weight ? -// getModel().setTotalVracWeight(totalVrac); - } - protected void recomputeBatchActionEnable() { int rowIndex = getTable().getSelectedRow(); @@ -960,6 +931,7 @@ boolean enableSplit = false; boolean enableRemove = false; boolean enableRemoveSub = false; + boolean enableCreateMelag = false; if (rowIndex != -1) { @@ -968,7 +940,8 @@ //TODO If there is some sub-batch, can remove them //TODO If there is no sub-batch, can split current batch - SpeciesBatchRowModel row = getTableModel().getEntry(rowIndex); + SpeciesBatchTableModel tableModel = getTableModel(); + SpeciesBatchRowModel row = tableModel.getEntry(rowIndex); if (row.isValid()) { @@ -979,6 +952,7 @@ enableRemove = true; enableRemoveSub = true; enableRename = true; + enableCreateMelag = true; } if (enableSplit) { @@ -1005,12 +979,37 @@ // can remove sub batch if selected batch is not a leaf enableRemoveSub = !row.isBatchLeaf(); } + + if (enableCreateMelag) { + + JXTable table = getTable(); + + // can add species to a melag if several root are selected + int[] selectedRows = table.getSelectedRows(); + if (selectedRows.length < 2) { + enableCreateMelag = false; + + } else { + for (int selectedRowIndex : selectedRows) { + SpeciesBatchRowModel selectedRow = + tableModel.getEntry(selectedRowIndex); + + if (!selectedRow.isBatchRoot()) { + enableCreateMelag = false; + break; + } + } + } + } } - getModel().setCreateSpeciesBatchEnabled(enableAdd); - getModel().setSplitSpeciesBatchEnabled(enableSplit); - getModel().setRemoveSpeciesBatchEnabled(enableRemove); - getModel().setRemoveSpeciesSubBatchEnabled(enableRemoveSub); - getModel().setRenameSpeciesBatchEnabled(enableRename); + + SpeciesBatchUIModel model = getModel(); + model.setCreateSpeciesBatchEnabled(enableAdd); + model.setSplitSpeciesBatchEnabled(enableSplit); + model.setRemoveSpeciesBatchEnabled(enableRemove); + model.setRemoveSpeciesSubBatchEnabled(enableRemoveSub); + model.setRenameSpeciesBatchEnabled(enableRename); + model.setCreateMelagEnabled(enableCreateMelag); } public void collectChilds(SpeciesBatchRowModel row, @@ -1161,4 +1160,8 @@ return model.getSelectedSpecies(); } + + public void test() { + JOptionPane.showMessageDialog(ui, Arrays.toString(getTable().getSelectedRows())); + } } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-03-01 09:33:34 UTC (rev 507) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-03-01 10:53:27 UTC (rev 508) @@ -10,15 +10,15 @@ * %% * 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 + * 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 + * + * 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% @@ -56,6 +56,8 @@ public static final String PROPERTY_REMOVE_SPECIES_BATCH_ENABLED = "removeSpeciesBatchEnabled"; + public static final String PROPERTY_CREATE_MELAG_ENABLED = "createMelagEnabled"; + public static final String PROPERTY_TABLE_VIEW_MODE_ALL = "tableViewModeAll"; public static final String PROPERTY_TABLE_VIEW_MODE_LEAF = "tableViewModeLeaf"; @@ -123,6 +125,13 @@ */ protected boolean removeSpeciesSubBatchEnabled; + /** + * Can user create a melag from the selected species? + * + * @since 0.3 + */ + protected boolean createMelagEnabled = true; + /** @since 1.0 */ protected int rootNumber; @@ -148,7 +157,7 @@ public void setSpeciesTotalComputedWeight(Float speciesTotalComputedWeight) { catchesUIModel.setSpeciesTotalComputedWeight(speciesTotalComputedWeight); } - + public TuttiComputedOrNotData<Float> getSpeciesTotalSortedComputedOrNotWeight() { return catchesUIModel.getSpeciesTotalSortedComputedOrNotWeight(); } @@ -176,7 +185,7 @@ public void setSpeciesTotalUnsortedComputedWeight(Float speciesTotalUnsortedComputedWeight) { catchesUIModel.setSpeciesTotalUnsortedComputedWeight(speciesTotalUnsortedComputedWeight); } - + public Float getSpeciesTotalSampleSortedComputedWeight() { return catchesUIModel.getSpeciesTotalSampleSortedComputedWeight(); } @@ -184,7 +193,7 @@ public void setSpeciesTotalSampleSortedComputedWeight(Float speciesTotalSampleSortedComputedWeight) { catchesUIModel.setSpeciesTotalSampleSortedComputedWeight(speciesTotalSampleSortedComputedWeight); } - + public Float getSpeciesTotalInertWeight() { return catchesUIModel.getSpeciesTotalInertWeight(); } @@ -317,4 +326,15 @@ public boolean isRenameSpeciesBatchEnabled() { return renameSpeciesBatchEnabled; } + + public boolean isCreateMelagEnabled() { + return createMelagEnabled; + } + + public void setCreateMelagEnabled(boolean createMelagEnabled) { + Object oldValue = isCreateMelagEnabled(); + this.createMelagEnabled = createMelagEnabled; + firePropertyChange(PROPERTY_CREATE_MELAG_ENABLED, oldValue, createMelagEnabled); + } + } 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 2013-03-01 09:33:34 UTC (rev 507) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2013-03-01 10:53:27 UTC (rev 508) @@ -10,15 +10,15 @@ * %% * 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 + * 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 + * + * 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% @@ -73,6 +73,7 @@ import java.awt.event.MouseEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.Arrays; import java.util.Enumeration; import java.util.List; import java.util.Set; @@ -302,7 +303,8 @@ new HighlightPredicate.AndHighlightPredicate( new MyIdentifierHighlightPredicate(SpeciesBatchTableModel.COMMENT), // for not null value - new HighlightPredicate.NotHighlightPredicate(new HighlightPredicate.EqualsHighlightPredicate()) + new HighlightPredicate.NotHighlightPredicate(new HighlightPredicate.EqualsHighlightPredicate()), + new HighlightPredicate.NotHighlightPredicate(new HighlightPredicate.EqualsHighlightPredicate("")) ), cellWithValueColor); table.addHighlighter(commentHighlighter); @@ -678,6 +680,8 @@ JXTable source = (JXTable) e.getSource(); + int[] selectedRows = source.getSelectedRows(); + // get the row index at this point int rowIndex = source.rowAtPoint(p); @@ -704,7 +708,7 @@ // select row (could empty selection) if (rowIndex == -1) { source.clearSelection(); - } else { + } else if (!ArrayUtils.contains(selectedRows, rowIndex)) { source.setRowSelectionInterval(rowIndex, rowIndex); } 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 2013-03-01 09:33:34 UTC (rev 507) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-03-01 10:53:27 UTC (rev 508) @@ -44,6 +44,8 @@ tutti.action.computeWeights.tip=Elever les poids tutti.action.configuration=Configuration tutti.action.configuration.tip=Configurer Tutti +tutti.action.createMelag=Èspèces d'un MELAG +tutti.action.createMelag.tip=Calcul des poids des lots appartenant à un MELAG tutti.action.createSpeciesBatch=Créer un lot pour une espèce tutti.action.deleteProtocol=Supprimer tutti.action.deleteProtocol.message=Vous êtes sur le point de supprimer le protocol %s @@ -185,6 +187,10 @@ tutti.dialog.catches.species.computeWeight.error.title=Erreur tutti.dialog.catches.species.split.weightNotNull.message=Pour catégoriser un lot, il ne doit pas avoir de poids sous-échantillonné. Catégoriser le lot mettra le poids sous-échantillonné à nul. tutti.dialog.catches.species.split.weightNotNull.title=Poids sous-échantillonné non nul +tutti.dialog.createMelag.error.message=Erreur à la ligne %s +tutti.dialog.createMelag.error.title=Erreur +tutti.dialog.createMelag.message=Combien pesait le MELAG (kg) ? +tutti.dialog.createMelag.title=Poids du MELAG (kg) tutti.duration.format=dj Hh m'm' tutti.error.errorpane.htmlmessage=<html><body><b>Une erreur s'est produite</b>\:<br/>%s</body></html> tutti.file.csv=Extension d'un fichier csv
participants (1)
-
kmorin@users.forge.codelutin.com