Tutti-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- 4130 discussions
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 11 Dec '12
by tchemit@users.forge.codelutin.com 11 Dec '12
11 Dec '12
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
11 Dec '12
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 10 Dec '12
by tchemit@users.forge.codelutin.com 10 Dec '12
10 Dec '12
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 10 Dec '12
by tchemit@users.forge.codelutin.com 10 Dec '12
10 Dec '12
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
10 Dec '12
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
08 Dec '12
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 08 Dec '12
by tchemit@users.forge.codelutin.com 08 Dec '12
08 Dec '12
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
r34 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table
by tchemit@users.forge.codelutin.com 07 Dec '12
by tchemit@users.forge.codelutin.com 07 Dec '12
07 Dec '12
Author: tchemit
Date: 2012-12-07 15:48:55 +0100 (Fri, 07 Dec 2012)
New Revision: 34
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/34
Log:
add missing svn properties
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
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-07 14:48:14 UTC (rev 33)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2012-12-07 14:48:55 UTC (rev 34)
@@ -4,7 +4,7 @@
* #%L
* Tutti :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2012 Ifremer
* %%
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
1
0
r33 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing 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/util/table resources/i18n resources/icons
by tchemit@users.forge.codelutin.com 07 Dec '12
by tchemit@users.forge.codelutin.com 07 Dec '12
07 Dec '12
Author: tchemit
Date: 2012-12-07 15:48:14 +0100 (Fri, 07 Dec 2012)
New Revision: 33
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/33
Log:
saisie des mensurations + am?\195?\169lioration api table
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java
trunk/tutti-ui-swing/src/main/resources/icons/action-close.png
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java
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/content/catches/species/FrequencyCellComponent.java
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/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/SpeciesFrequencyColumnIdentifier.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/SpeciesFrequencyUI.css
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/util/table/AbstractSelectTableAction.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/resources/i18n/tutti-ui-swing_fr_FR.properties
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -322,8 +322,8 @@
String surveyId = context.getSurveyId();
String campaignId = context.getCampaignId();
- JComponent screenUI = null;
- String screenTitle = null;
+ JComponent screenUI;
+ String screenTitle;
switch (screen) {
default:
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -25,8 +25,9 @@
*/
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.content.catches.species.frequency.SpeciesFrequencyUI;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -87,6 +88,8 @@
protected Frame frame;
+ protected JTable table;
+
protected SpeciesBatchTableModel tableModel;
protected SpeciesBatchColumnIdentifier columnIdentifier;
@@ -95,6 +98,8 @@
protected Integer rowIndex;
+ protected Integer columnIndex;
+
public FrequencyCellEditor(SpeciesFrequencyUI ui) {
this.ui = ui;
component = new FrequencyCellComponent();
@@ -125,8 +130,7 @@
// open frequency dialog
- Preconditions.checkNotNull(editRow,
- "No editRow found.");
+ Preconditions.checkNotNull(editRow, "No editRow found.");
if (log.isInfoEnabled()) {
log.info("Will edit frequencies for row: " + rowIndex);
@@ -138,8 +142,21 @@
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
@@ -150,7 +167,7 @@
int column) {
if (tableModel == null) {
tableModel = (SpeciesBatchTableModel) table.getModel();
-
+ this.table = table;
columnIdentifier = tableModel.getPropertyName(column);
}
String text;
@@ -162,6 +179,7 @@
component.setText(text);
rowIndex = row;
+ columnIndex = column;
editRow = tableModel.getEntry(row);
@@ -173,9 +191,6 @@
Preconditions.checkNotNull(editRow, "No editRow found in editor.");
- // update from computed frequencies
- editRow.updateTotalFromFrequencies();
-
Object result;
if (columnIdentifier == SpeciesBatchColumnIdentifier.computedNumber) {
result = editRow.getComputedNumber();
@@ -195,6 +210,7 @@
if (b) {
rowIndex = null;
editRow = null;
+ columnIndex = null;
}
return b;
}
@@ -203,6 +219,7 @@
public void cancelCellEditing() {
super.cancelCellEditing();
rowIndex = null;
+ columnIndex = null;
editRow = null;
}
}
Modified: 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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -25,7 +25,7 @@
*/
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import static org.nuiton.i18n.I18n.n_;
@@ -33,7 +33,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public enum SpeciesBatchColumnIdentifier implements AbstractColumnIdentifier<SpeciesBatchRowModel> {
+public enum SpeciesBatchColumnIdentifier implements ColumnIdentifier<SpeciesBatchRowModel> {
speciesToConfirm(
n_("tutti.table.species.batch.header.toConfirm"),
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchRowModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -192,12 +192,9 @@
List<SpeciesBatchFrequency> frequencies) {
this();
fromBean(aBatch);
-
- for (SpeciesBatchFrequency frequencyBean : frequencies) {
- SpeciesFrequencyRowModel f = new SpeciesFrequencyRowModel();
- f.fromBean(frequencyBean);
- frequency.add(f);
- }
+ List<SpeciesFrequencyRowModel> frequencyRows =
+ SpeciesFrequencyRowModel.fromBeans(frequencies);
+ frequency.addAll(frequencyRows);
updateTotalFromFrequencies();
}
@@ -209,7 +206,16 @@
totalWeight = 0f;
for (SpeciesFrequencyRowModel frequencyModel : frequency) {
totalNumber += frequencyModel.getNumber();
- totalWeight += frequencyModel.getComputedWeight();
+ 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;
+ }
}
}
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTableModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -84,6 +84,17 @@
SpeciesBatchColumnIdentifier.speciesByCode,
SpeciesBatchColumnIdentifier.computedNumber,
SpeciesBatchColumnIdentifier.computedWeight);
+ } else if (propertyName == SpeciesBatchColumnIdentifier.computedNumber) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SpeciesBatchColumnIdentifier.computedWeight);
+
+ } else if (propertyName == SpeciesBatchColumnIdentifier.computedWeight) {
+
+ // update also other columns
+ fireTableCellUpdated(rowIndex,
+ SpeciesBatchColumnIdentifier.computedNumber);
}
}
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -36,9 +36,11 @@
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.species.frequency.SpeciesFrequencyRowModel;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
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;
@@ -80,7 +82,8 @@
SpeciesBatchRowModel.PROPERTY_WEIGHT,
SpeciesBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
SpeciesBatchRowModel.PROPERTY_ELEVATION_RATIO,
- SpeciesBatchRowModel.PROPERTY_COMMENT);
+ SpeciesBatchRowModel.PROPERTY_COMMENT,
+ SpeciesBatchRowModel.PROPERTY_FREQUENCY);
this.ui = ui;
this.parentUi = parentUi;
this.persistenceService = context.getService(PersistenceService.class);
@@ -138,6 +141,9 @@
// save when row chaged and was modified
listenRowModification(table);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(getTable());
}
@Override
@@ -161,6 +167,22 @@
} 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 selectTrait(Trait bean) {
@@ -304,8 +326,7 @@
addFloatColumnToModel(columnModel,
SpeciesBatchColumnIdentifier.maturity,
- TuttiUI.DECIMAL3_PATTERN
- );
+ TuttiUI.DECIMAL3_PATTERN);
}
{ // Age
Modified: 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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -25,7 +25,7 @@
*/
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import static org.nuiton.i18n.I18n.n_;
@@ -33,7 +33,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public enum SpeciesFrequencyColumnIdentifier implements AbstractColumnIdentifier<SpeciesFrequencyRowModel> {
+public enum SpeciesFrequencyColumnIdentifier implements ColumnIdentifier<SpeciesFrequencyRowModel> {
lengthStep(
n_("tutti.table.species.frequency.header.lengthStep"),
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyRowModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -24,11 +24,15 @@
* #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.ui.swing.AbstractTuttiBeanUIModel;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
+import java.util.List;
+
/**
* Represents a batch frequency row.
*
@@ -83,6 +87,27 @@
BinderFactory.newBinder(SpeciesFrequencyRowModel.class,
SpeciesBatchFrequency.class);
+ 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);
}
@@ -126,4 +151,10 @@
this.computedWeight = computedWeight;
firePropertyChange(PROPERTY_COMPUTED_WEIGHT, oldValue, computedWeight);
}
+
+ //TODO Use validator
+ @Override
+ public boolean isValid() {
+ return lengthStep != null && number != null;
+ }
}
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -24,9 +24,13 @@
* #L%
*/
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import javax.swing.table.TableColumnModel;
+import java.util.List;
+import java.util.Map;
/**
* Model of the species frequency table.
@@ -38,15 +42,34 @@
private static final long serialVersionUID = 1L;
- public SpeciesFrequencyTableModel(TableColumnModel columnModel) {
+ 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(SpeciesFrequencyColumnIdentifier.computedWeight);
}
@Override
protected SpeciesFrequencyRowModel createNewRow() {
- return new SpeciesFrequencyRowModel();
+ 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
@@ -58,4 +81,41 @@
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
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-07 14:48:14 UTC (rev 33)
@@ -21,24 +21,122 @@
* <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-lengthSteps";
+ text: "tutti.action.generate";
+ enabled: {model.isCanGenerate()};
+}
+
#configurationPanel {
- border:{new TitledBorder(null, _("tutti.label.frequencyConfiguration"))};
+ border: {new TitledBorder(null, _("tutti.legend.frequencyConfiguration"))};
}
-#saveButton {
- actionIcon:"save";
- text:"tutti.action.save";
- enabled:{model.isModify() && model.isValid()};
+#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";
+ actionIcon: "close";
+ text: "tutti.action.close";
}
#table {
- selectionMode:{ListSelectionModel.SINGLE_SELECTION};
- selectionBackground:{null};
- selectionForeground:{Color.BLACK};
- sortable:false;
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
}
\ No newline at end of file
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx 2012-12-07 14:48:14 UTC (rev 33)
@@ -28,18 +28,20 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.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[
@@ -65,16 +67,93 @@
<SpeciesFrequencyUIModel id='model'
initializer='getContextValue(SpeciesFrequencyUIModel.class)'/>
- <JPanel id='configurationPanel' constraints='BorderLayout.NORTH'
- layout='{new BorderLayout()}'>
+ <CardLayout2Ext id='modeConfigurationLayout'
+ constructorParams='this, "modeConfigurationPanel"'/>
- <JPanel id='configurationModePanel' constraints='BorderLayout.WEST'>
+ <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>
-
-
- </JPanel>
<JScrollPane id='tableScrollPane' constraints='BorderLayout.CENTER'>
<JXTable id='table'/>
</JScrollPane>
@@ -82,7 +161,7 @@
<!-- actions -->
<JPanel id='actionPanel' layout='{new GridLayout(1, 0)}'
constraints='BorderLayout.SOUTH'>
- <JButton id='close' onActionPerformed='handler.close()'/>
+ <JButton id='closeButton' onActionPerformed='handler.close()'/>
</JPanel>
</JPanel>
\ No newline at end of file
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -24,12 +24,14 @@
* #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.content.catches.species.SpeciesBatchRowModel;
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;
@@ -39,6 +41,11 @@
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>
@@ -71,17 +78,6 @@
}
@Override
- protected void saveRow(SpeciesFrequencyRowModel row) {
-
- //TODO
- }
-
- @Override
- protected JXTable getTable() {
- return ui.getTable();
- }
-
- @Override
public void afterInitUI() {
initUI(ui);
@@ -91,9 +87,11 @@
// create table column model
TableColumnModel columnModel = createTableColumnModel(table);
+ SpeciesFrequencyUIModel model = getModel();
+
// create table model
SpeciesFrequencyTableModel tableModel =
- new SpeciesFrequencyTableModel(columnModel);
+ new SpeciesFrequencyTableModel(columnModel, model);
table.setModel(tableModel);
table.setColumnModel(columnModel);
@@ -102,31 +100,159 @@
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();
// save when row chaged and was modified
listenRowModification(table);
+
+ //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() {
-// ui.getValidator().setBean(null);
}
@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
+ protected JXTable getTable() {
+ return ui.getTable();
+ }
+
+ @Override
protected SpeciesFrequencyUIModel getModel() {
return ui.getModel();
}
+ 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();
+ Map<Float, SpeciesFrequencyRowModel> rowsByStep = getTableModel().getRowCache();
+
+ float aroundLengthStep = model.getLengthStep(step);
+
+ SpeciesFrequencyRowModel row = rowsByStep.get(aroundLengthStep);
+
+ if (row != null) {
+
+ // increments current row
+ Integer number = row.getNumber();
+ row.setNumber((number == null ? 0 : number) + 1);
+ getTableModel().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);
+
+ int indexRow = steps.indexOf(aroundLengthStep);
+
+ getTableModel().addNewRow(indexRow, row);
+ }
+ }
+
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 row: " + row);
+ log.info("Will edit batch row: " + row + " with " +
+ editFrequency.size() + " frequency");
}
- getModel().fromBean(row);
+ getModel().setRows(editFrequency);
+
+ // keep batch (will be used to push back editing entry)
+ getModel().setBatch(row);
}
public void close() {
@@ -135,6 +261,25 @@
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);
@@ -149,7 +294,7 @@
addFloatColumnToModel(columnModel,
SpeciesFrequencyColumnIdentifier.lengthStep,
- TuttiUI.DECIMAL3_PATTERN);
+ TuttiUI.DECIMAL1_PATTERN);
}
{ // Number
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -26,11 +26,7 @@
import fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderModelBuilder;
-import static org.nuiton.i18n.I18n.n_;
-
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
@@ -39,49 +35,65 @@
private static final long serialVersionUID = 1L;
- protected static final Binder<SpeciesBatchRowModel, SpeciesFrequencyUIModel> fromBeanBinder =
- BinderModelBuilder.newEmptyBuilder(SpeciesBatchRowModel.class, SpeciesFrequencyUIModel.class)
- .addProperty(SpeciesBatchRowModel.PROPERTY_FREQUENCY, PROPERTY_ROWS)
- .toBinder();
+ public static final String PROPERTY_CONFIGURATION_MODE = "configurationMode";
- protected static final Binder<SpeciesFrequencyUIModel, SpeciesBatchRowModel> toBeanBinder =
- BinderModelBuilder.newEmptyBuilder(SpeciesFrequencyUIModel.class, SpeciesBatchRowModel.class)
- .addProperty(PROPERTY_ROWS, SpeciesBatchRowModel.PROPERTY_FREQUENCY)
- .toBinder();
+ public static final String PROPERTY_STEP = "step";
- public static final String PROPERTY_CONFIGURATION_MODE = "configurationMode";
+ private static final String PROPERTY_MIN_STEP = "minStep";
- public static enum ConfigurationMode {
+ private static final String PROPERTY_MAX_STEP = "maxStep";
- SIMPLE(n_("tutti.speciesFrequency.configurationMode.simple"),
- n_("tutti.speciesFrequency.configurationMode.simple.tip")),
- AUTO_GEN(n_("tutti.speciesFrequency.configurationMode.autoGenerate"),
- n_("tutti.speciesFrequency.configurationMode.autoGenerate.tip")),
- RAFALE(n_("tutti.speciesFrequency.configurationMode.rafale"),
- n_("tutti.speciesFrequency.configurationMode.rafale.tip"));
+ public static final String PROPERTY_CAN_GENERATE = "canGenerate";
- private final String i18nKey;
+ public static final String PROPERTY_SIMPLE_MODE = "simpleMode";
- private final String tipKey;
+ public static final String PROPERTY_AUTO_GEN_MODE = "autoGenMode";
- private ConfigurationMode(String i18nKey, String tipKey) {
- this.i18nKey = i18nKey;
- this.tipKey = tipKey;
- }
+ public static final String PROPERTY_RAFALE_MODE = "rafaleMode";
- public String getI18nKey() {
- return i18nKey;
- }
-
- public String getTipKey() {
- return tipKey;
- }
+ 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, fromBeanBinder, toBeanBinder);
+ super(SpeciesBatchRowModel.class, null, null);
}
public ConfigurationMode getConfigurationMode() {
@@ -92,6 +104,72 @@
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
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -1,44 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util.table;
-
-/*
- * #%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 java.io.Serializable;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public interface AbstractColumnIdentifier<R> extends Serializable {
-
- String getPropertyName();
-
- String getHeaderI18nKey();
-
- String getHeaderTipI18nKey();
-
- void setValue(R entry, Object value);
-
- Object getValue(R entry);
-}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java 2012-12-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -53,16 +53,20 @@
this.table = table;
}
+ public static void doSelectCell(JTable table, int rowIndex, int columnIndex) {
+
+ table.setColumnSelectionInterval(columnIndex, columnIndex);
+ table.setRowSelectionInterval(rowIndex, rowIndex);
+ table.editCellAt(rowIndex, columnIndex);
+ }
+
protected void doSelectCell(int rowIndex, int columnIndex) {
if (log.isDebugEnabled()) {
log.debug("Will select cell at " +
getCellCoordinate(rowIndex, columnIndex));
}
-
- table.editCellAt(rowIndex, columnIndex);
- table.setColumnSelectionInterval(columnIndex, columnIndex);
- table.setRowSelectionInterval(rowIndex, rowIndex);
+ doSelectCell(table, rowIndex, columnIndex);
}
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -44,7 +44,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public abstract class AbstractTuttiTableModel<R extends Serializable, C extends AbstractColumnIdentifier<R>> extends AbstractTableModel {
+public abstract class AbstractTuttiTableModel<R extends Serializable, C extends ColumnIdentifier<R>> extends AbstractTableModel {
private static final long serialVersionUID = 1L;
@@ -111,20 +111,47 @@
log.info("Set " + data.size() + " row(s) in table model " + this);
}
this.rows = data;
+ onRowsChanged(data);
fireTableDataChanged();
}
public final void addNewRow() {
R newValue = createNewRow();
+ addNewRow(getRowCount(), newValue);
+ }
+ public final void addNewRow(int rowIndex, R newValue) {
+
+ Preconditions.checkNotNull(newValue, "Row can not be null.");
+
List<R> data = getRows();
Preconditions.checkNotNull(data, "Data list can not be null.");
- data.add(newValue);
- int rowIndex = data.indexOf(newValue);
+ data.add(rowIndex, newValue);
+
+ onRowAdded(rowIndex, newValue);
fireTableRowsInserted(rowIndex, rowIndex);
}
+ public void updateRow(R row) {
+ Preconditions.checkNotNull(row, "Row can not be null.");
+
+ List<R> data = getRows();
+ Preconditions.checkNotNull(data, "Data list can not be null.");
+
+ int rowIndex = data.indexOf(row);
+
+ fireTableRowsUpdated(rowIndex, rowIndex);
+ }
+
+ protected void onRowsChanged(List<R> data) {
+ // by default do nothing
+ }
+
+ protected void onRowAdded(int rowIndex, R newValue) {
+ // by default do nothing
+ }
+
public final C getPropertyName(int columnIndex) {
TableColumn column = getColumn(columnIndex);
return (C) column.getIdentifier();
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -69,7 +69,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIModel, C extends AbstractColumnIdentifier<R>, T extends AbstractTuttiTableModel<R, C>, M extends AbstractTuttiTableUIModel<?, R, M>> extends AbstractTuttiUIHandler<M> {
+public abstract class AbstractTuttiTableUIHandler<R extends AbstractTuttiBeanUIModel, C extends ColumnIdentifier<R>, T extends AbstractTuttiTableModel<R, C>, M extends AbstractTuttiTableUIModel<?, R, M>> extends AbstractTuttiUIHandler<M> {
/** Logger. */
private static final Log log =
@@ -139,10 +139,10 @@
return keyAdapter;
}
- protected <C extends AbstractColumnIdentifier> void addColumnToModel(TableColumnModel model,
- TableCellEditor editor,
- TableCellRenderer renderer,
- C identifier) {
+ protected void addColumnToModel(TableColumnModel model,
+ TableCellEditor editor,
+ TableCellRenderer renderer,
+ ColumnIdentifier identifier) {
TableColumn col = new TableColumnExt(model.getColumnCount());
col.setCellEditor(editor);
@@ -154,15 +154,15 @@
model.addColumn(col);
}
- protected <C extends AbstractColumnIdentifier> void addColumnToModel(TableColumnModel model,
- C identifier) {
+ protected void addColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier) {
addColumnToModel(model, null, null, identifier);
}
- protected <C extends AbstractColumnIdentifier> void addFloatColumnToModel(TableColumnModel model,
- C identifier,
- String numberPattern) {
+ protected void addFloatColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier,
+ String numberPattern) {
NumberCellEditor<Float> editor =
JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
@@ -174,9 +174,9 @@
}
- protected <C extends AbstractColumnIdentifier> void addIntegerColumnToModel(TableColumnModel model,
- C identifier,
- String numberPattern) {
+ protected void addIntegerColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier,
+ String numberPattern) {
NumberCellEditor<Integer> editor =
JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false);
@@ -188,9 +188,9 @@
}
- protected <C extends AbstractColumnIdentifier> void addBooleanColumnToModel(TableColumnModel model,
- C identifier,
- JTable table) {
+ protected void addBooleanColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier,
+ JTable table) {
addColumnToModel(model,
table.getDefaultEditor(Boolean.class),
@@ -198,9 +198,9 @@
identifier);
}
- protected <C extends AbstractColumnIdentifier, B> void addComboDataColumnToModel(TableColumnModel model,
- C identifier,
- Decorator<B> decorator, List<B> data) {
+ protected <B> void addComboDataColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier,
+ Decorator<B> decorator, List<B> data) {
JComboBox comboBox = new JComboBox();
comboBox.setRenderer(newListCellRender(decorator));
SwingUtil.fillComboBox(comboBox, data, null);
@@ -215,9 +215,9 @@
identifier);
}
- protected <C extends AbstractColumnIdentifier, B extends Enum<B>> void addComboEnumColumnToModel(TableColumnModel model,
- C identifier,
- B[] data) {
+ protected <B extends Enum<B>> void addComboEnumColumnToModel(TableColumnModel model,
+ ColumnIdentifier identifier,
+ B[] data) {
EnumEditor<B> comboBox =
EnumEditor.newEditor(data);
BeanUIUtil.decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION);
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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -42,7 +42,9 @@
protected List<R> rows;
- protected AbstractTuttiTableUIModel(Class<E> entityType, Binder<E, B> fromBeanBinder, Binder<B, E> toBeanBinder) {
+ protected AbstractTuttiTableUIModel(Class<E> entityType,
+ Binder<E, B> fromBeanBinder,
+ Binder<B, E> toBeanBinder) {
super(entityType, fromBeanBinder, toBeanBinder);
}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java (from rev 32, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractColumnIdentifier.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java 2012-12-07 14:48:14 UTC (rev 33)
@@ -0,0 +1,44 @@
+package fr.ifremer.tutti.ui.swing.util.table;
+
+/*
+ * #%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 java.io.Serializable;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public interface ColumnIdentifier<R> extends Serializable {
+
+ String getPropertyName();
+
+ String getHeaderI18nKey();
+
+ String getHeaderTipI18nKey();
+
+ void setValue(R entry, Object value);
+
+ Object getValue(R entry);
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.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-06 17:43:45 UTC (rev 32)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-07 14:48:14 UTC (rev 33)
@@ -5,6 +5,7 @@
tutti.action.cancel=Annuler
tutti.action.casino-import=Import Casino
tutti.action.catches=Captures
+tutti.action.close=Fermer
tutti.action.configuration=Configuration
tutti.action.configuration.tip=Configurer Tutti
tutti.action.edit=Editer
@@ -12,6 +13,7 @@
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.manageProtocol=Protocole
tutti.action.manageProtocol.tip=Gérer les protocoles
tutti.action.new=Nouveau
@@ -47,7 +49,18 @@
tutti.label.captureAccidentel.sampleTotalWeight=Poids total échantillonné
tutti.label.captureAccidentel.totalWeight=Poids total
tutti.label.comment=Commentaire
-tutti.label.frequencyConfiguration=Mode de saisie
+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"
+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.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.no.configuration=< Pas de configuration >
+tutti.label.frequencyConfiguration.rafaleStep=Classe de taille à incrémenter
+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
@@ -107,6 +120,7 @@
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
tutti.menu.file=Fichier
@@ -121,12 +135,6 @@
tutti.menu.synchronisationImport.tip=Effectuer des imports
tutti.menu.synchronisations=Synchronisation
tutti.menu.synchronisations.tip=Import/Export
-tutti.speciesFrequency.configurationMode.autoGenerate=Génération des classes
-tutti.speciesFrequency.configurationMode.autoGenerate.tip=Mode où toutes les classes de taille sont générées
-tutti.speciesFrequency.configurationMode.rafale=Mode "rafale"
-tutti.speciesFrequency.configurationMode.rafale.tip=Mode où on ne saisit uniquement la classe de taille (les nombres seront alors incrémentés...)
-tutti.speciesFrequency.configurationMode.simple=Mode simple
-tutti.speciesFrequency.configurationMode.simple.tip=Mode par défaut on on doit tout saisir (les classes de tailles et les nombres)
tutti.table.benthos.header.number=Nombre observé
tutti.table.benthos.header.speciesByCode=Espèce
tutti.table.benthos.header.weight=Poids observé
Copied: trunk/tutti-ui-swing/src/main/resources/icons/action-close.png (from rev 32, trunk/tutti-ui-swing/src/main/resources/icons/action-exit.png)
===================================================================
(Binary files differ)
1
0
r32 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing 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/util resources/i18n
by tchemit@users.forge.codelutin.com 06 Dec '12
by tchemit@users.forge.codelutin.com 06 Dec '12
06 Dec '12
Author: tchemit
Date: 2012-12-06 18:43:45 +0100 (Thu, 06 Dec 2012)
New Revision: 32
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/32
Log:
display frequency ui + move ui util class to his natural package
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.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/MainUIHandler.java
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/SpeciesBatchColumnIdentifier.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/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/frequency/SpeciesFrequencyColumnIdentifier.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/SpeciesFrequencyUI.css
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/resources/i18n/tutti-ui-swing_fr_FR.properties
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -31,6 +31,7 @@
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.config.TuttiConfig;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.swing.OneClicListSelectionModel;
import jaxx.runtime.swing.editor.NumberEditor;
import jaxx.runtime.swing.editor.TimeEditor;
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -34,6 +34,7 @@
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.util.TuttiUIUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.AboutPanel;
import jaxx.runtime.swing.ErrorDialogUI;
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-12-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -1,257 +0,0 @@
-package fr.ifremer.tutti.ui.swing;
-
-/*
- * #%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.service.TuttiServiceTechnicalException;
-import fr.ifremer.tutti.ui.swing.util.TuttiColorHighlighter;
-import jaxx.runtime.JAXXUtil;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.decorator.Highlighter;
-import org.nuiton.util.FileUtil;
-
-import javax.swing.Action;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JRootPane;
-import javax.swing.KeyStroke;
-import javax.swing.UIManager;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.File;
-
-/**
- * Created: 14/06/12
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public final class TuttiUIUtil {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(TuttiUIUtil.class);
-
- private TuttiUIUtil() {
- // never instanciate util class
- }
-
- public static JDialog openInDialog(JComponent ui,
- JFrame frame,
- String title,
- Action closeAction) {
- return openInDialog(ui, frame, title, closeAction, null);
- }
-
- public static JDialog openInDialog(JComponent ui,
- JFrame frame,
- String title,
- Action closeAction,
- Dimension dim) {
-
- JDialog result = new JDialog(frame, false);
- result.setTitle(title);
- result.add(ui);
- result.setResizable(true);
- if (dim == null) {
- result.setSize(550, 450);
- } else {
- result.setSize(dim);
- }
- if (closeAction != null) {
- JRootPane rootPane = result.getRootPane();
- rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close");
- rootPane.getActionMap().put("close", closeAction);
- }
- result.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);
- }
- });
- SwingUtil.center(frame, result);
- result.setVisible(true);
- return result;
- }
-
- /**
- * Choisir un fichier via un sélecteur graphique de fichiers.
- *
- * @param parent le component swing appelant le controle
- * @param title le titre du dialogue de sélection
- * @param buttonLabel le label du boutton d'acceptation
- * @param incoming le fichier de base à utilier
- * @param filters les filtres + descriptions sur le sélecteur de
- * fichiers
- * @return le fichier choisi ou le fichier incoming si l'opération a été
- * annulée
- */
- public static File chooseFile(Component parent,
- String title,
- String buttonLabel,
- File incoming,
- String... filters) {
- File oldBasedir = FileUtil.getCurrentDirectory();
- if (incoming != null) {
- File basedir;
- if (incoming.isFile()) {
- basedir = incoming.getParentFile();
- } else {
- basedir = incoming;
- }
- if (basedir.exists()) {
- FileUtil.setCurrentDirectory(basedir);
- }
- }
- File file = FileUtil.getFile(title, buttonLabel, parent, filters);
- if (log.isDebugEnabled()) {
- log.debug(title + " : " + file);
- }
- FileUtil.setCurrentDirectory(oldBasedir);
- File result = file == null ? incoming : file;
- return result;
- }
-
- /**
- * Choisir un répertoire via un sélecteur graphique de fichiers.
- *
- * @param parent le component swing appelant le controle
- * @param title le titre de la boite de dialogue de sléection
- * @param buttonLabel le label de l'action d'acceptation
- * @param incoming le fichier de base à utiliser
- * @return le répertoire choisi ou le répertoire incoming si l'opération a
- * été annulée
- */
- public static File chooseDirectory(Component parent,
- String title,
- String buttonLabel,
- File incoming) {
- File oldBasedir = FileUtil.getCurrentDirectory();
- if (incoming != null) {
- File basedir;
- if (incoming.isFile()) {
- basedir = incoming.getParentFile();
- } else {
- basedir = incoming;
- }
- if (basedir.exists()) {
- FileUtil.setCurrentDirectory(basedir);
- }
- }
- String file = FileUtil.getDirectory(parent, title, buttonLabel);
- if (log.isDebugEnabled()) {
- log.debug(title + " : " + file);
- }
- FileUtil.setCurrentDirectory(oldBasedir);
- return file == null ? incoming : new File(file);
- }
-
- public static void updateBusyState(Component ui, boolean busy) {
- if (busy) {
- // ui bloquee
- if (log.isDebugEnabled()) {
- log.debug("block ui in busy mode");
- }
- ui.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- } else {
- // ui debloquee
- if (log.isDebugEnabled()) {
- log.debug("unblock ui in none busy mode");
- }
- ui.setCursor(Cursor.getDefaultCursor());
- }
- }
-
- public static void showSuccessMessage(Component ui, String message) {
- JOptionPane.showMessageDialog(
- ui,
- message,
- "Success",
- JOptionPane.INFORMATION_MESSAGE,
- UIManager.getIcon("info")
- );
- }
-
- public static void showErrorMessage(Component ui, String message) {
- JOptionPane.showMessageDialog(
- ui,
- message,
- "Error",
- JOptionPane.ERROR_MESSAGE,
- UIManager.getIcon("error")
- );
- }
-
- public static boolean askQuestion(Component ui, String message) {
- int i = JOptionPane.showConfirmDialog(
- ui,
- message,
- "Question?",
- JOptionPane.YES_NO_OPTION);
- return i == JOptionPane.YES_OPTION;
- }
-
- public static void setProperty(Object bean, String property, Object value) {
- Preconditions.checkNotNull(bean);
- Preconditions.checkNotNull(property);
- try {
- PropertyUtils.setSimpleProperty(bean, property, value);
- } catch (Exception e) {
- throw new TuttiServiceTechnicalException("Could not set property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
- }
- }
-
- public static Object getProperty(Object bean, String property) {
- Preconditions.checkNotNull(bean);
- Preconditions.checkNotNull(property);
- try {
- return PropertyUtils.getSimpleProperty(bean, property);
- } catch (Exception e) {
- throw new TuttiServiceTechnicalException("Could not get property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
- }
- }
-
- public static Highlighter newBackgroundColorHighlighter(HighlightPredicate predicate, Color color) {
- return new TuttiColorHighlighter(predicate, color, false);
- }
-
- public static Highlighter newForegroundColorHighlighter(HighlightPredicate predicate, Color color) {
- return new TuttiColorHighlighter(predicate, color, true);
- }
-}
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/FrequencyCellComponent.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -25,6 +25,8 @@
*/
import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -37,11 +39,14 @@
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.
*
@@ -68,8 +73,8 @@
return new FrequencyCellRenderer();
}
- public static TableCellEditor newEditor() {
- return new FrequencyCellEditor();
+ public static TableCellEditor newEditor(SpeciesFrequencyUI ui) {
+ return new FrequencyCellEditor(ui);
}
public static class FrequencyCellEditor extends AbstractCellEditor implements TableCellEditor {
@@ -78,6 +83,10 @@
protected final FrequencyCellComponent component;
+ protected final SpeciesFrequencyUI ui;
+
+ protected Frame frame;
+
protected SpeciesBatchTableModel tableModel;
protected SpeciesBatchColumnIdentifier columnIdentifier;
@@ -86,7 +95,8 @@
protected Integer rowIndex;
- public FrequencyCellEditor() {
+ public FrequencyCellEditor(SpeciesFrequencyUI ui) {
+ this.ui = ui;
component = new FrequencyCellComponent();
component.setBorder(new LineBorder(Color.BLACK));
component.addKeyListener(new KeyAdapter() {
@@ -121,6 +131,15 @@
if (log.isInfoEnabled()) {
log.info("Will edit frequencies for row: " + rowIndex);
}
+
+ if (frame == null) {
+ frame = SwingUtil.getParentContainer(ui, Frame.class);
+ }
+
+ ui.editBatch(editRow);
+
+ TuttiUIUtil.openInDialog(ui, frame, _("tutti.title.frequency"), true, null);
+
}
@Override
Modified: 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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchColumnIdentifier.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier;
import static org.nuiton.i18n.I18n.n_;
Modified: 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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesBatchTreeModel.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -26,7 +26,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import java.io.Serializable;
import java.util.List;
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUI.jaxx 2012-12-06 17:43:45 UTC (rev 32)
@@ -29,6 +29,7 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.content.catches.CatchesUI
+ fr.ifremer.tutti.ui.swing.content.catches.species.frequency.SpeciesFrequencyUI
org.jdesktop.swingx.JXTable
@@ -73,6 +74,8 @@
<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 -->
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/SpeciesTabUIHandler.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -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.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.content.catches.CatchesUI;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import org.apache.commons.logging.Log;
@@ -325,7 +325,7 @@
{ // Poids calculé
addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(),
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
FrequencyCellComponent.newRender(),
SpeciesBatchColumnIdentifier.computedWeight);
}
@@ -333,7 +333,7 @@
{ // Nombre calculé
addColumnToModel(columnModel,
- FrequencyCellComponent.newEditor(),
+ FrequencyCellComponent.newEditor(ui.getFrequencyUI()),
FrequencyCellComponent.newRender(),
SpeciesBatchColumnIdentifier.computedNumber);
}
Modified: 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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyColumnIdentifier.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.table.AbstractColumnIdentifier;
import static org.nuiton.i18n.I18n.n_;
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyTableModel.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -41,7 +41,7 @@
public SpeciesFrequencyTableModel(TableColumnModel columnModel) {
super(columnModel);
- setNoneEditableCols(SpeciesFrequencyColumnIdentifier.weight);
+ setNoneEditableCols(SpeciesFrequencyColumnIdentifier.computedWeight);
}
@Override
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.css 2012-12-06 17:43:45 UTC (rev 32)
@@ -31,9 +31,9 @@
enabled:{model.isModify() && model.isValid()};
}
-#cancelButton {
- actionIcon:"cancel";
- text:"tutti.action.cancel";
+#closeButton {
+ actionIcon:"close";
+ text:"tutti.action.close";
}
#table {
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUI.jaxx 2012-12-06 17:43:45 UTC (rev 32)
@@ -50,7 +50,10 @@
handler.beforeInitUI();
}
- public void editBatch(SpeciesBatchRowModel row) { handler.editBatch(row); }
+ public void editBatch(SpeciesBatchRowModel row) {
+ handler.editBatch(row);
+ }
+
protected void $afterCompleteSetup() {
handler.afterInitUI();
}
@@ -79,8 +82,7 @@
<!-- actions -->
<JPanel id='actionPanel' layout='{new GridLayout(1, 0)}'
constraints='BorderLayout.SOUTH'>
- <JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
- <JButton id='saveButton' onActionPerformed='handler.save()'/>
+ <JButton id='close' onActionPerformed='handler.close()'/>
</JPanel>
</JPanel>
\ No newline at end of file
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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/catches/species/frequency/SpeciesFrequencyUIHandler.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -24,18 +24,19 @@
* #L%
*/
-import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUI;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.content.catches.species.SpeciesBatchRowModel;
+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 javax.swing.JDialog;
import javax.swing.table.TableColumnModel;
import java.awt.Color;
@@ -51,8 +52,6 @@
private final SpeciesFrequencyUI ui;
- private final PersistenceService persistenceService;
-
public SpeciesFrequencyUIHandler(TuttiUIContext context,
SpeciesFrequencyUI ui) {
super(context,
@@ -61,7 +60,6 @@
SpeciesFrequencyRowModel.PROPERTY_WEIGHT,
SpeciesFrequencyRowModel.PROPERTY_COMPUTED_WEIGHT);
this.ui = ui;
- persistenceService = context.getService(PersistenceService.class);
}
@Override
@@ -131,20 +129,15 @@
getModel().fromBean(row);
}
- public void cancel() {
- if (log.isInfoEnabled()) {
- log.info("Will cancel");
- }
- }
+ public void close() {
- public void save() {
-
if (log.isInfoEnabled()) {
- log.info("Will save");
+ log.info("Will close UI " + ui);
}
- SpeciesFrequencyUIModel model = getModel();
+ ui.editBatch(null);
+ SwingUtil.getParentContainer(ui, JDialog.class).setVisible(false);
}
@Override
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java (from rev 29, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIUtil.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java 2012-12-06 17:43:45 UTC (rev 32)
@@ -0,0 +1,258 @@
+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 com.google.common.base.Preconditions;
+import fr.ifremer.tutti.service.TuttiServiceTechnicalException;
+import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+import org.nuiton.util.FileUtil;
+
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.JRootPane;
+import javax.swing.KeyStroke;
+import javax.swing.UIManager;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.File;
+
+/**
+ * Created: 14/06/12
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public final class TuttiUIUtil {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(TuttiUIUtil.class);
+
+ private TuttiUIUtil() {
+ // never instanciate util class
+ }
+
+ public static JDialog openInDialog(JComponent ui,
+ Frame frame,
+ String title,
+ boolean modal,
+ Action closeAction) {
+ return openInDialog(ui, frame, title, modal, closeAction, null);
+ }
+
+ public static JDialog openInDialog(JComponent ui,
+ Frame frame,
+ String title,
+ boolean modal,
+ Action closeAction,
+ Dimension dim) {
+
+ JDialog result = new JDialog(frame, modal);
+ result.setTitle(title);
+ result.add(ui);
+ result.setResizable(true);
+ if (dim == null) {
+ result.setSize(550, 450);
+ } else {
+ result.setSize(dim);
+ }
+ if (closeAction != null) {
+ JRootPane rootPane = result.getRootPane();
+ rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close");
+ rootPane.getActionMap().put("close", closeAction);
+ }
+ result.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);
+ }
+ });
+ SwingUtil.center(frame, result);
+ result.setVisible(true);
+ return result;
+ }
+
+ /**
+ * Choisir un fichier via un sélecteur graphique de fichiers.
+ *
+ * @param parent le component swing appelant le controle
+ * @param title le titre du dialogue de sélection
+ * @param buttonLabel le label du boutton d'acceptation
+ * @param incoming le fichier de base à utilier
+ * @param filters les filtres + descriptions sur le sélecteur de
+ * fichiers
+ * @return le fichier choisi ou le fichier incoming si l'opération a été
+ * annulée
+ */
+ public static File chooseFile(Component parent,
+ String title,
+ String buttonLabel,
+ File incoming,
+ String... filters) {
+ File oldBasedir = FileUtil.getCurrentDirectory();
+ if (incoming != null) {
+ File basedir;
+ if (incoming.isFile()) {
+ basedir = incoming.getParentFile();
+ } else {
+ basedir = incoming;
+ }
+ if (basedir.exists()) {
+ FileUtil.setCurrentDirectory(basedir);
+ }
+ }
+ File file = FileUtil.getFile(title, buttonLabel, parent, filters);
+ if (log.isDebugEnabled()) {
+ log.debug(title + " : " + file);
+ }
+ FileUtil.setCurrentDirectory(oldBasedir);
+ File result = file == null ? incoming : file;
+ return result;
+ }
+
+ /**
+ * Choisir un répertoire via un sélecteur graphique de fichiers.
+ *
+ * @param parent le component swing appelant le controle
+ * @param title le titre de la boite de dialogue de sléection
+ * @param buttonLabel le label de l'action d'acceptation
+ * @param incoming le fichier de base à utiliser
+ * @return le répertoire choisi ou le répertoire incoming si l'opération a
+ * été annulée
+ */
+ public static File chooseDirectory(Component parent,
+ String title,
+ String buttonLabel,
+ File incoming) {
+ File oldBasedir = FileUtil.getCurrentDirectory();
+ if (incoming != null) {
+ File basedir;
+ if (incoming.isFile()) {
+ basedir = incoming.getParentFile();
+ } else {
+ basedir = incoming;
+ }
+ if (basedir.exists()) {
+ FileUtil.setCurrentDirectory(basedir);
+ }
+ }
+ String file = FileUtil.getDirectory(parent, title, buttonLabel);
+ if (log.isDebugEnabled()) {
+ log.debug(title + " : " + file);
+ }
+ FileUtil.setCurrentDirectory(oldBasedir);
+ return file == null ? incoming : new File(file);
+ }
+
+ public static void updateBusyState(Component ui, boolean busy) {
+ if (busy) {
+ // ui bloquee
+ if (log.isDebugEnabled()) {
+ log.debug("block ui in busy mode");
+ }
+ ui.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ } else {
+ // ui debloquee
+ if (log.isDebugEnabled()) {
+ log.debug("unblock ui in none busy mode");
+ }
+ ui.setCursor(Cursor.getDefaultCursor());
+ }
+ }
+
+ public static void showSuccessMessage(Component ui, String message) {
+ JOptionPane.showMessageDialog(
+ ui,
+ message,
+ "Success",
+ JOptionPane.INFORMATION_MESSAGE,
+ UIManager.getIcon("info")
+ );
+ }
+
+ public static void showErrorMessage(Component ui, String message) {
+ JOptionPane.showMessageDialog(
+ ui,
+ message,
+ "Error",
+ JOptionPane.ERROR_MESSAGE,
+ UIManager.getIcon("error")
+ );
+ }
+
+ public static boolean askQuestion(Component ui, String message) {
+ int i = JOptionPane.showConfirmDialog(
+ ui,
+ message,
+ "Question?",
+ JOptionPane.YES_NO_OPTION);
+ return i == JOptionPane.YES_OPTION;
+ }
+
+ public static void setProperty(Object bean, String property, Object value) {
+ Preconditions.checkNotNull(bean);
+ Preconditions.checkNotNull(property);
+ try {
+ PropertyUtils.setSimpleProperty(bean, property, value);
+ } catch (Exception e) {
+ throw new TuttiServiceTechnicalException("Could not set property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
+ }
+ }
+
+ public static Object getProperty(Object bean, String property) {
+ Preconditions.checkNotNull(bean);
+ Preconditions.checkNotNull(property);
+ try {
+ return PropertyUtils.getSimpleProperty(bean, property);
+ } catch (Exception e) {
+ throw new TuttiServiceTechnicalException("Could not get property '" + property + "' on object of type '" + bean.getClass().getName() + "'", e);
+ }
+ }
+
+ public static Highlighter newBackgroundColorHighlighter(HighlightPredicate predicate, Color color) {
+ return new TuttiColorHighlighter(predicate, color, false);
+ }
+
+ public static Highlighter newForegroundColorHighlighter(HighlightPredicate predicate, Color color) {
+ return new TuttiColorHighlighter(predicate, color, true);
+ }
+}
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.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-06 17:16:09 UTC (rev 31)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2012-12-06 17:43:45 UTC (rev 32)
@@ -164,6 +164,7 @@
tutti.title.edit.campaign=Editer une campagne existante
tutti.title.edit.survey=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.noSelectedCampaign=Pas de campagne sélectionné
tutti.title.noSelectedSurvey=Pas de série de campagne sélectionné
1
0