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
- 4058 discussions
Author: tchemit
Date: 2013-11-26 15:57:55 +0100 (Tue, 26 Nov 2013)
New Revision: 1393
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1393
Log:
keep a backup, you never know...
Added:
branches/tutti-before-ifremer-shared/
Removed:
trunk/
1
0
r1392 - in branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation: . catches catches/accidental catches/benthos catches/individualobservation catches/marinelitter catches/species
by tchemit@users.forge.codelutin.com 26 Nov '13
by tchemit@users.forge.codelutin.com 26 Nov '13
26 Nov '13
Author: tchemit
Date: 2013-11-26 15:56:35 +0100 (Tue, 26 Nov 2013)
New Revision: 1392
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1392
Log:
move some classes
Added:
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractTuttiBatchTableUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractTuttiBatchUIModel.java
Removed:
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java
Modified:
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -1,154 +0,0 @@
-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.ui.swing.util.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
-import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.ComponentAdapter;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.decorator.Highlighter;
-import org.jdesktop.swingx.sort.TableSortController;
-import org.jdesktop.swingx.table.TableColumnModelExt;
-
-import javax.swing.table.TableModel;
-import java.awt.Color;
-import java.awt.Component;
-import java.util.Collection;
-
-/**
- * Abstract ui handler forbatch ui.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public abstract class AbstractTuttiBatchTableUIHandler<R extends AbstractTuttiBeanUIModel, M extends AbstractTuttiBatchUIModel<R, M>, T extends AbstractApplicationTableModel<R>, UI extends TuttiUI<M, ?>> extends AbstractTuttiTableUIHandler<R, M, UI> {
-
- protected abstract ColumnIdentifier<R> getCommentIdentifier();
-
- protected abstract ColumnIdentifier<R> getAttachementIdentifier();
-
- public abstract void selectFishingOperation(FishingOperation bean);
-
- protected AbstractTuttiBatchTableUIHandler(TuttiUI<?, ?> parentUi,
- UI ui,
- String... properties) {
- super(parentUi.getHandler().getContext(), ui, properties);
- }
-
- /**
- * To clear the table selection.
- * <p/>
- * This method is invoked before changing the fishing operation.
- *
- * @since 0.3
- */
- public final void clearTableSelection() {
-
- JXTable table = getTable();
-
- if (table.isEditing()) {
-
- // make sure to stop editor
- table.editingCanceled(null);
- }
-
- // make sure selection is empty (will remove bean from monitor)
- table.clearSelection();
- }
-
- @Override
- protected void onRowModified(int rowIndex,
- R row,
- String propertyName,
- Object oldValue,
- Object newValue) {
- recomputeRowValidState(row);
-
- saveSelectedRowIfNeeded();
- }
-
- protected void initBatchTable(JXTable table,
- TableColumnModelExt columnModel,
- T tableModel) {
-
- installTableKeyListener(columnModel, table);
-
- TableSortController<TableModel> sorter = new TableSortController<TableModel>(tableModel);
- sorter.setSortable(false);
- table.setRowSorter(sorter);
-
- initTable(table);
- }
-
- @Override
- protected void addHighlighters(final JXTable table) {
- super.addHighlighters(table);
- addCommentHighlighter(table, getCommentIdentifier());
- addAttachementHighlighter(table, getAttachementIdentifier());
- }
-
- protected void addCommentHighlighter(JXTable table, ColumnIdentifier identifier) {
- Color cellWithValueColor = getConfig().getColorCellWithValue();
-
- Highlighter commentHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
- new HighlightPredicate.AndHighlightPredicate(
- new HighlightPredicate.IdentifierHighlightPredicate(identifier),
- // for not null value
- new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
- String value = (String) adapter.getValue();
- return StringUtils.isNotBlank(value);
- }
- }), cellWithValueColor);
- table.addHighlighter(commentHighlighter);
- }
-
- protected void addAttachementHighlighter(JXTable table, ColumnIdentifier identifier) {
- Color cellWithValueColor = getConfig().getColorCellWithValue();
-
- Highlighter attachmentHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
- new HighlightPredicate.AndHighlightPredicate(
- new HighlightPredicate.IdentifierHighlightPredicate(identifier),
- // for not null value
- new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
- Collection attachments = (Collection) adapter.getValue();
- return CollectionUtils.isNotEmpty(attachments);
- }
- }
- ), cellWithValueColor);
- table.addHighlighter(attachmentHighlighter);
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -1,90 +0,0 @@
-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 com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Set;
-
-/**
- * Abstract model for ui in batch tabs.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public abstract class AbstractTuttiBatchUIModel<R extends AbstractTuttiBeanUIModel, B extends AbstractTuttiBatchUIModel<R, B>> extends AbstractTuttiTableUIModel<FishingOperation, R, B> {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Fishing Operation to prapagate to operations model.
- *
- * @since 0.3
- */
- protected final Set<String> propagateProperties;
-
- /**
- * Editing fishing operations model.
- *
- * @since 0.3
- */
- protected final EditCatchesUIModel catchesUIModel;
-
- protected AbstractTuttiBatchUIModel(EditCatchesUIModel catchesUIModel,
- String... properties) {
- super(FishingOperation.class, null, null);
- this.catchesUIModel = catchesUIModel;
- propagateProperties = Sets.newHashSet(properties);
- catchesUIModel.addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (propagateProperties.contains(evt.getPropertyName())) {
- firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
- }
- }
- });
- }
-
- public final FishingOperation getFishingOperation() {
- return catchesUIModel == null ? null : catchesUIModel.getFishingOperation();
- }
-
- @Override
- protected FishingOperation newEntity() {
- return null;
- }
-
- public void fireBatchUpdated(R row) {
- if (catchesUIModel != null) {
- catchesUIModel.firePropertyChanged(EditCatchesUIModel.PROPERTY_BATCH_UPDATED, null, row);
- }
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2013-11-26 14:56:35 UTC (rev 1392)
@@ -410,7 +410,7 @@
propertyDegree: gearShootingStartLongitudeDmsDegree;
propertyMinute: gearShootingStartLongitudeDmsMinute;
propertySecond: gearShootingStartLongitudeDmsSecond;
- longitudeEditor: true;
+ _longitudeEditor: {true};
value: {model.getGearShootingStartLongitudeDms()};
showResetTip: "tutti.coordinate.action.reset.longitude.tip";
_validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLongitude")};
@@ -421,7 +421,7 @@
propertyDegree: gearShootingStartLongitudeDmdDegree;
propertyMinute: gearShootingStartLongitudeDmdMinute;
propertyDecimal: gearShootingStartLongitudeDmdDecimal;
- longitudeEditor: true;
+ _longitudeEditor: {true};
value: {model.getGearShootingStartLongitudeDmd()};
showResetTip: "tutti.coordinate.action.reset.longitude.tip";
_validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLongitude")};
@@ -490,7 +490,7 @@
propertyDegree: gearShootingEndLongitudeDmsDegree;
propertyMinute: gearShootingEndLongitudeDmsMinute;
propertySecond: gearShootingEndLongitudeDmsSecond;
- longitudeEditor: true;
+ _longitudeEditor: {true};
value: {model.getGearShootingEndLongitudeDms()};
showResetTip: "tutti.coordinate.action.reset.longitude.tip";
_validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLongitude")};
@@ -501,7 +501,7 @@
propertyDegree: gearShootingEndLongitudeDmdDegree;
propertyMinute: gearShootingEndLongitudeDmdMinute;
propertyDecimal: gearShootingEndLongitudeDmdDecimal;
- longitudeEditor: true;
+ _longitudeEditor: {true};
value: {model.getGearShootingEndLongitudeDmd()};
showResetTip: "tutti.coordinate.action.reset.longitude.tip";
_validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLongitude")};
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -595,7 +595,7 @@
DmsCoordinate position =
DmsCoordinate.valueOf(decimal);
setGearShootingEndLatitudeDmsSign(position.isSign());
- setGearShootingEndLatitudeDmdDegree(position.getDegree());
+ setGearShootingEndLatitudeDmsDegree(position.getDegree());
setGearShootingEndLatitudeDmsMinute(position.getMinute());
setGearShootingEndLatitudeDmsSecond(position.getSecond());
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMS, null, getGearShootingEndLatitudeDms());
@@ -892,10 +892,6 @@
setGearShootingEndLongitudeDmd(getGearShootingEndLongitude());
break;
}
-
-// quadrant = GeoPositionHelper.getQuadrant(
-// getGearShootingStartLongitude(),
-// getGearShootingStartLatitude());
}
public void convertGearShootingCoordinatesToDD() {
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractTuttiBatchTableUIHandler.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractTuttiBatchTableUIHandler.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractTuttiBatchTableUIHandler.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -0,0 +1,154 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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.ui.swing.util.AbstractTuttiBeanUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+import org.jdesktop.swingx.sort.TableSortController;
+import org.jdesktop.swingx.table.TableColumnModelExt;
+
+import javax.swing.table.TableModel;
+import java.awt.Color;
+import java.awt.Component;
+import java.util.Collection;
+
+/**
+ * Abstract ui handler forbatch ui.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public abstract class AbstractTuttiBatchTableUIHandler<R extends AbstractTuttiBeanUIModel, M extends AbstractTuttiBatchUIModel<R, M>, T extends AbstractApplicationTableModel<R>, UI extends TuttiUI<M, ?>> extends AbstractTuttiTableUIHandler<R, M, UI> {
+
+ protected abstract ColumnIdentifier<R> getCommentIdentifier();
+
+ protected abstract ColumnIdentifier<R> getAttachementIdentifier();
+
+ public abstract void selectFishingOperation(FishingOperation bean);
+
+ protected AbstractTuttiBatchTableUIHandler(TuttiUI<?, ?> parentUi,
+ UI ui,
+ String... properties) {
+ super(parentUi.getHandler().getContext(), ui, properties);
+ }
+
+ /**
+ * To clear the table selection.
+ * <p/>
+ * This method is invoked before changing the fishing operation.
+ *
+ * @since 0.3
+ */
+ public final void clearTableSelection() {
+
+ JXTable table = getTable();
+
+ if (table.isEditing()) {
+
+ // make sure to stop editor
+ table.editingCanceled(null);
+ }
+
+ // make sure selection is empty (will remove bean from monitor)
+ table.clearSelection();
+ }
+
+ @Override
+ protected void onRowModified(int rowIndex,
+ R row,
+ String propertyName,
+ Object oldValue,
+ Object newValue) {
+ recomputeRowValidState(row);
+
+ saveSelectedRowIfNeeded();
+ }
+
+ protected void initBatchTable(JXTable table,
+ TableColumnModelExt columnModel,
+ T tableModel) {
+
+ installTableKeyListener(columnModel, table);
+
+ TableSortController<TableModel> sorter = new TableSortController<TableModel>(tableModel);
+ sorter.setSortable(false);
+ table.setRowSorter(sorter);
+
+ initTable(table);
+ }
+
+ @Override
+ protected void addHighlighters(final JXTable table) {
+ super.addHighlighters(table);
+ addCommentHighlighter(table, getCommentIdentifier());
+ addAttachementHighlighter(table, getAttachementIdentifier());
+ }
+
+ protected void addCommentHighlighter(JXTable table, ColumnIdentifier identifier) {
+ Color cellWithValueColor = getConfig().getColorCellWithValue();
+
+ Highlighter commentHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ new HighlightPredicate.AndHighlightPredicate(
+ new HighlightPredicate.IdentifierHighlightPredicate(identifier),
+ // for not null value
+ new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+ String value = (String) adapter.getValue();
+ return StringUtils.isNotBlank(value);
+ }
+ }), cellWithValueColor);
+ table.addHighlighter(commentHighlighter);
+ }
+
+ protected void addAttachementHighlighter(JXTable table, ColumnIdentifier identifier) {
+ Color cellWithValueColor = getConfig().getColorCellWithValue();
+
+ Highlighter attachmentHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ new HighlightPredicate.AndHighlightPredicate(
+ new HighlightPredicate.IdentifierHighlightPredicate(identifier),
+ // for not null value
+ new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+ Collection attachments = (Collection) adapter.getValue();
+ return CollectionUtils.isNotEmpty(attachments);
+ }
+ }
+ ), cellWithValueColor);
+ table.addHighlighter(attachmentHighlighter);
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractTuttiBatchUIModel.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractTuttiBatchUIModel.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractTuttiBatchUIModel.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -0,0 +1,89 @@
+package fr.ifremer.tutti.ui.swing.content.operation.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 com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Set;
+
+/**
+ * Abstract model for ui in batch tabs.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public abstract class AbstractTuttiBatchUIModel<R extends AbstractTuttiBeanUIModel, B extends AbstractTuttiBatchUIModel<R, B>> extends AbstractTuttiTableUIModel<FishingOperation, R, B> {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Fishing Operation to prapagate to operations model.
+ *
+ * @since 0.3
+ */
+ protected final Set<String> propagateProperties;
+
+ /**
+ * Editing fishing operations model.
+ *
+ * @since 0.3
+ */
+ protected final EditCatchesUIModel catchesUIModel;
+
+ protected AbstractTuttiBatchUIModel(EditCatchesUIModel catchesUIModel,
+ String... properties) {
+ super(FishingOperation.class, null, null);
+ this.catchesUIModel = catchesUIModel;
+ propagateProperties = Sets.newHashSet(properties);
+ catchesUIModel.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (propagateProperties.contains(evt.getPropertyName())) {
+ firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
+ }
+ }
+ });
+ }
+
+ public final FishingOperation getFishingOperation() {
+ return catchesUIModel == null ? null : catchesUIModel.getFishingOperation();
+ }
+
+ @Override
+ protected FishingOperation newEntity() {
+ return null;
+ }
+
+ public void fireBatchUpdated(R row) {
+ if (catchesUIModel != null) {
+ catchesUIModel.firePropertyChanged(EditCatchesUIModel.PROPERTY_BATCH_UPDATED, null, row);
+ }
+ }
+}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -36,7 +36,7 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.ValidationService;
import fr.ifremer.shared.application.type.WeightUnit;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.shared.application.swing.tab.TabContentModel;
import org.apache.commons.collections.CollectionUtils;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -46,7 +46,7 @@
import fr.ifremer.tutti.service.TuttiDecorator;
import fr.ifremer.tutti.service.ValidationService;
import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -27,7 +27,7 @@
import com.google.common.collect.Multimap;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode;
import fr.ifremer.shared.application.swing.tab.TabContentModel;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIHandler.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIHandler.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -36,7 +36,7 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.ValidationService;
import fr.ifremer.shared.application.type.WeightUnit;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIModel.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIModel.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -26,7 +26,7 @@
import com.google.common.collect.Sets;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.shared.application.swing.tab.TabContentModel;
import org.apache.commons.collections.CollectionUtils;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -35,7 +35,7 @@
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.service.ValidationService;
import fr.ifremer.shared.application.type.WeightUnit;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -26,7 +26,7 @@
import com.google.common.collect.Multimap;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.shared.application.swing.tab.TabContentModel;
import fr.ifremer.shared.application.swing.computable.ComputableData;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -45,7 +45,7 @@
import fr.ifremer.tutti.service.ValidationService;
import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-11-26 14:56:06 UTC (rev 1391)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-11-26 14:56:35 UTC (rev 1392)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyRowModel;
1
0
r1391 - branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action
by tchemit@users.forge.codelutin.com 26 Nov '13
by tchemit@users.forge.codelutin.com 26 Nov '13
26 Nov '13
Author: tchemit
Date: 2013-11-26 15:56:06 +0100 (Tue, 26 Nov 2013)
New Revision: 1391
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1391
Log:
fixes #3853: [CAPTURE] si on fait l'?\195?\169l?\195?\169vation des poids dans l'onglet r?\195?\169sum?\195?\169 le focus se met sur le champ poids total capture donc la valeur ne s'affiche pas
Modified:
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java 2013-11-26 14:51:38 UTC (rev 1390)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java 2013-11-26 14:56:06 UTC (rev 1391)
@@ -48,6 +48,7 @@
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
import java.util.List;
import static org.nuiton.i18n.I18n._;
@@ -261,6 +262,15 @@
super.postSuccessAction();
getUI().repaint();
+ // see http://forge.codelutin.com/issues/3853
+ SwingUtilities.invokeLater(
+ new Runnable() {
+ @Override
+ public void run() {
+ getUI().getComputeSpeciesBatchButton().requestFocus();
+ }
+ }
+ );
}
//------------------------------------------------------------------------//
1
0
r1390 - application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing
by tchemit@users.forge.codelutin.com 26 Nov '13
by tchemit@users.forge.codelutin.com 26 Nov '13
26 Nov '13
Author: tchemit
Date: 2013-11-26 15:51:38 +0100 (Tue, 26 Nov 2013)
New Revision: 1390
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1390
Log:
init coordinate editors
Modified:
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/AbstractApplicationUIHandler.java
Modified: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/AbstractApplicationUIHandler.java
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/AbstractApplicationUIHandler.java 2013-11-26 14:22:59 UTC (rev 1389)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/AbstractApplicationUIHandler.java 2013-11-26 14:51:38 UTC (rev 1390)
@@ -738,11 +738,15 @@
}
protected void initCoordinateDMSEditor(DmsCoordinateEditor editor) {
- editor.init();
+ Object property = editor.getClientProperty("longitudeEditor");
+ boolean longitudeEditor = property != null && Boolean.valueOf(property.toString());
+ editor.init(longitudeEditor);
}
protected void initCoordinateDMDEditor(DmdCoordinateEditor editor) {
- editor.init();
+ Object property = editor.getClientProperty("longitudeEditor");
+ boolean longitudeEditor = property != null && Boolean.valueOf(property.toString());
+ editor.init(longitudeEditor);
}
protected void initDatePicker(final JXDatePicker picker) {
1
0
r1389 - branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action
by tchemit@users.forge.codelutin.com 26 Nov '13
by tchemit@users.forge.codelutin.com 26 Nov '13
26 Nov '13
Author: tchemit
Date: 2013-11-26 15:22:59 +0100 (Tue, 26 Nov 2013)
New Revision: 1389
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1389
Log:
fixes #3854: [CAMPAGNE] erreur null au moment d'enregistrer
Modified:
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCruiseAction.java
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCruiseAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCruiseAction.java 2013-11-26 14:22:59 UTC (rev 1389)
@@ -70,8 +70,8 @@
if (!TuttiEntities.isNew(bean)) {
Cruise oldCruise = persistenceService.getCruise(bean.getId());
- // check gear has not changed
- if (!oldCruise.getVessel().equals(bean.getVessel())) {
+ // check vessel has not changed
+ if (ObjectUtils.notEqual(oldCruise.getVessel(), bean.getVessel())) {
// if so ask user confirmation
String htmlMessage = String.format(
1
0
26 Nov '13
Author: tchemit
Date: 2013-11-26 09:03:42 +0100 (Tue, 26 Nov 2013)
New Revision: 1388
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1388
Log:
utilisation derni?\195?\168re api ifremer-shared + un seul paquetage pour toutes les actions
Added:
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractChangeLocaleAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractChangeScreenAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractExportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractImportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractMainUITuttiAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractTuttiAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AddBenthosProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AddSpeciesProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CancelEditCatchBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CancelEditFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ChangeToLocaleFRAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ChangeToLocaleUKAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CleanBatchWeightsAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloneProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloseApplicationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloseDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CreateBenthosMelagAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CreateSpeciesMelagAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/DeleteFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/DeleteProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCatchesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCruiseFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditGearCaracteristicsAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditProgramAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSampleCategoryModelAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedCruiseCatchesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedProgramAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAccidentalMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAllCaracteristicAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAndCleanDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportBenthosMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseValidationMessagesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportIndividualObservationMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportMarineLitterMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportOperationValidationMessagesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProgramAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolBenthosAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolCaracteristicAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolSpeciesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportPupitriAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportSpeciesMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryGearExampleAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryPersonExampleAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporarySpeciesExampleAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryVesselExampleAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/GenerateReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/GoToPreviousScreenAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportAccidentalMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportBenthosMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportCasinoAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportIndividualObservationMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportMarineLitterMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportOrReimportDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolBenthosAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolCaracteristicAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolSpeciesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportPupitriAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportSpeciesMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryGearAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryPersonAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryReferentialAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporarySpeciesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryVesselAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/InstallDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/InstallOrReinstallDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ManageDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewProgramAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/OpenDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReimportDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReinstallDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReloadTuttiAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveAccidentalBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveAllIndividualObservationBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosSubBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveIndividualObservationBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveMarineLitterBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesSubBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RenameBenthosBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RenameSpeciesBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCatchBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveProgramAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveSampleCategoryModelAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectOtherBenthosAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectOtherSpeciesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForBenthosBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForIndividualObservationBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForSpeciesBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SendCruiseReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowAboutAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowConfigAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/StartAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateApplicationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ValidateCatchesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ValidateSelectedCruiseCatchesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ViewGearCaracteristicsAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicValueEditor.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicValueRenderer.java
Removed:
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/PropagatePropertyChangeListener.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeLocaleAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeScreenAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractMainUITuttiAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ChangeToLocaleFRAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ChangeToLocaleUKAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/CloseApplicationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSampleCategoryModelAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedCruiseCatchesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedProgramAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/GoToPreviousScreenAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ImportTemporaryReferentialAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ManageDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ReloadTuttiAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/SelectCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowAboutAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowConfigAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/StartAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateApplicationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ValidateSelectedCruiseCatchesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/SaveSampleCategoryModelAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditGearCaracteristicsAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ExportCruiseValidationMessagesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ExportOperationValidationMessagesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/SaveCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ViewGearCaracteristicsAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/CloseDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ExportAndCleanDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ExportDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportOrReimportDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallOrReinstallDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/OpenDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReimportDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReinstallDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/DeleteProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProgramAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseForSumatraAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProgramAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ValidateCatchesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/CancelEditFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/DeleteFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/ImportCasinoAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/NewFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/SaveFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractExportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CancelEditCatchBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CleanBatchWeightsAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeBatchWeightsAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ExportFishingOperationForSumatraAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ExportFishingOperationReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SaveCatchBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ExportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ImportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/RemoveAccidentalBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/CreateBenthosMelagAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ExportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ImportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosSubBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RenameBenthosBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/SelectSpeciesForBenthosBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ExportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ImportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/RemoveAllIndividualObservationBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/RemoveIndividualObservationBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/SelectSpeciesForIndividualObservationBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ExportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ImportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/RemoveMarineLitterBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateSpeciesMelagAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ExportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesSubBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RenameSpeciesBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/SelectSpeciesForSpeciesBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/SaveProgramAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddBenthosProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddSpeciesProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportAllCaracteristicAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolBenthosAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolCaracteristicAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolBenthosAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolCaracteristicAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolSpeciesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveBenthosProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveSpeciesProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SaveProtocolAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherBenthosAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherSpeciesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryGearExampleAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryPersonExampleAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporarySpeciesExampleAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryVesselExampleAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryGearAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryPersonAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporarySpeciesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryVesselAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/GenerateReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ActionListCellRenderer.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/Cancelable.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/CustomTab.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabContentModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiComputedOrNotData.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueEditor.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueRenderer.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditor.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditorHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataTableCell.java
Modified:
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/RunTutti.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiActionFactory.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiReportUpdaterCallBack.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTabUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTabUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ManageTemporaryReferentialUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiBeanUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiExceptionHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/SaveAttachmentAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
Deleted: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/PropagatePropertyChangeListener.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/PropagatePropertyChangeListener.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/PropagatePropertyChangeListener.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,80 +0,0 @@
-package fr.ifremer.tutti;
-
-/*
- * #%L
- * Tutti :: Persistence
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import org.jdesktop.beans.AbstractBean;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-/**
- * To listen a bean and propagate some of properties.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.3
- */
-public class PropagatePropertyChangeListener implements PropertyChangeListener {
-
- public static interface PropagatePropertyChange {
- void firePropertyChanged(String propertyName,
- Object oldValue,
- Object newValue);
- }
-
- public static void listenAndPropagate(AbstractBean producer,
- PropagatePropertyChange consumer,
- String propertyNameToListen,
- String propertyNameToForward) {
- PropagatePropertyChangeListener listener =
- new PropagatePropertyChangeListener(propertyNameToForward,
- consumer);
- producer.addPropertyChangeListener(propertyNameToListen, listener);
- }
-
- public static void listenAndPropagateAll(AbstractBean producer,
- PropagatePropertyChange consumer) {
- PropagatePropertyChangeListener listener =
- new PropagatePropertyChangeListener(null, consumer);
- producer.addPropertyChangeListener(listener);
- }
-
- private String propertyName;
-
- private PropagatePropertyChange editor;
-
- public PropagatePropertyChangeListener(String propertyName,
- PropagatePropertyChange editor) {
- this.propertyName = propertyName;
- this.editor = editor;
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- String name = propertyName == null ? evt.getPropertyName() : propertyName;
- editor.firePropertyChanged(name,
- evt.getOldValue(),
- evt.getNewValue());
- }
-}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -559,6 +559,7 @@
return applicationConfig.getOptionAsColor(TuttiConfigurationOption.COLOR_SELECTED_ROW.getKey());
}
+ @Override
public KeyStroke getShortcutClosePopup() {
return applicationConfig.getOptionAsKeyStroke(TuttiConfigurationOption.SHORTCUT_CLOSE_POPUP.getKey());
}
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1463,7 +1463,7 @@
tutti.persistence.cruise.gearUsedInOperations.error=Vous essayez d'enlever un ou plusieurs engins qui sont utilisés sur des traits.<hr/>Veuillez changer l'engin des traits en question pour pouvoir les enlever de la campagne.
tutti.persistence.dbMetadata.instanciation.error=Erreur lors de l'initialisation des metadata de la base de données par la connexion %s
tutti.persistence.error.caracteristic.notFound=Caractéristique inconnue
-tutti.persistence.error.no.convertor=Impossible de convertir en modeèle de catégorie le type %s avec la valeur %s
+tutti.persistence.error.no.convertor=Impossible de convertir en modèle de catégorie le type %s avec la valeur %s
tutti.persistence.error.protocol.categories.not.compatible=Le protocole utilise des catégories non connues par la configuration des catégorisations \: <ul>%s</ul>
tutti.persistence.loader.error=Erreur de conversion du dossier %s en URL
tutti.persistence.protocol.delete.error=Erreur lors de la suppression du protocole %1s (fichier %2s)
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/RunTutti.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/RunTutti.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/RunTutti.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -25,11 +25,11 @@
*/
import fr.ifremer.tutti.TuttiConfiguration;
+import fr.ifremer.tutti.ui.swing.action.StartAction;
+import fr.ifremer.tutti.ui.swing.action.UpdateApplicationAction;
+import fr.ifremer.tutti.ui.swing.action.UpdateReportAction;
import fr.ifremer.tutti.ui.swing.content.MainUI;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import fr.ifremer.tutti.ui.swing.content.StartAction;
-import fr.ifremer.tutti.ui.swing.content.UpdateApplicationAction;
-import fr.ifremer.tutti.ui.swing.content.UpdateReportAction;
import fr.ifremer.tutti.ui.swing.util.TuttiExceptionHandler;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiActionFactory.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiActionFactory.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiActionFactory.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -4,7 +4,7 @@
import fr.ifremer.shared.application.swing.AbstractApplicationUIHandler;
import fr.ifremer.shared.application.swing.action.AbstractApplicationAction;
import fr.ifremer.shared.application.swing.action.ApplicationActionFactory;
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
+import fr.ifremer.tutti.ui.swing.action.AbstractMainUITuttiAction;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import org.apache.commons.lang3.reflect.ConstructorUtils;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -32,7 +32,7 @@
import fr.ifremer.tutti.LabelAware;
import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import fr.ifremer.tutti.ui.swing.action.AbstractTuttiAction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.updater.ApplicationInfo;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -34,7 +34,7 @@
import fr.ifremer.tutti.persistence.service.synchro.ReferentialSynchronizeResult;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.referential.TuttiReferentialSynchronizeService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import fr.ifremer.tutti.ui.swing.action.AbstractTuttiAction;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiReportUpdaterCallBack.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiReportUpdaterCallBack.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiReportUpdaterCallBack.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -27,7 +27,7 @@
import com.google.common.collect.Maps;
import fr.ifremer.shared.application.swing.action.ApplicationActionException;
import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import fr.ifremer.tutti.ui.swing.action.AbstractTuttiAction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.updater.ApplicationInfo;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -36,7 +36,7 @@
import fr.ifremer.shared.application.swing.action.ApplicationActionFactory;
import fr.ifremer.shared.application.swing.action.ApplicationActionUI;
import fr.ifremer.shared.application.swing.util.ApplicationErrorHelper;
-import fr.ifremer.tutti.PropagatePropertyChangeListener;
+import fr.ifremer.shared.application.listener.PropagatePropertyChangeListener;
import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.service.ClosedPersistenceService;
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractChangeLocaleAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeLocaleAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractChangeLocaleAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractChangeLocaleAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,51 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+import java.util.Locale;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0.3
+ */
+public abstract class AbstractChangeLocaleAction extends AbstractChangeScreenAction {
+
+
+ protected AbstractChangeLocaleAction(MainUIHandler handler) {
+ super(handler, true, null);
+ }
+
+ protected abstract Locale getLocale();
+
+ @Override
+ public void doAction() throws Exception {
+
+ getHandler().changeLocale(getLocale());
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractChangeScreenAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeScreenAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractChangeScreenAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractChangeScreenAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,118 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.context.JAXXContextEntryDef;
+
+/**
+ * Action to change the screen.
+ * <p/>
+ * Will just check that the current screen can be quit via
+ * the {@link MainUIHandler#quitCurrentScreen()}.
+ * <p/>
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public abstract class AbstractChangeScreenAction extends AbstractMainUITuttiAction {
+
+ /**
+ * Context entry to keep previous screen.
+ *
+ * @since 1.1
+ */
+ protected static final JAXXContextEntryDef<TuttiScreen> PREVIOUS_SCREEN =
+ SwingUtil.newContextEntryDef("previousScreen", TuttiScreen.class);
+
+ /**
+ * Screen where to go.
+ *
+ * @since 1.0
+ */
+ protected TuttiScreen screen;
+
+ /**
+ * Flag to skip the check of current screen.
+ *
+ * @since 1.1
+ */
+ protected boolean skipCheckCurrentScreen;
+
+ protected AbstractChangeScreenAction(MainUIHandler handler,
+ boolean hideBody,
+ TuttiScreen screen) {
+ super(handler, hideBody);
+ this.screen = screen;
+ }
+
+ public void setSkipCheckCurrentScreen(boolean skipCheckCurrentScreen) {
+ this.skipCheckCurrentScreen = skipCheckCurrentScreen;
+ }
+
+ protected void setScreen(TuttiScreen screen) {
+ this.screen = screen;
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+ result &= skipCheckCurrentScreen || getHandler().quitCurrentScreen();
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ TuttiUIContext context = getContext();
+
+ TuttiScreen previousScreen = context.getScreen();
+ if (getUI() != null) {
+ if (previousScreen == null) {
+ PREVIOUS_SCREEN.removeContextValue(getUI());
+ } else {
+ PREVIOUS_SCREEN.setContextValue(getUI(), previousScreen);
+ }
+ }
+
+ // clean current screen
+ context.setScreen(null);
+
+ // change screen
+ context.setScreen(screen);
+ }
+
+ @Override
+ public void postFailedAction(Throwable error) {
+ if (error != null) {
+
+ getContext().setFallBackScreen();
+ }
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractExportMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractExportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractExportMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractExportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.service.DecoratorService;
+import fr.ifremer.tutti.service.catches.multipost.MultiPostExportService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.util.TuttiUI;
+import org.jdesktop.beans.AbstractBean;
+
+import java.io.File;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public abstract class AbstractExportMultiPostAction<M extends AbstractBean, UI extends TuttiUI<M, ?>, H extends AbstractTuttiUIHandler<M, UI>>
+ extends AbstractTuttiAction<M, UI, H> {
+
+ protected File file;
+
+ protected FishingOperation currentOperation;
+
+ protected MultiPostExportService multiPostImportExportService;
+
+ public AbstractExportMultiPostAction(H handler) {
+ super(handler, false);
+ multiPostImportExportService = getContext().getMultiPostExportService();
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ EditCatchesUI catchesUI = getUI().getParentContainer(EditCatchesUI.class);
+ currentOperation = catchesUI.getModel().getFishingOperation();
+
+ String extension = getFileExtension();
+ // choose file to export
+ file = saveFile(
+ decorate(currentOperation, DecoratorService.FILE_NAME_COMPATIBLE),
+ extension,
+ getFileChooserTitle(),
+ getFileChooserButton(),
+ "^.*\\." + extension,
+ getFileExtensionDescription()
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ protected abstract String getFileExtension();
+
+ protected abstract String getFileExtensionDescription();
+
+ protected abstract String getFileChooserTitle();
+
+ protected abstract String getFileChooserButton();
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ currentOperation = null;
+ super.releaseAction();
+ }
+
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractImportMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractImportMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractImportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,112 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.service.catches.multipost.MultiPostImportService;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.util.TuttiUI;
+import org.jdesktop.beans.AbstractBean;
+
+import java.io.File;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public abstract class AbstractImportMultiPostAction<M extends AbstractBean, UI extends TuttiUI<M, ?>, H extends AbstractTuttiUIHandler<M, UI>>
+ extends AbstractTuttiAction<M, UI, H> {
+
+ protected File file;
+
+ protected EditFishingOperationAction editAction;
+
+ protected MultiPostImportService multiPostImportExportService;
+
+ public AbstractImportMultiPostAction(H handler) {
+ super(handler, false);
+ multiPostImportExportService = getContext().getMultiPostImportService();
+ }
+
+ public EditFishingOperationAction getEditAction() {
+ FishingOperationsUI parentUI = getUI().getParentContainer(FishingOperationsUI.class);
+ if (editAction == null) {
+ editAction = getContext().getActionFactory().createLogicAction(parentUI.getHandler(),
+ EditFishingOperationAction.class);
+ }
+ return editAction;
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to import
+ file = chooseFile(
+ getFileChooserTitle(),
+ getFileChooserButton(),
+ "^.*\\." + getFileExtension(),
+ getFileExtensionDescription()
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ protected abstract String getFileExtension();
+
+ protected abstract String getFileExtensionDescription();
+
+ protected abstract String getFileChooserTitle();
+
+ protected abstract String getFileChooserButton();
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ EditCatchesUI editCatchesUI = getUI().getParentContainer(EditCatchesUI.class);
+ EditCatchesUIModel editCatchesUIModel = editCatchesUI.getModel();
+
+ FishingOperation operation = editCatchesUIModel.getFishingOperation();
+
+ importBatches(operation);
+
+ getEditAction().loadCatchBatch(operation);
+ }
+
+ protected abstract void importBatches(FishingOperation operation);
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractMainUITuttiAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractMainUITuttiAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractMainUITuttiAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractMainUITuttiAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,41 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.MainUI;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public abstract class AbstractMainUITuttiAction extends AbstractTuttiAction<TuttiUIContext, MainUI, MainUIHandler> {
+
+ protected AbstractMainUITuttiAction(MainUIHandler handler,
+ boolean hideBody) {
+ super(handler, hideBody);
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractTuttiAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/AbstractTuttiAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractTuttiAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AbstractTuttiAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,131 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.swing.action.AbstractApplicationAction;
+import fr.ifremer.tutti.TuttiConfiguration;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.service.TuttiDataContext;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.util.TuttiUI;
+import org.apache.commons.lang3.StringUtils;
+import org.jdesktop.beans.AbstractBean;
+import org.nuiton.util.StringUtil;
+
+import javax.swing.JOptionPane;
+import java.awt.Component;
+
+/**
+ * Tutti base action.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public abstract class AbstractTuttiAction<M extends AbstractBean, UI extends TuttiUI<M, ?>, H extends AbstractTuttiUIHandler<M, UI>>
+ extends AbstractApplicationAction<M, UI, H> {
+
+ public abstract void doAction() throws Exception;
+
+ protected AbstractTuttiAction(H handler, boolean hideBody) {
+ super(handler, hideBody);
+ }
+
+ @Override
+ public TuttiUIContext getContext() {
+ return handler.getContext();
+ }
+
+ public void setProgressionModel(ProgressionModel progressionModel) {
+ super.setProgressionModel(progressionModel);
+ }
+
+ @Override
+ protected ProgressionModel getProgressionModel() {
+ return (ProgressionModel) getContext().getActionUI().getModel().getProgressionModel();
+ }
+
+ public TuttiDataContext getDataContext() {
+ return getContext().getDataContext();
+ }
+
+ @Override
+ protected TuttiConfiguration getConfig() {
+ return getContext().getConfig();
+ }
+
+ @Override
+ protected void sendMessage(String message) {
+ getContext().showInformationMessage(message);
+ }
+
+ @Override
+ protected void createProgressionModelIfRequired(int total) {
+ ProgressionModel progressionModel = getProgressionModel();
+ if (progressionModel == null) {
+ progressionModel = new ProgressionModel();
+ progressionModel.setTotal(total);
+ progressionModel.setMessage("");
+ progressionModel.setCurrent(0);
+ setProgressionModel(progressionModel);
+ } else {
+ progressionModel.adaptTotal(total);
+ }
+ }
+
+ protected boolean askAdminPassword(String askMessage,
+ String askMessageTitle,
+ String errorMessage,
+ String errorMessageTitle) {
+
+ Component container = getContext().getActionUI();
+
+ String answer;
+ boolean result;
+ do {
+ answer = JOptionPane.showInputDialog(container,
+ askMessage,
+ askMessageTitle,
+ JOptionPane.WARNING_MESSAGE);
+ if (answer != null) {
+ String cryptedAnswer = StringUtil.encodeMD5(answer);
+ String correctAnswer = getConfig().getAdminPassword();
+ result = StringUtils.equals(cryptedAnswer, correctAnswer);
+
+ if (!result) {
+ JOptionPane.showMessageDialog(container,
+ errorMessage,
+ errorMessageTitle,
+ JOptionPane.ERROR_MESSAGE);
+ }
+
+ } else {
+ result = false;
+ }
+
+ } while (!result && answer != null);
+ return result;
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AddBenthosProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddBenthosProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AddBenthosProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AddBenthosProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,107 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesRowModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesTableModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
+
+import java.util.Collection;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To add a new benthos protocol.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class AddBenthosProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ public AddBenthosProtocolAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ protected Species species;
+
+ protected EditProtocolSpeciesRowModel newRow;
+
+ @Override
+ public void doAction() throws Exception {
+
+ species = null;
+
+ EditProtocolUI ui = getUI();
+
+ EditProtocolSpeciesTableModel tableModel = handler.getBenthosTableModel();
+ BeanFilterableComboBox<Species> benthosComboBox = ui.getBenthosComboBox();
+
+ species = (Species) benthosComboBox.getSelectedItem();
+ Preconditions.checkNotNull(
+ species, "Can't add a benthosProtocol with a null species");
+ Preconditions.checkArgument(species.isReferenceTaxon(),
+ "Can't add a benthosProtocol with a not referent species");
+
+ Integer taxonId = species.getReferenceTaxonId();
+ String taxonIdStr = String.valueOf(taxonId);
+
+ // remove all synonyms of this taxon
+ Collection<Species> allSynonyms = getModel().getAllSynonyms(taxonIdStr);
+ getModel().getAllSynonyms().removeAll(allSynonyms);
+
+ // add new row to model (do it after combo stuff for ui best display)
+ newRow = tableModel.createNewRow();
+ newRow.setSpecies(species);
+ getModel().getBenthosRow().add(newRow);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ // update comboboxes
+ getUI().getBenthosComboBox().removeItem(species);
+ getUI().getSpeciesComboBox().removeItem(species);
+
+ // fire row was inserted in table model
+ EditProtocolSpeciesTableModel tableModel = getHandler().getBenthosTableModel();
+ tableModel.fireTableRowsInserted(newRow);
+
+ // select this new row
+ int rowIndex = tableModel.getRowIndex(newRow);
+ SwingUtil.setSelectionInterval(handler.getBenthosTable(), rowIndex);
+
+ // add notification
+ String speciesStr = decorate(species);
+ sendMessage(_("tutti.flash.info.benthos.add.to.protocol",
+ speciesStr));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AddSpeciesProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddSpeciesProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AddSpeciesProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/AddSpeciesProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,105 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesRowModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesTableModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
+
+import java.util.Collection;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To add a new species protocol.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class AddSpeciesProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ public AddSpeciesProtocolAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ protected Species species;
+
+ protected EditProtocolSpeciesRowModel newRow;
+
+ @Override
+ public void doAction() throws Exception {
+
+ EditProtocolUI ui = getUI();
+
+ EditProtocolSpeciesTableModel tableModel = handler.getSpeciesTableModel();
+ BeanFilterableComboBox<Species> speciesComboBox = ui.getSpeciesComboBox();
+
+ species = (Species) speciesComboBox.getSelectedItem();
+ Preconditions.checkNotNull(
+ species, "Can't add a speciesProtocol with a null species");
+ Preconditions.checkArgument(species.isReferenceTaxon(),
+ "Can't add a speciesProtocol with a not referent species");
+
+ Integer taxonId = species.getReferenceTaxonId();
+ String taxonIdStr = String.valueOf(taxonId);
+
+ // remove all synonyms of this taxon
+ Collection<Species> allSynonyms = getModel().getAllSynonyms(taxonIdStr);
+ getModel().getAllSynonyms().removeAll(allSynonyms);
+
+ // add new row to model (do it after combo stuff for ui best display)
+ newRow = tableModel.createNewRow();
+ newRow.setSpecies(species);
+ getModel().getSpeciesRow().add(newRow);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ // update comboboxes
+ getUI().getBenthosComboBox().removeItem(species);
+ getUI().getSpeciesComboBox().removeItem(species);
+
+ // fire row was inserted in table model
+ EditProtocolSpeciesTableModel tableModel = getHandler().getSpeciesTableModel();
+ tableModel.fireTableRowsInserted(newRow);
+
+ // select this new row
+ int rowIndex = tableModel.getRowIndex(newRow);
+ SwingUtil.setSelectionInterval(handler.getSpeciesTable(), rowIndex);
+
+ // add notification
+ String speciesStr = decorate(species);
+ sendMessage(_("tutti.flash.info.species.add.to.protocol",
+ speciesStr));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CancelEditCatchBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CancelEditCatchBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CancelEditCatchBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CancelEditCatchBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,87 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.data.CatchBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * To cancel edit of a {@link CatchBatch}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class CancelEditCatchBatchAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(CancelEditCatchBatchAction.class);
+
+ /**
+ * A flag to update ui after create or save the edit catch batch.
+ *
+ * @since 1.0
+ */
+ protected boolean updateUI;
+
+ protected EditFishingOperationAction editAction;
+
+ public CancelEditCatchBatchAction(EditCatchesUIHandler handler) {
+ super(handler, true);
+ }
+
+ public EditFishingOperationAction getEditAction() {
+ if (editAction == null) {
+ editAction = getContext().getActionFactory().createLogicAction(getHandler().getParentHandler(),
+ EditFishingOperationAction.class);
+ }
+ return editAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ // cancel to create a catch batch ?
+ // Should never happen ?
+ Preconditions.checkState(
+ !getModel().isCreate(),
+ "Can't cancel edition of a not persisted catchBatch!");
+
+ if (log.isInfoEnabled()) {
+ log.info("Can edition of catchBatch (will reload catchBatch)");
+ }
+
+ FishingOperation operation = getModel().getFishingOperation();
+
+ getEditAction().loadCatchBatch(operation);
+ }
+
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CancelEditFishingOperationAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/CancelEditFishingOperationAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CancelEditFishingOperationAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CancelEditFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,109 @@
+
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Cancels the edition of a fishing operation and potentially switch to another tab.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public class CancelEditFishingOperationAction extends AbstractTuttiAction<EditFishingOperationUIModel, EditFishingOperationUI, EditFishingOperationUIHandler> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(SaveFishingOperationAction.class);
+
+ /**
+ * Delegate edit action.
+ *
+ * @since 1.0
+ */
+ protected EditFishingOperationAction editAction;
+
+ public CancelEditFishingOperationAction(EditFishingOperationUIHandler handler) {
+ super(handler, true);
+ }
+
+ public EditFishingOperationAction getEditAction() {
+ if (editAction == null) {
+ editAction = getContext().getActionFactory().createLogicAction(
+ getHandler().getParentUi().getHandler(),
+ EditFishingOperationAction.class);
+ }
+ return editAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ EditFishingOperationAction action = getEditAction();
+
+ if (getModel().isCreate()) {
+ if (log.isInfoEnabled()) {
+ log.info("Cancel creation for fishingOperation");
+ }
+ // cancel to create a new fishingOperation
+ action.setFishingOperation(null);
+ getActionEngine().runInternalAction(action);
+
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("Can edition of fishingOperation");
+ }
+
+ // re-edit current fishing operation (but do not perform any check)
+ action.setCheckPreviousEdit(false);
+ action.setFishingOperation(getModel().getFishingOperation());
+ action.setInternalAction(true);
+ getActionEngine().runInternalAction(action);
+ }
+
+ //FIXME-TC Make sure this works again
+// // if called directly from the EditFishingOperationUIHandler:
+// // the user does not want to save the modifications before
+// // selecting another tab, we must reload the current tab before setting
+// // the new index of the tab pane
+// if (event.getSource() != null
+// && event.getSource().getClass().isAssignableFrom(EditFishingOperationUIHandler.class)) {
+//
+// int newIndex = event.getID();
+// parentHandler.getTabPanel().setSelectedIndex(newIndex);
+// }
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ getEditAction().displayValidationErrors();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ChangeToLocaleFRAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ChangeToLocaleFRAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ChangeToLocaleFRAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ChangeToLocaleFRAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,46 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+import java.util.Locale;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0.3
+ */
+public class ChangeToLocaleFRAction extends AbstractChangeLocaleAction {
+
+ public ChangeToLocaleFRAction(MainUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected Locale getLocale() {
+ return Locale.FRANCE;
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ChangeToLocaleUKAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ChangeToLocaleUKAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ChangeToLocaleUKAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ChangeToLocaleUKAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,45 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+import java.util.Locale;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0.3
+ */
+public class ChangeToLocaleUKAction extends AbstractChangeLocaleAction {
+
+ public ChangeToLocaleUKAction(MainUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected Locale getLocale() {
+ return Locale.UK;
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CleanBatchWeightsAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CleanBatchWeightsAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CleanBatchWeightsAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CleanBatchWeightsAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,145 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.Multimap;
+import fr.ifremer.tutti.persistence.InvalidBatchModelException;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.service.catches.WeightCleaningService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JOptionPane;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To remove weight in double for species and benthos rows.
+ * <p/>
+ * Created on 9/27/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 2.6
+ */
+public class CleanBatchWeightsAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(CleanBatchWeightsAction.class);
+
+ protected final WeightCleaningService cleaningService;
+
+ protected int nbErrors;
+
+ public CleanBatchWeightsAction(EditCatchesUIHandler handler) {
+ super(handler, false);
+ cleaningService = getContext().getWeightCleaningService();
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean doAction = super.prepareAction();
+ if (doAction) {
+
+
+ // do a check
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ Multimap<String, String> errors = cleaningService.checkFishingOperation(fishingOperation.getId());
+
+ nbErrors = errors.size();
+
+ if (nbErrors == 0) {
+
+ // no errors
+
+ sendMessage(_("tutti.editCatchBatch.action.cleanWeights.no.double.weight.detected"));
+ doAction = false;
+ } else {
+
+ // show errors to user and ask him to apply change
+
+ String errorsStr = cleaningService.errorsToString(errors);
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ _("tutti.editCatchBatch.action.cleanWeights.double.weight.detected", errorsStr),
+ _("tutti.editCatchBatch.action.cleanWeights.help"));
+
+ int answer = JOptionPane.showConfirmDialog(
+ getContext().getActionUI(),
+ htmlMessage,
+ _("tutti.editCatchBatch.action.cleanWieghts.resume.title"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+
+ doAction = (answer == JOptionPane.OK_OPTION);
+
+ }
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ EditCatchesUIModel model = getModel();
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ model.setLoadingData(true);
+
+ cleaningService.cleanFishingOperation(fishingOperation.getId());
+
+ try {
+
+ getUI().getSpeciesTabContent().getHandler().selectFishingOperation(fishingOperation);
+ } catch (InvalidBatchModelException e) {
+
+ // invalid sample category model for species batches
+ if (log.isDebugEnabled()) {
+ log.debug("Invalid sample category model for species batches", e);
+ }
+ }
+
+ try {
+ getUI().getBenthosTabContent().getHandler().selectFishingOperation(fishingOperation);
+ } catch (InvalidBatchModelException e) {
+
+ // invalid sample category model for benthos batches
+ if (log.isDebugEnabled()) {
+ log.debug("Invalid sample category model for benthos batches", e);
+ }
+ }
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ sendMessage(_("tutti.editCatchBatch.action.cleanWeights.done", nbErrors));
+ }
+
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloneProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloneProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloneProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,160 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocols;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import jaxx.runtime.context.JAXXContextEntryDef;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JOptionPane;
+import javax.swing.UIManager;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Opens the protocol creation screen with the data of an already existing protocol.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class CloneProtocolAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(CloneProtocolAction.class);
+
+ public static final JAXXContextEntryDef<TuttiProtocol> CLONE_PROTOCOL_ENTRY = new JAXXContextEntryDef<TuttiProtocol>("cloneProtocol", TuttiProtocol.class);
+
+ protected TuttiProtocol protocol;
+
+ public CloneProtocolAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_PROTOCOL);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ CLONE_PROTOCOL_ENTRY.removeContextValue(getContext().getMainUI());
+
+ boolean doAction = super.prepareAction();
+ if (doAction) {
+
+ // check that protocol is compatible with sample category model
+ SampleCategoryModel sampleCategoryModel =
+ getDataContext().getSampleCategoryModel();
+
+ if (log.isInfoEnabled()) {
+ log.info("Clone protocol: " + getContext().getProtocolId());
+ }
+
+ // get protocol
+ protocol = getContext().getPersistenceService().getProtocol(getContext().getProtocolId());
+
+ // remove id
+ protocol.setId((String) null);
+
+ Set<Integer> badCategories = Sets.newHashSet();
+
+ TuttiProtocols.checkSampleCategories(sampleCategoryModel,
+ protocol,
+ badCategories);
+
+ if (!badCategories.isEmpty()) {
+
+ // detect some bad categories
+ if (log.isWarnEnabled()) {
+ log.warn("There is some bad categories: " + badCategories);
+ }
+
+ String message = TuttiProtocols.getBadCategoriesMessage(
+ badCategories,
+ getDecorator(Caracteristic.class, null),
+ getContext().getPersistenceService());
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ message,
+ _("tutti.common.askBeforeCloneProtocol.help"));
+ int response = JOptionPane.showOptionDialog(
+ getContext().getActionUI(),
+ htmlMessage,
+ _("tutti.common.askBeforeEditProtocol.title"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.WARNING_MESSAGE,
+ UIManager.getIcon("warning"),
+ new Object[]{_("tutti.option.cleanAndClone"), _("tutti.option.clone"), _("tutti.option.cancel")},
+ _("tutti.option.cancel")
+ );
+
+ switch (response) {
+ case 0:
+ // clean and clone
+ if (log.isInfoEnabled()) {
+ log.info("Clean and Clone");
+ }
+ TuttiProtocols.removeBadCategories(sampleCategoryModel,
+ protocol);
+ break;
+
+ case 1:
+ // clone with no clean
+ if (log.isInfoEnabled()) {
+ log.info("Clone with no cleaning");
+ }
+ break;
+ default:
+
+ // cancel
+ doAction = false;
+ }
+ }
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(protocol);
+
+ // store protocol in context
+ CLONE_PROTOCOL_ENTRY.setContextValue(getContext().getMainUI(), protocol);
+ protocol = null;
+
+ createProgressionModelIfRequired(4);
+
+ // removed selected protocol
+ getContext().setProtocolId(null);
+
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloseApplicationAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/CloseApplicationAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloseApplicationAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloseApplicationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,66 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.RunTutti;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To close Tutti Application.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class CloseApplicationAction extends AbstractChangeScreenAction {
+
+ protected int exitCode = RunTutti.NORMAL_EXIT_CODE;
+
+ public CloseApplicationAction(MainUIHandler handler) {
+ super(handler, false, null);
+ setSkipCheckCurrentScreen(true);
+ setActionDescription(_("tutti.main.action.exit.tip"));
+ }
+
+ public void setExitCode(int exitCode) {
+ this.exitCode = exitCode;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ super.doAction();
+
+ RunTutti.closeTutti(getHandler(), exitCode);
+ }
+
+
+ @Override
+ public void releaseAction() {
+ exitCode = RunTutti.NORMAL_EXIT_CODE;
+ super.releaseAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloseDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/CloseDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloseDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CloseDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,87 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To close a db.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.4
+ */
+public class CloseDbAction extends AbstractMainUITuttiAction {
+
+ protected String jdbcUrl;
+
+ public CloseDbAction(MainUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean canContinue = super.prepareAction();
+ if (canContinue) {
+ jdbcUrl = getConfig().getJdbcUrl();
+ }
+ return canContinue;
+ }
+
+ @Override
+ public void doAction() {
+
+ // close db
+ getContext().getPersistenceService().clearAllCaches();
+
+ // set to not reload a real db
+ getContext().setDbLoaded(false);
+
+ // close services + repon a fake persistence service
+ getHandler().reloadPersistenceService();
+
+ // clean db context
+ getContext().clearDbContext();
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ sendMessage(_("tutti.flash.info.db.closed", jdbcUrl));
+
+ // make sure title is reloaded
+ handler.reloadDbManagerText();
+ handler.changeTitle();
+ }
+
+ @Override
+ public void postFailedAction(Throwable error) {
+ handler.reloadDbManagerText();
+ super.postFailedAction(error);
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeBatchWeightsAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ComputeBatchWeightsAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,327 @@
+
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Multimap;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch;
+import fr.ifremer.tutti.persistence.entities.data.SampleCategory;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.service.catches.TuttiWeightComputingException;
+import fr.ifremer.tutti.service.catches.WeightCleaningService;
+import fr.ifremer.tutti.service.catches.WeightComputingService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+
+import javax.swing.JOptionPane;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
+
+ protected final WeightCleaningService cleaningService;
+
+ public ComputeBatchWeightsAction(EditCatchesUIHandler handler) {
+ super(handler, true);
+ cleaningService = getContext().getWeightCleaningService();
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean doAction = super.prepareAction();
+ if (doAction) {
+
+ // do a check of double weights
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ Multimap<String, String> errors = cleaningService.checkFishingOperation(fishingOperation.getId());
+
+ if (errors.isEmpty()) {
+
+ // no errors
+
+ sendMessage(_("tutti.editCatchBatch.action.computeWeights.no.double.weight.detected"));
+ } else {
+
+ // show errors to user as warning
+
+ String errorsStr = cleaningService.errorsToString(errors);
+ String htmlMessage = _("tutti.editCatchBatch.action.computeWeights.double.weight.detected", errorsStr);
+
+ JOptionPane.showMessageDialog(getContext().getActionUI(),
+ htmlMessage,
+ _("tutti.editCatchBatch.action.computeWeights.double.weight.detected.title"),
+ JOptionPane.WARNING_MESSAGE);
+
+
+ }
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ PersistenceService persistenceService = getContext().getPersistenceService();
+
+ WeightComputingService weightComputingService = getContext().getWeightComputingService();
+
+ EditCatchesUIModel model = getModel();
+ model.setLoadingData(true);
+
+ // ---------
+ // Compute species batches
+ // ---------
+
+ BatchContainer<SpeciesBatch> computedSpeciesBatches;
+ Float totalSpeciesSortedWeight;
+ String operationId = model.getFishingOperation().getId();
+ try {
+ computedSpeciesBatches =
+ weightComputingService.getComputedSpeciesBatches(operationId);
+ totalSpeciesSortedWeight = computeSpeciesBatches(persistenceService, computedSpeciesBatches);
+
+ } catch (TuttiWeightComputingException e) {
+ getUI().getTabPane().setSelectedIndex(1);
+
+ int index = e.getIndex();
+ SpeciesBatchRowModel row = getUI().getSpeciesTabContent().getModel().getRows().get(index);
+ int column;
+ if (SpeciesBatch.PROPERTY_SAMPLE_CATEGORY_WEIGHT.equals(e.getProperty())) {
+ column = getFinestCategoryColumn(row.getFinestCategory().getCategoryId());
+ } else {
+ column = 6;
+ }
+ TuttiUIUtil.doSelectCell(getUI().getSpeciesTabContent().getTable(), index, column);
+
+ throw e;
+ }
+
+ // ---------
+ // Compute benthos batches
+ // ---------
+
+ BatchContainer<BenthosBatch> computedBenthosBatches;
+ Float totalBenthosSortedWeight;
+ try {
+ computedBenthosBatches =
+ weightComputingService.getComputedBenthosBatches(operationId);
+ totalBenthosSortedWeight = computeBenthosBatches(persistenceService, computedBenthosBatches);
+
+ } catch (TuttiWeightComputingException e) {
+ getUI().getTabPane().setSelectedIndex(2);
+
+ int index = e.getIndex();
+ BenthosBatchRowModel row = getUI().getBenthosTabContent().getModel().getRows().get(index);
+ int column;
+ if (BenthosBatch.PROPERTY_SAMPLE_CATEGORY_WEIGHT.equals(e.getProperty())) {
+ column = getFinestCategoryColumn(row.getFinestCategory().getCategoryId());
+ } else {
+ column = 6;
+ }
+ TuttiUIUtil.doSelectCell(getUI().getBenthosTabContent().getTable(), index, column);
+
+ throw e;
+ }
+
+ // ---------
+ // Compute marine litter batches
+ // ---------
+
+ BatchContainer<MarineLitterBatch> computedMarineLitterBatches;
+ try {
+ computedMarineLitterBatches =
+ weightComputingService.getComputedMarineLitterBatches(operationId,
+ model.getMarineLitterTotalWeight());
+
+ } catch (TuttiWeightComputingException e) {
+ getUI().getTabPane().setSelectedIndex(3);
+ TuttiUIUtil.doSelectCell(getUI().getMarineLitterTabContent().getTable(), e.getIndex(), 3);
+ throw e;
+ }
+
+ // ---------
+ // Check species rates
+ // ---------
+
+ Float rate = getConfig().getDifferenceRateBetweenSortedAndTotalWeights();
+ if (model.getSpeciesTotalSortedWeight() != null
+ && model.getSpeciesTotalSortedWeight() >= totalSpeciesSortedWeight
+ && model.getSpeciesTotalSortedWeight() < (1 + rate / 100) * totalSpeciesSortedWeight) {
+
+ // Si le "Poids total VRAC" est saisi est que sa valeur
+ // est supérieure de moins de x% (x en configuration)
+ // du "Poids total Vrac trié", demander confirmation que
+ // le "Poids total VRAC" est bien une valeur observée
+ // sinon la remplacer par le "Poids total Vrac trié"
+
+ getUI().getTabPane().setSelectedIndex(1);
+
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.message.species", rate),
+ _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.help"));
+
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ htmlMessage,
+ _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.title"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+
+ if (answer == JOptionPane.NO_OPTION) {
+ model.setSpeciesTotalSortedWeight(null);
+ model.setSpeciesTotalSortedComputedWeight(totalSpeciesSortedWeight);
+ }
+ }
+
+ // ---------
+ // Check benthos rates
+ // ---------
+
+ if (model.getBenthosTotalSortedWeight() != null
+ && model.getBenthosTotalSortedWeight() >= totalBenthosSortedWeight
+ && model.getBenthosTotalSortedWeight() < (1 + rate / 100) * totalBenthosSortedWeight) {
+
+ // Si le "Poids total VRAC" est saisi est que sa valeur
+ // est supérieure de moins de x% (x en configuration)
+ // du "Poids total Vrac trié", demander confirmation que
+ // le "Poids total VRAC" est bien une valeur observée
+ // sinon la remplacer par le "Poids total Vrac trié"
+
+ getUI().getTabPane().setSelectedIndex(2);
+
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.message.benthos", rate),
+ _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.help"));
+
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ htmlMessage,
+ _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.title"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+
+ if (answer == JOptionPane.NO_OPTION) {
+ model.setBenthosTotalSortedWeight(null);
+ model.setBenthosTotalSortedComputedWeight(totalBenthosSortedWeight);
+ }
+ }
+
+ boolean modified = model.isModify();
+ CatchBatch catchBatch = model.toEntity();
+ weightComputingService.computeCatchBatchWeights(catchBatch,
+ computedSpeciesBatches,
+ computedBenthosBatches,
+ computedMarineLitterBatches);
+ model.fromEntity(catchBatch);
+ model.setLoadingData(false);
+
+ model.setModify(modified);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ getUI().repaint();
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected Float computeSpeciesBatches(PersistenceService persistenceService, BatchContainer<SpeciesBatch> computedSpeciesBatches) {
+ Float totalSortedWeight = 0f;
+
+ if (computedSpeciesBatches != null) {
+ List<SpeciesBatchRowModel> rows = Lists.newArrayList();
+ List<SpeciesBatch> children = computedSpeciesBatches.getChildren();
+ for (SpeciesBatch batch : children) {
+ SpeciesBatchRowModel row = getUI().getSpeciesTabContent().getHandler().loadBatch(batch, null, rows);
+ if (persistenceService.isVracBatch(row)) {
+ SampleCategory<?> sampleCategory = row.getFirstSampleCategory();
+ Float weight = TuttiEntities.getValueOrComputedValue(
+ sampleCategory.getCategoryWeight(),
+ sampleCategory.getComputedWeight());
+ totalSortedWeight += weight;
+ }
+ }
+ getUI().getSpeciesTabContent().getModel().setRows(rows);
+ }
+
+ return totalSortedWeight;
+ }
+
+ protected Float computeBenthosBatches(PersistenceService persistenceService, BatchContainer<BenthosBatch> computedBenthosBatches) {
+ Float totalSortedWeight = 0f;
+
+ if (computedBenthosBatches != null) {
+ List<BenthosBatchRowModel> rows = Lists.newArrayList();
+ List<BenthosBatch> children = computedBenthosBatches.getChildren();
+ for (BenthosBatch batch : children) {
+ BenthosBatchRowModel row = getUI().getBenthosTabContent().getHandler().loadBatch(batch, null, rows);
+
+ if (persistenceService.isVracBatch(row)) {
+ SampleCategory<?> sampleCategory = row.getFirstSampleCategory();
+ Float weight = TuttiEntities.getValueOrComputedValue(
+ sampleCategory.getCategoryWeight(),
+ sampleCategory.getComputedWeight());
+ totalSortedWeight += weight;
+ }
+ }
+ getUI().getBenthosTabContent().getModel().setRows(rows);
+
+ }
+ return totalSortedWeight;
+ }
+
+ protected int getFinestCategoryColumn(Integer categoryId) {
+ int column = 1;
+
+ List<Integer> samplingOrderIds = getConfig().getSamplingOrderIds();
+
+ int index = samplingOrderIds.indexOf(categoryId);
+ if (index > -1) {
+ column += index + 1;
+ }
+
+ return column;
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CreateBenthosMelagAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/CreateBenthosMelagAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CreateBenthosMelagAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CreateBenthosMelagAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,201 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.Maps;
+import fr.ifremer.shared.application.type.WeightUnit;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchTableModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.frequency.BenthosFrequencyRowModel;
+import fr.ifremer.tutti.ui.swing.util.species.EnterMelagWeightDialog;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.swing.JOptionPane;
+import java.awt.Frame;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0.2
+ */
+public class CreateBenthosMelagAction extends AbstractTuttiAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
+
+ protected Map<BenthosBatchRowModel, Float> selectedRows = Maps.newHashMap();
+
+ protected Float melagWeight = null;
+
+ protected Float sampleMelagWeight = null;
+
+ protected Float sortedWeight = null;
+
+ /**
+ * Weight unit.
+ *
+ * @since 2.5
+ */
+ protected final WeightUnit weightUnit;
+
+ public CreateBenthosMelagAction(BenthosBatchUIHandler handler) {
+ super(handler, false);
+ weightUnit = getConfig().getBenthosWeightUnit();
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ int[] selectedRowIndexes = SwingUtil.getSelectedModelRows(handler.getTable());
+
+ BenthosBatchTableModel tableModel = handler.getTableModel();
+
+ // sum of the weights already entered by the user
+ Float alreadyKnownWeights = 0f;
+ sortedWeight = 0f;
+
+ for (int selectedRowIndex : selectedRowIndexes) {
+ BenthosBatchRowModel selectedRow =
+ tableModel.getEntry(selectedRowIndex);
+
+ Float sampleWeight = null;
+ if (selectedRow.getFinestCategory().getNotNullWeight() != null) {
+ alreadyKnownWeights += selectedRow.getFinestCategory().getNotNullWeight();
+
+ } else if (selectedRow.getWeight() != null) {
+ sampleWeight = selectedRow.getWeight();
+
+ } else {
+ sampleWeight = 0f;
+ if (selectedRow.getFrequency() != null) {
+ for (BenthosFrequencyRowModel frequency : selectedRow.getFrequency()) {
+ if (frequency.getWeight() == null) {
+ sampleWeight = 0f;
+ break;
+ }
+ sampleWeight += frequency.getWeight();
+ }
+ }
+ }
+
+ if (sampleWeight != null) {
+ if (sampleWeight == 0f) {
+ JOptionPane.showMessageDialog(
+ getUI(),
+ _("tutti.createBenthosMelag.error.message", selectedRowIndex + 1),
+ _("tutti.createBenthosMelag.error.title"),
+ JOptionPane.ERROR_MESSAGE);
+
+ SwingUtil.setSelectionInterval(handler.getTable(), selectedRowIndex);
+ result = false;
+ break;
+
+ } else {
+ sortedWeight += sampleWeight;
+ }
+ }
+
+ selectedRows.put(selectedRow, sampleWeight);
+ }
+
+ if (result) {
+ melagWeight = openMelagWeightDialog();
+
+ if (melagWeight != null) {
+ // substract the weights that the user already entered
+ // they must not be used to compute the other weights
+ sampleMelagWeight = melagWeight - alreadyKnownWeights;
+ }
+ }
+
+ return result && melagWeight != null;
+ }
+
+ protected Float openMelagWeightDialog() {
+ Frame frame = SwingUtil.getParentContainer(getUI(), Frame.class);
+
+ EnterMelagWeightDialog dialog = new EnterMelagWeightDialog(
+ frame, getConfig().getShortcutClosePopup());
+ dialog.setWeightUnit(weightUnit);
+ SwingUtil.center(frame, dialog);
+ dialog.pack();
+ dialog.setVisible(true);
+
+ Float result = null;
+ if (dialog.getEditor().getModel() != null) {
+ result = dialog.getEditor().getModel().floatValue();
+ }
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ String unitLabel = weightUnit.getShortLabel();
+ String melagComment = _("tutti.createBenthosMelag.comment.part1") + "\n";
+ for (BenthosBatchRowModel batch : selectedRows.keySet()) {
+ Float sampleWeight = selectedRows.get(batch);
+ if (sampleWeight != null) {
+ Float weight = sampleMelagWeight * sampleWeight / sortedWeight;
+ batch.getFinestCategory().setCategoryWeight(weight);
+ }
+ melagComment += _("tutti.createBenthosMelag.comment.part2", sampleWeight, unitLabel, decorate(batch.getSpecies())) + "\n";
+ }
+ melagComment += _("tutti.createBenthosMelag.comment.part3", melagWeight, unitLabel);
+
+ for (BenthosBatchRowModel batch : selectedRows.keySet()) {
+ String comment = batch.getComment();
+ if (StringUtils.isBlank(comment)) {
+ comment = "";
+
+ } else {
+ comment += "\n";
+ }
+ comment += melagComment;
+ batch.setComment(comment);
+ }
+ getHandler().saveRows(selectedRows.keySet());
+ }
+
+ @Override
+ public void releaseAction() {
+ super.releaseAction();
+ //FIXME-TC No release action is not design to refresh ui...
+// getHandler().getTable().repaint();
+ selectedRows.clear();
+ melagWeight = null;
+ sortedWeight = null;
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ getHandler().getTable().repaint();
+
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CreateSpeciesMelagAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateSpeciesMelagAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CreateSpeciesMelagAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/CreateSpeciesMelagAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,203 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.Maps;
+import fr.ifremer.shared.application.type.WeightUnit;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchTableModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyRowModel;
+import fr.ifremer.tutti.ui.swing.util.species.EnterMelagWeightDialog;
+import jaxx.runtime.SwingUtil;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.swing.JOptionPane;
+import java.awt.Frame;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0.2
+ */
+public class CreateSpeciesMelagAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
+
+ protected Map<SpeciesBatchRowModel, Float> selectedRows = Maps.newHashMap();
+
+ protected Float melagWeight = null;
+
+ protected Float sampleMelagWeight = null;
+
+ protected Float sortedWeight = null;
+
+ /**
+ * Weight unit.
+ *
+ * @since 2.5
+ */
+ protected final WeightUnit weightUnit;
+
+ public CreateSpeciesMelagAction(SpeciesBatchUIHandler handler) {
+ super(handler, false);
+ weightUnit = getConfig().getSpeciesWeightUnit();
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ int[] selectedRowIndexes = SwingUtil.getSelectedModelRows(handler.getTable());
+
+ SpeciesBatchTableModel tableModel = handler.getTableModel();
+
+ // sum of the weights already entered by the user
+ Float alreadyKnownWeights = 0f;
+ sortedWeight = 0f;
+
+ for (int selectedRowIndex : selectedRowIndexes) {
+ SpeciesBatchRowModel selectedRow =
+ tableModel.getEntry(selectedRowIndex);
+
+ Float sampleWeight = null;
+ if (selectedRow.getFinestCategory().getNotNullWeight() != null) {
+ alreadyKnownWeights += selectedRow.getFinestCategory().getNotNullWeight();
+
+ } else if (selectedRow.getWeight() != null) {
+ sampleWeight = selectedRow.getWeight();
+
+ } else {
+ sampleWeight = 0f;
+ if (selectedRow.getFrequency() != null) {
+ for (SpeciesFrequencyRowModel frequency : selectedRow.getFrequency()) {
+ if (frequency.getWeight() == null) {
+ sampleWeight = 0f;
+ break;
+ }
+ sampleWeight += frequency.getWeight();
+ }
+ }
+ }
+
+ if (sampleWeight != null) {
+ if (sampleWeight == 0f) {
+ JOptionPane.showMessageDialog(
+ getUI(),
+ _("tutti.createSpeciesMelag.error.message", selectedRowIndex + 1),
+ _("tutti.createSpeciesMelag.error.title"),
+ JOptionPane.ERROR_MESSAGE);
+
+ SwingUtil.setSelectionInterval(handler.getTable(), selectedRowIndex);
+ result = false;
+ break;
+
+ } else {
+ sortedWeight += sampleWeight;
+ }
+ }
+
+ selectedRows.put(selectedRow, sampleWeight);
+ }
+
+ if (result) {
+ melagWeight = openMelagWeightDialog();
+
+ if (melagWeight != null) {
+ // substract the weights that the user already entered
+ // they must not be used to compute the other weights
+ sampleMelagWeight = melagWeight - alreadyKnownWeights;
+ }
+ }
+
+ return result && melagWeight != null;
+ }
+
+ protected Float openMelagWeightDialog() {
+ Frame frame = SwingUtil.getParentContainer(getUI(), Frame.class);
+
+ EnterMelagWeightDialog dialog = new EnterMelagWeightDialog(
+ frame, getConfig().getShortcutClosePopup());
+
+ dialog.setWeightUnit(weightUnit);
+
+ SwingUtil.center(frame, dialog);
+ dialog.pack();
+ dialog.setVisible(true);
+
+ Float result = null;
+ if (dialog.getEditor().getModel() != null) {
+ result = dialog.getEditor().getModel().floatValue();
+ }
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ String unitLabel = weightUnit.getShortLabel();
+ String melagComment = _("tutti.createSpeciesMelag.comment.part1") + "\n";
+ for (SpeciesBatchRowModel batch : selectedRows.keySet()) {
+ Float sampleWeight = selectedRows.get(batch);
+ if (sampleWeight != null) {
+ Float weight = sampleMelagWeight * sampleWeight / sortedWeight;
+ batch.getFinestCategory().setCategoryWeight(weight);
+ }
+ melagComment += _("tutti.createSpeciesMelag.comment.part2", sampleWeight, unitLabel, decorate(batch.getSpecies())) + "\n";
+ }
+ melagComment += _("tutti.createSpeciesMelag.comment.part3", melagWeight, unitLabel);
+
+ for (SpeciesBatchRowModel batch : selectedRows.keySet()) {
+ String comment = batch.getComment();
+ if (StringUtils.isBlank(comment)) {
+ comment = "";
+
+ } else {
+ comment += "\n";
+ }
+ comment += melagComment;
+ batch.setComment(comment);
+ }
+ getHandler().saveRows(selectedRows.keySet());
+ }
+
+ @Override
+ public void releaseAction() {
+ super.releaseAction();
+ //FIXME-TC No release action is not design to refresh ui...
+// getHandler().getTable().repaint();
+ selectedRows.clear();
+ melagWeight = null;
+ sortedWeight = null;
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ getHandler().getTable().repaint();
+
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/DeleteFishingOperationAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/DeleteFishingOperationAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/DeleteFishingOperationAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/DeleteFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,90 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To delete a fishing operation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.2
+ */
+public class DeleteFishingOperationAction extends AbstractTuttiAction<FishingOperationsUIModel, FishingOperationsUI, FishingOperationsUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(DeleteFishingOperationAction.class);
+
+ public DeleteFishingOperationAction(FishingOperationsUIHandler handler) {
+ super(handler, true);
+ setActionDescription(
+ _("tutti.editFishingOperation.action.deleteFishingOperation.tip"));
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean canContinue = super.prepareAction();
+ FishingOperation fishingOperation = getModel().getSelectedFishingOperation();
+ canContinue &= fishingOperation != null &&
+ !TuttiEntities.isNew(fishingOperation) &&
+ askBeforeDelete(
+ _("tutti.editFishingOperation.action.deleteFishingOperation.title"),
+ _("tutti.editFishingOperation.action.deleteFishingOperation.message", decorate(fishingOperation))
+ );
+ return canContinue;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ FishingOperation fishingOperation =
+ getModel().getSelectedFishingOperation();
+
+ if (log.isInfoEnabled()) {
+ log.info("Will delete fishingOperation: " + fishingOperation);
+ }
+
+ getContext().getPersistenceService().deleteFishingOperation(fishingOperation.getId());
+
+ FishingOperationsUIModel model = getModel();
+
+ // unselect removed fishing operation
+ model.setSelectedFishingOperation(null);
+
+ // remove it from selection model
+ model.removeFishingOperation(fishingOperation);
+
+ sendMessage(_("tutti.editFishingOperation.message.operation.deleted", decorate(fishingOperation)));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/DeleteProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/DeleteProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/DeleteProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/DeleteProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,99 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUIHandler;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To delete the selected protocol.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class DeleteProtocolAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUI, SelectCruiseUIHandler> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(EditProtocolAction.class);
+
+ public DeleteProtocolAction(SelectCruiseUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ TuttiProtocol protocol = getHandler().getModel().getProtocol();
+
+ result &=
+ askBeforeDelete(
+ _("tutti.selectCruise.action.deleteProtocol.title"),
+ _("tutti.selectCruise.action.deleteProtocol.message", protocol.getName())
+ );
+
+ return result;
+ }
+
+ @Override
+ public void doAction() {
+ TuttiProtocol protocol = getModel().getProtocol();
+ Preconditions.checkNotNull(protocol);
+ String id = protocol.getId();
+ Preconditions.checkNotNull(id);
+ if (log.isInfoEnabled()) {
+ log.info("Delete protocol: " + id);
+ }
+
+ PersistenceService service = getContext().getPersistenceService();
+ service.deleteProtocol(id);
+
+ getModel().setProtocol(null);
+
+ List<TuttiProtocol> protocols = getModel().getProtocols();
+ protocols.remove(protocol);
+
+ if (log.isInfoEnabled()) {
+ log.info("nb protocols: " + protocols.size());
+ }
+ // reset (will clear combo-box)
+ getModel().setProtocols(null);
+
+ // set new list
+ getModel().setProtocols(protocols);
+
+ getHandler().resetEditProtolAction();
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCatchesAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCatchesAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCatchesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,71 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.ValidationService;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Opens the operations edition screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class EditCatchesAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(EditCatchesAction.class);
+
+ public EditCatchesAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_FISHING_OPERATION);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkState(getContext().isProgramFilled());
+ Preconditions.checkState(getContext().isCruiseFilled());
+ if (log.isInfoEnabled()) {
+ log.info("Edit operations of cruise: " + getContext().getCruiseId());
+ }
+ getContext().setValidationContext(ValidationService.VALIDATION_CONTEXT_EDIT);
+ super.doAction();
+ }
+
+ @Override
+ public void postFailedAction(Throwable error) {
+// TuttiUIContext context = getContext();
+// if (error != null) {
+// if (context.isDbLoaded()) {
+// context.setScreen(TuttiScreen.SELECT_CRUISE);
+// } else {
+// context.setScreen(TuttiScreen.MANAGE_DB);
+// }
+// }
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCruiseAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCruiseAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCruiseAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,49 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+/**
+ * Opens the cruise edition screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class EditCruiseAction extends AbstractChangeScreenAction {
+
+ public EditCruiseAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_CRUISE);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkState(getContext().isProgramFilled());
+ Preconditions.checkState(getContext().isCruiseFilled());
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCruiseFishingOperationAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseFishingOperationAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCruiseFishingOperationAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditCruiseFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,177 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.CatchBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
+import fr.ifremer.tutti.ui.swing.content.cruise.ValidateCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.cruise.ValidateCruiseUIHandler;
+import fr.ifremer.tutti.ui.swing.content.cruise.ValidateCruiseUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import org.nuiton.validator.NuitonValidatorResult;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To edit the given fishing operation.
+ *
+ * @author kmorin <morin(a)codelutin.com>
+ * @since 1.4
+ */
+public class EditCruiseFishingOperationAction extends AbstractTuttiAction<ValidateCruiseUIModel, ValidateCruiseUI, ValidateCruiseUIHandler> {
+
+ /** Validation service. */
+ private final ValidateCruiseOperationsService validationService = getContext().getValidateCruiseOperationsService();
+
+ /**
+ * The incoming fishing operation to edit.
+ * <p/>
+ * Can be null (means do not edit any fishing operation), or with no id
+ * (means create a ne fishing operation), or with an id (means edit an
+ * existing fishing operation).
+ */
+ protected FishingOperation fishingOperation;
+
+ protected final PropertyChangeListener editFishingOperationModelListener = new PropertyChangeListener() {
+
+ protected final List<String> propertiesToIgnore = Lists.newArrayList(
+ EditFishingOperationUIModel.PROPERTY_MODIFY,
+ EditFishingOperationUIModel.PROPERTY_VALID,
+ EditFishingOperationUIModel.PROPERTY_PERSISTED
+ );
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+
+ EditFishingOperationUIModel model = (EditFishingOperationUIModel) evt.getSource();
+
+ if (!model.isLoadingData()
+ && model.getFishingOperation() != null
+ && !propertiesToIgnore.contains(evt.getPropertyName())) {
+
+ model.convertGearShootingCoordinatesToDD();
+
+ FishingOperation operation = model.toBean();
+ NuitonValidatorResult validationResult = validationService.validateCruiseOperation(operation);
+
+ ValidateCruiseUIModel uiModel = getModel();
+ uiModel.getValidator().put(uiModel.getSelectedFishingOperation(), validationResult);
+
+ getHandler().updateCurrentOperationNode(validationResult);
+
+ }
+ }
+ };
+
+ protected final PropertyChangeListener editCatchesModelListener = new PropertyChangeListener() {
+
+ protected final List<String> propertiesToIgnore = Lists.newArrayList(
+ EditCatchesUIModel.PROPERTY_MODIFY,
+ EditCatchesUIModel.PROPERTY_VALID,
+ EditCatchesUIModel.PROPERTY_CATCH_TOTAL_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_CATCH_TOTAL_SORTED_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_CATCH_TOTAL_UNSORTED_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_CATCH_TOTAL_REJECTED_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SORTED_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_UNSORTED_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_INERT_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_LIVING_NOT_ITEMIZED_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SORTED_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_UNSORTED_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_INERT_COMPUTED_WEIGHT,
+ EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_COMPUTED_WEIGHT
+ );
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ EditCatchesUIModel model = (EditCatchesUIModel) evt.getSource();
+
+ if (!model.isLoadingData()
+ && model.getFishingOperation() != null
+ && !propertiesToIgnore.contains(evt.getPropertyName())) {
+
+ CatchBatch catchBatch = model.toBean();
+ NuitonValidatorResult validationResult = validationService.validateCruiseOperation(catchBatch);
+
+ ValidateCruiseUIModel uiModel = getModel();
+ uiModel.getValidator().put(uiModel.getSelectedFishingOperation(), validationResult);
+
+ getHandler().updateCurrentOperationNode(validationResult);
+ }
+ }
+ };
+
+ public EditCruiseFishingOperationAction(ValidateCruiseUIHandler handler) {
+ super(handler, true);
+ setActionDescription(_("tutti.editFishingOperation.action.editFishingOperation.tip"));
+ }
+
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ FishingOperationsUI operationPanel = getUI().getOperationPanel();
+ operationPanel.getFishingOperationTabContent().getModel().
+ removePropertyChangeListener(editFishingOperationModelListener);
+ operationPanel.getCatchesTabContent().getModel().
+ removePropertyChangeListener(editCatchesModelListener);
+
+ return super.prepareAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ getUI().getOperationPanel().getModel().setSelectedFishingOperation(fishingOperation);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ FishingOperationsUI operationPanel = getUI().getOperationPanel();
+ operationPanel.getFishingOperationTabContent().getModel().addPropertyChangeListener(editFishingOperationModelListener);
+ operationPanel.getCatchesTabContent().getModel().addPropertyChangeListener(editCatchesModelListener);
+ }
+
+ @Override
+ public void releaseAction() {
+ super.releaseAction();
+ fishingOperation = null;
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditFishingOperationAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditFishingOperationAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,798 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.InvalidBatchModelException;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
+import fr.ifremer.tutti.persistence.entities.data.CatchBatchs;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperations;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrders;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.SecondaryVesselTypeEnum;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.GearUseFeatureTabUI;
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.VesselUseFeatureTabUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JTabbedPane;
+import java.awt.BorderLayout;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To edit the given fishing operation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class EditFishingOperationAction extends AbstractTuttiAction<FishingOperationsUIModel, FishingOperationsUI, FishingOperationsUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditFishingOperationAction.class);
+
+ /**
+ * The incoming fishing operation to edit.
+ * <p/>
+ * Can be null (means do not edit any fishing operation), or with no id
+ * (means create a ne fishing operation), or with an id (means edit an
+ * existing fishing operation).
+ *
+ * @since 1.0
+ */
+ protected FishingOperation fishingOperation;
+
+ /**
+ * A flag to not check if there is a previous edit.
+ * <p/>
+ * This flag is used when we launch the cancel action.
+ *
+ * @since 1.0
+ */
+ protected boolean checkPreviousEdit = true;
+
+ /**
+ * Delegate action to save Fising Operation.
+ *
+ * @since 1.0
+ */
+ protected SaveFishingOperationAction saveFishingOperationAction;
+
+ /**
+ * Delegate action to compute the weight of the operations.
+ *
+ * @since 1.1
+ */
+ protected ComputeBatchWeightsAction computeBatchWeightsAction;
+
+ /**
+ * Delegate action to save catch batch.
+ *
+ * @since 1.0
+ */
+ protected SaveCatchBatchAction saveCatchBatchAction;
+
+ /**
+ * To keep catch validation error while loading batches.
+ *
+ * @since 2.4
+ */
+ protected List<String> errorMessages = Lists.newArrayList();
+
+ /**
+ * Flag to know if this action is part of another action.
+ *
+ * @since 2.4
+ */
+ protected boolean internalAction;
+
+ /**
+ * To recompute distance when coordinate change.
+ *
+ * @since 2.4
+ */
+ private final PropertyChangeListener coordinatePropertiesListener = new PropertyChangeListener() {
+
+ private List<String> properties = Lists.newArrayList(
+ EditFishingOperationUIModel.PROPERTY_FISHING_OPERATION_RECTILIGNE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMS_SIGN,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMS_DEGREE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMS_MINUTE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMS_SECOND,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMD_SIGN,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMD_DEGREE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMD_MINUTE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMS_SIGN,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMS_DEGREE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMS_MINUTE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMS_SECOND,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMD_SIGN,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMD_DEGREE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMD_MINUTE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMS_SIGN,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMS_DEGREE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMS_MINUTE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMS_SECOND,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMD_SIGN,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMD_DEGREE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMD_MINUTE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMS_SIGN,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMS_DEGREE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMS_MINUTE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMS_SECOND,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMD_SIGN,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMD_DEGREE,
+ EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMD_MINUTE
+ );
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (properties.contains(evt.getPropertyName())) {
+ EditFishingOperationUIModel source = (EditFishingOperationUIModel) evt.getSource();
+ if (source.isFishingOperationRectiligne()) {
+ source.computeDistance();
+ }
+ }
+ }
+ };
+
+ public EditFishingOperationAction(FishingOperationsUIHandler handler) {
+ super(handler, true);
+ setActionDescription(_("tutti.editFishingOperation.action.editFishingOperation.tip"));
+ }
+
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ this.fishingOperation = fishingOperation;
+ getDataContext().setFishingOperationId(fishingOperation != null ? fishingOperation.getId() : null);
+ }
+
+ public void setCheckPreviousEdit(boolean checkPreviousEdit) {
+ this.checkPreviousEdit = checkPreviousEdit;
+ }
+
+ @Override
+ public void releaseAction() {
+ fishingOperation = null;
+ checkPreviousEdit = true;
+ internalAction = false;
+ super.releaseAction();
+ }
+
+ protected SaveFishingOperationAction getSaveFishingOperationAction() {
+ if (saveFishingOperationAction == null) {
+ saveFishingOperationAction = new SaveFishingOperationAction(getUI().getFishingOperationTabContent().getHandler());
+ }
+ return saveFishingOperationAction;
+ }
+
+ protected SaveCatchBatchAction getSaveCatchBatchAction() {
+ if (saveCatchBatchAction == null) {
+ saveCatchBatchAction = new SaveCatchBatchAction(getUI().getCatchesTabContent().getHandler());
+ }
+ return saveCatchBatchAction;
+ }
+
+ protected ComputeBatchWeightsAction getComputeBatchWeightsAction() {
+ if (computeBatchWeightsAction == null) {
+ computeBatchWeightsAction = new ComputeBatchWeightsAction(getUI().getCatchesTabContent().getHandler());
+ }
+ return computeBatchWeightsAction;
+ }
+
+ @Override
+ public boolean prepareAction() {
+
+ boolean canContinue = true;
+ if (checkPreviousEdit) {
+ FishingOperationsUI ui = getUI();
+
+ final FishingOperationsUIModel model = ui.getModel();
+
+ FishingOperation editFishingOperation = model.getEditFishingOperation();
+
+ String editFishingOperationId = null;
+
+ if (editFishingOperation == null) {
+
+ // no previous fishing operation in edition, can continue
+ canContinue = true;
+ } else {
+
+ editFishingOperationId = editFishingOperation.getId();
+
+ boolean create = TuttiEntities.isNew(editFishingOperation);
+
+ boolean fishingOperationModified = getHandler().isFishingOperationModified();
+ boolean catchBatchModified = getHandler().isCatchBatchModified();
+
+ boolean fishingOperationValid = getHandler().isFishingOperationValid();
+ boolean catchBatchValid = getHandler().isCatchBatchValid();
+
+ boolean needSave = create || fishingOperationModified || catchBatchModified;
+
+
+ if (needSave) {
+
+ boolean canSave = fishingOperationValid && catchBatchValid;
+
+ canContinue = false;
+
+ if (canSave) {
+
+ String message;
+
+ if (create) {
+ message = _("tutti.editFishingOperation.askSaveBeforeLeaving.createFishingOperation");
+ } else if (fishingOperationModified) {
+ message = _("tutti.editFishingOperation.askSaveBeforeLeaving.saveFishingOperation");
+ } else {
+ message = _("tutti.editCatchBatch.askSaveBeforeLeaving.saveCatchBatch");
+ }
+
+ int answer = getHandler().askSaveBeforeLeaving(message);
+
+
+ switch (answer) {
+ case JOptionPane.OK_OPTION:
+
+ // persist previous fishing operation
+ if (fishingOperationModified) {
+ getSaveFishingOperationAction().setUpdateUI(false);
+ getActionEngine().runInternalAction(getSaveFishingOperationAction());
+ }
+
+ if (catchBatchModified) {
+ getSaveCatchBatchAction().setUpdateUI(false);
+ getActionEngine().runInternalAction(getSaveCatchBatchAction());
+ }
+
+ canContinue = true;
+ break;
+
+ case JOptionPane.NO_OPTION:
+
+ // won't save modification
+ // so since we will edit a new operation, nothing to do here
+
+ canContinue = true;
+ break;
+ }
+ } else {
+
+ // data are not valid
+ String message;
+
+ if (fishingOperationValid) {
+ message = _("tutti.editCatchBatch.askCancelEditBeforeLeaving.cancelEditCatchBatch");
+ } else {
+ message = _("tutti.editFishingOperation.askCancelEditBeforeLeaving.cancelEditFishingOperation");
+ }
+
+ // ok will revert any modification by
+ // editing new fishing operation (if user says yes)
+ canContinue = handler.askCancelEditBeforeLeaving(message);
+ }
+ }
+ }
+
+ if (!canContinue) {
+
+ FishingOperation selectFishingOperation;
+ if (TuttiEntities.isNew(editFishingOperation)) {
+
+ // no selection
+ selectFishingOperation = null;
+ } else {
+ // rollback selected fishing operation
+ selectFishingOperation =
+ model.getFishingOperation(editFishingOperationId);
+ }
+
+ model.setEditionAdjusting(true);
+ try {
+ model.setSelectedFishingOperation(selectFishingOperation);
+ } finally {
+ model.setEditionAdjusting(false);
+ }
+ }
+ }
+
+ return canContinue;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ errorMessages.clear();
+
+ FishingOperationsUI ui = getUI();
+
+ FishingOperationsUIModel model = ui.getModel();
+
+ // edit new fishing operation
+ if (log.isDebugEnabled()) {
+ log.debug("Edit fishingOperation: " + fishingOperation);
+ }
+
+ // now fishing operation is edited
+ model.setEditFishingOperation(fishingOperation);
+
+ loadFishingOperation(fishingOperation);
+
+ loadCatchBatch(fishingOperation);
+
+ JTabbedPane form = ui.getTabPane();
+ JLabel noContentPane = ui.getNoTraitPane();
+
+ if (fishingOperation == null) {
+
+ // nothing to display
+
+ ui.remove(form);
+
+ // just display <no trait!>
+ ui.add(noContentPane, BorderLayout.CENTER);
+
+ } else {
+
+ ui.remove(noContentPane);
+
+ // wait last minute to display (avoid dirty display effects)
+ ui.add(form, BorderLayout.CENTER);
+
+ ui.getFishingOperationTabContent().getFishingOperationTabPane().setSelectedIndex(0);
+
+ if (checkPreviousEdit) {
+ ui.getTabPane().setSelectedIndex(0);
+ }
+ }
+
+ model.addPropertyChangeListener(coordinatePropertiesListener);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ final EditFishingOperationUI fishingOperationTabContent = getUI().getFishingOperationTabContent();
+ fishingOperationTabContent.getModel().setModify(false);
+// SwingUtilities.invokeLater(
+// new Runnable() {
+// @Override
+// public void run() {
+// if (log.isInfoEnabled()) {
+// log.info("startLongitude: " + fishingOperationTabContent.getGearShootingStartLongitudeDMSField().getEditor().getText());
+// }
+// fishingOperationTabContent.getGearShootingStartLongitudeDMSField().getEditor().repaint();
+// fishingOperationTabContent.getGearShootingEndLongitudeDMSField().getEditor().repaint();
+// }
+// }
+// );
+ getUI().repaint();
+
+ if (!internalAction) {
+ displayValidationErrors();
+ }
+ }
+
+ public void displayValidationErrors() {
+ if (CollectionUtils.isNotEmpty(errorMessages)) {
+ for (String errorMessage : errorMessages) {
+ getContext().getErrorHelper().showErrorDialog(errorMessage, null);
+ }
+ }
+ }
+
+ public void loadFishingOperation(FishingOperation bean) {
+
+ EditFishingOperationUI ui = getUI().getFishingOperationTabContent();
+
+ EditFishingOperationUIHandler handler = ui.getHandler();
+
+ EditFishingOperationUIModel editFishingOperationUIModel = ui.getModel();
+
+ editFishingOperationUIModel.setLoadingData(true);
+
+ editFishingOperationUIModel.removeAllAttachment(editFishingOperationUIModel.getAttachment());
+
+ handler.uninstallStartDateListener();
+ handler.uninstallCoordinatesListener();
+
+ if (bean == null) {
+
+ editFishingOperationUIModel.fromBean(
+ FishingOperations.newFishingOperation());
+
+ editFishingOperationUIModel.setFishingOperation(bean);
+
+ editFishingOperationUIModel.setAllSecondaryVessel(null);
+ editFishingOperationUIModel.setFishingSecondaryVessel(null);
+ editFishingOperationUIModel.setScientificSecondaryVessel(null);
+ editFishingOperationUIModel.setOnlyCruisSecondaryVessel(null);
+ editFishingOperationUIModel.setSecondaryVesselType(null);
+
+ handler.clearValidators();
+
+ handler.resetAllModels();
+
+ } else { //if (!bean.equals(editFishingOperationUIModel.getFishingOperation()) || handler.isAModelModified()) {
+
+ TuttiLocation strata = bean.getStrata();
+ TuttiLocation subStrata = bean.getSubStrata();
+ TuttiLocation location = bean.getLocation();
+
+ PersistenceService persistenceService = getContext().getPersistenceService();
+
+ Cruise cruise = bean.getCruise();
+ if (cruise != null) {
+
+ // update gear universe
+ // add a equals on id + rankOrder
+ List<Gear> gears = Lists.newArrayList();
+ for (Gear gear : cruise.getGear()) {
+ CaracteristicMap caracteristics =
+ persistenceService.getGearCaracteristics(
+ cruise.getId(),
+ gear.getId(),
+ gear.getRankOrder());
+
+ Gear toKeep = GearWithOriginalRankOrders.newGearWithOriginalRankOrder(gear);
+ toKeep.setCaracteristics(caracteristics);
+
+ gears.add(toKeep);
+ }
+ ui.getGearComboBox().setData(gears);
+ }
+
+ editFishingOperationUIModel.fromBean(bean);
+
+ // to be sure combo list will be reloaded
+ editFishingOperationUIModel.setStrata(null);
+ editFishingOperationUIModel.setSubStrata(null);
+ editFishingOperationUIModel.setLocation(null);
+
+ editFishingOperationUIModel.convertGearShootingCoordinatesFromDD();
+
+ if (strata != null) {
+ ui.getStrataComboBox().setSelectedItem(strata);
+ }
+
+ if (subStrata != null) {
+ ui.getSubStrataComboBox().setSelectedItem(subStrata);
+ }
+
+ if (location != null) {
+ ui.getLocationComboBox().setSelectedItem(location);
+ }
+
+ editFishingOperationUIModel.setFishingOperation(bean);
+
+ // update saisisseur selection
+ List<Person> saisisseur = editFishingOperationUIModel.getRecorderPerson();
+ ui.getRecorderPersonList().getHandler().setSelected(saisisseur);
+
+ //reset gear use feature tab
+ GearUseFeatureTabUI gearUseFeatureTabContent = ui.getGearUseFeatureTabContent();
+ gearUseFeatureTabContent.getHandler().reset(bean);
+
+ //reset vessel use feature tab
+ VesselUseFeatureTabUI vesselUseFeatureTabContent = ui.getVesselUseFeatureTabContent();
+ vesselUseFeatureTabContent.getHandler().reset(bean);
+
+ Integer objectId = editFishingOperationUIModel.getObjectId();
+ if (objectId != null) {
+
+ List<Attachment> attachments =
+ persistenceService.getAllAttachments(
+ editFishingOperationUIModel.getObjectType(),
+ objectId);
+
+ editFishingOperationUIModel.addAllAttachment(attachments);
+ }
+
+ Vessel cruiseVessel = getDataContext().getCruise().getVessel();
+ List<Vessel> scientificVessels = getDataContext().getScientificVessels();
+ List<Vessel> fishingVessels = getDataContext().getFishingVessels();
+
+ { // update all secondary vessel universe
+ List<Vessel> vessels = Lists.newArrayList();
+ vessels.addAll(scientificVessels);
+ vessels.addAll(fishingVessels);
+ vessels.remove(cruiseVessel);
+ editFishingOperationUIModel.setAllSecondaryVessel(vessels);
+ }
+
+ { // update scientific secondary vessel universe
+ List<Vessel> vessels = Lists.newArrayList();
+ vessels.addAll(scientificVessels);
+ vessels.remove(cruiseVessel);
+ editFishingOperationUIModel.setScientificSecondaryVessel(vessels);
+ }
+
+ { // update fishing secondary vessel universe
+ List<Vessel> vessels = Lists.newArrayList();
+ vessels.addAll(fishingVessels);
+ vessels.remove(cruiseVessel);
+ editFishingOperationUIModel.setFishingSecondaryVessel(vessels);
+ }
+
+ { // update only cruise vessel universe
+
+ List<FishingOperation> fishingOperation =
+ getModel().getFishingOperation();
+
+ Set<Vessel> vesselSet = Sets.newHashSet();
+ for (FishingOperation operation : fishingOperation) {
+ List<Vessel> secondaryVessel = persistenceService.getFishingOperationSecondaryVessel(operation.getId());
+ if (CollectionUtils.isNotEmpty(secondaryVessel)) {
+ vesselSet.addAll(secondaryVessel);
+ }
+ }
+ List<Vessel> vessel = Lists.newArrayList(vesselSet);
+ editFishingOperationUIModel.setOnlyCruisSecondaryVessel(vessel);
+ }
+
+ // will propagate to model
+ ui.getSecondaryVesselList().getModel().setSelected(bean.getSecondaryVessel());
+
+ editFishingOperationUIModel.setSecondaryVesselType(SecondaryVesselTypeEnum.ALL);
+
+ editFishingOperationUIModel.setModify(false);
+ handler.getFishingOperationMonitor().clearModified();
+ handler.registerValidator();
+ }
+
+ editFishingOperationUIModel.setLoadingData(false);
+
+ handler.installStartDateListener();
+ handler.installCoordinatesListener();
+ }
+
+ public void loadCatchBatch(FishingOperation bean) {
+
+ boolean empty = bean == null || TuttiEntities.isNew(bean);
+
+ EditCatchesUI ui = getUI().getCatchesTabContent();
+ TuttiBeanMonitor<EditCatchesUIModel> catchBatchMonitor =
+ ui.getHandler().getCatchBatchMonitor();
+
+ EditCatchesUIModel catchesUIModel = ui.getModel();
+
+ catchesUIModel.setLoadingData(true);
+
+ catchesUIModel.reset();
+
+ CatchBatch batch;
+
+ List<Attachment> attachments;
+
+ boolean catchNotFound;
+ boolean catchEnabled;
+
+ String operationId = bean == null ? null : bean.getId();
+
+ ProgressionModel progressionModel = getProgressionModel();
+ if (progressionModel == null) {
+ progressionModel = new ProgressionModel();
+ setProgressionModel(progressionModel);
+ }
+ progressionModel.adaptTotal(empty ? 1 : 6);
+
+ if (empty) {
+
+ // create a new CatchBatch
+ progressionModel.increments("Create new catch batch");
+ if (log.isDebugEnabled()) {
+ log.debug("Create a new CatchBatch (fishing operation is null)");
+ }
+ batch = CatchBatchs.newCatchBatch();
+ batch.setFishingOperation(bean);
+
+ attachments = Collections.emptyList();
+
+ catchEnabled = true;
+ catchNotFound = false;
+
+ } else {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Load existing CatchBatch from operation id: " +
+ operationId);
+ }
+
+ PersistenceService persistenceService =
+ getContext().getPersistenceService();
+
+ progressionModel.increments("Chargement de la capture");
+
+ boolean withCatchBath =
+ persistenceService.isFishingOperationWithCatchBatch(
+ operationId);
+
+ if (withCatchBath) {
+
+ // load it
+ try {
+ batch = persistenceService.getCatchBatchFromFishingOperation(operationId);
+ batch.setFishingOperation(bean);
+ Integer objectId = batch.getIdAsInt();
+ attachments = persistenceService.getAllAttachments(catchesUIModel.getObjectType(), objectId);
+ catchNotFound = false;
+ catchEnabled = true;
+
+ } catch (InvalidBatchModelException e) {
+
+ // batch is not compatible with Tutti
+ if (log.isDebugEnabled()) {
+ log.debug("Invalid batch model", e);
+ }
+ batch = null;
+ attachments = Collections.emptyList();
+
+ catchEnabled = false;
+ catchNotFound = false;
+ }
+ } else {
+
+ // no catch batch
+ batch = null;
+ attachments = Collections.emptyList();
+
+ catchEnabled = false;
+ catchNotFound = true;
+ }
+ }
+
+ setCatch(attachments,
+ catchesUIModel,
+ catchBatchMonitor,
+ batch,
+ true,
+ catchEnabled,
+ catchNotFound);
+
+
+ // 4) Propagate new selected fishingoperation to others tabs
+
+ FishingOperation operationToLoad = batch == null ? null : bean;
+
+ boolean catchValid = true;
+
+ try {
+ progressionModel.increments("Chargement des captures Espèces");
+
+ ui.getSpeciesTabContent().getHandler().selectFishingOperation(operationToLoad);
+ } catch (InvalidBatchModelException e) {
+
+ // invalid sample category model for species batches
+ if (log.isDebugEnabled()) {
+ log.debug("Invalid sample category model for species batches", e);
+ }
+ errorMessages.add(e.getMessage());
+ catchValid = false;
+ }
+
+ try {
+ progressionModel.increments("Chargement des captures Benthos");
+ ui.getBenthosTabContent().getHandler().selectFishingOperation(operationToLoad);
+ } catch (InvalidBatchModelException e) {
+
+ // invalid sample category model for benthos batches
+ if (log.isDebugEnabled()) {
+ log.debug("Invalid sample category model for benthos batches", e);
+ }
+ errorMessages.add(e.getMessage());
+ catchValid = false;
+ }
+
+ if (catchValid) {
+
+ // load other tabs
+
+ progressionModel.increments("Chargmenent des macro-déchets");
+ ui.getMarineLitterTabContent().getHandler().selectFishingOperation(operationToLoad);
+
+ progressionModel.increments("Chargement des captures accidentelles");
+ ui.getAccidentalTabContent().getHandler().selectFishingOperation(operationToLoad);
+
+ progressionModel.increments("Chargement des données individuelles");
+ ui.getIndividualObservationTabContent().getHandler().selectFishingOperation(operationToLoad);
+
+ } else {
+
+ // remove catch
+ setCatch(Collections.<Attachment>emptyList(),
+ catchesUIModel,
+ catchBatchMonitor,
+ null,
+ false,
+ false,
+ false);
+ }
+
+ catchesUIModel.setLoadingData(false);
+ }
+
+ @Override
+ public void postFailedAction(Throwable error) {
+ super.postFailedAction(error);
+ }
+
+
+ protected void setCatch(List<Attachment> attachments,
+ EditCatchesUIModel catchesUIModel,
+ TuttiBeanMonitor<EditCatchesUIModel> catchBatchMonitor,
+ CatchBatch batch,
+ boolean sampleModelValid,
+ boolean catchEnabled,
+ boolean catchNotFound) {
+
+ getModel().setCatchEnabled(catchEnabled);
+ getModel().setCatchNotFound(catchNotFound);
+ getModel().setSampleCatchModelValid(sampleModelValid);
+
+ catchesUIModel.fromEntity(batch);
+ catchesUIModel.addAllAttachment(attachments);
+
+ catchesUIModel.setModify(false);
+ catchBatchMonitor.clearModified();
+ }
+
+ public void setInternalAction(boolean internalAction) {
+ this.internalAction = internalAction;
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditGearCaracteristicsAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditGearCaracteristicsAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditGearCaracteristicsAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditGearCaracteristicsAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,81 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrder;
+import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrders;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUIHandler;
+import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUIModel;
+import fr.ifremer.tutti.ui.swing.content.cruise.GearCaracteristicsEditorUI;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.1
+ */
+public class EditGearCaracteristicsAction extends AbstractTuttiAction<EditCruiseUIModel, EditCruiseUI, EditCruiseUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditGearCaracteristicsAction.class);
+
+ protected final PersistenceService persistenceService;
+
+ public EditGearCaracteristicsAction(EditCruiseUIHandler handler) {
+ super(handler, false);
+ persistenceService = getContext().getPersistenceService();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ GearCaracteristicsEditorUI editor = getUI().getGearCaracteristicsEditor();
+ editor.getModel().setEditable(true);
+
+ GearWithOriginalRankOrder gear =
+ EditCruiseUIHandler.GEAR_EDIT_CONTEXT.getContextValue(getUI());
+
+ CaracteristicMap caracteristics =
+ persistenceService.getGearCaracteristics(
+ getDataContext().getCruise().getId(),
+ gear.getId(),
+ gear.getOriginalRankOrder());
+
+ GearWithOriginalRankOrder gearToView =
+ GearWithOriginalRankOrders.newGearWithOriginalRankOrder(gear);
+ gearToView.setCaracteristics(caracteristics);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will edit gear " + decorate(gearToView) +
+ " with " + gearToView.getCaracteristics().size() + " caracteristics.");
+ }
+ editor.getModel().setGear(gearToView);
+
+ getUI().getMainPanelLayout().setSelected(EditCruiseUIHandler.GEAR_CARACTERISTICS_CARD);
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditProgramAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProgramAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditProgramAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditProgramAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,56 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Opens the program edition screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class EditProgramAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(EditProgramAction.class);
+
+ public EditProgramAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_PROGRAM);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkState(getContext().isProgramFilled());
+ if (log.isInfoEnabled()) {
+ log.info("Edit program: " + getContext().getProgramId());
+ }
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,154 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocols;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import jaxx.runtime.context.JAXXContextEntryDef;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JOptionPane;
+import javax.swing.UIManager;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Opens the protocol edition screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class EditProtocolAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(EditProtocolAction.class);
+
+ public static final JAXXContextEntryDef<TuttiProtocol> CLEAN_PROTOCOL_ENTRY = new JAXXContextEntryDef<TuttiProtocol>("cleanProtocol", TuttiProtocol.class);
+
+ public EditProtocolAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_PROTOCOL);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ CLEAN_PROTOCOL_ENTRY.removeContextValue(getContext().getMainUI());
+
+ boolean doAction = super.prepareAction();
+ if (doAction) {
+
+ // check that protocol is compatible with sample category model
+ SampleCategoryModel sampleCategoryModel =
+ getDataContext().getSampleCategoryModel();
+
+ TuttiProtocol protocol = getDataContext().getProtocol();
+
+ Set<Integer> badCategories = Sets.newHashSet();
+
+ TuttiProtocols.checkSampleCategories(sampleCategoryModel,
+ protocol,
+ badCategories);
+
+ if (!badCategories.isEmpty()) {
+
+ // detect some bad categories
+ if (log.isWarnEnabled()) {
+ log.warn("There is some bad categories: " + badCategories);
+ }
+
+ String message = TuttiProtocols.getBadCategoriesMessage(
+ badCategories,
+ getDecorator(Caracteristic.class, null),
+ getContext().getPersistenceService());
+
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ message,
+ _("tutti.common.askBeforeEditProtocol.help"));
+ int response = JOptionPane.showOptionDialog(
+ getContext().getActionUI(),
+ htmlMessage,
+ _("tutti.common.askBeforeEditProtocol.title"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.WARNING_MESSAGE,
+ UIManager.getIcon("warning"),
+ new Object[]{_("tutti.option.cleanAndEdit"), _("tutti.option.edit"), _("tutti.option.cancel")},
+ _("tutti.option.cancel")
+ );
+
+ switch (response) {
+ case 0:
+ // edit and clean
+ if (log.isInfoEnabled()) {
+ log.info("Clean and edit");
+ }
+
+ protocol = getContext().getPersistenceService().getProtocol(getContext().getProtocolId());
+
+ CLEAN_PROTOCOL_ENTRY.setContextValue(getContext().getMainUI(), protocol);
+
+ TuttiProtocols.removeBadCategories(sampleCategoryModel,
+ protocol);
+
+ break;
+
+ case 1:
+ // edit with no modification
+ if (log.isInfoEnabled()) {
+ log.info("Edit with no cleaning");
+ }
+ break;
+
+ default:
+
+ // cancel
+ doAction = false;
+ }
+
+ }
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkState(getContext().isProtocolFilled());
+ if (log.isInfoEnabled()) {
+ log.info("Edit protocol: " + getContext().getProtocolId());
+ }
+ createProgressionModelIfRequired(4);
+ super.doAction();
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSampleCategoryModelAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSampleCategoryModelAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSampleCategoryModelAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSampleCategoryModelAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,57 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To show {@link TuttiScreen#EDIT_SAMPLE_CATEGORY_MODEL} config screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.4
+ */
+public class EditSampleCategoryModelAction extends AbstractChangeScreenAction {
+
+ public EditSampleCategoryModelAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_SAMPLE_CATEGORY_MODEL);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+ if (result) {
+ result = askAdminPassword(
+ _("tutti.editSampleCategoryModel.passwordDialog.message"),
+ _("tutti.editSampleCategoryModel.passwordDialog.title"),
+ _("tutti.editSampleCategoryModel.passwordDialog.error.message"),
+ _("tutti.editSampleCategoryModel.passwordDialog.error.title")
+ );
+ }
+ return result;
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedCruiseAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedCruiseAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedCruiseAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,57 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Opens the cruise edition screen to edit the selected cruise.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class EditSelectedCruiseAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditSelectedCruiseAction.class);
+
+ public EditSelectedCruiseAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_CRUISE);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkState(getContext().isCruiseFilled());
+ if (log.isInfoEnabled()) {
+ log.info("Edit cruise: " + getContext().getCruiseId());
+ }
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedCruiseCatchesAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedCruiseCatchesAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedCruiseCatchesAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedCruiseCatchesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,60 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.ValidationService;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Opens the operations edition screen to edit the selected operations.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class EditSelectedCruiseCatchesAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditSelectedCruiseCatchesAction.class);
+
+ public EditSelectedCruiseCatchesAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_FISHING_OPERATION);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkState(getContext().isCruiseFilled());
+ if (log.isInfoEnabled()) {
+ log.info("Edit operations of cruise: " + getContext().getCruiseId());
+ }
+ getContext().setValidationContext(ValidationService.VALIDATION_CONTEXT_EDIT);
+ super.doAction();
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedProgramAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedProgramAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedProgramAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedProgramAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,57 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Opens the program edition screen to edit the selected program.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class EditSelectedProgramAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(EditSelectedProgramAction.class);
+
+ public EditSelectedProgramAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_PROGRAM);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkState(getContext().isProgramFilled());
+ if (log.isInfoEnabled()) {
+ log.info("Edit program: " + getContext().getProgramId());
+ }
+ super.doAction();
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/EditSelectedProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,59 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Opens the protocol edition screen to edit the selected protocol.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class EditSelectedProtocolAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditSelectedProtocolAction.class);
+
+ public EditSelectedProtocolAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_PROTOCOL);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkState(getContext().isProtocolFilled());
+ if (log.isDebugEnabled()) {
+ log.debug("Edit protocol: " + getContext().getProtocolId());
+ }
+ createProgressionModelIfRequired(4);
+ super.doAction();
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAccidentalMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ExportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAccidentalMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAccidentalMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,74 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUIModel;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public class ExportAccidentalMultiPostAction
+ extends AbstractExportMultiPostAction<AccidentalBatchUIModel, AccidentalBatchUI, AccidentalBatchUIHandler> {
+
+ public ExportAccidentalMultiPostAction(AccidentalBatchUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected String getFileExtension() {
+ return "tuttiAccidental";
+ }
+
+ @Override
+ protected String getFileExtensionDescription() {
+ return _("tutti.common.file.tuttiAccidental");
+ }
+
+ @Override
+ protected String getFileChooserTitle() {
+ return _("tutti.editAccidentalBatch.action.exportMultiPost.destinationFile.title");
+ }
+
+ @Override
+ protected String getFileChooserButton() {
+ return _("tutti.editAccidentalBatch.action.exportMultiPost.destinationFile.button");
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ multiPostImportExportService.exportAccidentalCatch(file, currentOperation);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.editAccidentalBatch.action.exportMultiPost.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAllCaracteristicAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportAllCaracteristicAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAllCaracteristicAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAllCaracteristicAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,98 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.protocol.ProtocolImportExportService;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To export all caracteristics.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportAllCaracteristicAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportAllCaracteristicAction.class);
+
+ protected File file;
+
+ public ExportAllCaracteristicAction(EditProtocolUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = saveFile(
+ "tuttiProtocol-" + getModel().getName() + "-allCaracteristics",
+ "csv",
+ _("tutti.editProtocol.title.choose.caracteristicExportFile"),
+ _("tutti.editProtocol.action.chooseProtocolCaracteristicFile"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export all caracteristic to file: " + file);
+ }
+
+ // export protocol caracteristics
+ ProtocolImportExportService service =
+ getContext().getTuttiProtocolImportExportService();
+
+ service.exportAllCaracteristic(file, getModel().getAllCaracteristic());
+
+ sendMessage(_("tutti.flash.info.all.caractristic.exported", file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAndCleanDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ExportAndCleanDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAndCleanDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportAndCleanDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,136 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.ProgressionModel;
+import fr.ifremer.tutti.ui.swing.RunTutti;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To export a db attached to Tutti.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportAndCleanDbAction extends AbstractMainUITuttiAction {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportAndCleanDbAction.class);
+
+ public static final DateFormat df = new SimpleDateFormat("yyy-MM-dd");
+
+ protected File file;
+
+ public ExportAndCleanDbAction(MainUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ file = null;
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // ask user file where to export db
+
+ // choose file to import
+ file = saveFile(
+ "tutti-db-" + df.format(new Date()),
+ "zip",
+ _("tutti.dbManager.title.choose.dbExportFile"),
+ _("tutti.dbManager.action.chooseDbExportFile"),
+ "^.*\\.zip", _("tutti.common.file.zip")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export db to " + file);
+ }
+
+ ProgressionModel progressionModel = new ProgressionModel();
+ setProgressionModel(progressionModel);
+ progressionModel.setTotal(3);
+
+ // close db
+
+ progressionModel.setMessage(_("tutti.exportDb.step.closeDb"));
+
+ // clear all caches
+ getContext().getPersistenceService().clearAllCaches();
+
+ // set to not reload a real db
+ getContext().setDbLoaded(false);
+
+ // close services + repon a fake persistence service
+ getHandler().reloadPersistenceService();
+
+ // clean db context
+ getContext().clearDbContext();
+
+ // export db
+
+ progressionModel.increments(1);
+ progressionModel.setMessage(_("tutti.exportDb.step.createArchive", file));
+
+ getContext().getPersistenceService().exportDb(file);
+
+ // clean files
+
+ progressionModel.increments(1);
+ progressionModel.setMessage(_("tutti.exportDb.step.reloadApplication"));
+
+ // Close the application, will exit and restart application
+ RunTutti.closeTutti(getHandler(), RunTutti.DELETE_DB_EXIT_CODE);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ sendMessage(_("tutti.flash.info.db.exported.and.clean", file));
+
+ // make sure title is reloaded
+ getUI().getHandler().changeTitle();
+ }
+
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportBenthosMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ExportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportBenthosMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportBenthosMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,73 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIModel;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public class ExportBenthosMultiPostAction extends AbstractExportMultiPostAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
+
+ public ExportBenthosMultiPostAction(BenthosBatchUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected String getFileExtension() {
+ return "tuttiBenthos";
+ }
+
+ @Override
+ protected String getFileExtensionDescription() {
+ return _("tutti.common.file.tuttiBenthos");
+ }
+
+ @Override
+ protected String getFileChooserTitle() {
+ return _("tutti.editBenthosBatch.action.exportMultiPost.destinationFile.title");
+ }
+
+ @Override
+ protected String getFileChooserButton() {
+ return _("tutti.editBenthosBatch.action.exportMultiPost.destinationFile.button");
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ multiPostImportExportService.exportBenthos(file, currentOperation);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.editBenthosBatch.action.exportMultiPost.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,132 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.ApplicationBusinessException;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.service.export.generic.TuttiExportService;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUIHandler;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To export a selected cruise.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class ExportCruiseAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUI, SelectCruiseUIHandler> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(ExportCruiseAction.class);
+
+ protected File file;
+
+ public ExportCruiseAction(SelectCruiseUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ Cruise cruise = getModel().getCruise();
+
+ // choose file to export
+ file = saveFile(
+ "exportCruise-" + cruise.getName(),
+ "zip",
+ _("tutti.selectCruise.title.choose.exportCruiseFile"),
+ _("tutti.selectCruise.action.chooseCruiseExportFile"),
+ "^.+\\.zip$", _("tutti.common.file.zip")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Cruise cruise = getModel().getCruise();
+ Preconditions.checkNotNull(cruise);
+ Preconditions.checkNotNull(file);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will save cruise " + cruise.getId() +
+ " to file: " + file);
+ }
+
+ ProgressionModel progressionModel = new ProgressionModel();
+ setProgressionModel(progressionModel);
+ // (check cruise / export cruise / gear caracteristics / operation / parameter / accidental catches / catches / individual observation / species) / zip
+ progressionModel.setTotal(10);
+
+// TuttiProtocol protocol = null;
+// if (getContext().isProtocolFilled()) {
+// protocol = getDataContext().getProtocol();
+// if (log.isInfoEnabled()) {
+// log.info("Will use protocol " + protocol.getName());
+// }
+// }
+
+ ApplicationBusinessException exportError = null;
+
+ TuttiExportService service = getContext().getTuttiExportService();
+ try {
+ service.exportCruise(cruise.getId(), file, progressionModel);
+ } catch (ApplicationBusinessException e) {
+
+ String errorMessage;
+ errorMessage = _("tutti.exportCruise.action.exportErrors", cruise.getName(), e.getMessage());
+ exportError = new ApplicationBusinessException(errorMessage);
+ }
+
+ sendMessage(_("tutti.exportCruise.action.success",
+ cruise.getName(), file.getName()));
+
+ handler.resetEditCruiseAction();
+
+ if (exportError != null) {
+ throw exportError;
+ }
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseForSumatraAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,108 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportService;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.DateUtil;
+
+import java.io.File;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Opens a file chooser, exports the cruise catches into the selected file and open the default email editor.
+ *
+ * @author kmorin <morin(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportCruiseForSumatraAction extends AbstractMainUITuttiAction {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportCruiseForSumatraAction.class);
+
+ protected File file;
+
+ public ExportCruiseForSumatraAction(MainUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ String date = DateUtil.formatDate(new Date(), "dd-MM-yyyy");
+ // choose file to export
+ file = saveFile(
+ String.format("sumatra_%s_%s", getDataContext().getCruise().getName(), date),
+ "csv",
+ _("tutti.exportCruiseForSumatra.title.choose.exportFile"),
+ _("tutti.exportCruiseForSumatra.action.chooseFile"),
+ "^.+\\.csv$", _("tutti.common.file.csv")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Cruise cruise = getDataContext().getCruise();
+ Preconditions.checkNotNull(cruise);
+ Preconditions.checkNotNull(file);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will export cruise " + cruise.getId() +
+ " to file: " + file);
+ }
+
+ // export catches
+ CatchesSumatraExportService service =
+ getContext().getCatchesSumatraExportService();
+ service.exportCruiseForSumatra(file, cruise.getId());
+
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.exportCruiseForSumatra.action.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseValidationMessagesAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ExportCruiseValidationMessagesAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseValidationMessagesAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseValidationMessagesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,86 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.service.catches.ValidateCruiseOperationsService;
+import fr.ifremer.tutti.ui.swing.content.cruise.ValidateCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.cruise.ValidateCruiseUIHandler;
+import fr.ifremer.tutti.ui.swing.content.cruise.ValidateCruiseUIModel;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.0.1
+ */
+public class ExportCruiseValidationMessagesAction extends AbstractTuttiAction<ValidateCruiseUIModel, ValidateCruiseUI, ValidateCruiseUIHandler> {
+
+ protected File file;
+
+ /** Validation service. */
+ protected ValidateCruiseOperationsService validationService = getContext().getValidateCruiseOperationsService();
+
+ public ExportCruiseValidationMessagesAction(ValidateCruiseUIHandler handler) {
+ super(handler, false);
+ setActionDescription(_("tutti.validateCruise.action.export.all.tip"));
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+ // choose file to export
+ file = saveFile(
+ String.format("validation_%s", getDataContext().getCruise().getName()),
+ "txt",
+ _("tutti.validateCruise.action.export.all.chooseFile.title"),
+ _("tutti.validateCruise.action.export.all.chooseFile.label")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ ValidateCruiseUIModel uiModel = getModel();
+ validationService.exportValidationResults(file, uiModel.getValidator());
+ }
+
+ @Override
+ public void releaseAction() {
+ super.releaseAction();
+ file = null;
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.validateCruise.action.export.all.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ExportDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,130 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.ProgressionModel;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To export a db attached to Tutti.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportDbAction extends AbstractMainUITuttiAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(ExportDbAction.class);
+
+ public static final int TOTAL_STEP = 3;
+
+ protected File file;
+
+ public static final DateFormat df = new SimpleDateFormat("yyy-MM-dd");
+
+ public ExportDbAction(MainUIHandler handler) {
+ super(handler, true);
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ file = null;
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // ask user file where to export db
+ file = saveFile(
+ "tutti-db-" + df.format(new Date()),
+ "zip",
+ _("tutti.dbManager.title.choose.dbExportFile"),
+ _("tutti.dbManager.action.chooseDbExportFile"),
+ "^.*\\.zip", _("tutti.common.file.zip")
+ );
+ doAction = file != null;
+ }
+
+ if (doAction) {
+
+ ProgressionModel progressionModel = new ProgressionModel();
+ setProgressionModel(progressionModel);
+ progressionModel.setTotal(TOTAL_STEP);
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export db to " + file);
+ }
+
+ ProgressionModel progressionModel = getProgressionModel();
+
+ // close db
+
+ progressionModel.setMessage(_("tutti.exportDb.step.closeDb"));
+
+ getContext().setDbLoaded(false);
+ getHandler().reloadPersistenceService();
+
+ // export
+
+ progressionModel.increments(_("tutti.exportDb.step.createArchive", file));
+
+ getContext().getPersistenceService().exportDb(file);
+
+ // reopen db
+
+ progressionModel.increments(_("tutti.exportDb.step.openDb"));
+
+ getContext().setDbLoaded(true);
+ getHandler().reloadPersistenceService();
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.flash.info.db.exported", file));
+
+ // make sure title is reloaded
+ getUI().getHandler().changeTitle();
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ExportFishingOperationForSumatraAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,117 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.DateUtil;
+
+import java.io.File;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Created on 10/1/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 2.7
+ */
+public class ExportFishingOperationForSumatraAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportFishingOperationForSumatraAction.class);
+
+ protected File file;
+
+ public ExportFishingOperationForSumatraAction(EditCatchesUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+
+ String date = DateUtil.formatDate(new Date(), "dd-MM-yyyy");
+ // choose file to export
+ file = saveFile(
+ String.format("sumatra_%s_%s_%s", getDataContext().getCruise().getName(), fishingOperation.getId(), date),
+ "csv",
+ _("tutti.exportFishingOperationForSumatra.title.choose.exportFile"),
+ _("tutti.exportFishingOperationForSumatra.action.chooseFile"),
+ "^.+\\.csv$", _("tutti.common.file.csv")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Cruise cruise = getDataContext().getCruise();
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ Preconditions.checkNotNull(cruise);
+ Preconditions.checkNotNull(fishingOperation);
+ Preconditions.checkNotNull(file);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will export fishingOperation " + cruise.getId() + "-" + fishingOperation.getStationNumber() +
+ " to file: " + file);
+ }
+
+ // export catches
+ CatchesSumatraExportService service =
+ getContext().getCatchesSumatraExportService();
+ service.exportFishingOperationForSumatra(file,
+ cruise.getId(),
+ fishingOperation.getId());
+
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.exportFishingOperationForSumatra.action.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationReportAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ExportFishingOperationReportAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationReportAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationReportAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,112 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.service.export.pdf.CatchesPdfExportService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Opens a file chooser, exports the cruise catches into the selected file and open the default email editor.
+ *
+ * @author kmorin <morin(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportFishingOperationReportAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportFishingOperationReportAction.class);
+
+ protected File file;
+
+ public ExportFishingOperationReportAction(EditCatchesUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ Cruise cruise = getDataContext().getCruise();
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ // choose file to export
+ file = saveFile(
+ "exportFishingOperation-" + cruise.getName() + "-" + fishingOperation.getStationNumber(),
+ "pdf",
+ _("tutti.exportFishingOperationReport.title.choose.exportFile"),
+ _("tutti.exportFishingOperationReport.action.chooseFile"),
+ "^.+\\.pdf$", _("tutti.common.file.pdf")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Cruise cruise = getDataContext().getCruise();
+ FishingOperation fishingOperation = getModel().getFishingOperation();
+ Preconditions.checkNotNull(cruise);
+ Preconditions.checkNotNull(fishingOperation);
+ Preconditions.checkNotNull(file);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will export fishingOperation " + cruise.getId() + "-" + fishingOperation.getStationNumber() +
+ " to file: " + file);
+ }
+
+ // export catches
+ CatchesPdfExportService service =
+ getContext().getGeneratePDFService();
+ service.generateFishingOperationPDFFile(file, fishingOperation.getId(), getConfig().getI18nLocale());
+
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.exportFishingOperationReport.action.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportIndividualObservationMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ExportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportIndividualObservationMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportIndividualObservationMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,74 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUIModel;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public class ExportIndividualObservationMultiPostAction
+ extends AbstractExportMultiPostAction<IndividualObservationBatchUIModel, IndividualObservationBatchUI, IndividualObservationBatchUIHandler> {
+
+ public ExportIndividualObservationMultiPostAction(IndividualObservationBatchUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected String getFileExtension() {
+ return "tuttiIndividualObservation";
+ }
+
+ @Override
+ protected String getFileExtensionDescription() {
+ return _("tutti.common.file.tuttiIndividualObservation");
+ }
+
+ @Override
+ protected String getFileChooserTitle() {
+ return _("tutti.editIndividualObservationBatch.action.exportMultiPost.destinationFile.title");
+ }
+
+ @Override
+ protected String getFileChooserButton() {
+ return _("tutti.editIndividualObservationBatch.action.exportMultiPost.destinationFile.button");
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ multiPostImportExportService.exportIndividualObservation(file, currentOperation);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.editIndividualObservationBatch.action.exportMultiPost.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportMarineLitterMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ExportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportMarineLitterMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportMarineLitterMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,73 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUIModel;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public class ExportMarineLitterMultiPostAction extends AbstractExportMultiPostAction<MarineLitterBatchUIModel, MarineLitterBatchUI, MarineLitterBatchUIHandler> {
+
+ public ExportMarineLitterMultiPostAction(MarineLitterBatchUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected String getFileExtension() {
+ return "tuttiMarineLitter";
+ }
+
+ @Override
+ protected String getFileExtensionDescription() {
+ return _("tutti.common.file.tuttiMarineLitter");
+ }
+
+ @Override
+ protected String getFileChooserTitle() {
+ return _("tutti.editMarineLitterBatch.action.exportMultiPost.destinationFile.title");
+ }
+
+ @Override
+ protected String getFileChooserButton() {
+ return _("tutti.editMarineLitterBatch.action.exportMultiPost.destinationFile.button");
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ multiPostImportExportService.exportMarineLitter(file, currentOperation);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.editMarineLitterBatch.action.exportMultiPost.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportOperationValidationMessagesAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ExportOperationValidationMessagesAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportOperationValidationMessagesAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportOperationValidationMessagesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,91 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.service.DecoratorService;
+import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
+import fr.ifremer.tutti.ui.swing.content.cruise.ValidateCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.cruise.ValidateCruiseUIHandler;
+import fr.ifremer.tutti.ui.swing.content.cruise.ValidateCruiseUIModel;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.0.1
+ */
+public class ExportOperationValidationMessagesAction extends AbstractTuttiAction<ValidateCruiseUIModel, ValidateCruiseUI, ValidateCruiseUIHandler> {
+
+ protected File file;
+
+ /** Validation service. */
+ protected ValidateCruiseOperationsService validationService = getContext().getValidateCruiseOperationsService();
+
+ public ExportOperationValidationMessagesAction(ValidateCruiseUIHandler handler) {
+ super(handler, false);
+ setActionDescription(_("tutti.validateCruise.action.export.operation.tip"));
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = saveFile(
+ String.format("validation_%s",
+ decorate(getModel().getSelectedFishingOperation(), DecoratorService.FILE_NAME_COMPATIBLE)),
+ "txt",
+ _("tutti.validateCruise.action.export.operation.chooseFile.title"),
+ _("tutti.validateCruise.action.export.operation.chooseFile.label")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ ValidateCruiseUIModel uiModel = getModel();
+ FishingOperation operation = getModel().getSelectedFishingOperation();
+ validationService.exportValidationResult(file, operation, uiModel.getValidator().get(operation));
+ }
+
+ @Override
+ public void releaseAction() {
+ super.releaseAction();
+ file = null;
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.validateCruise.action.export.operation.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProgramAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProgramAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProgramAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,135 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.ApplicationBusinessException;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.service.export.generic.TuttiExportService;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUIHandler;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To export a selected program.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class ExportProgramAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUI, SelectCruiseUIHandler> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(ExportProgramAction.class);
+
+ protected File file;
+
+ public ExportProgramAction(SelectCruiseUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ Program program = getModel().getProgram();
+ if (doAction) {
+
+ // choose file to export
+ file = saveFile(
+ "exportProgram-" + program.getName(), "zip",
+ _("tutti.selectCruise.title.choose.exportProgramFile"),
+ _("tutti.selectCruise.action.chooseProgramExportFile"),
+ "^.+\\.zip$", _("tutti.common.file.zip")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Program program = getModel().getProgram();
+ Preconditions.checkNotNull(program);
+ Preconditions.checkNotNull(file);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will save program " + program.getId() +
+ " to file: " + file);
+ }
+
+ // nbCruise * (check cruise / export cruise / gear caracteristics / operation / parameter / catches / individual observation / accidental catches / species) + zip
+ List<Cruise> allCruise =
+ getContext().getPersistenceService().getAllCruise(program.getId());
+
+ ProgressionModel progressionModel = new ProgressionModel();
+ setProgressionModel(progressionModel);
+ progressionModel.setTotal(9 * allCruise.size() + 1);
+
+// TuttiProtocol protocol = null;
+// if (getContext().isProtocolFilled()) {
+// protocol = getDataContext().getProtocol();
+// if (log.isInfoEnabled()) {
+// log.info("Will use protocol " + protocol.getName());
+// }
+// }
+ ApplicationBusinessException exportError = null;
+
+ TuttiExportService service = getContext().getTuttiExportService();
+ try {
+ service.exportProgram(program.getId(), file, progressionModel);
+ } catch (ApplicationBusinessException e) {
+
+ String errorMessage;
+ errorMessage = _("tutti.exportProgram.action.exportErrors", program.getName(), e.getMessage());
+
+ exportError = new ApplicationBusinessException(errorMessage);
+ }
+
+ handler.resetEditProgramAction();
+
+ sendMessage(_("tutti.exportProgram.action.success", program.getName(),
+ file.getName()));
+
+ if (exportError != null) {
+ throw exportError;
+ }
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,110 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUIHandler;
+import fr.ifremer.tutti.ui.swing.content.home.SelectCruiseUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Opens a file chooser and exports the protocol into the selected file.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportProtocolAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUI, SelectCruiseUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportProtocolAction.class);
+
+ protected File file;
+
+ public ExportProtocolAction(SelectCruiseUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ TuttiProtocol protocol = getModel().getProtocol();
+ // choose file to export
+ file = saveFile(
+ "protocol-" + protocol.getName().replaceAll(" ", "_"),
+ "tuttiProtocol",
+ _("tutti.selectCruise.title.choose.exportFile"),
+ _("tutti.selectCruise.action.exportProtocol"),
+ "^.+\\.tuttiProtocol$", _("tutti.common.file.protocol")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ TuttiProtocol protocol = getModel().getProtocol();
+ Preconditions.checkNotNull(protocol);
+ Preconditions.checkNotNull(file);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will save protocol " + protocol.getId() +
+ " to file: " + file);
+ }
+
+ // export protocol
+ ProtocolImportExportService service =
+ getContext().getTuttiProtocolImportExportService();
+ service.exportProtocol(protocol, file);
+
+ getHandler().resetEditProtolAction();
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ TuttiProtocol protocol = getModel().getProtocol();
+ sendMessage(_("tutti.exportProtocol.action.success", protocol.getName(), file.getName()));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolBenthosAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolBenthosAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolBenthosAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolBenthosAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,117 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
+import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesRowModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To export protocol benthos.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2
+ */
+public class ExportProtocolBenthosAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportProtocolBenthosAction.class);
+
+ private File file;
+
+ public ExportProtocolBenthosAction(EditProtocolUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = saveFile(
+ "tuttiProtocol-" + getModel().getName() + "-benthos",
+ "csv",
+ _("tutti.editProtocol.title.choose.benthosExportFile"),
+ _("tutti.editProtocol.action.chooseProtocolBenthosFile"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export protocol benthos to file: " + file);
+ }
+
+ EditProtocolUIModel model = getModel();
+
+ // build benthos protocol to export
+
+ List<SpeciesProtocol> protocols = Lists.newArrayList();
+ for (EditProtocolSpeciesRowModel row : model.getBenthosRow()) {
+ if (row.isValid()) {
+ protocols.add(row.toBean());
+ }
+ }
+
+ // import
+ ProtocolImportExportService service =
+ getContext().getTuttiProtocolImportExportService();
+
+ service.exportProtocolBenthos(file,
+ protocols,
+ model.getAllCaracteristic(),
+ model.getAllReferentSpeciesByTaxonId());
+
+ sendMessage(_("tutti.flash.info.species.exported.from.protocol",
+ file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolCaracteristicAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolCaracteristicAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolCaracteristicAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolCaracteristicAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,105 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To import protocol caracteristics.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportProtocolCaracteristicAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportProtocolCaracteristicAction.class);
+
+ private File file;
+
+ public ExportProtocolCaracteristicAction(EditProtocolUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = saveFile(
+ "tuttiProtocol-" + getModel().getName() + "-caracteristics",
+ "csv",
+ _("tutti.editProtocol.title.choose.caracteristicExportFile"),
+ _("tutti.editProtocol.action.chooseProtocolCaracteristicFile"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export protocol caracteristic to file: " + file);
+ }
+
+ // bind to a protocol
+ TuttiProtocol protocol = getModel().toBean();
+
+ // export protocol caracteristics
+ ProtocolImportExportService service =
+ getContext().getTuttiProtocolImportExportService();
+
+ service.exportProtocolCaracteristic(file,
+ protocol,
+ getModel().getAllCaracteristic());
+
+ sendMessage(_("tutti.flash.info.caractristic.exported.from.protocol",
+ file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolSpeciesAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolSpeciesAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportProtocolSpeciesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,117 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
+import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesRowModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To export protocol species.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportProtocolSpeciesAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportProtocolSpeciesAction.class);
+
+ private File file;
+
+ public ExportProtocolSpeciesAction(EditProtocolUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = saveFile(
+ "tuttiProtocol-" + getModel().getName() + "-species",
+ "csv",
+ _("tutti.editProtocol.title.choose.speciesExportFile"),
+ _("tutti.editProtocol.action.chooseProtocolSpeciesFile"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export protocol species to file: " + file);
+ }
+
+ EditProtocolUIModel model = getModel();
+
+ // build species protocol to export
+
+ List<SpeciesProtocol> protocols = Lists.newArrayList();
+ for (EditProtocolSpeciesRowModel row : model.getSpeciesRow()) {
+ if (row.isValid()) {
+ protocols.add(row.toBean());
+ }
+ }
+
+ // import
+ ProtocolImportExportService service =
+ getContext().getTuttiProtocolImportExportService();
+
+ service.exportProtocolSpecies(file,
+ protocols,
+ model.getAllCaracteristic(),
+ model.getAllReferentSpeciesByTaxonId());
+
+ sendMessage(_("tutti.flash.info.species.exported.from.protocol",
+ file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportPupitriAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportPupitriAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportPupitriAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,115 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.pupitri.PupitriImportExportService;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesRowModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To export protocol species.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportPupitriAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportPupitriAction.class);
+
+ private File file;
+
+ public ExportPupitriAction(EditProtocolUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = saveFile(
+ "tuttiProtocol-" + getModel().getName() + "-pupitri",
+ "csv",
+ _("tutti.editProtocol.title.choose.speciesExportFile"),
+ _("tutti.editProtocol.action.chooseProtocolSpeciesFile")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export protocol species to file: " + file);
+ }
+
+ EditProtocolUIModel model = getModel();
+
+ // build species protocol to export
+
+ List<Species> speciesList = Lists.newArrayList();
+ for (EditProtocolSpeciesRowModel row : model.getSpeciesRow()) {
+ if (row.isValid()) {
+ Species species = row.getSpecies();
+ species.setSurveyCode(row.getSpeciesSurveyCode());
+ speciesList.add(species);
+ }
+ }
+
+ // import
+ PupitriImportExportService service =
+ getContext().getTuttiPupitriImportExportService();
+
+ service.exportSpecies(speciesList, file);
+
+ sendMessage(_("tutti.flash.info.species.exported.from.protocol",
+ file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportSpeciesMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ExportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportSpeciesMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportSpeciesMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,73 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public class ExportSpeciesMultiPostAction extends AbstractExportMultiPostAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
+
+ public ExportSpeciesMultiPostAction(SpeciesBatchUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected String getFileExtension() {
+ return "tuttiSpecies";
+ }
+
+ @Override
+ protected String getFileExtensionDescription() {
+ return _("tutti.common.file.tuttiSpecies");
+ }
+
+ @Override
+ protected String getFileChooserTitle() {
+ return _("tutti.editSpeciesBatch.action.exportMultiPost.destinationFile.title");
+ }
+
+ @Override
+ protected String getFileChooserButton() {
+ return _("tutti.editSpeciesBatch.action.exportMultiPost.destinationFile.button");
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ multiPostImportExportService.exportSpecies(file, currentOperation);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.editSpeciesBatch.action.exportMultiPost.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryGearExampleAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryGearExampleAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryGearExampleAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryGearExampleAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,102 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.ReferentialImportExportService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUI;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Export an example file of temporary gears referential.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportTemporaryGearExampleAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportTemporaryGearExampleAction.class);
+
+ private File file;
+
+ public ExportTemporaryGearExampleAction(ManageTemporaryReferentialUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = saveFile(
+ "exportGearExample",
+ "csv",
+ _("tutti.manageTemporaryReferential.title.choose.exportTemporaryGearExampleFile"),
+ _("tutti.manageTemporaryReferential.action.chooseReferentialGearFile.export"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export example gears temporary " +
+ "referential to file: " + file);
+ }
+
+ ReferentialImportExportService service =
+ getContext().getTuttiReferentialImportExportService();
+ service.exportTemporaryGearExample(file);
+
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialGearFile.export.success", file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryPersonExampleAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryPersonExampleAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryPersonExampleAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryPersonExampleAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,103 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.ReferentialImportExportService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUI;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Export an example file of temporary person referential.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportTemporaryPersonExampleAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
+
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportTemporaryPersonExampleAction.class);
+
+ private File file;
+
+ public ExportTemporaryPersonExampleAction(ManageTemporaryReferentialUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = saveFile(
+ "exportPersonExample",
+ "csv",
+ _("tutti.manageTemporaryReferential.title.choose.exportTemporaryPersonExampleFile"),
+ _("tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.export"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export example persons temporary " +
+ "referential to file: " + file);
+ }
+
+ ReferentialImportExportService service =
+ getContext().getTuttiReferentialImportExportService();
+
+ service.exportTemporaryPersonExample(file);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.export.success", file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporarySpeciesExampleAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporarySpeciesExampleAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporarySpeciesExampleAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporarySpeciesExampleAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,102 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.ReferentialImportExportService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUI;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Export an example file of temporary species referential.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportTemporarySpeciesExampleAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportTemporarySpeciesExampleAction.class);
+
+ private File file;
+
+ public ExportTemporarySpeciesExampleAction(ManageTemporaryReferentialUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = saveFile(
+ "exportSpeciesExample",
+ "csv",
+ _("tutti.manageTemporaryReferential.title.choose.exportTemporarySpeciesExampleFile"),
+ _("tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.export"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export example species temporary " +
+ "referential to file: " + file);
+ }
+
+ ReferentialImportExportService service =
+ getContext().getTuttiReferentialImportExportService();
+
+ service.exportTemporarySpeciesExample(file);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.export.success", file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryVesselExampleAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryVesselExampleAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryVesselExampleAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportTemporaryVesselExampleAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,102 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.ReferentialImportExportService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUI;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Export an example file of temporary species referential.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportTemporaryVesselExampleAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportTemporaryVesselExampleAction.class);
+
+ private File file;
+
+ public ExportTemporaryVesselExampleAction(ManageTemporaryReferentialUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = saveFile(
+ "exportVesselExample",
+ "csv",
+ _("tutti.manageTemporaryReferential.title.choose.exportTemporaryVesselExampleFile"),
+ _("tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.export"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export example vessels temporary " +
+ "referential to file: " + file);
+ }
+
+ ReferentialImportExportService service =
+ getContext().getTuttiReferentialImportExportService();
+
+ service.exportTemporaryVesselExample(file);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.export.success", file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/GenerateReportAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/GenerateReportAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/GenerateReportAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/GenerateReportAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,75 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.report.ReportModel;
+import fr.ifremer.tutti.ui.swing.content.report.ReportUI;
+import fr.ifremer.tutti.ui.swing.content.report.ReportUIHandler;
+import fr.ifremer.tutti.ui.swing.content.report.ReportUIModel;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To generate the selected report.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.9
+ */
+public class GenerateReportAction extends AbstractTuttiAction<ReportUIModel, ReportUI, ReportUIHandler> {
+
+ public GenerateReportAction(ReportUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // ask user to confirm overwrite if required
+ doAction = askOverwriteFile(getModel().getOutputFile());
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkState(getModel().isValid());
+
+ ReportModel reportModel = getModel().toBean();
+ getContext().getReportService().generateReport(reportModel);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ sendMessage(_("tutti.report.generated", getModel().getOutputFile()));
+
+ getModel().reloadOuputFile();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/GoToPreviousScreenAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/GoToPreviousScreenAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/GoToPreviousScreenAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/GoToPreviousScreenAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,46 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To return on previous screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class GoToPreviousScreenAction extends AbstractChangeScreenAction {
+
+ public GoToPreviousScreenAction(MainUIHandler handler) {
+ super(handler,
+ true,
+ PREVIOUS_SCREEN.getContextValue(handler.getUI())
+ );
+ setActionDescription(_("tutti.main.action.goto.previousScreen.tip"));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportAccidentalMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ImportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportAccidentalMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportAccidentalMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,76 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.content.operation.catches.accidental.AccidentalBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUIModel;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public class ImportAccidentalMultiPostAction
+ extends AbstractImportMultiPostAction<AccidentalBatchUIModel, AccidentalBatchUI, AccidentalBatchUIHandler> {
+
+ public ImportAccidentalMultiPostAction(AccidentalBatchUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected String getFileExtension() {
+ return "tuttiAccidental";
+ }
+
+ @Override
+ protected String getFileExtensionDescription() {
+ return _("tutti.common.file.tuttiAccidental");
+ }
+
+ @Override
+ protected String getFileChooserTitle() {
+ return _("tutti.editAccidentalBatch.action.importMultiPost.sourceFile.title");
+ }
+
+ @Override
+ protected String getFileChooserButton() {
+ return _("tutti.editAccidentalBatch.action.importMultiPost.sourceFile.button");
+ }
+
+ @Override
+ protected void importBatches(FishingOperation operation) {
+ multiPostImportExportService.importAccidentalCatches(file, operation);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ sendMessage(_("tutti.editAccidentalBatch.action.importMultiPost.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportBenthosMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ImportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportBenthosMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportBenthosMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,128 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.service.catches.multipost.MultiPostImportService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.MultiPostImportLogDialog;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIModel;
+
+import javax.swing.JTextArea;
+import java.awt.Dialog;
+import java.util.Collection;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public class ImportBenthosMultiPostAction extends AbstractImportMultiPostAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
+
+ protected Map<String, Object> notImportedData;
+
+ public ImportBenthosMultiPostAction(BenthosBatchUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected String getFileExtension() {
+ return "tuttiBenthos";
+ }
+
+ @Override
+ protected String getFileExtensionDescription() {
+ return _("tutti.common.file.tuttiBenthos");
+ }
+
+ @Override
+ protected String getFileChooserTitle() {
+ return _("tutti.editBenthosBatch.action.importMultiPost.sourceFile.title");
+ }
+
+ @Override
+ protected String getFileChooserButton() {
+ return _("tutti.editBenthosBatch.action.importMultiPost.sourceFile.button");
+ }
+
+ @Override
+ public void releaseAction() {
+ notImportedData = null;
+ super.releaseAction();
+ }
+
+ @Override
+ protected void importBatches(FishingOperation operation) {
+ notImportedData = multiPostImportExportService.importBenthos(file, operation);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ if (!notImportedData.isEmpty()) {
+ MultiPostImportLogDialog dialog = new MultiPostImportLogDialog((Dialog) getContext().getActionUI());
+
+ Collection<BenthosBatch> notImportedBenthosBatches =
+ (Collection<BenthosBatch>) notImportedData.get(MultiPostImportService.BATCHES_KEY);
+
+ StringBuffer stringBuffer = new StringBuffer();
+ Float totalSortedWeight = (Float) notImportedData.get(CatchBatch.PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT);
+ if (totalSortedWeight != null) {
+ stringBuffer.append("- " + _("tutti.multiPostImportLog.totalSortedWeight", totalSortedWeight) + "\n");
+ }
+
+ Float inertWeight = (Float) notImportedData.get(CatchBatch.PROPERTY_BENTHOS_TOTAL_INERT_WEIGHT);
+ if (inertWeight != null) {
+ stringBuffer.append("- " + _("tutti.multiPostImportLog.inertWeight", inertWeight) + "\n");
+ }
+
+ Float livingNotItemizedWeight =
+ (Float) notImportedData.get(CatchBatch.PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT);
+ if (livingNotItemizedWeight != null) {
+ stringBuffer.append("- " + _("tutti.multiPostImportLog.livingNotItemizedWeight", livingNotItemizedWeight) + "\n");
+ }
+
+ for (BenthosBatch sb : notImportedBenthosBatches) {
+ stringBuffer.append("- " + decorate(sb.getSpecies()) + " / " + decorate(sb.getSampleCategoryValue()) + "\n");
+ }
+
+ if (stringBuffer.length() > 0) {
+ JTextArea batchList = dialog.getBatchList();
+ batchList.setText(stringBuffer.toString());
+ dialog.setSize(400, 300);
+ dialog.setLocationRelativeTo(getContext().getMainUI());
+ dialog.setVisible(true);
+ }
+ }
+
+ sendMessage(_("tutti.editBenthosBatch.action.importMultiPost.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportCasinoAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/ImportCasinoAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportCasinoAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportCasinoAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,46 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportCasinoAction extends AbstractTuttiAction<EditFishingOperationUIModel, EditFishingOperationUI, EditFishingOperationUIHandler> {
+
+ public ImportCasinoAction(EditFishingOperationUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ //TODO
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,331 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.ApplicationBusinessException;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.persistence.TuttiPersistence;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.Version;
+
+import javax.swing.JOptionPane;
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To import a db and use it.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class ImportDbAction extends AbstractMainUITuttiAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(ImportDbAction.class);
+
+ protected File importFile;
+
+ protected String jdbcUrl;
+
+ protected boolean updateSchema;
+
+ protected boolean closeDb;
+
+ protected Version dbVersion;
+
+ protected Version applicationVersion;
+
+ protected PersistenceService.ImportStructureType importStructureType;
+
+ public ImportDbAction(MainUIHandler handler) {
+ super(handler, true);
+ setActionDescription(_("tutti.dbManager.action.importDb.tip"));
+ }
+
+ public void setImportFile(File importFile) {
+ this.importFile = importFile;
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ importStructureType = null;
+ jdbcUrl = null;
+ dbVersion = applicationVersion = null;
+ closeDb = updateSchema = false;
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ jdbcUrl = getConfig().getJdbcUrl();
+
+ if (importFile == null) {
+
+ // choose file to import
+ importFile = chooseFile(
+ _("tutti.dbManager.title.choose.dbImportFile"),
+ _("tutti.dbManager.action.chooseDbFile"),
+ "^.*\\.zip", _("tutti.common.file.zip")
+ );
+
+ if (importFile == null) {
+
+ displayWarningMessage(
+ _("tutti.dbManager.title.choose.dbImportFile"),
+ _("tutti.dbManager.action.importdb.no.import.file.choosen")
+ );
+
+ doAction = false;
+ }
+ }
+
+ if (doAction) {
+
+ ProgressionModel progressionModel = new ProgressionModel();
+ progressionModel.setTotal(3);
+ setProgressionModel(progressionModel);
+
+ importStructureType =
+ getContext().getPersistenceService().checkImportStructure(importFile);
+ }
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ importFile = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(importFile);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will import db: " + importFile);
+ }
+
+ ProgressionModel progressionModel = getProgressionModel();
+
+ // ------------------------------------------------------------------ //
+ // --- import db //
+ // ------------------------------------------------------------------ //
+
+ progressionModel.increments(_("tutti.importDb.step.unzipArchive"));
+
+ getContext().getPersistenceService().importDb(importStructureType, importFile);
+
+ // ------------------------------------------------------------------ //
+ // --- open db //
+ // ------------------------------------------------------------------ //
+
+ progressionModel.increments(_("tutti.importDb.step.openDb", jdbcUrl));
+ try {
+ getContext().setDbExist(true);
+ getContext().setDbLoaded(true);
+ handler.reloadPersistenceService();
+ } catch (Exception e) {
+
+ if (log.isErrorEnabled()) {
+ log.error("Could not open db", e);
+ }
+ // no more db
+ getContext().setDbLoaded(false);
+ handler.reloadPersistenceService();
+
+ // could not load db
+ throw new ApplicationBusinessException(_("tutti.dbManager.action.importdb.couldNotOpen"), e);
+ }
+
+ // ------------------------------------------------------------------ //
+ // --- check schema version //
+ // ------------------------------------------------------------------ //
+
+ progressionModel.increments(_("tutti.importDb.step.checkSchemaVersion"));
+
+ TuttiPersistence persistenceService =
+ handler.getPersistenceService();
+
+ dbVersion = persistenceService.getDbVersion();
+
+ if (log.isInfoEnabled()) {
+ log.info("Detected database version: " + dbVersion);
+ }
+ applicationVersion = persistenceService.getApplicationVersion();
+
+ if (log.isInfoEnabled()) {
+ log.info("Detected schema application version:" + applicationVersion);
+ }
+
+ if (dbVersion == null) {
+
+ // no database version filled (can not migrate schema)
+ String message = _("tutti.dbManager.action.upgradeDb.schema.version.not.found");
+ displayWarningMessage(_("tutti.dbManager.title.schema.toupdate"), message);
+
+ closeDb = true;
+ } else if (dbVersion.equals(applicationVersion)) {
+
+ // database schema is up to date
+ if (log.isInfoEnabled()) {
+ log.info("Database schema is up-to-date at version: " + dbVersion);
+ }
+ } else if (dbVersion.compareTo(applicationVersion) < 0) {
+
+ // database schema need to migrate
+ // ask user to migrate or not (if not will close db)
+
+ String message = _("tutti.dbManager.action.upgradeDb.schema.to.update.message", dbVersion, applicationVersion);
+
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ message,
+ _("tutti.dbManager.action.upgradeDb.schema.to.update.message.help"));
+ int i = JOptionPane.showConfirmDialog(
+ handler.getTopestUI(),
+ htmlMessage,
+ _("tutti.dbManager.title.schema.toupdate"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+ boolean continueAction = i == JOptionPane.OK_OPTION;
+
+ if (continueAction) {
+
+ // will migrate
+ updateSchema = true;
+ } else {
+
+ //close db
+ closeDb = true;
+ }
+
+
+ } else {
+
+ // database schema version is higher than application one
+ String message = _("tutti.dbManager.action.upgradeDb.schema.too.high", dbVersion, applicationVersion);
+
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ message,
+ _("tutti.dbManager.action.upgradeDb.schema.too.high.help"));
+ int i = JOptionPane.showConfirmDialog(
+ handler.getTopestUI(),
+ htmlMessage,
+ _("tutti.dbManager.title.schema.toupdate"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+ boolean continueAction = i == JOptionPane.OK_OPTION;
+
+ if (!continueAction) {
+
+ //close db
+ closeDb = true;
+ }
+ }
+
+ if (closeDb) {
+
+ // ------------------------------------------------------------------ //
+ // --- close db //
+ // ------------------------------------------------------------------ //
+
+ progressionModel.increments(_("tutti.importDb.step.closeDb"));
+ getActionEngine().runInternalAction(handler, CloseDbAction.class);
+
+ return;
+ }
+
+ if (updateSchema) {
+
+ // need to migrate schema
+ progressionModel.adaptTotal(progressionModel.getTotal() + 2);
+
+ // ------------------------------------------------------------------ //
+ // --- update schema //
+ // ------------------------------------------------------------------ //
+
+ String message = _("tutti.importDb.step.will.migrateSchema",
+ dbVersion, applicationVersion);
+
+ progressionModel.increments(message);
+ sendMessage(message);
+ handler.getPersistenceService().updateSchema();
+
+ sendMessage(_("tutti.flash.info.db.schema.updated", dbVersion, applicationVersion));
+ }
+
+ // ------------------------------------------------------------------ //
+ // --- check db context //
+ // ------------------------------------------------------------------ //
+
+ String message = _("tutti.importDb.step.check.dbContext",
+ dbVersion, applicationVersion);
+
+ progressionModel.increments(message);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Check db context");
+ }
+ getContext().checkDbContext();
+
+ // ------------------------------------------------------------------ //
+ // --- change screen //
+ // ------------------------------------------------------------------ //
+
+ getActionEngine().runInternalAction(handler, SelectCruiseAction.class);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ handler.reloadDbManagerText();
+
+ super.postSuccessAction();
+
+ if (closeDb) {
+ sendMessage(_("tutti.flash.info.db.imported.but.closed", jdbcUrl));
+ } else {
+ sendMessage(_("tutti.flash.info.db.imported", jdbcUrl));
+ }
+
+ // make sure title is reloaded
+ getUI().getHandler().changeTitle();
+ }
+
+ @Override
+ public void postFailedAction(Throwable error) {
+ handler.reloadDbManagerText();
+ super.postFailedAction(error);
+ }
+
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportIndividualObservationMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ImportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportIndividualObservationMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportIndividualObservationMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,76 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.content.operation.catches.individualobservation.IndividualObservationBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUIModel;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public class ImportIndividualObservationMultiPostAction
+ extends AbstractImportMultiPostAction<IndividualObservationBatchUIModel, IndividualObservationBatchUI, IndividualObservationBatchUIHandler> {
+
+ public ImportIndividualObservationMultiPostAction(IndividualObservationBatchUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected String getFileExtension() {
+ return "tuttiIndividualObservation";
+ }
+
+ @Override
+ protected String getFileExtensionDescription() {
+ return _("tutti.common.file.tuttiIndividualObservation");
+ }
+
+ @Override
+ protected String getFileChooserTitle() {
+ return _("tutti.editIndividualObservationBatch.action.importMultiPost.sourceFile.title");
+ }
+
+ @Override
+ protected String getFileChooserButton() {
+ return _("tutti.editIndividualObservationBatch.action.importMultiPost.sourceFile.button");
+ }
+
+ @Override
+ protected void importBatches(FishingOperation operation) {
+ multiPostImportExportService.importIndividualObservation(file, operation);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ sendMessage(_("tutti.editIndividualObservationBatch.action.importMultiPost.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportMarineLitterMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ImportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportMarineLitterMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportMarineLitterMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,117 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.CatchBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch;
+import fr.ifremer.tutti.service.catches.multipost.MultiPostImportService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.MultiPostImportLogDialog;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUIModel;
+
+import javax.swing.JTextArea;
+import java.awt.Dialog;
+import java.util.Collection;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public class ImportMarineLitterMultiPostAction extends AbstractImportMultiPostAction<MarineLitterBatchUIModel, MarineLitterBatchUI, MarineLitterBatchUIHandler> {
+
+ protected Map<String, Object> notImportedData;
+
+ public ImportMarineLitterMultiPostAction(MarineLitterBatchUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected String getFileExtension() {
+ return "tuttiMarineLitter";
+ }
+
+ @Override
+ protected String getFileExtensionDescription() {
+ return _("tutti.common.file.tuttiMarineLitter");
+ }
+
+ @Override
+ protected String getFileChooserTitle() {
+ return _("tutti.editMarineLitterBatch.action.importMultiPost.sourceFile.title");
+ }
+
+ @Override
+ protected String getFileChooserButton() {
+ return _("tutti.editMarineLitterBatch.action.importMultiPost.sourceFile.button");
+ }
+
+ @Override
+ public void releaseAction() {
+ notImportedData = null;
+ super.releaseAction();
+ }
+
+ @Override
+ protected void importBatches(FishingOperation operation) {
+ notImportedData = multiPostImportExportService.importMarineLitter(file, operation);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ if (!notImportedData.isEmpty()) {
+ MultiPostImportLogDialog dialog = new MultiPostImportLogDialog((Dialog) getContext().getActionUI());
+
+ Collection<MarineLitterBatch> notImportedMarineLitterBatches =
+ (Collection<MarineLitterBatch>) notImportedData.get(MultiPostImportService.BATCHES_KEY);
+
+ StringBuffer stringBuffer = new StringBuffer();
+ Float totalWeight = (Float) notImportedData.get(CatchBatch.PROPERTY_MARINE_LITTER_TOTAL_WEIGHT);
+ if (totalWeight != null) {
+ stringBuffer.append("- " + _("tutti.multiPostImportLog.totalWeight", totalWeight) + "\n");
+ }
+
+ for (MarineLitterBatch mlb : notImportedMarineLitterBatches) {
+ stringBuffer.append("- " + decorate(mlb.getMarineLitterCategory()) + " / " + decorate(mlb.getMarineLitterSizeCategory()) + "\n");
+ }
+
+ if (stringBuffer.length() > 0) {
+ JTextArea batchList = dialog.getBatchList();
+ batchList.setText(stringBuffer.toString());
+ dialog.setSize(400, 300);
+ dialog.setLocationRelativeTo(getContext().getMainUI());
+ dialog.setVisible(true);
+ }
+ }
+
+ sendMessage(_("tutti.editMarineLitterBatch.action.importMultiPost.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportOrReimportDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportOrReimportDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportOrReimportDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportOrReimportDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,72 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+/**
+ * To import or reimport a db (will delegate to correct action).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.4
+ */
+public class ImportOrReimportDbAction extends AbstractMainUITuttiAction {
+
+ protected AbstractMainUITuttiAction delegateAction;
+
+ public ImportOrReimportDbAction(MainUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ if (getContext().isDbExist()) {
+
+ // reimport action
+ delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), ReimportDbAction.class);
+ } else {
+
+ // import action
+ delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), ImportDbAction.class);
+ }
+
+ setActionDescription(delegateAction.getActionDescription());
+
+ return delegateAction.prepareAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ getActionEngine().runInternalAction(delegateAction);
+ }
+
+ @Override
+ protected void releaseAction() {
+ delegateAction = null;
+ super.releaseAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,180 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocols;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import jaxx.runtime.context.JAXXContextEntryDef;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JOptionPane;
+import javax.swing.UIManager;
+import java.io.File;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Opens a file chooser and imports the protocol from the selected file.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportProtocolAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ImportProtocolAction.class);
+
+ public static final JAXXContextEntryDef<TuttiProtocol> IMPORT_PROTOCOL_ENTRY = new JAXXContextEntryDef<TuttiProtocol>("importProtocol", TuttiProtocol.class);
+
+ protected TuttiProtocol protocol;
+
+ public ImportProtocolAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_PROTOCOL);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ IMPORT_PROTOCOL_ENTRY.removeContextValue(getContext().getMainUI());
+
+ boolean doAction = super.prepareAction();
+
+ File file = null;
+
+ if (doAction) {
+ // choose file to import
+ file = chooseFile(
+ _("tutti.selectCruise.title.choose.importFile"),
+ _("tutti.selectCruise.action.importProtocol"),
+ "^.+\\.tuttiProtocol$", _("tutti.common.file.protocol")
+ );
+
+ doAction = file != null;
+ }
+
+ if (doAction) {
+
+ // import protocol
+ if (log.isInfoEnabled()) {
+ log.info("Will import protocol file: " + file);
+ }
+
+ ProtocolImportExportService service =
+ getContext().getTuttiProtocolImportExportService();
+
+ protocol = service.importProtocol(file);
+
+ // remove id
+ protocol.setId((String) null);
+
+ sendMessage(_("tutti.importProtocol.action.success", protocol.getName()));
+
+ // check that protocol is compatible with sample category model
+ SampleCategoryModel sampleCategoryModel =
+ getDataContext().getSampleCategoryModel();
+
+ Set<Integer> badCategories = Sets.newHashSet();
+
+ TuttiProtocols.checkSampleCategories(sampleCategoryModel,
+ protocol,
+ badCategories);
+
+ if (!badCategories.isEmpty()) {
+
+ // detect some bad categories
+ if (log.isWarnEnabled()) {
+ log.warn("There is some bad categories: " + badCategories);
+ }
+
+ String message = TuttiProtocols.getBadCategoriesMessage(
+ badCategories,
+ getDecorator(Caracteristic.class, null),
+ getContext().getPersistenceService());
+
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ message,
+ _("tutti.common.askBeforeImportProtocol.help"));
+ int response = JOptionPane.showOptionDialog(
+ getContext().getActionUI(),
+ htmlMessage,
+ _("tutti.common.askBeforeEditProtocol.title"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.WARNING_MESSAGE,
+ UIManager.getIcon("warning"),
+ new Object[]{_("tutti.option.cleanAndImport"), _("tutti.option.import"), _("tutti.option.cancel")},
+ _("tutti.option.cancel")
+ );
+
+ switch (response) {
+ case 0:
+ // clean and import
+ if (log.isInfoEnabled()) {
+ log.info("Clean and Import");
+ }
+ TuttiProtocols.removeBadCategories(sampleCategoryModel,
+ protocol);
+ break;
+ case 1:
+ // import with no clean
+ if (log.isInfoEnabled()) {
+ log.info("Import with no cleaning");
+ }
+ break;
+ default:
+
+ // cancel
+ doAction = false;
+ }
+ }
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(protocol);
+
+ // store protocol in context
+ IMPORT_PROTOCOL_ENTRY.setContextValue(getContext().getMainUI(), protocol);
+ protocol = null;
+ createProgressionModelIfRequired(4);
+
+ // removed selected protocol
+ getContext().setProtocolId(null);
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolBenthosAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolBenthosAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolBenthosAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolBenthosAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,148 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.protocol.SpeciesProtocol;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesRowModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To import protocol benthos.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportProtocolBenthosAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ImportProtocolBenthosAction.class);
+
+ private File file;
+
+ public ImportProtocolBenthosAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to import
+ file = chooseFile(
+ _("tutti.editProtocol.title.choose.benthosImportFile"),
+ _("tutti.editProtocol.action.chooseProtocolBenthosFile"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will import protocol benthos file: " + file);
+ }
+
+ EditProtocolUIModel model = getModel();
+
+ // bind to a protocol
+ TuttiProtocol protocol = model.toBean();
+
+ // import
+ ProtocolImportExportService service =
+ getContext().getTuttiProtocolImportExportService();
+
+ service.importProtocolBenthos(file,
+ protocol,
+ model.getAllCaracteristic(),
+ model.getAllReferentSpeciesByTaxonId());
+
+ // build rows from imported+merged protocol
+ // (will also remove all synonyms of species referent used)
+ List<EditProtocolSpeciesRowModel> rows =
+ handler.toRows(protocol.getBenthos());
+
+ // update species comboBox
+ getUI().getSpeciesComboBox().getHandler().reset();
+
+ // update benthos comboBox
+ getUI().getBenthosComboBox().getHandler().reset();
+
+ // update rows in model
+ model.setBenthosRow(rows);
+
+ getHandler().getBenthosTableModel().setRows(rows);
+
+ int nbSynonym = 0;
+ for (SpeciesProtocol speciesProtocol : protocol.getBenthos()) {
+ if (!speciesProtocol.isMadeFromAReferentTaxon()) {
+ nbSynonym++;
+ }
+ }
+
+ String message;
+ switch (nbSynonym) {
+ case 0:
+ message = _("tutti.flash.info.benthos.imported.in.protocol",
+ file);
+ break;
+
+ case 1:
+ message = _("tutti.flash.info.benthos.imported.in.protocol.oneReplaced",
+ file);
+ break;
+
+ default:
+ message = _("tutti.flash.info.benthos.imported.in.protocol.severalReplaced",
+ file, nbSynonym);
+ }
+ sendMessage(message);
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolCaracteristicAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolCaracteristicAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolCaracteristicAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolCaracteristicAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,116 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To import protocol caracteristics.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportProtocolCaracteristicAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ImportProtocolCaracteristicAction.class);
+
+ private File file;
+
+ public ImportProtocolCaracteristicAction(EditProtocolUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to import
+ file = chooseFile(
+ _("tutti.editProtocol.title.choose.caracteristicImportFile"),
+ _("tutti.editProtocol.action.chooseProtocolCaracteristicFile"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will import protocol caracteristic file: " + file);
+ }
+
+ EditProtocolUIModel model = getModel();
+
+ // bind to a protocol
+ TuttiProtocol protocol = model.toBean();
+
+ ProtocolImportExportService service =
+ getContext().getTuttiProtocolImportExportService();
+
+ service.importProtocolCaracteristic(file,
+ protocol,
+ model.getAllCaracteristic());
+
+ handler.addDoubleListListeners();
+
+ try {
+ // rebind to model
+ model.fromBean(protocol);
+ } finally {
+ handler.removeDoubleListListeners();
+ }
+
+ sendMessage(
+ _("tutti.flash.info.caracteristic.imported.in.protocol",
+ file));
+
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolSpeciesAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolSpeciesAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolSpeciesAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportProtocolSpeciesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,148 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.protocol.SpeciesProtocol;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesRowModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To import protocol species.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportProtocolSpeciesAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ImportProtocolSpeciesAction.class);
+
+ private File file;
+
+ public ImportProtocolSpeciesAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to import
+ file = chooseFile(
+ _("tutti.editProtocol.title.choose.speciesImportFile"),
+ _("tutti.editProtocol.action.chooseProtocolSpeciesFile"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will import protocol species file: " + file);
+ }
+
+ EditProtocolUIModel model = getModel();
+
+ // bind to a protocol
+ TuttiProtocol protocol = model.toBean();
+
+ // import
+ ProtocolImportExportService service =
+ getContext().getTuttiProtocolImportExportService();
+
+ service.importProtocolSpecies(file,
+ protocol,
+ model.getAllCaracteristic(),
+ model.getAllReferentSpeciesByTaxonId());
+
+ // build rows from imported+merged protocol
+ // (will also remove all synonyms of species referent used)
+ List<EditProtocolSpeciesRowModel> rows =
+ handler.toRows(protocol.getSpecies());
+
+ // update species comboBox
+ getUI().getSpeciesComboBox().getHandler().reset();
+
+ // update benthos comboBox
+ getUI().getBenthosComboBox().getHandler().reset();
+
+ // update rows in model
+ model.setSpeciesRow(rows);
+
+ getHandler().getSpeciesTableModel().setRows(rows);
+
+ int nbSynonym = 0;
+ for (SpeciesProtocol speciesProtocol : protocol.getSpecies()) {
+ if (!speciesProtocol.isMadeFromAReferentTaxon()) {
+ nbSynonym++;
+ }
+ }
+
+ String message;
+ switch (nbSynonym) {
+ case 0:
+ message = _("tutti.flash.info.species.imported.in.protocol",
+ file);
+ break;
+
+ case 1:
+ message = _("tutti.flash.info.species.imported.in.protocol.oneReplaced",
+ file);
+ break;
+
+ default:
+ message = _("tutti.flash.info.species.imported.in.protocol.severalReplaced",
+ file, nbSynonym);
+ }
+ sendMessage(message);
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportPupitriAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportPupitriAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportPupitriAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,170 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.Joiner;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
+import fr.ifremer.tutti.persistence.service.TuttiEnumerationFile;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.service.pupitri.PupitriImportExportService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.ImportPupitriPopupUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+
+import javax.swing.JOptionPane;
+import javax.swing.UIManager;
+import java.io.File;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportPupitriAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
+
+ protected File importedTrunkFile;
+
+ protected File importedCarrouselFile;
+
+ protected ImportPupitriPopupUI importPupitriDialog;
+
+// protected TuttiProtocol currentProtocol;
+
+ protected PersistenceService persistenceService;
+
+ protected EditFishingOperationAction editAction;
+
+ public ImportPupitriAction(SpeciesBatchUIHandler handler) {
+ super(handler, false);
+ persistenceService = getContext().getPersistenceService();
+ importPupitriDialog = new ImportPupitriPopupUI(handler.getContext());
+ }
+
+ public EditFishingOperationAction getEditAction() {
+ if (editAction == null) {
+ editAction = getContext().getActionFactory().createLogicAction(getHandler().getParentUi().getHandler().getParentHandler(),
+ EditFishingOperationAction.class);
+ }
+ return editAction;
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = true;
+
+ // must check that sample category model is compatible for pupitri import
+ // means need some categories
+
+ TuttiEnumerationFile enumerationFile = persistenceService.getEnumerationFile();
+ SampleCategoryModel sampleCategoryModel = getDataContext().getSampleCategoryModel();
+
+ List<String> missingCategories = Lists.newArrayList();
+ if (!sampleCategoryModel.containsCategoryId(enumerationFile.PMFM_ID_SIZE_CATEGORY)) {
+ missingCategories.add("<li>" + persistenceService.getSizeCategoryCaracteristic().getParameterName() + "</li>");
+ }
+ if (!sampleCategoryModel.containsCategoryId(enumerationFile.PMFM_ID_SEX)) {
+ missingCategories.add("<li>" + persistenceService.getSexCaracteristic().getParameterName() + "</li>");
+ }
+ if (!missingCategories.isEmpty()) {
+ result = false;
+ JOptionPane.showMessageDialog(
+ getContext().getActionUI(),
+ _("tutti.editSpeciesBatch.action.importPupitri.invalidSampleCategoryModel.message", Joiner.on("").join(missingCategories)),
+ _("tutti.editSpeciesBatch.action.importPupitri.invalidSampleCategoryModel.title"),
+ JOptionPane.ERROR_MESSAGE,
+ UIManager.getIcon("error")
+ );
+ }
+ if (result) {
+// currentProtocol = getDataContext().getProtocol();
+
+ SpeciesBatchUIModel speciesBatchUIModel = getUI().getModel();
+ if (speciesBatchUIModel.getRowCount() > 0) {
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ _("tutti.editSpeciesBatch.action.importPupitri.existingData.message"),
+ _("tutti.editSpeciesBatch.action.importPupitri.existingData.help"));
+
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ htmlMessage,
+ _("tutti.editSpeciesBatch.action.importPupitri.existingData.title"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.WARNING_MESSAGE);
+
+ result = answer == JOptionPane.OK_OPTION;
+ }
+ }
+
+ if (result) {
+ importPupitriDialog.open();
+ importedTrunkFile = importPupitriDialog.getTrunkFile().getSelectedFile();
+ importedCarrouselFile = importPupitriDialog.getCarrouselFile().getSelectedFile();
+ result = importedTrunkFile != null
+ && importedCarrouselFile != null;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ PupitriImportExportService pupitriImportExportService =
+ getContext().getTuttiPupitriImportExportService();
+
+ EditCatchesUIModel model = getUI().getHandler().getParentUi().getModel();
+
+ FishingOperation operation = model.getFishingOperation();
+ CatchBatch catchBatch = model.toEntity();
+
+ // import
+ int rejectedSpeciesNb =
+ pupitriImportExportService.importPupitri(importedTrunkFile,
+ importedCarrouselFile,
+ operation,
+ catchBatch);
+
+ getEditAction().loadCatchBatch(operation);
+
+ sendMessage(_("tutti.editSpeciesBatch.action.importPupitri.success",
+ getModel().getRootNumber(), rejectedSpeciesNb));
+ }
+
+ @Override
+ public void releaseAction() {
+ super.releaseAction();
+ importedTrunkFile = null;
+ importedCarrouselFile = null;
+// currentProtocol = null;
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportSpeciesMultiPostAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportMultiPostAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportSpeciesMultiPostAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportSpeciesMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,128 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.CatchBatch;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
+import fr.ifremer.tutti.service.catches.multipost.MultiPostImportService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.MultiPostImportLogDialog;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
+
+import javax.swing.JTextArea;
+import java.awt.Dialog;
+import java.util.Collection;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.2
+ */
+public class ImportSpeciesMultiPostAction extends AbstractImportMultiPostAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
+
+ protected Map<String, Object> notImportedData;
+
+ public ImportSpeciesMultiPostAction(SpeciesBatchUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ protected String getFileExtension() {
+ return "tuttiSpecies";
+ }
+
+ @Override
+ protected String getFileExtensionDescription() {
+ return _("tutti.common.file.tuttiSpecies");
+ }
+
+ @Override
+ protected String getFileChooserTitle() {
+ return _("tutti.editSpeciesBatch.action.importMultiPost.sourceFile.title");
+ }
+
+ @Override
+ protected String getFileChooserButton() {
+ return _("tutti.editSpeciesBatch.action.importMultiPost.sourceFile.button");
+ }
+
+ @Override
+ public void releaseAction() {
+ notImportedData = null;
+ super.releaseAction();
+ }
+
+ @Override
+ protected void importBatches(FishingOperation operation) {
+ notImportedData = multiPostImportExportService.importSpecies(file, operation);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ if (!notImportedData.isEmpty()) {
+ MultiPostImportLogDialog dialog = new MultiPostImportLogDialog((Dialog) getContext().getActionUI());
+
+ Collection<SpeciesBatch> notImportedSpeciesBatches =
+ (Collection<SpeciesBatch>) notImportedData.get(MultiPostImportService.BATCHES_KEY);
+
+ StringBuffer stringBuffer = new StringBuffer();
+ Float totalSortedWeight = (Float) notImportedData.get(CatchBatch.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT);
+ if (totalSortedWeight != null) {
+ stringBuffer.append("- " + _("tutti.multiPostImportLog.totalSortedWeight", totalSortedWeight) + "\n");
+ }
+
+ Float inertWeight = (Float) notImportedData.get(CatchBatch.PROPERTY_SPECIES_TOTAL_INERT_WEIGHT);
+ if (inertWeight != null) {
+ stringBuffer.append("- " + _("tutti.multiPostImportLog.inertWeight", inertWeight) + "\n");
+ }
+
+ Float livingNotItemizedWeight =
+ (Float) notImportedData.get(CatchBatch.PROPERTY_SPECIES_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT);
+ if (livingNotItemizedWeight != null) {
+ stringBuffer.append("- " + _("tutti.multiPostImportLog.livingNotItemizedWeight", livingNotItemizedWeight) + "\n");
+ }
+
+ for (SpeciesBatch sb : notImportedSpeciesBatches) {
+ stringBuffer.append("- " + decorate(sb.getSpecies()) + " / " + decorate(sb.getSampleCategoryValue()) + "\n");
+ }
+
+ if (stringBuffer.length() > 0) {
+ JTextArea batchList = dialog.getBatchList();
+ batchList.setText(stringBuffer.toString());
+ dialog.setSize(400, 300);
+ dialog.setLocationRelativeTo(getContext().getMainUI());
+ dialog.setVisible(true);
+ }
+ }
+
+ sendMessage(_("tutti.editSpeciesBatch.action.importMultiPost.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryGearAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryGearAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryGearAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryGearAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,105 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.ReferentialImportExportService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUI;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Import temporary gear referential.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportTemporaryGearAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ImportTemporaryGearAction.class);
+
+ private File file;
+
+ public ImportTemporaryGearAction(ManageTemporaryReferentialUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to import
+ file = chooseFile(
+ _("tutti.manageTemporaryReferential.title.choose.importTemporaryGearFile"),
+ _("tutti.manageTemporaryReferential.action.chooseReferentialGearFile.import"),
+ "^.*\\.csv", _("tutti.common.file.csv"));
+
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will import gear temporary " +
+ "referential from file: " + file);
+ }
+
+ ReferentialImportExportService service =
+ getContext().getTuttiReferentialImportExportService();
+
+ service.importTemporaryGear(file);
+
+ // reset ui cache
+ getDataContext().resetGears();
+
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialGearFile.import.success", file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryPersonAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryPersonAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryPersonAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryPersonAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,104 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.ReferentialImportExportService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUI;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Import temporary person referential.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportTemporaryPersonAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ImportTemporaryPersonAction.class);
+
+ private File file;
+
+ public ImportTemporaryPersonAction(ManageTemporaryReferentialUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to import
+ file = chooseFile(
+ _("tutti.manageTemporaryReferential.title.choose.importTemporaryPersonFile"),
+ _("tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.import"),
+ "^.*\\.csv", _("tutti.common.file.csv"));
+
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will import person temporary " +
+ "referential from file: " + file);
+ }
+
+ ReferentialImportExportService service =
+ getContext().getTuttiReferentialImportExportService();
+
+ service.importTemporaryPerson(file);
+
+ // reset ui cache
+ getDataContext().resetPersons();
+
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.import.success", file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryReferentialAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ImportTemporaryReferentialAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryReferentialAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryReferentialAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,71 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+import javax.swing.SwingUtilities;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Open screen to import referential
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportTemporaryReferentialAction extends AbstractChangeScreenAction {
+
+ public ImportTemporaryReferentialAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.IMPORT_TEMPORARY_REFERENTIAL);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+ if (result) {
+ result = askAdminPassword(
+ _("tutti.manageTemporaryReferential.passwordDialog.message"),
+ _("tutti.manageTemporaryReferential.passwordDialog.title"),
+ _("tutti.manageTemporaryReferential.passwordDialog.error.message"),
+ _("tutti.manageTemporaryReferential.passwordDialog.error.title")
+ );
+ }
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ super.doAction();
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ getContext().getMainUI().getBody().revalidate();
+ }
+ });
+
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporarySpeciesAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporarySpeciesAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporarySpeciesAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporarySpeciesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,103 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.ReferentialImportExportService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUI;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Import temporary species referential.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportTemporarySpeciesAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ImportTemporarySpeciesAction.class);
+
+ private File file;
+
+ public ImportTemporarySpeciesAction(ManageTemporaryReferentialUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+ // choose file to import
+ file = chooseFile(
+ _("tutti.manageTemporaryReferential.title.choose.importTemporarySpeciesFile"),
+ _("tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.import"),
+ "^.*\\.csv", _("tutti.common.file.csv"));
+
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will import species temporary " +
+ "referential from file: " + file);
+ }
+
+ ReferentialImportExportService service =
+ getContext().getTuttiReferentialImportExportService();
+
+ service.importTemporarySpecies(file);
+
+ // reset ui cache
+ getDataContext().resetSpecies();
+
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.import.success", file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryVesselAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryVesselAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryVesselAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ImportTemporaryVesselAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,103 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.ReferentialImportExportService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUI;
+import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Import temporary vessel referential.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportTemporaryVesselAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ImportTemporaryVesselAction.class);
+
+ private File file;
+
+ public ImportTemporaryVesselAction(ManageTemporaryReferentialUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+ // choose file to import
+ file = chooseFile(
+ _("tutti.manageTemporaryReferential.title.choose.importTemporaryVesselFile"),
+ _("tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.import"),
+ "^.*\\.csv", _("tutti.common.file.csv"));
+
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will import vessel temporary " +
+ "referential from file: " + file);
+ }
+
+ ReferentialImportExportService service =
+ getContext().getTuttiReferentialImportExportService();
+
+ service.importTemporaryVessel(file);
+
+ // reset ui cache
+ getDataContext().resetVessels();
+
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.import.success", file));
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/InstallDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/InstallDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/InstallDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,125 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiConfiguration;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.updater.ApplicationUpdater;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To install (or reinstall) a db from last network one.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.4
+ */
+public class InstallDbAction extends AbstractMainUITuttiAction {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(InstallDbAction.class);
+
+ protected File backupFile;
+
+ protected boolean doBackup;
+
+ protected String jdbcUrl;
+
+ public InstallDbAction(MainUIHandler handler) {
+ super(handler, true);
+ setActionDescription(_("tutti.dbManager.action.installDb.tip"));
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // check db url is reachable
+ doAction = getContext().checkUpdateDataReachable();
+ }
+
+ if (doAction) {
+
+ ProgressionModel progressionModel = new ProgressionModel();
+ progressionModel.setTotal(2);
+ setProgressionModel(progressionModel);
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() {
+
+ ProgressionModel progressionModel = getProgressionModel();
+
+ // ------------------------------------------------------------------ //
+ // --- install db //
+ // ------------------------------------------------------------------ //
+
+ TuttiConfiguration config = getConfig();
+
+ File current = config.getDataDirectory();
+ String url = config.getUpdateDataUrl();
+
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Try to install / update db (current data location: %s), using update url: %s", current, url));
+ }
+
+ File dest = new File(config.getBasedir(), "NEW");
+
+ progressionModel.increments(_("tutti.dbManager.action.upgradeDb.check"));
+ TuttiDbUpdaterCallBack callback =
+ new TuttiDbUpdaterCallBack(this, progressionModel);
+ ApplicationUpdater up = new ApplicationUpdater();
+ up.update(url,
+ current,
+ dest,
+ false,
+ callback,
+ progressionModel);
+
+ Preconditions.checkState(callback.isDbInstalled());
+
+ progressionModel.increments(_("tutti.dbManager.action.upgradeDb.opening"));
+
+ getContext().setDbExist(true);
+
+ // ------------------------------------------------------------------ //
+ // --- open db //
+ // ------------------------------------------------------------------ //
+
+ getActionEngine().runInternalAction(getHandler(), OpenDbAction.class);
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/InstallOrReinstallDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallOrReinstallDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/InstallOrReinstallDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/InstallOrReinstallDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,73 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+/**
+ * To install or reinstall a db (will delegate to correct action).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.4
+ */
+public class InstallOrReinstallDbAction extends AbstractMainUITuttiAction {
+
+ protected AbstractMainUITuttiAction delegateAction;
+
+ public InstallOrReinstallDbAction(MainUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ if (getContext().isDbExist()) {
+
+ // reinstall action
+ delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), ReinstallDbAction.class);
+ } else {
+
+ // install action
+ delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), InstallDbAction.class);
+ }
+
+ setActionDescription(delegateAction.getActionDescription());
+
+ return delegateAction.prepareAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ getActionEngine().runInternalAction(delegateAction);
+ }
+
+ @Override
+ protected void releaseAction() {
+ delegateAction = null;
+ super.releaseAction();
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ManageDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ManageDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ManageDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ManageDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,42 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+/**
+ * To manage db in Tutti.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ManageDbAction extends AbstractChangeScreenAction {
+
+ public ManageDbAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.MANAGE_DB);
+ }
+
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewCruiseAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewCruiseAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewCruiseAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,47 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+/**
+ * Opens the cruise creation screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class NewCruiseAction extends AbstractChangeScreenAction {
+
+ public NewCruiseAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_CRUISE);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ getContext().setCruiseId(null);
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewFishingOperationAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/NewFishingOperationAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewFishingOperationAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,88 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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 fr.ifremer.tutti.persistence.entities.data.FishingOperations;
+import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrder;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUIModel;
+
+import java.util.List;
+
+/**
+ * To create a new fishing operation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class NewFishingOperationAction extends EditFishingOperationAction {
+
+ public NewFishingOperationAction(FishingOperationsUIHandler handler) {
+ super(handler);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ FishingOperationsUIModel model = getModel();
+
+ // deselect selected fishingOperation
+ // Will remove the selection fishing operation from the comboBox
+
+ model.setCatchEnabled(true);
+
+ model.setEditionAdjusting(true);
+ try {
+ model.setSelectedFishingOperation(null);
+ } finally {
+ model.setEditionAdjusting(false);
+ }
+
+ // creates a empty bean
+
+ FishingOperation newFishingOperation =
+ FishingOperations.newFishingOperation();
+ Cruise cruise = getDataContext().getCruise();
+ newFishingOperation.setCruise(cruise);
+ newFishingOperation.setVessel(cruise.getVessel());
+
+ List<GearWithOriginalRankOrder> gears = cruise.getGear();
+ if (gears.size() == 1) {
+ newFishingOperation.setGear(gears.get(0));
+ }
+
+ if (cruise.getMultirigNumber() == 1) {
+ newFishingOperation.setMultirigAggregation("1");
+ }
+
+ newFishingOperation.setGearShootingStartDate(null);
+ newFishingOperation.setGearShootingEndDate(null);
+ setFishingOperation(newFishingOperation);
+
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewProgramAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProgramAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewProgramAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewProgramAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,48 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+/**
+ * Opens the program creation screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class NewProgramAction extends AbstractChangeScreenAction {
+
+ public NewProgramAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_PROGRAM);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ getContext().setProgramId(null);
+ getContext().setCruiseId(null);
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/NewProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,48 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+/**
+ * Opens the protocol creation screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class NewProtocolAction extends AbstractChangeScreenAction {
+
+ public NewProtocolAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.EDIT_PROTOCOL);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ getContext().setProtocolId(null);
+ createProgressionModelIfRequired(4);
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/OpenDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/OpenDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/OpenDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/OpenDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,375 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.ApplicationBusinessException;
+import fr.ifremer.shared.application.swing.action.ApplicationUIAction;
+import fr.ifremer.tutti.TuttiConfiguration;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.persistence.TuttiPersistence;
+import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.updater.ApplicationInfo;
+import org.nuiton.updater.ApplicationUpdater;
+import org.nuiton.util.Version;
+
+import javax.swing.JOptionPane;
+import java.io.File;
+import java.util.Date;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To open existing db.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class OpenDbAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(OpenDbAction.class);
+
+ protected Version dbVersion;
+
+ protected Version applicationVersion;
+
+ protected File file;
+
+ protected boolean updateSchema;
+
+ protected boolean updateReferentiel;
+
+ protected boolean closeDb;
+
+ protected String jdbcUrl;
+
+ protected ApplicationInfo updateDbVersion;
+
+ public OpenDbAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.SELECT_CRUISE);
+ setActionDescription(_("tutti.dbManager.action.openDb.tip"));
+ }
+
+ public void setUpdateReferentiel(boolean updateReferentiel) {
+ this.updateReferentiel = updateReferentiel;
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean canContinue = super.prepareAction();
+ if (canContinue) {
+ jdbcUrl = null;
+ dbVersion = applicationVersion = null;
+ file = null;
+ closeDb = updateSchema = false;
+ updateDbVersion = null;
+
+ updateReferentiel &= getContext().checkUpdateDataReachable();
+
+ if (updateReferentiel) {
+
+ // get the next db version
+ ApplicationUpdater up = new ApplicationUpdater();
+
+ // get db updates
+ Map<String, ApplicationInfo> dbVersions =
+ up.getVersions(getConfig().getUpdateDataUrl(),
+ getConfig().getDataDirectory());
+ updateDbVersion =
+ dbVersions.get(TuttiDbUpdaterCallBack.DB_UPDATE_NAME);
+
+ if (updateDbVersion != null && updateDbVersion.newVersion != null) {
+
+ // ask user if it wants to do the update
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ _("tutti.dbManager.updatedb.found", updateDbVersion.newVersion),
+ _("tutti.common.askBeforeUpdate.help"));
+ int i = JOptionPane.showConfirmDialog(
+ getHandler().getTopestUI(),
+ htmlMessage,
+ _("tutti.dbManager.title.confirm.updatedb"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+
+ updateReferentiel = i == JOptionPane.OK_OPTION;
+ }
+
+ }
+ }
+ return canContinue;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Will open db...");
+ }
+
+ jdbcUrl = getConfig().getJdbcUrl();
+
+ // at the beginning 3 steps (open db + check version + check db context)
+ ProgressionModel progressionModel = new ProgressionModel();
+ setProgressionModel(progressionModel);
+ progressionModel.setTotal(3 + (updateReferentiel ? 1 : 0));
+
+ // ------------------------------------------------------------------ //
+ // --- open db //
+ // ------------------------------------------------------------------ //
+
+ progressionModel.increments(_("tutti.openDb.step.open", jdbcUrl));
+ try {
+ getContext().setDbLoaded(true);
+ getHandler().reloadPersistenceService();
+ } catch (Exception e) {
+
+ if (log.isErrorEnabled()) {
+ log.error("Could not open db", e);
+ }
+ // no more db
+ getContext().setDbLoaded(false);
+ getHandler().reloadPersistenceService();
+
+ // could not load db
+ throw new ApplicationBusinessException(_("tutti.dbManager.action.openDb.couldNotOpen"));
+ }
+
+ // ------------------------------------------------------------------ //
+ // --- check schema version //
+ // ------------------------------------------------------------------ //
+
+ progressionModel.increments(_("tutti.openDb.step.checkSchemaVersion"));
+
+ TuttiPersistence persistenceService =
+ getHandler().getPersistenceService();
+
+ dbVersion = persistenceService.getDbVersion();
+
+ if (log.isInfoEnabled()) {
+ log.info("Detected database version: " + dbVersion);
+ }
+ applicationVersion = persistenceService.getApplicationVersion();
+
+ if (log.isInfoEnabled()) {
+ log.info("Detected schema application version:" + applicationVersion);
+ }
+
+ TuttiConfiguration config = getConfig();
+ if (dbVersion.equals(applicationVersion)) {
+
+ // database schema is up to date
+ if (log.isInfoEnabled()) {
+ log.info("Database schema is up-to-date at version: " + dbVersion);
+ }
+ } else if (dbVersion.compareTo(applicationVersion) < 0) {
+
+ // database schema need to migrate
+ // ask user to migrate or not (if not will close db)
+
+ // ask user where to backup db
+
+ String message = _("tutti.dbManager.action.upgradeDb.schema.to.update.message", dbVersion, applicationVersion);
+
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ message,
+ _("tutti.dbManager.action.upgradeDb.schema.to.update.message.help"));
+ int i = JOptionPane.showConfirmDialog(
+ getHandler().getTopestUI(),
+ htmlMessage,
+ _("tutti.dbManager.title.schema.toupdate"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+ boolean continueAction = i == JOptionPane.OK_OPTION;
+
+ if (continueAction) {
+
+ // ask user file where to backup db
+
+ file = saveFile(
+ config.getDbBackupDirectory(),
+ "tutti-db-" + ExportDbAction.df.format(new Date()),
+ "zip",
+ _("tutti.dbManager.title.choose.dbBackupFile"),
+ _("tutti.dbManager.action.chooseDbBackupFile"),
+ "^.*\\.zip", _("tutti.common.file.zip")
+ );
+
+ if (file == null) {
+
+ // won't migrate db
+ closeDb = true;
+
+ displayWarningMessage(
+ _("tutti.dbManager.title.choose.dbBackupFile"),
+ _("tutti.dbManager.action.upgradeDb.no.backup.db.choosen")
+ );
+ } else {
+
+ updateSchema = true;
+ }
+ } else {
+
+ //close db
+ closeDb = true;
+ }
+
+ } else {
+
+ // database schema version is higher than application one
+ displayWarningMessage(
+ _("tutti.dbManager.title.schema.toupdate"),
+ _("tutti.dbManager.action.upgradeDb.schema.not.update.message", dbVersion, applicationVersion)
+ );
+ }
+
+ if (closeDb) {
+
+ // ------------------------------------------------------------------ //
+ // --- close current db //
+ // ------------------------------------------------------------------ //
+
+ progressionModel.increments(_("tutti.importDb.step.closeDb"));
+ getActionEngine().runInternalAction(getHandler(), CloseDbAction.class);
+
+ setScreen(TuttiScreen.MANAGE_DB);
+ super.doAction();
+ return;
+ }
+
+ if (updateSchema) {
+
+ // need to export db + migrate schema)
+ progressionModel.adaptTotal(progressionModel.getTotal() + ExportDbAction.TOTAL_STEP + 1);
+
+ // ------------------------------------------------------------------ //
+ // --- backup current db //
+ // ------------------------------------------------------------------ //
+
+ ApplicationUIAction<ExportDbAction> backupAction =
+ getActionFactory().createUIAction(getHandler(), ExportDbAction.class);
+ backupAction.getLogicAction().setProgressionModel(getProgressionModel());
+ backupAction.getLogicAction().setFile(file);
+ getActionEngine().runInternalAction(backupAction.getLogicAction());
+
+ // ------------------------------------------------------------------ //
+ // --- update schema //
+ // ------------------------------------------------------------------ //
+
+ String message = _("tutti.openDb.step.will.migrateSchema",
+ dbVersion, applicationVersion);
+
+ progressionModel.increments(message);
+ sendMessage(message);
+ getHandler().getPersistenceService().updateSchema();
+ }
+
+ if (updateReferentiel) {
+
+ // ------------------------------------------------------------------ //
+ // --- update referentiel //
+ // ------------------------------------------------------------------ //
+
+ progressionModel.increments(_("tutti.openDb.step.updateReferential"));
+
+ File current = config.getDataDirectory();
+ String url = config.getUpdateDataUrl();
+
+ File dest = new File(config.getBasedir(), "NEW");
+
+ progressionModel.setMessage(_("tutti.dbManager.action.upgradeDb.check"));
+ TuttiDbUpdaterCallBack callback =
+ new TuttiDbUpdaterCallBack(this, progressionModel);
+ ApplicationUpdater up = new ApplicationUpdater();
+ up.update(url,
+ current,
+ dest,
+ false,
+ callback,
+ progressionModel);
+
+ if (callback.isDbUpdated()) {
+
+ progressionModel.setMessage(_("tutti.dbManager.action.upgradeDb.reloading"));
+
+ } else {
+ sendMessage(_("tutti.dbManager.action.upgradeDb.upToDate"));
+ }
+ }
+
+ // ------------------------------------------------------------------ //
+ // --- check db context //
+ // ------------------------------------------------------------------ //
+
+ String message = _("tutti.openDb.step.check.dbContext",
+ dbVersion, applicationVersion);
+
+ progressionModel.increments(message);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Check db context");
+ }
+ getContext().checkDbContext();
+
+ super.doAction();
+ }
+
+ @Override
+ public void postSuccessAction() {
+
+ handler.reloadDbManagerText();
+
+ // make sure title is reloaded
+ handler.changeTitle();
+
+ if (closeDb) {
+ sendMessage(_("tutti.flash.info.db.not.opened", jdbcUrl));
+ } else {
+
+ if (updateSchema) {
+
+ sendMessage(_("tutti.flash.info.db.schema.updated", dbVersion, applicationVersion));
+ }
+
+ sendMessage(_("tutti.flash.info.db.opened", jdbcUrl));
+ }
+ }
+
+ @Override
+ public void postFailedAction(Throwable error) {
+
+ handler.reloadDbManagerText();
+
+ super.postFailedAction(error);
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReimportDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReimportDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReimportDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReimportDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,166 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.ApplicationIOUtil;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.ui.swing.RunTutti;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+import java.io.File;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To import a db after restart application.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class ReimportDbAction extends AbstractMainUITuttiAction {
+
+ protected File backupFile;
+
+ protected File importFile;
+
+ protected String jdbcUrl;
+
+ public ReimportDbAction(MainUIHandler handler) {
+ super(handler, true);
+ setActionDescription(_("tutti.dbManager.action.importDb.tip"));
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ jdbcUrl = null;
+ backupFile = importFile = null;
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ jdbcUrl = getConfig().getJdbcUrl();
+
+ if (getModel().isDbExist()) {
+
+ displayInfoMessage(
+ _("tutti.dbManager.title.backup.db"),
+ _("tutti.dbManager.action.importDb.backup.db")
+ );
+
+ // choose backup file
+ backupFile = saveFile(
+ getConfig().getDbBackupDirectory(),
+ "tutti-db-" + ExportDbAction.df.format(new Date()),
+ "zip",
+ _("tutti.dbManager.title.choose.dbExportFile"),
+ _("tutti.dbManager.action.chooseDbExportFile"),
+ "^.*\\.zip", _("tutti.common.file.zip")
+ );
+
+ if (backupFile == null) {
+
+ displayWarningMessage(
+ _("tutti.dbManager.title.backup.db"),
+ _("tutti.dbManager.action.importdb.no.backup.db.choosen")
+ );
+
+ doAction = false;
+ }
+ }
+
+ if (doAction && importFile == null) {
+
+ // choose file to import
+ importFile = chooseFile(
+ _("tutti.dbManager.title.choose.dbImportFile"),
+ _("tutti.dbManager.action.chooseDbFile"),
+ "^.*\\.zip", _("tutti.common.file.zip")
+ );
+
+ if (importFile == null) {
+
+ displayWarningMessage(
+ _("tutti.dbManager.title.choose.dbImportFile"),
+ _("tutti.dbManager.action.importdb.no.import.file.choosen")
+ );
+
+ doAction = false;
+ }
+ }
+
+ if (doAction) {
+
+ ProgressionModel progressionModel = new ProgressionModel();
+ progressionModel.setTotal(3);
+ setProgressionModel(progressionModel);
+
+ getContext().getPersistenceService().checkImportStructure(importFile);
+ }
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ importFile = backupFile = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkNotNull(importFile);
+ Preconditions.checkNotNull(backupFile);
+
+ ProgressionModel progressionModel = getProgressionModel();
+
+ // close db
+ progressionModel.increments(_("tutti.reimport.step.closeDb", jdbcUrl));
+ getContext().setDbLoaded(false);
+ getHandler().reloadPersistenceService();
+
+ // backup db
+ progressionModel.increments(_("tutti.reimport.step.backupDb", backupFile));
+ getContext().getPersistenceService().exportDb(backupFile);
+
+ // clean db context
+ getContext().clearDbContext();
+
+ // write restart action file (will be load at restart)
+ String actionContent = ImportDbAction.class.getName() + ":" + importFile.getAbsolutePath();
+
+ File startActionFile = getConfig().getStartActionFile();
+ ApplicationIOUtil.writeContent(startActionFile, actionContent, _("tutti.error.write.startActionFile", startActionFile));
+
+ // restart application
+ progressionModel.increments(_("tutti.reimport.step.reloadApplication"));
+
+ RunTutti.closeTutti(getHandler(), RunTutti.DELETE_DB_EXIT_CODE);
+ }
+
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReinstallDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReinstallDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReinstallDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReinstallDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,145 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.ApplicationIOUtil;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.ui.swing.RunTutti;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+import java.io.File;
+import java.util.Date;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To install (or reinstall) a db from last network one.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.4
+ */
+public class ReinstallDbAction extends AbstractMainUITuttiAction {
+
+ protected File backupFile;
+
+ protected String jdbcUrl;
+
+ public ReinstallDbAction(MainUIHandler handler) {
+ super(handler, true);
+ setActionDescription(_("tutti.dbManager.action.installDb.tip"));
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // check we can connect to remote install server
+
+ // check db url is reachable
+ TuttiUIContext context = getContext();
+ doAction = context.checkUpdateDataReachable();
+ }
+
+ if (doAction) {
+
+ jdbcUrl = null;
+ backupFile = null;
+
+ jdbcUrl = getConfig().getJdbcUrl();
+
+ if (getModel().isDbExist()) {
+
+ displayInfoMessage(
+ _("tutti.dbManager.title.backup.db"),
+ _("tutti.dbManager.action.installDb.backup.db")
+ );
+
+ // choose backup file
+ backupFile = saveFile(
+ getConfig().getDbBackupDirectory(),
+ "tutti-db-" + ExportDbAction.df.format(new Date()),
+ "zip",
+ _("tutti.dbManager.title.choose.dbExportFile"),
+ _("tutti.dbManager.action.chooseDbExportFile"),
+ "^.*\\.zip", _("tutti.common.file.zip")
+ );
+
+ if (backupFile == null) {
+
+ displayWarningMessage(
+ _("tutti.dbManager.title.backup.db"),
+ _("tutti.dbManager.action.installDb.no.backup.db.choosen")
+ );
+
+ doAction = false;
+ }
+ }
+ }
+
+ if (doAction) {
+
+ ProgressionModel progressionModel = new ProgressionModel();
+ progressionModel.setTotal(3);
+ setProgressionModel(progressionModel);
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() {
+
+ Preconditions.checkNotNull(backupFile);
+
+ ProgressionModel progressionModel = getProgressionModel();
+
+ // close db
+ progressionModel.increments(_("tutti.reinstallDb.step.closeDb", jdbcUrl));
+
+ getContext().setDbLoaded(false);
+ getHandler().reloadPersistenceService();
+
+ // backup db
+ progressionModel.increments(_("tutti.reinstallDb.step.backupDb", backupFile));
+ getContext().getPersistenceService().exportDb(backupFile);
+
+ // clean db context
+ getContext().clearDbContext();
+
+ // write restart action file (will be loaded at restart)
+ String actionContent = InstallDbAction.class.getName();
+
+ File startActionFile = getConfig().getStartActionFile();
+ ApplicationIOUtil.writeContent(startActionFile, actionContent, _("tutti.error.write.startActionFile", startActionFile));
+
+ // restart application
+ progressionModel.increments(_("tutti.reinstallDb.step.reloadApplication"));
+
+ RunTutti.closeTutti(getHandler(), RunTutti.DELETE_DB_EXIT_CODE);
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReloadTuttiAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ReloadTuttiAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReloadTuttiAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ReloadTuttiAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,52 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.RunTutti;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To reload Tutti application.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0.3
+ */
+public class ReloadTuttiAction extends AbstractChangeScreenAction {
+
+ public ReloadTuttiAction(MainUIHandler handler) {
+ super(handler, true, null);
+ setActionDescription(_("tutti.main.action.reloadTutti"));
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ // Close the application, will exit and restart application
+ RunTutti.closeTutti(getHandler(), RunTutti.UPATE_EXIT_CODE);
+ }
+
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveAccidentalBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/RemoveAccidentalBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveAccidentalBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveAccidentalBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,116 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.TuttiPersistence;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchTableModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.JOptionPane;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.4
+ */
+public class RemoveAccidentalBatchAction extends AbstractTuttiAction<AccidentalBatchUIModel, AccidentalBatchUI, AccidentalBatchUIHandler> {
+
+ private static final Log log =
+ LogFactory.getLog(RemoveAccidentalBatchAction.class);
+
+ public RemoveAccidentalBatchAction(AccidentalBatchUIHandler handler) {
+ super(handler, false);
+ }
+
+ int rowIndex;
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ if (result) {
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ _("tutti.editAccidentalBatch.action.removeBatch.confirm.message"),
+ _("tutti.editAccidentalBatch.action.removeBatch.confirm.title"),
+ JOptionPane.YES_NO_OPTION);
+ result = answer == JOptionPane.YES_OPTION;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ JXTable table = handler.getTable();
+
+ rowIndex = table.getSelectedRow();
+
+ Preconditions.checkState(rowIndex != -1,
+ "Cant remove batch if none is selected");
+
+ AccidentalBatchTableModel tableModel = handler.getTableModel();
+ AccidentalBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
+
+ boolean persisted = !TuttiEntities.isNew(selectedBatch);
+
+ if (persisted) {
+
+ // remove it from db
+
+ String id = selectedBatch.getId();
+
+ if (log.isInfoEnabled()) {
+ log.info("Remove accidental with id: " + id);
+ }
+
+ TuttiPersistence persistenceService =
+ getContext().getPersistenceService();
+
+ persistenceService.deleteAccidentalBatch(id);
+ }
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ JXTable table = handler.getTable();
+
+ AccidentalBatchTableModel tableModel = handler.getTableModel();
+
+ tableModel.removeRow(rowIndex);
+
+ TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveAllIndividualObservationBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/RemoveAllIndividualObservationBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveAllIndividualObservationBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveAllIndividualObservationBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,157 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.TuttiPersistence;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchTableModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.JOptionPane;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Created on 10/3/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 2.7
+ */
+public class RemoveAllIndividualObservationBatchAction
+ extends AbstractTuttiAction<IndividualObservationBatchUIModel, IndividualObservationBatchUI, IndividualObservationBatchUIHandler> {
+
+ private static final Log log =
+ LogFactory.getLog(RemoveAllIndividualObservationBatchAction.class);
+
+ public RemoveAllIndividualObservationBatchAction(IndividualObservationBatchUIHandler handler) {
+ super(handler, false);
+ }
+
+ protected Species species;
+
+ protected List<Integer> rowIndexToRemove;
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ rowIndexToRemove = null;
+ species = null;
+
+ int rowIndex = -1;
+
+ if (result) {
+ JXTable table = handler.getTable();
+
+ rowIndex = table.getSelectedRow();
+
+ Preconditions.checkState(rowIndex != -1,
+ "Cant remove batch if none is selected");
+ }
+
+ if (result) {
+
+ IndividualObservationBatchTableModel tableModel = handler.getTableModel();
+
+ IndividualObservationBatchRowModel entry = tableModel.getEntry(rowIndex);
+
+ species = entry.getSpecies();
+
+ rowIndexToRemove = Lists.newArrayList();
+
+ for (IndividualObservationBatchRowModel rowModel : tableModel.getRows()) {
+ if (species.equals(rowModel.getSpecies())) {
+ rowIndexToRemove.add(0, tableModel.getRowIndex(rowModel));
+ }
+ }
+
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ _("tutti.editIndividualObservationBatch.action.removeAllBatch.confirm.message", rowIndexToRemove.size(), decorate(species)),
+ _("tutti.editIndividualObservationBatch.action.removeAllBatch.confirm.title"),
+ JOptionPane.YES_NO_OPTION);
+ result = answer == JOptionPane.YES_OPTION;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ Preconditions.checkNotNull(rowIndexToRemove);
+ Preconditions.checkNotNull(species);
+
+ IndividualObservationBatchTableModel tableModel = handler.getTableModel();
+
+ for (Integer rowIndex : rowIndexToRemove) {
+ IndividualObservationBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
+
+ boolean persisted = !TuttiEntities.isNew(selectedBatch);
+
+ if (persisted) {
+
+ // remove it from db
+
+ String id = selectedBatch.getId();
+
+ if (log.isInfoEnabled()) {
+ log.info("Remove individual observation with id: " + id);
+ }
+
+ TuttiPersistence persistenceService =
+ getContext().getPersistenceService();
+
+ persistenceService.deleteIndividualObservationBatch(id);
+ }
+ }
+
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ JXTable table = handler.getTable();
+
+ IndividualObservationBatchTableModel tableModel = handler.getTableModel();
+
+ for (Integer rowIndex : rowIndexToRemove) {
+ tableModel.removeRow(rowIndex);
+ }
+
+ TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,145 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.TuttiPersistence;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchTableModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import jaxx.runtime.SwingUtil;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.JOptionPane;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To remove a species batch and all his children.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class RemoveBenthosBatchAction extends AbstractTuttiAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
+
+ /**
+ * Selected row to treat.
+ *
+ * @since 2.8
+ */
+ protected int rowIndex;
+
+ /**
+ * Rows to delete after all.
+ *
+ * @since 3.0-rc-1
+ */
+ protected Set<BenthosBatchRowModel> rowToRemove;
+
+ public RemoveBenthosBatchAction(BenthosBatchUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ rowIndex = -1;
+
+ if (result) {
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ _("tutti.editBenthosBatch.action.removeBatch.confirm.message"),
+ _("tutti.editBenthosBatch.action.removeBatch.confirm.title"),
+ JOptionPane.YES_NO_OPTION);
+ result = answer == JOptionPane.YES_OPTION;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ TuttiPersistence persistenceService =
+ getContext().getPersistenceService();
+
+ JXTable table = handler.getTable();
+
+ rowIndex = SwingUtil.getSelectedModelRow(table);
+
+ Preconditions.checkState(rowIndex != -1,
+ "Cant remove batch if no batch selected");
+
+ BenthosBatchTableModel tableModel = handler.getTableModel();
+ BenthosBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
+
+ Preconditions.checkState(!TuttiEntities.isNew(selectedBatch),
+ "Can't remove batch if batch is not persisted");
+
+ // remove selected batch and all his children
+
+ // remove parent batch (will destroy all his childs from db)
+ persistenceService.deleteBenthosBatch(selectedBatch.getId());
+
+ if (selectedBatch.isBatchRoot()) {
+ // update speciesUsed
+ handler.removeFromSpeciesUsed(selectedBatch);
+ } else {
+
+ // remove from his parent
+ BenthosBatchRowModel parentBatch = selectedBatch.getParentBatch();
+ parentBatch.getChildBatch().remove(selectedBatch);
+ }
+
+ // collect of rows to remove from model
+ rowToRemove = Sets.newHashSet();
+ rowToRemove.add(selectedBatch);
+
+ handler.collectChildren(selectedBatch, rowToRemove);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ JXTable table = handler.getTable();
+
+ // remove all rows from the model
+ getModel().getRows().removeAll(rowToRemove);
+
+ // refresh table from parent batch row index to the end
+ handler.getTableModel().fireTableDataChanged();
+
+ // select parent batch row
+ TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveBenthosProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,136 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesRowModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesTableModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import jaxx.runtime.SwingUtil;
+
+import javax.swing.JTable;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To remove all the selected benthos rows from protocol.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class RemoveBenthosProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+
+ /**
+ * Set of removed species.
+ *
+ * @since 2.8
+ */
+ protected Set<Species> removedSpecies;
+
+ /**
+ * Set of removed rows.
+ *
+ * @since 2.8
+ */
+ protected Set<EditProtocolSpeciesRowModel> removedRows;
+
+
+ public RemoveBenthosProtocolAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ JTable table = handler.getBenthosTable();
+
+ // need to have a selection
+ Preconditions.checkState(!table.getSelectionModel().isSelectionEmpty());
+
+ EditProtocolSpeciesTableModel tableModel =
+ (EditProtocolSpeciesTableModel) table.getModel();
+
+ removedSpecies = Sets.newHashSet();
+ removedRows = Sets.newHashSet();
+
+ EditProtocolUIModel model = getModel();
+
+ for (Integer rowIndex : SwingUtil.getSelectedModelRows(table)) {
+
+ // get row to remove
+ EditProtocolSpeciesRowModel selectedRow =
+ tableModel.getEntry(rowIndex);
+
+ // re-add all synonym of this taxon to the species / benthos combobox
+ Species species = selectedRow.getSpecies();
+ removedSpecies.add(species);
+
+ Integer taxonId = species.getReferenceTaxonId();
+ List<Species> allSynonyms = Lists.newArrayList(
+ model.getAllSynonyms(String.valueOf(taxonId)));
+ allSynonyms.remove(species);
+ model.getAllSynonyms().addAll(allSynonyms);
+
+ // mark row to be removed at the very last moment
+ removedRows.add(selectedRow);
+ }
+
+ // reorder the list by name, otherwise,
+ // all the species without a reftax code will be at the end
+ Collections.sort(model.getAllSynonyms(),
+ TuttiEntities.SPECIES_BY_NAME_COMPARATOR);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ // update comboboxes
+ getUI().getBenthosComboBox().addItems(removedSpecies);
+ getUI().getSpeciesComboBox().addItems(removedSpecies);
+
+ // remove all rows from model
+ getModel().getBenthosRow().removeAll(removedRows);
+
+ // fire table data changed
+ handler.getBenthosTableModel().fireTableDataChanged();
+
+ // clear table selection
+ handler.getBenthosTable().clearSelection();
+
+ // notify user
+ sendMessage(_("tutti.flash.info.benthos.remove.from.protocol"));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosSubBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosSubBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosSubBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveBenthosSubBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,139 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.TuttiPersistence;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import jaxx.runtime.SwingUtil;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.JOptionPane;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To remove a species batch children.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class RemoveBenthosSubBatchAction extends AbstractTuttiAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
+
+ /**
+ * Selected row to treat.
+ *
+ * @since 2.8
+ */
+ protected int rowIndex;
+
+ /**
+ * Rows to delete after all.
+ *
+ * @since 3.0-rc-1
+ */
+ protected Set<BenthosBatchRowModel> rowToRemove;
+
+ /**
+ * Parent batch of rows to delete.
+ *
+ * @since 3.0-rc-1
+ */
+ protected BenthosBatchRowModel parentBatch;
+
+ public RemoveBenthosSubBatchAction(BenthosBatchUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ rowIndex = -1;
+
+ if (result) {
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ _("tutti.editBenthosBatch.action.removeSubBatch.confirm.message"),
+ _("tutti.editBenthosBatch.action.removeSubBatch.confirm.title"),
+ JOptionPane.YES_NO_OPTION);
+ result = answer == JOptionPane.YES_OPTION;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ TuttiPersistence persistenceService =
+ getContext().getPersistenceService();
+
+ JXTable table = handler.getTable();
+
+ rowIndex = SwingUtil.getSelectedModelRow(table);
+
+ Preconditions.checkState(rowIndex != -1,
+ "Cant remove sub batch if no batch selected");
+
+ parentBatch = handler.getTableModel().getEntry(rowIndex);
+
+ Preconditions.checkState(!TuttiEntities.isNew(parentBatch),
+ "Can't remove sub batch if batch is not persisted");
+
+ // save parent batch (will destroy all his childs from db)
+ persistenceService.deleteSpeciesSubBatch(parentBatch.getId());
+
+ // collect of rows to remove from model
+ rowToRemove = Sets.newHashSet();
+
+ handler.collectChildren(parentBatch, rowToRemove);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ JXTable table = handler.getTable();
+
+ // remove all rows from the model
+ getModel().getRows().removeAll(rowToRemove);
+
+ // remove childs from parent batch
+ parentBatch.setChildBatch(null);
+
+ // refresh table from parent batch row index to the end
+ handler.getTableModel().fireTableDataChanged();
+
+ // select parent batch row
+ TuttiUIUtil.selectFirstCellOnRow(table, rowIndex, true);
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveIndividualObservationBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/RemoveIndividualObservationBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveIndividualObservationBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveIndividualObservationBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,117 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.TuttiPersistence;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchTableModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.JOptionPane;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.4
+ */
+public class RemoveIndividualObservationBatchAction
+ extends AbstractTuttiAction<IndividualObservationBatchUIModel, IndividualObservationBatchUI, IndividualObservationBatchUIHandler> {
+
+ private static final Log log =
+ LogFactory.getLog(RemoveIndividualObservationBatchAction.class);
+
+ public RemoveIndividualObservationBatchAction(IndividualObservationBatchUIHandler handler) {
+ super(handler, false);
+ }
+
+ int rowIndex;
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ if (result) {
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ _("tutti.editIndividualObservationBatch.action.removeBatch.confirm.message"),
+ _("tutti.editIndividualObservationBatch.action.removeBatch.confirm.title"),
+ JOptionPane.YES_NO_OPTION);
+ result = answer == JOptionPane.YES_OPTION;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ JXTable table = handler.getTable();
+
+ rowIndex = table.getSelectedRow();
+
+ Preconditions.checkState(rowIndex != -1,
+ "Cant remove batch if none is selected");
+
+ IndividualObservationBatchTableModel tableModel = handler.getTableModel();
+ IndividualObservationBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
+
+ boolean persisted = !TuttiEntities.isNew(selectedBatch);
+
+ if (persisted) {
+
+ // remove it from db
+
+ String id = selectedBatch.getId();
+
+ if (log.isInfoEnabled()) {
+ log.info("Remove individual observation with id: " + id);
+ }
+
+ TuttiPersistence persistenceService =
+ getContext().getPersistenceService();
+
+ persistenceService.deleteIndividualObservationBatch(id);
+ }
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ JXTable table = handler.getTable();
+
+ IndividualObservationBatchTableModel tableModel = handler.getTableModel();
+
+ tableModel.removeRow(rowIndex);
+
+ TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveMarineLitterBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/RemoveMarineLitterBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveMarineLitterBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveMarineLitterBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,126 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.TuttiPersistence;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchTableModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.JOptionPane;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To remove a selected marine litter batch in the table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class RemoveMarineLitterBatchAction extends AbstractTuttiAction<MarineLitterBatchUIModel, MarineLitterBatchUI, MarineLitterBatchUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(RemoveMarineLitterBatchAction.class);
+
+ protected RemoveSpeciesSubBatchAction removeSpeciesSubBatchAction;
+
+ public RemoveMarineLitterBatchAction(MarineLitterBatchUIHandler handler) {
+ super(handler, false);
+ }
+
+ int rowIndex;
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ if (result) {
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ _("tutti.editMarineLitterBatch.action.removeBatch.confirm.message"),
+ _("tutti.editMarineLitterBatch.action.removeBatch.confirm.title"),
+ JOptionPane.YES_NO_OPTION);
+ result = answer == JOptionPane.YES_OPTION;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ JXTable table = handler.getTable();
+
+ rowIndex = table.getSelectedRow();
+
+ Preconditions.checkState(rowIndex != -1,
+ "Cant remove batch if none is selected");
+
+ MarineLitterBatchTableModel tableModel = handler.getTableModel();
+ MarineLitterBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
+
+ boolean persisted = !TuttiEntities.isNew(selectedBatch);
+
+ if (persisted) {
+
+ // remove it from db
+
+ String id = selectedBatch.getId();
+
+ if (log.isInfoEnabled()) {
+ log.info("Remove marineLitter with id: " + id);
+ }
+
+ TuttiPersistence persistenceService =
+ getContext().getPersistenceService();
+
+ persistenceService.deleteMarineLitterBatch(id);
+ }
+
+ // update speciesUsed
+ handler.removeFromMarineLitterCategoriesUsed(selectedBatch);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ JXTable table = handler.getTable();
+
+ MarineLitterBatchTableModel tableModel = handler.getTableModel();
+
+ tableModel.removeRow(rowIndex);
+
+ TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,136 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.TuttiPersistence;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchTableModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import jaxx.runtime.SwingUtil;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.JOptionPane;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To remove a species batch and all his children.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class RemoveSpeciesBatchAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
+
+ /**
+ * Rows to delete after all.
+ *
+ * @since 3.0-rc-1
+ */
+ protected Set<SpeciesBatchRowModel> rowToRemove;
+
+ public RemoveSpeciesBatchAction(SpeciesBatchUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ if (result) {
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ _("tutti.editSpeciesBatch.action.removeBatch.confirm.message"),
+ _("tutti.editSpeciesBatch.action.removeBatch.confirm.title"),
+ JOptionPane.YES_NO_OPTION);
+ result = answer == JOptionPane.YES_OPTION;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ TuttiPersistence persistenceService =
+ getContext().getPersistenceService();
+
+ JXTable table = handler.getTable();
+
+ int rowIndex = SwingUtil.getSelectedModelRow(table);
+
+ Preconditions.checkState(rowIndex != -1,
+ "Cant remove batch if no batch selected");
+
+ SpeciesBatchTableModel tableModel = handler.getTableModel();
+
+ SpeciesBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
+
+ Preconditions.checkState(!TuttiEntities.isNew(selectedBatch),
+ "Can't remove batch if batch is not persisted");
+
+ // remove selected batch and all his children
+
+ // remove parent batch (will destroy all his childs from db)
+ persistenceService.deleteSpeciesBatch(selectedBatch.getId());
+
+ if (selectedBatch.isBatchRoot()) {
+ // update speciesUsed
+ handler.removeFromSpeciesUsed(selectedBatch);
+ } else {
+
+ // remove from his parent
+ SpeciesBatchRowModel parentBatch = selectedBatch.getParentBatch();
+ parentBatch.getChildBatch().remove(selectedBatch);
+ }
+
+ // collect of rows to remove from model
+ rowToRemove = Sets.newHashSet();
+ rowToRemove.add(selectedBatch);
+
+ handler.collectChildren(selectedBatch, rowToRemove);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ JXTable table = handler.getTable();
+
+ // remove all rows from the model
+ getModel().getRows().removeAll(rowToRemove);
+
+ // refresh table from parent batch row index to the end
+ handler.getTableModel().fireTableDataChanged();
+
+ // select parent batch row
+ TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveSpeciesProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,134 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesRowModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesTableModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import jaxx.runtime.SwingUtil;
+
+import javax.swing.JTable;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To remove all the selected species rows from protocol.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class RemoveSpeciesProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /**
+ * Set of removed species.
+ *
+ * @since 2.8
+ */
+ protected Set<Species> removedSpecies;
+
+ /**
+ * Set of removed rows.
+ *
+ * @since 2.8
+ */
+ protected Set<EditProtocolSpeciesRowModel> removedRows;
+
+ public RemoveSpeciesProtocolAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ JTable table = handler.getSpeciesTable();
+
+ // need to have a selection
+ Preconditions.checkState(!table.getSelectionModel().isSelectionEmpty());
+
+ EditProtocolSpeciesTableModel tableModel =
+ (EditProtocolSpeciesTableModel) table.getModel();
+
+ EditProtocolUIModel model = getModel();
+
+ removedSpecies = Sets.newHashSet();
+ removedRows = Sets.newHashSet();
+
+ for (Integer rowIndex : SwingUtil.getSelectedModelRows(table)) {
+
+ // get row to remove
+ EditProtocolSpeciesRowModel selectedRow =
+ tableModel.getEntry(rowIndex);
+
+ // re-add all synonym of this taxon to the species / benthos combobox
+ Species species = selectedRow.getSpecies();
+ removedSpecies.add(species);
+
+ Integer taxonId = species.getReferenceTaxonId();
+ List<Species> allSynonyms = Lists.newArrayList(
+ model.getAllSynonyms(String.valueOf(taxonId)));
+ allSynonyms.remove(species);
+ model.getAllSynonyms().addAll(allSynonyms);
+
+ // mark row to be removed at the very last moment
+ removedRows.add(selectedRow);
+ }
+
+ // reorder the list by name, otherwise,
+ // all the species without a reftax code will be at the end
+ Collections.sort(model.getAllSynonyms(), TuttiEntities.SPECIES_BY_NAME_COMPARATOR);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ // update comboboxes
+ getUI().getBenthosComboBox().addItems(removedSpecies);
+ getUI().getSpeciesComboBox().addItems(removedSpecies);
+
+ // remove all rows from model
+ getModel().getSpeciesRow().removeAll(removedRows);
+
+ // fire table data changed
+ handler.getSpeciesTableModel().fireTableDataChanged();
+
+ // clear table selection
+ handler.getSpeciesTable().clearSelection();
+
+ // notify user
+ sendMessage(_("tutti.flash.info.species.remove.from.protocol"));
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesSubBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesSubBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesSubBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RemoveSpeciesSubBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,141 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
+import fr.ifremer.tutti.persistence.TuttiPersistence;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import jaxx.runtime.SwingUtil;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.JOptionPane;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To remove a species batch children.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class RemoveSpeciesSubBatchAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
+
+ /**
+ * Selected row to treat.
+ *
+ * @since 2.8
+ */
+ protected int rowIndex;
+
+ /**
+ * Rows to delete after all.
+ *
+ * @since 3.0-rc-1
+ */
+ protected Set<SpeciesBatchRowModel> rowToRemove;
+
+ /**
+ * Parent batch of rows to delete.
+ *
+ * @since 3.0-rc-1
+ */
+ protected SpeciesBatchRowModel parentBatch;
+
+ public RemoveSpeciesSubBatchAction(SpeciesBatchUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ rowIndex = -1;
+
+ if (result) {
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ _("tutti.editSpeciesBatch.action.removeSubBatch.confirm.message"),
+ _("tutti.editSpeciesBatch.action.removeSubBatch.confirm.title"),
+ JOptionPane.YES_NO_OPTION);
+ result = answer == JOptionPane.YES_OPTION;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ TuttiPersistence persistenceService =
+ getContext().getPersistenceService();
+
+ JXTable table = handler.getTable();
+
+ rowIndex = SwingUtil.getSelectedModelRow(table);
+
+ Preconditions.checkState(rowIndex != -1,
+ "Cant remove sub batch if no batch selected");
+
+
+ parentBatch = handler.getTableModel().getEntry(rowIndex);
+
+ Preconditions.checkState(!TuttiEntities.isNew(parentBatch),
+ "Can't remove sub batch if batch is not persisted");
+
+ // save parent batch (will destroy all his childs from db)
+ persistenceService.deleteSpeciesSubBatch(parentBatch.getId());
+
+ // collect of rows to remove from model
+
+ rowToRemove = Sets.newHashSet();
+
+ handler.collectChildren(parentBatch, rowToRemove);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ JXTable table = handler.getTable();
+
+ // remove all rows from the model
+ getModel().getRows().removeAll(rowToRemove);
+
+ // remove childs from parent batch
+ parentBatch.setChildBatch(null);
+
+ // refresh table from parent batch row index to the end
+ handler.getTableModel().fireTableDataChanged();
+
+ // select parent batch row
+ TuttiUIUtil.selectFirstCellOnRow(table, rowIndex, true);
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RenameBenthosBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RenameBenthosBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RenameBenthosBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RenameBenthosBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,124 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.SampleCategory;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchTableModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIModel;
+import jaxx.runtime.SwingUtil;
+import org.jdesktop.swingx.JXTable;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To rename the species for a species batch and all his children.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class RenameBenthosBatchAction extends AbstractTuttiAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
+
+ protected Species selectedSpecies;
+
+ public RenameBenthosBatchAction(BenthosBatchUIHandler handler) {
+ super(handler, false);
+
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ BenthosBatchTableModel tableModel = handler.getTableModel();
+ JXTable table = handler.getTable();
+ int selectedRowIndex = SwingUtil.getSelectedModelRow(table);
+ BenthosBatchRowModel row = tableModel.getEntry(selectedRowIndex);
+
+ BenthosBatchUIModel model = handler.getModel();
+ List<Species> speciesList = Lists.newArrayList(
+ getDataContext().getReferentBenthosWithSurveyCode());
+ SampleCategory<?> firstSampleCategory = row.getFirstSampleCategory();
+ Serializable categoryValue = firstSampleCategory.getCategoryValue();
+ speciesList.removeAll(
+ model.getSpeciesUsed().get(
+ (CaracteristicQualitativeValue) categoryValue));
+
+ selectedSpecies = getHandler().openAddSpeciesDialog(
+ _("tutti.selectSpecies.title"),
+ speciesList
+ );
+
+ result &= selectedSpecies != null;
+ return result;
+ }
+
+ @Override
+ public void releaseAction() {
+ selectedSpecies = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ BenthosBatchTableModel tableModel = handler.getTableModel();
+ JXTable table = handler.getTable();
+ int selectedRowIndex = SwingUtil.getSelectedModelRow(table);
+ BenthosBatchRowModel row = tableModel.getEntry(selectedRowIndex);
+
+ PersistenceService persistenceService = getContext().getPersistenceService();
+ persistenceService.changeBenthosBatchSpecies(row.getId(), selectedSpecies);
+
+ SampleCategory<?> firstSampleCategory = row.getFirstSampleCategory();
+ Serializable categoryValue = firstSampleCategory.getCategoryValue();
+ Collection<Species> speciesUsed = getModel().getSpeciesUsed()
+ .get((CaracteristicQualitativeValue) categoryValue);
+ speciesUsed.remove(row.getSpecies());
+ changeChildrenSpecies(row, selectedSpecies);
+ speciesUsed.add(selectedSpecies);
+ }
+
+ protected void changeChildrenSpecies(BenthosBatchRowModel row,
+ Species species) {
+ row.setSpecies(species);
+ List<BenthosBatchRowModel> children = row.getChildBatch();
+ if (children != null) {
+ for (BenthosBatchRowModel child : children) {
+ changeChildrenSpecies(child, species);
+ }
+ }
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RenameSpeciesBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RenameSpeciesBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RenameSpeciesBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/RenameSpeciesBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,124 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.SampleCategory;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchTableModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
+import jaxx.runtime.SwingUtil;
+import org.jdesktop.swingx.JXTable;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To rename the species for a species batch and all his children.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class RenameSpeciesBatchAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
+
+ protected Species selectedSpecies;
+
+ public RenameSpeciesBatchAction(SpeciesBatchUIHandler handler) {
+ super(handler, false);
+
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ SpeciesBatchTableModel tableModel = handler.getTableModel();
+ JXTable table = handler.getTable();
+ int selectedRowIndex = SwingUtil.getSelectedModelRow(table);
+ SpeciesBatchRowModel row = tableModel.getEntry(selectedRowIndex);
+
+ SpeciesBatchUIModel model = handler.getModel();
+ List<Species> speciesList = Lists.newArrayList(
+ getDataContext().getReferentSpeciesWithSurveyCode());
+ SampleCategory<?> firstSampleCategory = row.getFirstSampleCategory();
+ Serializable categoryValue = firstSampleCategory.getCategoryValue();
+ speciesList.removeAll(
+ model.getSpeciesUsed().get((CaracteristicQualitativeValue) categoryValue));
+
+ selectedSpecies = getHandler().openAddSpeciesDialog(
+ _("tutti.selectSpecies.title"),
+ speciesList
+ );
+
+ result &= selectedSpecies != null;
+ return result;
+ }
+
+ @Override
+ public void releaseAction() {
+ selectedSpecies = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ SpeciesBatchTableModel tableModel = handler.getTableModel();
+ JXTable table = handler.getTable();
+ int selectedRowIndex = SwingUtil.getSelectedModelRow(table);
+ SpeciesBatchRowModel row = tableModel.getEntry(selectedRowIndex);
+
+ PersistenceService persistenceService = getContext().getPersistenceService();
+ persistenceService.changeSpeciesBatchSpecies(row.getId(), selectedSpecies);
+
+ SampleCategory<?> firstSampleCategory = row.getFirstSampleCategory();
+ Serializable categoryValue = firstSampleCategory.getCategoryValue();
+
+ Collection<Species> speciesUsed = getModel().getSpeciesUsed()
+ .get((CaracteristicQualitativeValue) categoryValue);
+ speciesUsed.remove(row.getSpecies());
+ changeChildrenSpecies(row, selectedSpecies);
+ speciesUsed.add(selectedSpecies);
+ }
+
+ protected void changeChildrenSpecies(SpeciesBatchRowModel row,
+ Species species) {
+ row.setSpecies(species);
+ List<SpeciesBatchRowModel> children = row.getChildBatch();
+ if (children != null) {
+ for (SpeciesBatchRowModel child : children) {
+ changeChildrenSpecies(child, species);
+ }
+ }
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCatchBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SaveCatchBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCatchBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCatchBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,109 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.CatchBatch;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * To save a {@link CatchBatch}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class SaveCatchBatchAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SaveCatchBatchAction.class);
+
+ /**
+ * A flag to update ui after create or save the edit catch batch.
+ *
+ * @since 1.0
+ */
+ protected boolean updateUI;
+
+ public SaveCatchBatchAction(EditCatchesUIHandler handler) {
+ super(handler, true);
+ }
+
+ public void setUpdateUI(boolean updateUI) {
+ this.updateUI = updateUI;
+ }
+
+ @Override
+ public void releaseAction() {
+ updateUI = true;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ TuttiBeanMonitor<EditCatchesUIModel> monitor =
+ handler.getCatchBatchMonitor();
+
+ // previous fishingOperation was modified, let's save it
+ EditCatchesUIModel beanToSave = monitor.getBean();
+
+ // must save when bean is new or was modifiy and is valid
+ boolean mustSave = (beanToSave.isCreate() || beanToSave.isModify()) &&
+ beanToSave.isValid();
+
+ if (mustSave) {
+
+ PersistenceService persistenceService =
+ getContext().getPersistenceService();
+
+ CatchBatch catchBatch = beanToSave.toEntity();
+
+ if (log.isInfoEnabled()) {
+ log.info("FishingOperation " + catchBatch.getId() +
+ " was modified, will save it.");
+ }
+
+ //FIXME I18n
+ sendMessage(
+ "[ Captures - Caractéristiques générales ] " +
+ "Sauvegarde des modifications du résumé de la capture.");
+
+ persistenceService.saveCatchBatch(catchBatch);
+
+ monitor.clearModified();
+ getModel().setModify(false);
+ }
+
+ getUI().getSpeciesTabContent().getHandler().clearTableSelection();
+
+ }
+
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCruiseAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/SaveCruiseAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCruiseAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,181 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrder;
+import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrders;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUIHandler;
+import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUIModel;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import org.apache.commons.lang3.ObjectUtils;
+
+import javax.swing.JOptionPane;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Saves a cruise
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public class SaveCruiseAction extends AbstractTuttiAction<EditCruiseUIModel, EditCruiseUI, EditCruiseUIHandler> {
+
+ protected PersistenceService persistenceService;
+
+ protected boolean updateVessel;
+
+ protected boolean updateGear;
+
+ public SaveCruiseAction(EditCruiseUIHandler handler) {
+ super(handler, true);
+ persistenceService = getContext().getPersistenceService();
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+
+ Cruise bean = getModel().toBean();
+ if (!TuttiEntities.isNew(bean)) {
+ Cruise oldCruise = persistenceService.getCruise(bean.getId());
+
+ // check gear has not changed
+ if (!oldCruise.getVessel().equals(bean.getVessel())) {
+
+ // if so ask user confirmation
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ _("tutti.editCruise.action.save.vesselChanged.message"),
+ _("tutti.editCruise.action.save.vesselChanged.help"));
+
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ htmlMessage,
+ _("tutti.editCruise.action.save.vesselChanged.title"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.WARNING_MESSAGE);
+
+ result = updateVessel = answer == JOptionPane.OK_OPTION;
+ }
+
+ if (result) {
+
+ if (ObjectUtils.notEqual(oldCruise.getGear(), bean.getGear())) {
+
+ // get all gears to remove
+
+ Set<Gear> gearsToRemove =
+ Sets.<Gear>newHashSet(oldCruise.getGear());
+
+ for (GearWithOriginalRankOrder gearWithOriginalRankOrder : bean.getGear()) {
+ GearWithOriginalRankOrder g =
+ GearWithOriginalRankOrders.newGearWithOriginalRankOrder(
+ gearWithOriginalRankOrder.getIdAsInt(),
+ gearWithOriginalRankOrder.getOriginalRankOrder()
+ );
+ gearsToRemove.remove(g);
+ }
+
+ // check they are not used by any operation of the cruise
+ boolean obsoleteGearIsUsed = persistenceService.isOperationUseGears(
+ bean.getIdAsInt(), gearsToRemove);
+
+ if (obsoleteGearIsUsed) {
+
+ // not possible, can't removed used gears
+
+ String message = _("tutti.persistence.cruise.gearUsedInOperations.error");
+ displayWarningMessage(
+ _("tutti.editCruise.action.save.gearChanged.title"),
+ "<html><body>" + message + "</body></html>"
+ );
+ result = false;
+ } else {
+
+ // if so ask user confirmation
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ _("tutti.editCruise.action.save.gearChanged.message"),
+ _("tutti.editCruise.action.save.gearChanged.help"));
+
+ int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
+ htmlMessage,
+ _("tutti.editCruise.action.save.gearChanged.title"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.WARNING_MESSAGE);
+
+ result = updateGear = answer == JOptionPane.OK_OPTION;
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ TuttiUIContext context = getContext();
+ EditCruiseUIModel model = getModel();
+
+ Cruise bean = model.toBean();
+
+ Cruise saved;
+ if (TuttiEntities.isNew(bean)) {
+
+ saved = persistenceService.createCruise(bean);
+ model.setId(saved.getId());
+ sendMessage(_("tutti.flash.info.cruiseCreated", bean.getName()));
+ } else {
+ saved = persistenceService.saveCruise(bean, updateVessel, updateGear);
+ sendMessage(_("tutti.flash.info.cruiseSaved", bean.getName()));
+ }
+
+ context.setProgramId(saved.getProgram().getId());
+ context.setCruiseId(saved.getId());
+
+ // update originalRankOrder for all gears of the cruise
+ for (GearWithOriginalRankOrder gear : model.getGear()) {
+ gear.setOriginalRankOrder(gear.getRankOrder());
+ }
+ model.setModify(false);
+ }
+
+ @Override
+ public void postSuccessAction() {
+
+ getContext().getMainUI().getHandler().setBodyTitle(
+ EditCruiseUIHandler.getTitle(true));
+
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveFishingOperationAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/SaveFishingOperationAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveFishingOperationAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,185 @@
+
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
+import fr.ifremer.tutti.persistence.entities.data.CatchBatchs;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.service.ValidationService;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.AbstractCaracteristicTabUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.GearUseFeatureTabUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.fishing.VesselUseFeatureTabUIModel;
+import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Saves a fishing operation and potentially sets another screen or switch to another tab.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public class SaveFishingOperationAction extends AbstractTuttiAction<EditFishingOperationUIModel, EditFishingOperationUI, EditFishingOperationUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SaveFishingOperationAction.class);
+
+
+ /**
+ * A flag to update ui after create or save the edit fishing operation.
+ *
+ * @since 1.0
+ */
+ protected boolean updateUI;
+
+ public SaveFishingOperationAction(EditFishingOperationUIHandler handler) {
+ super(handler, true);
+ }
+
+ public void setUpdateUI(boolean updateUI) {
+ this.updateUI = updateUI;
+ }
+
+ @Override
+ public void releaseAction() {
+ updateUI = true;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ TuttiBeanMonitor<EditFishingOperationUIModel> monitor =
+ handler.getFishingOperationMonitor();
+
+ // previous fishingOperation was modified, let's save it
+ EditFishingOperationUIModel beanToSave = monitor.getBean();
+
+ // must save when bean is new or was modifiy and is valid
+ boolean mustSave = beanToSave.getFishingOperation() != null
+ && beanToSave.isValid();
+
+ if (mustSave) {
+
+ // prepare model
+ beanToSave.convertGearShootingCoordinatesToDD();
+
+ // save modified fishing operation
+ FishingOperation toSave = beanToSave.toBean();
+
+ AbstractCaracteristicTabUIModel[] subModels = handler.getSubModels();
+ for (AbstractCaracteristicTabUIModel subModel : subModels) {
+ Class<?> modelClass = subModel.getClass();
+ CaracteristicMap caracteristics = subModel.getCaracteristicMap();
+
+ if (modelClass.isAssignableFrom(VesselUseFeatureTabUIModel.class)) {
+ toSave.setVesselUseFeatures(caracteristics);
+
+ } else if (modelClass.isAssignableFrom(GearUseFeatureTabUIModel.class)) {
+ toSave.setGearUseFeatures(caracteristics);
+
+ }
+ subModel.setModify(false);
+ }
+
+ sendMessage(
+ "[ Trait - Caractéristiques générales ] " +
+ "Sauvegarde des modifications de " + decorate(toSave) +
+ ".");
+
+ if (log.isInfoEnabled()) {
+ log.info("FishingOperation " + toSave.getId() +
+ " was modified, will save it.");
+ }
+
+ monitor.clearModified();
+ getModel().setModify(false);
+
+ saveFishingOperation(toSave);
+
+ if (ValidationService.VALIDATION_CONTEXT_EDIT.equals(getContext().getValidationContext())) {
+ handler.getParentUi().getTabPane().setSelectedIndex(1);
+ handler.getParentUi().getCatchesTabContent().getTabPane().setSelectedIndex(1);
+ }
+ }
+
+ }
+
+ protected void saveFishingOperation(FishingOperation toSave) {
+
+ PersistenceService service = getContext().getPersistenceService();
+
+ boolean create = TuttiEntities.isNew(toSave);
+
+ FishingOperationsUIModel model =
+ getHandler().getParentUi().getModel();
+ FishingOperation savedFishingOperation;
+
+ if (create) {
+
+ // create fishing operation
+ savedFishingOperation = service.createFishingOperation(toSave);
+
+ // create then the CatchBatch
+ CatchBatch catchBatch = CatchBatchs.newCatchBatch();
+ catchBatch.setFishingOperation(savedFishingOperation);
+ service.createCatchBatch(catchBatch);
+
+ // add new created fishing operation to list
+ model.addFishingOperation(savedFishingOperation);
+
+ // select it (will reload editing fishing operation)
+ model.setSelectedFishingOperation(savedFishingOperation);
+
+ } else {
+
+ model.setEditionAdjusting(true);
+
+ try {
+ // save fishing operation
+ savedFishingOperation = service.saveFishingOperation(toSave);
+
+ model.setSelectedFishingOperation(null);
+
+ // reinject it in model
+ model.updateFishingOperation(savedFishingOperation);
+
+ model.setSelectedFishingOperation(savedFishingOperation);
+ } finally {
+ model.setEditionAdjusting(false);
+ }
+ }
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveProgramAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/SaveProgramAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveProgramAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveProgramAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,81 @@
+
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.program.EditProgramUI;
+import fr.ifremer.tutti.ui.swing.content.program.EditProgramUIHandler;
+import fr.ifremer.tutti.ui.swing.content.program.EditProgramUIModel;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class SaveProgramAction extends AbstractTuttiAction<EditProgramUIModel, EditProgramUI, EditProgramUIHandler> {
+
+ public SaveProgramAction(EditProgramUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ TuttiUIContext context = getContext();
+ PersistenceService persistenceService =
+ getContext().getPersistenceService();
+
+ EditProgramUIModel model = getModel();
+
+ Program bean = model.toBean();
+
+ Program saved;
+ if (TuttiEntities.isNew(bean)) {
+
+ saved = persistenceService.createProgram(bean);
+ model.setId(saved.getId());
+ sendMessage(_("tutti.flash.info.programCreated", bean.getName()));
+ } else {
+ saved = persistenceService.saveProgram(bean);
+ sendMessage(_("tutti.flash.info.programSaved", bean.getName()));
+ }
+
+ context.setProgramId(saved.getId());
+
+ model.setModify(false);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ getContext().getMainUI().getHandler().setBodyTitle(
+ EditProgramUIHandler.getTitle(true));
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveProtocolAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SaveProtocolAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveProtocolAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,122 @@
+
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.protocol.SpeciesProtocol;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesRowModel;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Saves a protocol
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public class SaveProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(SaveProtocolAction.class);
+
+ public SaveProtocolAction(EditProtocolUIHandler handler) {
+ super(handler, true);
+ }
+
+ /**
+ * If the event source is a TuttiScreen, then the screen changes to the source.
+ * Otherwise, the screen changes to the home.
+ */
+ @Override
+ public void doAction() throws Exception {
+ EditProtocolUIModel model = getModel();
+ TuttiUIContext context = getContext();
+
+ PersistenceService persistenceService = context.getPersistenceService();
+
+ TuttiProtocol bean = model.toBean();
+
+ // get the species protocols from the table
+ List<SpeciesProtocol> speciesProtocols = Lists.newArrayList();
+
+ for (EditProtocolSpeciesRowModel row : model.getSpeciesRow()) {
+ if (row.isValid()) {
+ SpeciesProtocol protocol = row.toBean();
+ speciesProtocols.add(protocol);
+ }
+ }
+ bean.setSpecies(speciesProtocols);
+
+ List<SpeciesProtocol> benthosProtocols = Lists.newArrayList();
+
+ for (EditProtocolSpeciesRowModel row : model.getBenthosRow()) {
+ if (row.isValid()) {
+ SpeciesProtocol protocol = row.toBean();
+ benthosProtocols.add(protocol);
+ }
+ }
+ bean.setBenthos(benthosProtocols);
+
+ if (log.isDebugEnabled()) {
+ log.debug("protocol id to save: " + bean.getId());
+ }
+
+ TuttiProtocol saved;
+
+ if (TuttiEntities.isNew(bean)) {
+
+ saved = persistenceService.createProtocol(bean);
+ model.setId(saved.getId());
+ sendMessage(_("tutti.flash.info.protocolCreated", bean.getName()));
+ } else {
+ saved = persistenceService.saveProtocol(bean);
+ sendMessage(_("tutti.flash.info.protocolSaved", bean.getName()));
+ }
+
+ context.setProtocolId(saved.getId());
+
+ model.setModify(false);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ getContext().getMainUI().getHandler().setBodyTitle(
+ EditProtocolUIHandler.getTitle(true));
+ getUI().getSaveWarningContainer().setVisible(false);
+
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveSampleCategoryModelAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/SaveSampleCategoryModelAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveSampleCategoryModelAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SaveSampleCategoryModelAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,68 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.SampleCategoryModel;
+import fr.ifremer.tutti.ui.swing.content.category.EditSampleCategoryModelUI;
+import fr.ifremer.tutti.ui.swing.content.category.EditSampleCategoryModelUIHandler;
+import fr.ifremer.tutti.ui.swing.content.category.EditSampleCategoryModelUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * To save the sample category model.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.4
+ */
+public class SaveSampleCategoryModelAction extends AbstractTuttiAction<EditSampleCategoryModelUIModel, EditSampleCategoryModelUI, EditSampleCategoryModelUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SaveSampleCategoryModelAction.class);
+
+ public SaveSampleCategoryModelAction(EditSampleCategoryModelUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ EditSampleCategoryModelUIModel model = getModel();
+
+ SampleCategoryModel bean = model.toBean();
+
+ if (log.isInfoEnabled()) {
+ log.info("Will save sampleCategoryModel: " + bean);
+ }
+ getConfig().setSampleCategoryModel(bean);
+
+ getConfig().save();
+
+ getDataContext().loadSampleCategoryModel(bean);
+
+ model.setModify(false);
+
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectCruiseAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/SelectCruiseAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectCruiseAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,42 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+/**
+ * Opens the cruise selection screen (home).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class SelectCruiseAction extends AbstractChangeScreenAction {
+
+ public SelectCruiseAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.SELECT_CRUISE);
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectOtherBenthosAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherBenthosAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectOtherBenthosAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectOtherBenthosAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,93 @@
+
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.Species;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Action to select a benthos which is not in the referent list.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.1
+ */
+public class SelectOtherBenthosAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SelectOtherBenthosAction.class);
+
+ protected Species selectedSpecies;
+
+ public SelectOtherBenthosAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+ if (result) {
+ EditProtocolUIModel model = getModel();
+
+ List<Species> species = Lists.newArrayList(model.getAllSynonyms());
+
+ selectedSpecies = getHandler().openSelectOtherSpeciesDialog(
+ _("tutti.selectBenthos.title"), species);
+
+ if (log.isInfoEnabled()) {
+ log.info("SelectedBenthos: " + selectedSpecies);
+ }
+ result = selectedSpecies != null;
+ }
+ return result;
+ }
+
+ @Override
+ public void releaseAction() {
+ selectedSpecies = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ String decoratedSynonym = decorate(selectedSpecies);
+ String taxonId = String.valueOf(selectedSpecies.getReferenceTaxonId());
+ selectedSpecies = getModel().getAllReferentSpeciesByTaxonId().get(taxonId);
+ String decoratedReferent = decorate(selectedSpecies);
+ sendMessage(_("tutti.flash.info.benthos.replaced", decoratedSynonym, decoratedReferent));
+ getUI().getBenthosComboBox().setSelectedItem(selectedSpecies);
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectOtherSpeciesAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherSpeciesAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectOtherSpeciesAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectOtherSpeciesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,93 @@
+
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.Species;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
+import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Action to select a species which is not in the referent list.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.1
+ */
+public class SelectOtherSpeciesAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SelectOtherSpeciesAction.class);
+
+ protected Species selectedSpecies;
+
+ public SelectOtherSpeciesAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+ if (result) {
+ EditProtocolUIModel model = getModel();
+
+ List<Species> species = Lists.newArrayList(model.getAllSynonyms());
+
+ selectedSpecies = getHandler().openSelectOtherSpeciesDialog(
+ _("tutti.selectSpecies.title"), species);
+
+ if (log.isInfoEnabled()) {
+ log.info("SelectedSpecies: " + selectedSpecies);
+ }
+ result = selectedSpecies != null;
+ }
+ return result;
+ }
+
+ @Override
+ public void releaseAction() {
+ selectedSpecies = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ String decoratedSynonym = decorate(selectedSpecies);
+ String taxonId = String.valueOf(selectedSpecies.getReferenceTaxonId());
+ selectedSpecies = getModel().getAllReferentSpeciesByTaxonId().get(taxonId);
+ String decoratedReferent = decorate(selectedSpecies);
+ sendMessage(_("tutti.flash.info.species.replaced", decoratedSynonym, decoratedReferent));
+ getUI().getSpeciesComboBox().setSelectedItem(selectedSpecies);
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForBenthosBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/SelectSpeciesForBenthosBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForBenthosBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForBenthosBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,103 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.Species;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.create.CreateBenthosBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.create.CreateBenthosBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.create.CreateBenthosBatchUIModel;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Enable to select a species to the species selected in the protocol.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public class SelectSpeciesForBenthosBatchAction extends AbstractTuttiAction<CreateBenthosBatchUIModel, CreateBenthosBatchUI, CreateBenthosBatchUIHandler> {
+
+ protected List<Species> allSpecies;
+
+ protected List<Species> referentSpecies;
+
+ protected Species selectedSpecies;
+
+ public SelectSpeciesForBenthosBatchAction(CreateBenthosBatchUIHandler handler) {
+ super(handler, false);
+
+ allSpecies = getDataContext().getSpecies();
+ referentSpecies = getDataContext().getReferentSpecies();
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean canContinue = super.prepareAction();
+ if (canContinue) {
+
+ CreateBenthosBatchUIModel model = getModel();
+
+ List<Species> species = Lists.newArrayList(allSpecies);
+ species.removeAll(model.getAvailableSpecies());
+
+ selectedSpecies = getHandler().openAddSpeciesDialog(
+ _("tutti.selectSpecies.title"), species);
+ canContinue = selectedSpecies != null;
+ }
+ return canContinue;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ CreateBenthosBatchUIModel model = getModel();
+
+ List<Species> availableSpecies = Lists.newArrayList(model.getAvailableSpecies());
+
+ if (!selectedSpecies.isReferenceTaxon()) {
+ String decoratedSynonym = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
+ List<Species> referents = referentSpecies;
+ Map<String, Species> referentsById = TuttiEntities.splitByTaxonId(referents);
+ String taxonId = String.valueOf(selectedSpecies.getReferenceTaxonId());
+ selectedSpecies = referentsById.get(taxonId);
+ String decoratedReferent = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
+ sendMessage(_("tutti.flash.info.species.replaced", decoratedSynonym, decoratedReferent));
+ }
+
+ if (!availableSpecies.contains(selectedSpecies)) {
+ availableSpecies.add(selectedSpecies);
+ }
+ model.setAvailableSpecies(availableSpecies);
+ model.setSpecies(selectedSpecies);
+
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForIndividualObservationBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/SelectSpeciesForIndividualObservationBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForIndividualObservationBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForIndividualObservationBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,105 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.Species;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.create.CreateIndividualObservationBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.create.CreateIndividualObservationBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.create.CreateIndividualObservationBatchUIModel;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Enable to select a species to the species selected in the protocol.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.0
+ */
+public class SelectSpeciesForIndividualObservationBatchAction extends AbstractTuttiAction<CreateIndividualObservationBatchUIModel,
+ CreateIndividualObservationBatchUI,
+ CreateIndividualObservationBatchUIHandler> {
+
+ protected List<Species> allSpecies;
+
+ protected List<Species> referentSpecies;
+
+ protected Species selectedSpecies;
+
+ public SelectSpeciesForIndividualObservationBatchAction(CreateIndividualObservationBatchUIHandler handler) {
+ super(handler, false);
+
+ allSpecies = getDataContext().getSpecies();
+ referentSpecies = getDataContext().getReferentSpecies();
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean canContinue = super.prepareAction();
+ if (canContinue) {
+
+ CreateIndividualObservationBatchUIModel model = getModel();
+
+ List<Species> species = Lists.newArrayList(allSpecies);
+ species.removeAll(model.getAvailableSpecies());
+
+ selectedSpecies = getHandler().openAddSpeciesDialog(
+ _("tutti.selectSpecies.title"), species);
+ canContinue = selectedSpecies != null;
+ }
+ return canContinue;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ CreateIndividualObservationBatchUIModel model = getModel();
+
+ List<Species> availableSpecies = Lists.newArrayList(model.getAvailableSpecies());
+
+ if (!selectedSpecies.isReferenceTaxon()) {
+ String decoratedSynonym = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
+ List<Species> referents = referentSpecies;
+ Map<String, Species> referentsById = TuttiEntities.splitByTaxonId(referents);
+ String taxonId = String.valueOf(selectedSpecies.getReferenceTaxonId());
+ selectedSpecies = referentsById.get(taxonId);
+ String decoratedReferent = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
+ sendMessage(_("tutti.flash.info.species.replaced", decoratedSynonym, decoratedReferent));
+ }
+
+ if (!availableSpecies.contains(selectedSpecies)) {
+ availableSpecies.add(selectedSpecies);
+ }
+ model.setAvailableSpecies(availableSpecies);
+ model.setSpecies(selectedSpecies);
+
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForSpeciesBatchAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/SelectSpeciesForSpeciesBatchAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForSpeciesBatchAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SelectSpeciesForSpeciesBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,103 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.Species;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.CreateSpeciesBatchUI;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.CreateSpeciesBatchUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.CreateSpeciesBatchUIModel;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Enable to select a species to the species selected in the protocol.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public class SelectSpeciesForSpeciesBatchAction extends AbstractTuttiAction<CreateSpeciesBatchUIModel, CreateSpeciesBatchUI, CreateSpeciesBatchUIHandler> {
+
+ protected List<Species> allSpecies;
+
+ protected List<Species> referentSpecies;
+
+ protected Species selectedSpecies;
+
+ public SelectSpeciesForSpeciesBatchAction(CreateSpeciesBatchUIHandler handler) {
+ super(handler, false);
+
+ allSpecies = getDataContext().getSpecies();
+ referentSpecies = getDataContext().getReferentSpecies();
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean canContinue = super.prepareAction();
+ if (canContinue) {
+
+ CreateSpeciesBatchUIModel model = getModel();
+
+ List<Species> species = Lists.newArrayList(allSpecies);
+ species.removeAll(model.getAvailableSpecies());
+
+ selectedSpecies = getHandler().openAddSpeciesDialog(
+ _("tutti.selectSpecies.title"), species);
+ canContinue = selectedSpecies != null;
+ }
+ return canContinue;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ CreateSpeciesBatchUIModel model = getModel();
+
+ List<Species> availableSpecies = Lists.newArrayList(model.getAvailableSpecies());
+
+ if (!selectedSpecies.isReferenceTaxon()) {
+ String decoratedSynonym = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
+ List<Species> referents = referentSpecies;
+ Map<String, Species> referentsById = TuttiEntities.splitByTaxonId(referents);
+ String taxonId = String.valueOf(selectedSpecies.getReferenceTaxonId());
+ selectedSpecies = referentsById.get(taxonId);
+ String decoratedReferent = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
+ sendMessage(_("tutti.flash.info.species.replaced", decoratedSynonym, decoratedReferent));
+ }
+
+ if (!availableSpecies.contains(selectedSpecies)) {
+ availableSpecies.add(selectedSpecies);
+ }
+ model.setAvailableSpecies(availableSpecies);
+ model.setSpecies(selectedSpecies);
+
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SendCruiseReportAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SendCruiseReportAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SendCruiseReportAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,121 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.ApplicationTechnicalException;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.service.export.pdf.CatchesPdfExportService;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JOptionPane;
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Opens a file chooser, exports the cruise catches into the selected file and open the default email editor.
+ *
+ * @author kmorin <morin(a)codelutin.com>
+ * @since 1.0
+ */
+public class SendCruiseReportAction extends AbstractMainUITuttiAction {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SendCruiseReportAction.class);
+
+ protected File file;
+
+ public SendCruiseReportAction(MainUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ Cruise cruise = getDataContext().getCruise();
+ // choose file to export
+ file = saveFile(
+ "exportCruise-" + cruise.getName(),
+ "pdf",
+ _("tutti.sendCruiseReport.title.choose.exportFile"),
+ _("tutti.sendCruiseReport.action.chooseFile"),
+ "^.+\\.pdf$", _("tutti.common.file.pdf")
+ );
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Cruise cruise = getDataContext().getCruise();
+ Preconditions.checkNotNull(cruise);
+ Preconditions.checkNotNull(file);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will export cruise " + cruise.getId() +
+ " to file: " + file);
+ }
+
+ // export catches
+ CatchesPdfExportService service =
+ getContext().getGeneratePDFService();
+ service.generateCruisePDFFile(file, cruise.getId(), getConfig().getI18nLocale());
+
+ try {
+
+ TuttiUIUtil.mail(_("tutti.sendCruiseReport.mail.subject", cruise.getName()),
+ _("tutti.sendCruiseReport.mail.body", cruise.getName(), file.getAbsolutePath()));
+
+ } catch (ApplicationTechnicalException e) {
+ JOptionPane.showMessageDialog(getContext().getMainUI(),
+ _("tutti.sendCruiseReport.action.error.mail.message", file),
+ _("tutti.sendCruiseReport.action.error.mail.title"),
+ JOptionPane.WARNING_MESSAGE);
+ }
+
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ sendMessage(_("tutti.sendCruiseReport.action.success", file));
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowAboutAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowAboutAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowAboutAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowAboutAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,304 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.Joiner;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import fr.ifremer.tutti.TuttiConfiguration;
+import fr.ifremer.tutti.ui.swing.TuttiApplicationUpdaterCallBack;
+import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
+import fr.ifremer.tutti.ui.swing.TuttiReportUpdaterCallBack;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import jaxx.runtime.swing.AboutPanel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.updater.ApplicationInfo;
+import org.nuiton.updater.ApplicationUpdater;
+
+import javax.swing.JEditorPane;
+import javax.swing.JScrollPane;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+import java.io.File;
+import java.net.URL;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To show about panel.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2
+ */
+public class ShowAboutAction extends AbstractMainUITuttiAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(ShowAboutAction.class);
+
+ protected AboutPanel about;
+
+ public ShowAboutAction(MainUIHandler handler) {
+ super(handler, false);
+ }
+
+ protected boolean canUpdateApplication;
+
+ protected boolean canUpdateData;
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+ // check db url is reachable
+ TuttiUIContext context = getContext();
+ canUpdateApplication = context.checkUpdateApplicationReachable();
+ canUpdateData = context.checkUpdateDataReachable();
+
+ }
+
+ return doAction;
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ about.showInDialog(getUI(), true);
+
+ // register on swing session
+ getContext().getSwingSession().add(about);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ about = null;
+
+ String iconPath = "/icons/allegro_about.png";
+ String name = "tutti";
+ String licensePath = "META-INF/" + name + "-LICENSE.txt";
+ String thirdPartyPath = "META-INF/" + name + "-THIRD-PARTY.txt";
+
+ about = new AboutPanel();
+ about.setTitle(_("tutti.about.title"));
+ about.setAboutText(_("tutti.about.message"));
+
+ TuttiConfiguration config = getConfig();
+ int currentYear = Calendar.getInstance().get(Calendar.YEAR);
+ int inceptionYear = config.getInceptionYear();
+ String years;
+ if (currentYear != inceptionYear) {
+ years = inceptionYear + "-" + currentYear;
+ } else {
+ years = inceptionYear + "";
+ }
+
+ about.setBottomText(_("tutti.about.bottomText",
+ config.getOrganizationName(),
+ years,
+ config.getVersion()));
+ about.setIconPath(iconPath);
+ about.setLicenseFile(licensePath);
+ about.setThirdpartyFile(thirdPartyPath);
+ about.buildTopPanel();
+
+ //
+ // translate tab
+ //
+
+ JScrollPane translatePane = new JScrollPane();
+ JEditorPane translateArea = new JEditorPane();
+ translateArea.setContentType("text/html");
+ translateArea.setEditable(false);
+ if (translateArea.getFont() != null) {
+ translateArea.setFont(translateArea.getFont().deriveFont((float) 11));
+ }
+
+ translateArea.setBorder(null);
+ File csvFile = new File(config.getI18nDirectory(), "tutti-i18n.csv");
+ String translateText = _("tutti.about.translate.content", csvFile.toURI().toURL());
+ translateArea.setText(translateText);
+ translatePane.getViewport().add(translateArea);
+ translateArea.addHyperlinkListener(new HyperlinkListener() {
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent e) {
+ if (HyperlinkEvent.EventType.ACTIVATED == e.getEventType()) {
+ URL url = e.getURL();
+ if (log.isInfoEnabled()) {
+ log.info("edit url: " + url);
+ }
+ TuttiUIUtil.openLink(url);
+ }
+ }
+ });
+
+ about.getTabs().add(_("tutti.about.translate.title"), translatePane);
+
+ if (canUpdateApplication || canUpdateData) {
+
+ //
+ // update tab
+ //
+
+ addUpdateTab(config);
+
+ }
+ about.init();
+ }
+
+ protected void addUpdate(Map<String, ApplicationInfo> source,
+ Map<String, ApplicationInfo> target,
+ String type) {
+ ApplicationInfo info = source.get(type.toLowerCase());
+ target.put(type, info);
+ }
+
+ protected void addUpdateTab(TuttiConfiguration config) {
+ File current = config.getBasedir();
+ String urlApplication = config.getUpdateApplicationUrl();
+ String urlData = config.getUpdateDataUrl();
+
+ ApplicationUpdater up = new ApplicationUpdater();
+
+ // create final update map
+ final Map<String, ApplicationInfo> versions = Maps.newLinkedHashMap();
+
+ if (canUpdateApplication) {
+
+ // get application updates
+ Map<String, ApplicationInfo> applicationVersions = up.getVersions(urlApplication, current);
+
+ addUpdate(applicationVersions, versions, TuttiApplicationUpdaterCallBack.UpdateType.JRE.name());
+ addUpdate(applicationVersions, versions, TuttiApplicationUpdaterCallBack.UpdateType.TUTTI.name());
+ addUpdate(applicationVersions, versions, TuttiApplicationUpdaterCallBack.UpdateType.I18N.name());
+ addUpdate(applicationVersions, versions, TuttiApplicationUpdaterCallBack.UpdateType.HELP.name());
+ }
+
+ if (canUpdateData) {
+
+ // get report updates
+ Map<String, ApplicationInfo> reportVersions = up.getVersions(urlData, current);
+ addUpdate(reportVersions, versions, TuttiReportUpdaterCallBack.REPORT_UPDATE_NAME);
+
+ // get db updates
+ Map<String, ApplicationInfo> dbVersions = up.getVersions(urlData, config.getDataDirectory());
+ addUpdate(dbVersions, versions, TuttiDbUpdaterCallBack.DB_UPDATE_NAME);
+ }
+ JScrollPane updatePane = new JScrollPane();
+ JEditorPane updateArea = new JEditorPane();
+ updateArea.setContentType("text/html");
+ updateArea.setEditable(false);
+ if (updateArea.getFont() != null) {
+ updateArea.setFont(updateArea.getFont().deriveFont((float) 11));
+ }
+ updateArea.setBorder(null);
+
+ List<String> params = Lists.newArrayList();
+ for (Map.Entry<String, ApplicationInfo> entry : versions.entrySet()) {
+ String appName = entry.getKey();
+ ApplicationInfo info = entry.getValue();
+ String oldVersion = info.oldVersion;
+ String newVersion = info.newVersion;
+ String i18nKey = "tutti.update." + appName.toLowerCase();
+ String appLabel = _(i18nKey);
+
+ if (log.isInfoEnabled()) {
+ log.info(String.format(
+ "Module %s, version courante %s, nouvelle version %s",
+ appLabel, oldVersion, newVersion));
+ }
+ if (newVersion == null) {
+
+ // no update
+ params.add(_("tutti.about.update.app.noup.detail", appLabel, oldVersion));
+ } else {
+ // update exists
+ params.add(_("tutti.about.update.app.up.detail", appLabel, oldVersion, newVersion, appName));
+ }
+ }
+
+ String updateText = _("tutti.about.update.content", urlApplication, urlData, Joiner.on("\n").join(params));
+ updateArea.setText(updateText);
+ updatePane.getViewport().add(updateArea);
+ updateArea.addHyperlinkListener(new HyperlinkListener() {
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent e) {
+ if (HyperlinkEvent.EventType.ACTIVATED == e.getEventType()) {
+ URL url = e.getURL();
+ if (url != null) {
+ TuttiUIUtil.openLink(url);
+ } else {
+ String appType = e.getDescription();
+
+
+ if (log.isInfoEnabled()) {
+ log.info("Open url: " + appType);
+ }
+ AbstractTuttiAction action;
+
+ if (TuttiDbUpdaterCallBack.DB_UPDATE_NAME.equals(appType)) {
+ UpdateDbAction logicAction = getContext().getActionFactory().createLogicAction(getHandler(), UpdateDbAction.class);
+ action = logicAction;
+ if (!getContext().isDbExist()) {
+
+ // install db
+ action.setActionDescription(
+ _("tutti.dbManager.action.installDb.tip"));
+ }
+ } else if (TuttiReportUpdaterCallBack.REPORT_UPDATE_NAME.equals(appType)) {
+ UpdateReportAction logicAction = getContext().getActionFactory().createLogicAction(getHandler(), UpdateReportAction.class);
+ action = logicAction;
+ } else {
+
+ TuttiApplicationUpdaterCallBack.UpdateType updateType =
+ TuttiApplicationUpdaterCallBack.UpdateType.valueOf(appType.toUpperCase());
+
+ UpdateApplicationAction logicAction = getContext().getActionFactory().createLogicAction(getHandler(), UpdateApplicationAction.class);
+ logicAction.setTypes(updateType);
+ logicAction.setActionDescription(_("tutti.main.action.updateSpecificApplication.tip", updateType.getLabel()));
+ action = logicAction;
+ }
+
+ // close this dialog
+ getActionEngine().runAction(about.getClose());
+
+ // do update
+ getActionEngine().runAction(action);
+ }
+
+ }
+ }
+ });
+ about.getTabs().add(_("tutti.about.update.title"), updatePane);
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowConfigAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowConfigAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowConfigAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowConfigAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,41 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+
+/**
+ * To show config screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class ShowConfigAction extends AbstractChangeScreenAction {
+
+ public ShowConfigAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.CONFIG);
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowReportAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowReportAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowReportAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ShowReportAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,54 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * To show report screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.9
+ */
+public class ShowReportAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(ShowReportAction.class);
+
+ public ShowReportAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.REPORT);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ if (log.isDebugEnabled()) {
+ log.debug("Show report screen");
+ }
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/StartAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/StartAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/StartAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/StartAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,173 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.ApplicationIOUtil;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Start action.
+ * <p/>
+ * If there is a start action file, then load it and run inside actions, otherwise
+ * just starts normal ui action (open db if exists, or go to manage db screen).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.4
+ */
+public class StartAction extends AbstractMainUITuttiAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(StartAction.class);
+
+ protected AbstractMainUITuttiAction delegateAction;
+
+ public StartAction(MainUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+
+ File actionfile = getConfig().getStartActionFile();
+ boolean doAction = actionfile.exists();
+
+ if (doAction) {
+
+ try {
+ // get action to execute
+ String content = ApplicationIOUtil.readContent(actionfile, _("tutti.error.read.startActionFile", actionfile));
+ content = content.trim();
+
+ if (InstallDbAction.class.getName().equals(content)) {
+
+ // install db
+ delegateAction = getContext().getActionFactory().createLogicAction(handler, InstallDbAction.class);
+
+ if (log.isInfoEnabled()) {
+ log.info("Found install db action");
+ }
+ deleteOldDatabaseDirectory();
+
+ } else if (content.startsWith(ImportDbAction.class.getName())) {
+
+ // import db
+ ImportDbAction action = getContext().getActionFactory().createLogicAction(handler, ImportDbAction.class);
+ File importFile = new File(content.substring(ImportDbAction.class.getName().length() + 1));
+ action.setImportFile(importFile);
+ delegateAction = action;
+ if (log.isInfoEnabled()) {
+ log.info("Found import db action (with file " + importFile + ")");
+ }
+ deleteOldDatabaseDirectory();
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn("Unknown start action: " + content);
+ }
+ doAction = false;
+ }
+
+ } finally {
+
+ // delete start action file
+ ApplicationIOUtil.deleteFile(
+ actionfile,
+ _("tutti.error.delete.startActionFile", actionfile));
+ }
+ }
+
+ if (!doAction) {
+
+ // no start action, normal start
+
+ TuttiUIContext context = getContext();
+
+ if (context.isDbLoaded()) {
+
+ // db already opened (happens when reloading ui)
+ // just go to select cruise screen
+ SelectCruiseAction action = getContext().getActionFactory().createLogicAction(handler, SelectCruiseAction.class);
+ action.setSkipCheckCurrentScreen(true);
+ action.setActionDescription(getUI().getMenuActionSelectCruise().getToolTipText());
+ delegateAction = action;
+
+ } else {
+
+ if (context.isDbExist()) {
+
+ // open tutti db (using a fake button to have simple api)
+ OpenDbAction action = getContext().getActionFactory().createLogicAction(handler, OpenDbAction.class);
+ action.setSkipCheckCurrentScreen(true);
+ action.setUpdateReferentiel(true);
+ delegateAction = action;
+
+ } else {
+
+ // clean db context
+ context.clearDbContext();
+
+ // go to manage db screen (to install db)
+ ManageDbAction action = getContext().getActionFactory().createLogicAction(handler, ManageDbAction.class);
+ action.setSkipCheckCurrentScreen(true);
+ delegateAction = action;
+ }
+ }
+ }
+
+ setActionDescription(delegateAction.getActionDescription());
+ doAction = delegateAction.prepareAction();
+ return doAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ getActionEngine().runInternalAction(delegateAction);
+ }
+
+ @Override
+ protected void releaseAction() {
+ delegateAction = null;
+ super.releaseAction();
+ }
+
+ protected void deleteOldDatabaseDirectory() {
+ File dbDirectory = getConfig().getDbDirectory();
+ if (dbDirectory.exists()) {
+
+ // delete it before install
+ if (log.isInfoEnabled()) {
+ log.info("Delete previous database directory: " + dbDirectory);
+ }
+ ApplicationIOUtil.deleteDirectory(dbDirectory, "Could not delete old db directory");
+ }
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateApplicationAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateApplicationAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateApplicationAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateApplicationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,167 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiConfiguration;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.ui.swing.RunTutti;
+import fr.ifremer.tutti.ui.swing.TuttiApplicationUpdaterCallBack;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.MainUI;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.updater.ApplicationUpdater;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To update jre / i18n or tutti using the {@link ApplicationUpdater} mecanism.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class UpdateApplicationAction extends AbstractTuttiAction<TuttiUIContext, MainUI, MainUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(UpdateApplicationAction.class);
+
+ public UpdateApplicationAction(MainUIHandler handler) {
+ super(handler, true);
+ setActionDescription(_("tutti.main.action.updateApplication.tip"));
+ types = TuttiApplicationUpdaterCallBack.UpdateType.values();
+ }
+
+ protected TuttiApplicationUpdaterCallBack.UpdateType[] types;
+
+ protected boolean reload;
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+ // check application url is reachable
+ TuttiUIContext context = getContext();
+ doAction = context.checkUpdateApplicationReachable();
+ }
+ return doAction;
+ }
+
+ @Override
+ public void releaseAction() {
+ super.releaseAction();
+ types = TuttiApplicationUpdaterCallBack.UpdateType.values();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ reload = false;
+
+ TuttiUIContext context = getContext();
+ TuttiConfiguration config = getConfig();
+
+ File current = config.getBasedir();
+ if (current == null || !current.exists()) {
+
+ // can not update application
+ if (log.isWarnEnabled()) {
+ log.warn("No application base directory defined, skip updates.");
+ }
+ } else {
+
+ String url = config.getUpdateApplicationUrl();
+ File dest = new File(config.getBasedir(), "NEW");
+
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Try to update jre, i18N, help or tutti (current application location: %s), using update url: %s", current, url));
+ }
+
+ ProgressionModel progressionModel = new ProgressionModel();
+ context.getActionUI().getModel().setProgressionModel(progressionModel);
+ progressionModel.setMessage(_("tutti.updateApplication.checkUpdates"));
+
+ TuttiApplicationUpdaterCallBack callback =
+ new TuttiApplicationUpdaterCallBack(this, progressionModel);
+
+ callback.setTypes(types);
+
+ ApplicationUpdater up = new ApplicationUpdater();
+ up.update(url,
+ current,
+ dest,
+ false,
+ callback,
+ progressionModel);
+
+ if (callback.isApplicationUpdated()) {
+
+ reload = true;
+
+ } else {
+
+ sendMessage(_("tutti.updateApplication.noUpdate"));
+ }
+ }
+ }
+
+ public void setTypes(TuttiApplicationUpdaterCallBack.UpdateType... types) {
+ this.types = types;
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ if (reload) {
+ // wait 1 second to be sure action ui is up
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ if (log.isWarnEnabled()) {
+ log.warn("Could not wait 1 second...", e);
+ }
+ }
+
+ // tell user restart will be done
+
+ getHandler().showSuccessMessage(_("tutti.updateApplication.title.success"),
+ _("tutti.updateApplication.message.success"));
+
+ CloseApplicationAction action = getContext().getActionFactory().createLogicAction(
+ getHandler(), CloseApplicationAction.class);
+ action.setExitCode(RunTutti.UPATE_EXIT_CODE);
+ getActionEngine().runAction(action);
+ }
+ }
+
+ public boolean isReload() {
+ return reload;
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateDbAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateDbAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateDbAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,154 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiConfiguration;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.updater.ApplicationInfo;
+import org.nuiton.updater.ApplicationUpdater;
+
+import javax.swing.JOptionPane;
+import java.io.File;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To update - install database.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class UpdateDbAction extends AbstractMainUITuttiAction {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(UpdateDbAction.class);
+
+ protected ApplicationInfo updateDbVersion;
+
+ public UpdateDbAction(MainUIHandler handler) {
+ super(handler, true);
+ setActionDescription(_("tutti.dbManager.action.upgradeDb.tip"));
+ }
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean doAction = super.prepareAction();
+
+ updateDbVersion = null;
+
+ if (doAction) {
+ // check db url is reachable
+ doAction = getContext().checkUpdateDataReachable();
+ }
+
+ if (doAction) {
+
+ // get the next db version
+ ApplicationUpdater up = new ApplicationUpdater();
+
+ // get db updates
+ Map<String, ApplicationInfo> dbVersions =
+ up.getVersions(getConfig().getUpdateDataUrl(),
+ getConfig().getDataDirectory());
+ updateDbVersion =
+ dbVersions.get(TuttiDbUpdaterCallBack.DB_UPDATE_NAME);
+
+ if (getContext().isDbExist() &&
+ updateDbVersion != null &&
+ updateDbVersion.newVersion != null) {
+
+ // ask user if it wants to do the update
+ String htmlMessage = String.format(
+ AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
+ _("tutti.dbManager.updatedb.found", updateDbVersion.newVersion),
+ _("tutti.common.askBeforeUpdate.help"));
+ int i = JOptionPane.showConfirmDialog(
+ getHandler().getUI(),
+ htmlMessage,
+ _("tutti.dbManager.title.confirm.updatedb"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+
+ doAction = i == JOptionPane.OK_OPTION;
+ }
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() {
+ TuttiUIContext context = getContext();
+ TuttiConfiguration config = getConfig();
+
+ File current = config.getDataDirectory();
+ String url = config.getUpdateDataUrl();
+
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Try to install / update db (current data location: %s), using update url: %s", current, url));
+ }
+
+ File dest = new File(config.getBasedir(), "NEW");
+ ProgressionModel progressionModel = new ProgressionModel();
+ context.getActionUI().getModel().setProgressionModel(progressionModel);
+ progressionModel.setMessage(_("tutti.dbManager.action.upgradeDb.check"));
+ TuttiDbUpdaterCallBack callback =
+ new TuttiDbUpdaterCallBack(this, progressionModel);
+ ApplicationUpdater up = new ApplicationUpdater();
+
+ up.update(url,
+ current,
+ dest,
+ false,
+ callback,
+ progressionModel);
+
+ if (callback.isDbUpdated()) {
+
+ sendMessage(_("tutti.dbManager.action.upgradeDb.done", updateDbVersion.newVersion));
+
+ } else {
+ sendMessage(_("tutti.dbManager.action.upgradeDb.upToDate"));
+ }
+ }
+
+ @Override
+ public void postSuccessAction() {
+ handler.reloadDbManagerText();
+ super.postSuccessAction();
+ }
+
+ @Override
+ public void postFailedAction(Throwable error) {
+ handler.reloadDbManagerText();
+ super.postFailedAction(error);
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateReportAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateReportAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateReportAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/UpdateReportAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,152 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.TuttiConfiguration;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.ui.swing.RunTutti;
+import fr.ifremer.tutti.ui.swing.TuttiReportUpdaterCallBack;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.content.MainUI;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.updater.ApplicationUpdater;
+
+import java.io.File;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To update reports using the {@link ApplicationUpdater} mecanism.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class UpdateReportAction extends AbstractTuttiAction<TuttiUIContext, MainUI, MainUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(UpdateReportAction.class);
+
+ public UpdateReportAction(MainUIHandler handler) {
+ super(handler, true);
+ setActionDescription(_("tutti.main.action.updateReport.tip"));
+ }
+
+ protected boolean reload;
+
+ @Override
+ public boolean prepareAction() throws Exception {
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+ // check data url is reachable
+ TuttiUIContext context = getContext();
+ doAction = context.checkUpdateDataReachable();
+ }
+ return doAction;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ reload = false;
+
+ TuttiUIContext context = getContext();
+ TuttiConfiguration config = getConfig();
+
+ File current = config.getBasedir();
+ if (current == null || !current.exists()) {
+
+ // can not update application
+ if (log.isWarnEnabled()) {
+ log.warn("No application base directory defined, skip updates.");
+ }
+ } else {
+
+ String url = config.getUpdateDataUrl();
+ File dest = new File(config.getBasedir(), "NEW");
+
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Try to update repport (current application location: %s), using update url: %s", current, url));
+ }
+
+ ProgressionModel progressionModel = new ProgressionModel();
+ context.getActionUI().getModel().setProgressionModel(progressionModel);
+ progressionModel.setMessage(_("tutti.updateApplication.checkUpdates"));
+
+ TuttiReportUpdaterCallBack callback =
+ new TuttiReportUpdaterCallBack(this, progressionModel);
+
+ ApplicationUpdater up = new ApplicationUpdater();
+ up.update(url,
+ current,
+ dest,
+ false,
+ callback,
+ progressionModel);
+
+ if (callback.isReportUpdated()) {
+
+ reload = true;
+
+ } else {
+
+ sendMessage(_("tutti.updateReport.noUpdate"));
+ }
+ }
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ if (reload) {
+ // wait 1 second to be sure action ui is up
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ if (log.isWarnEnabled()) {
+ log.warn("Could not wait 1 second...", e);
+ }
+ }
+
+ // tell user restart will be done
+
+ getHandler().showSuccessMessage(_("tutti.updateReport.title.success"),
+ _("tutti.updateReport.message.success"));
+
+ CloseApplicationAction action = getContext().getActionFactory().createLogicAction(
+ getHandler(), CloseApplicationAction.class);
+ action.setExitCode(RunTutti.UPATE_EXIT_CODE);
+ getActionEngine().runAction(action);
+ }
+ }
+
+ public boolean isReload() {
+ return reload;
+ }
+}
\ No newline at end of file
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ValidateCatchesAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ValidateCatchesAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ValidateCatchesAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ValidateCatchesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,60 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.ValidationService;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Opens the operations validation screen.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ValidateCatchesAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ValidateCatchesAction.class);
+
+ public ValidateCatchesAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.VALIDATE_CRUISE);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkState(getContext().isProgramFilled());
+ Preconditions.checkState(getContext().isCruiseFilled());
+ getContext().setValidationContext(ValidationService.VALIDATION_CONTEXT_VALIDATE);
+ if (log.isInfoEnabled()) {
+ log.info("Validate operations of cruise: " + getContext().getCruiseId());
+ }
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ValidateSelectedCruiseCatchesAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ValidateSelectedCruiseCatchesAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ValidateSelectedCruiseCatchesAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ValidateSelectedCruiseCatchesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,59 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.ValidationService;
+import fr.ifremer.tutti.ui.swing.TuttiScreen;
+import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Opens the operations validation screen to edit the selected operations.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ValidateSelectedCruiseCatchesAction extends AbstractChangeScreenAction {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ValidateSelectedCruiseCatchesAction.class);
+
+ public ValidateSelectedCruiseCatchesAction(MainUIHandler handler) {
+ super(handler, true, TuttiScreen.VALIDATE_CRUISE);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ Preconditions.checkState(getContext().isCruiseFilled());
+ getContext().setValidationContext(ValidationService.VALIDATION_CONTEXT_VALIDATE);
+ if (log.isInfoEnabled()) {
+ log.info("Validate operations of cruise: " + getContext().getCruiseId());
+ }
+ super.doAction();
+ }
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ViewGearCaracteristicsAction.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ViewGearCaracteristicsAction.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ViewGearCaracteristicsAction.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ViewGearCaracteristicsAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,82 @@
+package fr.ifremer.tutti.ui.swing.action;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrder;
+import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrders;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUI;
+import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUIHandler;
+import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUIModel;
+import fr.ifremer.tutti.ui.swing.content.cruise.GearCaracteristicsEditorUI;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 2.1
+ */
+public class ViewGearCaracteristicsAction extends AbstractTuttiAction<EditCruiseUIModel, EditCruiseUI, EditCruiseUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ViewGearCaracteristicsAction.class);
+
+ protected final PersistenceService persistenceService;
+
+ public ViewGearCaracteristicsAction(EditCruiseUIHandler handler) {
+ super(handler, false);
+ persistenceService = getContext().getPersistenceService();
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ GearCaracteristicsEditorUI editor = getUI().getGearCaracteristicsEditor();
+ editor.getModel().setEditable(false);
+
+ GearWithOriginalRankOrder gear =
+ EditCruiseUIHandler.GEAR_EDIT_CONTEXT.getContextValue(getUI());
+
+ CaracteristicMap caracteristics =
+ persistenceService.getGearCaracteristics(
+ getDataContext().getCruise().getId(),
+ gear.getId(),
+ gear.getOriginalRankOrder());
+
+ GearWithOriginalRankOrder gearToEdit =
+ GearWithOriginalRankOrders.newGearWithOriginalRankOrder(gear);
+ gearToEdit.setCaracteristics(caracteristics);
+
+ if (log.isInfoEnabled()) {
+ log.info("Will edit gear " + decorate(gearToEdit) +
+ " with " + gearToEdit.getCaracteristics().size() + " caracteristics.");
+ }
+
+ editor.getModel().setGear(gearToEdit);
+
+ getUI().getMainPanelLayout().setSelected(EditCruiseUIHandler.GEAR_CARACTERISTICS_CARD);
+ }
+}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeLocaleAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeLocaleAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeLocaleAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,49 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.util.Locale;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0.3
- */
-public abstract class AbstractChangeLocaleAction extends AbstractChangeScreenAction {
-
-
- protected AbstractChangeLocaleAction(MainUIHandler handler) {
- super(handler, true, null);
- }
-
- protected abstract Locale getLocale();
-
- @Override
- public void doAction() throws Exception {
-
- getHandler().changeLocale(getLocale());
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeScreenAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeScreenAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeScreenAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,117 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.SwingUtil;
-import jaxx.runtime.context.JAXXContextEntryDef;
-
-/**
- * Action to change the screen.
- * <p/>
- * Will just check that the current screen can be quit via
- * the {@link MainUIHandler#quitCurrentScreen()}.
- * <p/>
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0
- */
-public abstract class AbstractChangeScreenAction extends AbstractMainUITuttiAction {
-
- /**
- * Context entry to keep previous screen.
- *
- * @since 1.1
- */
- protected static final JAXXContextEntryDef<TuttiScreen> PREVIOUS_SCREEN =
- SwingUtil.newContextEntryDef("previousScreen", TuttiScreen.class);
-
- /**
- * Screen where to go.
- *
- * @since 1.0
- */
- protected TuttiScreen screen;
-
- /**
- * Flag to skip the check of current screen.
- *
- * @since 1.1
- */
- protected boolean skipCheckCurrentScreen;
-
- protected AbstractChangeScreenAction(MainUIHandler handler,
- boolean hideBody,
- TuttiScreen screen) {
- super(handler, hideBody);
- this.screen = screen;
- }
-
- public void setSkipCheckCurrentScreen(boolean skipCheckCurrentScreen) {
- this.skipCheckCurrentScreen = skipCheckCurrentScreen;
- }
-
- protected void setScreen(TuttiScreen screen) {
- this.screen = screen;
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
- result &= skipCheckCurrentScreen || getHandler().quitCurrentScreen();
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
-
- TuttiUIContext context = getContext();
-
- TuttiScreen previousScreen = context.getScreen();
- if (getUI() != null) {
- if (previousScreen == null) {
- PREVIOUS_SCREEN.removeContextValue(getUI());
- } else {
- PREVIOUS_SCREEN.setContextValue(getUI(), previousScreen);
- }
- }
-
- // clean current screen
- context.setScreen(null);
-
- // change screen
- context.setScreen(screen);
- }
-
- @Override
- public void postFailedAction(Throwable error) {
- if (error != null) {
-
- getContext().setFallBackScreen();
- }
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractMainUITuttiAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractMainUITuttiAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractMainUITuttiAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,40 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public abstract class AbstractMainUITuttiAction extends AbstractTuttiAction<TuttiUIContext, MainUI, MainUIHandler> {
-
- protected AbstractMainUITuttiAction(MainUIHandler handler,
- boolean hideBody) {
- super(handler, hideBody);
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ChangeToLocaleFRAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ChangeToLocaleFRAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ChangeToLocaleFRAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,44 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.util.Locale;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0.3
- */
-public class ChangeToLocaleFRAction extends AbstractChangeLocaleAction {
-
- public ChangeToLocaleFRAction(MainUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected Locale getLocale() {
- return Locale.FRANCE;
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ChangeToLocaleUKAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ChangeToLocaleUKAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ChangeToLocaleUKAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,43 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.util.Locale;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0.3
- */
-public class ChangeToLocaleUKAction extends AbstractChangeLocaleAction {
-
- public ChangeToLocaleUKAction(MainUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected Locale getLocale() {
- return Locale.UK;
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/CloseApplicationAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/CloseApplicationAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/CloseApplicationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,65 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.RunTutti;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To close Tutti Application.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.1
- */
-public class CloseApplicationAction extends AbstractChangeScreenAction {
-
- protected int exitCode = RunTutti.NORMAL_EXIT_CODE;
-
- public CloseApplicationAction(MainUIHandler handler) {
- super(handler, false, null);
- setSkipCheckCurrentScreen(true);
- setActionDescription(_("tutti.main.action.exit.tip"));
- }
-
- public void setExitCode(int exitCode) {
- this.exitCode = exitCode;
- }
-
- @Override
- public void doAction() throws Exception {
-
- super.doAction();
-
- RunTutti.closeTutti(getHandler(), exitCode);
- }
-
-
- @Override
- public void releaseAction() {
- exitCode = RunTutti.NORMAL_EXIT_CODE;
- super.releaseAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSampleCategoryModelAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSampleCategoryModelAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSampleCategoryModelAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,56 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To show {@link TuttiScreen#EDIT_SAMPLE_CATEGORY_MODEL} config screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
- */
-public class EditSampleCategoryModelAction extends AbstractChangeScreenAction {
-
- public EditSampleCategoryModelAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_SAMPLE_CATEGORY_MODEL);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
- if (result) {
- result = askAdminPassword(
- _("tutti.editSampleCategoryModel.passwordDialog.message"),
- _("tutti.editSampleCategoryModel.passwordDialog.title"),
- _("tutti.editSampleCategoryModel.passwordDialog.error.message"),
- _("tutti.editSampleCategoryModel.passwordDialog.error.title")
- );
- }
- return result;
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedCruiseAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedCruiseAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,56 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Opens the cruise edition screen to edit the selected cruise.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class EditSelectedCruiseAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(EditSelectedCruiseAction.class);
-
- public EditSelectedCruiseAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_CRUISE);
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkState(getContext().isCruiseFilled());
- if (log.isInfoEnabled()) {
- log.info("Edit cruise: " + getContext().getCruiseId());
- }
- super.doAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedCruiseCatchesAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedCruiseCatchesAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedCruiseCatchesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,59 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.ValidationService;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Opens the operations edition screen to edit the selected operations.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class EditSelectedCruiseCatchesAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(EditSelectedCruiseCatchesAction.class);
-
- public EditSelectedCruiseCatchesAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_FISHING_OPERATION);
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkState(getContext().isCruiseFilled());
- if (log.isInfoEnabled()) {
- log.info("Edit operations of cruise: " + getContext().getCruiseId());
- }
- getContext().setValidationContext(ValidationService.VALIDATION_CONTEXT_EDIT);
- super.doAction();
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedProgramAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedProgramAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedProgramAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,56 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Opens the program edition screen to edit the selected program.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class EditSelectedProgramAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(EditSelectedProgramAction.class);
-
- public EditSelectedProgramAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_PROGRAM);
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkState(getContext().isProgramFilled());
- if (log.isInfoEnabled()) {
- log.info("Edit program: " + getContext().getProgramId());
- }
- super.doAction();
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/EditSelectedProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,58 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Opens the protocol edition screen to edit the selected protocol.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class EditSelectedProtocolAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(EditSelectedProtocolAction.class);
-
- public EditSelectedProtocolAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_PROTOCOL);
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkState(getContext().isProtocolFilled());
- if (log.isDebugEnabled()) {
- log.debug("Edit protocol: " + getContext().getProtocolId());
- }
- createProgressionModelIfRequired(4);
- super.doAction();
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/GoToPreviousScreenAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/GoToPreviousScreenAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/GoToPreviousScreenAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,44 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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 static org.nuiton.i18n.I18n._;
-
-/**
- * To return on previous screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.1
- */
-public class GoToPreviousScreenAction extends AbstractChangeScreenAction {
-
- public GoToPreviousScreenAction(MainUIHandler handler) {
- super(handler,
- true,
- PREVIOUS_SCREEN.getContextValue(handler.getUI())
- );
- setActionDescription(_("tutti.main.action.goto.previousScreen.tip"));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ImportTemporaryReferentialAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ImportTemporaryReferentialAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ImportTemporaryReferentialAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,70 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-
-import javax.swing.SwingUtilities;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Open screen to import referential
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ImportTemporaryReferentialAction extends AbstractChangeScreenAction {
-
- public ImportTemporaryReferentialAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.IMPORT_TEMPORARY_REFERENTIAL);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
- if (result) {
- result = askAdminPassword(
- _("tutti.manageTemporaryReferential.passwordDialog.message"),
- _("tutti.manageTemporaryReferential.passwordDialog.title"),
- _("tutti.manageTemporaryReferential.passwordDialog.error.message"),
- _("tutti.manageTemporaryReferential.passwordDialog.error.title")
- );
- }
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
- super.doAction();
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- getContext().getMainUI().getBody().revalidate();
- }
- });
-
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -48,7 +48,7 @@
toolTipText: "tutti.main.action.configuration.tip";
i18nMnemonic: "tutti.main.action.configuration.mnemonic";
enabled: {model.getScreen() != TuttiScreen.CONFIG};
- _applicationAction: {ShowConfigAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ShowConfigAction.class};
_help: {"tutti.main.menu.action.configuration.help"};
}
@@ -58,7 +58,7 @@
toolTipText: "tutti.main.action.editSampleCategoryModel.tip";
i18nMnemonic: "tutti.main.action.editSampleCategoryModel.mnemonic";
enabled: {model.getScreen() != TuttiScreen.EDIT_SAMPLE_CATEGORY_MODEL};
- _applicationAction: {EditSampleCategoryModelAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.EditSampleCategoryModelAction.class};
_help: {"tutti.main.menu.action.editSampleCategoryModel.help"};
}
@@ -68,7 +68,7 @@
toolTipText: "tutti.main.action.report.tip";
i18nMnemonic: "tutti.main.action.report.mnemonic";
enabled: {model.getScreen() != TuttiScreen.REPORT};
- _applicationAction: {ShowReportAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ShowReportAction.class};
_help: {"tutti.main.menu.action.report.help"};
}
@@ -77,7 +77,7 @@
text: "tutti.main.action.exit";
toolTipText: "tutti.main.action.exit.tip";
i18nMnemonic: "tutti.main.action.exit.mnemonic";
- _applicationAction: {CloseApplicationAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.CloseApplicationAction.class};
_help: {"tutti.main.menu.action.exit.help"};
}
@@ -86,7 +86,7 @@
text: "tutti.main.action.updateApplication";
toolTipText: "tutti.main.action.updateApplication.tip";
i18nMnemonic: "tutti.main.action.updateApplication.mnemonic";
- _applicationAction: {UpdateApplicationAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.UpdateApplicationAction.class};
_help: {"tutti.main.menu.action.updateApplication.help"};
}
@@ -95,7 +95,7 @@
text: "tutti.main.action.updateReport";
toolTipText: "tutti.main.action.updateReport.tip";
i18nMnemonic: "tutti.main.action.updateReport.mnemonic";
- _applicationAction: {UpdateReportAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.UpdateReportAction.class};
_help: {"tutti.main.menu.action.updateReport.help"};
}
@@ -105,7 +105,7 @@
toolTipText: "tutti.main.action.manageDb.tip";
i18nMnemonic: "tutti.main.action.manageDb.mnemonic";
enabled: {model.getScreen() != TuttiScreen.MANAGE_DB};
- _applicationAction: {ManageDbAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ManageDbAction.class};
_help: {"tutti.main.menu.action.manageDb.help"};
}
@@ -123,7 +123,7 @@
toolTipText: "tutti.main.action.changeLocaleFR.tip";
i18nMnemonic: "tutti.main.action.changeLocaleFR.mnemonic";
enabled: {!handler.acceptLocale(model.getLocale(), "fr_FR")};
- _applicationAction: {ChangeToLocaleFRAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ChangeToLocaleFRAction.class};
_help: {"tutti.main.menu.action.changeLocaleFR.help"};
}
@@ -133,7 +133,7 @@
toolTipText: "tutti.main.action.changeLocaleUK.tip";
i18nMnemonic: "tutti.main.action.changeLocaleUK.mnemonic";
enabled: {!handler.acceptLocale(model.getLocale(), "en_GB")};
- _applicationAction: {ChangeToLocaleUKAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ChangeToLocaleUKAction.class};
_help: {"tutti.main.menu.action.changeLocaleUK.help"};
}
@@ -150,7 +150,7 @@
toolTipText: "tutti.main.action.selectCruise.tip";
enabled: {model.getScreen() != TuttiScreen.SELECT_CRUISE};
i18nMnemonic: "tutti.main.action.selectCruise.mnemonic";
- _applicationAction: {SelectCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SelectCruiseAction.class};
_help: {"tutti.main.menu.action.selectCruise.help"};
}
@@ -160,7 +160,7 @@
toolTipText: "tutti.main.action.editProgram.tip";
i18nMnemonic: "tutti.main.action.editSelectedProgram.mnemonic";
enabled: {model.getScreen() != TuttiScreen.EDIT_PROGRAM && model.isProgramFilled()};
- _applicationAction: {EditSelectedProgramAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.EditSelectedProgramAction.class};
_help: {"tutti.main.menu.action.editProgram.help"};
}
@@ -170,7 +170,7 @@
toolTipText: "tutti.main.action.editSelectedCruise.tip";
i18nMnemonic: "tutti.main.action.editSelectedCruise.mnemonic";
enabled: {model.getScreen() != TuttiScreen.EDIT_CRUISE && model.isCruiseFilled()};
- _applicationAction: {EditSelectedCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.EditSelectedCruiseAction.class};
_help: {"tutti.main.menu.action.editCruise.help"};
}
@@ -180,7 +180,7 @@
toolTipText: "tutti.main.action.editSelectedProtocol.tip";
i18nMnemonic: "tutti.main.action.editSelectedProtocol.mnemonic";
enabled: {model.getScreen() != TuttiScreen.EDIT_PROTOCOL && model.isProtocolFilled()};
- _applicationAction: {EditSelectedProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.EditSelectedProtocolAction.class};
_help: {"tutti.main.menu.action.editProtocol.help"};
}
@@ -190,7 +190,7 @@
toolTipText: "tutti.main.action.editCatches.tip";
i18nMnemonic: "tutti.main.action.editCatches.mnemonic";
enabled: {model.getScreen() != TuttiScreen.EDIT_FISHING_OPERATION && model.isCruiseFilled()};
- _applicationAction: {EditSelectedCruiseCatchesAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.EditSelectedCruiseCatchesAction.class};
_help: {"tutti.main.menu.action.editCatches.help"};
}
@@ -200,7 +200,7 @@
toolTipText: "tutti.main.action.validateCatches.tip";
i18nMnemonic: "tutti.main.action.validateCatches.mnemonic";
enabled: {model.getScreen() != TuttiScreen.VALIDATE_CRUISE && model.isCruiseFilled()};
- _applicationAction: {ValidateSelectedCruiseCatchesAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ValidateSelectedCruiseCatchesAction.class};
_help: {"tutti.main.menu.action.validateCatches.help"};
}
@@ -217,7 +217,7 @@
toolTipText: "tutti.main.action.importTemporaryReferential.tip";
i18nMnemonic: "tutti.main.action.importTemporaryReferential.mnemonic";
enabled: {model.getScreen() != TuttiScreen.IMPORT_TEMPORARY_REFERENTIAL};
- _applicationAction: {ImportTemporaryReferentialAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportTemporaryReferentialAction.class};
_help: {"tutti.main.menu.action.importTemporaryReferential.help"};
}
@@ -248,7 +248,7 @@
toolTipText: "tutti.main.action.about.tip";
actionIcon: about;
i18nMnemonic: "tutti.main.action.about.mnemonic";
- _applicationAction: {ShowAboutAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ShowAboutAction.class};
_help: {"tutti.main.menu.action.about.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.jaxx 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.jaxx 2013-11-26 08:03:42 UTC (rev 1388)
@@ -30,6 +30,7 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.TuttiScreen
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
+ fr.ifremer.tutti.ui.swing.action.*
jaxx.runtime.swing.BlockingLayerUI
jaxx.runtime.validator.swing.SwingValidatorMessageWidget
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ManageDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ManageDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ManageDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,41 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-
-/**
- * To manage db in Tutti.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ManageDbAction extends AbstractChangeScreenAction {
-
- public ManageDbAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.MANAGE_DB);
- }
-
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ReloadTuttiAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ReloadTuttiAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ReloadTuttiAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,51 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.RunTutti;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To reload Tutti application.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0.3
- */
-public class ReloadTuttiAction extends AbstractChangeScreenAction {
-
- public ReloadTuttiAction(MainUIHandler handler) {
- super(handler, true, null);
- setActionDescription(_("tutti.main.action.reloadTutti"));
- }
-
- @Override
- public void doAction() throws Exception {
-
- // Close the application, will exit and restart application
- RunTutti.closeTutti(getHandler(), RunTutti.UPATE_EXIT_CODE);
- }
-
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/SelectCruiseAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/SelectCruiseAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/SelectCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,41 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-
-/**
- * Opens the cruise selection screen (home).
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class SelectCruiseAction extends AbstractChangeScreenAction {
-
- public SelectCruiseAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.SELECT_CRUISE);
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowAboutAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowAboutAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowAboutAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,304 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.Joiner;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import fr.ifremer.tutti.TuttiConfiguration;
-import fr.ifremer.tutti.ui.swing.TuttiApplicationUpdaterCallBack;
-import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
-import fr.ifremer.tutti.ui.swing.TuttiReportUpdaterCallBack;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.swing.AboutPanel;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.updater.ApplicationInfo;
-import org.nuiton.updater.ApplicationUpdater;
-
-import javax.swing.JEditorPane;
-import javax.swing.JScrollPane;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkListener;
-import java.io.File;
-import java.net.URL;
-import java.util.Calendar;
-import java.util.List;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To show about panel.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.2
- */
-public class ShowAboutAction extends AbstractMainUITuttiAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(ShowAboutAction.class);
-
- protected AboutPanel about;
-
- public ShowAboutAction(MainUIHandler handler) {
- super(handler, false);
- }
-
- protected boolean canUpdateApplication;
-
- protected boolean canUpdateData;
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean doAction = super.prepareAction();
-
- if (doAction) {
- // check db url is reachable
- TuttiUIContext context = getContext();
- canUpdateApplication = context.checkUpdateApplicationReachable();
- canUpdateData = context.checkUpdateDataReachable();
-
- }
-
- return doAction;
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- about.showInDialog(getUI(), true);
-
- // register on swing session
- getContext().getSwingSession().add(about);
- }
-
- @Override
- public void doAction() throws Exception {
-
- about = null;
-
- String iconPath = "/icons/allegro_about.png";
- String name = "tutti";
- String licensePath = "META-INF/" + name + "-LICENSE.txt";
- String thirdPartyPath = "META-INF/" + name + "-THIRD-PARTY.txt";
-
- about = new AboutPanel();
- about.setTitle(_("tutti.about.title"));
- about.setAboutText(_("tutti.about.message"));
-
- TuttiConfiguration config = getConfig();
- int currentYear = Calendar.getInstance().get(Calendar.YEAR);
- int inceptionYear = config.getInceptionYear();
- String years;
- if (currentYear != inceptionYear) {
- years = inceptionYear + "-" + currentYear;
- } else {
- years = inceptionYear + "";
- }
-
- about.setBottomText(_("tutti.about.bottomText",
- config.getOrganizationName(),
- years,
- config.getVersion()));
- about.setIconPath(iconPath);
- about.setLicenseFile(licensePath);
- about.setThirdpartyFile(thirdPartyPath);
- about.buildTopPanel();
-
- //
- // translate tab
- //
-
- JScrollPane translatePane = new JScrollPane();
- JEditorPane translateArea = new JEditorPane();
- translateArea.setContentType("text/html");
- translateArea.setEditable(false);
- if (translateArea.getFont() != null) {
- translateArea.setFont(translateArea.getFont().deriveFont((float) 11));
- }
-
- translateArea.setBorder(null);
- File csvFile = new File(config.getI18nDirectory(), "tutti-i18n.csv");
- String translateText = _("tutti.about.translate.content", csvFile.toURI().toURL());
- translateArea.setText(translateText);
- translatePane.getViewport().add(translateArea);
- translateArea.addHyperlinkListener(new HyperlinkListener() {
- @Override
- public void hyperlinkUpdate(HyperlinkEvent e) {
- if (HyperlinkEvent.EventType.ACTIVATED == e.getEventType()) {
- URL url = e.getURL();
- if (log.isInfoEnabled()) {
- log.info("edit url: " + url);
- }
- TuttiUIUtil.openLink(url);
- }
- }
- });
-
- about.getTabs().add(_("tutti.about.translate.title"), translatePane);
-
- if (canUpdateApplication || canUpdateData) {
-
- //
- // update tab
- //
-
- addUpdateTab(config);
-
- }
- about.init();
- }
-
- protected void addUpdate(Map<String, ApplicationInfo> source,
- Map<String, ApplicationInfo> target,
- String type) {
- ApplicationInfo info = source.get(type.toLowerCase());
- target.put(type, info);
- }
-
- protected void addUpdateTab(TuttiConfiguration config) {
- File current = config.getBasedir();
- String urlApplication = config.getUpdateApplicationUrl();
- String urlData = config.getUpdateDataUrl();
-
- ApplicationUpdater up = new ApplicationUpdater();
-
- // create final update map
- final Map<String, ApplicationInfo> versions = Maps.newLinkedHashMap();
-
- if (canUpdateApplication) {
-
- // get application updates
- Map<String, ApplicationInfo> applicationVersions = up.getVersions(urlApplication, current);
-
- addUpdate(applicationVersions, versions, TuttiApplicationUpdaterCallBack.UpdateType.JRE.name());
- addUpdate(applicationVersions, versions, TuttiApplicationUpdaterCallBack.UpdateType.TUTTI.name());
- addUpdate(applicationVersions, versions, TuttiApplicationUpdaterCallBack.UpdateType.I18N.name());
- addUpdate(applicationVersions, versions, TuttiApplicationUpdaterCallBack.UpdateType.HELP.name());
- }
-
- if (canUpdateData) {
-
- // get report updates
- Map<String, ApplicationInfo> reportVersions = up.getVersions(urlData, current);
- addUpdate(reportVersions, versions, TuttiReportUpdaterCallBack.REPORT_UPDATE_NAME);
-
- // get db updates
- Map<String, ApplicationInfo> dbVersions = up.getVersions(urlData, config.getDataDirectory());
- addUpdate(dbVersions, versions, TuttiDbUpdaterCallBack.DB_UPDATE_NAME);
- }
- JScrollPane updatePane = new JScrollPane();
- JEditorPane updateArea = new JEditorPane();
- updateArea.setContentType("text/html");
- updateArea.setEditable(false);
- if (updateArea.getFont() != null) {
- updateArea.setFont(updateArea.getFont().deriveFont((float) 11));
- }
- updateArea.setBorder(null);
-
- List<String> params = Lists.newArrayList();
- for (Map.Entry<String, ApplicationInfo> entry : versions.entrySet()) {
- String appName = entry.getKey();
- ApplicationInfo info = entry.getValue();
- String oldVersion = info.oldVersion;
- String newVersion = info.newVersion;
- String i18nKey = "tutti.update." + appName.toLowerCase();
- String appLabel = _(i18nKey);
-
- if (log.isInfoEnabled()) {
- log.info(String.format(
- "Module %s, version courante %s, nouvelle version %s",
- appLabel, oldVersion, newVersion));
- }
- if (newVersion == null) {
-
- // no update
- params.add(_("tutti.about.update.app.noup.detail", appLabel, oldVersion));
- } else {
- // update exists
- params.add(_("tutti.about.update.app.up.detail", appLabel, oldVersion, newVersion, appName));
- }
- }
-
- String updateText = _("tutti.about.update.content", urlApplication, urlData, Joiner.on("\n").join(params));
- updateArea.setText(updateText);
- updatePane.getViewport().add(updateArea);
- updateArea.addHyperlinkListener(new HyperlinkListener() {
- @Override
- public void hyperlinkUpdate(HyperlinkEvent e) {
- if (HyperlinkEvent.EventType.ACTIVATED == e.getEventType()) {
- URL url = e.getURL();
- if (url != null) {
- TuttiUIUtil.openLink(url);
- } else {
- String appType = e.getDescription();
-
-
- if (log.isInfoEnabled()) {
- log.info("Open url: " + appType);
- }
- AbstractTuttiAction action;
-
- if (TuttiDbUpdaterCallBack.DB_UPDATE_NAME.equals(appType)) {
- UpdateDbAction logicAction = getContext().getActionFactory().createLogicAction(getHandler(), UpdateDbAction.class);
- action = logicAction;
- if (!getContext().isDbExist()) {
-
- // install db
- action.setActionDescription(
- _("tutti.dbManager.action.installDb.tip"));
- }
- } else if (TuttiReportUpdaterCallBack.REPORT_UPDATE_NAME.equals(appType)) {
- UpdateReportAction logicAction = getContext().getActionFactory().createLogicAction(getHandler(), UpdateReportAction.class);
- action = logicAction;
- } else {
-
- TuttiApplicationUpdaterCallBack.UpdateType updateType =
- TuttiApplicationUpdaterCallBack.UpdateType.valueOf(appType.toUpperCase());
-
- UpdateApplicationAction logicAction = getContext().getActionFactory().createLogicAction(getHandler(), UpdateApplicationAction.class);
- logicAction.setTypes(updateType);
- logicAction.setActionDescription(_("tutti.main.action.updateSpecificApplication.tip", updateType.getLabel()));
- action = logicAction;
- }
-
- // close this dialog
- getActionEngine().runAction(about.getClose());
-
- // do update
- getActionEngine().runAction(action);
- }
-
- }
- }
- });
- about.getTabs().add(_("tutti.about.update.title"), updatePane);
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowConfigAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowConfigAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowConfigAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,40 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-
-/**
- * To show config screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.1
- */
-public class ShowConfigAction extends AbstractChangeScreenAction {
-
- public ShowConfigAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.CONFIG);
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowReportAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowReportAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowReportAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,53 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * To show report screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.9
- */
-public class ShowReportAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(ShowReportAction.class);
-
- public ShowReportAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.REPORT);
- }
-
- @Override
- public void doAction() throws Exception {
- if (log.isDebugEnabled()) {
- log.debug("Show report screen");
- }
- super.doAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/StartAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/StartAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/StartAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,175 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.shared.application.ApplicationIOUtil;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.content.db.ImportDbAction;
-import fr.ifremer.tutti.ui.swing.content.db.InstallDbAction;
-import fr.ifremer.tutti.ui.swing.content.db.OpenDbAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Start action.
- * <p/>
- * If there is a start action file, then load it and run inside actions, otherwise
- * just starts normal ui action (open db if exists, or go to manage db screen).
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
- */
-public class StartAction extends AbstractMainUITuttiAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(StartAction.class);
-
- protected AbstractMainUITuttiAction delegateAction;
-
- public StartAction(MainUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- File actionfile = getConfig().getStartActionFile();
- boolean doAction = actionfile.exists();
-
- if (doAction) {
-
- try {
- // get action to execute
- String content = ApplicationIOUtil.readContent(actionfile, _("tutti.error.read.startActionFile", actionfile));
- content = content.trim();
-
- if (InstallDbAction.class.getName().equals(content)) {
-
- // install db
- delegateAction = getContext().getActionFactory().createLogicAction(handler, InstallDbAction.class);
-
- if (log.isInfoEnabled()) {
- log.info("Found install db action");
- }
- deleteOldDatabaseDirectory();
-
- } else if (content.startsWith(ImportDbAction.class.getName())) {
-
- // import db
- ImportDbAction action = getContext().getActionFactory().createLogicAction(handler, ImportDbAction.class);
- File importFile = new File(content.substring(ImportDbAction.class.getName().length() + 1));
- action.setImportFile(importFile);
- delegateAction = action;
- if (log.isInfoEnabled()) {
- log.info("Found import db action (with file " + importFile + ")");
- }
- deleteOldDatabaseDirectory();
- } else {
- if (log.isWarnEnabled()) {
- log.warn("Unknown start action: " + content);
- }
- doAction = false;
- }
-
- } finally {
-
- // delete start action file
- ApplicationIOUtil.deleteFile(
- actionfile,
- _("tutti.error.delete.startActionFile", actionfile));
- }
- }
-
- if (!doAction) {
-
- // no start action, normal start
-
- TuttiUIContext context = getContext();
-
- if (context.isDbLoaded()) {
-
- // db already opened (happens when reloading ui)
- // just go to select cruise screen
- SelectCruiseAction action = getContext().getActionFactory().createLogicAction(handler, SelectCruiseAction.class);
- action.setSkipCheckCurrentScreen(true);
- action.setActionDescription(getUI().getMenuActionSelectCruise().getToolTipText());
- delegateAction = action;
-
- } else {
-
- if (context.isDbExist()) {
-
- // open tutti db (using a fake button to have simple api)
- OpenDbAction action = getContext().getActionFactory().createLogicAction(handler, OpenDbAction.class);
- action.setSkipCheckCurrentScreen(true);
- action.setUpdateReferentiel(true);
- delegateAction = action;
-
- } else {
-
- // clean db context
- context.clearDbContext();
-
- // go to manage db screen (to install db)
- ManageDbAction action = getContext().getActionFactory().createLogicAction(handler, ManageDbAction.class);
- action.setSkipCheckCurrentScreen(true);
- delegateAction = action;
- }
- }
- }
-
- setActionDescription(delegateAction.getActionDescription());
- doAction = delegateAction.prepareAction();
- return doAction;
- }
-
- @Override
- public void doAction() throws Exception {
-
- getActionEngine().runInternalAction(delegateAction);
- }
-
- @Override
- protected void releaseAction() {
- delegateAction = null;
- super.releaseAction();
- }
-
- protected void deleteOldDatabaseDirectory() {
- File dbDirectory = getConfig().getDbDirectory();
- if (dbDirectory.exists()) {
-
- // delete it before install
- if (log.isInfoEnabled()) {
- log.info("Delete previous database directory: " + dbDirectory);
- }
- ApplicationIOUtil.deleteDirectory(dbDirectory, "Could not delete old db directory");
- }
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateApplicationAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateApplicationAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateApplicationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,166 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiConfiguration;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.RunTutti;
-import fr.ifremer.tutti.ui.swing.TuttiApplicationUpdaterCallBack;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.updater.ApplicationUpdater;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To update jre / i18n or tutti using the {@link ApplicationUpdater} mecanism.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class UpdateApplicationAction extends AbstractTuttiAction<TuttiUIContext, MainUI, MainUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(UpdateApplicationAction.class);
-
- public UpdateApplicationAction(MainUIHandler handler) {
- super(handler, true);
- setActionDescription(_("tutti.main.action.updateApplication.tip"));
- types = TuttiApplicationUpdaterCallBack.UpdateType.values();
- }
-
- protected TuttiApplicationUpdaterCallBack.UpdateType[] types;
-
- protected boolean reload;
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean doAction = super.prepareAction();
-
- if (doAction) {
- // check application url is reachable
- TuttiUIContext context = getContext();
- doAction = context.checkUpdateApplicationReachable();
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- super.releaseAction();
- types = TuttiApplicationUpdaterCallBack.UpdateType.values();
- }
-
- @Override
- public void doAction() throws Exception {
-
- reload = false;
-
- TuttiUIContext context = getContext();
- TuttiConfiguration config = getConfig();
-
- File current = config.getBasedir();
- if (current == null || !current.exists()) {
-
- // can not update application
- if (log.isWarnEnabled()) {
- log.warn("No application base directory defined, skip updates.");
- }
- } else {
-
- String url = config.getUpdateApplicationUrl();
- File dest = new File(config.getBasedir(), "NEW");
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Try to update jre, i18N, help or tutti (current application location: %s), using update url: %s", current, url));
- }
-
- ProgressionModel progressionModel = new ProgressionModel();
- context.getActionUI().getModel().setProgressionModel(progressionModel);
- progressionModel.setMessage(_("tutti.updateApplication.checkUpdates"));
-
- TuttiApplicationUpdaterCallBack callback =
- new TuttiApplicationUpdaterCallBack(this, progressionModel);
-
- callback.setTypes(types);
-
- ApplicationUpdater up = new ApplicationUpdater();
- up.update(url,
- current,
- dest,
- false,
- callback,
- progressionModel);
-
- if (callback.isApplicationUpdated()) {
-
- reload = true;
-
- } else {
-
- sendMessage(_("tutti.updateApplication.noUpdate"));
- }
- }
- }
-
- public void setTypes(TuttiApplicationUpdaterCallBack.UpdateType... types) {
- this.types = types;
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- if (reload) {
- // wait 1 second to be sure action ui is up
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- if (log.isWarnEnabled()) {
- log.warn("Could not wait 1 second...", e);
- }
- }
-
- // tell user restart will be done
-
- getHandler().showSuccessMessage(_("tutti.updateApplication.title.success"),
- _("tutti.updateApplication.message.success"));
-
- CloseApplicationAction action = getContext().getActionFactory().createLogicAction(
- getHandler(), CloseApplicationAction.class);
- action.setExitCode(RunTutti.UPATE_EXIT_CODE);
- getActionEngine().runAction(action);
- }
- }
-
- public boolean isReload() {
- return reload;
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,153 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiConfiguration;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.updater.ApplicationInfo;
-import org.nuiton.updater.ApplicationUpdater;
-
-import javax.swing.JOptionPane;
-import java.io.File;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To update - install database.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class UpdateDbAction extends AbstractMainUITuttiAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(UpdateDbAction.class);
-
- protected ApplicationInfo updateDbVersion;
-
- public UpdateDbAction(MainUIHandler handler) {
- super(handler, true);
- setActionDescription(_("tutti.dbManager.action.upgradeDb.tip"));
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean doAction = super.prepareAction();
-
- updateDbVersion = null;
-
- if (doAction) {
- // check db url is reachable
- doAction = getContext().checkUpdateDataReachable();
- }
-
- if (doAction) {
-
- // get the next db version
- ApplicationUpdater up = new ApplicationUpdater();
-
- // get db updates
- Map<String, ApplicationInfo> dbVersions =
- up.getVersions(getConfig().getUpdateDataUrl(),
- getConfig().getDataDirectory());
- updateDbVersion =
- dbVersions.get(TuttiDbUpdaterCallBack.DB_UPDATE_NAME);
-
- if (getContext().isDbExist() &&
- updateDbVersion != null &&
- updateDbVersion.newVersion != null) {
-
- // ask user if it wants to do the update
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- _("tutti.dbManager.updatedb.found", updateDbVersion.newVersion),
- _("tutti.common.askBeforeUpdate.help"));
- int i = JOptionPane.showConfirmDialog(
- getHandler().getUI(),
- htmlMessage,
- _("tutti.dbManager.title.confirm.updatedb"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE);
-
- doAction = i == JOptionPane.OK_OPTION;
- }
- }
- return doAction;
- }
-
- @Override
- public void doAction() {
- TuttiUIContext context = getContext();
- TuttiConfiguration config = getConfig();
-
- File current = config.getDataDirectory();
- String url = config.getUpdateDataUrl();
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Try to install / update db (current data location: %s), using update url: %s", current, url));
- }
-
- File dest = new File(config.getBasedir(), "NEW");
- ProgressionModel progressionModel = new ProgressionModel();
- context.getActionUI().getModel().setProgressionModel(progressionModel);
- progressionModel.setMessage(_("tutti.dbManager.action.upgradeDb.check"));
- TuttiDbUpdaterCallBack callback =
- new TuttiDbUpdaterCallBack(this, progressionModel);
- ApplicationUpdater up = new ApplicationUpdater();
-
- up.update(url,
- current,
- dest,
- false,
- callback,
- progressionModel);
-
- if (callback.isDbUpdated()) {
-
- sendMessage(_("tutti.dbManager.action.upgradeDb.done", updateDbVersion.newVersion));
-
- } else {
- sendMessage(_("tutti.dbManager.action.upgradeDb.upToDate"));
- }
- }
-
- @Override
- public void postSuccessAction() {
- handler.reloadDbManagerText();
- super.postSuccessAction();
- }
-
- @Override
- public void postFailedAction(Throwable error) {
- handler.reloadDbManagerText();
- super.postFailedAction(error);
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateReportAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateReportAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateReportAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,151 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiConfiguration;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.RunTutti;
-import fr.ifremer.tutti.ui.swing.TuttiReportUpdaterCallBack;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.updater.ApplicationUpdater;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To update reports using the {@link ApplicationUpdater} mecanism.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class UpdateReportAction extends AbstractTuttiAction<TuttiUIContext, MainUI, MainUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(UpdateReportAction.class);
-
- public UpdateReportAction(MainUIHandler handler) {
- super(handler, true);
- setActionDescription(_("tutti.main.action.updateReport.tip"));
- }
-
- protected boolean reload;
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean doAction = super.prepareAction();
-
- if (doAction) {
- // check data url is reachable
- TuttiUIContext context = getContext();
- doAction = context.checkUpdateDataReachable();
- }
- return doAction;
- }
-
- @Override
- public void doAction() throws Exception {
-
- reload = false;
-
- TuttiUIContext context = getContext();
- TuttiConfiguration config = getConfig();
-
- File current = config.getBasedir();
- if (current == null || !current.exists()) {
-
- // can not update application
- if (log.isWarnEnabled()) {
- log.warn("No application base directory defined, skip updates.");
- }
- } else {
-
- String url = config.getUpdateDataUrl();
- File dest = new File(config.getBasedir(), "NEW");
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Try to update repport (current application location: %s), using update url: %s", current, url));
- }
-
- ProgressionModel progressionModel = new ProgressionModel();
- context.getActionUI().getModel().setProgressionModel(progressionModel);
- progressionModel.setMessage(_("tutti.updateApplication.checkUpdates"));
-
- TuttiReportUpdaterCallBack callback =
- new TuttiReportUpdaterCallBack(this, progressionModel);
-
- ApplicationUpdater up = new ApplicationUpdater();
- up.update(url,
- current,
- dest,
- false,
- callback,
- progressionModel);
-
- if (callback.isReportUpdated()) {
-
- reload = true;
-
- } else {
-
- sendMessage(_("tutti.updateReport.noUpdate"));
- }
- }
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- if (reload) {
- // wait 1 second to be sure action ui is up
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- if (log.isWarnEnabled()) {
- log.warn("Could not wait 1 second...", e);
- }
- }
-
- // tell user restart will be done
-
- getHandler().showSuccessMessage(_("tutti.updateReport.title.success"),
- _("tutti.updateReport.message.success"));
-
- CloseApplicationAction action = getContext().getActionFactory().createLogicAction(
- getHandler(), CloseApplicationAction.class);
- action.setExitCode(RunTutti.UPATE_EXIT_CODE);
- getActionEngine().runAction(action);
- }
- }
-
- public boolean isReload() {
- return reload;
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ValidateSelectedCruiseCatchesAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ValidateSelectedCruiseCatchesAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ValidateSelectedCruiseCatchesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,58 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.ValidationService;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Opens the operations validation screen to edit the selected operations.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ValidateSelectedCruiseCatchesAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ValidateSelectedCruiseCatchesAction.class);
-
- public ValidateSelectedCruiseCatchesAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.VALIDATE_CRUISE);
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkState(getContext().isCruiseFilled());
- getContext().setValidationContext(ValidationService.VALIDATION_CONTEXT_VALIDATE);
- if (log.isInfoEnabled()) {
- log.info("Validate operations of cruise: " + getContext().getCruiseId());
- }
- super.doAction();
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -79,7 +79,7 @@
text: "tutti.editSampleCategoryModel.action.close";
toolTipText: "tutti.editSampleCategoryModel.action.close.tip";
i18nMnemonic: "tutti.editSampleCategoryModel.action.close.mnemonic";
- _applicationAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SelectCruiseAction.class};
_help: {"tutti.editSampleCategoryModel.action.close.help"};
}
@@ -89,6 +89,6 @@
toolTipText: "tutti.editSampleCategoryModel.action.save.tip";
i18nMnemonic: "tutti.editSampleCategoryModel.action.save.mnemonic";
enabled: {model.isModify() && model.isValid()};
- _applicationAction: {SaveSampleCategoryModelAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SaveSampleCategoryModelAction.class};
_help: {"tutti.editSampleCategoryModel.action.save.help"};
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.shared.application.swing.util.CloseableUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/SaveSampleCategoryModelAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/SaveSampleCategoryModelAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/SaveSampleCategoryModelAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,66 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.category;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.SampleCategoryModel;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * To save the sample category model.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
- */
-public class SaveSampleCategoryModelAction extends AbstractTuttiAction<EditSampleCategoryModelUIModel, EditSampleCategoryModelUI, EditSampleCategoryModelUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(SaveSampleCategoryModelAction.class);
-
- public SaveSampleCategoryModelAction(EditSampleCategoryModelUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public void doAction() throws Exception {
- EditSampleCategoryModelUIModel model = getModel();
-
- SampleCategoryModel bean = model.toBean();
-
- if (log.isInfoEnabled()) {
- log.info("Will save sampleCategoryModel: " + bean);
- }
- getConfig().setSampleCategoryModel(bean);
-
- getConfig().save();
-
- getDataContext().loadSampleCategoryModel(bean);
-
- model.setModify(false);
-
- }
-}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -27,8 +27,8 @@
import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.TuttiConfigurationOption;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.content.GoToPreviousScreenAction;
-import fr.ifremer.tutti.ui.swing.content.ReloadTuttiAction;
+import fr.ifremer.tutti.ui.swing.action.GoToPreviousScreenAction;
+import fr.ifremer.tutti.ui.swing.action.ReloadTuttiAction;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.editor.TuttiLocationTableCell;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseFishingOperationAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseFishingOperationAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,180 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.cruise;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.CatchBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
-import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUIModel;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.validator.NuitonValidatorResult;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To edit the given fishing operation.
- *
- * @author kmorin <morin(a)codelutin.com>
- * @since 1.4
- */
-public class EditCruiseFishingOperationAction extends AbstractTuttiAction<ValidateCruiseUIModel, ValidateCruiseUI, ValidateCruiseUIHandler> {
-
- private static final Log log =
- LogFactory.getLog(EditCruiseFishingOperationAction.class);
-
- /** Validation service. */
- private final ValidateCruiseOperationsService validationService = getContext().getValidateCruiseOperationsService();
-
- /**
- * The incoming fishing operation to edit.
- * <p/>
- * Can be null (means do not edit any fishing operation), or with no id
- * (means create a ne fishing operation), or with an id (means edit an
- * existing fishing operation).
- */
- protected FishingOperation fishingOperation;
-
- protected final PropertyChangeListener editFishingOperationModelListener = new PropertyChangeListener() {
-
- protected final List<String> propertiesToIgnore = Lists.newArrayList(
- EditFishingOperationUIModel.PROPERTY_MODIFY,
- EditFishingOperationUIModel.PROPERTY_VALID,
- EditFishingOperationUIModel.PROPERTY_PERSISTED
- );
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
-
- EditFishingOperationUIModel model = (EditFishingOperationUIModel) evt.getSource();
-
- if (!model.isLoadingData()
- && model.getFishingOperation() != null
- && !propertiesToIgnore.contains(evt.getPropertyName())) {
-
- model.convertGearShootingCoordinatesToDD();
-
- FishingOperation operation = model.toBean();
- NuitonValidatorResult validationResult = validationService.validateCruiseOperation(operation);
-
- ValidateCruiseUIModel uiModel = getModel();
- uiModel.getValidator().put(uiModel.getSelectedFishingOperation(), validationResult);
-
- getHandler().updateCurrentOperationNode(validationResult);
-
- }
- }
- };
-
- protected final PropertyChangeListener editCatchesModelListener = new PropertyChangeListener() {
-
- protected final List<String> propertiesToIgnore = Lists.newArrayList(
- EditCatchesUIModel.PROPERTY_MODIFY,
- EditCatchesUIModel.PROPERTY_VALID,
- EditCatchesUIModel.PROPERTY_CATCH_TOTAL_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_CATCH_TOTAL_SORTED_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_CATCH_TOTAL_UNSORTED_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_CATCH_TOTAL_REJECTED_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SORTED_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_UNSORTED_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_INERT_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_LIVING_NOT_ITEMIZED_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SORTED_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_UNSORTED_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_INERT_COMPUTED_WEIGHT,
- EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_COMPUTED_WEIGHT
- );
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- EditCatchesUIModel model = (EditCatchesUIModel) evt.getSource();
-
- if (!model.isLoadingData()
- && model.getFishingOperation() != null
- && !propertiesToIgnore.contains(evt.getPropertyName())) {
-
- CatchBatch catchBatch = model.toBean();
- NuitonValidatorResult validationResult = validationService.validateCruiseOperation(catchBatch);
-
- ValidateCruiseUIModel uiModel = getModel();
- uiModel.getValidator().put(uiModel.getSelectedFishingOperation(), validationResult);
-
- getHandler().updateCurrentOperationNode(validationResult);
- }
- }
- };
-
- public EditCruiseFishingOperationAction(ValidateCruiseUIHandler handler) {
- super(handler, true);
- setActionDescription(_("tutti.editFishingOperation.action.editFishingOperation.tip"));
- }
-
- public void setFishingOperation(FishingOperation fishingOperation) {
- this.fishingOperation = fishingOperation;
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- FishingOperationsUI operationPanel = getUI().getOperationPanel();
- operationPanel.getFishingOperationTabContent().getModel().
- removePropertyChangeListener(editFishingOperationModelListener);
- operationPanel.getCatchesTabContent().getModel().
- removePropertyChangeListener(editCatchesModelListener);
-
- return super.prepareAction();
- }
-
- @Override
- public void doAction() throws Exception {
- getUI().getOperationPanel().getModel().setSelectedFishingOperation(fishingOperation);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- FishingOperationsUI operationPanel = getUI().getOperationPanel();
- operationPanel.getFishingOperationTabContent().getModel().addPropertyChangeListener(editFishingOperationModelListener);
- operationPanel.getCatchesTabContent().getModel().addPropertyChangeListener(editCatchesModelListener);
- }
-
- @Override
- public void releaseAction() {
- super.releaseAction();
- fishingOperation = null;
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -54,7 +54,7 @@
text: "tutti.editCruise.action.editGearCaracteristics";
toolTipText: "tutti.editCruise.action.editGearCaracteristics.tip";
enabled: {model.isCanEditGearCatacteristic()};
- _applicationAction: {EditGearCaracteristicsAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.EditGearCaracteristicsAction.class};
_help: {"tutti.editCruise.action.editGearCaracteristics.help"};
}
@@ -63,7 +63,7 @@
text: "tutti.editCruise.action.viewGearCaracteristics";
toolTipText: "tutti.editCruise.action.viewGearCaracteristics.tip";
enabled: {model.isCanShowGearCatacteristic()};
- _applicationAction: {ViewGearCaracteristicsAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ViewGearCaracteristicsAction.class};
_help: {"tutti.editCruise.action.viewGearCaracteristics.help"};
}
@@ -266,7 +266,7 @@
text: "tutti.editCruise.action.saveCruise";
toolTipText: "tutti.editCruise.action.saveCruise.tip";
i18nMnemonic: "tutti.editCruise.action.saveCruise.mnemonic";
- _applicationAction: {SaveCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SaveCruiseAction.class};
enabled: {model.isModify() && model.isValid()};
_help: {"tutti.editCruise.action.save.help"};
}
@@ -276,7 +276,7 @@
text: "tutti.editCruise.action.closeEditCruise";
toolTipText: "tutti.editCruise.action.closeEditCruise.tip";
i18nMnemonic: "tutti.editCruise.action.closeEditCruise.mnemonic";
- _applicationAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SelectCruiseAction.class};
_help: {"tutti.editCruise.action.close.help"};
}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditGearCaracteristicsAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditGearCaracteristicsAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditGearCaracteristicsAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,78 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.cruise;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.CaracteristicMap;
-import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrder;
-import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrders;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.1
- */
-public class EditGearCaracteristicsAction extends AbstractTuttiAction<EditCruiseUIModel, EditCruiseUI, EditCruiseUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(EditGearCaracteristicsAction.class);
-
- protected final PersistenceService persistenceService;
-
- public EditGearCaracteristicsAction(EditCruiseUIHandler handler) {
- super(handler, false);
- persistenceService = getContext().getPersistenceService();
- }
-
- @Override
- public void doAction() throws Exception {
- GearCaracteristicsEditorUI editor = getUI().getGearCaracteristicsEditor();
- editor.getModel().setEditable(true);
-
- GearWithOriginalRankOrder gear =
- EditCruiseUIHandler.GEAR_EDIT_CONTEXT.getContextValue(getUI());
-
- CaracteristicMap caracteristics =
- persistenceService.getGearCaracteristics(
- getDataContext().getCruise().getId(),
- gear.getId(),
- gear.getOriginalRankOrder());
-
- GearWithOriginalRankOrder gearToView =
- GearWithOriginalRankOrders.newGearWithOriginalRankOrder(gear);
- gearToView.setCaracteristics(caracteristics);
-
- if (log.isInfoEnabled()) {
- log.info("Will edit gear " + decorate(gearToView) +
- " with " + gearToView.getCaracteristics().size() + " caracteristics.");
- }
- editor.getModel().setGear(gearToView);
-
- getUI().getMainPanelLayout().setSelected(EditCruiseUIHandler.GEAR_CARACTERISTICS_CARD);
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ExportCruiseValidationMessagesAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ExportCruiseValidationMessagesAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ExportCruiseValidationMessagesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,84 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.cruise;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.service.catches.ValidateCruiseOperationsService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.0.1
- */
-public class ExportCruiseValidationMessagesAction extends AbstractTuttiAction<ValidateCruiseUIModel, ValidateCruiseUI, ValidateCruiseUIHandler> {
-
- protected File file;
-
- /** Validation service. */
- protected ValidateCruiseOperationsService validationService = getContext().getValidateCruiseOperationsService();
-
- public ExportCruiseValidationMessagesAction(ValidateCruiseUIHandler handler) {
- super(handler, false);
- setActionDescription(_("tutti.validateCruise.action.export.all.tip"));
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean doAction = super.prepareAction();
-
- if (doAction) {
- // choose file to export
- file = saveFile(
- String.format("validation_%s", getDataContext().getCruise().getName()),
- "txt",
- _("tutti.validateCruise.action.export.all.chooseFile.title"),
- _("tutti.validateCruise.action.export.all.chooseFile.label")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void doAction() throws Exception {
- ValidateCruiseUIModel uiModel = getModel();
- validationService.exportValidationResults(file, uiModel.getValidator());
- }
-
- @Override
- public void releaseAction() {
- super.releaseAction();
- file = null;
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.validateCruise.action.export.all.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ExportOperationValidationMessagesAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ExportOperationValidationMessagesAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ExportOperationValidationMessagesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,89 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.cruise;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.service.DecoratorService;
-import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.0.1
- */
-public class ExportOperationValidationMessagesAction extends AbstractTuttiAction<ValidateCruiseUIModel, ValidateCruiseUI, ValidateCruiseUIHandler> {
-
- protected File file;
-
- /** Validation service. */
- protected ValidateCruiseOperationsService validationService = getContext().getValidateCruiseOperationsService();
-
- public ExportOperationValidationMessagesAction(ValidateCruiseUIHandler handler) {
- super(handler, false);
- setActionDescription(_("tutti.validateCruise.action.export.operation.tip"));
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to export
- file = saveFile(
- String.format("validation_%s",
- decorate(getModel().getSelectedFishingOperation(), DecoratorService.FILE_NAME_COMPATIBLE)),
- "txt",
- _("tutti.validateCruise.action.export.operation.chooseFile.title"),
- _("tutti.validateCruise.action.export.operation.chooseFile.label")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void doAction() throws Exception {
- ValidateCruiseUIModel uiModel = getModel();
- FishingOperation operation = getModel().getSelectedFishingOperation();
- validationService.exportValidationResult(file, operation, uiModel.getValidator().get(operation));
- }
-
- @Override
- public void releaseAction() {
- super.releaseAction();
- file = null;
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.validateCruise.action.export.operation.success", file));
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -29,11 +29,11 @@
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueEditor;
-import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueRenderer;
+import fr.ifremer.tutti.ui.swing.util.caracteristics.CaracteristicValueEditor;
+import fr.ifremer.tutti.ui.swing.util.caracteristics.CaracteristicValueRenderer;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
import jaxx.runtime.validator.swing.SwingValidator;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/SaveCruiseAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/SaveCruiseAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/SaveCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,179 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.cruise;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrder;
-import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrders;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.lang3.ObjectUtils;
-
-import javax.swing.JOptionPane;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Saves a cruise
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0
- */
-public class SaveCruiseAction extends AbstractTuttiAction<EditCruiseUIModel, EditCruiseUI, EditCruiseUIHandler> {
-
- protected PersistenceService persistenceService;
-
- protected boolean updateVessel;
-
- protected boolean updateGear;
-
- public SaveCruiseAction(EditCruiseUIHandler handler) {
- super(handler, true);
- persistenceService = getContext().getPersistenceService();
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- Cruise bean = getModel().toBean();
- if (!TuttiEntities.isNew(bean)) {
- Cruise oldCruise = persistenceService.getCruise(bean.getId());
-
- // check gear has not changed
- if (!oldCruise.getVessel().equals(bean.getVessel())) {
-
- // if so ask user confirmation
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- _("tutti.editCruise.action.save.vesselChanged.message"),
- _("tutti.editCruise.action.save.vesselChanged.help"));
-
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- htmlMessage,
- _("tutti.editCruise.action.save.vesselChanged.title"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.WARNING_MESSAGE);
-
- result = updateVessel = answer == JOptionPane.OK_OPTION;
- }
-
- if (result) {
-
- if (ObjectUtils.notEqual(oldCruise.getGear(), bean.getGear())) {
-
- // get all gears to remove
-
- Set<Gear> gearsToRemove =
- Sets.<Gear>newHashSet(oldCruise.getGear());
-
- for (GearWithOriginalRankOrder gearWithOriginalRankOrder : bean.getGear()) {
- GearWithOriginalRankOrder g =
- GearWithOriginalRankOrders.newGearWithOriginalRankOrder(
- gearWithOriginalRankOrder.getIdAsInt(),
- gearWithOriginalRankOrder.getOriginalRankOrder()
- );
- gearsToRemove.remove(g);
- }
-
- // check they are not used by any operation of the cruise
- boolean obsoleteGearIsUsed = persistenceService.isOperationUseGears(
- bean.getIdAsInt(), gearsToRemove);
-
- if (obsoleteGearIsUsed) {
-
- // not possible, can't removed used gears
-
- String message = _("tutti.persistence.cruise.gearUsedInOperations.error");
- displayWarningMessage(
- _("tutti.editCruise.action.save.gearChanged.title"),
- "<html><body>" + message + "</body></html>"
- );
- result = false;
- } else {
-
- // if so ask user confirmation
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- _("tutti.editCruise.action.save.gearChanged.message"),
- _("tutti.editCruise.action.save.gearChanged.help"));
-
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- htmlMessage,
- _("tutti.editCruise.action.save.gearChanged.title"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.WARNING_MESSAGE);
-
- result = updateGear = answer == JOptionPane.OK_OPTION;
- }
- }
- }
- }
-
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
- TuttiUIContext context = getContext();
- EditCruiseUIModel model = getModel();
-
- Cruise bean = model.toBean();
-
- Cruise saved;
- if (TuttiEntities.isNew(bean)) {
-
- saved = persistenceService.createCruise(bean);
- model.setId(saved.getId());
- sendMessage(_("tutti.flash.info.cruiseCreated", bean.getName()));
- } else {
- saved = persistenceService.saveCruise(bean, updateVessel, updateGear);
- sendMessage(_("tutti.flash.info.cruiseSaved", bean.getName()));
- }
-
- context.setProgramId(saved.getProgram().getId());
- context.setCruiseId(saved.getId());
-
- // update originalRankOrder for all gears of the cruise
- for (GearWithOriginalRankOrder gear : model.getGear()) {
- gear.setOriginalRankOrder(gear.getRankOrder());
- }
- model.setModify(false);
- }
-
- @Override
- public void postSuccessAction() {
-
- getContext().getMainUI().getHandler().setBodyTitle(
- EditCruiseUIHandler.getTitle(true));
-
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -37,7 +37,7 @@
#exportButton {
actionIcon: export;
toolTipText: "tutti.validateCruise.navigation.action.export.all.tip";
- _applicationAction: {ExportCruiseValidationMessagesAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportCruiseValidationMessagesAction.class};
_help: {"tutti.validateCruise.navigation.action.export.all.help"};
}
@@ -50,7 +50,7 @@
text: "tutti.validateCruise.navigation.action.export.operation";
toolTipText: "tutti.validateCruise.navigation.action.export.operation.tip";
i18nMnemonic: "tutti.validateCruise.navigation.action.export.operation.mnemonic";
- _applicationAction: {ExportOperationValidationMessagesAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportOperationValidationMessagesAction.class};
enabled: {model.getSelectedFishingOperation() != null};
_help: {"tutti.validateCruise.navigation.action.export.operation.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -32,6 +32,7 @@
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
+import fr.ifremer.tutti.ui.swing.action.EditCruiseFishingOperationAction;
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.RemoveablePropertyChangeListener;
@@ -213,7 +214,7 @@
}
}
- protected void updateCurrentOperationNode(NuitonValidatorResult validationResult) {
+ public void updateCurrentOperationNode(NuitonValidatorResult validationResult) {
JTree navigation = ui.getNavigation();
TreePath selectionPath = navigation.getSelectionPath();
Preconditions.checkArgument(selectionPath.getPathCount() > 1);
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ViewGearCaracteristicsAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ViewGearCaracteristicsAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ViewGearCaracteristicsAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,79 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.cruise;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.CaracteristicMap;
-import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrder;
-import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrders;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.1
- */
-public class ViewGearCaracteristicsAction extends AbstractTuttiAction<EditCruiseUIModel, EditCruiseUI, EditCruiseUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ViewGearCaracteristicsAction.class);
-
- protected final PersistenceService persistenceService;
-
- public ViewGearCaracteristicsAction(EditCruiseUIHandler handler) {
- super(handler, false);
- persistenceService = getContext().getPersistenceService();
- }
-
- @Override
- public void doAction() throws Exception {
- GearCaracteristicsEditorUI editor = getUI().getGearCaracteristicsEditor();
- editor.getModel().setEditable(false);
-
- GearWithOriginalRankOrder gear =
- EditCruiseUIHandler.GEAR_EDIT_CONTEXT.getContextValue(getUI());
-
- CaracteristicMap caracteristics =
- persistenceService.getGearCaracteristics(
- getDataContext().getCruise().getId(),
- gear.getId(),
- gear.getOriginalRankOrder());
-
- GearWithOriginalRankOrder gearToEdit =
- GearWithOriginalRankOrders.newGearWithOriginalRankOrder(gear);
- gearToEdit.setCaracteristics(caracteristics);
-
- if (log.isInfoEnabled()) {
- log.info("Will edit gear " + decorate(gearToEdit) +
- " with " + gearToEdit.getCaracteristics().size() + " caracteristics.");
- }
-
- editor.getModel().setGear(gearToEdit);
-
- getUI().getMainPanelLayout().setSelected(EditCruiseUIHandler.GEAR_CARACTERISTICS_CARD);
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/CloseDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/CloseDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/CloseDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,88 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.db;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To close a db.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
- */
-public class CloseDbAction extends AbstractMainUITuttiAction {
-
- protected String jdbcUrl;
-
- public CloseDbAction(MainUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean canContinue = super.prepareAction();
- if (canContinue) {
- jdbcUrl = getConfig().getJdbcUrl();
- }
- return canContinue;
- }
-
- @Override
- public void doAction() {
-
- // close db
- getContext().getPersistenceService().clearAllCaches();
-
- // set to not reload a real db
- getContext().setDbLoaded(false);
-
- // close services + repon a fake persistence service
- getHandler().reloadPersistenceService();
-
- // clean db context
- getContext().clearDbContext();
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- sendMessage(_("tutti.flash.info.db.closed", jdbcUrl));
-
- // make sure title is reloaded
- handler.reloadDbManagerText();
- handler.changeTitle();
- }
-
- @Override
- public void postFailedAction(Throwable error) {
- handler.reloadDbManagerText();
- super.postFailedAction(error);
- }
-}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -43,7 +43,7 @@
text: {handler.getInstallButtonText(model.isDbExist())};
toolTipText: {handler.getInstallButtonTip(model.isDbExist())};
i18nMnemonic: "tutti.dbManager.action.installDb.mnemonic";
- _applicationAction: {InstallOrReinstallDbAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.InstallOrReinstallDbAction.class};
_help: {"tutti.dbManager.action.installDb.help"};
}
@@ -51,7 +51,7 @@
actionIcon: import-db;
text: "tutti.dbManager.action.importDb";
i18nMnemonic: "tutti.dbManager.action.importDb.mnemonic";
- _applicationAction: {ImportOrReimportDbAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportOrReimportDbAction.class};
toolTipText: "tutti.dbManager.action.importDb.tip";
_help: {"tutti.dbManager.action.importDb.help"};
}
@@ -61,7 +61,7 @@
text: "tutti.dbManager.action.openDb";
i18nMnemonic: "tutti.dbManager.action.openDb.mnemonic";
visible: {model.isDbExist() && !model.isDbLoaded()};
- _applicationAction: {OpenDbAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.OpenDbAction.class};
toolTipText: "tutti.dbManager.action.openDb.tip";
_help: {"tutti.dbManager.action.openDb.help"};
}
@@ -71,7 +71,7 @@
text: "tutti.dbManager.action.upgradeDb";
i18nMnemonic: "tutti.dbManager.action.upgradeDb.mnemonic";
visible: {model.isDbLoaded()};
- _applicationAction: {UpdateDbAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.UpdateDbAction.class};
toolTipText: "tutti.dbManager.action.upgradeDb.tip";
_help: {"tutti.dbManager.action.upgradeDb.help"};
}
@@ -81,7 +81,7 @@
text: "tutti.dbManager.action.exportDb";
i18nMnemonic: "tutti.dbManager.action.exportDb.mnemonic";
visible: {model.isDbLoaded()};
- _applicationAction: {ExportDbAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportDbAction.class};
toolTipText: "tutti.dbManager.action.exportDb.tip";
_help: {"tutti.dbManager.action.exportDb.help"};
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.jaxx 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.jaxx 2013-11-26 08:03:42 UTC (rev 1388)
@@ -27,7 +27,6 @@
<import>
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
fr.ifremer.tutti.ui.swing.TuttiUIContext
- fr.ifremer.tutti.ui.swing.content.UpdateDbAction
fr.ifremer.tutti.ui.swing.util.TuttiUI
javax.swing.border.EmptyBorder
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ExportAndCleanDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ExportAndCleanDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ExportAndCleanDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,137 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.db;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.RunTutti;
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To export a db attached to Tutti.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ExportAndCleanDbAction extends AbstractMainUITuttiAction {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportAndCleanDbAction.class);
-
- public static final DateFormat df = new SimpleDateFormat("yyy-MM-dd");
-
- protected File file;
-
- public ExportAndCleanDbAction(MainUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- file = null;
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // ask user file where to export db
-
- // choose file to import
- file = saveFile(
- "tutti-db-" + df.format(new Date()),
- "zip",
- _("tutti.dbManager.title.choose.dbExportFile"),
- _("tutti.dbManager.action.chooseDbExportFile"),
- "^.*\\.zip", _("tutti.common.file.zip")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void doAction() {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will export db to " + file);
- }
-
- ProgressionModel progressionModel = new ProgressionModel();
- setProgressionModel(progressionModel);
- progressionModel.setTotal(3);
-
- // close db
-
- progressionModel.setMessage(_("tutti.exportDb.step.closeDb"));
-
- // clear all caches
- getContext().getPersistenceService().clearAllCaches();
-
- // set to not reload a real db
- getContext().setDbLoaded(false);
-
- // close services + repon a fake persistence service
- getHandler().reloadPersistenceService();
-
- // clean db context
- getContext().clearDbContext();
-
- // export db
-
- progressionModel.increments(1);
- progressionModel.setMessage(_("tutti.exportDb.step.createArchive", file));
-
- getContext().getPersistenceService().exportDb(file);
-
- // clean files
-
- progressionModel.increments(1);
- progressionModel.setMessage(_("tutti.exportDb.step.reloadApplication"));
-
- // Close the application, will exit and restart application
- RunTutti.closeTutti(getHandler(), RunTutti.DELETE_DB_EXIT_CODE);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- sendMessage(_("tutti.flash.info.db.exported.and.clean", file));
-
- // make sure title is reloaded
- getUI().getHandler().changeTitle();
- }
-
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ExportDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ExportDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ExportDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,131 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.db;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To export a db attached to Tutti.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ExportDbAction extends AbstractMainUITuttiAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(ExportDbAction.class);
-
- public static final int TOTAL_STEP = 3;
-
- protected File file;
-
- public static final DateFormat df = new SimpleDateFormat("yyy-MM-dd");
-
- public ExportDbAction(MainUIHandler handler) {
- super(handler, true);
- }
-
- public void setFile(File file) {
- this.file = file;
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- file = null;
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // ask user file where to export db
- file = saveFile(
- "tutti-db-" + df.format(new Date()),
- "zip",
- _("tutti.dbManager.title.choose.dbExportFile"),
- _("tutti.dbManager.action.chooseDbExportFile"),
- "^.*\\.zip", _("tutti.common.file.zip")
- );
- doAction = file != null;
- }
-
- if (doAction) {
-
- ProgressionModel progressionModel = new ProgressionModel();
- setProgressionModel(progressionModel);
- progressionModel.setTotal(TOTAL_STEP);
- }
- return doAction;
- }
-
- @Override
- public void doAction() {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will export db to " + file);
- }
-
- ProgressionModel progressionModel = getProgressionModel();
-
- // close db
-
- progressionModel.setMessage(_("tutti.exportDb.step.closeDb"));
-
- getContext().setDbLoaded(false);
- getHandler().reloadPersistenceService();
-
- // export
-
- progressionModel.increments(_("tutti.exportDb.step.createArchive", file));
-
- getContext().getPersistenceService().exportDb(file);
-
- // reopen db
-
- progressionModel.increments(_("tutti.exportDb.step.openDb"));
-
- getContext().setDbLoaded(true);
- getHandler().reloadPersistenceService();
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.flash.info.db.exported", file));
-
- // make sure title is reloaded
- getUI().getHandler().changeTitle();
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,333 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.db;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.shared.application.ApplicationBusinessException;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import fr.ifremer.tutti.ui.swing.content.SelectCruiseAction;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.Version;
-
-import javax.swing.JOptionPane;
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To import a db and use it.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.1
- */
-public class ImportDbAction extends AbstractMainUITuttiAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(ImportDbAction.class);
-
- protected File importFile;
-
- protected String jdbcUrl;
-
- protected boolean updateSchema;
-
- protected boolean closeDb;
-
- protected Version dbVersion;
-
- protected Version applicationVersion;
-
- protected PersistenceService.ImportStructureType importStructureType;
-
- public ImportDbAction(MainUIHandler handler) {
- super(handler, true);
- setActionDescription(_("tutti.dbManager.action.importDb.tip"));
- }
-
- public void setImportFile(File importFile) {
- this.importFile = importFile;
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- importStructureType = null;
- jdbcUrl = null;
- dbVersion = applicationVersion = null;
- closeDb = updateSchema = false;
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- jdbcUrl = getConfig().getJdbcUrl();
-
- if (importFile == null) {
-
- // choose file to import
- importFile = chooseFile(
- _("tutti.dbManager.title.choose.dbImportFile"),
- _("tutti.dbManager.action.chooseDbFile"),
- "^.*\\.zip", _("tutti.common.file.zip")
- );
-
- if (importFile == null) {
-
- displayWarningMessage(
- _("tutti.dbManager.title.choose.dbImportFile"),
- _("tutti.dbManager.action.importdb.no.import.file.choosen")
- );
-
- doAction = false;
- }
- }
-
- if (doAction) {
-
- ProgressionModel progressionModel = new ProgressionModel();
- progressionModel.setTotal(3);
- setProgressionModel(progressionModel);
-
- importStructureType =
- getContext().getPersistenceService().checkImportStructure(importFile);
- }
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- importFile = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(importFile);
-
- if (log.isInfoEnabled()) {
- log.info("Will import db: " + importFile);
- }
-
- ProgressionModel progressionModel = getProgressionModel();
-
- // ------------------------------------------------------------------ //
- // --- import db //
- // ------------------------------------------------------------------ //
-
- progressionModel.increments(_("tutti.importDb.step.unzipArchive"));
-
- getContext().getPersistenceService().importDb(importStructureType, importFile);
-
- // ------------------------------------------------------------------ //
- // --- open db //
- // ------------------------------------------------------------------ //
-
- progressionModel.increments(_("tutti.importDb.step.openDb", jdbcUrl));
- try {
- getContext().setDbExist(true);
- getContext().setDbLoaded(true);
- handler.reloadPersistenceService();
- } catch (Exception e) {
-
- if (log.isErrorEnabled()) {
- log.error("Could not open db", e);
- }
- // no more db
- getContext().setDbLoaded(false);
- handler.reloadPersistenceService();
-
- // could not load db
- throw new ApplicationBusinessException(_("tutti.dbManager.action.importdb.couldNotOpen"), e);
- }
-
- // ------------------------------------------------------------------ //
- // --- check schema version //
- // ------------------------------------------------------------------ //
-
- progressionModel.increments(_("tutti.importDb.step.checkSchemaVersion"));
-
- TuttiPersistence persistenceService =
- handler.getPersistenceService();
-
- dbVersion = persistenceService.getDbVersion();
-
- if (log.isInfoEnabled()) {
- log.info("Detected database version: " + dbVersion);
- }
- applicationVersion = persistenceService.getApplicationVersion();
-
- if (log.isInfoEnabled()) {
- log.info("Detected schema application version:" + applicationVersion);
- }
-
- if (dbVersion == null) {
-
- // no database version filled (can not migrate schema)
- String message = _("tutti.dbManager.action.upgradeDb.schema.version.not.found");
- displayWarningMessage(_("tutti.dbManager.title.schema.toupdate"), message);
-
- closeDb = true;
- } else if (dbVersion.equals(applicationVersion)) {
-
- // database schema is up to date
- if (log.isInfoEnabled()) {
- log.info("Database schema is up-to-date at version: " + dbVersion);
- }
- } else if (dbVersion.compareTo(applicationVersion) < 0) {
-
- // database schema need to migrate
- // ask user to migrate or not (if not will close db)
-
- String message = _("tutti.dbManager.action.upgradeDb.schema.to.update.message", dbVersion, applicationVersion);
-
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- message,
- _("tutti.dbManager.action.upgradeDb.schema.to.update.message.help"));
- int i = JOptionPane.showConfirmDialog(
- handler.getTopestUI(),
- htmlMessage,
- _("tutti.dbManager.title.schema.toupdate"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- boolean continueAction = i == JOptionPane.OK_OPTION;
-
- if (continueAction) {
-
- // will migrate
- updateSchema = true;
- } else {
-
- //close db
- closeDb = true;
- }
-
-
- } else {
-
- // database schema version is higher than application one
- String message = _("tutti.dbManager.action.upgradeDb.schema.too.high", dbVersion, applicationVersion);
-
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- message,
- _("tutti.dbManager.action.upgradeDb.schema.too.high.help"));
- int i = JOptionPane.showConfirmDialog(
- handler.getTopestUI(),
- htmlMessage,
- _("tutti.dbManager.title.schema.toupdate"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- boolean continueAction = i == JOptionPane.OK_OPTION;
-
- if (!continueAction) {
-
- //close db
- closeDb = true;
- }
- }
-
- if (closeDb) {
-
- // ------------------------------------------------------------------ //
- // --- close db //
- // ------------------------------------------------------------------ //
-
- progressionModel.increments(_("tutti.importDb.step.closeDb"));
- getActionEngine().runInternalAction(handler, CloseDbAction.class);
-
- return;
- }
-
- if (updateSchema) {
-
- // need to migrate schema
- progressionModel.adaptTotal(progressionModel.getTotal() + 2);
-
- // ------------------------------------------------------------------ //
- // --- update schema //
- // ------------------------------------------------------------------ //
-
- String message = _("tutti.importDb.step.will.migrateSchema",
- dbVersion, applicationVersion);
-
- progressionModel.increments(message);
- sendMessage(message);
- handler.getPersistenceService().updateSchema();
-
- sendMessage(_("tutti.flash.info.db.schema.updated", dbVersion, applicationVersion));
- }
-
- // ------------------------------------------------------------------ //
- // --- check db context //
- // ------------------------------------------------------------------ //
-
- String message = _("tutti.importDb.step.check.dbContext",
- dbVersion, applicationVersion);
-
- progressionModel.increments(message);
-
- if (log.isDebugEnabled()) {
- log.debug("Check db context");
- }
- getContext().checkDbContext();
-
- // ------------------------------------------------------------------ //
- // --- change screen //
- // ------------------------------------------------------------------ //
-
- getActionEngine().runInternalAction(handler, SelectCruiseAction.class);
- }
-
- @Override
- public void postSuccessAction() {
- handler.reloadDbManagerText();
-
- super.postSuccessAction();
-
- if (closeDb) {
- sendMessage(_("tutti.flash.info.db.imported.but.closed", jdbcUrl));
- } else {
- sendMessage(_("tutti.flash.info.db.imported", jdbcUrl));
- }
-
- // make sure title is reloaded
- getUI().getHandler().changeTitle();
- }
-
- @Override
- public void postFailedAction(Throwable error) {
- handler.reloadDbManagerText();
- super.postFailedAction(error);
- }
-
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportOrReimportDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportOrReimportDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportOrReimportDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,73 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.db;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-
-/**
- * To import or reimport a db (will delegate to correct action).
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
- */
-public class ImportOrReimportDbAction extends AbstractMainUITuttiAction {
-
- protected AbstractMainUITuttiAction delegateAction;
-
- public ImportOrReimportDbAction(MainUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- if (getContext().isDbExist()) {
-
- // reimport action
- delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), ReimportDbAction.class);
- } else {
-
- // import action
- delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), ImportDbAction.class);
- }
-
- setActionDescription(delegateAction.getActionDescription());
-
- return delegateAction.prepareAction();
- }
-
- @Override
- public void doAction() throws Exception {
-
- getActionEngine().runInternalAction(delegateAction);
- }
-
- @Override
- protected void releaseAction() {
- delegateAction = null;
- super.releaseAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,126 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.db;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiConfiguration;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.updater.ApplicationUpdater;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To install (or reinstall) a db from last network one.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
- */
-public class InstallDbAction extends AbstractMainUITuttiAction {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(InstallDbAction.class);
-
- protected File backupFile;
-
- protected boolean doBackup;
-
- protected String jdbcUrl;
-
- public InstallDbAction(MainUIHandler handler) {
- super(handler, true);
- setActionDescription(_("tutti.dbManager.action.installDb.tip"));
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // check db url is reachable
- doAction = getContext().checkUpdateDataReachable();
- }
-
- if (doAction) {
-
- ProgressionModel progressionModel = new ProgressionModel();
- progressionModel.setTotal(2);
- setProgressionModel(progressionModel);
- }
- return doAction;
- }
-
- @Override
- public void doAction() {
-
- ProgressionModel progressionModel = getProgressionModel();
-
- // ------------------------------------------------------------------ //
- // --- install db //
- // ------------------------------------------------------------------ //
-
- TuttiConfiguration config = getConfig();
-
- File current = config.getDataDirectory();
- String url = config.getUpdateDataUrl();
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Try to install / update db (current data location: %s), using update url: %s", current, url));
- }
-
- File dest = new File(config.getBasedir(), "NEW");
-
- progressionModel.increments(_("tutti.dbManager.action.upgradeDb.check"));
- TuttiDbUpdaterCallBack callback =
- new TuttiDbUpdaterCallBack(this, progressionModel);
- ApplicationUpdater up = new ApplicationUpdater();
- up.update(url,
- current,
- dest,
- false,
- callback,
- progressionModel);
-
- Preconditions.checkState(callback.isDbInstalled());
-
- progressionModel.increments(_("tutti.dbManager.action.upgradeDb.opening"));
-
- getContext().setDbExist(true);
-
- // ------------------------------------------------------------------ //
- // --- open db //
- // ------------------------------------------------------------------ //
-
- getActionEngine().runInternalAction(getHandler(), OpenDbAction.class);
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallOrReinstallDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallOrReinstallDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallOrReinstallDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,74 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.db;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-
-/**
- * To install or reinstall a db (will delegate to correct action).
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
- */
-public class InstallOrReinstallDbAction extends AbstractMainUITuttiAction {
-
- protected AbstractMainUITuttiAction delegateAction;
-
- public InstallOrReinstallDbAction(MainUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- if (getContext().isDbExist()) {
-
- // reinstall action
- delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), ReinstallDbAction.class);
- } else {
-
- // install action
- delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), InstallDbAction.class);
- }
-
- setActionDescription(delegateAction.getActionDescription());
-
- return delegateAction.prepareAction();
- }
-
- @Override
- public void doAction() throws Exception {
-
- getActionEngine().runInternalAction(delegateAction);
- }
-
- @Override
- protected void releaseAction() {
- delegateAction = null;
- super.releaseAction();
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/OpenDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/OpenDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/OpenDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,376 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.db;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.shared.application.ApplicationBusinessException;
-import fr.ifremer.shared.application.swing.action.ApplicationUIAction;
-import fr.ifremer.tutti.TuttiConfiguration;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.updater.ApplicationInfo;
-import org.nuiton.updater.ApplicationUpdater;
-import org.nuiton.util.Version;
-
-import javax.swing.JOptionPane;
-import java.io.File;
-import java.util.Date;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To open existing db.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class OpenDbAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(OpenDbAction.class);
-
- protected Version dbVersion;
-
- protected Version applicationVersion;
-
- protected File file;
-
- protected boolean updateSchema;
-
- protected boolean updateReferentiel;
-
- protected boolean closeDb;
-
- protected String jdbcUrl;
-
- protected ApplicationInfo updateDbVersion;
-
- public OpenDbAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.SELECT_CRUISE);
- setActionDescription(_("tutti.dbManager.action.openDb.tip"));
- }
-
- public void setUpdateReferentiel(boolean updateReferentiel) {
- this.updateReferentiel = updateReferentiel;
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean canContinue = super.prepareAction();
- if (canContinue) {
- jdbcUrl = null;
- dbVersion = applicationVersion = null;
- file = null;
- closeDb = updateSchema = false;
- updateDbVersion = null;
-
- updateReferentiel &= getContext().checkUpdateDataReachable();
-
- if (updateReferentiel) {
-
- // get the next db version
- ApplicationUpdater up = new ApplicationUpdater();
-
- // get db updates
- Map<String, ApplicationInfo> dbVersions =
- up.getVersions(getConfig().getUpdateDataUrl(),
- getConfig().getDataDirectory());
- updateDbVersion =
- dbVersions.get(TuttiDbUpdaterCallBack.DB_UPDATE_NAME);
-
- if (updateDbVersion != null && updateDbVersion.newVersion != null) {
-
- // ask user if it wants to do the update
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- _("tutti.dbManager.updatedb.found", updateDbVersion.newVersion),
- _("tutti.common.askBeforeUpdate.help"));
- int i = JOptionPane.showConfirmDialog(
- getHandler().getTopestUI(),
- htmlMessage,
- _("tutti.dbManager.title.confirm.updatedb"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE);
-
- updateReferentiel = i == JOptionPane.OK_OPTION;
- }
-
- }
- }
- return canContinue;
- }
-
- @Override
- public void doAction() throws Exception {
-
- if (log.isDebugEnabled()) {
- log.debug("Will open db...");
- }
-
- jdbcUrl = getConfig().getJdbcUrl();
-
- // at the beginning 3 steps (open db + check version + check db context)
- ProgressionModel progressionModel = new ProgressionModel();
- setProgressionModel(progressionModel);
- progressionModel.setTotal(3 + (updateReferentiel ? 1 : 0));
-
- // ------------------------------------------------------------------ //
- // --- open db //
- // ------------------------------------------------------------------ //
-
- progressionModel.increments(_("tutti.openDb.step.open", jdbcUrl));
- try {
- getContext().setDbLoaded(true);
- getHandler().reloadPersistenceService();
- } catch (Exception e) {
-
- if (log.isErrorEnabled()) {
- log.error("Could not open db", e);
- }
- // no more db
- getContext().setDbLoaded(false);
- getHandler().reloadPersistenceService();
-
- // could not load db
- throw new ApplicationBusinessException(_("tutti.dbManager.action.openDb.couldNotOpen"));
- }
-
- // ------------------------------------------------------------------ //
- // --- check schema version //
- // ------------------------------------------------------------------ //
-
- progressionModel.increments(_("tutti.openDb.step.checkSchemaVersion"));
-
- TuttiPersistence persistenceService =
- getHandler().getPersistenceService();
-
- dbVersion = persistenceService.getDbVersion();
-
- if (log.isInfoEnabled()) {
- log.info("Detected database version: " + dbVersion);
- }
- applicationVersion = persistenceService.getApplicationVersion();
-
- if (log.isInfoEnabled()) {
- log.info("Detected schema application version:" + applicationVersion);
- }
-
- TuttiConfiguration config = getConfig();
- if (dbVersion.equals(applicationVersion)) {
-
- // database schema is up to date
- if (log.isInfoEnabled()) {
- log.info("Database schema is up-to-date at version: " + dbVersion);
- }
- } else if (dbVersion.compareTo(applicationVersion) < 0) {
-
- // database schema need to migrate
- // ask user to migrate or not (if not will close db)
-
- // ask user where to backup db
-
- String message = _("tutti.dbManager.action.upgradeDb.schema.to.update.message", dbVersion, applicationVersion);
-
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- message,
- _("tutti.dbManager.action.upgradeDb.schema.to.update.message.help"));
- int i = JOptionPane.showConfirmDialog(
- getHandler().getTopestUI(),
- htmlMessage,
- _("tutti.dbManager.title.schema.toupdate"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- boolean continueAction = i == JOptionPane.OK_OPTION;
-
- if (continueAction) {
-
- // ask user file where to backup db
-
- file = saveFile(
- config.getDbBackupDirectory(),
- "tutti-db-" + ExportDbAction.df.format(new Date()),
- "zip",
- _("tutti.dbManager.title.choose.dbBackupFile"),
- _("tutti.dbManager.action.chooseDbBackupFile"),
- "^.*\\.zip", _("tutti.common.file.zip")
- );
-
- if (file == null) {
-
- // won't migrate db
- closeDb = true;
-
- displayWarningMessage(
- _("tutti.dbManager.title.choose.dbBackupFile"),
- _("tutti.dbManager.action.upgradeDb.no.backup.db.choosen")
- );
- } else {
-
- updateSchema = true;
- }
- } else {
-
- //close db
- closeDb = true;
- }
-
- } else {
-
- // database schema version is higher than application one
- displayWarningMessage(
- _("tutti.dbManager.title.schema.toupdate"),
- _("tutti.dbManager.action.upgradeDb.schema.not.update.message", dbVersion, applicationVersion)
- );
- }
-
- if (closeDb) {
-
- // ------------------------------------------------------------------ //
- // --- close current db //
- // ------------------------------------------------------------------ //
-
- progressionModel.increments(_("tutti.importDb.step.closeDb"));
- getActionEngine().runInternalAction(getHandler(), CloseDbAction.class);
-
- setScreen(TuttiScreen.MANAGE_DB);
- super.doAction();
- return;
- }
-
- if (updateSchema) {
-
- // need to export db + migrate schema)
- progressionModel.adaptTotal(progressionModel.getTotal() + ExportDbAction.TOTAL_STEP + 1);
-
- // ------------------------------------------------------------------ //
- // --- backup current db //
- // ------------------------------------------------------------------ //
-
- ApplicationUIAction<ExportDbAction> backupAction =
- getActionFactory().createUIAction(getHandler(), ExportDbAction.class);
- backupAction.getLogicAction().setProgressionModel(getProgressionModel());
- backupAction.getLogicAction().setFile(file);
- getActionEngine().runInternalAction(backupAction.getLogicAction());
-
- // ------------------------------------------------------------------ //
- // --- update schema //
- // ------------------------------------------------------------------ //
-
- String message = _("tutti.openDb.step.will.migrateSchema",
- dbVersion, applicationVersion);
-
- progressionModel.increments(message);
- sendMessage(message);
- getHandler().getPersistenceService().updateSchema();
- }
-
- if (updateReferentiel) {
-
- // ------------------------------------------------------------------ //
- // --- update referentiel //
- // ------------------------------------------------------------------ //
-
- progressionModel.increments(_("tutti.openDb.step.updateReferential"));
-
- File current = config.getDataDirectory();
- String url = config.getUpdateDataUrl();
-
- File dest = new File(config.getBasedir(), "NEW");
-
- progressionModel.setMessage(_("tutti.dbManager.action.upgradeDb.check"));
- TuttiDbUpdaterCallBack callback =
- new TuttiDbUpdaterCallBack(this, progressionModel);
- ApplicationUpdater up = new ApplicationUpdater();
- up.update(url,
- current,
- dest,
- false,
- callback,
- progressionModel);
-
- if (callback.isDbUpdated()) {
-
- progressionModel.setMessage(_("tutti.dbManager.action.upgradeDb.reloading"));
-
- } else {
- sendMessage(_("tutti.dbManager.action.upgradeDb.upToDate"));
- }
- }
-
- // ------------------------------------------------------------------ //
- // --- check db context //
- // ------------------------------------------------------------------ //
-
- String message = _("tutti.openDb.step.check.dbContext",
- dbVersion, applicationVersion);
-
- progressionModel.increments(message);
-
- if (log.isDebugEnabled()) {
- log.debug("Check db context");
- }
- getContext().checkDbContext();
-
- super.doAction();
- }
-
- @Override
- public void postSuccessAction() {
-
- handler.reloadDbManagerText();
-
- // make sure title is reloaded
- handler.changeTitle();
-
- if (closeDb) {
- sendMessage(_("tutti.flash.info.db.not.opened", jdbcUrl));
- } else {
-
- if (updateSchema) {
-
- sendMessage(_("tutti.flash.info.db.schema.updated", dbVersion, applicationVersion));
- }
-
- sendMessage(_("tutti.flash.info.db.opened", jdbcUrl));
- }
- }
-
- @Override
- public void postFailedAction(Throwable error) {
-
- handler.reloadDbManagerText();
-
- super.postFailedAction(error);
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReimportDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReimportDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReimportDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,167 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.db;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.shared.application.ApplicationIOUtil;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.RunTutti;
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-
-import java.io.File;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To import a db after restart application.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.1
- */
-public class ReimportDbAction extends AbstractMainUITuttiAction {
-
- protected File backupFile;
-
- protected File importFile;
-
- protected String jdbcUrl;
-
- public ReimportDbAction(MainUIHandler handler) {
- super(handler, true);
- setActionDescription(_("tutti.dbManager.action.importDb.tip"));
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- jdbcUrl = null;
- backupFile = importFile = null;
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- jdbcUrl = getConfig().getJdbcUrl();
-
- if (getModel().isDbExist()) {
-
- displayInfoMessage(
- _("tutti.dbManager.title.backup.db"),
- _("tutti.dbManager.action.importDb.backup.db")
- );
-
- // choose backup file
- backupFile = saveFile(
- getConfig().getDbBackupDirectory(),
- "tutti-db-" + ExportDbAction.df.format(new Date()),
- "zip",
- _("tutti.dbManager.title.choose.dbExportFile"),
- _("tutti.dbManager.action.chooseDbExportFile"),
- "^.*\\.zip", _("tutti.common.file.zip")
- );
-
- if (backupFile == null) {
-
- displayWarningMessage(
- _("tutti.dbManager.title.backup.db"),
- _("tutti.dbManager.action.importdb.no.backup.db.choosen")
- );
-
- doAction = false;
- }
- }
-
- if (doAction && importFile == null) {
-
- // choose file to import
- importFile = chooseFile(
- _("tutti.dbManager.title.choose.dbImportFile"),
- _("tutti.dbManager.action.chooseDbFile"),
- "^.*\\.zip", _("tutti.common.file.zip")
- );
-
- if (importFile == null) {
-
- displayWarningMessage(
- _("tutti.dbManager.title.choose.dbImportFile"),
- _("tutti.dbManager.action.importdb.no.import.file.choosen")
- );
-
- doAction = false;
- }
- }
-
- if (doAction) {
-
- ProgressionModel progressionModel = new ProgressionModel();
- progressionModel.setTotal(3);
- setProgressionModel(progressionModel);
-
- getContext().getPersistenceService().checkImportStructure(importFile);
- }
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- importFile = backupFile = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(importFile);
- Preconditions.checkNotNull(backupFile);
-
- ProgressionModel progressionModel = getProgressionModel();
-
- // close db
- progressionModel.increments(_("tutti.reimport.step.closeDb", jdbcUrl));
- getContext().setDbLoaded(false);
- getHandler().reloadPersistenceService();
-
- // backup db
- progressionModel.increments(_("tutti.reimport.step.backupDb", backupFile));
- getContext().getPersistenceService().exportDb(backupFile);
-
- // clean db context
- getContext().clearDbContext();
-
- // write restart action file (will be load at restart)
- String actionContent = ImportDbAction.class.getName() + ":" + importFile.getAbsolutePath();
-
- File startActionFile = getConfig().getStartActionFile();
- ApplicationIOUtil.writeContent(startActionFile, actionContent, _("tutti.error.write.startActionFile", startActionFile));
-
- // restart application
- progressionModel.increments(_("tutti.reimport.step.reloadApplication"));
-
- RunTutti.closeTutti(getHandler(), RunTutti.DELETE_DB_EXIT_CODE);
- }
-
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReinstallDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReinstallDbAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReinstallDbAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,146 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.db;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.shared.application.ApplicationIOUtil;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.RunTutti;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-
-import java.io.File;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To install (or reinstall) a db from last network one.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
- */
-public class ReinstallDbAction extends AbstractMainUITuttiAction {
-
- protected File backupFile;
-
- protected String jdbcUrl;
-
- public ReinstallDbAction(MainUIHandler handler) {
- super(handler, true);
- setActionDescription(_("tutti.dbManager.action.installDb.tip"));
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // check we can connect to remote install server
-
- // check db url is reachable
- TuttiUIContext context = getContext();
- doAction = context.checkUpdateDataReachable();
- }
-
- if (doAction) {
-
- jdbcUrl = null;
- backupFile = null;
-
- jdbcUrl = getConfig().getJdbcUrl();
-
- if (getModel().isDbExist()) {
-
- displayInfoMessage(
- _("tutti.dbManager.title.backup.db"),
- _("tutti.dbManager.action.installDb.backup.db")
- );
-
- // choose backup file
- backupFile = saveFile(
- getConfig().getDbBackupDirectory(),
- "tutti-db-" + ExportDbAction.df.format(new Date()),
- "zip",
- _("tutti.dbManager.title.choose.dbExportFile"),
- _("tutti.dbManager.action.chooseDbExportFile"),
- "^.*\\.zip", _("tutti.common.file.zip")
- );
-
- if (backupFile == null) {
-
- displayWarningMessage(
- _("tutti.dbManager.title.backup.db"),
- _("tutti.dbManager.action.installDb.no.backup.db.choosen")
- );
-
- doAction = false;
- }
- }
- }
-
- if (doAction) {
-
- ProgressionModel progressionModel = new ProgressionModel();
- progressionModel.setTotal(3);
- setProgressionModel(progressionModel);
- }
- return doAction;
- }
-
- @Override
- public void doAction() {
-
- Preconditions.checkNotNull(backupFile);
-
- ProgressionModel progressionModel = getProgressionModel();
-
- // close db
- progressionModel.increments(_("tutti.reinstallDb.step.closeDb", jdbcUrl));
-
- getContext().setDbLoaded(false);
- getHandler().reloadPersistenceService();
-
- // backup db
- progressionModel.increments(_("tutti.reinstallDb.step.backupDb", backupFile));
- getContext().getPersistenceService().exportDb(backupFile);
-
- // clean db context
- getContext().clearDbContext();
-
- // write restart action file (will be loaded at restart)
- String actionContent = InstallDbAction.class.getName();
-
- File startActionFile = getConfig().getStartActionFile();
- ApplicationIOUtil.writeContent(startActionFile, actionContent, _("tutti.error.write.startActionFile", startActionFile));
-
- // restart application
- progressionModel.increments(_("tutti.reinstallDb.step.reloadApplication"));
-
- RunTutti.closeTutti(getHandler(), RunTutti.DELETE_DB_EXIT_CODE);
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,161 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocols;
-import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import jaxx.runtime.context.JAXXContextEntryDef;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JOptionPane;
-import javax.swing.UIManager;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Opens the protocol creation screen with the data of an already existing protocol.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class CloneProtocolAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(CloneProtocolAction.class);
-
- public static final JAXXContextEntryDef<TuttiProtocol> CLONE_PROTOCOL_ENTRY = new JAXXContextEntryDef<TuttiProtocol>("cloneProtocol", TuttiProtocol.class);
-
- protected TuttiProtocol protocol;
-
- public CloneProtocolAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_PROTOCOL);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- CLONE_PROTOCOL_ENTRY.removeContextValue(getContext().getMainUI());
-
- boolean doAction = super.prepareAction();
- if (doAction) {
-
- // check that protocol is compatible with sample category model
- SampleCategoryModel sampleCategoryModel =
- getDataContext().getSampleCategoryModel();
-
- if (log.isInfoEnabled()) {
- log.info("Clone protocol: " + getContext().getProtocolId());
- }
-
- // get protocol
- protocol = getContext().getPersistenceService().getProtocol(getContext().getProtocolId());
-
- // remove id
- protocol.setId((String) null);
-
- Set<Integer> badCategories = Sets.newHashSet();
-
- TuttiProtocols.checkSampleCategories(sampleCategoryModel,
- protocol,
- badCategories);
-
- if (!badCategories.isEmpty()) {
-
- // detect some bad categories
- if (log.isWarnEnabled()) {
- log.warn("There is some bad categories: " + badCategories);
- }
-
- String message = TuttiProtocols.getBadCategoriesMessage(
- badCategories,
- getDecorator(Caracteristic.class, null),
- getContext().getPersistenceService());
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- message,
- _("tutti.common.askBeforeCloneProtocol.help"));
- int response = JOptionPane.showOptionDialog(
- getContext().getActionUI(),
- htmlMessage,
- _("tutti.common.askBeforeEditProtocol.title"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.WARNING_MESSAGE,
- UIManager.getIcon("warning"),
- new Object[]{_("tutti.option.cleanAndClone"), _("tutti.option.clone"), _("tutti.option.cancel")},
- _("tutti.option.cancel")
- );
-
- switch (response) {
- case 0:
- // clean and clone
- if (log.isInfoEnabled()) {
- log.info("Clean and Clone");
- }
- TuttiProtocols.removeBadCategories(sampleCategoryModel,
- protocol);
- break;
-
- case 1:
- // clone with no clean
- if (log.isInfoEnabled()) {
- log.info("Clone with no cleaning");
- }
- break;
- default:
-
- // cancel
- doAction = false;
- }
- }
- }
- return doAction;
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(protocol);
-
- // store protocol in context
- CLONE_PROTOCOL_ENTRY.setContextValue(getContext().getMainUI(), protocol);
- protocol = null;
-
- createProgressionModelIfRequired(4);
-
- // removed selected protocol
- getContext().setProtocolId(null);
-
- super.doAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/DeleteProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/DeleteProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/DeleteProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,97 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To delete the selected protocol.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class DeleteProtocolAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUI, SelectCruiseUIHandler> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(EditProtocolAction.class);
-
- public DeleteProtocolAction(SelectCruiseUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- TuttiProtocol protocol = getHandler().getModel().getProtocol();
-
- result &=
- askBeforeDelete(
- _("tutti.selectCruise.action.deleteProtocol.title"),
- _("tutti.selectCruise.action.deleteProtocol.message", protocol.getName())
- );
-
- return result;
- }
-
- @Override
- public void doAction() {
- TuttiProtocol protocol = getModel().getProtocol();
- Preconditions.checkNotNull(protocol);
- String id = protocol.getId();
- Preconditions.checkNotNull(id);
- if (log.isInfoEnabled()) {
- log.info("Delete protocol: " + id);
- }
-
- PersistenceService service = getContext().getPersistenceService();
- service.deleteProtocol(id);
-
- getModel().setProtocol(null);
-
- List<TuttiProtocol> protocols = getModel().getProtocols();
- protocols.remove(protocol);
-
- if (log.isInfoEnabled()) {
- log.info("nb protocols: " + protocols.size());
- }
- // reset (will clear combo-box)
- getModel().setProtocols(null);
-
- // set new list
- getModel().setProtocols(protocols);
-
- getHandler().resetEditProtolAction();
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,72 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.ValidationService;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Opens the operations edition screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class EditCatchesAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(EditCatchesAction.class);
-
- public EditCatchesAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_FISHING_OPERATION);
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkState(getContext().isProgramFilled());
- Preconditions.checkState(getContext().isCruiseFilled());
- if (log.isInfoEnabled()) {
- log.info("Edit operations of cruise: " + getContext().getCruiseId());
- }
- getContext().setValidationContext(ValidationService.VALIDATION_CONTEXT_EDIT);
- super.doAction();
- }
-
- @Override
- public void postFailedAction(Throwable error) {
-// TuttiUIContext context = getContext();
-// if (error != null) {
-// if (context.isDbLoaded()) {
-// context.setScreen(TuttiScreen.SELECT_CRUISE);
-// } else {
-// context.setScreen(TuttiScreen.MANAGE_DB);
-// }
-// }
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCruiseAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCruiseAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,50 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-
-/**
- * Opens the cruise edition screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class EditCruiseAction extends AbstractChangeScreenAction {
-
- public EditCruiseAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_CRUISE);
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkState(getContext().isProgramFilled());
- Preconditions.checkState(getContext().isCruiseFilled());
- super.doAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProgramAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProgramAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProgramAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,57 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Opens the program edition screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class EditProgramAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(EditProgramAction.class);
-
- public EditProgramAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_PROGRAM);
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkState(getContext().isProgramFilled());
- if (log.isInfoEnabled()) {
- log.info("Edit program: " + getContext().getProgramId());
- }
- super.doAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,155 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocols;
-import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import jaxx.runtime.context.JAXXContextEntryDef;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JOptionPane;
-import javax.swing.UIManager;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Opens the protocol edition screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class EditProtocolAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(EditProtocolAction.class);
-
- public static final JAXXContextEntryDef<TuttiProtocol> CLEAN_PROTOCOL_ENTRY = new JAXXContextEntryDef<TuttiProtocol>("cleanProtocol", TuttiProtocol.class);
-
- public EditProtocolAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_PROTOCOL);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- CLEAN_PROTOCOL_ENTRY.removeContextValue(getContext().getMainUI());
-
- boolean doAction = super.prepareAction();
- if (doAction) {
-
- // check that protocol is compatible with sample category model
- SampleCategoryModel sampleCategoryModel =
- getDataContext().getSampleCategoryModel();
-
- TuttiProtocol protocol = getDataContext().getProtocol();
-
- Set<Integer> badCategories = Sets.newHashSet();
-
- TuttiProtocols.checkSampleCategories(sampleCategoryModel,
- protocol,
- badCategories);
-
- if (!badCategories.isEmpty()) {
-
- // detect some bad categories
- if (log.isWarnEnabled()) {
- log.warn("There is some bad categories: " + badCategories);
- }
-
- String message = TuttiProtocols.getBadCategoriesMessage(
- badCategories,
- getDecorator(Caracteristic.class, null),
- getContext().getPersistenceService());
-
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- message,
- _("tutti.common.askBeforeEditProtocol.help"));
- int response = JOptionPane.showOptionDialog(
- getContext().getActionUI(),
- htmlMessage,
- _("tutti.common.askBeforeEditProtocol.title"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.WARNING_MESSAGE,
- UIManager.getIcon("warning"),
- new Object[]{_("tutti.option.cleanAndEdit"), _("tutti.option.edit"), _("tutti.option.cancel")},
- _("tutti.option.cancel")
- );
-
- switch (response) {
- case 0:
- // edit and clean
- if (log.isInfoEnabled()) {
- log.info("Clean and edit");
- }
-
- protocol = getContext().getPersistenceService().getProtocol(getContext().getProtocolId());
-
- CLEAN_PROTOCOL_ENTRY.setContextValue(getContext().getMainUI(), protocol);
-
- TuttiProtocols.removeBadCategories(sampleCategoryModel,
- protocol);
-
- break;
-
- case 1:
- // edit with no modification
- if (log.isInfoEnabled()) {
- log.info("Edit with no cleaning");
- }
- break;
-
- default:
-
- // cancel
- doAction = false;
- }
-
- }
- }
- return doAction;
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkState(getContext().isProtocolFilled());
- if (log.isInfoEnabled()) {
- log.info("Edit protocol: " + getContext().getProtocolId());
- }
- createProgressionModelIfRequired(4);
- super.doAction();
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,130 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.shared.application.ApplicationBusinessException;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.service.export.generic.TuttiExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To export a selected cruise.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class ExportCruiseAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUI, SelectCruiseUIHandler> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(ExportCruiseAction.class);
-
- protected File file;
-
- public ExportCruiseAction(SelectCruiseUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- Cruise cruise = getModel().getCruise();
-
- // choose file to export
- file = saveFile(
- "exportCruise-" + cruise.getName(),
- "zip",
- _("tutti.selectCruise.title.choose.exportCruiseFile"),
- _("tutti.selectCruise.action.chooseCruiseExportFile"),
- "^.+\\.zip$", _("tutti.common.file.zip")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Cruise cruise = getModel().getCruise();
- Preconditions.checkNotNull(cruise);
- Preconditions.checkNotNull(file);
-
- if (log.isInfoEnabled()) {
- log.info("Will save cruise " + cruise.getId() +
- " to file: " + file);
- }
-
- ProgressionModel progressionModel = new ProgressionModel();
- setProgressionModel(progressionModel);
- // (check cruise / export cruise / gear caracteristics / operation / parameter / accidental catches / catches / individual observation / species) / zip
- progressionModel.setTotal(10);
-
-// TuttiProtocol protocol = null;
-// if (getContext().isProtocolFilled()) {
-// protocol = getDataContext().getProtocol();
-// if (log.isInfoEnabled()) {
-// log.info("Will use protocol " + protocol.getName());
-// }
-// }
-
- ApplicationBusinessException exportError = null;
-
- TuttiExportService service = getContext().getTuttiExportService();
- try {
- service.exportCruise(cruise.getId(), file, progressionModel);
- } catch (ApplicationBusinessException e) {
-
- String errorMessage;
- errorMessage = _("tutti.exportCruise.action.exportErrors", cruise.getName(), e.getMessage());
- exportError = new ApplicationBusinessException(errorMessage);
- }
-
- sendMessage(_("tutti.exportCruise.action.success",
- cruise.getName(), file.getName()));
-
- handler.resetEditCruiseAction();
-
- if (exportError != null) {
- throw exportError;
- }
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseForSumatraAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseForSumatraAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseForSumatraAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,109 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportService;
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.DateUtil;
-
-import java.io.File;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Opens a file chooser, exports the cruise catches into the selected file and open the default email editor.
- *
- * @author kmorin <morin(a)codelutin.com>
- * @since 1.0
- */
-public class ExportCruiseForSumatraAction extends AbstractMainUITuttiAction {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportCruiseForSumatraAction.class);
-
- protected File file;
-
- public ExportCruiseForSumatraAction(MainUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- String date = DateUtil.formatDate(new Date(), "dd-MM-yyyy");
- // choose file to export
- file = saveFile(
- String.format("sumatra_%s_%s", getDataContext().getCruise().getName(), date),
- "csv",
- _("tutti.exportCruiseForSumatra.title.choose.exportFile"),
- _("tutti.exportCruiseForSumatra.action.chooseFile"),
- "^.+\\.csv$", _("tutti.common.file.csv")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Cruise cruise = getDataContext().getCruise();
- Preconditions.checkNotNull(cruise);
- Preconditions.checkNotNull(file);
-
- if (log.isInfoEnabled()) {
- log.info("Will export cruise " + cruise.getId() +
- " to file: " + file);
- }
-
- // export catches
- CatchesSumatraExportService service =
- getContext().getCatchesSumatraExportService();
- service.exportCruiseForSumatra(file, cruise.getId());
-
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.exportCruiseForSumatra.action.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,133 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.shared.application.ApplicationBusinessException;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.service.export.generic.TuttiExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To export a selected program.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
-public class ExportProgramAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUI, SelectCruiseUIHandler> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(ExportProgramAction.class);
-
- protected File file;
-
- public ExportProgramAction(SelectCruiseUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- Program program = getModel().getProgram();
- if (doAction) {
-
- // choose file to export
- file = saveFile(
- "exportProgram-" + program.getName(), "zip",
- _("tutti.selectCruise.title.choose.exportProgramFile"),
- _("tutti.selectCruise.action.chooseProgramExportFile"),
- "^.+\\.zip$", _("tutti.common.file.zip")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Program program = getModel().getProgram();
- Preconditions.checkNotNull(program);
- Preconditions.checkNotNull(file);
-
- if (log.isInfoEnabled()) {
- log.info("Will save program " + program.getId() +
- " to file: " + file);
- }
-
- // nbCruise * (check cruise / export cruise / gear caracteristics / operation / parameter / catches / individual observation / accidental catches / species) + zip
- List<Cruise> allCruise =
- getContext().getPersistenceService().getAllCruise(program.getId());
-
- ProgressionModel progressionModel = new ProgressionModel();
- setProgressionModel(progressionModel);
- progressionModel.setTotal(9 * allCruise.size() + 1);
-
-// TuttiProtocol protocol = null;
-// if (getContext().isProtocolFilled()) {
-// protocol = getDataContext().getProtocol();
-// if (log.isInfoEnabled()) {
-// log.info("Will use protocol " + protocol.getName());
-// }
-// }
- ApplicationBusinessException exportError = null;
-
- TuttiExportService service = getContext().getTuttiExportService();
- try {
- service.exportProgram(program.getId(), file, progressionModel);
- } catch (ApplicationBusinessException e) {
-
- String errorMessage;
- errorMessage = _("tutti.exportProgram.action.exportErrors", program.getName(), e.getMessage());
-
- exportError = new ApplicationBusinessException(errorMessage);
- }
-
- handler.resetEditProgramAction();
-
- sendMessage(_("tutti.exportProgram.action.success", program.getName(),
- file.getName()));
-
- if (exportError != null) {
- throw exportError;
- }
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,108 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Opens a file chooser and exports the protocol into the selected file.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ExportProtocolAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUI, SelectCruiseUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportProtocolAction.class);
-
- protected File file;
-
- public ExportProtocolAction(SelectCruiseUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- TuttiProtocol protocol = getModel().getProtocol();
- // choose file to export
- file = saveFile(
- "protocol-" + protocol.getName().replaceAll(" ", "_") ,
- "tuttiProtocol",
- _("tutti.selectCruise.title.choose.exportFile"),
- _("tutti.selectCruise.action.exportProtocol"),
- "^.+\\.tuttiProtocol$", _("tutti.common.file.protocol")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- TuttiProtocol protocol = getModel().getProtocol();
- Preconditions.checkNotNull(protocol);
- Preconditions.checkNotNull(file);
-
- if (log.isInfoEnabled()) {
- log.info("Will save protocol " + protocol.getId() +
- " to file: " + file);
- }
-
- // export protocol
- ProtocolImportExportService service =
- getContext().getTuttiProtocolImportExportService();
- service.exportProtocol(protocol, file);
-
- getHandler().resetEditProtolAction();
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- TuttiProtocol protocol = getModel().getProtocol();
- sendMessage(_("tutti.exportProtocol.action.success", protocol.getName(), file.getName()));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,181 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocols;
-import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import jaxx.runtime.context.JAXXContextEntryDef;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JOptionPane;
-import javax.swing.UIManager;
-import java.io.File;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Opens a file chooser and imports the protocol from the selected file.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ImportProtocolAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ImportProtocolAction.class);
-
- public static final JAXXContextEntryDef<TuttiProtocol> IMPORT_PROTOCOL_ENTRY = new JAXXContextEntryDef<TuttiProtocol>("importProtocol", TuttiProtocol.class);
-
- protected TuttiProtocol protocol;
-
- public ImportProtocolAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_PROTOCOL);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- IMPORT_PROTOCOL_ENTRY.removeContextValue(getContext().getMainUI());
-
- boolean doAction = super.prepareAction();
-
- File file = null;
-
- if (doAction) {
- // choose file to import
- file = chooseFile(
- _("tutti.selectCruise.title.choose.importFile"),
- _("tutti.selectCruise.action.importProtocol"),
- "^.+\\.tuttiProtocol$", _("tutti.common.file.protocol")
- );
-
- doAction = file != null;
- }
-
- if (doAction) {
-
- // import protocol
- if (log.isInfoEnabled()) {
- log.info("Will import protocol file: " + file);
- }
-
- ProtocolImportExportService service =
- getContext().getTuttiProtocolImportExportService();
-
- protocol = service.importProtocol(file);
-
- // remove id
- protocol.setId((String) null);
-
- sendMessage(_("tutti.importProtocol.action.success", protocol.getName()));
-
- // check that protocol is compatible with sample category model
- SampleCategoryModel sampleCategoryModel =
- getDataContext().getSampleCategoryModel();
-
- Set<Integer> badCategories = Sets.newHashSet();
-
- TuttiProtocols.checkSampleCategories(sampleCategoryModel,
- protocol,
- badCategories);
-
- if (!badCategories.isEmpty()) {
-
- // detect some bad categories
- if (log.isWarnEnabled()) {
- log.warn("There is some bad categories: " + badCategories);
- }
-
- String message = TuttiProtocols.getBadCategoriesMessage(
- badCategories,
- getDecorator(Caracteristic.class, null),
- getContext().getPersistenceService());
-
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- message,
- _("tutti.common.askBeforeImportProtocol.help"));
- int response = JOptionPane.showOptionDialog(
- getContext().getActionUI(),
- htmlMessage,
- _("tutti.common.askBeforeEditProtocol.title"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.WARNING_MESSAGE,
- UIManager.getIcon("warning"),
- new Object[]{_("tutti.option.cleanAndImport"), _("tutti.option.import"), _("tutti.option.cancel")},
- _("tutti.option.cancel")
- );
-
- switch (response) {
- case 0:
- // clean and import
- if (log.isInfoEnabled()) {
- log.info("Clean and Import");
- }
- TuttiProtocols.removeBadCategories(sampleCategoryModel,
- protocol);
- break;
- case 1:
- // import with no clean
- if (log.isInfoEnabled()) {
- log.info("Import with no cleaning");
- }
- break;
- default:
-
- // cancel
- doAction = false;
- }
- }
- }
- return doAction;
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(protocol);
-
- // store protocol in context
- IMPORT_PROTOCOL_ENTRY.setContextValue(getContext().getMainUI(), protocol);
- protocol = null;
- createProgressionModelIfRequired(4);
-
- // removed selected protocol
- getContext().setProtocolId(null);
- super.doAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewCruiseAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewCruiseAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewCruiseAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,48 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-
-/**
- * Opens the cruise creation screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class NewCruiseAction extends AbstractChangeScreenAction {
-
- public NewCruiseAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_CRUISE);
- }
-
- @Override
- public void doAction() throws Exception {
- getContext().setCruiseId(null);
- super.doAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProgramAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProgramAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProgramAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,49 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-
-/**
- * Opens the program creation screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class NewProgramAction extends AbstractChangeScreenAction {
-
- public NewProgramAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_PROGRAM);
- }
-
- @Override
- public void doAction() throws Exception {
- getContext().setProgramId(null);
- getContext().setCruiseId(null);
- super.doAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,49 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-
-/**
- * Opens the protocol creation screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class NewProtocolAction extends AbstractChangeScreenAction {
-
- public NewProtocolAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.EDIT_PROTOCOL);
- }
-
- @Override
- public void doAction() throws Exception {
- getContext().setProtocolId(null);
- createProgressionModelIfRequired(4);
- super.doAction();
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -65,7 +65,7 @@
#editProgramButton {
actionIcon: edit;
text: "tutti.selectCruise.action.editProgram";
- _applicationAction: {EditProgramAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.EditProgramAction.class};
toolTipText: "tutti.selectCruise.action.editProgram.tip";
_help: {"tutti.selectCruise.action.editProgram.help"};
}
@@ -74,7 +74,7 @@
actionIcon: export;
text: "tutti.selectCruise.action.exportProgram";
enabled: false;
- _applicationAction: {ExportProgramAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportProgramAction.class};
toolTipText: "tutti.selectCruise.action.exportProgram.tip";
_help: {"tutti.selectCruise.action.exportProgram.help"};
}
@@ -82,7 +82,7 @@
#newProgramButton {
actionIcon: add;
text: "tutti.selectCruise.action.newProgram";
- _applicationAction: {NewProgramAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.NewProgramAction.class};
toolTipText: "tutti.selectCruise.action.newProgram.tip";
_help: {"tutti.selectCruise.action.newProgram.help"};
}
@@ -111,7 +111,7 @@
#editCruiseButton {
actionIcon: edit;
text: "tutti.selectCruise.action.editCruise";
- _applicationAction: {EditCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.EditCruiseAction.class};
toolTipText: "tutti.selectCruise.action.editCruise.tip";
_help: {"tutti.selectCruise.action.editCruise.help"};
}
@@ -120,7 +120,7 @@
actionIcon: export;
text: "tutti.selectCruise.action.exportCruise";
enabled: false;
- _applicationAction: {ExportCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportCruiseAction.class};
toolTipText: "tutti.selectCruise.action.exportCruise.tip";
_help: {"tutti.selectCruise.action.exportCruise.help"};
}
@@ -129,7 +129,7 @@
actionIcon: email;
text: "tutti.selectCruise.action.sendCruiseReport";
toolTipText: "tutti.selectCruise.action.sendCruiseReport.tip";
- _applicationAction: {SendCruiseReportAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SendCruiseReportAction.class};
_help: {"tutti.selectCruise.action.sendCruiseReport.help"};
}
@@ -137,7 +137,7 @@
actionIcon: export;
text: "tutti.selectCruise.action.exportCruiseForSumatra";
toolTipText: "tutti.selectCruise.action.exportCruiseForSumatra.tip";
- _applicationAction: {ExportCruiseForSumatraAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportCruiseForSumatraAction.class};
_help: {"tutti.selectCruise.action.exportCruiseForSumatra.help"};
}
@@ -145,7 +145,7 @@
actionIcon: add;
text: "tutti.selectCruise.action.newCruise";
enabled: {model.isProgramFound()};
- _applicationAction: {NewCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.NewCruiseAction.class};
toolTipText: "tutti.selectCruise.action.newCruise.tip";
_help: {"tutti.selectCruise.action.newCruise.help"};
}
@@ -179,7 +179,7 @@
#newProtocolButton {
actionIcon: add;
text: "tutti.selectCruise.action.newProtocol";
- _applicationAction: {NewProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.NewProtocolAction.class};
toolTipText: "tutti.selectCruise.action.newProtocol.tip";
_help: {"tutti.selectCruise.action.newProtocol.help"};
}
@@ -187,7 +187,7 @@
#importProtocolButton {
actionIcon: import;
text: "tutti.selectCruise.action.importProtocol";
- _applicationAction: {ImportProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportProtocolAction.class};
toolTipText: "tutti.selectCruise.action.importProtocol.tip";
_help: {"tutti.selectCruise.action.importProtocol.help"};
}
@@ -195,7 +195,7 @@
#editProtocolButton {
actionIcon: edit;
text: "tutti.selectCruise.action.editProtocol";
- _applicationAction: {EditProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.EditProtocolAction.class};
toolTipText: "tutti.selectCruise.action.editProtocol.tip";
_help: {"tutti.selectCruise.action.editProtocol.help"};
}
@@ -203,7 +203,7 @@
#cloneProtocolButton {
actionIcon: copy;
text: "tutti.selectCruise.action.cloneProtocol";
- _applicationAction: {CloneProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.CloneProtocolAction.class};
toolTipText: "tutti.selectCruise.action.cloneProtocol.tip";
_help: {"tutti.selectCruise.action.cloneProtocol.help"};
}
@@ -211,7 +211,7 @@
#exportProtocolButton {
actionIcon: export;
text: "tutti.selectCruise.action.exportProtocol";
- _applicationAction: {ExportProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportProtocolAction.class};
toolTipText: "tutti.selectCruise.action.exportProtocol.tip";
_help: {"tutti.selectCruise.action.exportProtocol.help"};
}
@@ -219,7 +219,7 @@
#deleteProtocolButton {
actionIcon: delete;
text: "tutti.selectCruise.action.deleteProtocol";
- _applicationAction: {DeleteProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.DeleteProtocolAction.class};
toolTipText: "tutti.selectCruise.action.deleteProtocol.tip";
_help: {"tutti.selectCruise.action.deleteProtocol.help"};
}
@@ -228,7 +228,7 @@
actionIcon: edit;
text: "tutti.selectCruise.action.editCatches";
i18nMnemonic: "tutti.selectCruise.action.editCatches.mnemonic";
- _applicationAction: {EditCatchesAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.EditCatchesAction.class};
enabled: {model.isValid() && uiContext.isCruiseFilled()};
toolTipText: "tutti.selectCruise.action.editCatches.tip";
_help: {"tutti.selectCruise.action.editCatches.help"};
@@ -239,7 +239,7 @@
text: "tutti.selectCruise.action.validateCatches";
toolTipText: "tutti.selectCruise.action.validateCatches.tip";
i18nMnemonic: "tutti.selectCruise.action.validateCatches.mnemonic";
- _applicationAction: {ValidateCatchesAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ValidateCatchesAction.class};
enabled: {model.isValid() && uiContext.isCruiseFilled()};
_help: {"tutti.selectCruise.action.validateCatches.help"};
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2013-11-26 08:03:42 UTC (rev 1388)
@@ -32,7 +32,7 @@
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.util.TuttiUI
- fr.ifremer.tutti.ui.swing.util.ActionListCellRenderer
+ fr.ifremer.shared.application.swing.util.ActionListCellRenderer
jaxx.runtime.swing.editor.bean.BeanFilterableComboBox
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,122 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.shared.application.ApplicationTechnicalException;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.service.export.pdf.CatchesPdfExportService;
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JOptionPane;
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Opens a file chooser, exports the cruise catches into the selected file and open the default email editor.
- *
- * @author kmorin <morin(a)codelutin.com>
- * @since 1.0
- */
-public class SendCruiseReportAction extends AbstractMainUITuttiAction {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(SendCruiseReportAction.class);
-
- protected File file;
-
- public SendCruiseReportAction(MainUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- Cruise cruise = getDataContext().getCruise();
- // choose file to export
- file = saveFile(
- "exportCruise-" + cruise.getName(),
- "pdf",
- _("tutti.sendCruiseReport.title.choose.exportFile"),
- _("tutti.sendCruiseReport.action.chooseFile"),
- "^.+\\.pdf$", _("tutti.common.file.pdf")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Cruise cruise = getDataContext().getCruise();
- Preconditions.checkNotNull(cruise);
- Preconditions.checkNotNull(file);
-
- if (log.isInfoEnabled()) {
- log.info("Will export cruise " + cruise.getId() +
- " to file: " + file);
- }
-
- // export catches
- CatchesPdfExportService service =
- getContext().getGeneratePDFService();
- service.generateCruisePDFFile(file, cruise.getId(), getConfig().getI18nLocale());
-
- try {
-
- TuttiUIUtil.mail(_("tutti.sendCruiseReport.mail.subject", cruise.getName()),
- _("tutti.sendCruiseReport.mail.body", cruise.getName(), file.getAbsolutePath()));
-
- } catch (ApplicationTechnicalException e) {
- JOptionPane.showMessageDialog(getContext().getMainUI(),
- _("tutti.sendCruiseReport.action.error.mail.message", file),
- _("tutti.sendCruiseReport.action.error.mail.title"),
- JOptionPane.WARNING_MESSAGE);
- }
-
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.sendCruiseReport.action.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ValidateCatchesAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ValidateCatchesAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ValidateCatchesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,61 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.home;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.ValidationService;
-import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Opens the operations validation screen.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ValidateCatchesAction extends AbstractChangeScreenAction {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ValidateCatchesAction.class);
-
- public ValidateCatchesAction(MainUIHandler handler) {
- super(handler, true, TuttiScreen.VALIDATE_CRUISE);
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkState(getContext().isProgramFilled());
- Preconditions.checkState(getContext().isCruiseFilled());
- getContext().setValidationContext(ValidationService.VALIDATION_CONTEXT_VALIDATE);
- if (log.isInfoEnabled()) {
- log.info("Validate operations of cruise: " + getContext().getCruiseId());
- }
- super.doAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/CancelEditFishingOperationAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/CancelEditFishingOperationAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/CancelEditFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,107 +0,0 @@
-
-package fr.ifremer.tutti.ui.swing.content.operation;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Cancels the edition of a fishing operation and potentially switch to another tab.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0
- */
-public class CancelEditFishingOperationAction extends AbstractTuttiAction<EditFishingOperationUIModel, EditFishingOperationUI, EditFishingOperationUIHandler> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(SaveFishingOperationAction.class);
-
- /**
- * Delegate edit action.
- *
- * @since 1.0
- */
- protected EditFishingOperationAction editAction;
-
- public CancelEditFishingOperationAction(EditFishingOperationUIHandler handler) {
- super(handler, true);
- }
-
- public EditFishingOperationAction getEditAction() {
- if (editAction == null) {
- editAction = getContext().getActionFactory().createLogicAction(
- getHandler().getParentUi().getHandler(),
- EditFishingOperationAction.class);
- }
- return editAction;
- }
-
- @Override
- public void doAction() throws Exception {
-
- EditFishingOperationAction action = getEditAction();
-
- if (getModel().isCreate()) {
- if (log.isInfoEnabled()) {
- log.info("Cancel creation for fishingOperation");
- }
- // cancel to create a new fishingOperation
- action.setFishingOperation(null);
- getActionEngine().runInternalAction(action);
-
- } else {
-
- if (log.isInfoEnabled()) {
- log.info("Can edition of fishingOperation");
- }
-
- // re-edit current fishing operation (but do not perform any check)
- action.setCheckPreviousEdit(false);
- action.setFishingOperation(getModel().getFishingOperation());
- action.setInternalAction(true);
- getActionEngine().runInternalAction(action);
- }
-
- //FIXME-TC Make sure this works again
-// // if called directly from the EditFishingOperationUIHandler:
-// // the user does not want to save the modifications before
-// // selecting another tab, we must reload the current tab before setting
-// // the new index of the tab pane
-// if (event.getSource() != null
-// && event.getSource().getClass().isAssignableFrom(EditFishingOperationUIHandler.class)) {
-//
-// int newIndex = event.getID();
-// parentHandler.getTabPanel().setSelectedIndex(newIndex);
-// }
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- getEditAction().displayValidationErrors();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/DeleteFishingOperationAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/DeleteFishingOperationAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/DeleteFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,88 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To delete a fishing operation.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.2
- */
-public class DeleteFishingOperationAction extends AbstractTuttiAction<FishingOperationsUIModel, FishingOperationsUI, FishingOperationsUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(DeleteFishingOperationAction.class);
-
- public DeleteFishingOperationAction(FishingOperationsUIHandler handler) {
- super(handler, true);
- setActionDescription(
- _("tutti.editFishingOperation.action.deleteFishingOperation.tip"));
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean canContinue = super.prepareAction();
- FishingOperation fishingOperation = getModel().getSelectedFishingOperation();
- canContinue &= fishingOperation != null &&
- !TuttiEntities.isNew(fishingOperation) &&
- askBeforeDelete(
- _("tutti.editFishingOperation.action.deleteFishingOperation.title"),
- _("tutti.editFishingOperation.action.deleteFishingOperation.message", decorate(fishingOperation))
- );
- return canContinue;
- }
-
- @Override
- public void doAction() throws Exception {
-
- FishingOperation fishingOperation =
- getModel().getSelectedFishingOperation();
-
- if (log.isInfoEnabled()) {
- log.info("Will delete fishingOperation: " + fishingOperation);
- }
-
- getContext().getPersistenceService().deleteFishingOperation(fishingOperation.getId());
-
- FishingOperationsUIModel model = getModel();
-
- // unselect removed fishing operation
- model.setSelectedFishingOperation(null);
-
- // remove it from selection model
- model.removeFishingOperation(fishingOperation);
-
- sendMessage(_("tutti.editFishingOperation.message.operation.deleted", decorate(fishingOperation)));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,782 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.InvalidBatchModelException;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
-import fr.ifremer.tutti.persistence.entities.data.CatchBatchs;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperations;
-import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrders;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
-import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.ComputeBatchWeightsAction;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.SaveCatchBatchAction;
-import fr.ifremer.tutti.ui.swing.content.operation.fishing.GearUseFeatureTabUI;
-import fr.ifremer.tutti.ui.swing.content.operation.fishing.VesselUseFeatureTabUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JTabbedPane;
-import java.awt.BorderLayout;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To edit the given fishing operation.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class EditFishingOperationAction extends AbstractTuttiAction<FishingOperationsUIModel, FishingOperationsUI, FishingOperationsUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(EditFishingOperationAction.class);
-
- /**
- * The incoming fishing operation to edit.
- * <p/>
- * Can be null (means do not edit any fishing operation), or with no id
- * (means create a ne fishing operation), or with an id (means edit an
- * existing fishing operation).
- *
- * @since 1.0
- */
- protected FishingOperation fishingOperation;
-
- /**
- * A flag to not check if there is a previous edit.
- * <p/>
- * This flag is used when we launch the cancel action.
- *
- * @since 1.0
- */
- protected boolean checkPreviousEdit = true;
-
- /**
- * Delegate action to save Fising Operation.
- *
- * @since 1.0
- */
- protected SaveFishingOperationAction saveFishingOperationAction;
-
- /**
- * Delegate action to compute the weight of the operations.
- *
- * @since 1.1
- */
- protected ComputeBatchWeightsAction computeBatchWeightsAction;
-
- /**
- * Delegate action to save catch batch.
- *
- * @since 1.0
- */
- protected SaveCatchBatchAction saveCatchBatchAction;
-
- /**
- * To keep catch validation error while loading batches.
- *
- * @since 2.4
- */
- protected List<String> errorMessages = Lists.newArrayList();
-
- /**
- * Flag to know if this action is part of another action.
- *
- * @since 2.4
- */
- protected boolean internalAction;
-
- /**
- * To recompute distance when coordinate change.
- *
- * @since 2.4
- */
- private final PropertyChangeListener coordinatePropertiesListener = new PropertyChangeListener() {
-
- private List<String> properties = Lists.newArrayList(
- EditFishingOperationUIModel.PROPERTY_FISHING_OPERATION_RECTILIGNE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMS_SIGN,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMS_DEGREE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMS_MINUTE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMS_SECOND,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMD_SIGN,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMD_DEGREE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LATITUDE_DMD_MINUTE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMS_SIGN,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMS_DEGREE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMS_MINUTE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMS_SECOND,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMD_SIGN,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMD_DEGREE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DMD_MINUTE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMS_SIGN,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMS_DEGREE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMS_MINUTE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMS_SECOND,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMD_SIGN,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMD_DEGREE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LATITUDE_DMD_MINUTE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMS_SIGN,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMS_DEGREE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMS_MINUTE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMS_SECOND,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMD_SIGN,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMD_DEGREE,
- EditFishingOperationUIModel.PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DMD_MINUTE
- );
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (properties.contains(evt.getPropertyName())) {
- EditFishingOperationUIModel source = (EditFishingOperationUIModel) evt.getSource();
- if (source.isFishingOperationRectiligne()) {
- source.computeDistance();
- }
- }
- }
- };
-
- public EditFishingOperationAction(FishingOperationsUIHandler handler) {
- super(handler, true);
- setActionDescription(_("tutti.editFishingOperation.action.editFishingOperation.tip"));
- }
-
- public void setFishingOperation(FishingOperation fishingOperation) {
- this.fishingOperation = fishingOperation;
- getDataContext().setFishingOperationId(fishingOperation != null ? fishingOperation.getId() : null);
- }
-
- public void setCheckPreviousEdit(boolean checkPreviousEdit) {
- this.checkPreviousEdit = checkPreviousEdit;
- }
-
- @Override
- public void releaseAction() {
- fishingOperation = null;
- checkPreviousEdit = true;
- internalAction = false;
- super.releaseAction();
- }
-
- protected SaveFishingOperationAction getSaveFishingOperationAction() {
- if (saveFishingOperationAction == null) {
- saveFishingOperationAction = new SaveFishingOperationAction(getUI().getFishingOperationTabContent().getHandler());
- }
- return saveFishingOperationAction;
- }
-
- protected SaveCatchBatchAction getSaveCatchBatchAction() {
- if (saveCatchBatchAction == null) {
- saveCatchBatchAction = new SaveCatchBatchAction(getUI().getCatchesTabContent().getHandler());
- }
- return saveCatchBatchAction;
- }
-
- protected ComputeBatchWeightsAction getComputeBatchWeightsAction() {
- if (computeBatchWeightsAction == null) {
- computeBatchWeightsAction = new ComputeBatchWeightsAction(getUI().getCatchesTabContent().getHandler());
- }
- return computeBatchWeightsAction;
- }
-
- @Override
- public boolean prepareAction() {
-
- boolean canContinue = true;
- if (checkPreviousEdit) {
- FishingOperationsUI ui = getUI();
-
- final FishingOperationsUIModel model = ui.getModel();
-
- FishingOperation editFishingOperation = model.getEditFishingOperation();
-
- String editFishingOperationId = null;
-
- if (editFishingOperation == null) {
-
- // no previous fishing operation in edition, can continue
- canContinue = true;
- } else {
-
- editFishingOperationId = editFishingOperation.getId();
-
- boolean create = TuttiEntities.isNew(editFishingOperation);
-
- boolean fishingOperationModified = getHandler().isFishingOperationModified();
- boolean catchBatchModified = getHandler().isCatchBatchModified();
-
- boolean fishingOperationValid = getHandler().isFishingOperationValid();
- boolean catchBatchValid = getHandler().isCatchBatchValid();
-
- boolean needSave = create || fishingOperationModified || catchBatchModified;
-
-
- if (needSave) {
-
- boolean canSave = fishingOperationValid && catchBatchValid;
-
- canContinue = false;
-
- if (canSave) {
-
- String message;
-
- if (create) {
- message = _("tutti.editFishingOperation.askSaveBeforeLeaving.createFishingOperation");
- } else if (fishingOperationModified) {
- message = _("tutti.editFishingOperation.askSaveBeforeLeaving.saveFishingOperation");
- } else {
- message = _("tutti.editCatchBatch.askSaveBeforeLeaving.saveCatchBatch");
- }
-
- int answer = getHandler().askSaveBeforeLeaving(message);
-
-
- switch (answer) {
- case JOptionPane.OK_OPTION:
-
- // persist previous fishing operation
- if (fishingOperationModified) {
- getSaveFishingOperationAction().setUpdateUI(false);
- getActionEngine().runInternalAction(getSaveFishingOperationAction());
- }
-
- if (catchBatchModified) {
- getSaveCatchBatchAction().setUpdateUI(false);
- getActionEngine().runInternalAction(getSaveCatchBatchAction());
- }
-
- canContinue = true;
- break;
-
- case JOptionPane.NO_OPTION:
-
- // won't save modification
- // so since we will edit a new operation, nothing to do here
-
- canContinue = true;
- break;
- }
- } else {
-
- // data are not valid
- String message;
-
- if (fishingOperationValid) {
- message = _("tutti.editCatchBatch.askCancelEditBeforeLeaving.cancelEditCatchBatch");
- } else {
- message = _("tutti.editFishingOperation.askCancelEditBeforeLeaving.cancelEditFishingOperation");
- }
-
- // ok will revert any modification by
- // editing new fishing operation (if user says yes)
- canContinue = handler.askCancelEditBeforeLeaving(message);
- }
- }
- }
-
- if (!canContinue) {
-
- FishingOperation selectFishingOperation;
- if (TuttiEntities.isNew(editFishingOperation)) {
-
- // no selection
- selectFishingOperation = null;
- } else {
- // rollback selected fishing operation
- selectFishingOperation =
- model.getFishingOperation(editFishingOperationId);
- }
-
- model.setEditionAdjusting(true);
- try {
- model.setSelectedFishingOperation(selectFishingOperation);
- } finally {
- model.setEditionAdjusting(false);
- }
- }
- }
-
- return canContinue;
- }
-
- @Override
- public void doAction() throws Exception {
-
- errorMessages.clear();
-
- FishingOperationsUI ui = getUI();
-
- FishingOperationsUIModel model = ui.getModel();
-
- // edit new fishing operation
- if (log.isDebugEnabled()) {
- log.debug("Edit fishingOperation: " + fishingOperation);
- }
-
- // now fishing operation is edited
- model.setEditFishingOperation(fishingOperation);
-
- loadFishingOperation(fishingOperation);
-
- loadCatchBatch(fishingOperation);
-
- JTabbedPane form = ui.getTabPane();
- JLabel noContentPane = ui.getNoTraitPane();
-
- if (fishingOperation == null) {
-
- // nothing to display
-
- ui.remove(form);
-
- // just display <no trait!>
- ui.add(noContentPane, BorderLayout.CENTER);
-
- } else {
-
- ui.remove(noContentPane);
-
- // wait last minute to display (avoid dirty display effects)
- ui.add(form, BorderLayout.CENTER);
-
- ui.getFishingOperationTabContent().getFishingOperationTabPane().setSelectedIndex(0);
-
- if (checkPreviousEdit) {
- ui.getTabPane().setSelectedIndex(0);
- }
- }
-
- model.addPropertyChangeListener(coordinatePropertiesListener);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- getUI().getFishingOperationTabContent().getModel().setModify(false);
- getUI().repaint();
-
- if (!internalAction) {
- displayValidationErrors();
- }
- }
-
- public void displayValidationErrors() {
- if (CollectionUtils.isNotEmpty(errorMessages)) {
- for (String errorMessage : errorMessages) {
- getContext().getErrorHelper().showErrorDialog(errorMessage, null);
- }
- }
- }
-
- public void loadFishingOperation(FishingOperation bean) {
-
- EditFishingOperationUI ui = getUI().getFishingOperationTabContent();
-
- EditFishingOperationUIHandler handler = ui.getHandler();
-
- EditFishingOperationUIModel editFishingOperationUIModel = ui.getModel();
-
- editFishingOperationUIModel.setLoadingData(true);
-
- editFishingOperationUIModel.removeAllAttachment(editFishingOperationUIModel.getAttachment());
-
- handler.uninstallStartDateListener();
- handler.uninstallCoordinatesListener();
-
- if (bean == null) {
-
- editFishingOperationUIModel.fromBean(
- FishingOperations.newFishingOperation());
-
- editFishingOperationUIModel.setFishingOperation(bean);
-
- editFishingOperationUIModel.setAllSecondaryVessel(null);
- editFishingOperationUIModel.setFishingSecondaryVessel(null);
- editFishingOperationUIModel.setScientificSecondaryVessel(null);
- editFishingOperationUIModel.setOnlyCruisSecondaryVessel(null);
- editFishingOperationUIModel.setSecondaryVesselType(null);
-
- handler.clearValidators();
-
- handler.resetAllModels();
-
- } else { //if (!bean.equals(editFishingOperationUIModel.getFishingOperation()) || handler.isAModelModified()) {
-
- TuttiLocation strata = bean.getStrata();
- TuttiLocation subStrata = bean.getSubStrata();
- TuttiLocation location = bean.getLocation();
-
- PersistenceService persistenceService = getContext().getPersistenceService();
-
- Cruise cruise = bean.getCruise();
- if (cruise != null) {
-
- // update gear universe
- // add a equals on id + rankOrder
- List<Gear> gears = Lists.newArrayList();
- for (Gear gear : cruise.getGear()) {
- CaracteristicMap caracteristics =
- persistenceService.getGearCaracteristics(
- cruise.getId(),
- gear.getId(),
- gear.getRankOrder());
-
- Gear toKeep = GearWithOriginalRankOrders.newGearWithOriginalRankOrder(gear);
- toKeep.setCaracteristics(caracteristics);
-
- gears.add(toKeep);
- }
- ui.getGearComboBox().setData(gears);
- }
-
- editFishingOperationUIModel.fromBean(bean);
-
- // to be sure combo list will be reloaded
- editFishingOperationUIModel.setStrata(null);
- editFishingOperationUIModel.setSubStrata(null);
- editFishingOperationUIModel.setLocation(null);
-
- editFishingOperationUIModel.convertGearShootingCoordinatesFromDD();
-
- if (strata != null) {
- ui.getStrataComboBox().setSelectedItem(strata);
- }
-
- if (subStrata != null) {
- ui.getSubStrataComboBox().setSelectedItem(subStrata);
- }
-
- if (location != null) {
- ui.getLocationComboBox().setSelectedItem(location);
- }
-
- editFishingOperationUIModel.setFishingOperation(bean);
-
- // update saisisseur selection
- List<Person> saisisseur = editFishingOperationUIModel.getRecorderPerson();
- ui.getRecorderPersonList().getHandler().setSelected(saisisseur);
-
- //reset gear use feature tab
- GearUseFeatureTabUI gearUseFeatureTabContent = ui.getGearUseFeatureTabContent();
- gearUseFeatureTabContent.getHandler().reset(bean);
-
- //reset vessel use feature tab
- VesselUseFeatureTabUI vesselUseFeatureTabContent = ui.getVesselUseFeatureTabContent();
- vesselUseFeatureTabContent.getHandler().reset(bean);
-
- Integer objectId = editFishingOperationUIModel.getObjectId();
- if (objectId != null) {
-
- List<Attachment> attachments =
- persistenceService.getAllAttachments(
- editFishingOperationUIModel.getObjectType(),
- objectId);
-
- editFishingOperationUIModel.addAllAttachment(attachments);
- }
-
- Vessel cruiseVessel = getDataContext().getCruise().getVessel();
- List<Vessel> scientificVessels = getDataContext().getScientificVessels();
- List<Vessel> fishingVessels = getDataContext().getFishingVessels();
-
- { // update all secondary vessel universe
- List<Vessel> vessels = Lists.newArrayList();
- vessels.addAll(scientificVessels);
- vessels.addAll(fishingVessels);
- vessels.remove(cruiseVessel);
- editFishingOperationUIModel.setAllSecondaryVessel(vessels);
- }
-
- { // update scientific secondary vessel universe
- List<Vessel> vessels = Lists.newArrayList();
- vessels.addAll(scientificVessels);
- vessels.remove(cruiseVessel);
- editFishingOperationUIModel.setScientificSecondaryVessel(vessels);
- }
-
- { // update fishing secondary vessel universe
- List<Vessel> vessels = Lists.newArrayList();
- vessels.addAll(fishingVessels);
- vessels.remove(cruiseVessel);
- editFishingOperationUIModel.setFishingSecondaryVessel(vessels);
- }
-
- { // update only cruise vessel universe
-
- List<FishingOperation> fishingOperation =
- getModel().getFishingOperation();
-
- Set<Vessel> vesselSet = Sets.newHashSet();
- for (FishingOperation operation : fishingOperation) {
- List<Vessel> secondaryVessel = persistenceService.getFishingOperationSecondaryVessel(operation.getId());
- if (CollectionUtils.isNotEmpty(secondaryVessel)) {
- vesselSet.addAll(secondaryVessel);
- }
- }
- List<Vessel> vessel = Lists.newArrayList(vesselSet);
- editFishingOperationUIModel.setOnlyCruisSecondaryVessel(vessel);
- }
-
- // will propagate to model
- ui.getSecondaryVesselList().getModel().setSelected(bean.getSecondaryVessel());
-
- editFishingOperationUIModel.setSecondaryVesselType(SecondaryVesselTypeEnum.ALL);
-
- editFishingOperationUIModel.setModify(false);
- handler.getFishingOperationMonitor().clearModified();
- handler.registerValidator();
- }
-
- editFishingOperationUIModel.setLoadingData(false);
-
- handler.installStartDateListener();
- handler.installCoordinatesListener();
- }
-
- public void loadCatchBatch(FishingOperation bean) {
-
- boolean empty = bean == null || TuttiEntities.isNew(bean);
-
- EditCatchesUI ui = getUI().getCatchesTabContent();
- TuttiBeanMonitor<EditCatchesUIModel> catchBatchMonitor =
- ui.getHandler().getCatchBatchMonitor();
-
- EditCatchesUIModel catchesUIModel = ui.getModel();
-
- catchesUIModel.setLoadingData(true);
-
- catchesUIModel.reset();
-
- CatchBatch batch;
-
- List<Attachment> attachments;
-
- boolean catchNotFound;
- boolean catchEnabled;
-
- String operationId = bean == null ? null : bean.getId();
-
- ProgressionModel progressionModel = getProgressionModel();
- if (progressionModel == null) {
- progressionModel = new ProgressionModel();
- setProgressionModel(progressionModel);
- }
- progressionModel.adaptTotal(empty ? 1 : 6);
-
- if (empty) {
-
- // create a new CatchBatch
- progressionModel.increments("Create new catch batch");
- if (log.isDebugEnabled()) {
- log.debug("Create a new CatchBatch (fishing operation is null)");
- }
- batch = CatchBatchs.newCatchBatch();
- batch.setFishingOperation(bean);
-
- attachments = Collections.emptyList();
-
- catchEnabled = true;
- catchNotFound = false;
-
- } else {
-
- if (log.isDebugEnabled()) {
- log.debug("Load existing CatchBatch from operation id: " +
- operationId);
- }
-
- PersistenceService persistenceService =
- getContext().getPersistenceService();
-
- progressionModel.increments("Chargement de la capture");
-
- boolean withCatchBath =
- persistenceService.isFishingOperationWithCatchBatch(
- operationId);
-
- if (withCatchBath) {
-
- // load it
- try {
- batch = persistenceService.getCatchBatchFromFishingOperation(operationId);
- batch.setFishingOperation(bean);
- Integer objectId = batch.getIdAsInt();
- attachments = persistenceService.getAllAttachments(catchesUIModel.getObjectType(), objectId);
- catchNotFound = false;
- catchEnabled = true;
-
- } catch (InvalidBatchModelException e) {
-
- // batch is not compatible with Tutti
- if (log.isDebugEnabled()) {
- log.debug("Invalid batch model", e);
- }
- batch = null;
- attachments = Collections.emptyList();
-
- catchEnabled = false;
- catchNotFound = false;
- }
- } else {
-
- // no catch batch
- batch = null;
- attachments = Collections.emptyList();
-
- catchEnabled = false;
- catchNotFound = true;
- }
- }
-
- setCatch(attachments,
- catchesUIModel,
- catchBatchMonitor,
- batch,
- true,
- catchEnabled,
- catchNotFound);
-
-
- // 4) Propagate new selected fishingoperation to others tabs
-
- FishingOperation operationToLoad = batch == null ? null : bean;
-
- boolean catchValid = true;
-
- try {
- progressionModel.increments("Chargement des captures Espèces");
-
- ui.getSpeciesTabContent().getHandler().selectFishingOperation(operationToLoad);
- } catch (InvalidBatchModelException e) {
-
- // invalid sample category model for species batches
- if (log.isDebugEnabled()) {
- log.debug("Invalid sample category model for species batches", e);
- }
- errorMessages.add(e.getMessage());
- catchValid = false;
- }
-
- try {
- progressionModel.increments("Chargement des captures Benthos");
- ui.getBenthosTabContent().getHandler().selectFishingOperation(operationToLoad);
- } catch (InvalidBatchModelException e) {
-
- // invalid sample category model for benthos batches
- if (log.isDebugEnabled()) {
- log.debug("Invalid sample category model for benthos batches", e);
- }
- errorMessages.add(e.getMessage());
- catchValid = false;
- }
-
- if (catchValid) {
-
- // load other tabs
-
- progressionModel.increments("Chargmenent des macro-déchets");
- ui.getMarineLitterTabContent().getHandler().selectFishingOperation(operationToLoad);
-
- progressionModel.increments("Chargement des captures accidentelles");
- ui.getAccidentalTabContent().getHandler().selectFishingOperation(operationToLoad);
-
- progressionModel.increments("Chargement des données individuelles");
- ui.getIndividualObservationTabContent().getHandler().selectFishingOperation(operationToLoad);
-
- } else {
-
- // remove catch
- setCatch(Collections.<Attachment>emptyList(),
- catchesUIModel,
- catchBatchMonitor,
- null,
- false,
- false,
- false);
- }
-
- catchesUIModel.setLoadingData(false);
- }
-
- @Override
- public void postFailedAction(Throwable error) {
- super.postFailedAction(error);
- }
-
-
- protected void setCatch(List<Attachment> attachments,
- EditCatchesUIModel catchesUIModel,
- TuttiBeanMonitor<EditCatchesUIModel> catchBatchMonitor,
- CatchBatch batch,
- boolean sampleModelValid,
- boolean catchEnabled,
- boolean catchNotFound) {
-
- getModel().setCatchEnabled(catchEnabled);
- getModel().setCatchNotFound(catchNotFound);
- getModel().setSampleCatchModelValid(sampleModelValid);
-
- catchesUIModel.fromEntity(batch);
- catchesUIModel.addAllAttachment(attachments);
-
- catchesUIModel.setModify(false);
- catchBatchMonitor.clearModified();
- }
-
- public void setInternalAction(boolean internalAction) {
- this.internalAction = internalAction;
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -627,7 +627,7 @@
toolTipText: "tutti.editFishingOperation.action.saveEditFishingOperation.tip";
i18nMnemonic: "tutti.editFishingOperation.action.saveEditFishingOperation.mnemonic";
enabled: {model.isValid() && model.isModify()};
- _applicationAction: {SaveFishingOperationAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SaveFishingOperationAction.class};
_help: {"tutti.editFishingOperation.action.saveEditFishingOperation.help"};
}
@@ -636,6 +636,6 @@
text: "tutti.editFishingOperation.action.cancelEditFishingOperation";
toolTipText: "tutti.editFishingOperation.action.cancelEditFishingOperation.tip";
i18nMnemonic: "tutti.editFishingOperation.action.cancelEditFishingOperation.mnemonic";
- _applicationAction: {CancelEditFishingOperationAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.CancelEditFishingOperationAction.class};
_help: {"tutti.editFishingOperation.action.cancelEditFishingOperation.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -40,11 +40,12 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.action.CancelEditFishingOperationAction;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.AbstractCaracteristicTabUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.GearUseFeatureTabUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.VesselUseFeatureTabUIModel;
+import fr.ifremer.shared.application.swing.tab.TabHandler;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiTabContainerUIHandler;
-import fr.ifremer.tutti.ui.swing.util.TabHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.caracteristics.GearCaracteristicListCellRenderer;
import jaxx.runtime.validator.swing.SwingValidator;
@@ -582,13 +583,13 @@
//------------------------------------------------------------------------//
@Override
- protected boolean onTabChanged(int currentIndex, int newIndex) {
+ public boolean onTabChanged(int currentIndex, int newIndex) {
ui.getFishingOperationAttachmentsButton().onCloseUI();
return super.onTabChanged(currentIndex, newIndex);
}
@Override
- protected JTabbedPane getTabPanel() {
+ public JTabbedPane getTabPanel() {
return ui.getFishingOperationTabPane();
}
@@ -822,7 +823,7 @@
return result;
}
- protected void resetAllModels() {
+ public void resetAllModels() {
for (AbstractCaracteristicTabUIModel subModel : getSubModels()) {
subModel.setModify(false);
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -39,12 +39,14 @@
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.shared.application.type.CoordinateEditorType;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.util.TabContentModel;
+import fr.ifremer.shared.application.swing.tab.TabContentModel;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
import jaxx.runtime.swing.editor.gis.DmdCoordinate;
import jaxx.runtime.swing.editor.gis.DmsCoordinate;
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 org.nuiton.util.DateUtil;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -865,6 +867,10 @@
return CoordinateEditorType.DMD.equals(getCoordinateEditorType());
}
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EditFishingOperationUIModel.class);
+
public void convertGearShootingCoordinatesFromDD() {
switch (coordinateEditorType) {
@@ -873,6 +879,10 @@
setGearShootingStartLongitudeDms(getGearShootingStartLongitude());
setGearShootingEndLatitudeDms(getGearShootingEndLatitude());
setGearShootingEndLongitudeDms(getGearShootingEndLongitude());
+
+ if (log.isInfoEnabled()) {
+ log.info("startLongitude dms: "+gearShootingStartLongitudeDms);
+ }
break;
case DMD:
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -35,7 +35,7 @@
actionIcon: add;
toolTipText: "tutti.fishingOperations.action.newFishingOperation.tip";
i18nMnemonic: "tutti.fishingOperations.action.newFishingOperation.mnemonic";
- _applicationAction: {NewFishingOperationAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.NewFishingOperationAction.class};
_help: {"tutti.fishingOperations.action.newFishingOperation.help"};
}
@@ -44,7 +44,7 @@
enabled:{model.getSelectedFishingOperation() != null};
toolTipText: "tutti.fishingOperations.action.deleteFishingOperation.tip";
i18nMnemonic: "tutti.fishingOperations.action.deleteFishingOperation.mnemonic";
- _applicationAction: {DeleteFishingOperationAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.DeleteFishingOperationAction.class};
_help: {"tutti.fishingOperations.action.deleteFishingOperation.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -32,6 +32,7 @@
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.tutti.ui.swing.action.EditFishingOperationAction;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiTabContainerUIHandler;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/ImportCasinoAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/ImportCasinoAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/ImportCasinoAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,44 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.action.AbstractTuttiAction;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ImportCasinoAction extends AbstractTuttiAction<EditFishingOperationUIModel, EditFishingOperationUI, EditFishingOperationUIHandler> {
-
- public ImportCasinoAction(EditFishingOperationUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public void doAction() throws Exception {
- //TODO
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/NewFishingOperationAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/NewFishingOperationAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/NewFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,86 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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 fr.ifremer.tutti.persistence.entities.data.FishingOperations;
-import fr.ifremer.tutti.persistence.entities.referential.GearWithOriginalRankOrder;
-
-import java.util.List;
-
-/**
- * To create a new fishing operation.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class NewFishingOperationAction extends EditFishingOperationAction {
-
- public NewFishingOperationAction(FishingOperationsUIHandler handler) {
- super(handler);
- }
-
- @Override
- public void doAction() throws Exception {
-
- FishingOperationsUIModel model = getModel();
-
- // deselect selected fishingOperation
- // Will remove the selection fishing operation from the comboBox
-
- model.setCatchEnabled(true);
-
- model.setEditionAdjusting(true);
- try {
- model.setSelectedFishingOperation(null);
- } finally {
- model.setEditionAdjusting(false);
- }
-
- // creates a empty bean
-
- FishingOperation newFishingOperation =
- FishingOperations.newFishingOperation();
- Cruise cruise = getDataContext().getCruise();
- newFishingOperation.setCruise(cruise);
- newFishingOperation.setVessel(cruise.getVessel());
-
- List<GearWithOriginalRankOrder> gears = cruise.getGear();
- if (gears.size() == 1) {
- newFishingOperation.setGear(gears.get(0));
- }
-
- if (cruise.getMultirigNumber() == 1) {
- newFishingOperation.setMultirigAggregation("1");
- }
-
- newFishingOperation.setGearShootingStartDate(null);
- newFishingOperation.setGearShootingEndDate(null);
- setFishingOperation(newFishingOperation);
-
- super.doAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/SaveFishingOperationAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/SaveFishingOperationAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/SaveFishingOperationAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,182 +0,0 @@
-
-package fr.ifremer.tutti.ui.swing.content.operation;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.CaracteristicMap;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
-import fr.ifremer.tutti.persistence.entities.data.CatchBatchs;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.service.ValidationService;
-import fr.ifremer.tutti.ui.swing.content.operation.fishing.AbstractCaracteristicTabUIModel;
-import fr.ifremer.tutti.ui.swing.content.operation.fishing.GearUseFeatureTabUIModel;
-import fr.ifremer.tutti.ui.swing.content.operation.fishing.VesselUseFeatureTabUIModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Saves a fishing operation and potentially sets another screen or switch to another tab.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0
- */
-public class SaveFishingOperationAction extends AbstractTuttiAction<EditFishingOperationUIModel, EditFishingOperationUI, EditFishingOperationUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(SaveFishingOperationAction.class);
-
-
- /**
- * A flag to update ui after create or save the edit fishing operation.
- *
- * @since 1.0
- */
- protected boolean updateUI;
-
- public SaveFishingOperationAction(EditFishingOperationUIHandler handler) {
- super(handler, true);
- }
-
- public void setUpdateUI(boolean updateUI) {
- this.updateUI = updateUI;
- }
-
- @Override
- public void releaseAction() {
- updateUI = true;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
-
- TuttiBeanMonitor<EditFishingOperationUIModel> monitor =
- handler.getFishingOperationMonitor();
-
- // previous fishingOperation was modified, let's save it
- EditFishingOperationUIModel beanToSave = monitor.getBean();
-
- // must save when bean is new or was modifiy and is valid
- boolean mustSave = beanToSave.getFishingOperation() != null
- && beanToSave.isValid();
-
- if (mustSave) {
-
- // prepare model
- beanToSave.convertGearShootingCoordinatesToDD();
-
- // save modified fishing operation
- FishingOperation toSave = beanToSave.toBean();
-
- AbstractCaracteristicTabUIModel[] subModels = handler.getSubModels();
- for (AbstractCaracteristicTabUIModel subModel : subModels) {
- Class<?> modelClass = subModel.getClass();
- CaracteristicMap caracteristics = subModel.getCaracteristicMap();
-
- if (modelClass.isAssignableFrom(VesselUseFeatureTabUIModel.class)) {
- toSave.setVesselUseFeatures(caracteristics);
-
- } else if (modelClass.isAssignableFrom(GearUseFeatureTabUIModel.class)) {
- toSave.setGearUseFeatures(caracteristics);
-
- }
- subModel.setModify(false);
- }
-
- sendMessage(
- "[ Trait - Caractéristiques générales ] " +
- "Sauvegarde des modifications de " + decorate(toSave) +
- ".");
-
- if (log.isInfoEnabled()) {
- log.info("FishingOperation " + toSave.getId() +
- " was modified, will save it.");
- }
-
- monitor.clearModified();
- getModel().setModify(false);
-
- saveFishingOperation(toSave);
-
- if (ValidationService.VALIDATION_CONTEXT_EDIT.equals(getContext().getValidationContext())) {
- handler.getParentUi().getTabPane().setSelectedIndex(1);
- handler.getParentUi().getCatchesTabContent().getTabPane().setSelectedIndex(1);
- }
- }
-
- }
-
- protected void saveFishingOperation(FishingOperation toSave) {
-
- PersistenceService service = getContext().getPersistenceService();
-
- boolean create = TuttiEntities.isNew(toSave);
-
- FishingOperationsUIModel model =
- getHandler().getParentUi().getModel();
- FishingOperation savedFishingOperation;
-
- if (create) {
-
- // create fishing operation
- savedFishingOperation = service.createFishingOperation(toSave);
-
- // create then the CatchBatch
- CatchBatch catchBatch = CatchBatchs.newCatchBatch();
- catchBatch.setFishingOperation(savedFishingOperation);
- service.createCatchBatch(catchBatch);
-
- // add new created fishing operation to list
- model.addFishingOperation(savedFishingOperation);
-
- // select it (will reload editing fishing operation)
- model.setSelectedFishingOperation(savedFishingOperation);
-
- } else {
-
- model.setEditionAdjusting(true);
-
- try {
- // save fishing operation
- savedFishingOperation = service.saveFishingOperation(toSave);
-
- model.setSelectedFishingOperation(null);
-
- // reinject it in model
- model.updateFishingOperation(savedFishingOperation);
-
- model.setSelectedFishingOperation(savedFishingOperation);
- } finally {
- model.setEditionAdjusting(false);
- }
- }
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractExportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractExportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractExportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,95 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.service.DecoratorService;
-import fr.ifremer.tutti.service.catches.multipost.MultiPostExportService;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.jdesktop.beans.AbstractBean;
-
-import java.io.File;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public abstract class AbstractExportMultiPostAction<M extends AbstractBean, UI extends TuttiUI<M, ?>, H extends AbstractTuttiUIHandler<M, UI>>
- extends AbstractTuttiAction<M, UI, H> {
-
- protected File file;
-
- protected FishingOperation currentOperation;
-
- protected MultiPostExportService multiPostImportExportService;
-
- public AbstractExportMultiPostAction(H handler) {
- super(handler, false);
- multiPostImportExportService = getContext().getMultiPostExportService();
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- EditCatchesUI catchesUI = getUI().getParentContainer(EditCatchesUI.class);
- currentOperation = catchesUI.getModel().getFishingOperation();
-
- String extension = getFileExtension();
- // choose file to export
- file = saveFile(
- decorate(currentOperation, DecoratorService.FILE_NAME_COMPATIBLE),
- extension,
- getFileChooserTitle(),
- getFileChooserButton(),
- "^.*\\." + extension,
- getFileExtensionDescription()
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- protected abstract String getFileExtension();
-
- protected abstract String getFileExtensionDescription();
-
- protected abstract String getFileChooserTitle();
-
- protected abstract String getFileChooserButton();
-
- @Override
- public void releaseAction() {
- file = null;
- currentOperation = null;
- super.releaseAction();
- }
-
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,112 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.service.catches.multipost.MultiPostImportService;
-import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationAction;
-import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.jdesktop.beans.AbstractBean;
-
-import java.io.File;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public abstract class AbstractImportMultiPostAction<M extends AbstractBean, UI extends TuttiUI<M, ?>, H extends AbstractTuttiUIHandler<M, UI>>
- extends AbstractTuttiAction<M, UI, H> {
-
- protected File file;
-
- protected EditFishingOperationAction editAction;
-
- protected MultiPostImportService multiPostImportExportService;
-
- public AbstractImportMultiPostAction(H handler) {
- super(handler, false);
- multiPostImportExportService = getContext().getMultiPostImportService();
- }
-
- public EditFishingOperationAction getEditAction() {
- FishingOperationsUI parentUI = getUI().getParentContainer(FishingOperationsUI.class);
- if (editAction == null) {
- editAction = getContext().getActionFactory().createLogicAction(parentUI.getHandler(),
- EditFishingOperationAction.class);
- }
- return editAction;
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to import
- file = chooseFile(
- getFileChooserTitle(),
- getFileChooserButton(),
- "^.*\\." + getFileExtension(),
- getFileExtensionDescription()
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- protected abstract String getFileExtension();
-
- protected abstract String getFileExtensionDescription();
-
- protected abstract String getFileChooserTitle();
-
- protected abstract String getFileChooserButton();
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- EditCatchesUI editCatchesUI = getUI().getParentContainer(EditCatchesUI.class);
- EditCatchesUIModel editCatchesUIModel = editCatchesUI.getModel();
-
- FishingOperation operation = editCatchesUIModel.getFishingOperation();
-
- importBatches(operation);
-
- getEditAction().loadCatchBatch(operation);
- }
-
- protected abstract void importBatches(FishingOperation operation);
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CancelEditCatchBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CancelEditCatchBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CancelEditCatchBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,86 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.data.CatchBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationAction;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * To cancel edit of a {@link CatchBatch}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class CancelEditCatchBatchAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(CancelEditCatchBatchAction.class);
-
- /**
- * A flag to update ui after create or save the edit catch batch.
- *
- * @since 1.0
- */
- protected boolean updateUI;
-
- protected EditFishingOperationAction editAction;
-
- public CancelEditCatchBatchAction(EditCatchesUIHandler handler) {
- super(handler, true);
- }
-
- public EditFishingOperationAction getEditAction() {
- if (editAction == null) {
- editAction = getContext().getActionFactory().createLogicAction(getHandler().getParentHandler(),
- EditFishingOperationAction.class);
- }
- return editAction;
- }
-
- @Override
- public void doAction() throws Exception {
-
- // cancel to create a catch batch ?
- // Should never happen ?
- Preconditions.checkState(
- !getModel().isCreate(),
- "Can't cancel edition of a not persisted catchBatch!");
-
- if (log.isInfoEnabled()) {
- log.info("Can edition of catchBatch (will reload catchBatch)");
- }
-
- FishingOperation operation = getModel().getFishingOperation();
-
- getEditAction().loadCatchBatch(operation);
- }
-
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CleanBatchWeightsAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CleanBatchWeightsAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CleanBatchWeightsAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,143 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.Multimap;
-import fr.ifremer.tutti.persistence.InvalidBatchModelException;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.service.catches.WeightCleaningService;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JOptionPane;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To remove weight in double for species and benthos rows.
- * <p/>
- * Created on 9/27/13.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 2.6
- */
-public class CleanBatchWeightsAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(CleanBatchWeightsAction.class);
-
- protected final WeightCleaningService cleaningService;
-
- protected int nbErrors;
-
- public CleanBatchWeightsAction(EditCatchesUIHandler handler) {
- super(handler, false);
- cleaningService = getContext().getWeightCleaningService();
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean doAction = super.prepareAction();
- if (doAction) {
-
-
- // do a check
- FishingOperation fishingOperation = getModel().getFishingOperation();
- Multimap<String, String> errors = cleaningService.checkFishingOperation(fishingOperation.getId());
-
- nbErrors = errors.size();
-
- if (nbErrors == 0) {
-
- // no errors
-
- sendMessage(_("tutti.editCatchBatch.action.cleanWeights.no.double.weight.detected"));
- doAction = false;
- } else {
-
- // show errors to user and ask him to apply change
-
- String errorsStr = cleaningService.errorsToString(errors);
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- _("tutti.editCatchBatch.action.cleanWeights.double.weight.detected", errorsStr),
- _("tutti.editCatchBatch.action.cleanWeights.help"));
-
- int answer = JOptionPane.showConfirmDialog(
- getContext().getActionUI(),
- htmlMessage,
- _("tutti.editCatchBatch.action.cleanWieghts.resume.title"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE);
-
- doAction = (answer == JOptionPane.OK_OPTION);
-
- }
- }
- return doAction;
- }
-
- @Override
- public void doAction() throws Exception {
-
- EditCatchesUIModel model = getModel();
- FishingOperation fishingOperation = getModel().getFishingOperation();
- model.setLoadingData(true);
-
- cleaningService.cleanFishingOperation(fishingOperation.getId());
-
- try {
-
- getUI().getSpeciesTabContent().getHandler().selectFishingOperation(fishingOperation);
- } catch (InvalidBatchModelException e) {
-
- // invalid sample category model for species batches
- if (log.isDebugEnabled()) {
- log.debug("Invalid sample category model for species batches", e);
- }
- }
-
- try {
- getUI().getBenthosTabContent().getHandler().selectFishingOperation(fishingOperation);
- } catch (InvalidBatchModelException e) {
-
- // invalid sample category model for benthos batches
- if (log.isDebugEnabled()) {
- log.debug("Invalid sample category model for benthos batches", e);
- }
- }
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- sendMessage(_("tutti.editCatchBatch.action.cleanWeights.done", nbErrors));
- }
-
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeBatchWeightsAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeBatchWeightsAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeBatchWeightsAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,325 +0,0 @@
-
-package fr.ifremer.tutti.ui.swing.content.operation.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
-import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategory;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.service.catches.TuttiWeightComputingException;
-import fr.ifremer.tutti.service.catches.WeightCleaningService;
-import fr.ifremer.tutti.service.catches.WeightComputingService;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-
-import javax.swing.JOptionPane;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0
- */
-public class ComputeBatchWeightsAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
-
- protected final WeightCleaningService cleaningService;
-
- public ComputeBatchWeightsAction(EditCatchesUIHandler handler) {
- super(handler, true);
- cleaningService = getContext().getWeightCleaningService();
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean doAction = super.prepareAction();
- if (doAction) {
-
- // do a check of double weights
- FishingOperation fishingOperation = getModel().getFishingOperation();
- Multimap<String, String> errors = cleaningService.checkFishingOperation(fishingOperation.getId());
-
- if (errors.isEmpty()) {
-
- // no errors
-
- sendMessage(_("tutti.editCatchBatch.action.computeWeights.no.double.weight.detected"));
- } else {
-
- // show errors to user as warning
-
- String errorsStr = cleaningService.errorsToString(errors);
- String htmlMessage = _("tutti.editCatchBatch.action.computeWeights.double.weight.detected", errorsStr);
-
- JOptionPane.showMessageDialog(getContext().getActionUI(),
- htmlMessage,
- _("tutti.editCatchBatch.action.computeWeights.double.weight.detected.title"),
- JOptionPane.WARNING_MESSAGE);
-
-
- }
- }
- return doAction;
- }
-
- @Override
- public void doAction() throws Exception {
- PersistenceService persistenceService = getContext().getPersistenceService();
-
- WeightComputingService weightComputingService = getContext().getWeightComputingService();
-
- EditCatchesUIModel model = getModel();
- model.setLoadingData(true);
-
- // ---------
- // Compute species batches
- // ---------
-
- BatchContainer<SpeciesBatch> computedSpeciesBatches;
- Float totalSpeciesSortedWeight;
- String operationId = model.getFishingOperation().getId();
- try {
- computedSpeciesBatches =
- weightComputingService.getComputedSpeciesBatches(operationId);
- totalSpeciesSortedWeight = computeSpeciesBatches(persistenceService, computedSpeciesBatches);
-
- } catch (TuttiWeightComputingException e) {
- getUI().getTabPane().setSelectedIndex(1);
-
- int index = e.getIndex();
- SpeciesBatchRowModel row = getUI().getSpeciesTabContent().getModel().getRows().get(index);
- int column;
- if (SpeciesBatch.PROPERTY_SAMPLE_CATEGORY_WEIGHT.equals(e.getProperty())) {
- column = getFinestCategoryColumn(row.getFinestCategory().getCategoryId());
- } else {
- column = 6;
- }
- TuttiUIUtil.doSelectCell(getUI().getSpeciesTabContent().getTable(), index, column);
-
- throw e;
- }
-
- // ---------
- // Compute benthos batches
- // ---------
-
- BatchContainer<BenthosBatch> computedBenthosBatches;
- Float totalBenthosSortedWeight;
- try {
- computedBenthosBatches =
- weightComputingService.getComputedBenthosBatches(operationId);
- totalBenthosSortedWeight = computeBenthosBatches(persistenceService, computedBenthosBatches);
-
- } catch (TuttiWeightComputingException e) {
- getUI().getTabPane().setSelectedIndex(2);
-
- int index = e.getIndex();
- BenthosBatchRowModel row = getUI().getBenthosTabContent().getModel().getRows().get(index);
- int column;
- if (BenthosBatch.PROPERTY_SAMPLE_CATEGORY_WEIGHT.equals(e.getProperty())) {
- column = getFinestCategoryColumn(row.getFinestCategory().getCategoryId());
- } else {
- column = 6;
- }
- TuttiUIUtil.doSelectCell(getUI().getBenthosTabContent().getTable(), index, column);
-
- throw e;
- }
-
- // ---------
- // Compute marine litter batches
- // ---------
-
- BatchContainer<MarineLitterBatch> computedMarineLitterBatches;
- try {
- computedMarineLitterBatches =
- weightComputingService.getComputedMarineLitterBatches(operationId,
- model.getMarineLitterTotalWeight());
-
- } catch (TuttiWeightComputingException e) {
- getUI().getTabPane().setSelectedIndex(3);
- TuttiUIUtil.doSelectCell(getUI().getMarineLitterTabContent().getTable(), e.getIndex(), 3);
- throw e;
- }
-
- // ---------
- // Check species rates
- // ---------
-
- Float rate = getConfig().getDifferenceRateBetweenSortedAndTotalWeights();
- if (model.getSpeciesTotalSortedWeight() != null
- && model.getSpeciesTotalSortedWeight() >= totalSpeciesSortedWeight
- && model.getSpeciesTotalSortedWeight() < (1 + rate / 100) * totalSpeciesSortedWeight) {
-
- // Si le "Poids total VRAC" est saisi est que sa valeur
- // est supérieure de moins de x% (x en configuration)
- // du "Poids total Vrac trié", demander confirmation que
- // le "Poids total VRAC" est bien une valeur observée
- // sinon la remplacer par le "Poids total Vrac trié"
-
- getUI().getTabPane().setSelectedIndex(1);
-
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.message.species", rate),
- _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.help"));
-
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- htmlMessage,
- _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.title"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
-
- if (answer == JOptionPane.NO_OPTION) {
- model.setSpeciesTotalSortedWeight(null);
- model.setSpeciesTotalSortedComputedWeight(totalSpeciesSortedWeight);
- }
- }
-
- // ---------
- // Check benthos rates
- // ---------
-
- if (model.getBenthosTotalSortedWeight() != null
- && model.getBenthosTotalSortedWeight() >= totalBenthosSortedWeight
- && model.getBenthosTotalSortedWeight() < (1 + rate / 100) * totalBenthosSortedWeight) {
-
- // Si le "Poids total VRAC" est saisi est que sa valeur
- // est supérieure de moins de x% (x en configuration)
- // du "Poids total Vrac trié", demander confirmation que
- // le "Poids total VRAC" est bien une valeur observée
- // sinon la remplacer par le "Poids total Vrac trié"
-
- getUI().getTabPane().setSelectedIndex(2);
-
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.message.benthos", rate),
- _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.help"));
-
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- htmlMessage,
- _("tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.title"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
-
- if (answer == JOptionPane.NO_OPTION) {
- model.setBenthosTotalSortedWeight(null);
- model.setBenthosTotalSortedComputedWeight(totalBenthosSortedWeight);
- }
- }
-
- boolean modified = model.isModify();
- CatchBatch catchBatch = model.toEntity();
- weightComputingService.computeCatchBatchWeights(catchBatch,
- computedSpeciesBatches,
- computedBenthosBatches,
- computedMarineLitterBatches);
- model.fromEntity(catchBatch);
- model.setLoadingData(false);
-
- model.setModify(modified);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- getUI().repaint();
- }
-
- //------------------------------------------------------------------------//
- //-- Internal methods --//
- //------------------------------------------------------------------------//
-
- protected Float computeSpeciesBatches(PersistenceService persistenceService, BatchContainer<SpeciesBatch> computedSpeciesBatches) {
- Float totalSortedWeight = 0f;
-
- if (computedSpeciesBatches != null) {
- List<SpeciesBatchRowModel> rows = Lists.newArrayList();
- List<SpeciesBatch> children = computedSpeciesBatches.getChildren();
- for (SpeciesBatch batch : children) {
- SpeciesBatchRowModel row = getUI().getSpeciesTabContent().getHandler().loadBatch(batch, null, rows);
- if (persistenceService.isVracBatch(row)) {
- SampleCategory<?> sampleCategory = row.getFirstSampleCategory();
- Float weight = TuttiEntities.getValueOrComputedValue(
- sampleCategory.getCategoryWeight(),
- sampleCategory.getComputedWeight());
- totalSortedWeight += weight;
- }
- }
- getUI().getSpeciesTabContent().getModel().setRows(rows);
- }
-
- return totalSortedWeight;
- }
-
- protected Float computeBenthosBatches(PersistenceService persistenceService, BatchContainer<BenthosBatch> computedBenthosBatches) {
- Float totalSortedWeight = 0f;
-
- if (computedBenthosBatches != null) {
- List<BenthosBatchRowModel> rows = Lists.newArrayList();
- List<BenthosBatch> children = computedBenthosBatches.getChildren();
- for (BenthosBatch batch : children) {
- BenthosBatchRowModel row = getUI().getBenthosTabContent().getHandler().loadBatch(batch, null, rows);
-
- if (persistenceService.isVracBatch(row)) {
- SampleCategory<?> sampleCategory = row.getFirstSampleCategory();
- Float weight = TuttiEntities.getValueOrComputedValue(
- sampleCategory.getCategoryWeight(),
- sampleCategory.getComputedWeight());
- totalSortedWeight += weight;
- }
- }
- getUI().getBenthosTabContent().getModel().setRows(rows);
-
- }
- return totalSortedWeight;
- }
-
- protected int getFinestCategoryColumn(Integer categoryId) {
- int column = 1;
-
- List<Integer> samplingOrderIds = getConfig().getSamplingOrderIds();
-
- int index = samplingOrderIds.indexOf(categoryId);
- if (index > -1) {
- column += index + 1;
- }
-
- return column;
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -30,7 +30,7 @@
useFloat: true;
}
-TuttiComputedOrNotDataEditor {
+ComputableDataEditor {
autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
showReset: true;
@@ -332,7 +332,7 @@
text: "tutti.editCatchBatch.action.exportFishingOperationReport";
toolTipText: "tutti.editCatchBatch.action.exportFishingOperationReport.tip";
i18nMnemonic: "tutti.editCatchBatch.action.exportFishingOperationReport.mnemonic";
- _applicationAction: {ExportFishingOperationReportAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportFishingOperationReportAction.class};
_help: {"tutti.editCatchBatch.action.exportFishingOperationReport.help"};
}
@@ -341,7 +341,7 @@
text: "tutti.editCatchBatch.action.exportFishingOperationReportForSumatra";
toolTipText: "tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.tip";
i18nMnemonic: "tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.mnemonic";
- _applicationAction: {ExportFishingOperationForSumatraAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportFishingOperationForSumatraAction.class};
_help: {"tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.help"};
}
@@ -351,7 +351,7 @@
toolTipText: "tutti.editCatchBatch.action.saveCatchBatch.tip";
i18nMnemonic: "tutti.editCatchBatch.action.saveCatchBatch.mnemonic";
enabled: {model.isModify()};
- _applicationAction: {SaveCatchBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SaveCatchBatchAction.class};
_help: {"tutti.editCatchBatch.action.saveCatchBatch.help"};
}
@@ -360,7 +360,7 @@
text: "tutti.editCatchBatch.action.cancelEditCatchBatch";
toolTipText: "tutti.editCatchBatch.action.cancelEditCatchBatch.tip";
i18nMnemonic: "tutti.editCatchBatch.action.cancelEditCatchBatch.mnemonic";
- _applicationAction: {CancelEditCatchBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.CancelEditCatchBatchAction.class};
_help: {"tutti.editCatchBatch.action.cancelEditCatchBatch.help"};
}
@@ -369,7 +369,7 @@
text: "tutti.editCatchBatch.action.cleanWeights";
toolTipText: "tutti.editCatchBatch.action.cleanWeights.tip";
i18nMnemonic: "tutti.editCatchBatch.action.cleanWeights.mnemonic";
- _applicationAction: {CleanBatchWeightsAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.CleanBatchWeightsAction.class};
_help: {"tutti.editCatchBatch.action.cleanWeights.help"};
}
@@ -378,6 +378,6 @@
text: "tutti.editCatchBatch.action.computeWeights";
toolTipText: "tutti.editCatchBatch.action.computeWeights.tip";
i18nMnemonic: "tutti.editCatchBatch.action.computeWeights.mnemonic";
- _applicationAction: {ComputeBatchWeightsAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ComputeBatchWeightsAction.class};
_help: {"tutti.editCatchBatch.action.computeWeights.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2013-11-26 08:03:42 UTC (rev 1388)
@@ -24,12 +24,9 @@
<JPanel id='editCatchesTopPanel' layout='{new BorderLayout()}' decorator='help'
implements='fr.ifremer.tutti.ui.swing.util.TuttiUI<EditCatchesUIModel, EditCatchesUIHandler>'>
- <import>
+ <import><![CDATA[
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
- fr.ifremer.tutti.ui.swing.content.home.SendCruiseReportAction
- fr.ifremer.tutti.ui.swing.content.home.ExportCruiseForSumatraAction
-
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUI
fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.create.CreateAccidentalBatchUI
@@ -50,17 +47,15 @@
fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment
fr.ifremer.tutti.ui.swing.util.caracteristics.CaracteristicMapEditorUI
- fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataEditor
+ fr.ifremer.shared.application.swing.computable.ComputableDataEditor
org.jdesktop.swingx.JXTitledPanel
jaxx.runtime.swing.CardLayout2Ext
- jaxx.runtime.swing.editor.NumberEditor
static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
static fr.ifremer.shared.application.ApplicationDataUtil.getWeightStringValue
- </import>
+ ]]></import>
<script><![CDATA[
@@ -138,8 +133,9 @@
<JLabel id='catchTotalWeightLabel'/>
</cell>
<cell columns='4' weightx='1.0'>
- <TuttiComputedOrNotDataEditor id='catchTotalWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor id='catchTotalWeightField'
+ genericType="Float"
+ constructorParams='this'/>
</cell>
</row>
<!-- Poids total trié balance tremie / caroussel-->
@@ -189,9 +185,9 @@
<JLabel id='catchTotalRejectedWeightLabel'/>
</cell>
<cell columns='4' weightx='1.0'>
- <TuttiComputedOrNotDataEditor
- id='catchTotalRejectedWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor genericType="Float"
+ id='catchTotalRejectedWeightField'
+ constructorParams='this'/>
</cell>
</row>
</Table>
@@ -216,9 +212,9 @@
<JLabel id='speciesTotalSortedWeightLabel'/>
</cell>
<cell weightx='1.0'>
- <TuttiComputedOrNotDataEditor
- id='speciesTotalSortedWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor genericType="Float"
+ id='speciesTotalSortedWeightField'
+ constructorParams='this'/>
</cell>
</row>
@@ -262,9 +258,9 @@
<JLabel id='benthosTotalSortedWeightLabel'/>
</cell>
<cell weightx='1.0'>
- <TuttiComputedOrNotDataEditor
- id='benthosTotalSortedWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor genericType="Float"
+ id='benthosTotalSortedWeightField'
+ constructorParams='this'/>
</cell>
</row>
@@ -299,9 +295,9 @@
<JLabel id='marineLitterTotalWeightLabel'/>
</cell>
<cell weightx='1.0'>
- <TuttiComputedOrNotDataEditor
- id='marineLitterTotalWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor genericType="Float"
+ id='marineLitterTotalWeightField'
+ constructorParams='this'/>
</cell>
</row>
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -36,8 +36,8 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyCellComponent;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchUI;
+import fr.ifremer.shared.application.swing.tab.TabHandler;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiTabContainerUIHandler;
-import fr.ifremer.tutti.ui.swing.util.TabHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import jaxx.runtime.swing.CardLayout2Ext;
@@ -194,12 +194,12 @@
}
@Override
- protected JTabbedPane getTabPanel() {
+ public JTabbedPane getTabPanel() {
return ui.getTabPane();
}
@Override
- protected boolean onTabChanged(int currentIndex, int newIndex) {
+ public boolean onTabChanged(int currentIndex, int newIndex) {
ui.getCatchesCaracteristicsAttachmentsButton().onCloseUI();
ui.getComputeSpeciesBatchButton().setVisible(newIndex < 4);
ui.getCleanSpeciesBatchButton().setVisible(newIndex < 3);
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -28,6 +28,7 @@
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
+import fr.ifremer.shared.application.swing.computable.ComputableData;
import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
@@ -37,8 +38,7 @@
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.util.TabContentModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
+import fr.ifremer.shared.application.swing.tab.TabContentModel;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
import org.apache.commons.collections.CollectionUtils;
import org.nuiton.util.beans.Binder;
@@ -67,36 +67,36 @@
protected Float speciesTotalComputedWeight;
- protected TuttiComputedOrNotData<Float> speciesTotalSortedComputedOrNotWeight = new TuttiComputedOrNotData<Float>();
+ protected ComputableData<Float> speciesTotalSortedComputedOrNotWeight = new ComputableData<Float>();
protected Float speciesTotalUnsortedComputedWeight;
protected Float speciesTotalSampleSortedComputedWeight;
- protected TuttiComputedOrNotData<Float> speciesTotalInertComputedOrNotWeight = new TuttiComputedOrNotData<Float>();
+ protected ComputableData<Float> speciesTotalInertComputedOrNotWeight = new ComputableData<Float>();
- protected TuttiComputedOrNotData<Float> speciesTotalLivingNotItemizedComputedOrNotWeight = new TuttiComputedOrNotData<Float>();
+ protected ComputableData<Float> speciesTotalLivingNotItemizedComputedOrNotWeight = new ComputableData<Float>();
protected Float benthosTotalComputedWeight;
- protected TuttiComputedOrNotData<Float> benthosTotalSortedComputedOrNotWeight = new TuttiComputedOrNotData<Float>();
+ protected ComputableData<Float> benthosTotalSortedComputedOrNotWeight = new ComputableData<Float>();
protected Float benthosTotalUnsortedComputedWeight;
protected Float benthosTotalSampleSortedComputedWeight;
- protected TuttiComputedOrNotData<Float> benthosTotalInertComputedOrNotWeight = new TuttiComputedOrNotData<Float>();
+ protected ComputableData<Float> benthosTotalInertComputedOrNotWeight = new ComputableData<Float>();
- protected TuttiComputedOrNotData<Float> benthosTotalLivingNotItemizedComputedOrNotWeight = new TuttiComputedOrNotData<Float>();
+ protected ComputableData<Float> benthosTotalLivingNotItemizedComputedOrNotWeight = new ComputableData<Float>();
protected Float planktonTotalWeight;
protected Float planktonTotalSampleWeight;
- protected TuttiComputedOrNotData<Float> marineLitterTotalComputedOrNotWeight = new TuttiComputedOrNotData<Float>();
+ protected ComputableData<Float> marineLitterTotalComputedOrNotWeight = new ComputableData<Float>();
- protected TuttiComputedOrNotData<Float> catchTotalComputedOrNotWeight
- = new TuttiComputedOrNotData<Float>();
+ protected ComputableData<Float> catchTotalComputedOrNotWeight
+ = new ComputableData<Float>();
protected Float catchTotalSortedComputedWeight;
@@ -106,8 +106,8 @@
protected Float catchTotalSortedCarousselWeight;
- protected TuttiComputedOrNotData<Float> catchTotalRejectedComputedOrNotWeight
- = new TuttiComputedOrNotData<Float>();
+ protected ComputableData<Float> catchTotalRejectedComputedOrNotWeight
+ = new ComputableData<Float>();
protected FishingOperation fishingOperation;
@@ -385,7 +385,7 @@
//-- Total --//
//------------------------------------------------------------------------//
- public TuttiComputedOrNotData<Float> getCatchTotalComputedOrNotWeight() {
+ public ComputableData<Float> getCatchTotalComputedOrNotWeight() {
return catchTotalComputedOrNotWeight;
}
@@ -461,7 +461,7 @@
firePropertyChange(PROPERTY_CATCH_TOTAL_SORTED_CAROUSSEL_WEIGHT, oldValue, catchTotalSortedCarousselWeight);
}
- public TuttiComputedOrNotData<Float> getCatchTotalRejectedComputedOrNotWeight() {
+ public ComputableData<Float> getCatchTotalRejectedComputedOrNotWeight() {
return catchTotalRejectedComputedOrNotWeight;
}
@@ -505,7 +505,7 @@
firePropertyChange(PROPERTY_SPECIES_TOTAL_COMPUTED_WEIGHT, oldValue, speciesTotalComputedWeight);
}
- public TuttiComputedOrNotData<Float> getSpeciesTotalSortedComputedOrNotWeight() {
+ public ComputableData<Float> getSpeciesTotalSortedComputedOrNotWeight() {
return speciesTotalSortedComputedOrNotWeight;
}
@@ -557,7 +557,7 @@
firePropertyChange(PROPERTY_SPECIES_TOTAL_UNSORTED_COMPUTED_WEIGHT, oldValue, speciesTotalUnsortedComputedWeight);
}
- public TuttiComputedOrNotData<Float> getSpeciesTotalInertComputedOrNotWeight() {
+ public ComputableData<Float> getSpeciesTotalInertComputedOrNotWeight() {
return speciesTotalInertComputedOrNotWeight;
}
@@ -585,7 +585,7 @@
firePropertyChange(PROPERTY_SPECIES_TOTAL_INERT_COMPUTED_WEIGHT, oldValue, speciesTotalInertComputedWeight);
}
- public TuttiComputedOrNotData<Float> getSpeciesTotalLivingNotItemizedComputedOrNotWeight() {
+ public ComputableData<Float> getSpeciesTotalLivingNotItemizedComputedOrNotWeight() {
return speciesTotalLivingNotItemizedComputedOrNotWeight;
}
@@ -629,7 +629,7 @@
firePropertyChange(PROPERTY_BENTHOS_TOTAL_COMPUTED_WEIGHT, oldValue, benthosTotalComputedWeight);
}
- public TuttiComputedOrNotData<Float> getBenthosTotalSortedComputedOrNotWeight() {
+ public ComputableData<Float> getBenthosTotalSortedComputedOrNotWeight() {
return benthosTotalSortedComputedOrNotWeight;
}
@@ -681,7 +681,7 @@
firePropertyChange(PROPERTY_BENTHOS_TOTAL_UNSORTED_COMPUTED_WEIGHT, oldValue, benthosTotalUnsortedComputedWeight);
}
- public TuttiComputedOrNotData<Float> getBenthosTotalInertComputedOrNotWeight() {
+ public ComputableData<Float> getBenthosTotalInertComputedOrNotWeight() {
return benthosTotalInertComputedOrNotWeight;
}
@@ -709,7 +709,7 @@
firePropertyChange(PROPERTY_BENTHOS_TOTAL_INERT_COMPUTED_WEIGHT, oldValue, benthosTotalInertComputedWeight);
}
- public TuttiComputedOrNotData<Float> getBenthosTotalLivingNotItemizedComputedOrNotWeight() {
+ public ComputableData<Float> getBenthosTotalLivingNotItemizedComputedOrNotWeight() {
return benthosTotalLivingNotItemizedComputedOrNotWeight;
}
@@ -769,7 +769,7 @@
//-- Marine Litter --//
//------------------------------------------------------------------------//
- public TuttiComputedOrNotData<Float> getMarineLitterTotalComputedOrNotWeight() {
+ public ComputableData<Float> getMarineLitterTotalComputedOrNotWeight() {
return marineLitterTotalComputedOrNotWeight;
}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ExportFishingOperationForSumatraAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ExportFishingOperationForSumatraAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ExportFishingOperationForSumatraAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,115 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.DateUtil;
-
-import java.io.File;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Created on 10/1/13.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 2.7
- */
-public class ExportFishingOperationForSumatraAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportFishingOperationForSumatraAction.class);
-
- protected File file;
-
- public ExportFishingOperationForSumatraAction(EditCatchesUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- FishingOperation fishingOperation = getModel().getFishingOperation();
-
- String date = DateUtil.formatDate(new Date(), "dd-MM-yyyy");
- // choose file to export
- file = saveFile(
- String.format("sumatra_%s_%s_%s", getDataContext().getCruise().getName(), fishingOperation.getId(), date),
- "csv",
- _("tutti.exportFishingOperationForSumatra.title.choose.exportFile"),
- _("tutti.exportFishingOperationForSumatra.action.chooseFile"),
- "^.+\\.csv$", _("tutti.common.file.csv")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Cruise cruise = getDataContext().getCruise();
- FishingOperation fishingOperation = getModel().getFishingOperation();
- Preconditions.checkNotNull(cruise);
- Preconditions.checkNotNull(fishingOperation);
- Preconditions.checkNotNull(file);
-
- if (log.isInfoEnabled()) {
- log.info("Will export fishingOperation " + cruise.getId() + "-" + fishingOperation.getStationNumber() +
- " to file: " + file);
- }
-
- // export catches
- CatchesSumatraExportService service =
- getContext().getCatchesSumatraExportService();
- service.exportFishingOperationForSumatra(file,
- cruise.getId(),
- fishingOperation.getId());
-
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.exportFishingOperationForSumatra.action.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ExportFishingOperationReportAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ExportFishingOperationReportAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ExportFishingOperationReportAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,110 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.service.export.pdf.CatchesPdfExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Opens a file chooser, exports the cruise catches into the selected file and open the default email editor.
- *
- * @author kmorin <morin(a)codelutin.com>
- * @since 1.0
- */
-public class ExportFishingOperationReportAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportFishingOperationReportAction.class);
-
- protected File file;
-
- public ExportFishingOperationReportAction(EditCatchesUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- Cruise cruise = getDataContext().getCruise();
- FishingOperation fishingOperation = getModel().getFishingOperation();
- // choose file to export
- file = saveFile(
- "exportFishingOperation-" + cruise.getName() + "-" + fishingOperation.getStationNumber(),
- "pdf",
- _("tutti.exportFishingOperationReport.title.choose.exportFile"),
- _("tutti.exportFishingOperationReport.action.chooseFile"),
- "^.+\\.pdf$", _("tutti.common.file.pdf")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Cruise cruise = getDataContext().getCruise();
- FishingOperation fishingOperation = getModel().getFishingOperation();
- Preconditions.checkNotNull(cruise);
- Preconditions.checkNotNull(fishingOperation);
- Preconditions.checkNotNull(file);
-
- if (log.isInfoEnabled()) {
- log.info("Will export fishingOperation " + cruise.getId() + "-" + fishingOperation.getStationNumber() +
- " to file: " + file);
- }
-
- // export catches
- CatchesPdfExportService service =
- getContext().getGeneratePDFService();
- service.generateFishingOperationPDFFile(file, fishingOperation.getId(), getConfig().getI18nLocale());
-
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.exportFishingOperationReport.action.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SaveCatchBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SaveCatchBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SaveCatchBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,107 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.CatchBatch;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * To save a {@link CatchBatch}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class SaveCatchBatchAction extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(SaveCatchBatchAction.class);
-
- /**
- * A flag to update ui after create or save the edit catch batch.
- *
- * @since 1.0
- */
- protected boolean updateUI;
-
- public SaveCatchBatchAction(EditCatchesUIHandler handler) {
- super(handler, true);
- }
-
- public void setUpdateUI(boolean updateUI) {
- this.updateUI = updateUI;
- }
-
- @Override
- public void releaseAction() {
- updateUI = true;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
-
- TuttiBeanMonitor<EditCatchesUIModel> monitor =
- handler.getCatchBatchMonitor();
-
- // previous fishingOperation was modified, let's save it
- EditCatchesUIModel beanToSave = monitor.getBean();
-
- // must save when bean is new or was modifiy and is valid
- boolean mustSave = (beanToSave.isCreate() || beanToSave.isModify()) &&
- beanToSave.isValid();
-
- if (mustSave) {
-
- PersistenceService persistenceService =
- getContext().getPersistenceService();
-
- CatchBatch catchBatch = beanToSave.toEntity();
-
- if (log.isInfoEnabled()) {
- log.info("FishingOperation " + catchBatch.getId() +
- " was modified, will save it.");
- }
-
- //FIXME I18n
- sendMessage(
- "[ Captures - Caractéristiques générales ] " +
- "Sauvegarde des modifications du résumé de la capture.");
-
- persistenceService.saveCatchBatch(catchBatch);
-
- monitor.clearModified();
- getModel().setModify(false);
- }
-
- getUI().getSpeciesTabContent().getHandler().clearTableSelection();
-
- }
-
-}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -54,7 +54,7 @@
text: "tutti.editAccidentalBatch.action.importMultiPost";
toolTipText: "tutti.editAccidentalBatch.action.importMultiPost.tip";
i18nMnemonic: "tutti.editAccidentalBatch.action.importMultiPost.mnemonic";
- _applicationAction: {ImportMultiPostAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportAccidentalMultiPostAction.class};
_help: {"tutti.editAccidentalBatch.action.importMultiPost.help"};
}
@@ -63,7 +63,7 @@
text: "tutti.editAccidentalBatch.action.exportMultiPost";
toolTipText: "tutti.editAccidentalBatch.action.exportMultiPost.tip";
i18nMnemonic: "tutti.editAccidentalBatch.action.exportMultiPost.mnemonic";
- _applicationAction: {ExportMultiPostAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportAccidentalMultiPostAction.class};
_help: {"tutti.editAccidentalBatch.action.exportMultiPost.help"};
}
@@ -80,7 +80,7 @@
text: "tutti.editAccidentalBatch.action.removeBatch";
toolTipText: "tutti.editAccidentalBatch.action.removeBatch.tip";
i18nMnemonic: "tutti.editAccidentalBatch.action.removeBatch.mnemonic";
- _applicationAction: {RemoveAccidentalBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RemoveAccidentalBatchAction.class};
enabled: {model.isRemoveBatchEnabled()};
_help: {"tutti.editAccidentalBatch.action.removeBatch.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.jaxx 2013-11-26 08:03:42 UTC (rev 1388)
@@ -30,8 +30,6 @@
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.util.TuttiUI
- jaxx.runtime.swing.editor.NumberEditor
-
org.jdesktop.swingx.JXTable
javax.swing.ListSelectionModel
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -26,7 +26,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.util.TabContentModel;
+import fr.ifremer.shared.application.swing.tab.TabContentModel;
import org.apache.commons.collections.CollectionUtils;
import static org.nuiton.i18n.I18n.n_;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ExportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ExportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ExportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,72 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.accidental;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractExportMultiPostAction;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public class ExportMultiPostAction
- extends AbstractExportMultiPostAction<AccidentalBatchUIModel, AccidentalBatchUI, AccidentalBatchUIHandler> {
-
- public ExportMultiPostAction(AccidentalBatchUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected String getFileExtension() {
- return "tuttiAccidental";
- }
-
- @Override
- protected String getFileExtensionDescription() {
- return _("tutti.common.file.tuttiAccidental");
- }
-
- @Override
- protected String getFileChooserTitle() {
- return _("tutti.editAccidentalBatch.action.exportMultiPost.destinationFile.title");
- }
-
- @Override
- protected String getFileChooserButton() {
- return _("tutti.editAccidentalBatch.action.exportMultiPost.destinationFile.button");
- }
-
- @Override
- public void doAction() throws Exception {
- multiPostImportExportService.exportAccidentalCatch(file, currentOperation);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.editAccidentalBatch.action.exportMultiPost.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ImportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ImportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/ImportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,74 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.accidental;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.content.operation.catches.AbstractImportMultiPostAction;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public class ImportMultiPostAction
- extends AbstractImportMultiPostAction<AccidentalBatchUIModel, AccidentalBatchUI, AccidentalBatchUIHandler> {
-
- public ImportMultiPostAction(AccidentalBatchUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected String getFileExtension() {
- return "tuttiAccidental";
- }
-
- @Override
- protected String getFileExtensionDescription() {
- return _("tutti.common.file.tuttiAccidental");
- }
-
- @Override
- protected String getFileChooserTitle() {
- return _("tutti.editAccidentalBatch.action.importMultiPost.sourceFile.title");
- }
-
- @Override
- protected String getFileChooserButton() {
- return _("tutti.editAccidentalBatch.action.importMultiPost.sourceFile.button");
- }
-
- @Override
- protected void importBatches(FishingOperation operation) {
- multiPostImportExportService.importAccidentalCatches(file, operation);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- sendMessage(_("tutti.editAccidentalBatch.action.importMultiPost.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/RemoveAccidentalBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/RemoveAccidentalBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/RemoveAccidentalBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,112 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.accidental;
-
-/*
- * #%L
- * Tutti :: UI
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-
-import javax.swing.JOptionPane;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.4
- */
-public class RemoveAccidentalBatchAction extends AbstractTuttiAction<AccidentalBatchUIModel, AccidentalBatchUI, AccidentalBatchUIHandler> {
-
- private static final Log log =
- LogFactory.getLog(RemoveAccidentalBatchAction.class);
-
- public RemoveAccidentalBatchAction(AccidentalBatchUIHandler handler) {
- super(handler, false);
- }
-
- int rowIndex;
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- if (result) {
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- _("tutti.editAccidentalBatch.action.removeBatch.confirm.message"),
- _("tutti.editAccidentalBatch.action.removeBatch.confirm.title"),
- JOptionPane.YES_NO_OPTION);
- result = answer == JOptionPane.YES_OPTION;
- }
-
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
-
- JXTable table = handler.getTable();
-
- rowIndex = table.getSelectedRow();
-
- Preconditions.checkState(rowIndex != -1,
- "Cant remove batch if none is selected");
-
- AccidentalBatchTableModel tableModel = handler.getTableModel();
- AccidentalBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
-
- boolean persisted = !TuttiEntities.isNew(selectedBatch);
-
- if (persisted) {
-
- // remove it from db
-
- String id = selectedBatch.getId();
-
- if (log.isInfoEnabled()) {
- log.info("Remove accidental with id: " + id);
- }
-
- TuttiPersistence persistenceService =
- getContext().getPersistenceService();
-
- persistenceService.deleteAccidentalBatch(id);
- }
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- JXTable table = handler.getTable();
-
- AccidentalBatchTableModel tableModel = handler.getTableModel();
-
- tableModel.removeRow(rowIndex);
-
- TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -28,7 +28,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUI;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -41,7 +41,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryAble;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.frequency.BenthosFrequencyRowModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
+import fr.ifremer.shared.application.swing.computable.ComputableData;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -124,16 +124,16 @@
*
* @since 0.2
*/
- protected TuttiComputedOrNotData<Float> computedOrNotWeight =
- new TuttiComputedOrNotData<Float>();
+ protected ComputableData<Float> computedOrNotWeight =
+ new ComputableData<Float>();
/**
* Total computed number (from frequencies).
*
* @since 0.2
*/
- protected TuttiComputedOrNotData<Integer> computedOrNotNumber =
- new TuttiComputedOrNotData<Integer>();
+ protected ComputableData<Integer> computedOrNotNumber =
+ new ComputableData<Integer>();
/**
* Comment.
@@ -554,19 +554,19 @@
computedOrNotWeight.setComputedData(computedWeight);
}
- public TuttiComputedOrNotData<Integer> getComputedOrNotNumber() {
+ public ComputableData<Integer> getComputedOrNotNumber() {
return computedOrNotNumber;
}
- public void setComputedOrNotNumber(TuttiComputedOrNotData<Integer> computedOrNotNumber) {
+ public void setComputedOrNotNumber(ComputableData<Integer> computedOrNotNumber) {
this.computedOrNotNumber = computedOrNotNumber;
}
- public TuttiComputedOrNotData<Float> getComputedOrNotWeight() {
+ public ComputableData<Float> getComputedOrNotWeight() {
return computedOrNotWeight;
}
- public void setComputedOrNotWeight(TuttiComputedOrNotData<Float> computedOrNotWeight) {
+ public void setComputedOrNotWeight(ComputableData<Float> computedOrNotWeight) {
this.computedOrNotWeight = computedOrNotWeight;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -31,7 +31,7 @@
_selectOnFocus: {true};
}
-TuttiComputedOrNotDataEditor {
+ComputableDataEditor {
autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
showReset: true;
@@ -205,7 +205,7 @@
text: "tutti.editBenthosBatch.action.removeBatch";
toolTipText: "tutti.editBenthosBatch.action.removeBatch.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.removeBatch.mnemonic";
- _applicationAction: {RemoveBenthosBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RemoveBenthosBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRemoveBatchEnabled()};
_help: {"tutti.editBenthosBatch.action.removeBatch.help"};
}
@@ -215,7 +215,7 @@
text: "tutti.editBenthosBatch.action.removeSubBatch";
toolTipText: "tutti.editBenthosBatch.action.removeSubBatch.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.removeSubBatch.mnemonic";
- _applicationAction: {RemoveBenthosSubBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RemoveBenthosSubBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRemoveSubBatchEnabled()};
_help: {"tutti.editBenthosBatch.action.removeSubBatch.help"};
}
@@ -225,7 +225,7 @@
text: "tutti.editBenthosBatch.action.renameBatch";
toolTipText: "tutti.editBenthosBatch.action.renameBatch.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.renameBatch.mnemonic";
- _applicationAction: {RenameBenthosBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RenameBenthosBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRenameBatchEnabled()};
_help: {"tutti.editBenthosBatch.action.renameBatch.help"};
}
@@ -235,7 +235,7 @@
text: "tutti.editBenthosBatch.action.createMelag";
toolTipText: "tutti.editBenthosBatch.action.createMelag.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.createMelag.mnemonic";
- _applicationAction: {CreateBenthosMelagAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.CreateBenthosMelagAction.class};
enabled: {!model.isTableViewModeLeaf() && model.isCreateMelagEnabled()};
_help: {"tutti.editBenthosBatch.action.createMelag.help"};
}
@@ -254,7 +254,7 @@
text: "tutti.editBenthosBatch.action.importMultiPost";
toolTipText: "tutti.editBenthosBatch.action.importMultiPost.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.importMultiPost.mnemonic";
- _applicationAction: {ImportMultiPostAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportBenthosMultiPostAction.class};
_help: {"tutti.editBenthosBatch.action.importMultiPost.help"};
}
@@ -263,7 +263,7 @@
text: "tutti.editBenthosBatch.action.exportMultiPost";
toolTipText: "tutti.editBenthosBatch.action.exportMultiPost.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.exportMultiPost.mnemonic";
- _applicationAction: {ExportMultiPostAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportBenthosMultiPostAction.class};
_help: {"tutti.editBenthosBatch.action.exportMultiPost.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx 2013-11-26 08:03:42 UTC (rev 1388)
@@ -25,12 +25,12 @@
decorator='help'
implements='fr.ifremer.tutti.ui.swing.util.TuttiUI<BenthosBatchUIModel, BenthosBatchUIHandler>'>
- <import>
+ <import><![CDATA[
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode
fr.ifremer.tutti.ui.swing.util.TuttiUI
- fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataEditor
+ fr.ifremer.shared.application.swing.computable.ComputableDataEditor
org.jdesktop.swingx.JXTable
@@ -40,7 +40,7 @@
static org.nuiton.i18n.I18n._
static fr.ifremer.shared.application.ApplicationDataUtil.getWeightStringValue
- </import>
+ ]]></import>
<script><![CDATA[
@@ -102,8 +102,8 @@
<JLabel id='benthosTotalSortedWeightLabel'/>
</cell>
<cell weightx='1.0'>
- <TuttiComputedOrNotDataEditor id='benthosTotalSortedWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor id='benthosTotalSortedWeightField'
+ genericType="Float" constructorParams='this'/>
</cell>
</row>
@@ -129,16 +129,15 @@
<JLabel id='benthosTotalInertWeightLabel'/>
</cell>
<cell>
- <TuttiComputedOrNotDataEditor id='benthosTotalInertWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor id='benthosTotalInertWeightField'
+ genericType="Float" constructorParams='this'/>
</cell>
<cell>
<JLabel id='benthosTotalLivingNotItemizedWeightLabel'/>
</cell>
<cell>
- <TuttiComputedOrNotDataEditor
- id='benthosTotalLivingNotItemizedWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor id='benthosTotalLivingNotItemizedWeightField'
+ genericType="Float" constructorParams='this'/>
</cell>
</row>
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -27,6 +27,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.swing.computable.ComputableDataTableCell;
import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
@@ -67,7 +68,6 @@
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentCellRenderer;
import fr.ifremer.tutti.ui.swing.util.comment.CommentCellEditor;
import fr.ifremer.tutti.ui.swing.util.comment.CommentCellRenderer;
-import fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataTableCell;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel;
import jaxx.runtime.SwingUtil;
@@ -750,9 +750,9 @@
{ // Weight column
addColumnToModel(columnModel,
- TuttiComputedOrNotDataTableCell.newEditor(
+ ComputableDataTableCell.newEditor(
Float.class, weightUnit, computedDataColor),
- TuttiComputedOrNotDataTableCell.newRender(
+ ComputableDataTableCell.newRender(
defaultRenderer, weightUnit, computedDataColor),
BenthosBatchTableModel.WEIGHT,
weightUnit);
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -30,8 +30,8 @@
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode;
-import fr.ifremer.tutti.ui.swing.util.TabContentModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
+import fr.ifremer.shared.application.swing.tab.TabContentModel;
+import fr.ifremer.shared.application.swing.computable.ComputableData;
import org.apache.commons.collections.CollectionUtils;
import static org.nuiton.i18n.I18n.n_;
@@ -179,7 +179,7 @@
catchesUIModel.setBenthosTotalComputedWeight(speciesTotalComputedWeight);
}
- public TuttiComputedOrNotData<Float> getBenthosTotalSortedComputedOrNotWeight() {
+ public ComputableData<Float> getBenthosTotalSortedComputedOrNotWeight() {
return catchesUIModel.getBenthosTotalSortedComputedOrNotWeight();
}
@@ -215,7 +215,7 @@
catchesUIModel.setBenthosTotalSampleSortedComputedWeight(speciesTotalSampleSortedComputedWeight);
}
- public TuttiComputedOrNotData<Float> getBenthosTotalInertComputedOrNotWeight() {
+ public ComputableData<Float> getBenthosTotalInertComputedOrNotWeight() {
return catchesUIModel.getBenthosTotalInertComputedOrNotWeight();
}
@@ -235,7 +235,7 @@
catchesUIModel.setBenthosTotalInertComputedWeight(speciesTotalInertComputedWeight);
}
- public TuttiComputedOrNotData<Float> getBenthosTotalLivingNotItemizedComputedOrNotWeight() {
+ public ComputableData<Float> getBenthosTotalLivingNotItemizedComputedOrNotWeight() {
return catchesUIModel.getBenthosTotalLivingNotItemizedComputedOrNotWeight();
}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/CreateBenthosMelagAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/CreateBenthosMelagAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/CreateBenthosMelagAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,197 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.Maps;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.frequency.BenthosFrequencyRowModel;
-import fr.ifremer.shared.application.type.WeightUnit;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.species.EnterMelagWeightDialog;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.lang3.StringUtils;
-
-import javax.swing.JOptionPane;
-import java.awt.Frame;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0.2
- */
-public class CreateBenthosMelagAction extends AbstractTuttiAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
-
- protected Map<BenthosBatchRowModel, Float> selectedRows = Maps.newHashMap();
-
- protected Float melagWeight = null;
-
- protected Float sampleMelagWeight = null;
-
- protected Float sortedWeight = null;
-
- /**
- * Weight unit.
- *
- * @since 2.5
- */
- protected final WeightUnit weightUnit;
-
- public CreateBenthosMelagAction(BenthosBatchUIHandler handler) {
- super(handler, false);
- weightUnit = getConfig().getBenthosWeightUnit();
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- int[] selectedRowIndexes = SwingUtil.getSelectedModelRows(handler.getTable());
-
- BenthosBatchTableModel tableModel = handler.getTableModel();
-
- // sum of the weights already entered by the user
- Float alreadyKnownWeights = 0f;
- sortedWeight = 0f;
-
- for (int selectedRowIndex : selectedRowIndexes) {
- BenthosBatchRowModel selectedRow =
- tableModel.getEntry(selectedRowIndex);
-
- Float sampleWeight = null;
- if (selectedRow.getFinestCategory().getNotNullWeight() != null) {
- alreadyKnownWeights += selectedRow.getFinestCategory().getNotNullWeight();
-
- } else if (selectedRow.getWeight() != null) {
- sampleWeight = selectedRow.getWeight();
-
- } else {
- sampleWeight = 0f;
- if (selectedRow.getFrequency() != null) {
- for (BenthosFrequencyRowModel frequency : selectedRow.getFrequency()) {
- if (frequency.getWeight() == null) {
- sampleWeight = 0f;
- break;
- }
- sampleWeight += frequency.getWeight();
- }
- }
- }
-
- if (sampleWeight != null) {
- if (sampleWeight == 0f) {
- JOptionPane.showMessageDialog(
- getUI(),
- _("tutti.createBenthosMelag.error.message", selectedRowIndex + 1),
- _("tutti.createBenthosMelag.error.title"),
- JOptionPane.ERROR_MESSAGE);
-
- SwingUtil.setSelectionInterval(handler.getTable(), selectedRowIndex);
- result = false;
- break;
-
- } else {
- sortedWeight += sampleWeight;
- }
- }
-
- selectedRows.put(selectedRow, sampleWeight);
- }
-
- if (result) {
- melagWeight = openMelagWeightDialog();
-
- if (melagWeight != null) {
- // substract the weights that the user already entered
- // they must not be used to compute the other weights
- sampleMelagWeight = melagWeight - alreadyKnownWeights;
- }
- }
-
- return result && melagWeight != null;
- }
-
- protected Float openMelagWeightDialog() {
- Frame frame = SwingUtil.getParentContainer(getUI(), Frame.class);
-
- EnterMelagWeightDialog dialog = new EnterMelagWeightDialog(
- frame, getConfig().getShortcutClosePopup());
- dialog.setWeightUnit(weightUnit);
- SwingUtil.center(frame, dialog);
- dialog.pack();
- dialog.setVisible(true);
-
- Float result = null;
- if (dialog.getEditor().getModel() != null) {
- result = dialog.getEditor().getModel().floatValue();
- }
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
- String unitLabel = weightUnit.getShortLabel();
- String melagComment = _("tutti.createBenthosMelag.comment.part1") + "\n";
- for (BenthosBatchRowModel batch : selectedRows.keySet()) {
- Float sampleWeight = selectedRows.get(batch);
- if (sampleWeight != null) {
- Float weight = sampleMelagWeight * sampleWeight / sortedWeight;
- batch.getFinestCategory().setCategoryWeight(weight);
- }
- melagComment += _("tutti.createBenthosMelag.comment.part2", sampleWeight, unitLabel, decorate(batch.getSpecies())) + "\n";
- }
- melagComment += _("tutti.createBenthosMelag.comment.part3", melagWeight, unitLabel);
-
- for (BenthosBatchRowModel batch : selectedRows.keySet()) {
- String comment = batch.getComment();
- if (StringUtils.isBlank(comment)) {
- comment = "";
-
- } else {
- comment += "\n";
- }
- comment += melagComment;
- batch.setComment(comment);
- }
- getHandler().saveRows(selectedRows.keySet());
- }
-
- @Override
- public void releaseAction() {
- super.releaseAction();
- //FIXME-TC No release action is not design to refresh ui...
-// getHandler().getTable().repaint();
- selectedRows.clear();
- melagWeight = null;
- sortedWeight = null;
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- getHandler().getTable().repaint();
-
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ExportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ExportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ExportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,71 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractExportMultiPostAction;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public class ExportMultiPostAction extends AbstractExportMultiPostAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
-
- public ExportMultiPostAction(BenthosBatchUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected String getFileExtension() {
- return "tuttiBenthos";
- }
-
- @Override
- protected String getFileExtensionDescription() {
- return _("tutti.common.file.tuttiBenthos");
- }
-
- @Override
- protected String getFileChooserTitle() {
- return _("tutti.editBenthosBatch.action.exportMultiPost.destinationFile.title");
- }
-
- @Override
- protected String getFileChooserButton() {
- return _("tutti.editBenthosBatch.action.exportMultiPost.destinationFile.button");
- }
-
- @Override
- public void doAction() throws Exception {
- multiPostImportExportService.exportBenthos(file, currentOperation);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.editBenthosBatch.action.exportMultiPost.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ImportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ImportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/ImportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,126 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.service.catches.multipost.MultiPostImportService;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractImportMultiPostAction;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.MultiPostImportLogDialog;
-
-import javax.swing.JTextArea;
-import java.awt.Dialog;
-import java.util.Collection;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public class ImportMultiPostAction extends AbstractImportMultiPostAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
-
- protected Map<String, Object> notImportedData;
-
- public ImportMultiPostAction(BenthosBatchUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected String getFileExtension() {
- return "tuttiBenthos";
- }
-
- @Override
- protected String getFileExtensionDescription() {
- return _("tutti.common.file.tuttiBenthos");
- }
-
- @Override
- protected String getFileChooserTitle() {
- return _("tutti.editBenthosBatch.action.importMultiPost.sourceFile.title");
- }
-
- @Override
- protected String getFileChooserButton() {
- return _("tutti.editBenthosBatch.action.importMultiPost.sourceFile.button");
- }
-
- @Override
- public void releaseAction() {
- notImportedData = null;
- super.releaseAction();
- }
-
- @Override
- protected void importBatches(FishingOperation operation) {
- notImportedData = multiPostImportExportService.importBenthos(file, operation);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- if (!notImportedData.isEmpty()) {
- MultiPostImportLogDialog dialog = new MultiPostImportLogDialog((Dialog) getContext().getActionUI());
-
- Collection<BenthosBatch> notImportedBenthosBatches =
- (Collection<BenthosBatch>) notImportedData.get(MultiPostImportService.BATCHES_KEY);
-
- StringBuffer stringBuffer = new StringBuffer();
- Float totalSortedWeight = (Float) notImportedData.get(CatchBatch.PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT);
- if (totalSortedWeight != null) {
- stringBuffer.append("- " + _("tutti.multiPostImportLog.totalSortedWeight", totalSortedWeight) + "\n");
- }
-
- Float inertWeight = (Float) notImportedData.get(CatchBatch.PROPERTY_BENTHOS_TOTAL_INERT_WEIGHT);
- if (inertWeight != null) {
- stringBuffer.append("- " + _("tutti.multiPostImportLog.inertWeight", inertWeight) + "\n");
- }
-
- Float livingNotItemizedWeight =
- (Float) notImportedData.get(CatchBatch.PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT);
- if (livingNotItemizedWeight != null) {
- stringBuffer.append("- " + _("tutti.multiPostImportLog.livingNotItemizedWeight", livingNotItemizedWeight) + "\n");
- }
-
- for (BenthosBatch sb : notImportedBenthosBatches) {
- stringBuffer.append("- " + decorate(sb.getSpecies()) + " / " + decorate(sb.getSampleCategoryValue()) + "\n");
- }
-
- if (stringBuffer.length() > 0) {
- JTextArea batchList = dialog.getBatchList();
- batchList.setText(stringBuffer.toString());
- dialog.setSize(400, 300);
- dialog.setLocationRelativeTo(getContext().getMainUI());
- dialog.setVisible(true);
- }
- }
-
- sendMessage(_("tutti.editBenthosBatch.action.importMultiPost.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,141 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.SwingUtil;
-import org.jdesktop.swingx.JXTable;
-
-import javax.swing.JOptionPane;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To remove a species batch and all his children.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class RemoveBenthosBatchAction extends AbstractTuttiAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
-
- /**
- * Selected row to treat.
- *
- * @since 2.8
- */
- protected int rowIndex;
-
- /**
- * Rows to delete after all.
- *
- * @since 3.0-rc-1
- */
- protected Set<BenthosBatchRowModel> rowToRemove;
-
- public RemoveBenthosBatchAction(BenthosBatchUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- rowIndex = -1;
-
- if (result) {
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- _("tutti.editBenthosBatch.action.removeBatch.confirm.message"),
- _("tutti.editBenthosBatch.action.removeBatch.confirm.title"),
- JOptionPane.YES_NO_OPTION);
- result = answer == JOptionPane.YES_OPTION;
- }
-
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
-
- TuttiPersistence persistenceService =
- getContext().getPersistenceService();
-
- JXTable table = handler.getTable();
-
- rowIndex = SwingUtil.getSelectedModelRow(table);
-
- Preconditions.checkState(rowIndex != -1,
- "Cant remove batch if no batch selected");
-
- BenthosBatchTableModel tableModel = handler.getTableModel();
- BenthosBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
-
- Preconditions.checkState(!TuttiEntities.isNew(selectedBatch),
- "Can't remove batch if batch is not persisted");
-
- // remove selected batch and all his children
-
- // remove parent batch (will destroy all his childs from db)
- persistenceService.deleteBenthosBatch(selectedBatch.getId());
-
- if (selectedBatch.isBatchRoot()) {
- // update speciesUsed
- handler.removeFromSpeciesUsed(selectedBatch);
- } else {
-
- // remove from his parent
- BenthosBatchRowModel parentBatch = selectedBatch.getParentBatch();
- parentBatch.getChildBatch().remove(selectedBatch);
- }
-
- // collect of rows to remove from model
- rowToRemove = Sets.newHashSet();
- rowToRemove.add(selectedBatch);
-
- handler.collectChildren(selectedBatch, rowToRemove);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- JXTable table = handler.getTable();
-
- // remove all rows from the model
- getModel().getRows().removeAll(rowToRemove);
-
- // refresh table from parent batch row index to the end
- handler.getTableModel().fireTableDataChanged();
-
- // select parent batch row
- TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosSubBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosSubBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RemoveBenthosSubBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,136 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.SwingUtil;
-import org.jdesktop.swingx.JXTable;
-
-import javax.swing.JOptionPane;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To remove a species batch children.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class RemoveBenthosSubBatchAction extends AbstractTuttiAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
-
- /**
- * Selected row to treat.
- *
- * @since 2.8
- */
- protected int rowIndex;
-
- /**
- * Rows to delete after all.
- *
- * @since 3.0-rc-1
- */
- protected Set<BenthosBatchRowModel> rowToRemove;
-
- /**
- * Parent batch of rows to delete.
- *
- * @since 3.0-rc-1
- */
- protected BenthosBatchRowModel parentBatch;
-
- public RemoveBenthosSubBatchAction(BenthosBatchUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- rowIndex = -1;
-
- if (result) {
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- _("tutti.editBenthosBatch.action.removeSubBatch.confirm.message"),
- _("tutti.editBenthosBatch.action.removeSubBatch.confirm.title"),
- JOptionPane.YES_NO_OPTION);
- result = answer == JOptionPane.YES_OPTION;
- }
-
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
-
- TuttiPersistence persistenceService =
- getContext().getPersistenceService();
-
- JXTable table = handler.getTable();
-
- rowIndex = SwingUtil.getSelectedModelRow(table);
-
- Preconditions.checkState(rowIndex != -1,
- "Cant remove sub batch if no batch selected");
-
- parentBatch = handler.getTableModel().getEntry(rowIndex);
-
- Preconditions.checkState(!TuttiEntities.isNew(parentBatch),
- "Can't remove sub batch if batch is not persisted");
-
- // save parent batch (will destroy all his childs from db)
- persistenceService.deleteSpeciesSubBatch(parentBatch.getId());
-
- // collect of rows to remove from model
- rowToRemove = Sets.newHashSet();
-
- handler.collectChildren(parentBatch, rowToRemove);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- JXTable table = handler.getTable();
-
- // remove all rows from the model
- getModel().getRows().removeAll(rowToRemove);
-
- // remove childs from parent batch
- parentBatch.setChildBatch(null);
-
- // refresh table from parent batch row index to the end
- handler.getTableModel().fireTableDataChanged();
-
- // select parent batch row
- TuttiUIUtil.selectFirstCellOnRow(table, rowIndex, true);
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RenameBenthosBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RenameBenthosBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RenameBenthosBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,120 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.SampleCategory;
-import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.SwingUtil;
-import org.jdesktop.swingx.JXTable;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To rename the species for a species batch and all his children.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class RenameBenthosBatchAction extends AbstractTuttiAction<BenthosBatchUIModel, BenthosBatchUI, BenthosBatchUIHandler> {
-
- protected Species selectedSpecies;
-
- public RenameBenthosBatchAction(BenthosBatchUIHandler handler) {
- super(handler, false);
-
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- BenthosBatchTableModel tableModel = handler.getTableModel();
- JXTable table = handler.getTable();
- int selectedRowIndex = SwingUtil.getSelectedModelRow(table);
- BenthosBatchRowModel row = tableModel.getEntry(selectedRowIndex);
-
- BenthosBatchUIModel model = handler.getModel();
- List<Species> speciesList = Lists.newArrayList(
- getDataContext().getReferentBenthosWithSurveyCode());
- SampleCategory<?> firstSampleCategory = row.getFirstSampleCategory();
- Serializable categoryValue = firstSampleCategory.getCategoryValue();
- speciesList.removeAll(
- model.getSpeciesUsed().get(
- (CaracteristicQualitativeValue) categoryValue));
-
- selectedSpecies = getHandler().openAddSpeciesDialog(
- _("tutti.selectSpecies.title"),
- speciesList
- );
-
- result &= selectedSpecies != null;
- return result;
- }
-
- @Override
- public void releaseAction() {
- selectedSpecies = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
-
- BenthosBatchTableModel tableModel = handler.getTableModel();
- JXTable table = handler.getTable();
- int selectedRowIndex = SwingUtil.getSelectedModelRow(table);
- BenthosBatchRowModel row = tableModel.getEntry(selectedRowIndex);
-
- PersistenceService persistenceService = getContext().getPersistenceService();
- persistenceService.changeBenthosBatchSpecies(row.getId(), selectedSpecies);
-
- SampleCategory<?> firstSampleCategory = row.getFirstSampleCategory();
- Serializable categoryValue = firstSampleCategory.getCategoryValue();
- Collection<Species> speciesUsed = getModel().getSpeciesUsed()
- .get((CaracteristicQualitativeValue) categoryValue);
- speciesUsed.remove(row.getSpecies());
- changeChildrenSpecies(row, selectedSpecies);
- speciesUsed.add(selectedSpecies);
- }
-
- protected void changeChildrenSpecies(BenthosBatchRowModel row,
- Species species) {
- row.setSpecies(species);
- List<BenthosBatchRowModel> children = row.getChildBatch();
- if (children != null) {
- for (BenthosBatchRowModel child : children) {
- changeChildrenSpecies(child, species);
- }
- }
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -139,7 +139,7 @@
text: "tutti.createBenthosBatch.action.addSpecies";
toolTipText: "tutti.createBenthosBatch.action.addSpecies.tip";
i18nMnemonic: "tutti.createBenthosBatch.action.addSpecies.mnemonic";
- _applicationAction: {SelectSpeciesForBenthosBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SelectSpeciesForBenthosBatchAction.class};
_help: {"tutti.createBenthosBatch.action.addSpecies.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -41,7 +41,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.split.SplitBenthosBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.split.SplitBenthosBatchTableModel;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.shared.application.type.WeightUnit;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/SelectSpeciesForBenthosBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/SelectSpeciesForBenthosBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/SelectSpeciesForBenthosBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,101 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.create;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.Species;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-
-import java.util.List;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Enable to select a species to the species selected in the protocol.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0
- */
-public class SelectSpeciesForBenthosBatchAction extends AbstractTuttiAction<CreateBenthosBatchUIModel, CreateBenthosBatchUI, CreateBenthosBatchUIHandler> {
-
- protected List<Species> allSpecies;
-
- protected List<Species> referentSpecies;
-
- protected Species selectedSpecies;
-
- public SelectSpeciesForBenthosBatchAction(CreateBenthosBatchUIHandler handler) {
- super(handler, false);
-
- allSpecies = getDataContext().getSpecies();
- referentSpecies = getDataContext().getReferentSpecies();
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean canContinue = super.prepareAction();
- if (canContinue) {
-
- CreateBenthosBatchUIModel model = getModel();
-
- List<Species> species = Lists.newArrayList(allSpecies);
- species.removeAll(model.getAvailableSpecies());
-
- selectedSpecies = getHandler().openAddSpeciesDialog(
- _("tutti.selectSpecies.title"), species);
- canContinue = selectedSpecies != null;
- }
- return canContinue;
- }
-
- @Override
- public void doAction() throws Exception {
-
- CreateBenthosBatchUIModel model = getModel();
-
- List<Species> availableSpecies = Lists.newArrayList(model.getAvailableSpecies());
-
- if (!selectedSpecies.isReferenceTaxon()) {
- String decoratedSynonym = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
- List<Species> referents = referentSpecies;
- Map<String, Species> referentsById = TuttiEntities.splitByTaxonId(referents);
- String taxonId = String.valueOf(selectedSpecies.getReferenceTaxonId());
- selectedSpecies = referentsById.get(taxonId);
- String decoratedReferent = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
- sendMessage(_("tutti.flash.info.species.replaced", decoratedSynonym, decoratedReferent));
- }
-
- if (!availableSpecies.contains(selectedSpecies)) {
- availableSpecies.add(selectedSpecies);
- }
- model.setAvailableSpecies(availableSpecies);
- model.setSpecies(selectedSpecies);
-
- }
-
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchTableModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
+import fr.ifremer.shared.application.swing.computable.ComputableData;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import jaxx.runtime.SwingUtil;
@@ -79,7 +79,7 @@
this.computedDataColor = computedDataColor;
}
- public void setComputedOrNotText(TuttiComputedOrNotData<Integer> data) {
+ public void setComputedOrNotText(ComputableData<Integer> data) {
String text;
if (data != null && data.getData() != null) {
@@ -303,7 +303,7 @@
if (log.isDebugEnabled()) {
log.debug("Set columnIdentifier (" + column + ") :: " + columnIdentifier.getPropertyName());
}
- TuttiComputedOrNotData<Integer> data = (TuttiComputedOrNotData<Integer>) value;
+ ComputableData<Integer> data = (ComputableData<Integer>) value;
component.setComputedOrNotText(data);
rowIndex = row;
@@ -357,7 +357,7 @@
int column) {
component.setForeground(Color.BLACK);
- TuttiComputedOrNotData<Integer> data = (TuttiComputedOrNotData<Integer>) value;
+ ComputableData<Integer> data = (ComputableData<Integer>) value;
BenthosFrequencyCellComponent result =
(BenthosFrequencyCellComponent) component.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -38,7 +38,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -36,7 +36,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ExportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ExportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ExportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,72 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractExportMultiPostAction;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public class ExportMultiPostAction
- extends AbstractExportMultiPostAction<IndividualObservationBatchUIModel, IndividualObservationBatchUI, IndividualObservationBatchUIHandler> {
-
- public ExportMultiPostAction(IndividualObservationBatchUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected String getFileExtension() {
- return "tuttiIndividualObservation";
- }
-
- @Override
- protected String getFileExtensionDescription() {
- return _("tutti.common.file.tuttiIndividualObservation");
- }
-
- @Override
- protected String getFileChooserTitle() {
- return _("tutti.editIndividualObservationBatch.action.exportMultiPost.destinationFile.title");
- }
-
- @Override
- protected String getFileChooserButton() {
- return _("tutti.editIndividualObservationBatch.action.exportMultiPost.destinationFile.button");
- }
-
- @Override
- public void doAction() throws Exception {
- multiPostImportExportService.exportIndividualObservation(file, currentOperation);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.editIndividualObservationBatch.action.exportMultiPost.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ImportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ImportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/ImportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,74 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.content.operation.catches.AbstractImportMultiPostAction;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public class ImportMultiPostAction
- extends AbstractImportMultiPostAction<IndividualObservationBatchUIModel, IndividualObservationBatchUI, IndividualObservationBatchUIHandler> {
-
- public ImportMultiPostAction(IndividualObservationBatchUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected String getFileExtension() {
- return "tuttiIndividualObservation";
- }
-
- @Override
- protected String getFileExtensionDescription() {
- return _("tutti.common.file.tuttiIndividualObservation");
- }
-
- @Override
- protected String getFileChooserTitle() {
- return _("tutti.editIndividualObservationBatch.action.importMultiPost.sourceFile.title");
- }
-
- @Override
- protected String getFileChooserButton() {
- return _("tutti.editIndividualObservationBatch.action.importMultiPost.sourceFile.button");
- }
-
- @Override
- protected void importBatches(FishingOperation operation) {
- multiPostImportExportService.importIndividualObservation(file, operation);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- sendMessage(_("tutti.editIndividualObservationBatch.action.importMultiPost.success", file));
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -48,7 +48,7 @@
text: "tutti.editIndividualObservationBatch.action.importMultiPost";
toolTipText: "tutti.editIndividualObservationBatch.action.importMultiPost.tip";
i18nMnemonic: "tutti.editIndividualObservationBatch.action.importMultiPost.mnemonic";
- _applicationAction: {ImportMultiPostAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportIndividualObservationMultiPostAction.class};
_help: {"tutti.editIndividualObservationBatch.action.importMultiPost.help"};
}
@@ -57,7 +57,7 @@
text: "tutti.editIndividualObservationBatch.action.exportMultiPost";
toolTipText: "tutti.editIndividualObservationBatch.action.exportMultiPost.tip";
i18nMnemonic: "tutti.editIndividualObservationBatch.action.exportMultiPost.mnemonic";
- _applicationAction: {ExportMultiPostAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportIndividualObservationMultiPostAction.class};
_help: {"tutti.editIndividualObservationBatch.action.exportMultiPost.help"};
}
@@ -74,7 +74,7 @@
text: "tutti.editIndividualObservationBatch.action.removeBatch";
toolTipText: "tutti.editIndividualObservationBatch.action.removeBatch.tip";
i18nMnemonic: "tutti.editIndividualObservationBatch.action.removeBatch.mnemonic";
- _applicationAction: {RemoveIndividualObservationBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RemoveIndividualObservationBatchAction.class};
enabled: {model.isRemoveBatchEnabled()};
_help: {"tutti.editIndividualObservationBatch.action.removeBatch.help"};
}
@@ -84,7 +84,7 @@
text: "tutti.editIndividualObservationBatch.action.removeAllBatch";
toolTipText: "tutti.editIndividualObservationBatch.action.removeAllBatch.tip";
i18nMnemonic: "tutti.editIndividualObservationBatch.action.removeAllBatch.mnemonic";
- _applicationAction: {RemoveAllIndividualObservationBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RemoveAllIndividualObservationBatchAction.class};
enabled: {model.isRemoveBatchEnabled()};
_help: {"tutti.editIndividualObservationBatch.action.removeAllBatch.help"};
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -28,7 +28,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.util.TabContentModel;
+import fr.ifremer.shared.application.swing.tab.TabContentModel;
import org.apache.commons.collections.CollectionUtils;
import java.util.List;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/RemoveAllIndividualObservationBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/RemoveAllIndividualObservationBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/RemoveAllIndividualObservationBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,153 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-
-import javax.swing.JOptionPane;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Created on 10/3/13.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 2.7
- */
-public class RemoveAllIndividualObservationBatchAction
- extends AbstractTuttiAction<IndividualObservationBatchUIModel, IndividualObservationBatchUI, IndividualObservationBatchUIHandler> {
-
- private static final Log log =
- LogFactory.getLog(RemoveAllIndividualObservationBatchAction.class);
-
- public RemoveAllIndividualObservationBatchAction(IndividualObservationBatchUIHandler handler) {
- super(handler, false);
- }
-
- protected Species species;
-
- protected List<Integer> rowIndexToRemove;
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- rowIndexToRemove = null;
- species = null;
-
- int rowIndex = -1;
-
- if (result) {
- JXTable table = handler.getTable();
-
- rowIndex = table.getSelectedRow();
-
- Preconditions.checkState(rowIndex != -1,
- "Cant remove batch if none is selected");
- }
-
- if (result) {
-
- IndividualObservationBatchTableModel tableModel = handler.getTableModel();
-
- IndividualObservationBatchRowModel entry = tableModel.getEntry(rowIndex);
-
- species = entry.getSpecies();
-
- rowIndexToRemove = Lists.newArrayList();
-
- for (IndividualObservationBatchRowModel rowModel : tableModel.getRows()) {
- if (species.equals(rowModel.getSpecies())) {
- rowIndexToRemove.add(0, tableModel.getRowIndex(rowModel));
- }
- }
-
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- _("tutti.editIndividualObservationBatch.action.removeAllBatch.confirm.message", rowIndexToRemove.size(), decorate(species)),
- _("tutti.editIndividualObservationBatch.action.removeAllBatch.confirm.title"),
- JOptionPane.YES_NO_OPTION);
- result = answer == JOptionPane.YES_OPTION;
- }
-
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
-
- Preconditions.checkNotNull(rowIndexToRemove);
- Preconditions.checkNotNull(species);
-
- IndividualObservationBatchTableModel tableModel = handler.getTableModel();
-
- for (Integer rowIndex : rowIndexToRemove) {
- IndividualObservationBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
-
- boolean persisted = !TuttiEntities.isNew(selectedBatch);
-
- if (persisted) {
-
- // remove it from db
-
- String id = selectedBatch.getId();
-
- if (log.isInfoEnabled()) {
- log.info("Remove individual observation with id: " + id);
- }
-
- TuttiPersistence persistenceService =
- getContext().getPersistenceService();
-
- persistenceService.deleteIndividualObservationBatch(id);
- }
- }
-
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- JXTable table = handler.getTable();
-
- IndividualObservationBatchTableModel tableModel = handler.getTableModel();
-
- for (Integer rowIndex : rowIndexToRemove) {
- tableModel.removeRow(rowIndex);
- }
-
- TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/RemoveIndividualObservationBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/RemoveIndividualObservationBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/RemoveIndividualObservationBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,113 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation;
-
-/*
- * #%L
- * Tutti :: UI
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-
-import javax.swing.JOptionPane;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.4
- */
-public class RemoveIndividualObservationBatchAction
- extends AbstractTuttiAction<IndividualObservationBatchUIModel, IndividualObservationBatchUI, IndividualObservationBatchUIHandler> {
-
- private static final Log log =
- LogFactory.getLog(RemoveIndividualObservationBatchAction.class);
-
- public RemoveIndividualObservationBatchAction(IndividualObservationBatchUIHandler handler) {
- super(handler, false);
- }
-
- int rowIndex;
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- if (result) {
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- _("tutti.editIndividualObservationBatch.action.removeBatch.confirm.message"),
- _("tutti.editIndividualObservationBatch.action.removeBatch.confirm.title"),
- JOptionPane.YES_NO_OPTION);
- result = answer == JOptionPane.YES_OPTION;
- }
-
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
-
- JXTable table = handler.getTable();
-
- rowIndex = table.getSelectedRow();
-
- Preconditions.checkState(rowIndex != -1,
- "Cant remove batch if none is selected");
-
- IndividualObservationBatchTableModel tableModel = handler.getTableModel();
- IndividualObservationBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
-
- boolean persisted = !TuttiEntities.isNew(selectedBatch);
-
- if (persisted) {
-
- // remove it from db
-
- String id = selectedBatch.getId();
-
- if (log.isInfoEnabled()) {
- log.info("Remove individual observation with id: " + id);
- }
-
- TuttiPersistence persistenceService =
- getContext().getPersistenceService();
-
- persistenceService.deleteIndividualObservationBatch(id);
- }
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- JXTable table = handler.getTable();
-
- IndividualObservationBatchTableModel tableModel = handler.getTableModel();
-
- tableModel.removeRow(rowIndex);
-
- TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -98,7 +98,7 @@
text: "tutti.createIndividualObservationBatch.action.addSpecies";
toolTipText: "tutti.createIndividualObservationBatch.action.addSpecies.tip";
i18nMnemonic: "tutti.createIndividualObservationBatch.action.addSpecies.mnemonic";
- _applicationAction: {SelectSpeciesForIndividualObservationBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SelectSpeciesForIndividualObservationBatchAction.class};
_help: {"tutti.createIndividualObservationBatch.action.addSpecies.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -40,7 +40,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/SelectSpeciesForIndividualObservationBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/SelectSpeciesForIndividualObservationBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/SelectSpeciesForIndividualObservationBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,103 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.create;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.Species;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-
-import java.util.List;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Enable to select a species to the species selected in the protocol.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.0
- */
-public class SelectSpeciesForIndividualObservationBatchAction extends AbstractTuttiAction<CreateIndividualObservationBatchUIModel,
- CreateIndividualObservationBatchUI,
- CreateIndividualObservationBatchUIHandler> {
-
- protected List<Species> allSpecies;
-
- protected List<Species> referentSpecies;
-
- protected Species selectedSpecies;
-
- public SelectSpeciesForIndividualObservationBatchAction(CreateIndividualObservationBatchUIHandler handler) {
- super(handler, false);
-
- allSpecies = getDataContext().getSpecies();
- referentSpecies = getDataContext().getReferentSpecies();
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean canContinue = super.prepareAction();
- if (canContinue) {
-
- CreateIndividualObservationBatchUIModel model = getModel();
-
- List<Species> species = Lists.newArrayList(allSpecies);
- species.removeAll(model.getAvailableSpecies());
-
- selectedSpecies = getHandler().openAddSpeciesDialog(
- _("tutti.selectSpecies.title"), species);
- canContinue = selectedSpecies != null;
- }
- return canContinue;
- }
-
- @Override
- public void doAction() throws Exception {
-
- CreateIndividualObservationBatchUIModel model = getModel();
-
- List<Species> availableSpecies = Lists.newArrayList(model.getAvailableSpecies());
-
- if (!selectedSpecies.isReferenceTaxon()) {
- String decoratedSynonym = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
- List<Species> referents = referentSpecies;
- Map<String, Species> referentsById = TuttiEntities.splitByTaxonId(referents);
- String taxonId = String.valueOf(selectedSpecies.getReferenceTaxonId());
- selectedSpecies = referentsById.get(taxonId);
- String decoratedReferent = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
- sendMessage(_("tutti.flash.info.species.replaced", decoratedSynonym, decoratedReferent));
- }
-
- if (!availableSpecies.contains(selectedSpecies)) {
- availableSpecies.add(selectedSpecies);
- }
- model.setAvailableSpecies(availableSpecies);
- model.setSpecies(selectedSpecies);
-
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ExportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ExportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ExportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,71 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractExportMultiPostAction;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public class ExportMultiPostAction extends AbstractExportMultiPostAction<MarineLitterBatchUIModel, MarineLitterBatchUI, MarineLitterBatchUIHandler> {
-
- public ExportMultiPostAction(MarineLitterBatchUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected String getFileExtension() {
- return "tuttiMarineLitter";
- }
-
- @Override
- protected String getFileExtensionDescription() {
- return _("tutti.common.file.tuttiMarineLitter");
- }
-
- @Override
- protected String getFileChooserTitle() {
- return _("tutti.editMarineLitterBatch.action.exportMultiPost.destinationFile.title");
- }
-
- @Override
- protected String getFileChooserButton() {
- return _("tutti.editMarineLitterBatch.action.exportMultiPost.destinationFile.button");
- }
-
- @Override
- public void doAction() throws Exception {
- multiPostImportExportService.exportMarineLitter(file, currentOperation);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.editMarineLitterBatch.action.exportMultiPost.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ImportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ImportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/ImportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,115 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.CatchBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch;
-import fr.ifremer.tutti.service.catches.multipost.MultiPostImportService;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractImportMultiPostAction;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.MultiPostImportLogDialog;
-
-import javax.swing.JTextArea;
-import java.awt.Dialog;
-import java.util.Collection;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public class ImportMultiPostAction extends AbstractImportMultiPostAction<MarineLitterBatchUIModel, MarineLitterBatchUI, MarineLitterBatchUIHandler> {
-
- protected Map<String, Object> notImportedData;
-
- public ImportMultiPostAction(MarineLitterBatchUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected String getFileExtension() {
- return "tuttiMarineLitter";
- }
-
- @Override
- protected String getFileExtensionDescription() {
- return _("tutti.common.file.tuttiMarineLitter");
- }
-
- @Override
- protected String getFileChooserTitle() {
- return _("tutti.editMarineLitterBatch.action.importMultiPost.sourceFile.title");
- }
-
- @Override
- protected String getFileChooserButton() {
- return _("tutti.editMarineLitterBatch.action.importMultiPost.sourceFile.button");
- }
-
- @Override
- public void releaseAction() {
- notImportedData = null;
- super.releaseAction();
- }
-
- @Override
- protected void importBatches(FishingOperation operation) {
- notImportedData = multiPostImportExportService.importMarineLitter(file, operation);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- if (!notImportedData.isEmpty()) {
- MultiPostImportLogDialog dialog = new MultiPostImportLogDialog((Dialog) getContext().getActionUI());
-
- Collection<MarineLitterBatch> notImportedMarineLitterBatches =
- (Collection<MarineLitterBatch>) notImportedData.get(MultiPostImportService.BATCHES_KEY);
-
- StringBuffer stringBuffer = new StringBuffer();
- Float totalWeight = (Float) notImportedData.get(CatchBatch.PROPERTY_MARINE_LITTER_TOTAL_WEIGHT);
- if (totalWeight != null) {
- stringBuffer.append("- " + _("tutti.multiPostImportLog.totalWeight", totalWeight) + "\n");
- }
-
- for (MarineLitterBatch mlb : notImportedMarineLitterBatches) {
- stringBuffer.append("- " + decorate(mlb.getMarineLitterCategory()) + " / " + decorate(mlb.getMarineLitterSizeCategory()) + "\n");
- }
-
- if (stringBuffer.length() > 0) {
- JTextArea batchList = dialog.getBatchList();
- batchList.setText(stringBuffer.toString());
- dialog.setSize(400, 300);
- dialog.setLocationRelativeTo(getContext().getMainUI());
- dialog.setVisible(true);
- }
- }
-
- sendMessage(_("tutti.editMarineLitterBatch.action.importMultiPost.success", file));
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -22,7 +22,7 @@
* #L%
*/
-TuttiComputedOrNotDataEditor {
+ComputableDataEditor {
autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
showReset: true;
@@ -71,7 +71,7 @@
text: "tutti.editMarineLitterBatch.action.importMultiPost";
toolTipText: "tutti.editMarineLitterBatch.action.importMultiPost.tip";
i18nMnemonic: "tutti.editMarineLitterBatch.action.importMultiPost.mnemonic";
- _applicationAction: {ImportMultiPostAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportMarineLitterMultiPostAction.class};
_help: {"tutti.editMarineLitterBatch.action.importMultiPost.help"};
}
@@ -80,7 +80,7 @@
text: "tutti.editMarineLitterBatch.action.exportMultiPost";
toolTipText: "tutti.editMarineLitterBatch.action.exportMultiPost.tip";
i18nMnemonic: "tutti.editMarineLitterBatch.action.exportMultiPost.mnemonic";
- _applicationAction: {ExportMultiPostAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportMarineLitterMultiPostAction.class};
_help: {"tutti.editMarineLitterBatch.action.exportMultiPost.help"};
}
@@ -98,7 +98,7 @@
text: "tutti.editMarineLitterBatch.action.removeBatch";
toolTipText: "tutti.editMarineLitterBatch.action.removeBatch.tip";
i18nMnemonic: "tutti.editMarineLitterBatch.action.removeBatch.mnemonic";
- _applicationAction: {RemoveMarineLitterBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RemoveMarineLitterBatchAction.class};
enabled: {model.isRemoveBatchEnabled()};
_help: {"tutti.editMarineLitterBatch.action.removeBatch.help"};
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx 2013-11-26 08:03:42 UTC (rev 1388)
@@ -29,7 +29,7 @@
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.util.TuttiUI
- fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataEditor
+ fr.ifremer.shared.application.swing.computable.ComputableDataEditor
org.jdesktop.swingx.JXTable
@@ -85,8 +85,8 @@
<JLabel id='marineLitterTotalWeightLabel'/>
</cell>
<cell weightx='1.0'>
- <TuttiComputedOrNotDataEditor id='marineLitterTotalWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor id='marineLitterTotalWeightField'
+ genericType="Float" constructorParams='this'/>
</cell>
</row>
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -26,7 +26,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.PropagatePropertyChangeListener;
+import fr.ifremer.shared.application.listener.PropagatePropertyChangeListener;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -28,8 +28,8 @@
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.util.TabContentModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
+import fr.ifremer.shared.application.swing.tab.TabContentModel;
+import fr.ifremer.shared.application.swing.computable.ComputableData;
import org.apache.commons.collections.CollectionUtils;
import static org.nuiton.i18n.I18n.n_;
@@ -58,7 +58,7 @@
EditCatchesUIModel.PROPERTY_BATCH_UPDATED);
}
- public TuttiComputedOrNotData<Float> getMarineLitterTotalComputedOrNotWeight() {
+ public ComputableData<Float> getMarineLitterTotalComputedOrNotWeight() {
return catchesUIModel.getMarineLitterTotalComputedOrNotWeight();
}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/RemoveMarineLitterBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/RemoveMarineLitterBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/RemoveMarineLitterBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,123 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.species.RemoveSpeciesSubBatchAction;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-
-import javax.swing.JOptionPane;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To remove a selected marine litter batch in the table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.3
- */
-public class RemoveMarineLitterBatchAction extends AbstractTuttiAction<MarineLitterBatchUIModel, MarineLitterBatchUI, MarineLitterBatchUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(RemoveMarineLitterBatchAction.class);
-
- protected RemoveSpeciesSubBatchAction removeSpeciesSubBatchAction;
-
- public RemoveMarineLitterBatchAction(MarineLitterBatchUIHandler handler) {
- super(handler, false);
- }
-
- int rowIndex;
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- if (result) {
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- _("tutti.editMarineLitterBatch.action.removeBatch.confirm.message"),
- _("tutti.editMarineLitterBatch.action.removeBatch.confirm.title"),
- JOptionPane.YES_NO_OPTION);
- result = answer == JOptionPane.YES_OPTION;
- }
-
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
-
- JXTable table = handler.getTable();
-
- rowIndex = table.getSelectedRow();
-
- Preconditions.checkState(rowIndex != -1,
- "Cant remove batch if none is selected");
-
- MarineLitterBatchTableModel tableModel = handler.getTableModel();
- MarineLitterBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
-
- boolean persisted = !TuttiEntities.isNew(selectedBatch);
-
- if (persisted) {
-
- // remove it from db
-
- String id = selectedBatch.getId();
-
- if (log.isInfoEnabled()) {
- log.info("Remove marineLitter with id: " + id);
- }
-
- TuttiPersistence persistenceService =
- getContext().getPersistenceService();
-
- persistenceService.deleteMarineLitterBatch(id);
- }
-
- // update speciesUsed
- handler.removeFromMarineLitterCategoriesUsed(selectedBatch);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- JXTable table = handler.getTable();
-
- MarineLitterBatchTableModel tableModel = handler.getTableModel();
-
- tableModel.removeRow(rowIndex);
-
- TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
- }
-}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -35,7 +35,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUIModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateSpeciesMelagAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateSpeciesMelagAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateSpeciesMelagAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,199 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.Maps;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyRowModel;
-import fr.ifremer.shared.application.type.WeightUnit;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.species.EnterMelagWeightDialog;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.lang3.StringUtils;
-
-import javax.swing.JOptionPane;
-import java.awt.Frame;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0.2
- */
-public class CreateSpeciesMelagAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
-
- protected Map<SpeciesBatchRowModel, Float> selectedRows = Maps.newHashMap();
-
- protected Float melagWeight = null;
-
- protected Float sampleMelagWeight = null;
-
- protected Float sortedWeight = null;
-
- /**
- * Weight unit.
- *
- * @since 2.5
- */
- protected final WeightUnit weightUnit;
-
- public CreateSpeciesMelagAction(SpeciesBatchUIHandler handler) {
- super(handler, false);
- weightUnit = getConfig().getSpeciesWeightUnit();
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- int[] selectedRowIndexes = SwingUtil.getSelectedModelRows(handler.getTable());
-
- SpeciesBatchTableModel tableModel = handler.getTableModel();
-
- // sum of the weights already entered by the user
- Float alreadyKnownWeights = 0f;
- sortedWeight = 0f;
-
- for (int selectedRowIndex : selectedRowIndexes) {
- SpeciesBatchRowModel selectedRow =
- tableModel.getEntry(selectedRowIndex);
-
- Float sampleWeight = null;
- if (selectedRow.getFinestCategory().getNotNullWeight() != null) {
- alreadyKnownWeights += selectedRow.getFinestCategory().getNotNullWeight();
-
- } else if (selectedRow.getWeight() != null) {
- sampleWeight = selectedRow.getWeight();
-
- } else {
- sampleWeight = 0f;
- if (selectedRow.getFrequency() != null) {
- for (SpeciesFrequencyRowModel frequency : selectedRow.getFrequency()) {
- if (frequency.getWeight() == null) {
- sampleWeight = 0f;
- break;
- }
- sampleWeight += frequency.getWeight();
- }
- }
- }
-
- if (sampleWeight != null) {
- if (sampleWeight == 0f) {
- JOptionPane.showMessageDialog(
- getUI(),
- _("tutti.createSpeciesMelag.error.message", selectedRowIndex + 1),
- _("tutti.createSpeciesMelag.error.title"),
- JOptionPane.ERROR_MESSAGE);
-
- SwingUtil.setSelectionInterval(handler.getTable(), selectedRowIndex);
- result = false;
- break;
-
- } else {
- sortedWeight += sampleWeight;
- }
- }
-
- selectedRows.put(selectedRow, sampleWeight);
- }
-
- if (result) {
- melagWeight = openMelagWeightDialog();
-
- if (melagWeight != null) {
- // substract the weights that the user already entered
- // they must not be used to compute the other weights
- sampleMelagWeight = melagWeight - alreadyKnownWeights;
- }
- }
-
- return result && melagWeight != null;
- }
-
- protected Float openMelagWeightDialog() {
- Frame frame = SwingUtil.getParentContainer(getUI(), Frame.class);
-
- EnterMelagWeightDialog dialog = new EnterMelagWeightDialog(
- frame, getConfig().getShortcutClosePopup());
-
- dialog.setWeightUnit(weightUnit);
-
- SwingUtil.center(frame, dialog);
- dialog.pack();
- dialog.setVisible(true);
-
- Float result = null;
- if (dialog.getEditor().getModel() != null) {
- result = dialog.getEditor().getModel().floatValue();
- }
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
- String unitLabel = weightUnit.getShortLabel();
- String melagComment = _("tutti.createSpeciesMelag.comment.part1")+"\n";
- for (SpeciesBatchRowModel batch : selectedRows.keySet()) {
- Float sampleWeight = selectedRows.get(batch);
- if (sampleWeight != null) {
- Float weight = sampleMelagWeight * sampleWeight / sortedWeight;
- batch.getFinestCategory().setCategoryWeight(weight);
- }
- melagComment += _("tutti.createSpeciesMelag.comment.part2", sampleWeight, unitLabel, decorate(batch.getSpecies()))+"\n";
- }
- melagComment += _("tutti.createSpeciesMelag.comment.part3", melagWeight, unitLabel);
-
- for (SpeciesBatchRowModel batch : selectedRows.keySet()) {
- String comment = batch.getComment();
- if (StringUtils.isBlank(comment)) {
- comment = "";
-
- } else {
- comment += "\n";
- }
- comment += melagComment;
- batch.setComment(comment);
- }
- getHandler().saveRows(selectedRows.keySet());
- }
-
- @Override
- public void releaseAction() {
- super.releaseAction();
- //FIXME-TC No release action is not design to refresh ui...
-// getHandler().getTable().repaint();
- selectedRows.clear();
- melagWeight = null;
- sortedWeight = null;
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- getHandler().getTable().repaint();
-
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ExportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ExportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ExportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,71 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractExportMultiPostAction;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public class ExportMultiPostAction extends AbstractExportMultiPostAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
-
- public ExportMultiPostAction(SpeciesBatchUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected String getFileExtension() {
- return "tuttiSpecies";
- }
-
- @Override
- protected String getFileExtensionDescription() {
- return _("tutti.common.file.tuttiSpecies");
- }
-
- @Override
- protected String getFileChooserTitle() {
- return _("tutti.editSpeciesBatch.action.exportMultiPost.destinationFile.title");
- }
-
- @Override
- protected String getFileChooserButton() {
- return _("tutti.editSpeciesBatch.action.exportMultiPost.destinationFile.button");
- }
-
- @Override
- public void doAction() throws Exception {
- multiPostImportExportService.exportSpecies(file, currentOperation);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.editSpeciesBatch.action.exportMultiPost.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportMultiPostAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportMultiPostAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,126 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.CatchBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.service.catches.multipost.MultiPostImportService;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.AbstractImportMultiPostAction;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.MultiPostImportLogDialog;
-
-import javax.swing.JTextArea;
-import java.awt.Dialog;
-import java.util.Collection;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 2.2
- */
-public class ImportMultiPostAction extends AbstractImportMultiPostAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
-
- protected Map<String, Object> notImportedData;
-
- public ImportMultiPostAction(SpeciesBatchUIHandler handler) {
- super(handler);
- }
-
- @Override
- protected String getFileExtension() {
- return "tuttiSpecies";
- }
-
- @Override
- protected String getFileExtensionDescription() {
- return _("tutti.common.file.tuttiSpecies");
- }
-
- @Override
- protected String getFileChooserTitle() {
- return _("tutti.editSpeciesBatch.action.importMultiPost.sourceFile.title");
- }
-
- @Override
- protected String getFileChooserButton() {
- return _("tutti.editSpeciesBatch.action.importMultiPost.sourceFile.button");
- }
-
- @Override
- public void releaseAction() {
- notImportedData = null;
- super.releaseAction();
- }
-
- @Override
- protected void importBatches(FishingOperation operation) {
- notImportedData = multiPostImportExportService.importSpecies(file, operation);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- if (!notImportedData.isEmpty()) {
- MultiPostImportLogDialog dialog = new MultiPostImportLogDialog((Dialog) getContext().getActionUI());
-
- Collection<SpeciesBatch> notImportedSpeciesBatches =
- (Collection<SpeciesBatch>) notImportedData.get(MultiPostImportService.BATCHES_KEY);
-
- StringBuffer stringBuffer = new StringBuffer();
- Float totalSortedWeight = (Float) notImportedData.get(CatchBatch.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT);
- if (totalSortedWeight != null) {
- stringBuffer.append("- " + _("tutti.multiPostImportLog.totalSortedWeight", totalSortedWeight) + "\n");
- }
-
- Float inertWeight = (Float) notImportedData.get(CatchBatch.PROPERTY_SPECIES_TOTAL_INERT_WEIGHT);
- if (inertWeight != null) {
- stringBuffer.append("- " + _("tutti.multiPostImportLog.inertWeight", inertWeight) + "\n");
- }
-
- Float livingNotItemizedWeight =
- (Float) notImportedData.get(CatchBatch.PROPERTY_SPECIES_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT);
- if (livingNotItemizedWeight != null) {
- stringBuffer.append("- " + _("tutti.multiPostImportLog.livingNotItemizedWeight", livingNotItemizedWeight) + "\n");
- }
-
- for (SpeciesBatch sb : notImportedSpeciesBatches) {
- stringBuffer.append("- " + decorate(sb.getSpecies()) + " / " + decorate(sb.getSampleCategoryValue()) + "\n");
- }
-
- if (stringBuffer.length() > 0) {
- JTextArea batchList = dialog.getBatchList();
- batchList.setText(stringBuffer.toString());
- dialog.setSize(400, 300);
- dialog.setLocationRelativeTo(getContext().getMainUI());
- dialog.setVisible(true);
- }
- }
-
- sendMessage(_("tutti.editSpeciesBatch.action.importMultiPost.success", file));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,168 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.Joiner;
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
-import fr.ifremer.tutti.persistence.service.TuttiEnumerationFile;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.service.pupitri.PupitriImportExportService;
-import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationAction;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-
-import javax.swing.JOptionPane;
-import javax.swing.UIManager;
-import java.io.File;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ImportPupitriAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
-
- protected File importedTrunkFile;
-
- protected File importedCarrouselFile;
-
- protected ImportPupitriPopupUI importPupitriDialog;
-
-// protected TuttiProtocol currentProtocol;
-
- protected PersistenceService persistenceService;
-
- protected EditFishingOperationAction editAction;
-
- public ImportPupitriAction(SpeciesBatchUIHandler handler) {
- super(handler, false);
- persistenceService = getContext().getPersistenceService();
- importPupitriDialog = new ImportPupitriPopupUI(handler.getContext());
- }
-
- public EditFishingOperationAction getEditAction() {
- if (editAction == null) {
- editAction = getContext().getActionFactory().createLogicAction(getHandler().getParentUi().getHandler().getParentHandler(),
- EditFishingOperationAction.class);
- }
- return editAction;
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = true;
-
- // must check that sample category model is compatible for pupitri import
- // means need some categories
-
- TuttiEnumerationFile enumerationFile = persistenceService.getEnumerationFile();
- SampleCategoryModel sampleCategoryModel = getDataContext().getSampleCategoryModel();
-
- List<String> missingCategories = Lists.newArrayList();
- if (!sampleCategoryModel.containsCategoryId(enumerationFile.PMFM_ID_SIZE_CATEGORY)) {
- missingCategories.add("<li>" + persistenceService.getSizeCategoryCaracteristic().getParameterName() + "</li>");
- }
- if (!sampleCategoryModel.containsCategoryId(enumerationFile.PMFM_ID_SEX)) {
- missingCategories.add("<li>" + persistenceService.getSexCaracteristic().getParameterName() + "</li>");
- }
- if (!missingCategories.isEmpty()) {
- result = false;
- JOptionPane.showMessageDialog(
- getContext().getActionUI(),
- _("tutti.editSpeciesBatch.action.importPupitri.invalidSampleCategoryModel.message", Joiner.on("").join(missingCategories)),
- _("tutti.editSpeciesBatch.action.importPupitri.invalidSampleCategoryModel.title"),
- JOptionPane.ERROR_MESSAGE,
- UIManager.getIcon("error")
- );
- }
- if (result) {
-// currentProtocol = getDataContext().getProtocol();
-
- SpeciesBatchUIModel speciesBatchUIModel = getUI().getModel();
- if (speciesBatchUIModel.getRowCount() > 0) {
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- _("tutti.editSpeciesBatch.action.importPupitri.existingData.message"),
- _("tutti.editSpeciesBatch.action.importPupitri.existingData.help"));
-
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- htmlMessage,
- _("tutti.editSpeciesBatch.action.importPupitri.existingData.title"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.WARNING_MESSAGE);
-
- result = answer == JOptionPane.OK_OPTION;
- }
- }
-
- if (result) {
- importPupitriDialog.open();
- importedTrunkFile = importPupitriDialog.getTrunkFile().getSelectedFile();
- importedCarrouselFile = importPupitriDialog.getCarrouselFile().getSelectedFile();
- result = importedTrunkFile != null
- && importedCarrouselFile != null;
- }
-
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
- PupitriImportExportService pupitriImportExportService =
- getContext().getTuttiPupitriImportExportService();
-
- EditCatchesUIModel model = getUI().getHandler().getParentUi().getModel();
-
- FishingOperation operation = model.getFishingOperation();
- CatchBatch catchBatch = model.toEntity();
-
- // import
- int rejectedSpeciesNb =
- pupitriImportExportService.importPupitri(importedTrunkFile,
- importedCarrouselFile,
- operation,
- catchBatch);
-
- getEditAction().loadCatchBatch(operation);
-
- sendMessage(_("tutti.editSpeciesBatch.action.importPupitri.success",
- getModel().getRootNumber(), rejectedSpeciesNb));
- }
-
- @Override
- public void releaseAction() {
- super.releaseAction();
- importedTrunkFile = null;
- importedCarrouselFile = null;
-// currentProtocol = null;
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,132 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.SwingUtil;
-import org.jdesktop.swingx.JXTable;
-
-import javax.swing.JOptionPane;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To remove a species batch and all his children.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class RemoveSpeciesBatchAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
-
- /**
- * Rows to delete after all.
- *
- * @since 3.0-rc-1
- */
- protected Set<SpeciesBatchRowModel> rowToRemove;
-
- public RemoveSpeciesBatchAction(SpeciesBatchUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- if (result) {
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- _("tutti.editSpeciesBatch.action.removeBatch.confirm.message"),
- _("tutti.editSpeciesBatch.action.removeBatch.confirm.title"),
- JOptionPane.YES_NO_OPTION);
- result = answer == JOptionPane.YES_OPTION;
- }
-
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
-
- TuttiPersistence persistenceService =
- getContext().getPersistenceService();
-
- JXTable table = handler.getTable();
-
- int rowIndex = SwingUtil.getSelectedModelRow(table);
-
- Preconditions.checkState(rowIndex != -1,
- "Cant remove batch if no batch selected");
-
- SpeciesBatchTableModel tableModel = handler.getTableModel();
-
- SpeciesBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
-
- Preconditions.checkState(!TuttiEntities.isNew(selectedBatch),
- "Can't remove batch if batch is not persisted");
-
- // remove selected batch and all his children
-
- // remove parent batch (will destroy all his childs from db)
- persistenceService.deleteSpeciesBatch(selectedBatch.getId());
-
- if (selectedBatch.isBatchRoot()) {
- // update speciesUsed
- handler.removeFromSpeciesUsed(selectedBatch);
- } else {
-
- // remove from his parent
- SpeciesBatchRowModel parentBatch = selectedBatch.getParentBatch();
- parentBatch.getChildBatch().remove(selectedBatch);
- }
-
- // collect of rows to remove from model
- rowToRemove = Sets.newHashSet();
- rowToRemove.add(selectedBatch);
-
- handler.collectChildren(selectedBatch, rowToRemove);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- JXTable table = handler.getTable();
-
- // remove all rows from the model
- getModel().getRows().removeAll(rowToRemove);
-
- // refresh table from parent batch row index to the end
- handler.getTableModel().fireTableDataChanged();
-
- // select parent batch row
- TuttiUIUtil.selectFirstCellOnFirstRowAndStopEditing(table);
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesSubBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesSubBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RemoveSpeciesSubBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,138 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.SwingUtil;
-import org.jdesktop.swingx.JXTable;
-
-import javax.swing.JOptionPane;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To remove a species batch children.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class RemoveSpeciesSubBatchAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
-
- /**
- * Selected row to treat.
- *
- * @since 2.8
- */
- protected int rowIndex;
-
- /**
- * Rows to delete after all.
- *
- * @since 3.0-rc-1
- */
- protected Set<SpeciesBatchRowModel> rowToRemove;
-
- /**
- * Parent batch of rows to delete.
- *
- * @since 3.0-rc-1
- */
- protected SpeciesBatchRowModel parentBatch;
-
- public RemoveSpeciesSubBatchAction(SpeciesBatchUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- rowIndex = -1;
-
- if (result) {
- int answer = JOptionPane.showConfirmDialog(getContext().getActionUI(),
- _("tutti.editSpeciesBatch.action.removeSubBatch.confirm.message"),
- _("tutti.editSpeciesBatch.action.removeSubBatch.confirm.title"),
- JOptionPane.YES_NO_OPTION);
- result = answer == JOptionPane.YES_OPTION;
- }
-
- return result;
- }
-
- @Override
- public void doAction() throws Exception {
-
- TuttiPersistence persistenceService =
- getContext().getPersistenceService();
-
- JXTable table = handler.getTable();
-
- rowIndex = SwingUtil.getSelectedModelRow(table);
-
- Preconditions.checkState(rowIndex != -1,
- "Cant remove sub batch if no batch selected");
-
-
- parentBatch = handler.getTableModel().getEntry(rowIndex);
-
- Preconditions.checkState(!TuttiEntities.isNew(parentBatch),
- "Can't remove sub batch if batch is not persisted");
-
- // save parent batch (will destroy all his childs from db)
- persistenceService.deleteSpeciesSubBatch(parentBatch.getId());
-
- // collect of rows to remove from model
-
- rowToRemove = Sets.newHashSet();
-
- handler.collectChildren(parentBatch, rowToRemove);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- JXTable table = handler.getTable();
-
- // remove all rows from the model
- getModel().getRows().removeAll(rowToRemove);
-
- // remove childs from parent batch
- parentBatch.setChildBatch(null);
-
- // refresh table from parent batch row index to the end
- handler.getTableModel().fireTableDataChanged();
-
- // select parent batch row
- TuttiUIUtil.selectFirstCellOnRow(table, rowIndex, true);
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RenameSpeciesBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RenameSpeciesBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RenameSpeciesBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,120 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.SampleCategory;
-import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.SwingUtil;
-import org.jdesktop.swingx.JXTable;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To rename the species for a species batch and all his children.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class RenameSpeciesBatchAction extends AbstractTuttiAction<SpeciesBatchUIModel, SpeciesBatchUI, SpeciesBatchUIHandler> {
-
- protected Species selectedSpecies;
-
- public RenameSpeciesBatchAction(SpeciesBatchUIHandler handler) {
- super(handler, false);
-
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
-
- SpeciesBatchTableModel tableModel = handler.getTableModel();
- JXTable table = handler.getTable();
- int selectedRowIndex = SwingUtil.getSelectedModelRow(table);
- SpeciesBatchRowModel row = tableModel.getEntry(selectedRowIndex);
-
- SpeciesBatchUIModel model = handler.getModel();
- List<Species> speciesList = Lists.newArrayList(
- getDataContext().getReferentSpeciesWithSurveyCode());
- SampleCategory<?> firstSampleCategory = row.getFirstSampleCategory();
- Serializable categoryValue = firstSampleCategory.getCategoryValue();
- speciesList.removeAll(
- model.getSpeciesUsed().get((CaracteristicQualitativeValue) categoryValue));
-
- selectedSpecies = getHandler().openAddSpeciesDialog(
- _("tutti.selectSpecies.title"),
- speciesList
- );
-
- result &= selectedSpecies != null;
- return result;
- }
-
- @Override
- public void releaseAction() {
- selectedSpecies = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
-
- SpeciesBatchTableModel tableModel = handler.getTableModel();
- JXTable table = handler.getTable();
- int selectedRowIndex = SwingUtil.getSelectedModelRow(table);
- SpeciesBatchRowModel row = tableModel.getEntry(selectedRowIndex);
-
- PersistenceService persistenceService = getContext().getPersistenceService();
- persistenceService.changeSpeciesBatchSpecies(row.getId(), selectedSpecies);
-
- SampleCategory<?> firstSampleCategory = row.getFirstSampleCategory();
- Serializable categoryValue = firstSampleCategory.getCategoryValue();
-
- Collection<Species> speciesUsed = getModel().getSpeciesUsed()
- .get((CaracteristicQualitativeValue) categoryValue);
- speciesUsed.remove(row.getSpecies());
- changeChildrenSpecies(row, selectedSpecies);
- speciesUsed.add(selectedSpecies);
- }
-
- protected void changeChildrenSpecies(SpeciesBatchRowModel row,
- Species species) {
- row.setSpecies(species);
- List<SpeciesBatchRowModel> children = row.getChildBatch();
- if (children != null) {
- for (SpeciesBatchRowModel child : children) {
- changeChildrenSpecies(child, species);
- }
- }
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -41,7 +41,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryAble;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyRowModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
+import fr.ifremer.shared.application.swing.computable.ComputableData;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -107,16 +107,16 @@
*
* @since 0.2
*/
- protected TuttiComputedOrNotData<Float> computedOrNotWeight =
- new TuttiComputedOrNotData<Float>();
+ protected ComputableData<Float> computedOrNotWeight =
+ new ComputableData<Float>();
/**
* Total computed number (from frequencies).
*
* @since 0.2
*/
- protected TuttiComputedOrNotData<Integer> computedOrNotNumber =
- new TuttiComputedOrNotData<Integer>();
+ protected ComputableData<Integer> computedOrNotNumber =
+ new ComputableData<Integer>();
/**
* Attachments (should never be null).
@@ -624,19 +624,19 @@
firePropertyChange(PROPERTY_FREQUENCY, null, frequency);
}
- public TuttiComputedOrNotData<Integer> getComputedOrNotNumber() {
+ public ComputableData<Integer> getComputedOrNotNumber() {
return computedOrNotNumber;
}
- public void setComputedOrNotNumber(TuttiComputedOrNotData<Integer> computedOrNotNumber) {
+ public void setComputedOrNotNumber(ComputableData<Integer> computedOrNotNumber) {
this.computedOrNotNumber = computedOrNotNumber;
}
- public TuttiComputedOrNotData<Float> getComputedOrNotWeight() {
+ public ComputableData<Float> getComputedOrNotWeight() {
return computedOrNotWeight;
}
- public void setComputedOrNotWeight(TuttiComputedOrNotData<Float> computedOrNotWeight) {
+ public void setComputedOrNotWeight(ComputableData<Float> computedOrNotWeight) {
this.computedOrNotWeight = computedOrNotWeight;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -31,7 +31,7 @@
_selectOnFocus: {true};
}
-TuttiComputedOrNotDataEditor {
+ComputableDataEditor {
autoPopup: {handler.getConfig().isAutoPopupNumberEditor()};
showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
showReset: true;
@@ -181,7 +181,7 @@
text: "tutti.editSpeciesBatch.action.removeBatch";
toolTipText: "tutti.editSpeciesBatch.action.removeBatch.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.removeBatch.mnemonic";
- _applicationAction: {RemoveSpeciesBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RemoveSpeciesBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRemoveBatchEnabled()};
_help: {"tutti.editSpeciesBatch.action.removeBatch.help"};
}
@@ -191,7 +191,7 @@
text: "tutti.editSpeciesBatch.action.removeSubBatch";
toolTipText: "tutti.editSpeciesBatch.action.removeSubBatch.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.removeSubBatch.mnemonic";
- _applicationAction: {RemoveSpeciesSubBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RemoveSpeciesSubBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRemoveSubBatchEnabled()};
_help: {"tutti.editSpeciesBatch.action.removeSubBatch.help"};
}
@@ -201,7 +201,7 @@
text: "tutti.editSpeciesBatch.action.renameBatch";
toolTipText: "tutti.editSpeciesBatch.action.renameBatch.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.renameBatch.mnemonic";
- _applicationAction: {RenameSpeciesBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RenameSpeciesBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRenameBatchEnabled()};
_help: {"tutti.editSpeciesBatch.action.renameBatch.help"};
}
@@ -211,7 +211,7 @@
text: "tutti.editSpeciesBatch.action.createMelag";
toolTipText: "tutti.editSpeciesBatch.action.createMelag.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.createMelag.mnemonic";
- _applicationAction: {CreateSpeciesMelagAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.CreateSpeciesMelagAction.class};
enabled: {!model.isTableViewModeLeaf() && model.isCreateMelagEnabled()};
_help: {"tutti.editSpeciesBatch.action.createMelag.help"};
}
@@ -230,7 +230,7 @@
text: "tutti.editSpeciesBatch.action.importPupitri";
toolTipText: "tutti.editSpeciesBatch.action.importPupitri.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.importPupitri.mnemonic";
- _applicationAction: {ImportPupitriAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportPupitriAction.class};
_help: {"tutti.editSpeciesBatch.action.importPupitri.help"};
}
@@ -239,7 +239,7 @@
text: "tutti.editSpeciesBatch.action.importMultiPost";
toolTipText: "tutti.editSpeciesBatch.action.importMultiPost.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.importMultiPost.mnemonic";
- _applicationAction: {ImportMultiPostAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportSpeciesMultiPostAction.class};
_help: {"tutti.editSpeciesBatch.action.importMultiPost.help"};
}
@@ -248,7 +248,7 @@
text: "tutti.editSpeciesBatch.action.exportMultiPost";
toolTipText: "tutti.editSpeciesBatch.action.exportMultiPost.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.exportMultiPost.mnemonic";
- _applicationAction: {ExportMultiPostAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportSpeciesMultiPostAction.class};
_help: {"tutti.editSpeciesBatch.action.exportMultiPost.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-11-26 08:03:42 UTC (rev 1388)
@@ -25,12 +25,12 @@
decorator='help'
implements='fr.ifremer.tutti.ui.swing.util.TuttiUI<SpeciesBatchUIModel, SpeciesBatchUIHandler>'>
- <import>
+ <import><![CDATA[
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI
fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode
fr.ifremer.tutti.ui.swing.util.TuttiUI
- fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataEditor
+ fr.ifremer.shared.application.swing.computable.ComputableDataEditor
org.jdesktop.swingx.JXTable
@@ -40,7 +40,7 @@
static org.nuiton.i18n.I18n._
static fr.ifremer.shared.application.ApplicationDataUtil.getWeightStringValue
- </import>
+ ]]></import>
<script><![CDATA[
@@ -104,8 +104,8 @@
<JLabel id='speciesTotalSortedWeightLabel'/>
</cell>
<cell weightx='1.0'>
- <TuttiComputedOrNotDataEditor id='speciesTotalSortedWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor id='speciesTotalSortedWeightField'
+ genericType="Float" constructorParams='this'/>
</cell>
</row>
@@ -131,16 +131,15 @@
<JLabel id='speciesTotalInertWeightLabel'/>
</cell>
<cell>
- <TuttiComputedOrNotDataEditor id='speciesTotalInertWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor id='speciesTotalInertWeightField'
+ genericType="Float" constructorParams='this'/>
</cell>
<cell>
<JLabel id='speciesTotalLivingNotItemizedWeightLabel'/>
</cell>
<cell>
- <TuttiComputedOrNotDataEditor
- id='speciesTotalLivingNotItemizedWeightField'
- constructorParams='this'/>
+ <ComputableDataEditor id='speciesTotalLivingNotItemizedWeightField'
+ genericType="Float" constructorParams='this'/>
</cell>
</row>
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -27,6 +27,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.swing.computable.ComputableDataTableCell;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
@@ -65,7 +66,6 @@
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentCellRenderer;
import fr.ifremer.tutti.ui.swing.util.comment.CommentCellEditor;
import fr.ifremer.tutti.ui.swing.util.comment.CommentCellRenderer;
-import fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataTableCell;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel;
import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
@@ -758,9 +758,9 @@
{ // Weight column
addColumnToModel(columnModel,
- TuttiComputedOrNotDataTableCell.newEditor(
+ ComputableDataTableCell.newEditor(
Float.class, weightUnit, computedDataColor),
- TuttiComputedOrNotDataTableCell.newRender(
+ ComputableDataTableCell.newRender(
defaultRenderer, weightUnit, computedDataColor),
SpeciesBatchTableModel.WEIGHT,
weightUnit);
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -34,8 +34,8 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyRowModel;
-import fr.ifremer.tutti.ui.swing.util.TabContentModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
+import fr.ifremer.shared.application.swing.tab.TabContentModel;
+import fr.ifremer.shared.application.swing.computable.ComputableData;
import org.apache.commons.collections.CollectionUtils;
import java.util.List;
@@ -168,7 +168,7 @@
catchesUIModel.setSpeciesTotalComputedWeight(speciesTotalComputedWeight);
}
- public TuttiComputedOrNotData<Float> getSpeciesTotalSortedComputedOrNotWeight() {
+ public ComputableData<Float> getSpeciesTotalSortedComputedOrNotWeight() {
return catchesUIModel.getSpeciesTotalSortedComputedOrNotWeight();
}
@@ -204,7 +204,7 @@
catchesUIModel.setSpeciesTotalSampleSortedComputedWeight(speciesTotalSampleSortedComputedWeight);
}
- public TuttiComputedOrNotData<Float> getSpeciesTotalInertComputedOrNotWeight() {
+ public ComputableData<Float> getSpeciesTotalInertComputedOrNotWeight() {
return catchesUIModel.getSpeciesTotalInertComputedOrNotWeight();
}
@@ -224,7 +224,7 @@
catchesUIModel.setSpeciesTotalInertComputedWeight(speciesTotalInertComputedWeight);
}
- public TuttiComputedOrNotData<Float> getSpeciesTotalLivingNotItemizedComputedOrNotWeight() {
+ public ComputableData<Float> getSpeciesTotalLivingNotItemizedComputedOrNotWeight() {
return catchesUIModel.getSpeciesTotalLivingNotItemizedComputedOrNotWeight();
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -139,7 +139,7 @@
text: "tutti.createSpeciesBatch.action.addSpecies";
toolTipText: "tutti.createSpeciesBatch.action.addSpecies.tip";
i18nMnemonic: "tutti.createSpeciesBatch.action.addSpecies.mnemonic";
- _applicationAction: {SelectSpeciesForSpeciesBatchAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SelectSpeciesForSpeciesBatchAction.class};
_help: {"tutti.createSpeciesBatch.action.addSpecies.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -41,7 +41,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchTableModel;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.shared.application.type.WeightUnit;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/SelectSpeciesForSpeciesBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/SelectSpeciesForSpeciesBatchAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/SelectSpeciesForSpeciesBatchAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,101 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.species.create;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.Species;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-
-import java.util.List;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Enable to select a species to the species selected in the protocol.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0
- */
-public class SelectSpeciesForSpeciesBatchAction extends AbstractTuttiAction<CreateSpeciesBatchUIModel, CreateSpeciesBatchUI, CreateSpeciesBatchUIHandler> {
-
- protected List<Species> allSpecies;
-
- protected List<Species> referentSpecies;
-
- protected Species selectedSpecies;
-
- public SelectSpeciesForSpeciesBatchAction(CreateSpeciesBatchUIHandler handler) {
- super(handler, false);
-
- allSpecies = getDataContext().getSpecies();
- referentSpecies = getDataContext().getReferentSpecies();
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean canContinue = super.prepareAction();
- if (canContinue) {
-
- CreateSpeciesBatchUIModel model = getModel();
-
- List<Species> species = Lists.newArrayList(allSpecies);
- species.removeAll(model.getAvailableSpecies());
-
- selectedSpecies = getHandler().openAddSpeciesDialog(
- _("tutti.selectSpecies.title"), species);
- canContinue = selectedSpecies != null;
- }
- return canContinue;
- }
-
- @Override
- public void doAction() throws Exception {
-
- CreateSpeciesBatchUIModel model = getModel();
-
- List<Species> availableSpecies = Lists.newArrayList(model.getAvailableSpecies());
-
- if (!selectedSpecies.isReferenceTaxon()) {
- String decoratedSynonym = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
- List<Species> referents = referentSpecies;
- Map<String, Species> referentsById = TuttiEntities.splitByTaxonId(referents);
- String taxonId = String.valueOf(selectedSpecies.getReferenceTaxonId());
- selectedSpecies = referentsById.get(taxonId);
- String decoratedReferent = decorate(selectedSpecies, DecoratorService.FROM_PROTOCOL);
- sendMessage(_("tutti.flash.info.species.replaced", decoratedSynonym, decoratedReferent));
- }
-
- if (!availableSpecies.contains(selectedSpecies)) {
- availableSpecies.add(selectedSpecies);
- }
- model.setAvailableSpecies(availableSpecies);
- model.setSpecies(selectedSpecies);
-
- }
-
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -26,11 +26,11 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+import fr.ifremer.shared.application.swing.computable.ComputableData;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchTableModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import jaxx.runtime.SwingUtil;
@@ -79,7 +79,7 @@
this.computedDataColor = computedDataColor;
}
- public void setComputedOrNotText(TuttiComputedOrNotData<Integer> data) {
+ public void setComputedOrNotText(ComputableData<Integer> data) {
String text;
if (data != null && data.getData() != null) {
@@ -303,7 +303,7 @@
if (log.isDebugEnabled()) {
log.debug("Set columnIdentifier (" + column + ") :: " + columnIdentifier.getPropertyName());
}
- TuttiComputedOrNotData<Integer> data = (TuttiComputedOrNotData<Integer>) value;
+ ComputableData<Integer> data = (ComputableData<Integer>) value;
component.setComputedOrNotText(data);
rowIndex = row;
@@ -356,7 +356,7 @@
int row,
int column) {
component.setForeground(Color.BLACK);
- TuttiComputedOrNotData<Integer> data = (TuttiComputedOrNotData<Integer>) value;
+ ComputableData<Integer> data = (ComputableData<Integer>) value;
SpeciesFrequencyCellComponent result =
(SpeciesFrequencyCellComponent) component.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -39,7 +39,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyCellComponent.FrequencyCellEditor;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -36,7 +36,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -31,7 +31,7 @@
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.ui.swing.util.TabContentModel;
+import fr.ifremer.shared.application.swing.tab.TabContentModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
import java.io.Serializable;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTabUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTabUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTabUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -29,8 +29,8 @@
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
-import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueEditor;
-import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueRenderer;
+import fr.ifremer.tutti.ui.swing.util.caracteristics.CaracteristicValueEditor;
+import fr.ifremer.tutti.ui.swing.util.caracteristics.CaracteristicValueRenderer;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTabUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTabUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTabUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -29,8 +29,8 @@
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
-import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueEditor;
-import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueRenderer;
+import fr.ifremer.tutti.ui.swing.util.caracteristics.CaracteristicValueEditor;
+import fr.ifremer.tutti.ui.swing.util.caracteristics.CaracteristicValueRenderer;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -80,7 +80,7 @@
text: "tutti.editProgram.action.saveProgram";
toolTipText: "tutti.editProgram.action.saveProgram.tip";
i18nMnemonic: "tutti.editProgram.action.saveProgram.mnemonic";
- _applicationAction: {SaveProgramAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SaveProgramAction.class};
enabled: {model.isModify() && model.isValid()};
_help: {"tutti.editProgram.action.saveProgram.help"};
}
@@ -90,6 +90,6 @@
text: "tutti.editProgram.action.closeEditProgram";
toolTipText: "tutti.editProgram.action.closeEditProgram.tip";
i18nMnemonic: "tutti.editProgram.action.closeEditProgram.mnemonic";
- _applicationAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SelectCruiseAction.class};
_help: {"tutti.editProgram.action.cancelProgram.help"};
}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/SaveProgramAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/SaveProgramAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/SaveProgramAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,79 +0,0 @@
-
-package fr.ifremer.tutti.ui.swing.content.program;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class SaveProgramAction extends AbstractTuttiAction<EditProgramUIModel, EditProgramUI, EditProgramUIHandler> {
-
- public SaveProgramAction(EditProgramUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public void doAction() throws Exception {
- TuttiUIContext context = getContext();
- PersistenceService persistenceService =
- getContext().getPersistenceService();
-
- EditProgramUIModel model = getModel();
-
- Program bean = model.toBean();
-
- Program saved;
- if (TuttiEntities.isNew(bean)) {
-
- saved = persistenceService.createProgram(bean);
- model.setId(saved.getId());
- sendMessage(_("tutti.flash.info.programCreated", bean.getName()));
- } else {
- saved = persistenceService.saveProgram(bean);
- sendMessage(_("tutti.flash.info.programSaved", bean.getName()));
- }
-
- context.setProgramId(saved.getId());
-
- model.setModify(false);
- }
-
- @Override
- public void postSuccessAction() {
- getContext().getMainUI().getHandler().setBodyTitle(
- EditProgramUIHandler.getTitle(true));
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddBenthosProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddBenthosProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddBenthosProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,103 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
-
-import java.util.Collection;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To add a new benthos protocol.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class AddBenthosProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- public AddBenthosProtocolAction(EditProtocolUIHandler handler) {
- super(handler, false);
- }
-
- protected Species species;
-
- protected EditProtocolSpeciesRowModel newRow;
-
- @Override
- public void doAction() throws Exception {
-
- species = null;
-
- EditProtocolUI ui = getUI();
-
- EditProtocolSpeciesTableModel tableModel = handler.getBenthosTableModel();
- BeanFilterableComboBox<Species> benthosComboBox = ui.getBenthosComboBox();
-
- species = (Species) benthosComboBox.getSelectedItem();
- Preconditions.checkNotNull(
- species, "Can't add a benthosProtocol with a null species");
- Preconditions.checkArgument(species.isReferenceTaxon(),
- "Can't add a benthosProtocol with a not referent species");
-
- Integer taxonId = species.getReferenceTaxonId();
- String taxonIdStr = String.valueOf(taxonId);
-
- // remove all synonyms of this taxon
- Collection<Species> allSynonyms = getModel().getAllSynonyms(taxonIdStr);
- getModel().getAllSynonyms().removeAll(allSynonyms);
-
- // add new row to model (do it after combo stuff for ui best display)
- newRow = tableModel.createNewRow();
- newRow.setSpecies(species);
- getModel().getBenthosRow().add(newRow);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- // update comboboxes
- getUI().getBenthosComboBox().removeItem(species);
- getUI().getSpeciesComboBox().removeItem(species);
-
- // fire row was inserted in table model
- EditProtocolSpeciesTableModel tableModel = getHandler().getBenthosTableModel();
- tableModel.fireTableRowsInserted(newRow);
-
- // select this new row
- int rowIndex = tableModel.getRowIndex(newRow);
- SwingUtil.setSelectionInterval(handler.getBenthosTable(), rowIndex);
-
- // add notification
- String speciesStr = decorate(species);
- sendMessage(_("tutti.flash.info.benthos.add.to.protocol",
- speciesStr));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddSpeciesProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddSpeciesProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddSpeciesProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,101 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
-
-import java.util.Collection;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To add a new species protocol.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class AddSpeciesProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- public AddSpeciesProtocolAction(EditProtocolUIHandler handler) {
- super(handler, false);
- }
-
- protected Species species;
-
- protected EditProtocolSpeciesRowModel newRow;
-
- @Override
- public void doAction() throws Exception {
-
- EditProtocolUI ui = getUI();
-
- EditProtocolSpeciesTableModel tableModel = handler.getSpeciesTableModel();
- BeanFilterableComboBox<Species> speciesComboBox = ui.getSpeciesComboBox();
-
- species = (Species) speciesComboBox.getSelectedItem();
- Preconditions.checkNotNull(
- species, "Can't add a speciesProtocol with a null species");
- Preconditions.checkArgument(species.isReferenceTaxon(),
- "Can't add a speciesProtocol with a not referent species");
-
- Integer taxonId = species.getReferenceTaxonId();
- String taxonIdStr = String.valueOf(taxonId);
-
- // remove all synonyms of this taxon
- Collection<Species> allSynonyms = getModel().getAllSynonyms(taxonIdStr);
- getModel().getAllSynonyms().removeAll(allSynonyms);
-
- // add new row to model (do it after combo stuff for ui best display)
- newRow = tableModel.createNewRow();
- newRow.setSpecies(species);
- getModel().getSpeciesRow().add(newRow);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- // update comboboxes
- getUI().getBenthosComboBox().removeItem(species);
- getUI().getSpeciesComboBox().removeItem(species);
-
- // fire row was inserted in table model
- EditProtocolSpeciesTableModel tableModel = getHandler().getSpeciesTableModel();
- tableModel.fireTableRowsInserted(newRow);
-
- // select this new row
- int rowIndex = tableModel.getRowIndex(newRow);
- SwingUtil.setSelectionInterval(handler.getSpeciesTable(), rowIndex);
-
- // add notification
- String speciesStr = decorate(species);
- sendMessage(_("tutti.flash.info.species.add.to.protocol",
- speciesStr));
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -140,7 +140,7 @@
toolTipText: "tutti.editProtocol.action.saveProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.saveProtocol.mnemonic";
enabled: {model.isModify() && model.isValid()};
- _applicationAction: {SaveProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SaveProtocolAction.class};
_help: {"tutti.editProtocol.action.saveProtocol.help"};
}
@@ -149,7 +149,7 @@
text: "tutti.editProtocol.action.closeEditProtocol";
toolTipText: "tutti.editProtocol.action.closeEditProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.closeEditProtocol.mnemonic";
- _applicationAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SelectCruiseAction.class};
_help: {"tutti.editProtocol.action.closeEditProtocol.help"};
}
@@ -157,7 +157,7 @@
text: "tutti.editProtocol.action.selectOtherSpecies";
toolTipText: "tutti.editProtocol.action.selectOtherSpecies.tip";
i18nMnemonic: "tutti.editProtocol.action.selectOtherSpecies.mnemonic";
- _applicationAction: {SelectOtherSpeciesAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SelectOtherSpeciesAction.class};
_help: {"tutti.editProtocol.action.selectOtherSpecies.help"};
}
@@ -165,7 +165,7 @@
actionIcon: add;
toolTipText: "tutti.editProtocol.action.addSpeciesProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.addSpeciesProtocol.mnemonic";
- _applicationAction: {AddSpeciesProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.AddSpeciesProtocolAction.class};
enabled: {speciesComboBox.getSelectedItem() != null};
_help: {"tutti.editProtocol.action.addSpeciesProtocol.help"};
}
@@ -175,7 +175,7 @@
text: "tutti.editProtocol.action.removeSpeciesProtocol";
toolTipText: "tutti.editProtocol.action.removeSpeciesProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.removeSpeciesProtocol.mnemonic";
- _applicationAction: {RemoveSpeciesProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RemoveSpeciesProtocolAction.class};
enabled: {model.isRemoveSpeciesEnabled()};
_help: {"tutti.editProtocol.action.removeSpeciesProtocol.help"};
}
@@ -185,7 +185,7 @@
text: "tutti.editProtocol.action.importProtocolSpecies";
toolTipText: "tutti.editProtocol.action.importProtocolSpecies.tip";
i18nMnemonic: "tutti.editProtocol.action.importProtocolSpecies.mnemonic";
- _applicationAction: {ImportProtocolSpeciesAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportProtocolSpeciesAction.class};
_help: {"tutti.editProtocol.action.importProtocolSpecies.help"};
}
@@ -194,7 +194,7 @@
text: "tutti.editProtocol.action.exportProtocolSpecies";
toolTipText: "tutti.editProtocol.action.exportProtocolSpecies.tip";
i18nMnemonic: "tutti.editProtocol.action.exportProtocolSpecies.mnemonic";
- _applicationAction: {ExportProtocolSpeciesAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportProtocolSpeciesAction.class};
_help: {"tutti.editProtocol.action.exportProtocolSpecies.help"};
}
@@ -203,7 +203,7 @@
text: "tutti.editProtocol.action.exportPupitri";
toolTipText: "tutti.editProtocol.action.exportPupitri.tip";
i18nMnemonic: "tutti.editProtocol.action.exportPupitri.mnemonic";
- _applicationAction: {ExportPupitriAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportPupitriAction.class};
_help: {"tutti.editProtocol.action.exportPupitri.help"};
}
@@ -211,7 +211,7 @@
text: "tutti.editProtocol.action.selectOtherBenthos";
toolTipText: "tutti.editProtocol.action.selectOtherBenthos.tip";
i18nMnemonic: "tutti.editProtocol.action.selectOtherBenthos.mnemonic";
- _applicationAction: {SelectOtherBenthosAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.SelectOtherBenthosAction.class};
_help: {"tutti.editProtocol.action.selectOtherBenthos.help"};
}
@@ -219,7 +219,7 @@
actionIcon: add;
toolTipText: "tutti.editProtocol.action.addBenthosProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.addBenthosProtocol.mnemonic";
- _applicationAction: {AddBenthosProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.AddBenthosProtocolAction.class};
enabled: {benthosComboBox.getSelectedItem() != null};
_help: {"tutti.editProtocol.action.addBenthosProtocol.help"};
}
@@ -229,7 +229,7 @@
text: "tutti.editProtocol.action.removeBenthosProtocol";
toolTipText: "tutti.editProtocol.action.removeBenthosProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.removeBenthosProtocol.mnemonic";
- _applicationAction: {RemoveBenthosProtocolAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.RemoveBenthosProtocolAction.class};
enabled: {model.isRemoveBenthosEnabled()};
_help: {"tutti.editProtocol.action.removeBenthosProtocol.help"};
}
@@ -239,7 +239,7 @@
text: "tutti.editProtocol.action.importProtocolBenthos";
toolTipText: "tutti.editProtocol.action.importProtocolBenthos.tip";
i18nMnemonic: "tutti.editProtocol.action.importProtocolBenthos.mnemonic";
- _applicationAction: {ImportProtocolBenthosAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportProtocolBenthosAction.class};
_help: {"tutti.editProtocol.action.importProtocolBenthos.help"};
}
@@ -248,7 +248,7 @@
text: "tutti.editProtocol.action.exportProtocolBenthos";
toolTipText: "tutti.editProtocol.action.exportProtocolBenthos.tip";
i18nMnemonic: "tutti.editProtocol.action.exportProtocolBenthos.mnemonic";
- _applicationAction: {ExportProtocolBenthosAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportProtocolBenthosAction.class};
_help: {"tutti.editProtocol.action.exportProtocolBenthos.help"};
}
@@ -257,7 +257,7 @@
text: "tutti.editProtocol.action.importProtocolCaracteristic";
toolTipText: "tutti.editProtocol.action.importProtocolCaracteristic.tip";
i18nMnemonic: "tutti.editProtocol.action.importProtocolCaracteristic.mnemonic";
- _applicationAction: {ImportProtocolCaracteristicAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportProtocolCaracteristicAction.class};
_help: {"tutti.editProtocol.action.importProtocolCaracteristic.help"};
}
@@ -266,7 +266,7 @@
text: "tutti.editProtocol.action.exportProtocolCaracteristic";
toolTipText: "tutti.editProtocol.action.exportProtocolCaracteristic.tip";
i18nMnemonic: "tutti.editProtocol.action.exportProtocolCaracteristic.mnemonic";
- _applicationAction: {ExportProtocolCaracteristicAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportProtocolCaracteristicAction.class};
_help: {"tutti.editProtocol.action.exportProtocolCaracteristic.tip"};
}
@@ -275,7 +275,7 @@
text: "tutti.editProtocol.action.exportProtocolAllCaracteristic";
toolTipText: "tutti.editProtocol.action.exportProtocolAllCaracteristic.tip";
i18nMnemonic: "tutti.editProtocol.action.exportProtocolAllCaracteristic.mnemonic";
- _applicationAction: {ExportAllCaracteristicAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportAllCaracteristicAction.class};
_help: {"tutti.editProtocol.action.exportProtocolAllCaracteristic.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -39,9 +39,9 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.TuttiDecorator;
-import fr.ifremer.tutti.ui.swing.content.home.CloneProtocolAction;
-import fr.ifremer.tutti.ui.swing.content.home.EditProtocolAction;
-import fr.ifremer.tutti.ui.swing.content.home.ImportProtocolAction;
+import fr.ifremer.tutti.ui.swing.action.CloneProtocolAction;
+import fr.ifremer.tutti.ui.swing.action.EditProtocolAction;
+import fr.ifremer.tutti.ui.swing.action.ImportProtocolAction;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.shared.application.swing.util.CloseableUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportAllCaracteristicAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportAllCaracteristicAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportAllCaracteristicAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,96 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.protocol.ProtocolImportExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To export all caracteristics.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ExportAllCaracteristicAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportAllCaracteristicAction.class);
-
- protected File file;
-
- public ExportAllCaracteristicAction(EditProtocolUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to export
- file = saveFile(
- "tuttiProtocol-" + getModel().getName() + "-allCaracteristics",
- "csv",
- _("tutti.editProtocol.title.choose.caracteristicExportFile"),
- _("tutti.editProtocol.action.chooseProtocolCaracteristicFile"),
- "^.*\\.csv", _("tutti.common.file.csv")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will export all caracteristic to file: " + file);
- }
-
- // export protocol caracteristics
- ProtocolImportExportService service =
- getContext().getTuttiProtocolImportExportService();
-
- service.exportAllCaracteristic(file, getModel().getAllCaracteristic());
-
- sendMessage(_("tutti.flash.info.all.caractristic.exported", file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolBenthosAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolBenthosAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolBenthosAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,114 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
-import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To export protocol benthos.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.2
- */
-public class ExportProtocolBenthosAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportProtocolBenthosAction.class);
-
- private File file;
-
- public ExportProtocolBenthosAction(EditProtocolUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to export
- file = saveFile(
- "tuttiProtocol-" + getModel().getName() + "-benthos",
- "csv",
- _("tutti.editProtocol.title.choose.benthosExportFile"),
- _("tutti.editProtocol.action.chooseProtocolBenthosFile"),
- "^.*\\.csv", _("tutti.common.file.csv")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will export protocol benthos to file: " + file);
- }
-
- EditProtocolUIModel model = getModel();
-
- // build benthos protocol to export
-
- List<SpeciesProtocol> protocols = Lists.newArrayList();
- for (EditProtocolSpeciesRowModel row : model.getBenthosRow()) {
- if (row.isValid()) {
- protocols.add(row.toBean());
- }
- }
-
- // import
- ProtocolImportExportService service =
- getContext().getTuttiProtocolImportExportService();
-
- service.exportProtocolBenthos(file,
- protocols,
- model.getAllCaracteristic(),
- model.getAllReferentSpeciesByTaxonId());
-
- sendMessage(_("tutti.flash.info.species.exported.from.protocol",
- file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolCaracteristicAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolCaracteristicAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolCaracteristicAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,103 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To import protocol caracteristics.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ExportProtocolCaracteristicAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportProtocolCaracteristicAction.class);
-
- private File file;
-
- public ExportProtocolCaracteristicAction(EditProtocolUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to export
- file = saveFile(
- "tuttiProtocol-" + getModel().getName() + "-caracteristics",
- "csv",
- _("tutti.editProtocol.title.choose.caracteristicExportFile"),
- _("tutti.editProtocol.action.chooseProtocolCaracteristicFile"),
- "^.*\\.csv", _("tutti.common.file.csv")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will export protocol caracteristic to file: " + file);
- }
-
- // bind to a protocol
- TuttiProtocol protocol = getModel().toBean();
-
- // export protocol caracteristics
- ProtocolImportExportService service =
- getContext().getTuttiProtocolImportExportService();
-
- service.exportProtocolCaracteristic(file,
- protocol,
- getModel().getAllCaracteristic());
-
- sendMessage(_("tutti.flash.info.caractristic.exported.from.protocol",
- file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,114 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
-import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To export protocol species.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ExportProtocolSpeciesAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportProtocolSpeciesAction.class);
-
- private File file;
-
- public ExportProtocolSpeciesAction(EditProtocolUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to export
- file = saveFile(
- "tuttiProtocol-" + getModel().getName() + "-species",
- "csv",
- _("tutti.editProtocol.title.choose.speciesExportFile"),
- _("tutti.editProtocol.action.chooseProtocolSpeciesFile"),
- "^.*\\.csv", _("tutti.common.file.csv")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will export protocol species to file: " + file);
- }
-
- EditProtocolUIModel model = getModel();
-
- // build species protocol to export
-
- List<SpeciesProtocol> protocols = Lists.newArrayList();
- for (EditProtocolSpeciesRowModel row : model.getSpeciesRow()) {
- if (row.isValid()) {
- protocols.add(row.toBean());
- }
- }
-
- // import
- ProtocolImportExportService service =
- getContext().getTuttiProtocolImportExportService();
-
- service.exportProtocolSpecies(file,
- protocols,
- model.getAllCaracteristic(),
- model.getAllReferentSpeciesByTaxonId());
-
- sendMessage(_("tutti.flash.info.species.exported.from.protocol",
- file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,112 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.pupitri.PupitriImportExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To export protocol species.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ExportPupitriAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportPupitriAction.class);
-
- private File file;
-
- public ExportPupitriAction(EditProtocolUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to export
- file = saveFile(
- "tuttiProtocol-" + getModel().getName() + "-pupitri",
- "csv",
- _("tutti.editProtocol.title.choose.speciesExportFile"),
- _("tutti.editProtocol.action.chooseProtocolSpeciesFile")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will export protocol species to file: " + file);
- }
-
- EditProtocolUIModel model = getModel();
-
- // build species protocol to export
-
- List<Species> speciesList = Lists.newArrayList();
- for (EditProtocolSpeciesRowModel row : model.getSpeciesRow()) {
- if (row.isValid()) {
- Species species = row.getSpecies();
- species.setSurveyCode(row.getSpeciesSurveyCode());
- speciesList.add(species);
- }
- }
-
- // import
- PupitriImportExportService service =
- getContext().getTuttiPupitriImportExportService();
-
- service.exportSpecies(speciesList, file);
-
- sendMessage(_("tutti.flash.info.species.exported.from.protocol",
- file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolBenthosAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolBenthosAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolBenthosAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,145 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.protocol.SpeciesProtocol;
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To import protocol benthos.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ImportProtocolBenthosAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ImportProtocolBenthosAction.class);
-
- private File file;
-
- public ImportProtocolBenthosAction(EditProtocolUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to import
- file = chooseFile(
- _("tutti.editProtocol.title.choose.benthosImportFile"),
- _("tutti.editProtocol.action.chooseProtocolBenthosFile"),
- "^.*\\.csv", _("tutti.common.file.csv")
- );
-
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will import protocol benthos file: " + file);
- }
-
- EditProtocolUIModel model = getModel();
-
- // bind to a protocol
- TuttiProtocol protocol = model.toBean();
-
- // import
- ProtocolImportExportService service =
- getContext().getTuttiProtocolImportExportService();
-
- service.importProtocolBenthos(file,
- protocol,
- model.getAllCaracteristic(),
- model.getAllReferentSpeciesByTaxonId());
-
- // build rows from imported+merged protocol
- // (will also remove all synonyms of species referent used)
- List<EditProtocolSpeciesRowModel> rows =
- handler.toRows(protocol.getBenthos());
-
- // update species comboBox
- getUI().getSpeciesComboBox().getHandler().reset();
-
- // update benthos comboBox
- getUI().getBenthosComboBox().getHandler().reset();
-
- // update rows in model
- model.setBenthosRow(rows);
-
- getHandler().getBenthosTableModel().setRows(rows);
-
- int nbSynonym = 0;
- for (SpeciesProtocol speciesProtocol : protocol.getBenthos()) {
- if (!speciesProtocol.isMadeFromAReferentTaxon()) {
- nbSynonym++;
- }
- }
-
- String message;
- switch (nbSynonym) {
- case 0:
- message = _("tutti.flash.info.benthos.imported.in.protocol",
- file);
- break;
-
- case 1:
- message = _("tutti.flash.info.benthos.imported.in.protocol.oneReplaced",
- file);
- break;
-
- default:
- message = _("tutti.flash.info.benthos.imported.in.protocol.severalReplaced",
- file, nbSynonym);
- }
- sendMessage(message);
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolCaracteristicAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolCaracteristicAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolCaracteristicAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,114 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To import protocol caracteristics.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ImportProtocolCaracteristicAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ImportProtocolCaracteristicAction.class);
-
- private File file;
-
- public ImportProtocolCaracteristicAction(EditProtocolUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to import
- file = chooseFile(
- _("tutti.editProtocol.title.choose.caracteristicImportFile"),
- _("tutti.editProtocol.action.chooseProtocolCaracteristicFile"),
- "^.*\\.csv", _("tutti.common.file.csv")
- );
-
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will import protocol caracteristic file: " + file);
- }
-
- EditProtocolUIModel model = getModel();
-
- // bind to a protocol
- TuttiProtocol protocol = model.toBean();
-
- ProtocolImportExportService service =
- getContext().getTuttiProtocolImportExportService();
-
- service.importProtocolCaracteristic(file,
- protocol,
- model.getAllCaracteristic());
-
- handler.addDoubleListListeners();
-
- try {
- // rebind to model
- model.fromBean(protocol);
- } finally {
- handler.removeDoubleListListeners();
- }
-
- sendMessage(
- _("tutti.flash.info.caracteristic.imported.in.protocol",
- file));
-
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolSpeciesAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolSpeciesAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolSpeciesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,145 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.entities.protocol.SpeciesProtocol;
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To import protocol species.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ImportProtocolSpeciesAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ImportProtocolSpeciesAction.class);
-
- private File file;
-
- public ImportProtocolSpeciesAction(EditProtocolUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to import
- file = chooseFile(
- _("tutti.editProtocol.title.choose.speciesImportFile"),
- _("tutti.editProtocol.action.chooseProtocolSpeciesFile"),
- "^.*\\.csv", _("tutti.common.file.csv")
- );
-
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will import protocol species file: " + file);
- }
-
- EditProtocolUIModel model = getModel();
-
- // bind to a protocol
- TuttiProtocol protocol = model.toBean();
-
- // import
- ProtocolImportExportService service =
- getContext().getTuttiProtocolImportExportService();
-
- service.importProtocolSpecies(file,
- protocol,
- model.getAllCaracteristic(),
- model.getAllReferentSpeciesByTaxonId());
-
- // build rows from imported+merged protocol
- // (will also remove all synonyms of species referent used)
- List<EditProtocolSpeciesRowModel> rows =
- handler.toRows(protocol.getSpecies());
-
- // update species comboBox
- getUI().getSpeciesComboBox().getHandler().reset();
-
- // update benthos comboBox
- getUI().getBenthosComboBox().getHandler().reset();
-
- // update rows in model
- model.setSpeciesRow(rows);
-
- getHandler().getSpeciesTableModel().setRows(rows);
-
- int nbSynonym = 0;
- for (SpeciesProtocol speciesProtocol : protocol.getSpecies()) {
- if (!speciesProtocol.isMadeFromAReferentTaxon()) {
- nbSynonym++;
- }
- }
-
- String message;
- switch (nbSynonym) {
- case 0:
- message = _("tutti.flash.info.species.imported.in.protocol",
- file);
- break;
-
- case 1:
- message = _("tutti.flash.info.species.imported.in.protocol.oneReplaced",
- file);
- break;
-
- default:
- message = _("tutti.flash.info.species.imported.in.protocol.severalReplaced",
- file, nbSynonym);
- }
- sendMessage(message);
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveBenthosProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveBenthosProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveBenthosProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,132 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.SwingUtil;
-
-import javax.swing.JTable;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To remove all the selected benthos rows from protocol.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class RemoveBenthosProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
-
- /**
- * Set of removed species.
- *
- * @since 2.8
- */
- protected Set<Species> removedSpecies;
-
- /**
- * Set of removed rows.
- *
- * @since 2.8
- */
- protected Set<EditProtocolSpeciesRowModel> removedRows;
-
-
- public RemoveBenthosProtocolAction(EditProtocolUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public void doAction() throws Exception {
-
- JTable table = handler.getBenthosTable();
-
- // need to have a selection
- Preconditions.checkState(!table.getSelectionModel().isSelectionEmpty());
-
- EditProtocolSpeciesTableModel tableModel =
- (EditProtocolSpeciesTableModel) table.getModel();
-
- removedSpecies = Sets.newHashSet();
- removedRows = Sets.newHashSet();
-
- EditProtocolUIModel model = getModel();
-
- for (Integer rowIndex : SwingUtil.getSelectedModelRows(table)) {
-
- // get row to remove
- EditProtocolSpeciesRowModel selectedRow =
- tableModel.getEntry(rowIndex);
-
- // re-add all synonym of this taxon to the species / benthos combobox
- Species species = selectedRow.getSpecies();
- removedSpecies.add(species);
-
- Integer taxonId = species.getReferenceTaxonId();
- List<Species> allSynonyms = Lists.newArrayList(
- model.getAllSynonyms(String.valueOf(taxonId)));
- allSynonyms.remove(species);
- model.getAllSynonyms().addAll(allSynonyms);
-
- // mark row to be removed at the very last moment
- removedRows.add(selectedRow);
- }
-
- // reorder the list by name, otherwise,
- // all the species without a reftax code will be at the end
- Collections.sort(model.getAllSynonyms(),
- TuttiEntities.SPECIES_BY_NAME_COMPARATOR);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- // update comboboxes
- getUI().getBenthosComboBox().addItems(removedSpecies);
- getUI().getSpeciesComboBox().addItems(removedSpecies);
-
- // remove all rows from model
- getModel().getBenthosRow().removeAll(removedRows);
-
- // fire table data changed
- handler.getBenthosTableModel().fireTableDataChanged();
-
- // clear table selection
- handler.getBenthosTable().clearSelection();
-
- // notify user
- sendMessage(_("tutti.flash.info.benthos.remove.from.protocol"));
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveSpeciesProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveSpeciesProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveSpeciesProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,130 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.SwingUtil;
-
-import javax.swing.JTable;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To remove all the selected species rows from protocol.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class RemoveSpeciesProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /**
- * Set of removed species.
- *
- * @since 2.8
- */
- protected Set<Species> removedSpecies;
-
- /**
- * Set of removed rows.
- *
- * @since 2.8
- */
- protected Set<EditProtocolSpeciesRowModel> removedRows;
-
- public RemoveSpeciesProtocolAction(EditProtocolUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public void doAction() throws Exception {
-
- JTable table = handler.getSpeciesTable();
-
- // need to have a selection
- Preconditions.checkState(!table.getSelectionModel().isSelectionEmpty());
-
- EditProtocolSpeciesTableModel tableModel =
- (EditProtocolSpeciesTableModel) table.getModel();
-
- EditProtocolUIModel model = getModel();
-
- removedSpecies = Sets.newHashSet();
- removedRows = Sets.newHashSet();
-
- for (Integer rowIndex : SwingUtil.getSelectedModelRows(table)) {
-
- // get row to remove
- EditProtocolSpeciesRowModel selectedRow =
- tableModel.getEntry(rowIndex);
-
- // re-add all synonym of this taxon to the species / benthos combobox
- Species species = selectedRow.getSpecies();
- removedSpecies.add(species);
-
- Integer taxonId = species.getReferenceTaxonId();
- List<Species> allSynonyms = Lists.newArrayList(
- model.getAllSynonyms(String.valueOf(taxonId)));
- allSynonyms.remove(species);
- model.getAllSynonyms().addAll(allSynonyms);
-
- // mark row to be removed at the very last moment
- removedRows.add(selectedRow);
- }
-
- // reorder the list by name, otherwise,
- // all the species without a reftax code will be at the end
- Collections.sort(model.getAllSynonyms(), TuttiEntities.SPECIES_BY_NAME_COMPARATOR);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- // update comboboxes
- getUI().getBenthosComboBox().addItems(removedSpecies);
- getUI().getSpeciesComboBox().addItems(removedSpecies);
-
- // remove all rows from model
- getModel().getSpeciesRow().removeAll(removedRows);
-
- // fire table data changed
- handler.getSpeciesTableModel().fireTableDataChanged();
-
- // clear table selection
- handler.getSpeciesTable().clearSelection();
-
- // notify user
- sendMessage(_("tutti.flash.info.species.remove.from.protocol"));
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SaveProtocolAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SaveProtocolAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SaveProtocolAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,119 +0,0 @@
-
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.protocol.SpeciesProtocol;
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.service.PersistenceService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Saves a protocol
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0
- */
-public class SaveProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(SaveProtocolAction.class);
-
- public SaveProtocolAction(EditProtocolUIHandler handler) {
- super(handler, true);
- }
-
- /**
- * If the event source is a TuttiScreen, then the screen changes to the source.
- * Otherwise, the screen changes to the home.
- */
- @Override
- public void doAction() throws Exception {
- EditProtocolUIModel model = getModel();
- TuttiUIContext context = getContext();
-
- PersistenceService persistenceService = context.getPersistenceService();
-
- TuttiProtocol bean = model.toBean();
-
- // get the species protocols from the table
- List<SpeciesProtocol> speciesProtocols = Lists.newArrayList();
-
- for (EditProtocolSpeciesRowModel row : model.getSpeciesRow()) {
- if (row.isValid()) {
- SpeciesProtocol protocol = row.toBean();
- speciesProtocols.add(protocol);
- }
- }
- bean.setSpecies(speciesProtocols);
-
- List<SpeciesProtocol> benthosProtocols = Lists.newArrayList();
-
- for (EditProtocolSpeciesRowModel row : model.getBenthosRow()) {
- if (row.isValid()) {
- SpeciesProtocol protocol = row.toBean();
- benthosProtocols.add(protocol);
- }
- }
- bean.setBenthos(benthosProtocols);
-
- if (log.isDebugEnabled()) {
- log.debug("protocol id to save: " + bean.getId());
- }
-
- TuttiProtocol saved;
-
- if (TuttiEntities.isNew(bean)) {
-
- saved = persistenceService.createProtocol(bean);
- model.setId(saved.getId());
- sendMessage(_("tutti.flash.info.protocolCreated", bean.getName()));
- } else {
- saved = persistenceService.saveProtocol(bean);
- sendMessage(_("tutti.flash.info.protocolSaved", bean.getName()));
- }
-
- context.setProtocolId(saved.getId());
-
- model.setModify(false);
- }
-
- @Override
- public void postSuccessAction() {
- getContext().getMainUI().getHandler().setBodyTitle(
- EditProtocolUIHandler.getTitle(true));
- getUI().getSaveWarningContainer().setVisible(false);
-
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherBenthosAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherBenthosAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherBenthosAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,91 +0,0 @@
-
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.Species;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Action to select a benthos which is not in the referent list.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.1
- */
-public class SelectOtherBenthosAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(SelectOtherBenthosAction.class);
-
- protected Species selectedSpecies;
-
- public SelectOtherBenthosAction(EditProtocolUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
- if (result) {
- EditProtocolUIModel model = getModel();
-
- List<Species> species = Lists.newArrayList(model.getAllSynonyms());
-
- selectedSpecies = getHandler().openSelectOtherSpeciesDialog(
- _("tutti.selectBenthos.title"), species);
-
- if (log.isInfoEnabled()) {
- log.info("SelectedBenthos: " + selectedSpecies);
- }
- result = selectedSpecies != null;
- }
- return result;
- }
-
- @Override
- public void releaseAction() {
- selectedSpecies = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- String decoratedSynonym = decorate(selectedSpecies);
- String taxonId = String.valueOf(selectedSpecies.getReferenceTaxonId());
- selectedSpecies = getModel().getAllReferentSpeciesByTaxonId().get(taxonId);
- String decoratedReferent = decorate(selectedSpecies);
- sendMessage(_("tutti.flash.info.benthos.replaced", decoratedSynonym, decoratedReferent));
- getUI().getBenthosComboBox().setSelectedItem(selectedSpecies);
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherSpeciesAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherSpeciesAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherSpeciesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,91 +0,0 @@
-
-package fr.ifremer.tutti.ui.swing.content.protocol;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.Species;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Action to select a species which is not in the referent list.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.1
- */
-public class SelectOtherSpeciesAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(SelectOtherSpeciesAction.class);
-
- protected Species selectedSpecies;
-
- public SelectOtherSpeciesAction(EditProtocolUIHandler handler) {
- super(handler, false);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean result = super.prepareAction();
- if (result) {
- EditProtocolUIModel model = getModel();
-
- List<Species> species = Lists.newArrayList(model.getAllSynonyms());
-
- selectedSpecies = getHandler().openSelectOtherSpeciesDialog(
- _("tutti.selectSpecies.title"), species);
-
- if (log.isInfoEnabled()) {
- log.info("SelectedSpecies: " + selectedSpecies);
- }
- result = selectedSpecies != null;
- }
- return result;
- }
-
- @Override
- public void releaseAction() {
- selectedSpecies = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- String decoratedSynonym = decorate(selectedSpecies);
- String taxonId = String.valueOf(selectedSpecies.getReferenceTaxonId());
- selectedSpecies = getModel().getAllReferentSpeciesByTaxonId().get(taxonId);
- String decoratedReferent = decorate(selectedSpecies);
- sendMessage(_("tutti.flash.info.species.replaced", decoratedSynonym, decoratedReferent));
- getUI().getSpeciesComboBox().setSelectedItem(selectedSpecies);
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryGearExampleAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryGearExampleAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryGearExampleAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,101 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.referential;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.ReferentialImportExportService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Export an example file of temporary gears referential.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ExportTemporaryGearExampleAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportTemporaryGearExampleAction.class);
-
- private File file;
-
- public ExportTemporaryGearExampleAction(ManageTemporaryReferentialUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to export
- file = saveFile(
- "exportGearExample",
- "csv",
- _("tutti.manageTemporaryReferential.title.choose.exportTemporaryGearExampleFile"),
- _("tutti.manageTemporaryReferential.action.chooseReferentialGearFile.export"),
- "^.*\\.csv", _("tutti.common.file.csv")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will export example gears temporary " +
- "referential to file: " + file);
- }
-
- ReferentialImportExportService service =
- getContext().getTuttiReferentialImportExportService();
- service.exportTemporaryGearExample(file);
-
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialGearFile.export.success", file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryPersonExampleAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryPersonExampleAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryPersonExampleAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,102 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.referential;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.ReferentialImportExportService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Export an example file of temporary person referential.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ExportTemporaryPersonExampleAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
-
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportTemporaryPersonExampleAction.class);
-
- private File file;
-
- public ExportTemporaryPersonExampleAction(ManageTemporaryReferentialUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to export
- file = saveFile(
- "exportPersonExample",
- "csv",
- _("tutti.manageTemporaryReferential.title.choose.exportTemporaryPersonExampleFile"),
- _("tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.export"),
- "^.*\\.csv", _("tutti.common.file.csv")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will export example persons temporary " +
- "referential to file: " + file);
- }
-
- ReferentialImportExportService service =
- getContext().getTuttiReferentialImportExportService();
-
- service.exportTemporaryPersonExample(file);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.export.success", file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporarySpeciesExampleAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporarySpeciesExampleAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporarySpeciesExampleAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,101 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.referential;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.ReferentialImportExportService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Export an example file of temporary species referential.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ExportTemporarySpeciesExampleAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportTemporarySpeciesExampleAction.class);
-
- private File file;
-
- public ExportTemporarySpeciesExampleAction(ManageTemporaryReferentialUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to export
- file = saveFile(
- "exportSpeciesExample",
- "csv",
- _("tutti.manageTemporaryReferential.title.choose.exportTemporarySpeciesExampleFile"),
- _("tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.export"),
- "^.*\\.csv", _("tutti.common.file.csv")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will export example species temporary " +
- "referential to file: " + file);
- }
-
- ReferentialImportExportService service =
- getContext().getTuttiReferentialImportExportService();
-
- service.exportTemporarySpeciesExample(file);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.export.success", file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryVesselExampleAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryVesselExampleAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ExportTemporaryVesselExampleAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,101 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.referential;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.ReferentialImportExportService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Export an example file of temporary species referential.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ExportTemporaryVesselExampleAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ExportTemporaryVesselExampleAction.class);
-
- private File file;
-
- public ExportTemporaryVesselExampleAction(ManageTemporaryReferentialUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to export
- file = saveFile(
- "exportVesselExample",
- "csv",
- _("tutti.manageTemporaryReferential.title.choose.exportTemporaryVesselExampleFile"),
- _("tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.export"),
- "^.*\\.csv", _("tutti.common.file.csv")
- );
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will export example vessels temporary " +
- "referential to file: " + file);
- }
-
- ReferentialImportExportService service =
- getContext().getTuttiReferentialImportExportService();
-
- service.exportTemporaryVesselExample(file);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.export.success", file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryGearAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryGearAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryGearAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,104 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.referential;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.ReferentialImportExportService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Import temporary gear referential.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ImportTemporaryGearAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ImportTemporaryGearAction.class);
-
- private File file;
-
- public ImportTemporaryGearAction(ManageTemporaryReferentialUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to import
- file = chooseFile(
- _("tutti.manageTemporaryReferential.title.choose.importTemporaryGearFile"),
- _("tutti.manageTemporaryReferential.action.chooseReferentialGearFile.import"),
- "^.*\\.csv", _("tutti.common.file.csv"));
-
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will import gear temporary " +
- "referential from file: " + file);
- }
-
- ReferentialImportExportService service =
- getContext().getTuttiReferentialImportExportService();
-
- service.importTemporaryGear(file);
-
- // reset ui cache
- getDataContext().resetGears();
-
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialGearFile.import.success", file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryPersonAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryPersonAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryPersonAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,103 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.referential;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.ReferentialImportExportService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Import temporary person referential.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ImportTemporaryPersonAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ImportTemporaryPersonAction.class);
-
- private File file;
-
- public ImportTemporaryPersonAction(ManageTemporaryReferentialUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // choose file to import
- file = chooseFile(
- _("tutti.manageTemporaryReferential.title.choose.importTemporaryPersonFile"),
- _("tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.import"),
- "^.*\\.csv", _("tutti.common.file.csv"));
-
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will import person temporary " +
- "referential from file: " + file);
- }
-
- ReferentialImportExportService service =
- getContext().getTuttiReferentialImportExportService();
-
- service.importTemporaryPerson(file);
-
- // reset ui cache
- getDataContext().resetPersons();
-
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.import.success", file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporarySpeciesAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporarySpeciesAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporarySpeciesAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,102 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.referential;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.ReferentialImportExportService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Import temporary species referential.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ImportTemporarySpeciesAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ImportTemporarySpeciesAction.class);
-
- private File file;
-
- public ImportTemporarySpeciesAction(ManageTemporaryReferentialUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
- // choose file to import
- file = chooseFile(
- _("tutti.manageTemporaryReferential.title.choose.importTemporarySpeciesFile"),
- _("tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.import"),
- "^.*\\.csv", _("tutti.common.file.csv"));
-
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will import species temporary " +
- "referential from file: " + file);
- }
-
- ReferentialImportExportService service =
- getContext().getTuttiReferentialImportExportService();
-
- service.importTemporarySpecies(file);
-
- // reset ui cache
- getDataContext().resetSpecies();
-
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.import.success", file));
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryVesselAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryVesselAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ImportTemporaryVesselAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,102 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.referential;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.referential.ReferentialImportExportService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Import temporary vessel referential.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ImportTemporaryVesselAction extends AbstractTuttiAction<TuttiUIContext, ManageTemporaryReferentialUI, ManageTemporaryReferentialUIHandler> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ImportTemporaryVesselAction.class);
-
- private File file;
-
- public ImportTemporaryVesselAction(ManageTemporaryReferentialUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
-
- boolean doAction = super.prepareAction();
-
- if (doAction) {
- // choose file to import
- file = chooseFile(
- _("tutti.manageTemporaryReferential.title.choose.importTemporaryVesselFile"),
- _("tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.import"),
- "^.*\\.csv", _("tutti.common.file.csv"));
-
- doAction = file != null;
- }
- return doAction;
- }
-
- @Override
- public void releaseAction() {
- file = null;
- super.releaseAction();
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkNotNull(file);
- if (log.isInfoEnabled()) {
- log.info("Will import vessel temporary " +
- "referential from file: " + file);
- }
-
- ReferentialImportExportService service =
- getContext().getTuttiReferentialImportExportService();
-
- service.importTemporaryVessel(file);
-
- // reset ui cache
- getDataContext().resetVessels();
-
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
- sendMessage(_("tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.import.success", file));
- }
-}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ManageTemporaryReferentialUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ManageTemporaryReferentialUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ManageTemporaryReferentialUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -40,7 +40,7 @@
#exportSpeciesExampleButton {
actionIcon: export;
text: "tutti.manageTemporaryReferential.action.exportTemporarySpeciesExample";
- _applicationAction: {ExportTemporarySpeciesExampleAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportTemporarySpeciesExampleAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.exportTemporarySpeciesExample.tip";
_help: {"tutti.manageTemporaryReferential.action.exportTemporarySpeciesExample.help"};
}
@@ -48,7 +48,7 @@
#importSpeciesButton {
actionIcon: import;
text: "tutti.manageTemporaryReferential.action.importTemporarySpecies";
- _applicationAction: {ImportTemporarySpeciesAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportTemporarySpeciesAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.importTemporarySpecies.tip";
_help: {"tutti.manageTemporaryReferential.action.importTemporarySpecies.help"};
}
@@ -62,7 +62,7 @@
#exportVesselExampleButton {
actionIcon: export;
text: "tutti.manageTemporaryReferential.action.exportTemporaryVesselExample";
- _applicationAction: {ExportTemporaryVesselExampleAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportTemporaryVesselExampleAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.exportTemporaryVesselExample.tip";
_help: {"tutti.manageTemporaryReferential.action.exportTemporaryVesselExample.help"};
}
@@ -70,7 +70,7 @@
#importVesselButton {
actionIcon: import;
text: "tutti.manageTemporaryReferential.action.importTemporaryVessel";
- _applicationAction: {ImportTemporaryVesselAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportTemporaryVesselAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.importTemporaryVessel.tip";
_help: {"tutti.manageTemporaryReferential.action.importTemporaryVessel.help"};
}
@@ -84,7 +84,7 @@
#exportGearExampleButton {
actionIcon: export;
text: "tutti.manageTemporaryReferential.action.exportTemporaryGearExample";
- _applicationAction: {ExportTemporaryGearExampleAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportTemporaryGearExampleAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.exportTemporaryGearExample.tip";
_help: {"tutti.manageTemporaryReferential.action.exportTemporaryGearExample.help"};
}
@@ -92,7 +92,7 @@
#importGearButton {
actionIcon: import;
text: "tutti.manageTemporaryReferential.action.importTemporaryGear";
- _applicationAction: {ImportTemporaryGearAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportTemporaryGearAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.importTemporaryGear.tip";
_help: {"tutti.manageTemporaryReferential.action.importTemporaryGear.help"};
}
@@ -106,7 +106,7 @@
#exportPersonExampleButton {
actionIcon: export;
text: "tutti.manageTemporaryReferential.action.exportTemporaryPersonExample";
- _applicationAction: {ExportTemporaryPersonExampleAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportTemporaryPersonExampleAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.exportTemporaryPersonExample.tip";
_help: {"tutti.manageTemporaryReferential.action.exportTemporaryPersonExample.help"};
}
@@ -114,7 +114,7 @@
#importPersonButton {
actionIcon: import;
text: "tutti.manageTemporaryReferential.action.importTemporaryPerson";
- _applicationAction: {ImportTemporaryPersonAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.ImportTemporaryPersonAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.importTemporaryPerson.tip";
_help: {"tutti.manageTemporaryReferential.action.importTemporaryPerson.help"};
}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/GenerateReportAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/GenerateReportAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/GenerateReportAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,73 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.report;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.report.ReportModel;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To generate the selected report.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.9
- */
-public class GenerateReportAction extends AbstractTuttiAction<ReportUIModel, ReportUI, ReportUIHandler> {
-
- public GenerateReportAction(ReportUIHandler handler) {
- super(handler, true);
- }
-
- @Override
- public boolean prepareAction() throws Exception {
- boolean doAction = super.prepareAction();
-
- if (doAction) {
-
- // ask user to confirm overwrite if required
- doAction = askOverwriteFile(getModel().getOutputFile());
- }
- return doAction;
- }
-
- @Override
- public void doAction() throws Exception {
- Preconditions.checkState(getModel().isValid());
-
- ReportModel reportModel = getModel().toBean();
- getContext().getReportService().generateReport(reportModel);
- }
-
- @Override
- public void postSuccessAction() {
- super.postSuccessAction();
-
- sendMessage(_("tutti.report.generated", getModel().getOutputFile()));
-
- getModel().reloadOuputFile();
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.css 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.css 2013-11-26 08:03:42 UTC (rev 1388)
@@ -93,7 +93,7 @@
text: "tutti.report.action.cancel";
toolTipText: "tutti.report.action.cancel.tip";
i18nMnemonic: "tutti.report.action.cancel.mnemonic";
- _applicationAction: {GoToPreviousScreenAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.GoToPreviousScreenAction.class};
_help: {"tutti.report.action.cancel.help"};
}
@@ -102,7 +102,7 @@
text: "tutti.report.action.generate";
toolTipText: "tutti.report.action.generate.tip";
i18nMnemonic: "tutti.report.action.generate.mnemonic";
- _applicationAction: {GenerateReportAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.action.GenerateReportAction.class};
enabled: {model.isValid()};
_help: {"tutti.report.action.generate.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.jaxx 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.jaxx 2013-11-26 08:03:42 UTC (rev 1388)
@@ -26,7 +26,6 @@
<import>
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
- fr.ifremer.tutti.ui.swing.content.GoToPreviousScreenAction
fr.ifremer.tutti.ui.swing.util.TuttiUI
jaxx.runtime.swing.editor.FileEditor
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiBeanUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiBeanUIModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiBeanUIModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.PropagatePropertyChangeListener;
+import fr.ifremer.shared.application.listener.PropagatePropertyChangeListener;
import fr.ifremer.tutti.persistence.entities.TuttiEntity;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.util.CollectionUtil;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -25,12 +25,12 @@
* #L%
*/
+import fr.ifremer.shared.application.swing.tab.DelegateTabContainerHandler;
+import fr.ifremer.shared.application.swing.tab.TabContainerHandler;
+import fr.ifremer.shared.application.swing.tab.TabContentModel;
+import fr.ifremer.shared.application.swing.tab.TabHandler;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import javax.swing.DefaultSingleSelectionModel;
-import javax.swing.JTabbedPane;
-import java.awt.Component;
-
/**
* UI containing a tab panel.
*
@@ -38,40 +38,15 @@
* @author kmorin <kmorin(a)codelutin.com>
* @since 0.3
*/
-public abstract class AbstractTuttiTabContainerUIHandler<M, UI extends TuttiUI<M, ?>> extends AbstractTuttiUIHandler<M, UI> {
+public abstract class AbstractTuttiTabContainerUIHandler<M, UI extends TuttiUI<M, ?>> extends AbstractTuttiUIHandler<M, UI> implements TabContainerHandler {
+ DelegateTabContainerHandler delegateTabHandler;
+
protected AbstractTuttiTabContainerUIHandler(TuttiUIContext context, UI ui) {
super(context, ui);
}
- /** @return the tab panel of the UI */
- protected abstract JTabbedPane getTabPanel();
-
/**
- * Method called when the user selects a tab.
- *
- * @param currentIndex
- * @param newIndex
- * @return <code>false</code> if you want to prevent the tab change,
- * <code>true</code> otherwise
- */
- protected boolean onTabChanged(int currentIndex, int newIndex) {
- boolean result = true;
- if (currentIndex != newIndex) {
- TabHandler handler = getTabHandler(currentIndex);
- if (handler != null) {
- result = handler.onHideTab(currentIndex, newIndex);
- }
-
- handler = getTabHandler(newIndex);
- if (handler != null) {
- handler.onShowTab(currentIndex, newIndex);
- }
- }
- return result;
- }
-
- /**
* Returns the tab handler of the tab i.
*
* @param index the index of the tab
@@ -79,49 +54,31 @@
* the {@link TabHandler} interface,
* <code>null</code> otherwise
*/
- protected TabHandler getTabHandler(int index) {
- TabHandler tabHandler = null;
- JTabbedPane tabPanel = getTabPanel();
- if (index >= 0 && index < tabPanel.getTabCount()) {
- Component tab = tabPanel.getComponentAt(index);
- if (TuttiUI.class.isInstance(tab)) {
- TuttiUI tuttiTab = (TuttiUI) tabPanel.getComponentAt(index);
- AbstractTuttiUIHandler handler = tuttiTab.getHandler();
- if (TabHandler.class.isInstance(handler)) {
- tabHandler = (TabHandler) handler;
- }
- }
- }
+ @Override
+ public TabHandler getTabHandler(int index) {
+ TabHandler tabHandler = delegateTabHandler.getTabHandler(index);
return tabHandler;
}
@Override
+ public void setCustomTab(int index, TabContentModel model) {
+ delegateTabHandler.setCustomTab(index, model);
+ }
+
+ @Override
protected void initUI(UI ui) {
super.initUI(ui);
+ delegateTabHandler = new DelegateTabContainerHandler(getTabPanel());
+ delegateTabHandler.init();
+ }
- final JTabbedPane tabPanel = getTabPanel();
- tabPanel.setModel(new DefaultSingleSelectionModel() {
-
- @Override
- public void setSelectedIndex(int index) {
- int currentIndex = tabPanel.getSelectedIndex();
- boolean mustChangeTab = onTabChanged(currentIndex, index);
-
- if (mustChangeTab) {
- super.setSelectedIndex(index);
- }
- }
-
- });
+ @Override
+ public void init() {
+ delegateTabHandler.init();
}
- /**
- * Sets a {@link CustomTab} as tab component.
- *
- * @param index
- * @param model
- */
- protected void setCustomTab(int index, TabContentModel model) {
- getTabPanel().setTabComponentAt(index, new CustomTab(model));
+ @Override
+ public boolean onTabChanged(int currentIndex, int newIndex) {
+ return delegateTabHandler.onTabChanged(currentIndex, newIndex);
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -29,8 +29,6 @@
import fr.ifremer.shared.application.swing.AbstractApplicationUIHandler;
import fr.ifremer.shared.application.swing.action.ApplicationActionUI;
import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
-import fr.ifremer.shared.application.type.ApplicationProgressionModel;
-import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.LabelAware;
import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.entities.data.SampleCategory;
@@ -41,10 +39,6 @@
import fr.ifremer.tutti.ui.swing.content.MainUI;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
import fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment;
-import fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataEditor;
-import jaxx.runtime.JAXXUtil;
-import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.editor.NumberEditor;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -56,23 +50,11 @@
import org.nuiton.decorator.Decorator;
import org.nuiton.validator.bean.simple.SimpleBeanValidator;
-import javax.swing.AbstractAction;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JRootPane;
import javax.swing.JTextField;
-import javax.swing.KeyStroke;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import java.awt.Component;
-import java.awt.Dialog;
-import java.awt.Dimension;
import java.awt.Font;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Set;
@@ -83,61 +65,26 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public abstract class AbstractTuttiUIHandler<M, UI extends TuttiUI<M, ?>> extends fr.ifremer.shared.application.swing.AbstractApplicationUIHandler<M, UI> implements UIMessageNotifier {
+public abstract class AbstractTuttiUIHandler<M, UI extends TuttiUI<M, ?>> extends AbstractApplicationUIHandler<M, UI> implements UIMessageNotifier {
/** Logger. */
private static final Log log =
LogFactory.getLog(AbstractTuttiUIHandler.class);
-// public abstract void beforeInitUI();
-//
-// public abstract void afterInitUI();
-//
-// public abstract void onCloseUI();
-//
-// public abstract SwingValidator<M> getValidator();
-
-// /**
-// * Global application context.
-// *
-// * @since 0.1
-// */
-// protected final TuttiUIContext context;
-//
-// /**
-// * UI handled.
-// *
-// * @since 0.1
-// */
-// protected final UI ui;
-
protected AbstractTuttiUIHandler(TuttiUIContext context, UI ui) {
super(context, ui);
-// this.context = context;
-// this.ui = ui;
}
//------------------------------------------------------------------------//
//-- Public methods --//
//------------------------------------------------------------------------//
-// public DefaultComboBoxModel newComboModel(Object... items) {
-// return new DefaultComboBoxModel(items);
-// }
-
-// public final M getModel() {
-// return ui.getModel();
-// }
-//
-// public final UI getUI() {
-// return ui;
-// }
-
@Override
public void showInformationMessage(String message) {
getContext().showInformationMessage(message);
}
+ @Override
public TuttiUIContext getContext() {
return (TuttiUIContext) super.getContext();
}
@@ -150,165 +97,7 @@
return getContext().getConfig();
}
-// public void setText(KeyEvent event, String property) {
-// JTextComponent field = (JTextComponent) event.getSource();
-// String value = field.getText();
-// TuttiUIUtil.setProperty(getModel(), property, value);
-// }
-
-// public void setFile(ActionEvent event, String property) {
-// FileEditor field = (FileEditor) event.getSource();
-// File value = field.getSelectedFile();
-// TuttiUIUtil.setProperty(getModel(), property, value);
-// }
-
-// public void setBoolean(ItemEvent event, String property) {
-// boolean value = event.getStateChange() == ItemEvent.SELECTED;
-// 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();
-// ListSelectionModel selectionModel = list.getSelectionModel();
-//
-// selectionModel.setValueIsAdjusting(true);
-// try {
-// List selectedList = Lists.newLinkedList();
-//
-// for (int index : list.getSelectedIndices()) {
-// Object o = list.getModel().getElementAt(index);
-// selectedList.add(o);
-// }
-// TuttiUIUtil.setProperty(getModel(), property, selectedList);
-// } finally {
-// selectionModel.setValueIsAdjusting(false);
-// }
-// }
-// }
-
- public void openDialog(TuttiUI dialogContent,
- String title, Dimension dim) {
- Component topestUI = getTopestUI();
-
- JDialog result;
- if (topestUI instanceof Frame) {
- result = new JDialog((Frame) topestUI, title, true);
- } else {
- result = new JDialog((Dialog) topestUI, title, true);
- }
-
- result.add((Component) dialogContent);
- result.setResizable(true);
-
- result.setSize(dim);
-
- final AbstractApplicationUIHandler handler = dialogContent.getHandler();
-
- if (handler instanceof Cancelable) {
-
- // add a auto-close action
- JRootPane rootPane = result.getRootPane();
-
- KeyStroke shortcutClosePopup = getConfig().getShortcutClosePopup();
-
- rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
- shortcutClosePopup, "close");
- rootPane.getActionMap().put("close", new AbstractAction() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void actionPerformed(ActionEvent e) {
- ((Cancelable) handler).cancel();
- }
- });
- }
-
- result.addWindowListener(new WindowAdapter() {
-
- @Override
- public void windowClosed(WindowEvent e) {
- Component ui = (Component) e.getSource();
- if (log.isDebugEnabled()) {
- log.debug("Destroy ui " + ui);
- }
- JAXXUtil.destroy(ui);
- }
- });
- SwingUtil.center(getContext().getMainUI(), result);
- result.setVisible(true);
- }
-
- public void closeDialog(TuttiUI ui) {
- SwingUtil.getParentContainer(ui, JDialog.class).setVisible(false);
- }
-
- public static final String CONFIRMATION_FORMAT = "<html>%s<hr/><br/>%s</html>";
-
-// public int askSaveBeforeLeaving(String message) {
-// String htmlMessage = String.format(
-// CONFIRMATION_FORMAT,
-// message,
-// _("tutti.common.askSaveBeforeLeaving.help"));
-// int result = JOptionPane.showConfirmDialog(
-// getTopestUI(),
-// htmlMessage,
-// _("tutti.common.askSaveBeforeLeaving.title"),
-// JOptionPane.YES_NO_CANCEL_OPTION,
-// JOptionPane.QUESTION_MESSAGE);
-// return result;
-// }
-
-// public boolean askCancelEditBeforeLeaving(String message) {
-// String htmlMessage = String.format(
-// CONFIRMATION_FORMAT,
-// message,
-// _("tutti.common.askCancelEditBeforeLeaving.help"));
-// int i = JOptionPane.showConfirmDialog(
-// getTopestUI(),
-// htmlMessage,
-// _("tutti.common.askCancelEditBeforeLeaving.title"),
-// JOptionPane.OK_CANCEL_OPTION,
-// JOptionPane.QUESTION_MESSAGE);
-//
-// boolean result = i == JOptionPane.OK_OPTION;
-// return result;
-// }
-
-// public void showSuccessMessage(String title, String message) {
-//
-// Component topestUI = getTopestUI();
-// boolean alwaysOnTop = false;
-//
-// if (topestUI instanceof JDialog) {
-// alwaysOnTop = ((JDialog) topestUI).isAlwaysOnTop();
-// }
-//
-// if (alwaysOnTop) {
-// ((JDialog) topestUI).setAlwaysOnTop(false);
-// }
-// try {
-//
-// JOptionPane.showMessageDialog(
-// topestUI,
-// message,
-// title,
-// JOptionPane.INFORMATION_MESSAGE,
-// UIManager.getIcon("info")
-// );
-// } finally {
-// if (alwaysOnTop) {
-// ((JDialog) topestUI).setAlwaysOnTop(true);
-// }
-// }
-// }
-
+ @Override
public Component getTopestUI() {
Component result;
ApplicationActionUI actionUI = getContext().getActionUI();
@@ -346,81 +135,7 @@
return decorator;
}
-// public void autoSelectRowInTable(MouseEvent e, JPopupMenu popup) {
-//
-// boolean rightClick = SwingUtilities.isRightMouseButton(e);
-//
-// if (rightClick || SwingUtilities.isLeftMouseButton(e)) {
-//
-// // get the coordinates of the mouse click
-// Point p = e.getPoint();
-//
-// JXTable source = (JXTable) e.getSource();
-//
-// int[] selectedRows = source.getSelectedRows();
-// int[] selectedColumns = source.getSelectedColumns();
-//
-// // get the row index at this point
-// int rowIndex = source.rowAtPoint(p);
-//
-// // get the column index at this point
-// int columnIndex = source.columnAtPoint(p);
-//
-// if (log.isDebugEnabled()) {
-// log.debug("At point [" + p + "] found Row " + rowIndex + ", Column " + columnIndex);
-// }
-//
-// boolean canContinue = true;
-//
-// if (source.isEditing()) {
-//
-// // stop editing
-// boolean stopEdit = source.getCellEditor().stopCellEditing();
-// if (!stopEdit) {
-// if (log.isWarnEnabled()) {
-// log.warn("Could not stop edit cell...");
-// }
-// canContinue = false;
-// }
-// }
-//
-// if (canContinue) {
-//
-// // select row (could empty selection)
-// if (rowIndex == -1) {
-// source.clearSelection();
-// } else if (!ArrayUtils.contains(selectedRows, rowIndex)) {
-// if (ListSelectionModel.MULTIPLE_INTERVAL_SELECTION == source.getSelectionMode()) {
-// // add to selection
-// source.addRowSelectionInterval(rowIndex, rowIndex);
-// } else {
-// // set selection
-// source.setRowSelectionInterval(rowIndex, rowIndex);
-// }
-// }
-//
-// // select column (could empty selection)
-// if (columnIndex == -1) {
-// source.clearSelection();
-// } else if (!ArrayUtils.contains(selectedColumns, columnIndex)) {
-// source.setColumnSelectionInterval(columnIndex, columnIndex);
-// }
-//
-// if (rightClick) {
-//
-// // use now model coordinate
-// int modelRowIndex = source.convertRowIndexToModel(rowIndex);
-// int modelColumnIndex = source.convertColumnIndexToModel(columnIndex);
-//
-// beforeOpenPopup(modelRowIndex, modelColumnIndex);
-//
-// // on right click show popup
-// popup.show(source, e.getX(), e.getY());
-// }
-// }
-// }
-// }
-
+ @Override
protected void addHighlighters(final JXTable table) {
HighlightPredicate notSelectedPredicate = new HighlightPredicate.NotHighlightPredicate(HighlightPredicate.IS_SELECTED);
@@ -528,60 +243,10 @@
});
}
-// public void openRowMenu(KeyEvent e, JPopupMenu popup) {
-//
-// if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU) {
-//
-// JXTable source = (JXTable) e.getSource();
-//
-// // get the lowest selected row
-// int[] selectedRows = source.getSelectedRows();
-// int lowestRow = -1;
-// for (int row : selectedRows) {
-// lowestRow = Math.max(lowestRow, row);
-// }
-// // get the selected column
-// int selectedColumn = source.getSelectedColumn();
-// Rectangle r = source.getCellRect(lowestRow, selectedColumn, true);
-//
-// // get the point in the middle lower of the cell
-// Point p = new Point(r.x + r.width / 2, r.y + r.height);
-//
-// if (log.isDebugEnabled()) {
-// log.debug("Row " + lowestRow + " found t point [" + p + "]");
-// }
-//
-// boolean canContinue = true;
-//
-// if (source.isEditing()) {
-//
-// // stop editing
-// boolean stopEdit = source.getCellEditor().stopCellEditing();
-// if (!stopEdit) {
-// if (log.isWarnEnabled()) {
-// log.warn("Could not stop edit cell...");
-// }
-// canContinue = false;
-// }
-// }
-//
-// if (canContinue) {
-//
-// // use now model coordinate
-// int rowIndex = source.convertRowIndexToModel(lowestRow);
-// int columnIndex = source.convertColumnIndexToModel(selectedColumn);
-// beforeOpenPopup(rowIndex, columnIndex);
-//
-// popup.show(source, p.x, p.y);
-// }
-// }
-// }
-
//------------------------------------------------------------------------//
//-- Init methods --//
//------------------------------------------------------------------------//
-
@Override
protected void initUIComponent(Object component) {
if (component instanceof ButtonAttachment) {
@@ -592,58 +257,6 @@
}
}
-// protected void initUI(TuttiUI ui) {
-//
-// for (Map.Entry<String, Object> entry : ui.get$objectMap().entrySet()) {
-// Object component = entry.getValue();
-// if (component instanceof NumberEditor) {
-//
-// initNumberEditor((NumberEditor) component);
-// } else if (component instanceof JXDatePicker) {
-//
-// initDatePicker((JXDatePicker) component);
-// } else if (component instanceof SimpleTimeEditor) {
-//
-// initTimeEditor((SimpleTimeEditor) component);
-// } else if (component instanceof ButtonAttachment) {
-//
-// initButtonAttachment((ButtonAttachment) component);
-// } else if (component instanceof JLabel) {
-//
-// initLabel((JLabel) component);
-// } else if (component instanceof JTextField) {
-//
-// initTextField((JTextField) component);
-// } else if (component instanceof AbstractButton) {
-//
-// initButton((AbstractButton) component);
-// } else if (component instanceof JScrollPane) {
-//
-// initScrollPane((JScrollPane) component);
-// } else if (component instanceof DmsCoordinateEditor) {
-//
-// initCoordinateDMSEditor((DmsCoordinateEditor) component);
-// } else if (component instanceof DmdCoordinateEditor) {
-//
-// initCoordinateDMDEditor((DmdCoordinateEditor) component);
-// }
-// }
-//
-// ((Component) ui).addHierarchyListener(new HierarchyListener() {
-// @Override
-// public void hierarchyChanged(HierarchyEvent e) {
-// JComponent component = getComponentToFocus();
-// if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0
-// && e.getChanged().isShowing()
-// && component != null) {
-// component.requestFocus();
-// }
-// }
-// });
-// }
-
-// protected abstract JComponent getComponentToFocus();
-
protected void initTextField(JTextField jTextField) {
super.initTextField(jTextField);
Boolean computed = (Boolean) jTextField.getClientProperty("computed");
@@ -654,323 +267,17 @@
jTextField.setEnabled(false);
jTextField.setDisabledTextColor(getConfig().getColorComputedWeights());
}
-// if (isAutoSelectOnFocus(jTextField)) {
-// addAutoSelectOnFocus(jTextField);
-// }
}
- protected void initLabel(JLabel jLabel) {
- super.initLabel(jLabel);
-// Boolean strongStyle = (Boolean) jLabel.getClientProperty("strongStyle");
-// Boolean italicStyle = (Boolean) jLabel.getClientProperty("italicStyle");
-// Font font = jLabel.getFont();
-// int style = font.getStyle();
-// if (strongStyle != null && strongStyle) {
-// style |= Font.BOLD;
-// }
-// if (italicStyle != null && italicStyle) {
-// style |= Font.ITALIC;
-// }
-// jLabel.setFont(font.deriveFont(style));
-
- WeightUnit weightUnit = (WeightUnit) jLabel.getClientProperty("addWeightUnit");
- if (weightUnit != null) {
- String text = weightUnit.decorateLabel(jLabel.getText());
- jLabel.setText(text);
-
- String tip = weightUnit.decorateTip(jLabel.getToolTipText());
- jLabel.setToolTipText(tip);
-
- Component labelFor = jLabel.getLabelFor();
- if (labelFor instanceof TuttiComputedOrNotDataEditor) {
-
- // set also the number of digits (4 for kg, 1 for g)
- TuttiComputedOrNotDataEditor editor = (TuttiComputedOrNotDataEditor) labelFor;
- editor.setNumberPattern(weightUnit.getNumberEditorPattern());
- editor.setDecimalNumber(weightUnit.getNumberDigits());
- } else if (labelFor instanceof NumberEditor) {
-
- // set also the number of digits (4 for kg, 1 for g)
- NumberEditor editor = (NumberEditor) labelFor;
- editor.setNumberPattern(weightUnit.getNumberEditorPattern());
- }
- }
- }
-
protected void initButtonAttachment(ButtonAttachment component) {
component.init();
}
-// protected void initButton(AbstractButton abstractButton) {
-//
-// Class actionName = (Class) abstractButton.getClientProperty("tuttiAction");
-// if (actionName != null) {
-// Action action = TuttiActionHelper.createUIAction(this, abstractButton, actionName);
-// abstractButton.setAction(action);
-// }
-// }
-//
-// /**
-// * Prépare un component de choix d'entités pour un type d'entité donné et
-// * pour un service de persistance donné.
-// *
-// * @param comboBox le component graphique à initialiser
-// */
-// protected <E extends Serializable> void initBeanFilterableComboBox(
-// BeanFilterableComboBox<E> comboBox,
-// List<E> data,
-// E selectedData) {
-//
-// initBeanFilterableComboBox(comboBox, data, selectedData, null);
-// }
-//
-// protected <E extends Serializable> void initBeanFilterableComboBox(
-// BeanFilterableComboBox<E> comboBox,
-// List<E> data,
-// E selectedData,
-// String decoratorContext) {
-//
-// Preconditions.checkNotNull(comboBox, "No comboBox!");
-//
-// Class<E> beanType = comboBox.getBeanType();
-//
-// Preconditions.checkNotNull(beanType, "No beanType on the combobox!");
-//
-// Decorator<E> decorator = getDecorator(beanType, decoratorContext);
-//
-// if (data == null) {
-// data = Lists.newArrayList();
-// }
-//
-// if (log.isDebugEnabled()) {
-// log.debug("entity comboBox list [" + beanType.getName() + "] : " +
-// (data == null ? 0 : data.size()));
-// }
-//
-// comboBox.setI18nPrefix("tutti.property.");
-//
-// // add data list to combo box
-// comboBox.init((JXPathDecorator<E>) decorator, data);
-//
-// comboBox.setSelectedItem(selectedData);
-//
-// if (log.isDebugEnabled()) {
-// log.debug("combo [" + beanType.getName() + "] : " +
-// comboBox.getData().size());
-// }
-// }
-
-// /**
-// * Prépare un component de choix d'entités pour un type d'entité donné et
-// * pour un service de persistance donné.
-// *
-// * @param list le component graphique à initialiser
-// * @param data la liste des données à mettre dans la liste de gauche
-// * @param selectedData la liste des données à mettre dans la liste de droite
-// */
-// protected <E extends Serializable> void initBeanList(
-// BeanDoubleList<E> list,
-// List<E> data,
-// List<E> selectedData,
-// Decorator<E> selectedDecorator) {
-//
-// Preconditions.checkNotNull(list, "No list!");
-//
-// Class<E> beanType = list.getBeanType();
-// Preconditions.checkNotNull(beanType, "No beanType on the double list!");
-//
-// Decorator<E> decorator = getDecorator(beanType, null);
-//
-// if (log.isDebugEnabled()) {
-// log.debug("entity list [" + beanType.getName() + "] : " +
-// (data == null ? 0 : data.size()));
-// }
-//
-// list.setI18nPrefix("tutti.property.");
-//
-// // add data list to combo box
-// list.init((JXPathDecorator<E>) decorator,
-// (JXPathDecorator<E>) selectedDecorator,
-// data,
-// selectedData);
-//
-// if (log.isDebugEnabled()) {
-// log.debug("Jlist [" + beanType.getName() + "] : " +
-// list.getUniverseList().getModel().getSize());
-// }
-// }
-
-// /**
-// * Prépare un component de choix d'entités pour un type d'entité donné et
-// * pour un service de persistance donné.
-// *
-// * @param list le component graphique à initialiser
-// * @param data la liste des données à mettre dans la liste de gauche
-// * @param selectedData la liste des données à mettre dans la liste de droite
-// */
-// protected <E extends Serializable> void initBeanList(
-// BeanDoubleList<E> list,
-// List<E> data,
-// List<E> selectedData) {
-//
-// initBeanList(list, data, selectedData, null);
-// }
-
-// protected void initNumberEditor(NumberEditor editor) {
-// if (log.isDebugEnabled()) {
-// 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);
-// }
-//
-// if (isAutoSelectOnFocus(editor)) {
-//
-// addAutoSelectOnFocus(editor.getTextField());
-// }
-// }
-
-// protected void initTimeEditor(SimpleTimeEditor editor) {
-// if (log.isDebugEnabled()) {
-// log.debug("init time editor " + editor.getName() +
-// " for property " + editor.getModel().getProperty());
-// }
-// editor.init();
-//
-// if (isAutoSelectOnFocus(editor)) {
-// addAutoSelectOnFocus(((JSpinner.DefaultEditor) editor.getHour().getEditor()).getTextField());
-// addAutoSelectOnFocus(((JSpinner.DefaultEditor) editor.getMinute().getEditor()).getTextField());
-// }
-// }
-
-// protected void initCoordinateDMSEditor(DmsCoordinateEditor editor) {
-// editor.init();
-// }
-//
-// protected void initCoordinateDMDEditor(DmdCoordinateEditor editor) {
-// editor.init();
-// }
-
-// protected void initDatePicker(final JXDatePicker picker) {
-//
-// if (log.isDebugEnabled()) {
-// log.debug("disable JXDatePicker editor" + picker.getName());
-// }
-// String dateFormat = getConfig().getDateFormat();
-// picker.setFormats(dateFormat);
-// picker.setToolTipText(_("tutti.common.datefield.tip", dateFormat));
-// picker.getEditor().addFocusListener(new FocusAdapter() {
-//
-// @Override
-// public void focusLost(FocusEvent e) {
-// try {
-// picker.commitEdit();
-//
-// } catch (ParseException ex) {
-// if (log.isDebugEnabled()) {
-// log.debug("format error", ex);
-// }
-// picker.requestFocus();
-// }
-// }
-// });
-//
-// if (isAutoSelectOnFocus(picker)) {
-// addAutoSelectOnFocus(picker.getEditor());
-// }
-// }
-
-// protected void initScrollPane(JScrollPane scrollPane) {
-// Boolean onlyVerticalScrollable = (Boolean) scrollPane.getClientProperty("onlyVerticalScrollable");
-// if (onlyVerticalScrollable != null && onlyVerticalScrollable) {
-// scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
-// scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
-//
-// final JViewport viewport = scrollPane.getViewport();
-// viewport.addChangeListener(new ChangeListener() {
-// @Override
-// public void stateChanged(ChangeEvent e) {
-// Dimension newDimension = new Dimension(viewport.getExtentSize().width,
-// viewport.getViewSize().height);
-// viewport.setViewSize(newDimension);
-// }
-// });
-// }
-// }
-
-// protected boolean isAutoSelectOnFocus(JComponent comp) {
-// Object selectOnFocus = comp.getClientProperty("selectOnFocus");
-// return selectOnFocus != null && Boolean.valueOf(selectOnFocus.toString());
-// }
-
-// protected void addAutoSelectOnFocus(JTextField jTextField) {
-// jTextField.addFocusListener(new FocusAdapter() {
-// @Override
-// public void focusGained(final FocusEvent e) {
-// SwingUtilities.invokeLater(new Runnable() {
-// @Override
-// public void run() {
-// JTextField source = (JTextField) e.getSource();
-// source.selectAll();
-// }
-// });
-//
-// }
-// });
-// }
-
//------------------------------------------------------------------------//
//-- Internal methods --//
//------------------------------------------------------------------------//
-// protected boolean quitScreen(boolean modelIsValid,
-// boolean modelIsModify,
-// String askGiveUpMessage,
-// String askSaveMessage,
-// Action saveAction) {
-// boolean result;
-//
-// if (!modelIsValid) {
-//
-// // model is not valid
-// // ask user to qui or not
-// result = askCancelEditBeforeLeaving(askGiveUpMessage);
-//
-// } else if (modelIsModify) {
-//
-// // something is modify ask user what to do
-// int answer = askSaveBeforeLeaving(askSaveMessage);
-// switch (answer) {
-// case JOptionPane.YES_OPTION:
-//
-// // ok save
-// saveAction.actionPerformed(null);
-// result = true;
-// break;
-// case JOptionPane.NO_OPTION:
-//
-// // do not save but can still quit the screen (so nothing to do)
-// result = true;
-// break;
-// default:
-// // do not save and stay here (so nothing to do)
-// result = false;
-//
-// }
-// } else {
-//
-// // model is valid and not modify, can safely quit screen
-// result = true;
-// }
-// return result;
-// }
-
protected void registerValidators(SwingValidator... validators) {
MainUI main = getContext().getMainUI();
Preconditions.checkNotNull(
@@ -982,37 +289,6 @@
}
}
-// protected String decorate(Serializable object) {
-// return decorate(object, null);
-// }
-//
-// protected String decorate(Serializable object, String context) {
-// String result = "";
-// if (object != null) {
-// result = getDecorator(object.getClass(), context).toString(object);
-// }
-// return result;
-// }
-//
-// protected <O extends Serializable> ListCellRenderer newListCellRender(Class<O> type) {
-//
-// return newListCellRender(type, null);
-// }
-//
-// protected <O extends Serializable> ListCellRenderer newListCellRender(Class<O> type, String name) {
-//
-// Decorator<O> decorator = getDecorator(type, name);
-// return newListCellRender(decorator);
-// }
-//
-// protected <O> ListCellRenderer newListCellRender(Decorator<O> decorator) {
-//
-// Preconditions.checkNotNull(decorator);
-//
-// ListCellRenderer result = new DecoratorListCellRenderer(decorator);
-// return result;
-// }
-
protected void listenValidatorValid(SimpleBeanValidator validator,
final AbstractTuttiBeanUIModel model) {
validator.addPropertyChangeListener(SimpleBeanValidator.VALID_PROPERTY, new PropertyChangeListener() {
@@ -1067,195 +343,6 @@
ui.getHandler().onCloseUI();
}
-// protected <B> void changeValidatorContext(String newContext,
-// SwingValidator<B> validator) {
-// B bean = validator.getBean();
-// validator.setContext(newContext);
-// validator.setBean(bean);
-// }
-
-// protected <R> TableColumnExt addColumnToModel(TableColumnModel model,
-// TableCellEditor editor,
-// TableCellRenderer renderer,
-// ColumnIdentifier<R> identifier) {
-//
-// return addColumnToModel(model, editor, renderer, identifier, null);
-// }
-
-
-// protected <R> TableColumnExt addColumnToModel(TableColumnModel model,
-// TableCellEditor editor,
-// TableCellRenderer renderer,
-// ColumnIdentifier<R> identifier,
-// WeightUnit weightUnit) {
-//
-// TableColumnExt col = new TableColumnExt(model.getColumnCount());
-// col.setCellEditor(editor);
-// col.setCellRenderer(renderer);
-// String label = _(identifier.getHeaderI18nKey());
-// if (weightUnit != null) {
-// label = weightUnit.decorateLabel(label);
-// }
-// col.setHeaderValue(label);
-// String tip = _(identifier.getHeaderTipI18nKey());
-// if (weightUnit != null) {
-// tip = weightUnit.decorateTip(tip);
-// }
-// col.setToolTipText(tip);
-//
-// col.setIdentifier(identifier);
-// model.addColumn(col);
-// // by default no column is sortable, must specify it
-// col.setSortable(false);
-// return col;
-// }
-
-// protected <R> TableColumnExt addColumnToModel(TableColumnModel model,
-// ColumnIdentifier<R> identifier) {
-//
-// return addColumnToModel(model, null, null, identifier, null);
-// }
-
-// protected <R> TableColumnExt addFloatColumnToModel(TableColumnModel model,
-// ColumnIdentifier<R> identifier,
-// String numberPattern,
-// JTable table) {
-//
-// NumberCellEditor<Float> editor =
-// JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
-// editor.getNumberEditor().setSelectAllTextOnError(true);
-// editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
-// editor.getNumberEditor().setNumberPattern(numberPattern);
-//
-// TableCellRenderer renderer =
-// newNumberCellRenderer(table.getDefaultRenderer(Number.class));
-//
-// return addColumnToModel(model, editor, renderer, identifier, null);
-// }
-
-// protected <R> TableColumnExt addFloatColumnToModel(TableColumnModel model,
-// ColumnIdentifier<R> identifier,
-// WeightUnit weightUnit,
-// JTable table) {
-//
-// Preconditions.checkNotNull(weightUnit);
-// NumberCellEditor<Float> editor =
-// JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
-// editor.getNumberEditor().setSelectAllTextOnError(true);
-// editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
-// editor.getNumberEditor().setNumberPattern(weightUnit.getNumberEditorPattern());
-//
-// TableCellRenderer renderer =
-// newNumberCellRenderer(table.getDefaultRenderer(Number.class));
-//
-// return addColumnToModel(model, editor, renderer, identifier, weightUnit);
-// }
-
-// protected <R> TableColumnExt addIntegerColumnToModel(TableColumnModel model,
-// ColumnIdentifier<R> identifier,
-// String numberPattern,
-// JTable table) {
-//
-// NumberCellEditor<Integer> editor =
-// JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false);
-// editor.getNumberEditor().setSelectAllTextOnError(true);
-// editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
-// editor.getNumberEditor().setNumberPattern(numberPattern);
-//
-// TableCellRenderer renderer = newNumberCellRenderer(table.getDefaultRenderer(Number.class));
-// return addColumnToModel(model, editor, renderer, identifier, null);
-// }
-
-
-// TableCellRenderer newNumberCellRenderer(final TableCellRenderer defaultRenderer) {
-// TableCellRenderer result = new TableCellRenderer() {
-// @Override
-// public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
-// Component result = defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-// if (result instanceof JLabel) {
-// JLabel jLabel = (JLabel) result;
-// jLabel.setHorizontalTextPosition(SwingConstants.RIGHT);
-//
-// }
-// return result;
-// }
-// };
-// return result;
-// }
-
-
-// protected <R> TableColumnExt addBooleanColumnToModel(TableColumnModel model,
-// ColumnIdentifier<R> identifier,
-// JTable table) {
-//
-// return addColumnToModel(model,
-// table.getDefaultEditor(Boolean.class),
-// table.getDefaultRenderer(Boolean.class),
-// identifier,
-// null);
-// }
-
-// protected <R, B> TableColumnExt addComboDataColumnToModel(TableColumnModel model,
-// ColumnIdentifier<R> identifier,
-// Decorator<B> decorator,
-// List<B> data) {
-// JComboBox comboBox = new JComboBox();
-// comboBox.setRenderer(newListCellRender(decorator));
-//
-// List<B> dataToList = Lists.newArrayList(data);
-//
-// // add a null value at first position
-// if (!dataToList.isEmpty() && dataToList.get(0) != null) {
-// dataToList.add(0, null);
-// }
-// SwingUtil.fillComboBox(comboBox, dataToList, null);
-//
-// ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
-// BeanUIUtil.decorate(comboBox, converter);
-// ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox);
-//
-// return addColumnToModel(model,
-// editor,
-// newTableCellRender(decorator),
-// identifier,
-// null);
-// }
-
-// protected <O extends Serializable> TableCellRenderer newTableCellRender(Class<O> type) {
-//
-// return newTableCellRender(type, null);
-// }
-
-// protected <O extends Serializable> TableCellRenderer newTableCellRender(Class<O> type, String name) {
-//
-// Decorator<O> decorator = getDecorator(type, name);
-//
-// TableCellRenderer result = newTableCellRender(decorator);
-// return result;
-// }
-
-// protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) {
-//
-// Preconditions.checkNotNull(decorator);
-//
-// DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator, true);
-// return result;
-// }
-
-// /**
-// * Hook to prepare popup just before showing it.
-// * <p/>
-// * The right place to update actions accessibility; a quite better design
-// * than trying to update each time something change in the table...
-// *
-// * @param rowIndex selected row index (or lowest selected one)
-// * @param columnIndex selected column index
-// * @since 2.6
-// */
-// protected void beforeOpenPopup(int rowIndex, int columnIndex) {
-//
-// }
-
protected String buildReminderLabelTitle(Species species,
Iterable<SampleCategory<?>> categories,
String prefix,
@@ -1289,14 +376,4 @@
return title.toString();
}
- protected void incrementsMessage(String message) {
-
- ApplicationActionUI actionUI = getContext().getActionUI();
- if (actionUI != null) {
- ApplicationProgressionModel progressionModel = actionUI.getModel().getProgressionModel();
- if (progressionModel != null)
-
- progressionModel.increments(message);
- }
- }
}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ActionListCellRenderer.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ActionListCellRenderer.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ActionListCellRenderer.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,61 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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 javax.swing.Action;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.Icon;
-import javax.swing.JButton;
-import javax.swing.JList;
-import javax.swing.border.EmptyBorder;
-import java.awt.Component;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class ActionListCellRenderer extends DefaultListCellRenderer {
-
- private static final long serialVersionUID = 1L;
-
- protected final EmptyBorder border = new EmptyBorder(4, 8, 4, 8);
-
- @Override
- public Component getListCellRendererComponent(JList list,
- Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus) {
-
- Component result = super.getListCellRendererComponent(
- list, value, index, isSelected, cellHasFocus);
- Action action = ((JButton) value).getAction();
- setIcon((Icon) action.getValue(Action.LARGE_ICON_KEY));
- setText((String) action.getValue(Action.NAME));
- setToolTipText((String) action.getValue(Action.SHORT_DESCRIPTION));
- setBorder(border);
- return result;
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/Cancelable.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/Cancelable.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/Cancelable.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,36 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-/**
- * To cancel contract.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public interface Cancelable {
-
- void cancel();
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/CustomTab.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/CustomTab.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/CustomTab.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,127 +0,0 @@
-
-package fr.ifremer.tutti.ui.swing.util;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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 jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.beans.BeanUtil;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.UIManager;
-import java.awt.Color;
-import java.awt.Font;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Custom tab component which adds a * in the end of the title
- * when the content is modified.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 0.3
- */
-public class CustomTab extends JPanel {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log = LogFactory.getLog(CustomTab.class);
-
- protected TabContentModel model;
-
- protected JLabel title = new JLabel();
-
- public TabContentModel getModel() {
- return model;
- }
-
- public CustomTab(TabContentModel model) {
- this.model = model;
- try {
- BeanUtil.addPropertyChangeListener(
- new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- updateTitle();
- }
- }, this.model);
-
- } catch (Exception ex) {
- log.error("Error while adding the listener to the model modifications", ex);
- }
-
- setBackground(null);
-
- updateTitle();
- String actionIcon = model.getIcon();
- if (actionIcon != null) {
- title.setIcon(SwingUtil.createActionIcon(actionIcon));
- }
- add(title);
- }
-
- @Override
- public void setBackground(Color bg) {
- if (bg == null) {
- bg = new Color(0, 0, 0, 0);
- }
- super.setBackground(bg);
- revalidate();
- }
-
- @Override
- public void setForeground(Color fg) {
- super.setForeground(fg);
- if (title != null) {
- title.setForeground(fg);
- }
- }
-
- protected void updateTitle() {
- Font f = UIManager.getDefaults().getFont("Label.font");
- String titleValue = _(model.getTitle());
-
- int style;
- if (model.isModify()) {
- style = Font.BOLD;
- titleValue += "*";
-
- } else if (model.isEmpty()) {
- style = Font.ITALIC;
-
- } else {
- style = Font.PLAIN;
- }
-
- title.setText(titleValue);
- title.setFont(f.deriveFont(style));
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabContentModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabContentModel.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabContentModel.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,44 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-/**
- * Interface defining the models of the tab content UIs.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.2
- */
-public interface TabContentModel {
-
- boolean isEmpty();
-
- boolean isValid();
-
- boolean isModify();
-
- String getTitle();
-
- String getIcon();
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,53 +0,0 @@
-
-package fr.ifremer.tutti.ui.swing.util;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-/**
- * Interface describing UI contained in a tab.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 0.3
- */
-public interface TabHandler {
-
- /**
- * Method called when the tab is hidden
- *
- * @param currentIndex
- * @param newIndex
- * @return <code>false</code> to prevent the tab to be hidden,
- * <code>true</code> otherwise.
- */
- boolean onHideTab(int currentIndex, int newIndex);
-
- /**
- * Method called when the tab is shown
- *
- * @param currentIndex
- * @param newIndex
- */
- void onShowTab(int currentIndex, int newIndex);
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiComputedOrNotData.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiComputedOrNotData.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiComputedOrNotData.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,122 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.PropagatePropertyChangeListener;
-import org.jdesktop.beans.AbstractSerializableBean;
-
-
-/** @author kmorin <kmorin(a)codelutin.com> */
-public class TuttiComputedOrNotData<N extends Number> extends AbstractSerializableBean {
-
- public static final String PROPERTY_DATA = "data";
-
- public static final String PROPERTY_COMPUTED_DATA = "computedData";
-
- private static final long serialVersionUID = 1L;
-
- protected N data;
-
- protected N computedData;
-
- public TuttiComputedOrNotData() {
- data = null;
- computedData = null;
- }
-
- public TuttiComputedOrNotData(N data, N computedData) {
- this.data = data;
- this.computedData = computedData;
- }
-
- public N getData() {
- return data;
- }
-
- public void setData(N data) {
- Object oldValue = getData();
- this.data = data;
- firePropertyChange(PROPERTY_DATA, oldValue, data);
- }
-
- public N getComputedData() {
- return computedData;
- }
-
- public void setComputedData(N computedData) {
- Object oldValue = getComputedData();
- this.computedData = computedData;
- firePropertyChange(PROPERTY_COMPUTED_DATA, oldValue, computedData);
- }
-
- @Override
- public String toString() {
- String result = null;
- if (data != null) {
- result = data.toString();
- } else if (computedData != null) {
- result = computedData.toString();
- }
- return result;
- }
-
- /**
- * Add a listener to propagate the modification of the
- * {@link #PROPERTY_DATA} property to a given {@code propertyName}.
- *
- * @param propertyName name of the property to fire on given bean
- * @param otherBean bean that will fires
- * @since 1.2
- */
- public void addPropagateListener(String propertyName,
- PropagatePropertyChangeListener.PropagatePropertyChange otherBean) {
-
- PropagatePropertyChangeListener.listenAndPropagate(this,
- otherBean,
- PROPERTY_DATA,
- propertyName);
-
-// PropagatePropertyChangeListener listener = new PropagatePropertyChangeListener(propertyName, otherBean);
-// addPropertyChangeListener(PROPERTY_DATA, listener);
- }
-
-// private static class PropagateProperyChangeListener implements PropertyChangeListener {
-//
-// private String propertyName;
-//
-// private AbstractTuttiBeanUIModel otherBean;
-//
-// public PropagatePropertyChangeLstener(String propertyName,
-// AbstractTuttiBeanUIModel otherBean) {
-// this.propertyName = propertyName;
-// this.otherBean = otherBean;
-// }
-//
-// @Override
-// public void propertyChange(PropertyChangeEvent evt) {
-// otherBean.firePropertyChanged(propertyName, evt.getOldValue(), evt.getNewValue());
-// }
-// }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiExceptionHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiExceptionHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiExceptionHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -27,8 +27,8 @@
import fr.ifremer.shared.application.swing.action.ApplicationActionException;
import fr.ifremer.shared.application.swing.util.ApplicationErrorHelper;
import fr.ifremer.shared.application.swing.util.ApplicationExceptionHandler;
-import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import fr.ifremer.tutti.ui.swing.action.AbstractChangeScreenAction;
+import fr.ifremer.tutti.ui.swing.action.AbstractTuttiAction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -78,143 +78,6 @@
// never instanciate util class
}
-// 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 TuttiTechnicalException(_("tutti.property.set.error", property, 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 TuttiTechnicalException(_("tutti.property.get.error", property, 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);
-// }
-
- // private static DecimalFormatSymbols symbols;
-//
-// public static DecimalFormatSymbols getDecimalFormatSymbols() {
-// if (symbols == null) {
-// symbols = new DecimalFormatSymbols();
-// symbols.setDecimalSeparator('.');
-// symbols.setGroupingSeparator(' ');
-// }
-// return symbols;
-// }
-//
-// private static DecimalFormat decimalFormat;
-//
-// public static DecimalFormat getDecimalFormat(int minDecimal, int maxDecimal) {
-// if (decimalFormat == null) {
-// decimalFormat = new DecimalFormat();
-// decimalFormat.setDecimalFormatSymbols(getDecimalFormatSymbols());
-// decimalFormat.setGroupingUsed(false);
-// }
-// decimalFormat.setMinimumFractionDigits(minDecimal);
-// decimalFormat.setMaximumFractionDigits(maxDecimal);
-// return decimalFormat;
-// }
-
-// public static String getWeightStringValue(Float weight) {
-// String textValue;
-// if (weight != null) {
-// DecimalFormat weightDecimalFormat = getDecimalFormat(1, 3);
-// textValue = weightDecimalFormat.format(weight);
-//
-// } else {
-// textValue = "";
-// }
-// return textValue;
-// }
-//
-// public static void openLink(URL url) {
-// try {
-// openLink(url.toURI());
-// } catch (URISyntaxException e) {
-// throw new TuttiTechnicalException(_("application.error.cannot.open.link", url), e);
-// }
-// }
-//
-// public static Desktop getDesktopForBrowse() {
-//
-// if (!Desktop.isDesktopSupported()) {
-// throw new TuttiTechnicalException(
-// _("application.error.desktop.not.supported"));
-// }
-//
-// Desktop desktop = Desktop.getDesktop();
-//
-// if (!desktop.isSupported(Desktop.Action.BROWSE)) {
-//
-// throw new TuttiTechnicalException(
-// _("application.error.desktop.browse.not.supported"));
-// }
-//
-// return desktop;
-// }
-//
-// public static void openLink(URI uri) {
-//
-// Desktop desktop = getDesktopForBrowse();
-//
-// try {
-//
-// desktop.browse(uri);
-// } catch (Exception e) {
-//
-// throw new TuttiTechnicalException(
-// _("application.error.cannot.open.link", uri), e);
-// }
-// }
-//
-// public static Desktop getDesktopForMail() {
-//
-// if (!Desktop.isDesktopSupported()) {
-// throw new TuttiTechnicalException(
-// _("application.error.desktop.not.supported"));
-// }
-//
-// Desktop desktop = Desktop.getDesktop();
-//
-// if (!desktop.isSupported(Desktop.Action.MAIL)) {
-//
-// throw new TuttiTechnicalException(
-// _("application.error.desktop.mail.not.supported"));
-// }
-//
-// return desktop;
-// }
-//
-// public static void mail(String subject, String body) {
-//
-// Desktop desktop = getDesktopForMail();
-//
-// try {
-// URI mailtoURI = new URI("mailto", null, null, "subject=" + subject + "&body=" + body, null);
-// desktop.mail(mailtoURI);
-//
-// } catch (Exception e) {
-//
-// throw new TuttiTechnicalException(
-// _("application.error.cannot.mail"), e);
-// }
-// }
-
public static void tryToConnectToUpdateUrl(String urlAsString,
String badUrlFormatI18nKey,
String notReachI18nKey,
@@ -307,81 +170,6 @@
}
-// public static void selectFirstCellOnFirstRowAndStopEditing(JXTable table) {
-//
-// // select first cell
-// doSelectCell(table, 0, 0);
-//
-// if (table.isEditing()) {
-//
-// // but no edit it
-// table.getCellEditor().stopCellEditing();
-// }
-// }
-//
-// public static void selectFirstCellOnLastRow(JXTable table) {
-//
-// // select first cell
-// doSelectCell(table, table.getRowCount() - 1, 0);
-// }
-//
-// public static void selectFirstCellOnRow(JXTable table, int row, boolean stopEdit) {
-//
-// // select first cell
-// doSelectCell(table, row, 0);
-//
-// if (stopEdit && table.isEditing()) {
-//
-// table.getCellEditor().stopCellEditing();
-// }
-// }
-
-// public static void doSelectCell(JTable table,
-// int rowIndex,
-// int columnIndex) {
-//
-// int rowCount = table.getRowCount();
-// if (rowCount == 0) {
-//
-// // no row, can not selected any cell
-// if (log.isWarnEnabled()) {
-// log.warn("No row in table, can not select any cell");
-// }
-// return;
-// }
-// int columnCount = table.getColumnCount();
-// if (columnCount == 0) {
-//
-// // no column, can not selected any cell
-// if (log.isWarnEnabled()) {
-// log.warn("No column in table, can not select any cell");
-// }
-// return;
-// }
-// if (columnIndex > columnCount) {
-// if (log.isWarnEnabled()) {
-// log.warn(String.format("ColumnIndex: %s is more than columnCount %s", columnIndex, columnCount));
-// }
-// columnIndex = columnCount - 1;
-// }
-// if (columnIndex < 0) {
-// columnIndex = 0;
-// }
-// if (rowIndex >= rowCount) {
-// if (log.isWarnEnabled()) {
-// log.warn(String.format("RowIndex: %s is more than rowCount %s", rowIndex, rowCount));
-// }
-// rowIndex = rowCount - 1;
-// }
-// if (rowIndex < 0) {
-// rowIndex = 0;
-// }
-//
-// table.setColumnSelectionInterval(columnIndex, columnIndex);
-// table.setRowSelectionInterval(rowIndex, rowIndex);
-// table.editCellAt(rowIndex, columnIndex);
-// }
-
protected static class SpeciesDecoratorListener<R extends Serializable, T extends AbstractApplicationTableModel<R>> implements ActionListener {
protected final JXTable table;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/SaveAttachmentAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/SaveAttachmentAction.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/SaveAttachmentAction.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -27,7 +27,7 @@
import fr.ifremer.shared.application.ApplicationIOUtil;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import fr.ifremer.tutti.ui.swing.action.AbstractTuttiAction;
import java.io.File;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -29,11 +29,9 @@
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.ui.swing.util.Cancelable;
+import fr.ifremer.shared.application.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueEditor;
-import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueRenderer;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
import jaxx.runtime.validator.swing.SwingValidator;
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicValueEditor.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueEditor.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicValueEditor.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicValueEditor.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,139 @@
+
+package fr.ifremer.tutti.ui.swing.util.caracteristics;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.JAXXWidgetUtil;
+import jaxx.runtime.swing.editor.bean.BeanUIUtil;
+import jaxx.runtime.swing.editor.cell.NumberCellEditor;
+import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
+import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
+import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
+import org.nuiton.decorator.Decorator;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.border.LineBorder;
+import javax.swing.table.TableCellEditor;
+import java.awt.Color;
+import java.awt.Component;
+import java.util.List;
+
+/**
+ * Editor for the values of the caracteristics of the fishing operations.
+ * The editor depends on the caracteristic value type.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 0.3
+ */
+public class CaracteristicValueEditor extends AbstractCellEditor implements TableCellEditor {
+
+ private static final long serialVersionUID = 1L;
+
+ protected int caracteristicColumn;
+
+ protected TableCellEditor editor;
+
+ protected Decorator<CaracteristicQualitativeValue> decorator;
+
+ public CaracteristicValueEditor(TuttiUIContext context) {
+ this(0, context);
+ }
+
+ public CaracteristicValueEditor(int caracteristicColumn, TuttiUIContext context) {
+ super();
+ this.caracteristicColumn = caracteristicColumn;
+ DecoratorService decoratorService = context.getDecoratorService();
+ decorator = decoratorService.getDecoratorByType(CaracteristicQualitativeValue.class);
+ }
+
+ @Override
+ public Object getCellEditorValue() {
+ return editor.getCellEditorValue();
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ int row,
+ int column) {
+
+ Caracteristic caracteristic = (Caracteristic)
+ table.getModel().getValueAt(row, caracteristicColumn);
+ if (caracteristic == null) {
+
+ // can't edit a null value ?
+
+ } else {
+ switch (caracteristic.getCaracteristicType()) {
+
+ case NUMBER:
+ // by default this is a number
+ NumberCellEditor<Float> editor =
+ JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
+ editor.getNumberEditor().setSelectAllTextOnError(true);
+ editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+ this.editor = editor;
+ break;
+ case QUALITATIVE:
+ JComboBox comboBox = new JComboBox();
+ comboBox.setRenderer(new DecoratorListCellRenderer(decorator));
+
+ // always use a copy of data
+ List<CaracteristicQualitativeValue> data =
+ Lists.newArrayList(caracteristic.getQualitativeValue());
+ // add a null value at first position
+ if (!data.isEmpty() && data.get(0) != null) {
+ data.add(0, null);
+ }
+ SwingUtil.fillComboBox(comboBox, data, null);
+
+ ObjectToStringConverter converter =
+ BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+ BeanUIUtil.decorate(comboBox, converter);
+ this.editor = new ComboBoxCellEditor(comboBox);
+ break;
+ case TEXT:
+ // use default editor
+
+ this.editor = table.getDefaultEditor(Object.class);
+ break;
+ }
+ }
+
+ Component result = editor.getTableCellEditorComponent(
+ table, value, isSelected, row, column);
+ return result;
+ }
+
+}
Copied: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicValueRenderer.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueRenderer.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicValueRenderer.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicValueRenderer.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -0,0 +1,122 @@
+
+package fr.ifremer.tutti.ui.swing.util.caracteristics;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.service.DecoratorService;
+import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
+import org.nuiton.decorator.Decorator;
+
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.SwingConstants;
+import javax.swing.table.TableCellRenderer;
+import java.awt.Component;
+
+/**
+ * Renderer for the values of the caracteristics of the fishing operations.
+ * The renderer depends on the caracteristic value type.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 0.3
+ */
+public class CaracteristicValueRenderer implements TableCellRenderer {
+
+ protected int caracteristicColumn;
+
+ protected Decorator<CaracteristicQualitativeValue> decorator;
+
+ public CaracteristicValueRenderer(TuttiUIContext context) {
+ this(0, context);
+ }
+
+ public CaracteristicValueRenderer(int caracteristicColumn, TuttiUIContext context) {
+ super();
+ this.caracteristicColumn = caracteristicColumn;
+ DecoratorService decoratorService = context.getDecoratorService();
+ decorator = decoratorService.getDecoratorByType(CaracteristicQualitativeValue.class);
+ }
+
+ public Component getTableCellRendererComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row,
+ int column) {
+ TableCellRenderer renderer;
+
+ Caracteristic caracteristic = (Caracteristic)
+ table.getModel().getValueAt(row, caracteristicColumn);
+
+ boolean numericType = false;
+ if (caracteristic == null) {
+
+ // should be render a null value ?
+ renderer = table.getDefaultRenderer(Object.class);
+
+ } else {
+ switch (caracteristic.getCaracteristicType()) {
+
+ case QUALITATIVE:
+ renderer = new DecoratorTableCellRenderer(decorator);
+ break;
+
+ case NUMBER:
+
+ // use default text renderer with align at east
+ renderer = table.getDefaultRenderer(Object.class);
+ numericType = true;
+ break;
+ default:
+ case TEXT:
+ // use default text renderer
+ renderer = table.getDefaultRenderer(Object.class);
+ }
+ }
+
+ Component result = renderer.getTableCellRendererComponent(
+ table, value, isSelected, hasFocus, row, column);
+
+ if (numericType) {
+
+ if (result instanceof JLabel) {
+ JLabel jLabel = (JLabel) result;
+ jLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+
+ }
+ } else {
+ if (result instanceof JLabel) {
+ JLabel jLabel = (JLabel) result;
+ jLabel.setHorizontalAlignment(SwingConstants.LEFT);
+ }
+ }
+
+ return result;
+ }
+
+}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueEditor.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueEditor.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueEditor.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,139 +0,0 @@
-
-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 com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.JAXXWidgetUtil;
-import jaxx.runtime.swing.editor.bean.BeanUIUtil;
-import jaxx.runtime.swing.editor.cell.NumberCellEditor;
-import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
-import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
-import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
-import org.nuiton.decorator.Decorator;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.border.LineBorder;
-import javax.swing.table.TableCellEditor;
-import java.awt.Color;
-import java.awt.Component;
-import java.util.List;
-
-/**
- * Editor for the values of the caracteristics of the fishing operations.
- * The editor depends on the caracteristic value type.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 0.3
- */
-public class CaracteristicValueEditor extends AbstractCellEditor implements TableCellEditor {
-
- private static final long serialVersionUID = 1L;
-
- protected int caracteristicColumn;
-
- protected TableCellEditor editor;
-
- protected Decorator<CaracteristicQualitativeValue> decorator;
-
- public CaracteristicValueEditor(TuttiUIContext context) {
- this(0, context);
- }
-
- public CaracteristicValueEditor(int caracteristicColumn, TuttiUIContext context) {
- super();
- this.caracteristicColumn = caracteristicColumn;
- DecoratorService decoratorService = context.getDecoratorService();
- decorator = decoratorService.getDecoratorByType(CaracteristicQualitativeValue.class);
- }
-
- @Override
- public Object getCellEditorValue() {
- return editor.getCellEditorValue();
- }
-
- @Override
- public Component getTableCellEditorComponent(JTable table,
- Object value,
- boolean isSelected,
- int row,
- int column) {
-
- Caracteristic caracteristic = (Caracteristic)
- table.getModel().getValueAt(row, caracteristicColumn);
- if (caracteristic == null) {
-
- // can't edit a null value ?
-
- } else {
- switch (caracteristic.getCaracteristicType()) {
-
- case NUMBER:
- // by default this is a number
- NumberCellEditor<Float> editor =
- JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
- editor.getNumberEditor().setSelectAllTextOnError(true);
- editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
- this.editor = editor;
- break;
- case QUALITATIVE:
- JComboBox comboBox = new JComboBox();
- comboBox.setRenderer(new DecoratorListCellRenderer(decorator));
-
- // always use a copy of data
- List<CaracteristicQualitativeValue> data =
- Lists.newArrayList(caracteristic.getQualitativeValue());
- // add a null value at first position
- if (!data.isEmpty() && data.get(0) != null) {
- data.add(0, null);
- }
- SwingUtil.fillComboBox(comboBox, data, null);
-
- ObjectToStringConverter converter =
- BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
- BeanUIUtil.decorate(comboBox, converter);
- this.editor = new ComboBoxCellEditor(comboBox);
- break;
- case TEXT:
- // use default editor
-
- this.editor = table.getDefaultEditor(Object.class);
- break;
- }
- }
-
- Component result = editor.getTableCellEditorComponent(
- table, value, isSelected, row, column);
- return result;
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueRenderer.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueRenderer.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/CaracteristicValueRenderer.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,122 +0,0 @@
-
-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 fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
-import org.nuiton.decorator.Decorator;
-
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.SwingConstants;
-import javax.swing.table.TableCellRenderer;
-import java.awt.Component;
-
-/**
- * Renderer for the values of the caracteristics of the fishing operations.
- * The renderer depends on the caracteristic value type.
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 0.3
- */
-public class CaracteristicValueRenderer implements TableCellRenderer {
-
- protected int caracteristicColumn;
-
- protected Decorator<CaracteristicQualitativeValue> decorator;
-
- public CaracteristicValueRenderer(TuttiUIContext context) {
- this(0, context);
- }
-
- public CaracteristicValueRenderer(int caracteristicColumn, TuttiUIContext context) {
- super();
- this.caracteristicColumn = caracteristicColumn;
- DecoratorService decoratorService = context.getDecoratorService();
- decorator = decoratorService.getDecoratorByType(CaracteristicQualitativeValue.class);
- }
-
- public Component getTableCellRendererComponent(JTable table,
- Object value,
- boolean isSelected,
- boolean hasFocus,
- int row,
- int column) {
- TableCellRenderer renderer;
-
- Caracteristic caracteristic = (Caracteristic)
- table.getModel().getValueAt(row, caracteristicColumn);
-
- boolean numericType = false;
- if (caracteristic == null) {
-
- // should be render a null value ?
- renderer = table.getDefaultRenderer(Object.class);
-
- } else {
- switch (caracteristic.getCaracteristicType()) {
-
- case QUALITATIVE:
- renderer = new DecoratorTableCellRenderer(decorator);
- break;
-
- case NUMBER:
-
- // use default text renderer with align at east
- renderer = table.getDefaultRenderer(Object.class);
- numericType = true;
- break;
- default:
- case TEXT:
- // use default text renderer
- renderer = table.getDefaultRenderer(Object.class);
- }
- }
-
- Component result = renderer.getTableCellRendererComponent(
- table, value, isSelected, hasFocus, row, column);
-
- if (numericType) {
-
- if (result instanceof JLabel) {
- JLabel jLabel = (JLabel) result;
- jLabel.setHorizontalAlignment(SwingConstants.RIGHT);
-
- }
- } else {
- if (result instanceof JLabel) {
- JLabel jLabel = (JLabel) result;
- jLabel.setHorizontalAlignment(SwingConstants.LEFT);
- }
- }
-
- return result;
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditor.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditor.jaxx 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditor.jaxx 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,49 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 - 2013 Ifremer
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<jaxx.runtime.swing.editor.NumberEditor>
-
- <import>
- fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData
- java.awt.Color
- </import>
-
- <String id='property' javaBean='TuttiComputedOrNotData.PROPERTY_DATA'/>
-
- <TuttiComputedOrNotData id='bean' genericType='?' javaBean='null'/>
-
- <Color id='computedDataColor' javaBean='null'/>
-
- <!-- ui handler -->
- <TuttiComputedOrNotDataEditorHandler id='handler' constructorParams='this'/>
-
- <Integer id='decimalNumber' javaBean='null'/>
-
- <script><![CDATA[
- public void setProperty(String property) {
- // cannot change the property
- }
-]]>
- </script>
-
-</jaxx.runtime.swing.editor.NumberEditor>
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditorHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditorHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditorHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,143 +0,0 @@
-
-package fr.ifremer.tutti.ui.swing.util.editor;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.shared.application.ApplicationDataUtil;
-import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
-import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import jaxx.runtime.JAXXUtil;
-import jaxx.runtime.swing.editor.NumberEditorHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JTextField;
-import java.awt.Color;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.text.DecimalFormat;
-
-/**
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0
- */
-public class TuttiComputedOrNotDataEditorHandler extends NumberEditorHandler {
-
- private static final Log log = LogFactory.getLog(TuttiComputedOrNotDataEditorHandler.class);
-
- protected Integer decimalNumber;
-
- public TuttiComputedOrNotDataEditorHandler(TuttiComputedOrNotDataEditor ui) {
- super(ui);
- }
-
- @Override
- public void init() {
- final PropertyChangeListener l = new PropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent evt) {
- setComputedTextIfNullModel();
- }
- };
-
- TuttiComputedOrNotData bean = (TuttiComputedOrNotData) editor.getBean();
- if (bean != null) {
- bean.addPropertyChangeListener(l);
- }
- editor.addPropertyChangeListener(TuttiComputedOrNotDataEditor.PROPERTY_BEAN, new PropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent evt) {
-
- TuttiComputedOrNotData bean = (TuttiComputedOrNotData) evt.getOldValue();
- if (bean != null) {
- bean.removePropertyChangeListener(TuttiComputedOrNotData.PROPERTY_COMPUTED_DATA, l);
- }
-
- bean = (TuttiComputedOrNotData) evt.getNewValue();
- if (bean != null) {
- bean.addPropertyChangeListener(TuttiComputedOrNotData.PROPERTY_COMPUTED_DATA, l);
- }
- }
- });
-
- editor.addPropertyChangeListener(TuttiComputedOrNotDataEditor.PROPERTY_MODEL, l);
-
- editor.getTextField().addFocusListener(new FocusListener() {
-
- public void focusGained(FocusEvent e) {
- JTextField tf = editor.getTextField();
- tf.setFont(TuttiUI.TEXTFIELD_NORMAL_FONT);
- tf.setForeground(Color.BLACK);
- if (editor.getModel() == null) {
- tf.setText("");
- }
- }
-
- public void focusLost(FocusEvent e) {
- setComputedTextIfNullModel();
- }
- });
-
- editor.addPropertyChangeListener(TuttiComputedOrNotDataEditor.PROPERTY_DECIMAL_NUMBER,
- new PropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent evt) {
- decimalNumber = (Integer) evt.getNewValue();
- }
- });
-
- decimalNumber = ((TuttiComputedOrNotDataEditor) editor).getDecimalNumber();
-
- super.init();
-
- }
-
- protected void setComputedTextIfNullModel() {
- TuttiComputedOrNotData bean = (TuttiComputedOrNotData) editor.getBean();
- JTextField tf = editor.getTextField();
- if (bean != null && editor.getModel() == null) {
- tf.setFont(TuttiUI.TEXTFIELD_COMPUTED_FONT);
- tf.setForeground(((TuttiComputedOrNotDataEditor) editor).getComputedDataColor());
-
- String modelText;
- Number computedData = bean.getComputedData();
- if (editor.isUseFloat()
- && decimalNumber != null && computedData != null) {
- DecimalFormat decimalFormat = ApplicationDataUtil.getDecimalFormat(1, decimalNumber);
- modelText = decimalFormat.format(computedData);
- } else {
- modelText = JAXXUtil.getStringValue(computedData);
- }
- tf.setText(modelText);
-
- } else {
- tf.setFont(TuttiUI.TEXTFIELD_NORMAL_FONT);
- tf.setForeground(Color.BLACK);
- }
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataTableCell.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataTableCell.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataTableCell.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -1,260 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util.editor;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.shared.application.ApplicationDataUtil;
-import fr.ifremer.shared.application.type.WeightUnit;
-import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
-import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import jaxx.runtime.JAXXUtil;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.SwingConstants;
-import javax.swing.SwingUtilities;
-import javax.swing.border.LineBorder;
-import javax.swing.event.AncestorEvent;
-import javax.swing.event.AncestorListener;
-import javax.swing.table.DefaultTableCellRenderer;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Font;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.text.DecimalFormat;
-
-/**
- * Editor for TuttiComputedOrNotData
- *
- * @author kmorin <kmorin(a)codelutin.com>
- * @since 1.0
- */
-public class TuttiComputedOrNotDataTableCell extends DefaultTableCellRenderer {
- private static final long serialVersionUID = 1L;
-
- public static TableCellRenderer newRender(TableCellRenderer renderer,
- WeightUnit weightUnit,
- Color computedDataColor) {
-
- return new TuttiComputedOrNotDataTableCellRenderer(renderer,
- true,
- weightUnit.getNumberDigits(),
- computedDataColor);
- }
-
- public static TableCellEditor newEditor(Class type,
- WeightUnit weightUnit,
- Color computedDataColor) {
-
- return new TuttiComputedOrNotDataTableCellEditor(type,
- false,
- true,
- weightUnit.getNumberDigits(),
- weightUnit.getNumberEditorPattern(),
- computedDataColor);
- }
-
- public static class TuttiComputedOrNotDataTableCellEditor
- extends AbstractCellEditor
- implements TableCellEditor, FocusListener, AncestorListener {
-
- private static final long serialVersionUID = 1L;
-
- protected final TuttiComputedOrNotDataEditor numberEditor;
-
- protected TuttiComputedOrNotData data;
-
- /** constructor */
- public TuttiComputedOrNotDataTableCellEditor(Class type,
- boolean useSign,
- boolean useFloat,
- Integer decimalNumber,
- String numberPattern,
- Color computedDataColor) {
-
- numberEditor = new TuttiComputedOrNotDataEditor();
- numberEditor.setComputedDataColor(computedDataColor);
- numberEditor.getTextField().setHorizontalAlignment(SwingConstants.RIGHT);
- numberEditor.getTextField().addFocusListener(this);
- numberEditor.getTextField().addAncestorListener(this);
- numberEditor.getTextField().setBorder(new LineBorder(Color.GRAY, 2));
- numberEditor.setSelectAllTextOnError(true);
-
- numberEditor.setNumberPattern(numberPattern);
- numberEditor.setModelType(type);
- numberEditor.setUseSign(useSign);
- numberEditor.setUseFloat(useFloat);
- numberEditor.setDecimalNumber(decimalNumber);
- numberEditor.init();
- }
-
- @Override
- public Component getTableCellEditorComponent(JTable table, Object value,
- boolean isSelected, int row, int column) {
-
- data = (TuttiComputedOrNotData) value;
- numberEditor.setModel(data.getData());
-
- // Check nullity and set the text that will be selected with the current value
- if (data.getData() != null) {
- numberEditor.setModelText(String.valueOf(data.getData()));
- }
- return numberEditor;
- }
-
- public TuttiComputedOrNotDataEditor getNumberEditor() {
- return numberEditor;
- }
-
- @Override
- public TuttiComputedOrNotData getCellEditorValue() {
- return data;
- }
-
- @Override
- public void focusGained(FocusEvent e) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- numberEditor.getTextField().requestFocus();
- numberEditor.getTextField().selectAll();
- }
- });
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- }
-
- @Override
- public void ancestorAdded(AncestorEvent event) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- numberEditor.getTextField().requestFocus();
- numberEditor.getTextField().selectAll();
- }
- });
- }
-
- @Override
- public void ancestorRemoved(AncestorEvent event) {
- }
-
- @Override
- public void ancestorMoved(AncestorEvent event) {
- }
-
- @Override
- public boolean stopCellEditing() {
- boolean result = super.stopCellEditing();
- // Reset previous data to avoid keeping it on other cell edition
- if (result) {
- data.setData(numberEditor.getModel());
-
- numberEditor.setBean(null);
-
- data = null;
- }
- return result;
- }
- }
-
- public static class TuttiComputedOrNotDataTableCellRenderer
- implements TableCellRenderer {
-
- protected final TableCellRenderer delegate;
-
- protected Integer decimalNumber;
-
- protected Color computedDataColor;
-
- protected boolean useFloat;
-
- public TuttiComputedOrNotDataTableCellRenderer(
- TableCellRenderer delegate,
- boolean useFloat,
- Integer decimalNumber,
- Color computedDataColor) {
-
- this.delegate = delegate;
- this.useFloat = useFloat;
- this.decimalNumber = decimalNumber;
- this.computedDataColor = computedDataColor;
- }
-
- public Component getTableCellRendererComponent(JTable table,
- Object value,
- boolean isSelected,
- boolean hasFocus,
- int row,
- int column) {
-
- TuttiComputedOrNotData data = (TuttiComputedOrNotData) value;
- Number dataValue = data.getData();
- Font font;
- Color foreground;
- String text;
- if (dataValue == null) {
- dataValue = data.getComputedData();
- font = TuttiUI.TEXTFIELD_COMPUTED_FONT;
- foreground = computedDataColor;
-
- if (useFloat && decimalNumber != null && dataValue != null) {
- DecimalFormat decimalFormat = ApplicationDataUtil.getDecimalFormat(1, decimalNumber);
- text = JAXXUtil.getStringValue(decimalFormat.format(dataValue));
- } else {
- text = JAXXUtil.getStringValue(dataValue);
- }
-
- } else {
- font = TuttiUI.TEXTFIELD_NORMAL_FONT;
- foreground = Color.BLACK;
- text = JAXXUtil.getStringValue(dataValue);
- }
-
- Component component = delegate.getTableCellRendererComponent(table,
- text,
- isSelected,
- hasFocus,
- row,
- column);
-
- if (isSelected) {
- font = font.deriveFont(Font.BOLD);
- }
- component.setFont(font);
- component.setForeground(foreground);
- if (component instanceof JLabel) {
- JLabel jLabel = (JLabel) component;
- jLabel.setHorizontalAlignment(RIGHT);
- }
-
- return component;
- }
-
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2013-11-26 08:03:42 UTC (rev 1388)
@@ -38,7 +38,7 @@
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataTableCell.TuttiComputedOrNotDataTableCellEditor;
+import fr.ifremer.shared.application.swing.computable.ComputableDataTableCell.TuttiComputedOrNotDataTableCellEditor;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.editor.cell.NumberCellEditor;
import org.apache.commons.collections.CollectionUtils;
1
0
25 Nov '13
Author: tchemit
Date: 2013-11-25 17:03:00 +0100 (Mon, 25 Nov 2013)
New Revision: 1387
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1387
Log:
continue adding some stuff
Added:
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableData.java
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataEditor.jaxx
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataEditorHandler.java
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataTableCell.java
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/CustomTab.java
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/DelegateTabContainerHandler.java
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabContainerHandler.java
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabContentModel.java
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabHandler.java
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/util/ActionListCellRenderer.java
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/util/Cancelable.java
application/trunk/application/src/main/java/fr/ifremer/shared/application/listener/
application/trunk/application/src/main/java/fr/ifremer/shared/application/listener/PropagatePropertyChangeListener.java
Modified:
application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/AbstractApplicationUIHandler.java
application/trunk/application/src/main/java/fr/ifremer/shared/application/ApplicationConfiguration.java
Modified: application/trunk/application/src/main/java/fr/ifremer/shared/application/ApplicationConfiguration.java
===================================================================
--- application/trunk/application/src/main/java/fr/ifremer/shared/application/ApplicationConfiguration.java 2013-11-24 23:48:14 UTC (rev 1386)
+++ application/trunk/application/src/main/java/fr/ifremer/shared/application/ApplicationConfiguration.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -27,6 +27,8 @@
import org.nuiton.config.ApplicationConfig;
import org.nuiton.util.Version;
+import javax.swing.KeyStroke;
+
/**
* Created on 11/24/13.
*
@@ -44,6 +46,8 @@
public abstract Version getVersion();
+ public abstract KeyStroke getShortcutClosePopup();
+
public ApplicationConfiguration(ApplicationConfig applicationConfig) {
this.applicationConfig = applicationConfig;
}
Copied: application/trunk/application/src/main/java/fr/ifremer/shared/application/listener/PropagatePropertyChangeListener.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/PropagatePropertyChangeListener.java)
===================================================================
--- application/trunk/application/src/main/java/fr/ifremer/shared/application/listener/PropagatePropertyChangeListener.java (rev 0)
+++ application/trunk/application/src/main/java/fr/ifremer/shared/application/listener/PropagatePropertyChangeListener.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,80 @@
+package fr.ifremer.shared.application.listener;
+
+/*
+ * #%L
+ * Ifremer shared :: Application
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2013 Ifremer, CodeLutin, Tony CHEMIT
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.jdesktop.beans.AbstractBean;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+/**
+ * To listen a bean and propagate some of properties.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class PropagatePropertyChangeListener implements PropertyChangeListener {
+
+ public static interface PropagatePropertyChange {
+ void firePropertyChanged(String propertyName,
+ Object oldValue,
+ Object newValue);
+ }
+
+ public static void listenAndPropagate(AbstractBean producer,
+ PropagatePropertyChange consumer,
+ String propertyNameToListen,
+ String propertyNameToForward) {
+ PropagatePropertyChangeListener listener =
+ new PropagatePropertyChangeListener(propertyNameToForward,
+ consumer);
+ producer.addPropertyChangeListener(propertyNameToListen, listener);
+ }
+
+ public static void listenAndPropagateAll(AbstractBean producer,
+ PropagatePropertyChange consumer) {
+ PropagatePropertyChangeListener listener =
+ new PropagatePropertyChangeListener(null, consumer);
+ producer.addPropertyChangeListener(listener);
+ }
+
+ private String propertyName;
+
+ private PropagatePropertyChange editor;
+
+ public PropagatePropertyChangeListener(String propertyName,
+ PropagatePropertyChange editor) {
+ this.propertyName = propertyName;
+ this.editor = editor;
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ String name = propertyName == null ? evt.getPropertyName() : propertyName;
+ editor.firePropertyChanged(name,
+ evt.getOldValue(),
+ evt.getNewValue());
+ }
+}
\ No newline at end of file
Modified: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/AbstractApplicationUIHandler.java
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/AbstractApplicationUIHandler.java 2013-11-24 23:48:14 UTC (rev 1386)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/AbstractApplicationUIHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -27,8 +27,13 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import fr.ifremer.shared.application.ApplicationDataUtil;
+import fr.ifremer.shared.application.swing.action.ApplicationActionUI;
+import fr.ifremer.shared.application.swing.computable.ComputableDataEditor;
import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.util.Cancelable;
+import fr.ifremer.shared.application.type.ApplicationProgressionModel;
import fr.ifremer.shared.application.type.WeightUnit;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.JAXXWidgetUtil;
import jaxx.runtime.swing.editor.FileEditor;
@@ -54,6 +59,7 @@
import org.nuiton.decorator.Decorator;
import org.nuiton.decorator.JXPathDecorator;
+import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.DefaultComboBoxModel;
@@ -64,11 +70,13 @@
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
+import javax.swing.JRootPane;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.JViewport;
+import javax.swing.KeyStroke;
import javax.swing.ListCellRenderer;
import javax.swing.ListSelectionModel;
import javax.swing.ScrollPaneConstants;
@@ -85,8 +93,9 @@
import javax.swing.text.JTextComponent;
import java.awt.Color;
import java.awt.Component;
+import java.awt.Dialog;
import java.awt.Dimension;
-import java.awt.Font;
+import java.awt.Frame;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
@@ -97,6 +106,8 @@
import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
import java.io.File;
import java.io.Serializable;
import java.text.ParseException;
@@ -211,7 +222,7 @@
selectionModel.setValueIsAdjusting(true);
try {
- List selectedList = Lists.newLinkedList();
+ List<Object> selectedList = Lists.newLinkedList();
for (int index : list.getSelectedIndices()) {
Object o = list.getModel().getElementAt(index);
@@ -224,62 +235,62 @@
}
}
-// public void openDialog(TuttiUI dialogContent,
-// String title, Dimension dim) {
-// Component topestUI = getTopestUI();
-//
-// JDialog result;
-// if (topestUI instanceof Frame) {
-// result = new JDialog((Frame) topestUI, title, true);
-// } else {
-// result = new JDialog((Dialog) topestUI, title, true);
-// }
-//
-// result.add((Component) dialogContent);
-// result.setResizable(true);
-//
-// result.setSize(dim);
-//
-// final AbstractTuttiUIHandler handler = dialogContent.getHandler();
-//
-// if (handler instanceof Cancelable) {
-//
-// // add a auto-close action
-// JRootPane rootPane = result.getRootPane();
-//
-// KeyStroke shortcutClosePopup = getConfig().getShortcutClosePopup();
-//
-// rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
-// shortcutClosePopup, "close");
-// rootPane.getActionMap().put("close", new AbstractAction() {
-// private static final long serialVersionUID = 1L;
-//
-// @Override
-// public void actionPerformed(ActionEvent e) {
-// ((Cancelable) handler).cancel();
-// }
-// });
-// }
-//
-// result.addWindowListener(new WindowAdapter() {
-//
-// @Override
-// public void windowClosed(WindowEvent e) {
-// Component ui = (Component) e.getSource();
-// if (log.isDebugEnabled()) {
-// log.debug("Destroy ui " + ui);
-// }
-// JAXXUtil.destroy(ui);
-// }
-// });
-// SwingUtil.center(getContext().getMainUI(), result);
-// result.setVisible(true);
-// }
-//
-// public void closeDialog(ApplicationUI ui) {
-// SwingUtil.getParentContainer(ui, JDialog.class).setVisible(false);
-// }
+ public void openDialog(ApplicationUI dialogContent,
+ String title, Dimension dim) {
+ Component topestUI = getTopestUI();
+ JDialog result;
+ if (topestUI instanceof Frame) {
+ result = new JDialog((Frame) topestUI, title, true);
+ } else {
+ result = new JDialog((Dialog) topestUI, title, true);
+ }
+
+ result.add((Component) dialogContent);
+ result.setResizable(true);
+
+ result.setSize(dim);
+
+ final AbstractApplicationUIHandler handler = dialogContent.getHandler();
+
+ if (handler instanceof Cancelable) {
+
+ // add a auto-close action
+ JRootPane rootPane = result.getRootPane();
+
+ KeyStroke shortcutClosePopup = getContext().getConfiguration().getShortcutClosePopup();
+
+ rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ shortcutClosePopup, "close");
+ rootPane.getActionMap().put("close", new AbstractAction() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ((Cancelable) handler).cancel();
+ }
+ });
+ }
+
+ result.addWindowListener(new WindowAdapter() {
+
+ @Override
+ public void windowClosed(WindowEvent e) {
+ Component ui = (Component) e.getSource();
+ if (log.isDebugEnabled()) {
+ log.debug("Destroy ui " + ui);
+ }
+ JAXXUtil.destroy(ui);
+ }
+ });
+ SwingUtil.center(getContext().getMainUI(), result);
+ result.setVisible(true);
+ }
+
+ public void closeDialog(ApplicationUI ui) {
+ SwingUtil.getParentContainer(ui, JDialog.class).setVisible(false);
+ }
+
public static final String CONFIRMATION_FORMAT = "<html>%s<hr/><br/>%s</html>";
public int askSaveBeforeLeaving(String message) {
@@ -349,6 +360,10 @@
// handler.clearValidators();
// }
+ protected void addHighlighters(final JXTable table) {
+
+ }
+
public void autoSelectRowInTable(MouseEvent e, JPopupMenu popup) {
boolean rightClick = SwingUtilities.isRightMouseButton(e);
@@ -545,40 +560,29 @@
}
protected void initLabel(JLabel jLabel) {
- Boolean strongStyle = (Boolean) jLabel.getClientProperty("strongStyle");
- Boolean italicStyle = (Boolean) jLabel.getClientProperty("italicStyle");
- Font font = jLabel.getFont();
- int style = font.getStyle();
- if (strongStyle != null && strongStyle) {
- style |= Font.BOLD;
+
+ WeightUnit weightUnit = (WeightUnit) jLabel.getClientProperty("addWeightUnit");
+ if (weightUnit != null) {
+ String text = weightUnit.decorateLabel(jLabel.getText());
+ jLabel.setText(text);
+
+ String tip = weightUnit.decorateTip(jLabel.getToolTipText());
+ jLabel.setToolTipText(tip);
+
+ Component labelFor = jLabel.getLabelFor();
+ if (labelFor instanceof ComputableDataEditor) {
+
+ // set also the number of digits (4 for kg, 1 for g)
+ ComputableDataEditor editor = (ComputableDataEditor) labelFor;
+ editor.setNumberPattern(weightUnit.getNumberEditorPattern());
+ editor.setDecimalNumber(weightUnit.getNumberDigits());
+ } else if (labelFor instanceof NumberEditor) {
+
+ // set also the number of digits (4 for kg, 1 for g)
+ NumberEditor editor = (NumberEditor) labelFor;
+ editor.setNumberPattern(weightUnit.getNumberEditorPattern());
+ }
}
- if (italicStyle != null && italicStyle) {
- style |= Font.ITALIC;
- }
- jLabel.setFont(font.deriveFont(style));
-
-// WeightUnit weightUnit = (WeightUnit) jLabel.getClientProperty("addWeightUnit");
-// if (weightUnit != null) {
-// String text = weightUnit.decorateLabel(jLabel.getText());
-// jLabel.setText(text);
-//
-// String tip = weightUnit.decorateTip(jLabel.getToolTipText());
-// jLabel.setToolTipText(tip);
-//
-// Component labelFor = jLabel.getLabelFor();
-// if (labelFor instanceof TuttiComputedOrNotDataEditor) {
-//
-// // set also the number of digits (4 for kg, 1 for g)
-// TuttiComputedOrNotDataEditor editor = (TuttiComputedOrNotDataEditor) labelFor;
-// editor.setNumberPattern(weightUnit.getNumberEditorPattern());
-// editor.setDecimalNumber(weightUnit.getNumberDigits());
-// } else if (labelFor instanceof NumberEditor) {
-//
-// // set also the number of digits (4 for kg, 1 for g)
-// NumberEditor editor = (NumberEditor) labelFor;
-// editor.setNumberPattern(weightUnit.getNumberEditorPattern());
-// }
-// }
}
// protected void initButtonAttachment(ButtonAttachment component) {
@@ -1067,4 +1071,15 @@
DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator, true);
return result;
}
+
+ protected void incrementsMessage(String message) {
+
+ ApplicationActionUI actionUI = getContext().getActionUI();
+ if (actionUI != null) {
+ ApplicationProgressionModel progressionModel = actionUI.getModel().getProgressionModel();
+ if (progressionModel != null)
+
+ progressionModel.increments(message);
+ }
+ }
}
Copied: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableData.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiComputedOrNotData.java)
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableData.java (rev 0)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableData.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,127 @@
+package fr.ifremer.shared.application.swing.computable;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer, CodeLutin, Tony CHEMIT
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.listener.PropagatePropertyChangeListener;
+import org.jdesktop.beans.AbstractSerializableBean;
+
+
+/**
+ * A number data plus a possible computed value.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public class ComputableData<N extends Number> extends AbstractSerializableBean {
+
+ public static final String PROPERTY_DATA = "data";
+
+ public static final String PROPERTY_COMPUTED_DATA = "computedData";
+
+ private static final long serialVersionUID = 1L;
+
+ protected N data;
+
+ protected N computedData;
+
+ public ComputableData() {
+ data = null;
+ computedData = null;
+ }
+
+ public ComputableData(N data, N computedData) {
+ this.data = data;
+ this.computedData = computedData;
+ }
+
+ public N getData() {
+ return data;
+ }
+
+ public void setData(N data) {
+ Object oldValue = getData();
+ this.data = data;
+ firePropertyChange(PROPERTY_DATA, oldValue, data);
+ }
+
+ public N getComputedData() {
+ return computedData;
+ }
+
+ public void setComputedData(N computedData) {
+ Object oldValue = getComputedData();
+ this.computedData = computedData;
+ firePropertyChange(PROPERTY_COMPUTED_DATA, oldValue, computedData);
+ }
+
+ @Override
+ public String toString() {
+ String result = null;
+ if (data != null) {
+ result = data.toString();
+ } else if (computedData != null) {
+ result = computedData.toString();
+ }
+ return result;
+ }
+
+ /**
+ * Add a listener to propagate the modification of the
+ * {@link #PROPERTY_DATA} property to a given {@code propertyName}.
+ *
+ * @param propertyName name of the property to fire on given bean
+ * @param otherBean bean that will fires
+ * @since 1.2
+ */
+ public void addPropagateListener(String propertyName,
+ PropagatePropertyChangeListener.PropagatePropertyChange otherBean) {
+
+ PropagatePropertyChangeListener.listenAndPropagate(this,
+ otherBean,
+ PROPERTY_DATA,
+ propertyName);
+
+// PropagatePropertyChangeListener listener = new PropagatePropertyChangeListener(propertyName, otherBean);
+// addPropertyChangeListener(PROPERTY_DATA, listener);
+ }
+
+// private static class PropagateProperyChangeListener implements PropertyChangeListener {
+//
+// private String propertyName;
+//
+// private AbstractTuttiBeanUIModel otherBean;
+//
+// public PropagatePropertyChangeLstener(String propertyName,
+// AbstractTuttiBeanUIModel otherBean) {
+// this.propertyName = propertyName;
+// this.otherBean = otherBean;
+// }
+//
+// @Override
+// public void propertyChange(PropertyChangeEvent evt) {
+// otherBean.firePropertyChanged(propertyName, evt.getOldValue(), evt.getNewValue());
+// }
+// }
+}
Copied: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataEditor.jaxx (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditor.jaxx)
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataEditor.jaxx (rev 0)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataEditor.jaxx 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,54 @@
+<!--
+ #%L
+ Tutti :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 - 2013 Ifremer, CodeLutin, Tony CHEMIT
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+<jaxx.runtime.swing.editor.NumberEditor genericType='E extends Number'>
+
+ <import>
+ fr.ifremer.shared.application.swing.computable.ComputableData
+ java.awt.Color
+ </import>
+
+ <String id='property' javaBean='ComputableData.PROPERTY_DATA'/>
+
+ <ComputableData id='bean' genericType='E' javaBean='null'/>
+
+ <Color id='computedDataColor' javaBean='null'/>
+
+ <!-- ui handler -->
+ <ComputableDataEditorHandler id='handler' constructorParams='this'/>
+
+ <Integer id='decimalNumber' javaBean='null'/>
+
+ <script><![CDATA[
+
+ public void setBean(ComputableData<E> bean) {
+ super.setBean(bean);
+ }
+
+ public void setProperty(String property) {
+ // cannot change the property
+ }
+]]>
+ </script>
+
+</jaxx.runtime.swing.editor.NumberEditor>
\ No newline at end of file
Copied: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataEditorHandler.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditorHandler.java)
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataEditorHandler.java (rev 0)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataEditorHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,138 @@
+
+package fr.ifremer.shared.application.swing.computable;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer, CodeLutin, Tony CHEMIT
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.ApplicationDataUtil;
+import fr.ifremer.shared.application.swing.ApplicationUI;
+import jaxx.runtime.JAXXUtil;
+import jaxx.runtime.swing.editor.NumberEditorHandler;
+
+import javax.swing.JTextField;
+import java.awt.Color;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.text.DecimalFormat;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public class ComputableDataEditorHandler extends NumberEditorHandler {
+
+ protected Integer decimalNumber;
+
+ public ComputableDataEditorHandler(ComputableDataEditor ui) {
+ super(ui);
+ }
+
+ @Override
+ public void init() {
+ final PropertyChangeListener l = new PropertyChangeListener() {
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ setComputedTextIfNullModel();
+ }
+ };
+
+ ComputableData bean = (ComputableData) editor.getBean();
+ if (bean != null) {
+ bean.addPropertyChangeListener(l);
+ }
+ editor.addPropertyChangeListener(ComputableDataEditor.PROPERTY_BEAN, new PropertyChangeListener() {
+
+ public void propertyChange(PropertyChangeEvent evt) {
+
+ ComputableData bean = (ComputableData) evt.getOldValue();
+ if (bean != null) {
+ bean.removePropertyChangeListener(ComputableData.PROPERTY_COMPUTED_DATA, l);
+ }
+
+ bean = (ComputableData) evt.getNewValue();
+ if (bean != null) {
+ bean.addPropertyChangeListener(ComputableData.PROPERTY_COMPUTED_DATA, l);
+ }
+ }
+ });
+
+ editor.addPropertyChangeListener(ComputableDataEditor.PROPERTY_MODEL, l);
+
+ editor.getTextField().addFocusListener(new FocusListener() {
+
+ public void focusGained(FocusEvent e) {
+ JTextField tf = editor.getTextField();
+ tf.setFont(ApplicationUI.TEXTFIELD_NORMAL_FONT);
+ tf.setForeground(Color.BLACK);
+ if (editor.getModel() == null) {
+ tf.setText("");
+ }
+ }
+
+ public void focusLost(FocusEvent e) {
+ setComputedTextIfNullModel();
+ }
+ });
+
+ editor.addPropertyChangeListener(ComputableDataEditor.PROPERTY_DECIMAL_NUMBER,
+ new PropertyChangeListener() {
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ decimalNumber = (Integer) evt.getNewValue();
+ }
+ });
+
+ decimalNumber = ((ComputableDataEditor) editor).getDecimalNumber();
+
+ super.init();
+
+ }
+
+ protected void setComputedTextIfNullModel() {
+ ComputableData bean = (ComputableData) editor.getBean();
+ JTextField tf = editor.getTextField();
+ if (bean != null && editor.getModel() == null) {
+ tf.setFont(ApplicationUI.TEXTFIELD_COMPUTED_FONT);
+ tf.setForeground(((ComputableDataEditor) editor).getComputedDataColor());
+
+ String modelText;
+ Number computedData = bean.getComputedData();
+ if (editor.isUseFloat()
+ && decimalNumber != null && computedData != null) {
+ DecimalFormat decimalFormat = ApplicationDataUtil.getDecimalFormat(1, decimalNumber);
+ modelText = decimalFormat.format(computedData);
+ } else {
+ modelText = JAXXUtil.getStringValue(computedData);
+ }
+ tf.setText(modelText);
+
+ } else {
+ tf.setFont(ApplicationUI.TEXTFIELD_NORMAL_FONT);
+ tf.setForeground(Color.BLACK);
+ }
+ }
+
+}
Copied: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataTableCell.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataTableCell.java)
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataTableCell.java (rev 0)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/computable/ComputableDataTableCell.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,259 @@
+package fr.ifremer.shared.application.swing.computable;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer, CodeLutin, Tony CHEMIT
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.ApplicationDataUtil;
+import fr.ifremer.shared.application.swing.ApplicationUI;
+import fr.ifremer.shared.application.type.WeightUnit;
+import jaxx.runtime.JAXXUtil;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.border.LineBorder;
+import javax.swing.event.AncestorEvent;
+import javax.swing.event.AncestorListener;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Font;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.text.DecimalFormat;
+
+/**
+ * Editor for TuttiComputedOrNotData
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public class ComputableDataTableCell extends DefaultTableCellRenderer {
+ private static final long serialVersionUID = 1L;
+
+ public static TableCellRenderer newRender(TableCellRenderer renderer,
+ WeightUnit weightUnit,
+ Color computedDataColor) {
+
+ return new TuttiComputedOrNotDataTableCellRenderer(renderer,
+ true,
+ weightUnit.getNumberDigits(),
+ computedDataColor);
+ }
+
+ public static TableCellEditor newEditor(Class type,
+ WeightUnit weightUnit,
+ Color computedDataColor) {
+
+ return new TuttiComputedOrNotDataTableCellEditor(type,
+ false,
+ true,
+ weightUnit.getNumberDigits(),
+ weightUnit.getNumberEditorPattern(),
+ computedDataColor);
+ }
+
+ public static class TuttiComputedOrNotDataTableCellEditor
+ extends AbstractCellEditor
+ implements TableCellEditor, FocusListener, AncestorListener {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final ComputableDataEditor numberEditor;
+
+ protected ComputableData data;
+
+ /** constructor */
+ public TuttiComputedOrNotDataTableCellEditor(Class type,
+ boolean useSign,
+ boolean useFloat,
+ Integer decimalNumber,
+ String numberPattern,
+ Color computedDataColor) {
+
+ numberEditor = new ComputableDataEditor();
+ numberEditor.setComputedDataColor(computedDataColor);
+ numberEditor.getTextField().setHorizontalAlignment(SwingConstants.RIGHT);
+ numberEditor.getTextField().addFocusListener(this);
+ numberEditor.getTextField().addAncestorListener(this);
+ numberEditor.getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+ numberEditor.setSelectAllTextOnError(true);
+
+ numberEditor.setNumberPattern(numberPattern);
+ numberEditor.setModelType(type);
+ numberEditor.setUseSign(useSign);
+ numberEditor.setUseFloat(useFloat);
+ numberEditor.setDecimalNumber(decimalNumber);
+ numberEditor.init();
+ }
+
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value,
+ boolean isSelected, int row, int column) {
+
+ data = (ComputableData) value;
+ numberEditor.setModel(data.getData());
+
+ // Check nullity and set the text that will be selected with the current value
+ if (data.getData() != null) {
+ numberEditor.setModelText(String.valueOf(data.getData()));
+ }
+ return numberEditor;
+ }
+
+ public ComputableDataEditor getNumberEditor() {
+ return numberEditor;
+ }
+
+ @Override
+ public ComputableData getCellEditorValue() {
+ return data;
+ }
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ numberEditor.getTextField().requestFocus();
+ numberEditor.getTextField().selectAll();
+ }
+ });
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ }
+
+ @Override
+ public void ancestorAdded(AncestorEvent event) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ numberEditor.getTextField().requestFocus();
+ numberEditor.getTextField().selectAll();
+ }
+ });
+ }
+
+ @Override
+ public void ancestorRemoved(AncestorEvent event) {
+ }
+
+ @Override
+ public void ancestorMoved(AncestorEvent event) {
+ }
+
+ @Override
+ public boolean stopCellEditing() {
+ boolean result = super.stopCellEditing();
+ // Reset previous data to avoid keeping it on other cell edition
+ if (result) {
+ data.setData(numberEditor.getModel());
+
+ numberEditor.setBean(null);
+
+ data = null;
+ }
+ return result;
+ }
+ }
+
+ public static class TuttiComputedOrNotDataTableCellRenderer
+ implements TableCellRenderer {
+
+ protected final TableCellRenderer delegate;
+
+ protected Integer decimalNumber;
+
+ protected Color computedDataColor;
+
+ protected boolean useFloat;
+
+ public TuttiComputedOrNotDataTableCellRenderer(
+ TableCellRenderer delegate,
+ boolean useFloat,
+ Integer decimalNumber,
+ Color computedDataColor) {
+
+ this.delegate = delegate;
+ this.useFloat = useFloat;
+ this.decimalNumber = decimalNumber;
+ this.computedDataColor = computedDataColor;
+ }
+
+ public Component getTableCellRendererComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row,
+ int column) {
+
+ ComputableData data = (ComputableData) value;
+ Number dataValue = data.getData();
+ Font font;
+ Color foreground;
+ String text;
+ if (dataValue == null) {
+ dataValue = data.getComputedData();
+ font = ApplicationUI.TEXTFIELD_COMPUTED_FONT;
+ foreground = computedDataColor;
+
+ if (useFloat && decimalNumber != null && dataValue != null) {
+ DecimalFormat decimalFormat = ApplicationDataUtil.getDecimalFormat(1, decimalNumber);
+ text = JAXXUtil.getStringValue(decimalFormat.format(dataValue));
+ } else {
+ text = JAXXUtil.getStringValue(dataValue);
+ }
+
+ } else {
+ font = ApplicationUI.TEXTFIELD_NORMAL_FONT;
+ foreground = Color.BLACK;
+ text = JAXXUtil.getStringValue(dataValue);
+ }
+
+ Component component = delegate.getTableCellRendererComponent(table,
+ text,
+ isSelected,
+ hasFocus,
+ row,
+ column);
+
+ if (isSelected) {
+ font = font.deriveFont(Font.BOLD);
+ }
+ component.setFont(font);
+ component.setForeground(foreground);
+ if (component instanceof JLabel) {
+ JLabel jLabel = (JLabel) component;
+ jLabel.setHorizontalAlignment(RIGHT);
+ }
+
+ return component;
+ }
+
+ }
+}
Copied: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/CustomTab.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/CustomTab.java)
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/CustomTab.java (rev 0)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/CustomTab.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,126 @@
+package fr.ifremer.shared.application.swing.tab;
+
+/*
+ * #%L
+ * Ifremer shared :: Application Swing
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2013 Ifremer, CodeLutin, Tony CHEMIT
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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 jaxx.runtime.SwingUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.beans.BeanUtil;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.UIManager;
+import java.awt.Color;
+import java.awt.Font;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Custom tab component which adds a * in the end of the title
+ * when the content is modified.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public class CustomTab extends JPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log = LogFactory.getLog(CustomTab.class);
+
+ protected TabContentModel model;
+
+ protected JLabel title = new JLabel();
+
+ public TabContentModel getModel() {
+ return model;
+ }
+
+ public CustomTab(TabContentModel model) {
+ this.model = model;
+ try {
+ BeanUtil.addPropertyChangeListener(
+ new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ updateTitle();
+ }
+ }, this.model);
+
+ } catch (Exception ex) {
+ log.error("Error while adding the listener to the model modifications", ex);
+ }
+
+ setBackground(null);
+
+ updateTitle();
+ String actionIcon = model.getIcon();
+ if (actionIcon != null) {
+ title.setIcon(SwingUtil.createActionIcon(actionIcon));
+ }
+ add(title);
+ }
+
+ @Override
+ public void setBackground(Color bg) {
+ if (bg == null) {
+ bg = new Color(0, 0, 0, 0);
+ }
+ super.setBackground(bg);
+ revalidate();
+ }
+
+ @Override
+ public void setForeground(Color fg) {
+ super.setForeground(fg);
+ if (title != null) {
+ title.setForeground(fg);
+ }
+ }
+
+ protected void updateTitle() {
+ Font f = UIManager.getDefaults().getFont("Label.font");
+ String titleValue = _(model.getTitle());
+
+ int style;
+ if (model.isModify()) {
+ style = Font.BOLD;
+ titleValue += "*";
+
+ } else if (model.isEmpty()) {
+ style = Font.ITALIC;
+
+ } else {
+ style = Font.PLAIN;
+ }
+
+ title.setText(titleValue);
+ title.setFont(f.deriveFont(style));
+ }
+
+}
Added: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/DelegateTabContainerHandler.java
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/DelegateTabContainerHandler.java (rev 0)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/DelegateTabContainerHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,112 @@
+package fr.ifremer.shared.application.swing.tab;
+
+/*
+ * #%L
+ * Ifremer shared :: Application Swing
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2013 Ifremer, CodeLutin, Tony CHEMIT
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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.shared.application.swing.AbstractApplicationUIHandler;
+import fr.ifremer.shared.application.swing.ApplicationUI;
+
+import javax.swing.DefaultSingleSelectionModel;
+import javax.swing.JTabbedPane;
+import java.awt.Component;
+
+/**
+ * Created on 11/25/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class DelegateTabContainerHandler implements TabContainerHandler {
+
+ final JTabbedPane tabbedPane;
+
+ public DelegateTabContainerHandler(JTabbedPane tabbedPane) {
+ this.tabbedPane = tabbedPane;
+ }
+
+ @Override
+ public JTabbedPane getTabPanel() {
+ return tabbedPane;
+ }
+
+ @Override
+ public void init() {
+
+ getTabPanel().setModel(new DefaultSingleSelectionModel() {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void setSelectedIndex(int index) {
+ int currentIndex = getTabPanel().getSelectedIndex();
+ boolean mustChangeTab = onTabChanged(currentIndex, index);
+
+ if (mustChangeTab) {
+ super.setSelectedIndex(index);
+ }
+ }
+
+ });
+ }
+
+
+ @Override
+ public boolean onTabChanged(int currentIndex, int newIndex) {
+ boolean result = true;
+ if (currentIndex != newIndex) {
+ TabHandler handler = getTabHandler(currentIndex);
+ if (handler != null) {
+ result = handler.onHideTab(currentIndex, newIndex);
+ }
+
+ handler = getTabHandler(newIndex);
+ if (handler != null) {
+ handler.onShowTab(currentIndex, newIndex);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public TabHandler getTabHandler(int index) {
+ TabHandler tabHandler = null;
+ JTabbedPane tabPanel = getTabPanel();
+ if (index >= 0 && index < tabPanel.getTabCount()) {
+ Component tab = tabPanel.getComponentAt(index);
+ if (ApplicationUI.class.isInstance(tab)) {
+ ApplicationUI tuttiTab = (ApplicationUI) tabPanel.getComponentAt(index);
+ AbstractApplicationUIHandler handler = tuttiTab.getHandler();
+ if (TabHandler.class.isInstance(handler)) {
+ tabHandler = (TabHandler) handler;
+ }
+ }
+ }
+ return tabHandler;
+ }
+
+ @Override
+ public void setCustomTab(int index, TabContentModel model) {
+ getTabPanel().setTabComponentAt(index, new CustomTab(model));
+ }
+}
Property changes on: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/DelegateTabContainerHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabContainerHandler.java
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabContainerHandler.java (rev 0)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabContainerHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,68 @@
+package fr.ifremer.shared.application.swing.tab;
+
+/*
+ * #%L
+ * Ifremer shared :: Application Swing
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2013 Ifremer, CodeLutin, Tony CHEMIT
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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 javax.swing.JTabbedPane;
+
+/**
+ * Created on 11/25/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public interface TabContainerHandler {
+
+ JTabbedPane getTabPanel();
+
+ void init();
+
+ /**
+ * Method called when the user selects a tab.
+ *
+ * @param currentIndex
+ * @param newIndex
+ * @return <code>false</code> if you want to prevent the tab change,
+ * <code>true</code> otherwise
+ */
+ boolean onTabChanged(int currentIndex, int newIndex);
+
+ /**
+ * Returns the tab handler of the tab i.
+ *
+ * @param index the index of the tab
+ * @return the tab handler of the index i if the handler implements
+ * the {@link TabHandler} interface,
+ * <code>null</code> otherwise
+ */
+ TabHandler getTabHandler(int index);
+
+ /**
+ * Sets a {@link CustomTab} as tab component.
+ *
+ * @param index
+ * @param model
+ */
+ void setCustomTab(int index, TabContentModel model);
+}
Property changes on: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabContainerHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabContentModel.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabContentModel.java)
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabContentModel.java (rev 0)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabContentModel.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,44 @@
+package fr.ifremer.shared.application.swing.tab;
+
+/*
+ * #%L
+ * Ifremer shared :: Application Swing
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2013 Ifremer, CodeLutin, Tony CHEMIT
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * Interface defining the models of the tab content UIs.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public interface TabContentModel {
+
+ boolean isEmpty();
+
+ boolean isValid();
+
+ boolean isModify();
+
+ String getTitle();
+
+ String getIcon();
+}
Copied: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabHandler.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabHandler.java)
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabHandler.java (rev 0)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/tab/TabHandler.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,52 @@
+package fr.ifremer.shared.application.swing.tab;
+
+/*
+ * #%L
+ * Ifremer shared :: Application Swing
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2013 Ifremer, CodeLutin, Tony CHEMIT
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * Interface describing UI contained in a tab.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.0
+ */
+public interface TabHandler {
+
+ /**
+ * Method called when the tab is hidden
+ *
+ * @param currentIndex
+ * @param newIndex
+ * @return <code>false</code> to prevent the tab to be hidden,
+ * <code>true</code> otherwise.
+ */
+ boolean onHideTab(int currentIndex, int newIndex);
+
+ /**
+ * Method called when the tab is shown
+ *
+ * @param currentIndex
+ * @param newIndex
+ */
+ void onShowTab(int currentIndex, int newIndex);
+}
Copied: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/util/ActionListCellRenderer.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ActionListCellRenderer.java)
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/util/ActionListCellRenderer.java (rev 0)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/util/ActionListCellRenderer.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,61 @@
+package fr.ifremer.shared.application.swing.util;
+
+/*
+ * #%L
+ * Ifremer shared :: Application Swing
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2013 Ifremer, CodeLutin, Tony CHEMIT
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a 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 javax.swing.Action;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JList;
+import javax.swing.border.EmptyBorder;
+import java.awt.Component;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ActionListCellRenderer extends DefaultListCellRenderer {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final EmptyBorder border = new EmptyBorder(4, 8, 4, 8);
+
+ @Override
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus) {
+
+ Component result = super.getListCellRendererComponent(
+ list, value, index, isSelected, cellHasFocus);
+ Action action = ((JButton) value).getAction();
+ setIcon((Icon) action.getValue(Action.LARGE_ICON_KEY));
+ setText((String) action.getValue(Action.NAME));
+ setToolTipText((String) action.getValue(Action.SHORT_DESCRIPTION));
+ setBorder(border);
+ return result;
+ }
+}
Copied: application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/util/Cancelable.java (from rev 1385, branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/Cancelable.java)
===================================================================
--- application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/util/Cancelable.java (rev 0)
+++ application/trunk/application-swing/src/main/java/fr/ifremer/shared/application/swing/util/Cancelable.java 2013-11-25 16:03:00 UTC (rev 1387)
@@ -0,0 +1,36 @@
+package fr.ifremer.shared.application.swing.util;
+
+/*
+ * #%L
+ * Ifremer shared :: Application Swing
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2013 Ifremer, CodeLutin, Tony CHEMIT
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * To cancel contract.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public interface Cancelable {
+
+ void cancel();
+}
1
0
r1386 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise
by tchemit@users.forge.codelutin.com 24 Nov '13
by tchemit@users.forge.codelutin.com 24 Nov '13
24 Nov '13
Author: tchemit
Date: 2013-11-25 00:48:14 +0100 (Mon, 25 Nov 2013)
New Revision: 1386
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1386
Log:
fixes #3854: [CAMPAGNE] erreur null au moment d'enregistrer
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/SaveCruiseAction.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/SaveCruiseAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/SaveCruiseAction.java 2013-11-24 23:27:27 UTC (rev 1385)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/SaveCruiseAction.java 2013-11-24 23:48:14 UTC (rev 1386)
@@ -69,7 +69,7 @@
Cruise oldCruise = persistenceService.getCruise(bean.getId());
// check gear has not changed
- if (!oldCruise.getVessel().equals(bean.getVessel())) {
+ if (ObjectUtils.notEqual(oldCruise.getVessel(), bean.getVessel())) {
// if so ask user confirmation
String htmlMessage = String.format(
1
0
24 Nov '13
Author: tchemit
Date: 2013-11-25 00:27:27 +0100 (Mon, 25 Nov 2013)
New Revision: 1385
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1385
Log:
use ifremer-shared-application project
Added:
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationOption.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationProvider.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SampleCategoryModelConverter.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiActionFactory.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/
Removed:
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiBusinessException.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiIOUtil.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiTechnicalException.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/SampleCategoryModelConverter.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfig.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigOption.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigProvider.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/spatial/
branches/tutti-with-ifremer-shared/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/spatial/
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/WeightUnit.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/config/
branches/tutti-with-ifremer-shared/tutti-service/src/main/resources/META-INF/
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/config/
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/spatial/
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/CloseableUI.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiErrorHelper.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionException.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionHelper.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionSwingWorker.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiUIAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/resources/META-INF/
Modified:
branches/tutti-with-ifremer-shared/pom.xml
branches/tutti-with-ifremer-shared/tutti-persistence/pom.xml
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/InvalidBatchModelException.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/ProgressionModel.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/RessourceClassLoader.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocols.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/synchro/TuttiDatabaseMetadata.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/synchro/TuttiTableMetadata.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/test/DatabaseResource.java
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/META-INF/services/org.apache.commons.beanutils.Converter
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties
branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties
branches/tutti-with-ifremer-shared/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigTest.java
branches/tutti-with-ifremer-shared/tutti-service/pom.xml
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/AbstractTuttiService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/ClosedPersistenceService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDataContext.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingException.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ValidateCruiseOperationsService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightCleaningService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightComputingService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/multipost/MultiPostExportService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/multipost/MultiPostImportService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/TuttiExportService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/ProtocolImportExportService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/SpeciesRowModel.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/PupitriImportExportService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/ReferentialImportExportService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialSynchronizeService.java
branches/tutti-with-ifremer-shared/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties
branches/tutti-with-ifremer-shared/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/ServiceDbResource.java
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/WeightComputingServiceTest.java
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/multipost/MultiPostExportServiceTest.java
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportServiceTest.java
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/protocol/ProtocolImportExportServiceTest.java
branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/referential/ReferentialImportExportServiceTest.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/pom.xml
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/filtered-resources/log4j.properties
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/RunTutti.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiReportUpdaterCallBack.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowAboutAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/StartAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateApplicationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ValidateSelectedCruiseCatchesAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/SaveSampleCategoryModelAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/CloseDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportOrReimportDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallOrReinstallDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/OpenDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReimportDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReinstallDbAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/CancelEditFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CancelEditCatchBatchAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeBatchWeightsAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryColumnIdentifier.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryComponent.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/CreateBenthosMelagAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateSpeciesMelagAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTabUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTabUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesRowModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/MandatorySampleCategoryColumnIdentifier.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ManageTemporaryReferentialUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.css
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiBeanUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiExceptionHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUI.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/AbstractTuttiAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentCellEditor.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentEditorUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/SaveAttachmentAction.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapCellComponent.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorTableModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentCellEditor.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditorHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataTableCell.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/EnterMelagWeightDialog.jaxx
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/SelectSpeciesUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicColumnIdentifier.java
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
branches/tutti-with-ifremer-shared/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModelTest.java
Modified: branches/tutti-with-ifremer-shared/pom.xml
===================================================================
--- branches/tutti-with-ifremer-shared/pom.xml 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/pom.xml 2013-11-24 23:27:27 UTC (rev 1385)
@@ -120,6 +120,7 @@
<!-- libraries version -->
+ <ifremerApplicationVersion>1.0-SNAPSHOT</ifremerApplicationVersion>
<nuitonI18nVersion>2.5.2</nuitonI18nVersion>
<nuitonConfigVersion>3.0-alpha-1</nuitonConfigVersion>
<nuitonCsvVersion>3.0-alpha-1</nuitonCsvVersion>
@@ -131,7 +132,7 @@
<eugenePluginVersion>2.7.2</eugenePluginVersion>
<hibernateVersion>3.6.10.Final</hibernateVersion>
- <jaxxVersion>2.5.30</jaxxVersion>
+ <jaxxVersion>2.6-SNAPSHOT</jaxxVersion>
<swingXVersion>1.6.4</swingXVersion>
<xworkVersion>2.3.15.1</xworkVersion>
@@ -215,6 +216,18 @@
</dependency>
<dependency>
+ <groupId>fr.ifremer.shared</groupId>
+ <artifactId>application</artifactId>
+ <version>${ifremerApplicationVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>fr.ifremer.shared</groupId>
+ <artifactId>application-swing</artifactId>
+ <version>${ifremerApplicationVersion}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-profiling</artifactId>
<version>2.7.1</version>
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/pom.xml
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/pom.xml 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/pom.xml 2013-11-24 23:27:27 UTC (rev 1385)
@@ -38,6 +38,11 @@
<dependencies>
<dependency>
+ <groupId>fr.ifremer.shared</groupId>
+ <artifactId>application</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>fr.ifremer.adagio</groupId>
<artifactId>adagio-core-allegro</artifactId>
</dependency>
Deleted: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiBusinessException.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiBusinessException.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiBusinessException.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,48 +0,0 @@
-package fr.ifremer.tutti;
-
-/*
- * #%L
- * Tutti :: Persistence
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-/**
- * To box any business exception.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class TuttiBusinessException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public TuttiBusinessException(String message) {
- super(message);
- }
-
- public TuttiBusinessException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TuttiBusinessException(Throwable cause) {
- super(cause);
- }
-}
Added: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -0,0 +1,708 @@
+package fr.ifremer.tutti;
+
+import com.google.common.base.Charsets;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Sets;
+import com.google.common.io.Files;
+import fr.ifremer.shared.application.ApplicationConfiguration;
+import fr.ifremer.shared.application.ApplicationIOUtil;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
+import fr.ifremer.shared.application.type.CoordinateEditorType;
+import fr.ifremer.shared.application.type.WeightUnit;
+import fr.ifremer.tutti.persistence.RessourceClassLoader;
+import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.config.ApplicationConfig;
+import org.nuiton.config.ApplicationConfigHelper;
+import org.nuiton.config.ApplicationConfigProvider;
+import org.nuiton.config.ArgumentsParserException;
+import org.nuiton.util.Version;
+
+import javax.swing.KeyStroke;
+import java.awt.Color;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Created on 11/24/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class TuttiConfiguration extends ApplicationConfiguration {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(TuttiConfiguration.class);
+
+ private static TuttiConfiguration instance;
+
+ public static TuttiConfiguration getInstance() {
+ return instance;
+ }
+
+ public static void setInstance(TuttiConfiguration instance) {
+ TuttiConfiguration.instance = instance;
+ }
+
+ protected final String[] optionKeyToNotSave;
+
+ protected File configFile;
+
+ public TuttiConfiguration(ApplicationConfig applicationConfig) {
+ super(applicationConfig);
+ optionKeyToNotSave = null;
+ }
+
+ public TuttiConfiguration(String file, String... args) {
+ super(new ApplicationConfig());
+ applicationConfig.setEncoding(Charsets.UTF_8.name());
+
+ // get all config providers
+ Set<ApplicationConfigProvider> providers =
+ ApplicationConfigHelper.getProviders(null,
+ null,
+ null,
+ true);
+
+ // load all default options
+ ApplicationConfigHelper.loadAllDefaultOption(applicationConfig,
+ providers);
+
+ // get all transient and final option keys
+ Set<String> optionToSkip =
+ ApplicationConfigHelper.getTransientOptionKeys(providers);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Option that won't be saved: " + optionToSkip);
+ }
+ optionKeyToNotSave = optionToSkip.toArray(new String[optionToSkip.size()]);
+
+ applicationConfig.setConfigFileName(file);
+
+ try {
+ applicationConfig.parse(args);
+
+ } catch (ArgumentsParserException e) {
+ throw new ApplicationTechnicalException(_("tutti.config.parse.error"), e);
+ }
+
+ //TODO Review this, this is very dirty to do this...
+ File tuttiBasedir = applicationConfig.getOptionAsFile(
+ TuttiConfigurationOption.BASEDIR.getKey());
+
+ if (tuttiBasedir == null) {
+ tuttiBasedir = new File("");
+ }
+ if (!tuttiBasedir.isAbsolute()) {
+ tuttiBasedir = new File(tuttiBasedir.getAbsolutePath());
+ }
+ if (tuttiBasedir.getName().equals("..")) {
+ tuttiBasedir = tuttiBasedir.getParentFile().getParentFile();
+ }
+ if (tuttiBasedir.getName().equals(".")) {
+ tuttiBasedir = tuttiBasedir.getParentFile();
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Application basedir: " + tuttiBasedir);
+ }
+ applicationConfig.setOption(
+ TuttiConfigurationOption.BASEDIR.getKey(),
+ tuttiBasedir.getAbsolutePath());
+ }
+
+ public void initConfig(RessourceClassLoader resourceLoader) {
+
+ File directory = getDbDirectory();
+ ApplicationIOUtil.forceMkdir(directory, _("tutti.io.mkDir.error", directory));
+ directory = getDbAttachmentDirectory();
+ ApplicationIOUtil.forceMkdir(directory, _("tutti.io.mkDir.error", directory));
+ directory = getProtocolDirectory();
+ ApplicationIOUtil.forceMkdir(directory, _("tutti.io.mkDir.error", directory));
+ directory = getDbBackupDirectory();
+ ApplicationIOUtil.forceMkdir(directory, _("tutti.io.mkDir.error", directory));
+
+ File dataDirectory = getDataDirectory();
+ ApplicationIOUtil.forceMkdir(dataDirectory, _("tutti.io.mkDir.error", dataDirectory));
+
+ File tmpDirectory = getTmpDirectory();
+ if (tmpDirectory.exists()) {
+
+ ApplicationIOUtil.deleteDirectory(tmpDirectory, _("tutti.io.deleteTempDirectory.error", tmpDirectory));
+ }
+ ApplicationIOUtil.forceMkdir(tmpDirectory, _("tutti.io.mkDir.error", tmpDirectory));
+
+ ApplicationIOUtil.forceMkdir(getReportBackupDirectory(), _("tutti.io.mkDir.error", getReportBackupDirectory()));
+
+ // add a predicate to search the configuration file from his directory instead of the class-path
+ resourceLoader.addSearchInDirectoriesPredicate(new Predicate<String>() {
+
+ Set<String> matchingNames = Sets.newHashSet(
+ getDbConfigurationPath().getName(),
+ getDbEnumerationPath().getName());
+
+ @Override
+ public boolean apply(String input) {
+ return matchingNames.contains(input);
+ }
+ });
+
+ // get configuration file path
+ File configurationPath = getDbConfigurationPath();
+
+ // add his directory in path to search
+ resourceLoader.addDirectory(configurationPath.getParentFile());
+
+ // get enumeration file path
+ File enumerationPath = getDbEnumerationPath();
+
+ // add his directory in path to search
+ resourceLoader.addDirectory(enumerationPath.getParentFile());
+
+ // generate external configuration files if required
+ generateExternalDbFiles(false);
+ }
+
+ public void prepareDirectories() {
+
+ File dataDirectory = getDataDirectory();
+ ApplicationIOUtil.forceMkdir(
+ dataDirectory,
+ _("tutti.io.mkDir.error", dataDirectory));
+
+ File tmpDirectory = getTmpDirectory();
+ if (tmpDirectory.exists()) {
+
+ ApplicationIOUtil.deleteDirectory(
+ tmpDirectory,
+ _("tutti.io.deleteTempDirectory.error", tmpDirectory));
+ }
+ ApplicationIOUtil.forceMkdir(
+ tmpDirectory,
+ _("tutti.io.mkDir.error", tmpDirectory));
+
+ ApplicationIOUtil.forceMkdir(
+ getReportBackupDirectory(),
+ _("tutti.io.mkDir.error", getReportBackupDirectory()));
+ }
+
+ public void generateExternalDbFiles(boolean force) {
+
+ try {
+ // always generate db configuration file
+ // see http://forge.codelutin.com/issues/2352
+ generateDbConfiguration(true);
+
+ } catch (IOException e) {
+ throw new ApplicationTechnicalException(_("tutti.persistence.config.generateFile.error"));
+ }
+
+ try {
+
+ generateDbEnumerationConfiguration(force);
+ } catch (IOException e) {
+ throw new ApplicationTechnicalException(_("tutti.persistence.config.generateEnumFile.error"));
+ }
+ }
+
+ public File newTempFile(String basename) {
+ return new File(getTmpDirectory(), basename + "_" + System.nanoTime());
+ }
+
+ public boolean isDbExists() {
+ File f = new File(getDbDirectory(), getDbName() + ".data");
+ return f.exists();
+ }
+
+ public File getConfigFile() {
+ if (configFile == null) {
+ File dir = getBasedir();
+ if (dir == null || !dir.exists() || !isFullLaunchMode()) {
+ dir = new File(applicationConfig.getUserConfigDirectory());
+ }
+ configFile = new File(dir, applicationConfig.getConfigFileName());
+ }
+ return configFile;
+ }
+
+ public String getHelpResourceWithLocale(String value) {
+ File directory = new File(getHelpDirectory(),
+ getI18nLocale().getLanguage());
+ File result = new File(directory, value);
+ return result.toString();
+ }
+
+ public void save() {
+
+ File file = getConfigFile();
+ if (log.isInfoEnabled()) {
+ log.info("Save configuration at: " + file);
+ }
+ try {
+ applicationConfig.save(file, false, optionKeyToNotSave);
+ } catch (IOException e) {
+ throw new ApplicationTechnicalException(_("tutti.config.save.error", file), e);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this);
+ }
+
+ //------------------------------------------------------------------------//
+ //--- Option setter ------------------------------------------------------//
+ //------------------------------------------------------------------------//
+
+ public void setSampleCategoryModel(SampleCategoryModel model) {
+ applicationConfig.setOption(TuttiConfigurationOption.SAMPLE_CATEGORY_MODEL.getKey(), String.valueOf(model));
+ }
+
+ public void setCsvSeparator(char c) {
+ applicationConfig.setOption(
+ TuttiConfigurationOption.CSV_SEPARATOR.getKey(), c + "");
+ }
+
+ public void setExportCountry(String exportCountryId) {
+ applicationConfig.setOption(
+ TuttiConfigurationOption.EXPORT_COUNTRY_ID.getKey(), exportCountryId);
+ }
+
+ public void setI18nLocale(Locale locale) {
+ applicationConfig.setOption(TuttiConfigurationOption.I18N_LOCALE.getKey(), locale.toString());
+ }
+
+ public void setProgramId(String programId) {
+ if (programId == null) {
+ programId = "";
+ }
+ applicationConfig.setOption(TuttiConfigurationOption.PROGRAM_ID.getKey(), programId);
+ }
+
+ public void setCruiseId(String cruiseId) {
+ if (cruiseId == null) {
+ cruiseId = "";
+ }
+ applicationConfig.setOption(TuttiConfigurationOption.CRUISE_ID.getKey(), cruiseId);
+ }
+
+ public void setProtocolId(String protocolId) {
+ if (protocolId == null) {
+ protocolId = "";
+ }
+ applicationConfig.setOption(TuttiConfigurationOption.PROTOCOL_ID.getKey(), protocolId);
+ }
+
+
+ //------------------------------------------------------------------------//
+ //--- Option getter ------------------------------------------------------//
+ //------------------------------------------------------------------------//
+
+ public File getDbConfigurationPath() {
+ return applicationConfig.getOptionAsFile(TuttiConfigurationOption.DB_CONFIGURATION_PATH.getKey());
+ }
+
+ public File getDbDirectory() {
+ return applicationConfig.getOptionAsFile(TuttiConfigurationOption.DB_DIRECTORY.getKey());
+ }
+
+ public File getDbAttachmentDirectory() {
+ return applicationConfig.getOptionAsFile(TuttiConfigurationOption.DB_ATTACHMENT_DIRECTORY.getKey());
+ }
+
+ public File getCacheDirectory() {
+ return applicationConfig.getOptionAsFile(TuttiConfigurationOption.DB_CACHE_DIRECTORY.getKey());
+ }
+
+ public File getDbBackupDirectory() {
+ return applicationConfig.getOptionAsFile(TuttiConfigurationOption.DB_BACKUP_DIRECTORY.getKey());
+ }
+
+ public File getProtocolDirectory() {
+ return applicationConfig.getOptionAsFile(TuttiConfigurationOption.DB_PROTOCOL_DIRECTORY.getKey());
+ }
+
+ public String getDbName() {
+ return applicationConfig.getOption(TuttiConfigurationOption.DB_NAME.getKey());
+ }
+
+ public SampleCategoryModel getSampleCategoryModel() {
+ SampleCategoryModel result = applicationConfig.getOption(SampleCategoryModel.class, TuttiConfigurationOption.SAMPLE_CATEGORY_MODEL.getKey());
+ return result;
+ }
+
+ public File getDbEnumerationPath() {
+ return applicationConfig.getOptionAsFile(TuttiConfigurationOption.DB_ENUMERATION_PATH.getKey());
+ }
+
+ public String getJdbcUrl() {
+ return applicationConfig.getOption(TuttiConfigurationOption.JDBC_URL.getKey());
+ }
+
+ public Class getJdbcDriver() {
+ return applicationConfig.getOptionAsClass(TuttiConfigurationOption.JDBC_DRIVER.getKey());
+ }
+
+ public String getJdbcUsername() {
+ return applicationConfig.getOption(TuttiConfigurationOption.JDBC_USERNAME.getKey());
+ }
+
+ public String getJdbcPassword() {
+ return applicationConfig.getOption(TuttiConfigurationOption.JDBC_PASSWORD.getKey());
+ }
+
+ public Class getHibernateDialect() {
+ return applicationConfig.getOptionAsClass(TuttiConfigurationOption.HIBERNATE_DIALECT.getKey());
+ }
+
+ public boolean isHibernateShowSql() {
+ boolean result = applicationConfig.getOptionAsBoolean(TuttiConfigurationOption.HIBERNATE_SHOW_SQL.getKey());
+ return result;
+ }
+
+ public boolean isHibernateUseSqlComment() {
+ boolean result = applicationConfig.getOptionAsBoolean(TuttiConfigurationOption.HIBERNATE_USE_SQL_COMMENT.getKey());
+ return result;
+ }
+
+ public boolean isHibernateFormatSql() {
+ boolean result = applicationConfig.getOptionAsBoolean(TuttiConfigurationOption.HIBERNATE_FORMAT_SQL.getKey());
+ return result;
+ }
+
+ @Override
+ public String getApplicationName() {
+ return "Allegro Campagne";
+ }
+
+ /** @return {@link TuttiConfigurationOption#VERSION} value */
+ @Override
+ public Version getVersion() {
+ return applicationConfig.getOptionAsVersion(TuttiConfigurationOption.VERSION.getKey());
+ }
+
+ /** @return {@link TuttiConfigurationOption#SITE_URL} value */
+ public URL getSiteUrl() {
+ return applicationConfig.getOptionAsURL(TuttiConfigurationOption.SITE_URL.getKey());
+ }
+
+ /** @return {@link TuttiConfigurationOption#ORGANIZATION_NAME} value */
+ public String getOrganizationName() {
+ return applicationConfig.getOption(TuttiConfigurationOption.ORGANIZATION_NAME.getKey());
+ }
+
+ /** @return {@link TuttiConfigurationOption#INCEPTION_YEAR} value */
+ public int getInceptionYear() {
+ return applicationConfig.getOptionAsInt(TuttiConfigurationOption.INCEPTION_YEAR.getKey());
+ }
+
+ /** @return {@link TuttiConfigurationOption#BASEDIR} value */
+ public File getBasedir() {
+ File result = applicationConfig.getOptionAsFile(TuttiConfigurationOption.BASEDIR.getKey());
+ return result;
+ }
+
+ /** @return {@link TuttiConfigurationOption#DATA_DIRECTORY} value */
+ public File getDataDirectory() {
+ File result = applicationConfig.getOptionAsFile(TuttiConfigurationOption.DATA_DIRECTORY.getKey());
+ return result;
+ }
+
+ /** @return {@link TuttiConfigurationOption#REPORT_DIRECTORY} value */
+ public File getReportDirectory() {
+ File result = applicationConfig.getOptionAsFile(TuttiConfigurationOption.REPORT_DIRECTORY.getKey());
+ return result;
+ }
+
+ /** @return {@link TuttiConfigurationOption#REPORT_BACKUP_DIRECTORY} value */
+ public File getReportBackupDirectory() {
+ File result = applicationConfig.getOptionAsFile(TuttiConfigurationOption.REPORT_DIRECTORY.getKey());
+ return result;
+ }
+
+ public File getTmpDirectory() {
+ File result = applicationConfig.getOptionAsFile(TuttiConfigurationOption.TMP_DIRECTORY.getKey());
+ return result;
+ }
+
+ public char getCsvSeparator() {
+ return applicationConfig.getOption(
+ TuttiConfigurationOption.CSV_SEPARATOR.getKey()).charAt(0);
+ }
+
+ public String getExportCountryId() {
+ return applicationConfig.getOption(
+ TuttiConfigurationOption.EXPORT_COUNTRY_ID.getKey());
+ }
+
+ public List<Integer> getSamplingOrderIds() {
+ ApplicationConfig.OptionList result = applicationConfig.getOptionAsList(TuttiConfigurationOption.SAMPLING_CATEGORY_ORDER_IDS.getKey());
+ return result.getOptionAsInt();
+ }
+
+ public WeightUnit getSpeciesWeightUnit() {
+ return applicationConfig.getOption(WeightUnit.class, TuttiConfigurationOption.WEIGHT_UNIT_SPECIES.getKey());
+ }
+
+ public WeightUnit getBenthosWeightUnit() {
+ return applicationConfig.getOption(WeightUnit.class, TuttiConfigurationOption.WEIGHT_UNIT_BENTHOS.getKey());
+ }
+
+ public WeightUnit getMarineLitterWeightUnit() {
+ return applicationConfig.getOption(WeightUnit.class, TuttiConfigurationOption.WEIGHT_UNIT_MARINE_LITTER.getKey());
+ }
+
+ public WeightUnit getIndividualObservationWeightUnit() {
+ return applicationConfig.getOption(WeightUnit.class, TuttiConfigurationOption.WEIGHT_UNIT_INDIVIDUAL_OBSERVATION.getKey());
+ }
+
+ public WeightUnit getAccidentalCatchWeightUnit() {
+ return applicationConfig.getOption(WeightUnit.class, TuttiConfigurationOption.WEIGHT_UNIT_ACCIDENTAL_CATCH.getKey());
+ }
+
+ public boolean isFullLaunchMode() {
+ return "full".equals(getTuttiLaunchMode());
+ }
+
+ public String getTuttiLaunchMode() {
+ return applicationConfig.getOption(TuttiConfigurationOption.LAUNCH_MODE.getKey());
+ }
+
+ /** @return {@link TuttiConfigurationOption#UI_CONFIG_FILE} value */
+ public File getUIConfigFile() {
+ return applicationConfig.getOptionAsFile(TuttiConfigurationOption.UI_CONFIG_FILE.getKey());
+ }
+
+ /** @return {@link TuttiConfigurationOption#START_ACTION_FILE} value */
+ public File getStartActionFile() {
+ return applicationConfig.getOptionAsFile(TuttiConfigurationOption.START_ACTION_FILE.getKey());
+ }
+
+ public Float getDifferenceRateBetweenSortedAndTotalWeights() {
+ return applicationConfig.getOptionAsFloat(TuttiConfigurationOption.TOTAL_SORTED_WEIGHTS_DIFFERENCE_RATE.getKey());
+ }
+
+ public String getTremieCarousselVesselId() {
+ return applicationConfig.getOption(TuttiConfigurationOption.TREMIE_CAROUSSEL_VESSEL_ID.getKey());
+ }
+
+ public boolean isAutoPopupNumberEditor() {
+ return applicationConfig.getOptionAsBoolean(TuttiConfigurationOption.AUTO_POPUP_NUMBER_EDITOR.getKey());
+ }
+
+ public boolean isShowNumberEditorButton() {
+ return applicationConfig.getOptionAsBoolean(TuttiConfigurationOption.SHOW_NUMBER_EDITOR_BUTTON.getKey());
+ }
+
+ public CoordinateEditorType getCoordinateEditorType() {
+ String value = applicationConfig.getOption(TuttiConfigurationOption.COORDINATE_EDITOR_TYPE.getKey());
+ return CoordinateEditorType.valueOf(value);
+ }
+
+ public String getProgramId() {
+ String result = applicationConfig.getOption(TuttiConfigurationOption.PROGRAM_ID.getKey());
+ return StringUtils.isBlank(result) ? null : result;
+ }
+
+ public String getCruiseId() {
+ String result = applicationConfig.getOption(TuttiConfigurationOption.CRUISE_ID.getKey());
+ return StringUtils.isBlank(result) ? null : result;
+ }
+
+ public String getProtocolId() {
+ String result = applicationConfig.getOption(TuttiConfigurationOption.PROTOCOL_ID.getKey());
+ return StringUtils.isBlank(result) ? null : result;
+ }
+
+ public Color getColorRowInvalid() {
+ return applicationConfig.getOptionAsColor(TuttiConfigurationOption.COLOR_ROW_INVALID.getKey());
+ }
+
+ public Color getColorRowReadOnly() {
+ return applicationConfig.getOptionAsColor(TuttiConfigurationOption.COLOR_ROW_READ_ONLY.getKey());
+ }
+
+ public Color getColorCellWithValue() {
+ return applicationConfig.getOptionAsColor(TuttiConfigurationOption.COLOR_CELL_WITH_VALUE.getKey());
+ }
+
+ public Color getColorRowToConfirm() {
+ return applicationConfig.getOptionAsColor(TuttiConfigurationOption.COLOR_ROW_TO_CONFIRM.getKey());
+ }
+
+ public Color getColorComputedWeights() {
+ return applicationConfig.getOptionAsColor(TuttiConfigurationOption.COLOR_COMPUTED_WEIGHTS.getKey());
+ }
+
+ public Color getColorBlockingLayer() {
+ return applicationConfig.getOptionAsColor(TuttiConfigurationOption.COLOR_BLOCKING_LAYER.getKey());
+ }
+
+ public Color getColorAlternateRow() {
+ return applicationConfig.getOptionAsColor(TuttiConfigurationOption.COLOR_ALTERNATE_ROW.getKey());
+ }
+
+ public Color getColorSelectedRow() {
+ return applicationConfig.getOptionAsColor(TuttiConfigurationOption.COLOR_SELECTED_ROW.getKey());
+ }
+
+ public KeyStroke getShortcutClosePopup() {
+ return applicationConfig.getOptionAsKeyStroke(TuttiConfigurationOption.SHORTCUT_CLOSE_POPUP.getKey());
+ }
+
+ public int getMaxIndividualObservationRowsToCreate() {
+ return applicationConfig.getOptionAsInt(TuttiConfigurationOption.MAX_INDIVIDUAL_OBSERVATION_ROW_TO_CREATE.getKey());
+ }
+
+ public KeyStroke getShortCut(String actionName) {
+ KeyStroke result = applicationConfig.getOptionAsKeyStroke(
+ "tutti.ui." + actionName);
+ return result;
+ }
+
+ public String getDateFormat() {
+ return applicationConfig.getOption(TuttiConfigurationOption.DATE_FORMAT.getKey());
+ }
+
+ public File getNewTmpDirectory(String name) {
+ return new File(getTmpDirectory(), name + "_" + System.nanoTime());
+ }
+
+
+ public File getI18nDirectory() {
+ return applicationConfig.getOptionAsFile(
+ TuttiConfigurationOption.I18N_DIRECTORY.getKey());
+ }
+
+ public Locale getI18nLocale() {
+ return applicationConfig.getOptionAsLocale(
+ TuttiConfigurationOption.I18N_LOCALE.getKey());
+ }
+
+ public File getHelpDirectory() {
+ return applicationConfig.getOptionAsFile(
+ TuttiConfigurationOption.HELP_DIRECTORY.getKey());
+ }
+
+ public String getUpdateApplicationUrl() {
+ return applicationConfig.getOption(TuttiConfigurationOption.UPDATE_APPLICATION_URL.getKey());
+ }
+
+ public String getUpdateDataUrl() {
+ return applicationConfig.getOption(TuttiConfigurationOption.UPDATE_DATA_URL.getKey());
+ }
+
+ public String getAdminPassword() {
+ return applicationConfig.getOption(TuttiConfigurationOption.ADMIN_PASSWORD.getKey());
+ }
+
+ //------------------------------------------------------------------------//
+ //--- Internal methods ---------------------------------------------------//
+ //------------------------------------------------------------------------//
+
+ protected void generateDbConfiguration(boolean force) throws IOException {
+
+ File destination = getDbConfigurationPath();
+
+ if (force || !destination.exists()) {
+
+ // load db configuration template (tutti-db.properties)
+
+ if (log.isInfoEnabled()) {
+ log.info("Generate " + destination + " from classpath.");
+ }
+ Properties result = new Properties();
+ InputStream in = getClass().getResourceAsStream("/tutti-db-conf.properties");
+ try {
+ result.load(in);
+ in.close();
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
+
+ // replace some values from ApplicationConfig
+
+ result.put("dataSource.jdbc.driver", getJdbcDriver().getName());
+ result.put("dataSource.jdbc.username", getJdbcUsername());
+ result.put("dataSource.jdbc.password", getJdbcPassword());
+ result.put("dataSource.jdbc.url", getJdbcUrl());
+ result.put("hibernate.dialect", getHibernateDialect().getName());
+ result.put("hibernate.show_sql", isHibernateShowSql() + "");
+ result.put("hibernate.format_sql", isHibernateFormatSql() + "");
+ result.put("hibernate.use_sql_comments", isHibernateUseSqlComment() + "");
+ result.put("ehcache.disk.store.dir", getCacheDirectory().getAbsolutePath());
+
+ // write result file at destination
+
+ BufferedWriter writer = Files.newWriter(destination, Charsets.UTF_8);
+ try {
+ result.store(writer, "Generated by " + getClass().getName());
+ writer.close();
+ } finally {
+ IOUtils.closeQuietly(writer);
+ }
+ }
+ }
+
+ protected void generateDbEnumerationConfiguration(boolean force) throws IOException {
+
+ File destination = getDbEnumerationPath();
+
+ if (force || !destination.exists()) {
+
+ // load enumeration mapping from classpath (enumerations.properties)
+
+ if (log.isInfoEnabled()) {
+ log.info("Generate " + destination + " from classpath.");
+ }
+
+ Properties result = new Properties();
+ InputStream in = getClass().getResourceAsStream("/tutti-db-enumerations.properties");
+ try {
+ result.load(in);
+ in.close();
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
+
+ // replace some values from ApplicationConfig
+
+
+ // write result file at destination
+
+ BufferedWriter writer =
+ Files.newWriter(destination, Charsets.UTF_8);
+ try {
+ result.store(writer, "Generated by " + getClass().getName());
+ writer.close();
+ } finally {
+ IOUtils.closeQuietly(writer);
+ }
+ }
+ }
+
+ public Properties getDbEnumerations() throws IOException {
+ Properties result = new Properties();
+ BufferedReader in = Files.newReader(getDbEnumerationPath(), Charsets.UTF_8);
+ try {
+ result.load(in);
+ in.close();
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
+ return result;
+ }
+}
Property changes on: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationOption.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationOption.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationOption.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -0,0 +1,554 @@
+package fr.ifremer.tutti;
+
+import fr.ifremer.shared.application.type.CoordinateEditorType;
+import fr.ifremer.shared.application.type.WeightUnit;
+import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
+import org.hibernate.dialect.HSQLDialect;
+import org.hsqldb.jdbcDriver;
+import org.nuiton.config.ConfigOptionDef;
+import org.nuiton.util.Version;
+
+import javax.swing.KeyStroke;
+import java.awt.Color;
+import java.io.File;
+import java.net.URL;
+import java.util.Locale;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * All application configuration options.
+ * <p/>
+ * Created on 11/24/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public enum TuttiConfigurationOption implements ConfigOptionDef {
+
+ //------------------------------------------------------------------------//
+ //-- READ-ONLY OPTIONS ---------------------------------------------------//
+ //------------------------------------------------------------------------//
+
+ BASEDIR(
+ "tutti.basedir",
+ n_("tutti.config.option.basedir.description"),
+ "${user.home}/.tutti",
+ File.class),
+
+ DATA_DIRECTORY(
+ "tutti.data.directory",
+ n_("tutti.config.option.data.directory.description"),
+ "${tutti.basedir}/data",
+ File.class),
+
+ I18N_DIRECTORY(
+ "tutti.i18n.directory",
+ n_("tutti.config.option.i18n.directory.description"),
+ "${tutti.basedir}/i18n",
+ File.class),
+
+ HELP_DIRECTORY(
+ "tutti.help.directory",
+ n_("tutti.config.option.help.directory.description"),
+ "${tutti.basedir}/help",
+ File.class),
+
+ TMP_DIRECTORY(
+ "tutti.tmp.directory",
+ n_("tutti.config.option.tmp.directory.description"),
+ "${tutti.data.directory}/temp",
+ File.class),
+
+ REPORT_DIRECTORY(
+ "tutti.report.directory",
+ n_("tutti.config.option.report.directory.description"),
+ "${tutti.basedir}/report",
+ File.class),
+
+ DB_DIRECTORY(
+ "tutti.persistence.db.directory",
+ n_("tutti.config.option.persistence.db.directory.description"),
+ "${tutti.data.directory}/db",
+ File.class),
+
+ DB_ATTACHMENT_DIRECTORY(
+ "tutti.persistence.db.attachment.directory",
+ n_("tutti.config.option.persistence.db.attachment.directory.description"),
+ "${tutti.data.directory}/meas_files",
+ File.class),
+
+ DB_CACHE_DIRECTORY(
+ "tutti.persistence.db.cache.directory",
+ n_("tutti.config.option.persistence.db.cache.directory.description"),
+ "${tutti.data.directory}/dbcache",
+ File.class),
+
+ DB_PROTOCOL_DIRECTORY(
+ "tutti.persistence.db.protocol.directory",
+ n_("tutti.config.option.persistence.db.protocol.directory.description"),
+ "${tutti.data.directory}/protocol",
+ File.class),
+
+ DB_CONFIGURATION_PATH(
+ "tutti.persistence.db.configurationPath",
+ n_("tutti.config.option.persistence.db.configurationPath.description"),
+ "${tutti.data.directory}/dbconf/conf.properties",
+ File.class),
+
+ DB_ENUMERATION_PATH(
+ "tutti.persistence.db.enumerationPath",
+ n_("tutti.config.option.persistence.db.enumerationPath.description"),
+ "${tutti.data.directory}/dbconf/enumerations-v3.properties",
+ File.class),
+
+ DB_NAME(
+ "tutti.persistence.db.name",
+ n_("tutti.config.option.persistence.db.name.description"),
+ "allegro",
+ String.class),
+
+ JDBC_USERNAME(
+ "tutti.persistence.jdbc.username",
+ n_("tutti.config.option.persistence.jdbc.username.description"),
+ "sa",
+ String.class),
+
+ JDBC_PASSWORD(
+ "tutti.persistence.jdbc.password",
+ n_("tutti.config.option.persistence.jdbc.password.description"),
+ "",
+ String.class),
+
+ JDBC_URL(
+ "tutti.persistence.jdbc.url",
+ n_("tutti.config.option.persistence.jdbc.url.description"),
+ "jdbc:hsqldb:file:${tutti.persistence.db.directory}/${tutti.persistence.db.name}",
+ String.class),
+
+ JDBC_DRIVER(
+ "tutti.persistence.jdbc.driver",
+ n_("tutti.config.option.persistence.jdbc.driver.description"),
+ jdbcDriver.class.getName(),
+ Class.class),
+
+ HIBERNATE_DIALECT(
+ "tutti.persistence.hibernate.dialect",
+ n_("tutti.config.option.persistence.hibernate.dialect.description"),
+ HSQLDialect.class.getName(),
+ Class.class),
+
+ LAUNCH_MODE(
+ "tutti.launch.mode",
+ n_("tutti.config.option.launch.mode.description"),
+ null,
+ String.class),
+
+ START_ACTION_FILE(
+ "tutti.startActionFile",
+ n_("tutti.config.option.startActionFile.description"),
+ "${tutti.basedir}/tutti-start-action",
+ File.class),
+
+ VERSION(
+ "tutti.version",
+ n_("tutti.config.option.version.description"),
+ "",
+ Version.class),
+
+ SITE_URL(
+ "tutti.site.url",
+ n_("tutti.config.option.site.url.description"),
+ "http://maven-site.forge.codelutin.com/tutti",
+ URL.class),
+
+ ORGANIZATION_NAME(
+ "tutti.organizationName",
+ n_("tutti.config.option.organizationName.description"),
+ "",
+ String.class),
+
+ INCEPTION_YEAR(
+ "tutti.inceptionYear",
+ n_("tutti.config.option.inceptionYear.description"),
+ "2012",
+ Integer.class),
+
+ //------------------------------------------------------------------------//
+ //-- READ-WRITE OPTIONS --------------------------------------------------//
+ //------------------------------------------------------------------------//
+
+ DB_BACKUP_DIRECTORY(
+ "tutti.persistence.db.backup.directory",
+ n_("tutti.config.option.persistence.db.backup.directory.description"),
+ "${tutti.data.directory}/dbbackup",
+ File.class,
+ false),
+
+ HIBERNATE_SHOW_SQL(
+ "tutti.persistence.hibernate.showSql",
+ n_("tutti.config.option.persistence.hibernate.showSql.description"),
+ Boolean.FALSE.toString(),
+ boolean.class,
+ false),
+
+ HIBERNATE_USE_SQL_COMMENT(
+ "tutti.persistence.hibernate.useSqlComment",
+ n_("tutti.config.option.persistence.hibernate.useSqlComment.description"),
+ Boolean.FALSE.toString(),
+ boolean.class,
+ false),
+
+ HIBERNATE_FORMAT_SQL(
+ "tutti.persistence.hibernate.formatSql",
+ n_("tutti.config.option.persistence.hibernate.formatSql.description"),
+ Boolean.FALSE.toString(),
+ boolean.class,
+ false),
+
+ SAMPLE_CATEGORY_MODEL(
+ "tutti.persistence.SampleCategoryModel",
+ n_("tutti.config.option.persistence.SampleCategoryModel.description"),
+ "1428,V/HV|198,Class Tri.|196,Sexe|174,Maturité|1430,Age",
+ SampleCategoryModel.class,
+ false
+ ),
+
+ REPORT_BACKUP_DIRECTORY(
+ "tutti.report.backup.directory",
+ n_("tutti.config.option.report.backup.directory.description"),
+ "${tutti.data.directory}/reportbackup",
+ File.class,
+ false),
+
+ CSV_SEPARATOR(
+ "tutti.csv.separator",
+ n_("tutti.config.option.csv.separator.description"),
+ ";",
+ char.class,
+ false),
+
+ EXPORT_COUNTRY_ID(
+ "tutti.export.countryId",
+ n_("tutti.config.option.export.countryId.description"),
+ "12",
+ String.class,
+ false),
+
+ SAMPLING_CATEGORY_ORDER_IDS(
+ "tutti.samplingCategoryOrderIds",
+ n_("tutti.config.option.samplingCategoryOrderIds.description"),
+ "198,196,174,1430",
+ Integer[].class,
+ false),
+
+ WEIGHT_UNIT_SPECIES(
+ "tutti.weight.unit.species",
+ n_("tutti.config.option.weight.unit.species.description"),
+ WeightUnit.KG.name(),
+ WeightUnit.class,
+ false),
+
+ WEIGHT_UNIT_BENTHOS(
+ "tutti.weight.unit.benthos",
+ n_("tutti.config.option.weight.unit.benthos.description"),
+ WeightUnit.G.name(),
+ WeightUnit.class,
+ false),
+
+ WEIGHT_UNIT_MARINE_LITTER(
+ "tutti.weight.unit.marineLitter",
+ n_("tutti.config.option.weight.unit.marineLitter.description"),
+ WeightUnit.KG.name(),
+ WeightUnit.class,
+ false),
+
+ WEIGHT_UNIT_INDIVIDUAL_OBSERVATION(
+ "tutti.weight.unit.individualObservation",
+ n_("tutti.config.option.weight.unit.individualObservation.description"),
+ WeightUnit.G.name(),
+ WeightUnit.class,
+ false),
+
+ WEIGHT_UNIT_ACCIDENTAL_CATCH(
+ "tutti.weight.unit.accidentalCatch",
+ n_("tutti.config.option.weight.unit.accidentalCatch.description"),
+ WeightUnit.KG.name(),
+ WeightUnit.class,
+ false),
+
+ I18N_LOCALE(
+ "tutti.i18n.locale",
+ n_("tutti.config.option.i18n.locale.description"),
+ Locale.FRANCE.getCountry(),
+ Locale.class,
+ false
+ ),
+
+ UPDATE_APPLICATION_URL(
+ "tutti.update.application.url",
+ n_("tutti.config.option.update.application.url.description"),
+ "http://appup.forge.codelutin.com/tutti/tutti-application.properties",
+ String.class,
+ false
+ ),
+
+ UPDATE_DATA_URL(
+ "tutti.update.data.url",
+ n_("tutti.config.option.update.data.url.description"),
+ "http://appup.forge.codelutin.com/tutti/tutti-data.properties",
+ String.class,
+ false
+ ),
+
+ UI_CONFIG_FILE(
+ "tutti.ui.config.file",
+ n_("tutti.config.option.ui.config.file.description"),
+ "${tutti.data.directory}/tuttiUI.xml",
+ File.class,
+ false
+ ),
+
+ TOTAL_SORTED_WEIGHTS_DIFFERENCE_RATE(
+ "tutti.db.weights.rate.difference.totalAndSorted",
+ n_("tutti.config.option.weights.rate.difference.totalAndSorted.description"),
+ "1.0",
+ Float.class,
+ false
+ ),
+
+ TREMIE_CAROUSSEL_VESSEL_ID(
+ "tutti.tremieCarousselVessel",
+ n_("tutti.config.option.tremieCarousselVessel.description"),
+ "",
+ String.class,
+ false
+ ),
+
+ PROGRAM_ID(
+ "tutti.programId",
+ n_("tutti.config.option.programId.description"),
+ null,
+ String.class,
+ false
+ ),
+
+ CRUISE_ID(
+ "tutti.cruiseId",
+ n_("tutti.config.option.cruiseId.description"),
+ null,
+ String.class,
+ false
+ ),
+
+ PROTOCOL_ID(
+ "tutti.protocolId",
+ n_("tutti.config.option.protocolId.description"),
+ null,
+ String.class,
+ false
+ ),
+
+ AUTO_POPUP_NUMBER_EDITOR(
+ "tutti.ui.autoPopupNumberEditor",
+ n_("tutti.config.option.ui.autoPopupNumberEditor.description"),
+ String.valueOf(false),
+ Boolean.class,
+ false
+ ),
+
+ SHOW_NUMBER_EDITOR_BUTTON(
+ "tutti.ui.showNumberEditorButton",
+ n_("tutti.config.option.ui.showNumberEditorButton.description"),
+ String.valueOf(true),
+ Boolean.class,
+ false
+ ),
+
+ COLOR_ROW_READ_ONLY(
+ "tutti.ui.color.rowReadOnly",
+ n_("tutti.config.option.ui.color.rowReadOnly.description"),
+ new Color(192, 192, 192).toString(),
+ Color.class,
+ false
+ ),
+
+ COLOR_ROW_INVALID(
+ "tutti.ui.color.rowInvalid",
+ n_("tutti.config.option.ui.color.rowInvalid.description"),
+ new Color(255, 204, 153).toString(),
+ Color.class,
+ false
+ ),
+
+ COLOR_CELL_WITH_VALUE(
+ "tutti.ui.color.cellWithValue",
+ n_("tutti.config.option.ui.color.cellWithValue.description"),
+ new Color(128, 255, 128).toString(),
+ Color.class,
+ false
+ ),
+
+ COLOR_ROW_TO_CONFIRM(
+ "tutti.ui.color.rowToConfirm",
+ n_("tutti.config.option.ui.color.rowToConfirm.description"),
+ Color.ORANGE.toString(),
+ Color.class,
+ false
+ ),
+
+ COLOR_ALTERNATE_ROW(
+ "tutti.ui.color.alternateRow",
+ n_("tutti.config.option.ui.color.alternateRow.description"),
+ new Color(217, 217, 217).toString(),
+ Color.class,
+ false
+ ),
+ COLOR_SELECTED_ROW(
+ "tutti.ui.color.selectedRow",
+ n_("tutti.config.option.ui.color.selectedRow.description"),
+ new Color(57, 105, 138).toString(),
+ Color.class,
+ false
+ ),
+
+ COLOR_BLOCKING_LAYER(
+ "tutti.ui.color.blockingLayer",
+ n_("tutti.config.option.ui.color.blockingLayer.description"),
+ new Color(200, 200, 200).toString(),
+ Color.class,
+ false
+ ),
+
+ COLOR_COMPUTED_WEIGHTS(
+ "tutti.ui.color.computedWeights",
+ n_("tutti.config.option.ui.color.computedWeights.description"),
+ Color.BLUE.toString(),
+ Color.class,
+ false
+ ),
+
+ SHORTCUT_CLOSE_POPUP(
+ "tutti.ui.shortcut.closePopup",
+ n_("tutti.config.option.ui.shortcut.closePopup.description"),
+ "alt pressed F",
+ KeyStroke.class,
+ false
+ ),
+
+ COORDINATE_EDITOR_TYPE(
+ "tutti.ui.coordinateEditorType",
+ n_("tutti.config.option.ui.coordinateEditorType.description"),
+ CoordinateEditorType.DD.toString(),
+ CoordinateEditorType.class,
+ false
+ ),
+
+ DATE_FORMAT(
+ "tutti.ui.dateFormat",
+ n_("tutti.config.option.ui.dateFormat.description"),
+ "dd/MM/yyyy",
+ String.class,
+ false
+ ),
+
+ ADMIN_PASSWORD(
+ "tutti.admin.password",
+ n_("tutti.config.option.ui.adminPassword.description"),
+ // "ifremer" by default
+ "ef399a6e6ec62c6e142440241a5b98f8",
+ String.class,
+ false
+ ),
+
+ MAX_INDIVIDUAL_OBSERVATION_ROW_TO_CREATE(
+ "tutti.ui.max.individualObservationRowsToCreate",
+ n_("tutti.config.option.ui.individualObservationRowsToCreate.description"),
+ "10",
+ Integer.class,
+ false
+ );
+
+ /** Configuration key. */
+ private final String key;
+
+ /** I18n key of option description */
+ private final String description;
+
+ /** Type of option */
+ private final Class<?> type;
+
+ /** Default value of option. */
+ private String defaultValue;
+
+ /** Flag to not keep option value on disk */
+ private boolean isTransient;
+
+ /** Flag to not allow option value modification */
+ private boolean isFinal;
+
+ TuttiConfigurationOption(String key,
+ String description,
+ String defaultValue,
+ Class<?> type,
+ boolean isTransient) {
+ this.key = key;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ this.type = type;
+ this.isTransient = isTransient;
+ this.isFinal = isTransient;
+ }
+
+ TuttiConfigurationOption(String key,
+ String description,
+ String defaultValue,
+ Class<?> type) {
+ this(key, description, defaultValue, type, true);
+ }
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return type;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ @Override
+ public boolean isTransient() {
+ return isTransient;
+ }
+
+ @Override
+ public boolean isFinal() {
+ return isFinal;
+ }
+
+ @Override
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ @Override
+ public void setTransient(boolean newValue) {
+ // not used
+ }
+
+ @Override
+ public void setFinal(boolean newValue) {
+ // not used
+ }
+}
Property changes on: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationOption.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationProvider.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationProvider.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationProvider.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -0,0 +1,39 @@
+package fr.ifremer.tutti;
+
+import org.nuiton.config.ApplicationConfigProvider;
+import org.nuiton.config.ConfigActionDef;
+import org.nuiton.config.ConfigOptionDef;
+
+import java.util.Locale;
+
+import static org.nuiton.i18n.I18n.l_;
+
+/**
+ * Tutti config provider (for site generation).
+ * Created on 11/24/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class TuttiConfigurationProvider implements ApplicationConfigProvider {
+
+ @Override
+ public String getName() {
+ return "tutti";
+ }
+
+ @Override
+ public String getDescription(Locale locale) {
+ return l_(locale, "tutti.config");
+ }
+
+ @Override
+ public ConfigOptionDef[] getOptions() {
+ return TuttiConfigurationOption.values();
+ }
+
+ @Override
+ public ConfigActionDef[] getActions() {
+ return new ConfigActionDef[0];
+ }
+}
\ No newline at end of file
Property changes on: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationProvider.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiIOUtil.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiIOUtil.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiIOUtil.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,255 +0,0 @@
-package fr.ifremer.tutti;
-
-/*
- * #%L
- * Tutti :: Persistence
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.Charsets;
-import com.google.common.io.Files;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.vfs2.FileObject;
-import org.apache.commons.vfs2.FileSelector;
-import org.apache.commons.vfs2.FileSystemManager;
-import org.apache.commons.vfs2.FileType;
-import org.apache.commons.vfs2.VFS;
-import org.nuiton.util.ZipUtil;
-
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.List;
-import java.util.UUID;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Useful methods around IO, all method errors are boxes a
- * {@link TuttiTechnicalException}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0.2
- */
-public class TuttiIOUtil {
-
- protected TuttiIOUtil() {
- // no instance
- }
-
- public static void close(Closeable toClose, String errorMessage) {
-
- try {
- toClose.close();
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void zip(File source, File archiveFile, String errorMessage) {
- try {
- ZipUtil.compress(archiveFile, source);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void zip(File source, File archiveFile, List<File> files, String errorMessage) {
- try {
- ZipUtil.compressFiles(archiveFile, source, files);
- } catch (IOException e) {
- throw new TuttiTechnicalException(_(errorMessage, archiveFile), e);
- }
- }
-
- public static FileObject resolveFile(String file, String errorMessage) {
- try {
- FileSystemManager manager = VFS.getManager();
- FileObject targetObject = manager.resolveFile(file);
- return targetObject;
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static FileObject[] getChildren(FileObject objectFile, String errorMessage) {
- try {
- return objectFile.getChildren();
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static FileObject getChild(FileObject objectFile, String name, String errorMessage) {
- try {
- return objectFile.getChild(name);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
-
- public static FileType getType(FileObject objectFile, String errorMessage) {
- try {
- return objectFile.getType();
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void explode(FileObject archiveFile,
- File target,
- FileSelector fileSelector, String errorMessage) {
- try {
- FileSystemManager manager = VFS.getManager();
- FileObject targetObject = manager.toFileObject(target);
- targetObject.copyFrom(archiveFile, fileSelector);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void forceMkdir(File dir, String errorMessage) {
- try {
- FileUtils.forceMkdir(dir);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void cleanDirectory(File dir, String errorMessage) {
- try {
- FileUtils.cleanDirectory(dir);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void deleteDirectory(File dir, String errorMessage) {
- try {
- FileUtils.deleteDirectory(dir);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void forceDeleteOnExit(File dir, String errorMessage) {
- try {
- FileUtils.forceDeleteOnExit(dir);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void copyDirectory(File source, File target, String errorMessage) {
- try {
- FileUtils.copyDirectory(source, target);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void copyFileToDirectory(File source, File target, String errorMessage) {
- try {
- FileUtils.copyFileToDirectory(source, target);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void copyFile(File source, File target, String errorMessage) {
- try {
- FileUtils.copyFile(source, target);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void deleteFile(File file, String errorMessage) {
- try {
- FileUtils.forceDelete(file);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static String getBaseName(String file) {
- return FilenameUtils.getBaseName(file);
- }
-
- public static String getExtension(String file) {
- return FilenameUtils.getExtension(file);
- }
-
- public static Reader newReader(File file, String errorMessage) {
- try {
- return Files.newReader(file, Charsets.UTF_8);
-
- } catch (FileNotFoundException e) {
- throw new TuttiTechnicalException(_(errorMessage, file), e);
- }
- }
-
- public static Writer newWriter(File file, String errorMessage
- ) {
- try {
- return Files.newWriter(file, Charsets.UTF_8);
-
- } catch (FileNotFoundException e) {
- throw new TuttiTechnicalException(_(errorMessage, file), e);
- }
- }
-
- public static File explodeZip(File rootDirectory,
- File file,
- String errorMessage) {
- File tempDir = new File(rootDirectory, UUID.randomUUID().toString());
- try {
- ZipUtil.uncompress(file, tempDir);
- } catch (IOException e) {
- throw new TuttiTechnicalException(_(errorMessage, file), e);
- }
- return tempDir;
- }
-
- public static String readContent(File file, String errorMessage) {
-
- try {
- return Files.readFirstLine(file, Charsets.UTF_8);
-
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
- }
-
- public static void writeContent(File file, String content, String errorMessage) {
- try {
- FileUtils.write(file, content, Charsets.UTF_8);
- } catch (IOException e) {
- throw new TuttiTechnicalException(errorMessage, e);
- }
-
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiTechnicalException.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiTechnicalException.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiTechnicalException.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,51 +0,0 @@
-package fr.ifremer.tutti;
-
-/*
- * #%L
- * Tutti :: Persistence
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-/**
- * Any techincal exception should be boxed in a such exception.
- *
- * @author tchemit <chemit(a)codelutin.com/>
- * @since 0.1
- */
-public class TuttiTechnicalException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public TuttiTechnicalException() {
- }
-
- public TuttiTechnicalException(String message) {
- super(message);
- }
-
- public TuttiTechnicalException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TuttiTechnicalException(Throwable cause) {
- super(cause);
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/InvalidBatchModelException.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/InvalidBatchModelException.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/InvalidBatchModelException.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.TuttiBusinessException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
/**
* Exception when batch model is not compatible with Tutti.
@@ -32,7 +32,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.0.2
*/
-public class InvalidBatchModelException extends TuttiBusinessException {
+public class InvalidBatchModelException extends ApplicationBusinessException {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/ProgressionModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/ProgressionModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/ProgressionModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,7 +24,7 @@
* #L%
*/
-import org.jdesktop.beans.AbstractSerializableBean;
+import fr.ifremer.shared.application.type.ApplicationProgressionModel;
import org.nuiton.updater.DownloadMonitor;
/**
@@ -33,87 +33,87 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.0
*/
-public class ProgressionModel extends AbstractSerializableBean implements DownloadMonitor {
+public class ProgressionModel extends ApplicationProgressionModel implements DownloadMonitor {
private static final long serialVersionUID = 1L;
+//
+// public static final String PROPERTY_TOTAL = "total";
+//
+// public static final String PROPERTY_CURRENT = "current";
+//
+// public static final String PROPERTY_RATE = "rate";
+//
+// public static final String PROPERTY_MESSAGE = "message";
+//
+// protected int total;
+//
+// protected int current;
+//
+// protected float rate;
+//
+// protected String message;
- public static final String PROPERTY_TOTAL = "total";
+// public int getTotal() {
+// return total;
+// }
+//
+// public void setTotal(int total) {
+// Object oldValue = getTotal();
+// this.total = total;
+// firePropertyChange(PROPERTY_TOTAL, oldValue, total);
+// setCurrent(0);
+// }
+//
+// public void adaptTotal(int total) {
+// long current = getCurrent();
+// setTotal(total);
+// increments((int) current);
+// Object oldValue = getTotal();
+// this.total = total;
+// firePropertyChange(PROPERTY_TOTAL, oldValue, total);
+// setCurrent(current);
+// }
+//
+// public long getCurrent() {
+// return current;
+// }
+//
+// public void setCurrent(int current) {
+// Object oldValue = getCurrent();
+// this.current = current;
+// firePropertyChange(PROPERTY_CURRENT, oldValue, current);
+// }
+//
+// public void increments(int nb) {
+// setCurrent(current + nb);
+// setRate(getCurrent() / getTotal());
+// }
+//
+// public float getRate() {
+// return rate;
+// }
+//
+// public void setRate(float rate) {
+// Object oldValue = getRate();
+// this.rate = rate;
+// firePropertyChange(PROPERTY_RATE, oldValue, rate);
+// }
+//
+// public String getMessage() {
+// return message;
+// }
+//
+// public void increments(String message) {
+// increments(1);
+// setMessage(message);
+// }
+//
+// public void setMessage(String message) {
+// Object oldValue = getMessage();
+// this.message = message;
+// firePropertyChange(PROPERTY_MESSAGE, oldValue, message);
+// }
- public static final String PROPERTY_CURRENT = "current";
-
- public static final String PROPERTY_RATE = "rate";
-
- public static final String PROPERTY_MESSAGE = "message";
-
- protected int total;
-
- protected int current;
-
- protected float rate;
-
- protected String message;
-
- public int getTotal() {
- return total;
- }
-
- public void setTotal(int total) {
- Object oldValue = getTotal();
- this.total = total;
- firePropertyChange(PROPERTY_TOTAL, oldValue, total);
- setCurrent(0);
- }
-
- public void adaptTotal(int total) {
- long current = getCurrent();
- setTotal(total);
- increments((int) current);
- Object oldValue = getTotal();
- this.total = total;
- firePropertyChange(PROPERTY_TOTAL, oldValue, total);
- setCurrent(current);
- }
-
- public long getCurrent() {
- return current;
- }
-
- public void setCurrent(int current) {
- Object oldValue = getCurrent();
- this.current = current;
- firePropertyChange(PROPERTY_CURRENT, oldValue, current);
- }
-
- public void increments(int nb) {
- setCurrent(current + nb);
- setRate(getCurrent() / getTotal());
- }
-
- public float getRate() {
- return rate;
- }
-
- public void setRate(float rate) {
- Object oldValue = getRate();
- this.rate = rate;
- firePropertyChange(PROPERTY_RATE, oldValue, rate);
- }
-
- public String getMessage() {
- return message;
- }
-
- public void increments(String message) {
- increments(1);
- setMessage(message);
- }
-
- public void setMessage(String message) {
- Object oldValue = getMessage();
- this.message = message;
- firePropertyChange(PROPERTY_MESSAGE, oldValue, message);
- }
-
@Override
public void setSize(long size) {
setTotal((int) size);
@@ -121,6 +121,6 @@
@Override
public void setCurrent(long current) {
- setCurrent((int) current);
+ super.setCurrent((int) current);
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/RessourceClassLoader.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/RessourceClassLoader.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/RessourceClassLoader.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -28,8 +28,8 @@
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.TuttiIOUtil;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationIOUtil;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -84,7 +84,7 @@
this.directories.add(directory);
// force to create directory
- TuttiIOUtil.forceMkdir(directory, _("tutti.persistence.mkDir.error", directory));
+ ApplicationIOUtil.forceMkdir(directory, _("tutti.io.mkDir.error", directory));
}
}
loader = null;
@@ -182,7 +182,7 @@
directories.toArray(new File[directories.size()]));
loader = URLClassLoader.newInstance(urls, null);
} catch (IOException e) {
- throw new TuttiTechnicalException(_("tutti.persistence.loader.error", directories), e);
+ throw new ApplicationTechnicalException(_("tutti.persistence.loader.error", directories), e);
}
}
return loader;
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -30,7 +30,7 @@
import fr.ifremer.adagio.core.dao.technical.DatabaseSchemaUpdateException;
import fr.ifremer.adagio.core.dao.technical.VersionNotFoundException;
import fr.ifremer.adagio.core.service.technical.CacheService;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
@@ -162,12 +162,12 @@
try {
V result = call.call();
return result;
- } catch (TuttiTechnicalException e) {
+ } catch (ApplicationTechnicalException e) {
throw e;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
- throw new TuttiTechnicalException(e);
+ throw new ApplicationTechnicalException(e);
}
}
@@ -201,7 +201,7 @@
try {
databaseSchemaDao.updateSchema();
} catch (DatabaseSchemaUpdateException e) {
- throw new TuttiTechnicalException(e.getCause());
+ throw new ApplicationTechnicalException(e.getCause());
}
}
Deleted: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/SampleCategoryModelConverter.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/SampleCategoryModelConverter.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/SampleCategoryModelConverter.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,94 +0,0 @@
-package fr.ifremer.tutti.persistence.config;
-
-/*
- * #%L
- * Tutti :: Persistence
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry;
-import org.apache.commons.beanutils.ConversionException;
-import org.apache.commons.beanutils.Converter;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.List;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * To convert to a {@link SampleCategoryModel} from a string representation.
- * <p/>
- * Each entry is a couple (categoryId,label).
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
- */
-public class SampleCategoryModelConverter implements Converter {
-
- @Override
- public Object convert(Class aClass, Object value) {
- Preconditions.checkNotNull(
- value, "Can not convert a null SampleCategoryModel");
- if (isEnabled(aClass)) {
- Object result;
- if (isEnabled(value.getClass())) {
- result = value;
- return result;
- }
- if (value instanceof String) {
-
- List<SampleCategoryModelEntry> entries = Lists.newArrayList();
-
- String strValue = (String) value;
-
- if (StringUtils.isNotEmpty(strValue)) {
- String[] entryStrs = strValue.split("\\s*\\|\\s*");
-
- for (String entryStr : entryStrs) {
- String[] entryParts = entryStr.split("\\s*\\,\\s*");
- SampleCategoryModelEntry entry = new SampleCategoryModelEntry();
- entry.setCategoryId(Integer.valueOf(entryParts[0]));
- if (entryParts.length > 1) {
- entry.setLabel(entryParts[1]);
- }
- entry.setOrder(entries.size());
- entries.add(entry);
- }
- }
- result = new SampleCategoryModel(entries);
- return result;
- }
- }
- throw new ConversionException(
- _("tutti.persistence.error.no.convertor", aClass.getName(), value));
- }
-
- protected boolean isEnabled(Class<?> aClass) {
- return SampleCategoryModel.class.equals(aClass);
- }
-
- public Class<?> getType() {
- return SampleCategoryModel.class;
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfig.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfig.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfig.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,314 +0,0 @@
-package fr.ifremer.tutti.persistence.config;
-
-/*
- * #%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 com.google.common.base.Charsets;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Sets;
-import com.google.common.io.Files;
-import fr.ifremer.tutti.TuttiIOUtil;
-import fr.ifremer.tutti.TuttiTechnicalException;
-import fr.ifremer.tutti.persistence.RessourceClassLoader;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.config.ApplicationConfig;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Configuration for the persistence driver.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class TuttiPersistenceConfig {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(TuttiPersistenceConfig.class);
-
- private static TuttiPersistenceConfig instance;
-
- public static TuttiPersistenceConfig getInstance() {
- return instance;
- }
-
- public static void setInstance(TuttiPersistenceConfig instance) {
- TuttiPersistenceConfig.instance = instance;
- }
-
- protected final ApplicationConfig config;
-
- public TuttiPersistenceConfig(ApplicationConfig config) {
- this.config = config;
- }
-
- public void initConfig(RessourceClassLoader resourceLoader) {
-
- File directory = getDbDirectory();
- TuttiIOUtil.forceMkdir(directory, _("tutti.persistence.mkDir.error", directory));
- directory = getDbAttachmentDirectory();
- TuttiIOUtil.forceMkdir(directory, _("tutti.persistence.mkDir.error", directory));
- directory = getProtocolDirectory();
- TuttiIOUtil.forceMkdir(directory, _("tutti.persistence.mkDir.error", directory));
- directory = getDbBackupDirectory();
- TuttiIOUtil.forceMkdir(directory, _("tutti.persistence.mkDir.error", directory));
-
- // add a predicate to search the configuration file from his directory instead of the class-path
- resourceLoader.addSearchInDirectoriesPredicate(new Predicate<String>() {
-
- Set<String> matchingNames = Sets.newHashSet(
- getDbConfigurationPath().getName(),
- getDbEnumerationPath().getName());
-
- @Override
- public boolean apply(String input) {
- return matchingNames.contains(input);
- }
- });
-
- // get configuration file path
- File configurationPath = getDbConfigurationPath();
-
- // add his directory in path to search
- resourceLoader.addDirectory(configurationPath.getParentFile());
-
- // get enumeration file path
- File enumerationPath = getDbEnumerationPath();
-
- // add his directory in path to search
- resourceLoader.addDirectory(enumerationPath.getParentFile());
-
- // generate external configuration files if required
- generateExternalDbFiles(false);
- }
-
- public File getDbConfigurationPath() {
- return config.getOptionAsFile(TuttiPersistenceConfigOption.DB_CONFIGURATION_PATH.getKey());
- }
-
- public File getDbDirectory() {
- return config.getOptionAsFile(TuttiPersistenceConfigOption.DB_DIRECTORY.getKey());
- }
-
- public File getDbAttachmentDirectory() {
- return config.getOptionAsFile(TuttiPersistenceConfigOption.DB_ATTACHMENT_DIRECTORY.getKey());
- }
-
- public File getCacheDirectory() {
- return config.getOptionAsFile(TuttiPersistenceConfigOption.DB_CACHE_DIRECTORY.getKey());
- }
-
- public File getDbBackupDirectory() {
- return config.getOptionAsFile(TuttiPersistenceConfigOption.DB_BACKUP_DIRECTORY.getKey());
- }
-
- public File getProtocolDirectory() {
- return config.getOptionAsFile(TuttiPersistenceConfigOption.DB_PROTOCOL_DIRECTORY.getKey());
- }
-
- public String getDbName() {
- return config.getOption(TuttiPersistenceConfigOption.DB_NAME.getKey());
- }
-
- public SampleCategoryModel getSampleCategoryModel() {
- SampleCategoryModel result = config.getOption(SampleCategoryModel.class, TuttiPersistenceConfigOption.SAMPLE_CATEGORY_MODEL.getKey());
- return result;
- }
-
- public void setSampleCategoryModel(SampleCategoryModel model) {
- config.setOption(TuttiPersistenceConfigOption.SAMPLE_CATEGORY_MODEL.getKey(), String.valueOf(model));
- }
-
- public boolean isDbExists() {
- File f = new File(getDbDirectory(), getDbName() + ".data");
- return f.exists();
- }
-
- public File getDbEnumerationPath() {
- return config.getOptionAsFile(TuttiPersistenceConfigOption.DB_ENUMERATION_PATH.getKey());
- }
-
- public String getJdbcUrl() {
- return config.getOption(TuttiPersistenceConfigOption.JDBC_URL.getKey());
- }
-
- public Class getJdbcDriver() {
- return config.getOptionAsClass(TuttiPersistenceConfigOption.JDBC_DRIVER.getKey());
- }
-
- public String getJdbcUsername() {
- return config.getOption(TuttiPersistenceConfigOption.JDBC_USERNAME.getKey());
- }
-
- public String getJdbcPassword() {
- return config.getOption(TuttiPersistenceConfigOption.JDBC_PASSWORD.getKey());
- }
-
- public Class getHibernateDialect() {
- return config.getOptionAsClass(TuttiPersistenceConfigOption.HIBERNATE_DIALECT.getKey());
- }
-
- public boolean isHibernateShowSql() {
- boolean result = config.getOptionAsBoolean(TuttiPersistenceConfigOption.HIBERNATE_SHOW_SQL.getKey());
- return result;
- }
-
- public boolean isHibernateUseSqlComment() {
- boolean result = config.getOptionAsBoolean(TuttiPersistenceConfigOption.HIBERNATE_USE_SQL_COMMENT.getKey());
- return result;
- }
-
- public boolean isHibernateFormatSql() {
- boolean result = config.getOptionAsBoolean(TuttiPersistenceConfigOption.HIBERNATE_FORMAT_SQL.getKey());
- return result;
- }
-
- public ApplicationConfig getConfig() {
- return config;
- }
-
- public void generateExternalDbFiles(boolean force) {
-
- try {
- // always generate db configuration file
- // see http://forge.codelutin.com/issues/2352
- generateDbConfiguration(true);
-
- } catch (IOException e) {
- throw new TuttiTechnicalException(_("tutti.persistence.config.generateFile.error"));
- }
-
- try {
-
- generateDbEnumerationConfiguration(force);
- } catch (IOException e) {
- throw new TuttiTechnicalException(_("tutti.persistence.config.generateEnumFile.error"));
- }
- }
-
- protected void generateDbConfiguration(boolean force) throws IOException {
-
- File destination = getDbConfigurationPath();
-
- if (force || !destination.exists()) {
-
- // load db configuration template (tutti-db.properties)
-
- if (log.isInfoEnabled()) {
- log.info("Generate " + destination + " from classpath.");
- }
- Properties result = new Properties();
- InputStream in = getClass().getResourceAsStream("/tutti-db-conf.properties");
- try {
- result.load(in);
- in.close();
- } finally {
- IOUtils.closeQuietly(in);
- }
-
- // replace some values from ApplicationConfig
-
- result.put("dataSource.jdbc.driver", getJdbcDriver().getName());
- result.put("dataSource.jdbc.username", getJdbcUsername());
- result.put("dataSource.jdbc.password", getJdbcPassword());
- result.put("dataSource.jdbc.url", getJdbcUrl());
- result.put("hibernate.dialect", getHibernateDialect().getName());
- result.put("hibernate.show_sql", isHibernateShowSql() + "");
- result.put("hibernate.format_sql", isHibernateFormatSql() + "");
- result.put("hibernate.use_sql_comments", isHibernateUseSqlComment() + "");
- result.put("ehcache.disk.store.dir", getCacheDirectory().getAbsolutePath());
-
- // write result file at destination
-
- BufferedWriter writer = Files.newWriter(destination, Charsets.UTF_8);
- try {
- result.store(writer, "Generated by " + getClass().getName());
- writer.close();
- } finally {
- IOUtils.closeQuietly(writer);
- }
- }
- }
-
- protected void generateDbEnumerationConfiguration(boolean force) throws IOException {
-
- File destination = getDbEnumerationPath();
-
- if (force || !destination.exists()) {
-
- // load enumeration mapping from classpath (enumerations.properties)
-
- if (log.isInfoEnabled()) {
- log.info("Generate " + destination + " from classpath.");
- }
-
- Properties result = new Properties();
- InputStream in = getClass().getResourceAsStream("/tutti-db-enumerations.properties");
- try {
- result.load(in);
- in.close();
- } finally {
- IOUtils.closeQuietly(in);
- }
-
- // replace some values from ApplicationConfig
-
-
- // write result file at destination
-
- BufferedWriter writer =
- Files.newWriter(destination, Charsets.UTF_8);
- try {
- result.store(writer, "Generated by " + getClass().getName());
- writer.close();
- } finally {
- IOUtils.closeQuietly(writer);
- }
- }
- }
-
- public Properties getDbEnumerations() throws IOException {
- Properties result = new Properties();
- BufferedReader in = Files.newReader(getDbEnumerationPath(), Charsets.UTF_8);
- try {
- result.load(in);
- in.close();
- } finally {
- IOUtils.closeQuietly(in);
- }
- return result;
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigOption.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigOption.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigOption.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,236 +0,0 @@
-package fr.ifremer.tutti.persistence.config;
-
-/*
- * #%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.data.SampleCategoryModel;
-import org.hibernate.dialect.HSQLDialect;
-import org.hsqldb.jdbcDriver;
-import org.nuiton.config.ConfigOptionDef;
-
-import java.io.File;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * Persistence configuration options.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public enum TuttiPersistenceConfigOption implements ConfigOptionDef {
-
- DB_DIRECTORY(
- "tutti.persistence.db.directory",
- n_("tutti.config.option.persistence.db.directory.description"),
- "${tutti.data.directory}/db",
- File.class),
-
- DB_ATTACHMENT_DIRECTORY(
- "tutti.persistence.db.attachment.directory",
- n_("tutti.config.option.persistence.db.attachment.directory.description"),
- "${tutti.data.directory}/meas_files",
- File.class),
-
- DB_CACHE_DIRECTORY(
- "tutti.persistence.db.cache.directory",
- n_("tutti.config.option.persistence.db.cache.directory.description"),
- "${tutti.data.directory}/dbcache",
- File.class),
-
- DB_PROTOCOL_DIRECTORY(
- "tutti.persistence.db.protocol.directory",
- n_("tutti.config.option.persistence.db.protocol.directory.description"),
- "${tutti.data.directory}/protocol",
- File.class),
-
- DB_BACKUP_DIRECTORY(
- "tutti.persistence.db.backup.directory",
- n_("tutti.config.option.persistence.db.backup.directory.description"),
- "${tutti.data.directory}/dbbackup",
- File.class, false, false),
-
- DB_CONFIGURATION_PATH(
- "tutti.persistence.db.configurationPath",
- n_("tutti.config.option.persistence.db.configurationPath.description"),
- "${tutti.data.directory}/dbconf/conf.properties",
- File.class),
-
- DB_ENUMERATION_PATH(
- "tutti.persistence.db.enumerationPath",
- n_("tutti.config.option.persistence.db.enumerationPath.description"),
- "${tutti.data.directory}/dbconf/enumerations-v3.properties",
- File.class),
-
- DB_NAME(
- "tutti.persistence.db.name",
- n_("tutti.config.option.persistence.db.name.description"),
- "allegro",
- String.class),
-
- JDBC_USERNAME(
- "tutti.persistence.jdbc.username",
- n_("tutti.config.option.persistence.jdbc.username.description"),
- "sa",
- String.class),
- JDBC_PASSWORD(
- "tutti.persistence.jdbc.password",
- n_("tutti.config.option.persistence.jdbc.password.description"),
- "",
- String.class),
- JDBC_URL(
- "tutti.persistence.jdbc.url",
- n_("tutti.config.option.persistence.jdbc.url.description"),
- "jdbc:hsqldb:file:${tutti.persistence.db.directory}/${tutti.persistence.db.name}",
- String.class),
- JDBC_DRIVER(
- "tutti.persistence.jdbc.driver",
- n_("tutti.config.option.persistence.jdbc.driver.description"),
- jdbcDriver.class.getName(),
- Class.class),
- HIBERNATE_DIALECT(
- "tutti.persistence.hibernate.dialect",
- n_("tutti.config.option.persistence.hibernate.dialect.description"),
- HSQLDialect.class.getName(),
- Class.class),
- HIBERNATE_SHOW_SQL(
- "tutti.persistence.hibernate.showSql",
- n_("tutti.config.option.persistence.hibernate.showSql.description"),
- Boolean.FALSE.toString(),
- boolean.class,
- false,
- false),
- HIBERNATE_USE_SQL_COMMENT(
- "tutti.persistence.hibernate.useSqlComment",
- n_("tutti.config.option.persistence.hibernate.useSqlComment.description"),
- Boolean.FALSE.toString(),
- boolean.class,
- false,
- false),
- HIBERNATE_FORMAT_SQL(
- "tutti.persistence.hibernate.formatSql",
- n_("tutti.config.option.persistence.hibernate.formatSql.description"),
- Boolean.FALSE.toString(),
- boolean.class,
- false,
- false),
-
- SAMPLE_CATEGORY_MODEL(
- "tutti.persistence.SampleCategoryModel",
- n_("tutti.config.option.persistence.SampleCategoryModel.description"),
- "1428,V/HV|198,Class Tri.|196,Sexe|174,Maturité|1430,Age",
- SampleCategoryModel.class,
- false,
- false
- );
-
- /** Configuration key. */
- private final String key;
-
- /** I18n key of option description */
- private final String description;
-
- /** Type of option */
- private final Class<?> type;
-
- /** Default value of option. */
- private String defaultValue;
-
- /** Flag to not keep option value on disk */
- private boolean isTransient;
-
- /** Flag to not allow option value modification */
- private boolean isFinal;
-
- TuttiPersistenceConfigOption(String key,
- String description,
- String defaultValue,
- Class<?> type) {
- this.key = key;
- this.description = description;
- this.defaultValue = defaultValue;
- this.type = type;
- this.isTransient = true;
- this.isFinal = true;
- }
-
- TuttiPersistenceConfigOption(String key,
- String description,
- String defaultValue,
- Class<?> type,
- boolean isTransient,
- boolean isFinal) {
- this.key = key;
- this.description = description;
- this.defaultValue = defaultValue;
- this.type = type;
- this.isTransient = isTransient;
- this.isFinal = isFinal;
- }
-
- @Override
- public String getKey() {
- return key;
- }
-
- @Override
- public Class<?> getType() {
- return type;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public String getDefaultValue() {
- return defaultValue;
- }
-
- @Override
- public boolean isTransient() {
- return isTransient;
- }
-
- @Override
- public boolean isFinal() {
- return isFinal;
- }
-
- @Override
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- @Override
- public void setTransient(boolean newValue) {
- // not used
- }
-
- @Override
- public void setFinal(boolean newValue) {
- // not used
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigProvider.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigProvider.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigProvider.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,62 +0,0 @@
-package fr.ifremer.tutti.persistence.config;
-
-/*
- * #%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 org.nuiton.config.ApplicationConfigProvider;
-import org.nuiton.config.ConfigActionDef;
-import org.nuiton.config.ConfigOptionDef;
-
-import java.util.Locale;
-
-import static org.nuiton.i18n.I18n.l_;
-
-/**
- * Persistence config provider (for site generation).
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class TuttiPersistenceConfigProvider implements ApplicationConfigProvider {
-
- @Override
- public String getName() {
- return "tutti-persistence";
- }
-
- @Override
- public String getDescription(Locale locale) {
- return l_(locale, "tutti.config.persistence");
- }
-
- @Override
- public ConfigOptionDef[] getOptions() {
- return TuttiPersistenceConfigOption.values();
- }
-
- @Override
- public ConfigActionDef[] getActions() {
- return new ConfigActionDef[0];
- }
-}
Copied: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SampleCategoryModelConverter.java (from rev 1377, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/config/SampleCategoryModelConverter.java)
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SampleCategoryModelConverter.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SampleCategoryModelConverter.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -0,0 +1,94 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
+import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry;
+import org.apache.commons.beanutils.ConversionException;
+import org.apache.commons.beanutils.Converter;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To convert to a {@link SampleCategoryModel} from a string representation.
+ * <p/>
+ * Each entry is a couple (categoryId,label).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.4
+ */
+public class SampleCategoryModelConverter implements Converter {
+
+ @Override
+ public Object convert(Class aClass, Object value) {
+ Preconditions.checkNotNull(
+ value, "Can not convert a null SampleCategoryModel");
+ if (isEnabled(aClass)) {
+ Object result;
+ if (isEnabled(value.getClass())) {
+ result = value;
+ return result;
+ }
+ if (value instanceof String) {
+
+ List<SampleCategoryModelEntry> entries = Lists.newArrayList();
+
+ String strValue = (String) value;
+
+ if (StringUtils.isNotEmpty(strValue)) {
+ String[] entryStrs = strValue.split("\\s*\\|\\s*");
+
+ for (String entryStr : entryStrs) {
+ String[] entryParts = entryStr.split("\\s*\\,\\s*");
+ SampleCategoryModelEntry entry = new SampleCategoryModelEntry();
+ entry.setCategoryId(Integer.valueOf(entryParts[0]));
+ if (entryParts.length > 1) {
+ entry.setLabel(entryParts[1]);
+ }
+ entry.setOrder(entries.size());
+ entries.add(entry);
+ }
+ }
+ result = new SampleCategoryModel(entries);
+ return result;
+ }
+ }
+ throw new ConversionException(
+ _("tutti.persistence.error.no.convertor", aClass.getName(), value));
+ }
+
+ protected boolean isEnabled(Class<?> aClass) {
+ return SampleCategoryModel.class.equals(aClass);
+ }
+
+ public Class<?> getType() {
+ return SampleCategoryModel.class;
+ }
+}
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocols.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocols.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocols.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -31,7 +31,7 @@
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.TuttiPersistence;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.persistence.entities.protocol.v1.SpeciesProtocol1;
@@ -80,7 +80,7 @@
writer.close();
fileWriter.close();
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.persistence.protocol.fromFile.error", id, file), e);//"Could not transform protocol " + to file
+ throw new ApplicationTechnicalException(_("tutti.persistence.protocol.fromFile.error", id, file), e);//"Could not transform protocol " + to file
} finally {
IOUtils.closeQuietly(fileWriter);
}
@@ -146,7 +146,7 @@
fileReader.close();
return result;
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.persistence.protocol.fromFile.error", file), e);
+ throw new ApplicationTechnicalException(_("tutti.persistence.protocol.fromFile.error", file), e);
} finally {
IOUtils.closeQuietly(fileReader);
}
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,8 +25,8 @@
*/
import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.TuttiPersistenceServiceImplementor;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Query;
@@ -34,7 +34,6 @@
import org.hibernate.classic.Session;
import org.hibernate.type.Type;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.dao.DataIntegrityViolationException;
import java.io.Serializable;
import java.sql.Timestamp;
@@ -57,8 +56,6 @@
private static final Log log =
LogFactory.getLog(AbstractPersistenceService.class);
- private boolean debug = false;
-
/**
* Session factory.
*
@@ -70,17 +67,17 @@
@Autowired
protected TuttiEnumerationFile enumeration;
- protected TuttiPersistenceConfig config;
+ protected TuttiConfiguration config;
@Override
public void init() {
if (config == null) {
- config = TuttiPersistenceConfig.getInstance();
+ config = TuttiConfiguration.getInstance();
Preconditions.checkNotNull(
config, "No config found in " +
- TuttiPersistenceConfig.class.getName());
+ TuttiConfiguration.class.getName());
}
}
@@ -89,7 +86,7 @@
// do nohting by default
}
- public void setConfig(TuttiPersistenceConfig config) {
+ public void setConfig(TuttiConfiguration config) {
this.config = config;
}
@@ -170,12 +167,13 @@
// TODO BLA : ajouter une annotation qui rejoue une méthode
// avec debug=true. puis repasse à faux,
// lorsqu'une erreur
- if (debug) {
- T load = (T) getCurrentSession().get(clazz, id);
- if (load == null) {
- throw new DataIntegrityViolationException("Unable to load entity " + clazz.getName() + " with id=" + id + " : not found in database.");
- }
- }
+// boolean debug = false;
+// if (debug) {
+// T load = (T) getCurrentSession().get(clazz, id);
+// if (load == null) {
+// throw new DataIntegrityViolationException("Unable to load entity " + clazz.getName() + " with id=" + id + " : not found in database.");
+// }
+// }
T load = (T) getCurrentSession().load(clazz, id);
return load;
}
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -30,7 +30,7 @@
import fr.ifremer.adagio.core.dao.data.measure.file.MeasurementFileDao;
import fr.ifremer.adagio.core.dao.referential.ObjectTypeImpl;
import fr.ifremer.adagio.core.dao.referential.QualityFlagImpl;
-import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.shared.application.ApplicationIOUtil;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.Attachments;
@@ -166,7 +166,7 @@
measurementFile.getObjectType().getCode(),
measurementFile.getObjectId(),
measurementFile.getId(),
- TuttiIOUtil.getExtension(file.getName()));
+ ApplicationIOUtil.getExtension(file.getName()));
// store the path
attachment.setPath(filePath);
@@ -183,7 +183,7 @@
// copy file to disk local storage
File targetFile = getFile(attachment);
- TuttiIOUtil.copyFile(
+ ApplicationIOUtil.copyFile(
file, targetFile,
_("tutti.persistence.attachment.copyFile.error", file, targetFile));
@@ -286,7 +286,7 @@
measurementFileDao.remove(target.getIdAsInt());
File file = getFile(target);
- TuttiIOUtil.deleteFile(file, _("tutti.persistence.attachment.deleteFile.error", file));
+ ApplicationIOUtil.deleteFile(file, _("tutti.persistence.attachment.deleteFile.error", file));
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -58,7 +58,7 @@
import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValueDao;
import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValueImpl;
import fr.ifremer.adagio.core.dao.technical.synchronization.SynchronizationStatus;
-import fr.ifremer.tutti.TuttiBusinessException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
import fr.ifremer.tutti.persistence.dao.GearPhysicalFeaturesDaoTutti;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
@@ -690,7 +690,7 @@
boolean gearRemoved = isOperationUseGears(target.getId(), gears);
if (gearRemoved) {
- throw new TuttiBusinessException(_("tutti.persistence.cruise.gearUsedInOperations.error"));
+ throw new ApplicationBusinessException(_("tutti.persistence.cruise.gearUsedInOperations.error"));
}
for (GearPhysicalFeatures guf : notChangedGearPhysicalFeatures) {
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,7 +25,7 @@
*/
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.shared.application.ApplicationIOUtil;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocols;
@@ -178,7 +178,7 @@
File file = getProtocolFile(protocolId);
if (file.exists()) {
- TuttiIOUtil.deleteFile(
+ ApplicationIOUtil.deleteFile(
file,
_("tutti.persistence.protocol.delete.error", protocolId, file));
}
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/synchro/TuttiDatabaseMetadata.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/synchro/TuttiDatabaseMetadata.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/synchro/TuttiDatabaseMetadata.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,7 +27,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import org.hibernate.HibernateException;
import org.hibernate.dialect.Dialect;
import org.hibernate.mapping.Table;
@@ -64,7 +64,7 @@
this.delegate = new DatabaseMetadata(connection, dialect, true);
this.meta = connection.getMetaData();
} catch (SQLException e) {
- throw new TuttiTechnicalException(_("tutti.persistence.dbMetadata.instanciation.error", connection), e);
+ throw new ApplicationTechnicalException(_("tutti.persistence.dbMetadata.instanciation.error", connection), e);
}
tables = Maps.newTreeMap();
}
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/synchro/TuttiTableMetadata.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/synchro/TuttiTableMetadata.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/synchro/TuttiTableMetadata.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -28,7 +28,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import org.hibernate.mapping.ForeignKey;
import org.hibernate.tool.hbm2ddl.ColumnMetadata;
@@ -127,7 +127,7 @@
this.existingPrimaryKeysQuery = String.format(QUERY_SELECT_PRIMARY_KEYS, Joiner.on(',').join(pkNames), getName());
this.countQuery = String.format(QUERY_SELECT_COUNT, getName());
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.persistence.tableMetadata.instanciation.error", this), e);
+ throw new ApplicationTechnicalException(_("tutti.persistence.tableMetadata.instanciation.error", this), e);
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/test/DatabaseResource.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/test/DatabaseResource.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/test/DatabaseResource.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -30,10 +30,10 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.io.Files;
+import fr.ifremer.tutti.TuttiConfiguration;
+import fr.ifremer.tutti.TuttiConfigurationOption;
import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfigOption;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
import org.apache.commons.io.FileUtils;
@@ -82,7 +82,7 @@
private File resourceDirectory;
- private TuttiPersistenceConfig config;
+ private TuttiConfiguration config;
private DatabaseFixtures fixtures;
@@ -140,7 +140,7 @@
this.writeDb = writeDb;
}
- public TuttiPersistenceConfig getConfig() {
+ public TuttiConfiguration getConfig() {
return config;
}
@@ -159,6 +159,7 @@
public void updateSchema(TuttiPersistence persistenceService) {
}
+
@Override
public Statement apply(final Statement base, final Description description) {
@@ -181,7 +182,7 @@
File resourceDirectory) {
applicationConfig.loadDefaultOptions(
- TuttiPersistenceConfigOption.values());
+ TuttiConfigurationOption.values());
applicationConfig.setDefaultOption(
"tutti.data.directory",
new File(resourceDirectory, "data").getAbsolutePath());
@@ -257,7 +258,7 @@
applicationConfig.parse();
- config = new TuttiPersistenceConfig(applicationConfig);
+ config = new TuttiConfiguration(applicationConfig);
File db;
@@ -314,8 +315,6 @@
config.initConfig(loader);
- TuttiPersistenceConfig.setInstance(config);
-
if (log.isInfoEnabled()) {
log.info("Use db: " + config.getJdbcUrl());
}
@@ -420,8 +419,6 @@
if (oldClassLoader != null) {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
-
- TuttiPersistenceConfig.setInstance(null);
}
protected void closeSpring() {
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/META-INF/services/org.apache.commons.beanutils.Converter
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/META-INF/services/org.apache.commons.beanutils.Converter 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/META-INF/services/org.apache.commons.beanutils.Converter 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1 +1 @@
-fr.ifremer.tutti.persistence.config.SampleCategoryModelConverter
\ No newline at end of file
+fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelConverter
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1 +1 @@
-fr.ifremer.tutti.persistence.config.TuttiPersistenceConfigProvider
\ No newline at end of file
+fr.ifremer.tutti.TuttiConfigurationProvider
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,3 +1,15 @@
+tutti.config=
+tutti.config.option.basedir.description=
+tutti.config.option.cruiseId.description=
+tutti.config.option.csv.separator.description=
+tutti.config.option.data.directory.description=
+tutti.config.option.export.countryId.description=
+tutti.config.option.help.directory.description=
+tutti.config.option.i18n.directory.description=
+tutti.config.option.i18n.locale.description=
+tutti.config.option.inceptionYear.description=
+tutti.config.option.launch.mode.description=
+tutti.config.option.organizationName.description=
tutti.config.option.persistence.SampleCategoryModel.description=
tutti.config.option.persistence.db.attachment.directory.description=
tutti.config.option.persistence.db.backup.directory.description=
@@ -15,7 +27,45 @@
tutti.config.option.persistence.jdbc.password.description=
tutti.config.option.persistence.jdbc.url.description=
tutti.config.option.persistence.jdbc.username.description=
+tutti.config.option.programId.description=
+tutti.config.option.protocolId.description=
+tutti.config.option.report.backup.directory.description=
+tutti.config.option.report.directory.description=
+tutti.config.option.samplingCategoryOrderIds.description=
+tutti.config.option.site.url.description=
+tutti.config.option.startActionFile.description=
+tutti.config.option.tmp.directory.description=
+tutti.config.option.tremieCarousselVessel.description=
+tutti.config.option.ui.adminPassword.description=
+tutti.config.option.ui.autoPopupNumberEditor.description=
+tutti.config.option.ui.color.alternateRow.description=
+tutti.config.option.ui.color.blockingLayer.description=
+tutti.config.option.ui.color.cellWithValue.description=
+tutti.config.option.ui.color.computedWeights.description=
+tutti.config.option.ui.color.rowInvalid.description=
+tutti.config.option.ui.color.rowReadOnly.description=
+tutti.config.option.ui.color.rowToConfirm.description=
+tutti.config.option.ui.color.selectedRow.description=
+tutti.config.option.ui.config.file.description=
+tutti.config.option.ui.coordinateEditorType.description=
+tutti.config.option.ui.dateFormat.description=
+tutti.config.option.ui.individualObservationRowsToCreate.description=
+tutti.config.option.ui.shortcut.closePopup.description=
+tutti.config.option.ui.showNumberEditorButton.description=
+tutti.config.option.update.application.url.description=
+tutti.config.option.update.data.url.description=
+tutti.config.option.version.description=
+tutti.config.option.weight.unit.accidentalCatch.description=
+tutti.config.option.weight.unit.benthos.description=
+tutti.config.option.weight.unit.individualObservation.description=
+tutti.config.option.weight.unit.marineLitter.description=
+tutti.config.option.weight.unit.species.description=
+tutti.config.option.weights.rate.difference.totalAndSorted.description=
+tutti.config.parse.error=
tutti.config.persistence=
+tutti.config.save.error=
+tutti.io.deleteTempDirectory.error=
+tutti.io.mkDir.error=
tutti.persistence.attachment.copyFile.error=
tutti.persistence.attachment.deleteFile.error=
tutti.persistence.batch.validation.bad.sample.categories=
@@ -46,7 +96,6 @@
tutti.persistence.error.no.convertor=
tutti.persistence.error.protocol.categories.not.compatible=
tutti.persistence.loader.error=
-tutti.persistence.mkDir.error=
tutti.persistence.protocol.delete.error=
tutti.persistence.protocol.fromFile.error=
tutti.persistence.synchronizeReferential.prepare.step1=
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,12 +1,153 @@
+BOUUH=
+application.error.ui.business.error=Erreur
+application.error.ui.business.warning=Avertissement
+application.error.ui.other.error=Erreur
+observe.common.quadrant1=(1) NE
+observe.common.quadrant2=(2) SE
+observe.common.quadrant3=(3) SW
+observe.common.quadrant4=(4) NW
+swing.error.cannot.mail=Erreur lors de l'ouverture du client mail
+swing.error.cannot.open.file=Aucun programme n'est défini pour ouvrir ce type de fichier. Enregistrez le fichier et ouvrez le en dehors de l'application
+swing.error.cannot.open.link=Impossible d'ouvrir le fichier %s
+swing.error.desktop.browse.not.supported=Le navigateur n'a pas pu être ouvert. Vérifiez que vous avez défini un navigateur par défaut dans votre système
+swing.error.desktop.mail.not.supported=Le client mail n'a pas pu être ouvert. Vérifiez que vous avez défini un client mail par défaut dans votre système
+swing.error.desktop.not.supported=Votre système ne permet pas d'ouvrir des liens ou fichiers en dehors de l'application
+tutti.about.bottomText=Copyright %s - %s - version %s
+tutti.about.message=<h3>Tutti</h3><p><strong>Outil de saisie de données d'opérations et de captures au cours des campagnes halieutiques.</strong></p><br/><p>Ce logiciel permettra la saisie en mer des données d'opération de pêche (positions, environnement, engin, etc) et des captures associées (composition de la capture en espèces scientifiques avec poids, nombres, tailles etc) pour l'ensemble des campagnes halieutiques réalisées par l'Ifremer.</p><p>Ce projet a été initiée en 2012 par l'<a href\="http\://www.ifremer.fr">Ifremer</a> et réalisé par la société <a href\="http\://codelutin.com">Codelutin</a>.</p><hr/><br/><p>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.forge.codelutin.com/tutti">site du projet</a>.</p><p>Projet hébergé sur la forge <a href\="http\://forge.codelutin.com/projects/tutti">Forge.codelutin.com</a>.</p>
+tutti.about.title=À propos de Tutti
+tutti.about.translate.content=<h2>Comment traduire Tutti</h2>Vous pouvez nous aider à traduire Tutti.<hr/><br/><ul><li>Récupérer le fichier <a href\="%s">tutti-i18n.csv</a> dans le répertoire <strong>i18n</strong></li><li>ouvrez le avec un tableur (le caractère séprateur est une Tabultation)</li><li>Traduisez, Améliorer, ...</li><li>Enfin renvoyez-le nous</li></ul><br/>Nous intégrerons vos modifications avant la prochaine version.
+tutti.about.translate.title=Traduire Tutti
+tutti.about.update.app.noup.detail=<tr><td>%1$s</td><td>%2$s</td><td>%2$s<td><td></td></tr>
+tutti.about.update.app.up.detail=<tr><td>%1$s</td><td>%2$s</td><td><strong>%3$s</strong></td><td><a href\="%4$s">Mettre à jour</a><td></tr>
+tutti.about.update.content=<h2>Mise à jour de Tutti</h2><p>Fichier des mises à jour \: <ul><li>Applicatif \: <a href\="%1$s">%1$s</a></li><li>Données \: <a href\="%2$s">%2$s</a></li></ul></p><br/><hr/><br/><table><CAPTION><EM>Mises à jour des modules</EM></CAPTION><tr><th>Module</th><th>Version installée</th><th>Dernière version</th><th></th></tr>%3$s</table>
+tutti.about.update.title=Mise à jour Tutti
+tutti.action.create.error=Erreur à l'instanciation de l'action %s
+tutti.addSampleCategoryBenthosBatch.title=Catégorisation du lot (ajout)
+tutti.addSampleCategorySpeciesBatch.title=Catégorisation du lot (ajout)
+tutti.applicationUpdater.prepareFirstDB.copyDirectory.error=Erreur lors de la copie du contenu du dossier %1s vers %2s
+tutti.applicationUpdater.prepareFirstDB.deleteDirectory.error=Erreur lors de la suppression du dossier %s
+tutti.applicationUpdater.startUpdate.db.installation=Téléchargement et installation de la base (version %s)
+tutti.applicationUpdater.startUpdate.db.update=Téléchargement et mise à jour de la base (version %s)
+tutti.applicationUpdater.startUpdate.help=Téléchargement et installation d'une nouvelle version de l'aide (version %s)
+tutti.applicationUpdater.startUpdate.i18n=Téléchargement et installation d'une nouvelle version des traductions (version %s)
+tutti.applicationUpdater.startUpdate.jre=Téléchargement et installation d'une nouvelle JRE (version %s)
+tutti.applicationUpdater.startUpdate.report=Téléchargement et installation d'une nouvelle version des rapport (version %s)
+tutti.applicationUpdater.startUpdate.tutti=Téléchargement et installation d'une nouvelle version de l'application (version %s)
+tutti.applicationUpdater.synchroDB.prepare.error=Erreur lors de la préparation de la synchronisation de la base
+tutti.applicationUpdater.synchroDB.synchro.error=Erreur lors de la synchronisation de la base
+tutti.applicationUpdater.synchroDB.writeVersion.error=Erreur lors de l'écriture de la nouvelle version de la base de données dans le fichier %s
+tutti.applicationUpdater.updateDone.deleteDirectory.caches.error=Erreur lors de la suppression du dossier des caches
+tutti.applicationUpdater.updateDone.deleteDirectory.dbConf.error=Erreur lors de la suppression du dossier de configuration de base de données
+tutti.applicationUpdater.updateDone.deleteDirectory.enum.error=Erreur lors de la suppression du dossier d'énumération
+tutti.applicationUpdater.updateDone.deleteDirectory.i18n.error=Erreur lors de la suppression du dossier d'internationalisation
+tutti.attachmentEditor.action.add.mnemonic=A
+tutti.attachmentEditor.action.add.tip=Ajouter une pièce jointe
+tutti.attachmentEditor.action.closeAttachment.tip=Fermer la fenêtre des pièces-jointes
+tutti.attachmentEditor.action.open.mnemonic=O
+tutti.attachmentEditor.action.open.tip=Ouvrir la pièce jointe
+tutti.attachmentEditor.action.remove.mnemonic=u
+tutti.attachmentEditor.action.remove.tip=Supprimer la pièce jointe
+tutti.attachmentEditor.action.save.mnemonic=E
+tutti.attachmentEditor.action.save.tip=Enregistrer la pièce jointe en local
+tutti.attachmentEditor.action.tip=Pièces jointes
+tutti.attachmentEditor.deleteAttachment.message=Êtes-vous sûr de vouloir supprimer la pièce-jointe %s ?
+tutti.attachmentEditor.deleteAttachment.title=Suppression de pièce-jointe
+tutti.attachmentEditor.field.file=Fichier
+tutti.attachmentEditor.field.fileComment=Commentaire
+tutti.attachmentEditor.field.fileName=Nom
+tutti.attachmentEditor.fileNotFound=Le fichier %s de la pièce jointe n'a pas été trouvé
+tutti.attachmentEditor.none.tip=Pas de pièce-jointes
+tutti.attachmentEditor.saveAttachment.button=Enregistrer
+tutti.attachmentEditor.saveAttachment.error.message=Erreur lors de l'enregistrement de la pièce jointe %1s dans le fichier %2s
+tutti.attachmentEditor.saveAttachment.success.message=Le fichier %s a été sauvegardé sur votre machine
+tutti.attachmentEditor.saveAttachment.title=Enregistrer la pièce-jointe
+tutti.attachmentEditor.text=(%s)
+tutti.attachmentEditor.title=Pièces jointes
+tutti.caracteristicMapEditor.none.tip=Pas de caractéristiques
+tutti.caracteristicMapEditorTable.table.header.key=Caractéristique
+tutti.caracteristicMapEditorTable.table.header.value=Valeur
+tutti.commentEditor.action.close.tip=Fermer la fenêtre des commentaires
+tutti.commentEditor.action.tip=Commentaire
+tutti.commentEditor.none.tip=Pas de commentaire
+tutti.commentEditor.title=Commentaire
+tutti.common.askBeforeCloneProtocol.help=Que voulez-vous faire?<ul><li><strong>Annuler</strong> pour ne pas cloner le protocole</li><li><strong>Cloner</strong> pour cloner le protocole en conservant les catégories non connues (elle ne seront pas affichées)</li><li><strong>Nettoyer et Cloner</strong> pour supprimer les catégories non compatibles dans le protocole cloné</li></ul>
+tutti.common.askBeforeDelete.help=Que voulez-vous faire ?<ul><li><strong>Annuler</strong> pour ne pas supprimer</li><li><strong>OK</strong> pour supprimer l'objet en question</li></ul>
+tutti.common.askBeforeEditProtocol.help=Que voulez-vous faire?<ul><li><strong>Annuler</strong> pour ne pas éditer le protocole</li><li><strong>Éditer</strong> pour éditer le protocole en conservant les catégories non connues (elle ne seront pas affichées)</li><li><strong>Nettoyer et Éditer</strong> pour supprimer les catégories non compatibles et éditer le protocole</li></ul>
+tutti.common.askBeforeEditProtocol.title=Catégories non compatibles détectées dans le protocole
+tutti.common.askBeforeImportProtocol.help=Que voulez-vous faire?<ul><li><strong>Annuler</strong> pour ne pas importer le protocole</li><li><strong>Importer</strong> pour importer le protocole en conservant les catégories non connues (elle ne seront pas affichées)</li><li><strong>Nettoyer et Importer</strong> pour supprimer les catégories non compatibles dans le protocole importé</li></ul>
+tutti.common.askBeforeUpdate.help=Que voulez-vous faire ?<ul><li><strong>Annuler</strong> pour ne pas effectuer la mise à jour</li><li><strong>OK</strong> pour lancer la mise à jour</li></ul>
+tutti.common.askCancelEditBeforeLeaving.help=Que voulez-vous faire ?<ul><li><strong>Annuler</strong> pour rester sur cet écran</li><li><strong>OK</strong> pour quitter l'écran en abandonnant les modifications</li></ul>
+tutti.common.askCancelEditBeforeLeaving.title=Modifications non enregistrées mais invalides
+tutti.common.askOverwriteFile.help=Que voulez-vous faire ?<ul><li><strong>Annuler</strong> pour ne pas écraser le fichier et annuler l'opération</li><li><strong>Oui</strong> pour écraser le fichier et continuer l'opération</li></ul>
+tutti.common.askOverwriteFile.message=Le fichier %s existe déjà, confirmer pour l'écraser
+tutti.common.askOverwriteFile.title=Confirmer l'écrasement d'un fichier...
+tutti.common.askSaveBeforeLeaving.help=Que voulez-vous faire?<ul><li><strong>Annuler</strong> pour rester sur cet écran</li><li><strong>Non</strong> pour quitter l'écran en abandonnant les modifications en cours</li><li><strong>Oui</strong> pour quitter l'écran après enregistrement des modifications</li></ul>
+tutti.common.askSaveBeforeLeaving.title=Modifications non enregistrées
+tutti.common.cancel=Annuler
+tutti.common.cancel.mnemonic=A
+tutti.common.datefield.tip=Format attendu \: %s
+tutti.common.file.csv=Extension d'un fichier csv
+tutti.common.file.pdf=Extension d'un fichier pdf
+tutti.common.file.protocol=Extension d'un fichier de protocole Tutti
+tutti.common.file.tuttiAccidental=Fichier d'import/export des lots de captures accidentelles
+tutti.common.file.tuttiBenthos=Fichier d'import/export des lots de benthos
+tutti.common.file.tuttiIndividualObservation=Fichier d'import/export des lots d'observations individuelles
+tutti.common.file.tuttiMarineLitter=Fichier d'import/export des lots de déchets
+tutti.common.file.tuttiSpecies=Fichier d'import/export des lots d'espèces
+tutti.common.file.zip=Extension d'une archive zip
+tutti.common.unit=Unité
+tutti.common.unit.g=Gramme
+tutti.common.unit.kg=Kilogramme
+tutti.common.unit.short.g=g
+tutti.common.unit.short.kg=kg
+tutti.common.validate=Valider
+tutti.common.validate.mnemonic=V
+tutti.config=
+tutti.config.action.reload.actions=Recharger les actions
+tutti.config.action.reload.application=Recharger l'application
+tutti.config.action.reload.ui=Recharger l'interface graphique
+tutti.config.application=Configuration de l'application Tutti
+tutti.config.category.applications=Application
+tutti.config.category.applications.description=Application
+tutti.config.category.technical=Technique
+tutti.config.category.technical.description=Informations techniques
+tutti.config.category.ui=Interface utilisateur
+tutti.config.category.ui.description=Options de l'interface utilisateur
+tutti.config.category.weightUnit=Unité des poids
+tutti.config.category.weightUnit.description=Configurer les Unités des poids capturés selon de type de capture (espèce, benthos, ...)
+tutti.config.option.basedir.description=Répertoire principale
+tutti.config.option.basedir.shortLabel=Répertoire principale
+tutti.config.option.cruiseId.description=Identifiant de la dernière campagne utilisée
+tutti.config.option.csv.separator.description=Caractère séparateur pour les import / export de fichier au format csv.
+tutti.config.option.csv.separator.shortLabel=Caractère séparateur (csv)
+tutti.config.option.data.directory.description=Répertoire de données de l'application. Vous pouvez utiliser l'expression ${tutti.data.directory} pour le référence dans d'autres propriétés de configuration (ex\: ${tutti.data.directory}/tmp).
+tutti.config.option.data.directory.shortLabel=Répertoire de données
+tutti.config.option.export.countryId.description=L'id du pays à utiliser pour les exports (il s'agit de la valeur LOCATION.ID).
+tutti.config.option.export.countryId.shortLabel=Id du pays à utiliser (export)
+tutti.config.option.help.directory.description=Répertoire des fichiers d'aide
+tutti.config.option.help.directory.shortLabel=Répertoire des fichiers d'aide
+tutti.config.option.i18n.directory.description=Répertoire des fichiers de traductions
+tutti.config.option.i18n.directory.shortLabel=Répertoire des fichiers de traductions
+tutti.config.option.i18n.locale.description=Langue utilisée dans l'application
+tutti.config.option.inceptionYear.description=Année de démarrage du projet
+tutti.config.option.launch.mode.description=Mode de démarrage de l'application
+tutti.config.option.organizationName.description=Nom de l'organisation dans la licence
tutti.config.option.persistence.SampleCategoryModel.description=Configuration des catégories d'échantillonnage
tutti.config.option.persistence.db.attachment.directory.description=Répertoire où sont stockées les pièces-jointes
+tutti.config.option.persistence.db.attachment.directory.shortLabel=Répertoire des pieèces-jointes
tutti.config.option.persistence.db.backup.directory.description=Répertoire où sont enregistrées les sauvegardes de la base
+tutti.config.option.persistence.db.backup.directory.shortLabel=Répertoire des sauvegardes de base
tutti.config.option.persistence.db.cache.directory.description=Répertoire où sont stockées les caches de persistance
+tutti.config.option.persistence.db.cache.directory.shortLabel=Répertoire du cache de base
tutti.config.option.persistence.db.configurationPath.description=Chemin du fichier de configuration d'Adagio
+tutti.config.option.persistence.db.configurationPath.shortLabel=Chemin vers la configuration adagio
tutti.config.option.persistence.db.directory.description=Répertoire où est la base de données
+tutti.config.option.persistence.db.directory.shortLabel=Répertoire de la base de données
tutti.config.option.persistence.db.enumerationPath.description=Chemin du fichier de correspondance des constantes
+tutti.config.option.persistence.db.enumerationPath.shortLabel=Chemin vers le fichier constantes adagio
tutti.config.option.persistence.db.name.description=Nom du fichier de la base de données
tutti.config.option.persistence.db.protocol.directory.description=Répertoire où sont conservés les protocoles
+tutti.config.option.persistence.db.protocol.directory.shortLabel=Répertoire des protocoles
tutti.config.option.persistence.hibernate.dialect.description=Le dialecte hibernate utilisée pour communiquer avec la base de données
tutti.config.option.persistence.hibernate.formatSql.description=Option pour ajouter les commentaires dans les requêtes sql générées
tutti.config.option.persistence.hibernate.showSql.description=Option pour afficher ou non les requête sql dans les logs
@@ -14,8 +155,1287 @@
tutti.config.option.persistence.jdbc.driver.description=Le pilote JDBC utilisé pour communiquer avec la base de données
tutti.config.option.persistence.jdbc.password.description=Mot de passe de l'utilisateur pour se connecter à la base de données
tutti.config.option.persistence.jdbc.url.description=URL de connexion à la base de données
+tutti.config.option.persistence.jdbc.url.shortLabel=Url jdbc de connexion
tutti.config.option.persistence.jdbc.username.description=Login de l'utilisateur pour se connecter à la base de données
+tutti.config.option.programId.description=Identifiant de la dernière série de campagne utilisée
+tutti.config.option.protocolId.description=Identifiant du dernier protocole utilisé
+tutti.config.option.report.backup.directory.description=Répertoire contenant les rapports générés
+tutti.config.option.report.directory.description=Répertoire contenant les modèles de rapports
+tutti.config.option.samplingCategoryOrderIds.description=Ordre des catégories d'échantillonnage
+tutti.config.option.service.report.backup.directory.shortLabel=Répertoire des sauvegardes de rapport
+tutti.config.option.service.report.directory.shortLabel=Répertoire des modèles de rapport
+tutti.config.option.site.url.description=Url du site internet de l'application
+tutti.config.option.site.url.shortLabel=URL du site technique
+tutti.config.option.startActionFile.description=Fichier
+tutti.config.option.tmp.directory.description=Répertoire temporaire utilisée par l'application (est nettoyé à chaque démarrage de l'application).
+tutti.config.option.tmp.directory.shortLabel=Répertoire temporaire
+tutti.config.option.tremieCarousselVessel.description=Navire ayant un carrousel et une trémie (ex. Thalassa)
+tutti.config.option.tremieCarousselVessel.shortLabel=Navire ayant un carrousel et une trémie
+tutti.config.option.ui.adminPassword.description=MD5 du mot de passe des zones sensibles
+tutti.config.option.ui.autoPopupNumberEditor.description=Toujours afficher le pavé numérique lors de l'édition d'un nombre
+tutti.config.option.ui.color.alternateRow.description=Couleur de fond des lignes paires (non sélectionnée) dans un tableau
+tutti.config.option.ui.color.alternateRow.shortLabel=Couleur alternée
+tutti.config.option.ui.color.blockingLayer.description=Couleur utilisée pour bloquer l'interface lors d'une action longue
+tutti.config.option.ui.color.blockingLayer.shortLabel=Couleur d'attente
+tutti.config.option.ui.color.cellWithValue.description=Couleur d'une cellule avec des données
+tutti.config.option.ui.color.cellWithValue.shortLabel=Couleur cellule avec donnée
+tutti.config.option.ui.color.computedWeights.description=Couleur des données calculées
+tutti.config.option.ui.color.computedWeights.shortLabel=Couleur de valeur calculée
+tutti.config.option.ui.color.rowInvalid.description=Ligne invalide
+tutti.config.option.ui.color.rowInvalid.shortLabel=Couleur d'une ligne invalide
+tutti.config.option.ui.color.rowReadOnly.description=Cellule non éditable
+tutti.config.option.ui.color.rowReadOnly.shortLabel=Couleur d'une cellule en lecture seule
+tutti.config.option.ui.color.rowToConfirm.description=Ligne à confirmer
+tutti.config.option.ui.color.rowToConfirm.shortLabel=Couleur d'une espèce à confirmer
+tutti.config.option.ui.color.selectedRow.description=Couleur de fond d'une ligne sélectionnée dans un tableau
+tutti.config.option.ui.color.selectedRow.shortLabel=Couleur d'une ligne sélectionnée
+tutti.config.option.ui.config.file.description=Chemin du fichier de configuration des interfaces graphiques
+tutti.config.option.ui.config.file.shortLabel=Chemin du fichier de confirmation
+tutti.config.option.ui.coordinateEditorType.description=Type de l'éditeur de coordonnées
+tutti.config.option.ui.coordinateEditorType.shortLabel=Formateur de coordonnées
+tutti.config.option.ui.dateFormat.description=Format de dates
+tutti.config.option.ui.dateFormat.shortLabel=Format des dates
+tutti.config.option.ui.individualObservationRowsToCreate.description=Nombre maximum de données individuelles à créer sans demande de confirmation
+tutti.config.option.ui.individualObservationRowsToCreate.shortLabel=Nombre max de données individuelles
+tutti.config.option.ui.shortcut.closePopup.description=Fermer une popup
+tutti.config.option.ui.showNumberEditorButton.description=Afficher le pavé numérique de saisie
+tutti.config.option.update.application.url.description=URL de mise à jour des applicatifs
+tutti.config.option.update.application.url.shortLabel=URL de mise à jour des applicatifs
+tutti.config.option.update.data.url.description=URL de mise à jour des données (base + report)
+tutti.config.option.update.data.url.shortLabel=URL de mise à jour des données
+tutti.config.option.version.description=Version courante de l'application
+tutti.config.option.weight.unit.accidentalCatch.description=Unité de poids à utiliser dans la saisies des captures accidentelles
+tutti.config.option.weight.unit.accidentalCatch.shortLabel=Unité capture accidentelle
+tutti.config.option.weight.unit.benthos.description=Unité de poids à utiliser dans la saisies du benthos
+tutti.config.option.weight.unit.benthos.shortLabel=Unité Benthos
+tutti.config.option.weight.unit.individualObservation.description=Unité de poids à utiliser dans la saisies des données individuelles
+tutti.config.option.weight.unit.individualObservation.shortLabel=Unité données individuelles
+tutti.config.option.weight.unit.marineLitter.description=Unité de poids à utiliser dans la saisies des macro-déchêts
+tutti.config.option.weight.unit.marineLitter.shortLabel=Unité Macro-déchêts
+tutti.config.option.weight.unit.species.description=Unité de poids à utiliser dans la saisies des espèces
+tutti.config.option.weight.unit.species.shortLabel=Unité Espèces
+tutti.config.option.weights.rate.difference.totalAndSorted.description=Pourcentage de différence entre les Poids totaux VRAC triés et les poids totaux VRAC en dessous duquel on demande confirmation sur la saisie
+tutti.config.option.weights.rate.difference.totalAndSorted.shortLabel=Pourcentage de différence entre les Poids totaux VRAC triés et les poids totaux VRAC
+tutti.config.parse.error=Erreur de parsing du fichier de configuration
tutti.config.persistence=Configuration de la persistance de l'application
+tutti.config.save.error=Erreur lors de la sauvegarde de la configuration dans le fichier %s
+tutti.config.service=Configuration des services de l'application
+tutti.config.title=Configuration
+tutti.context.helpPage.notFound=La page d'aide %s n'a pas été trouvée
+tutti.context.service.close.error=Erreur lors de la fermeture du service %s
+tutti.coordinate.action.reset.latitude.tip=Réinitialiser la latitude
+tutti.coordinate.action.reset.longitude.tip=Réinitialiser la longitude
+tutti.createAccidentalBatch.action.cancel=Annuler
+tutti.createAccidentalBatch.action.cancel.mnemonic=A
+tutti.createAccidentalBatch.action.cancel.tip=Annuler la création de la capture accidentelle
+tutti.createAccidentalBatch.action.saveAndClose=Créer et Fermer
+tutti.createAccidentalBatch.action.saveAndClose.mnemonic=F
+tutti.createAccidentalBatch.action.saveAndClose.tip=Enregistrer la capture accidentelle et fermer
+tutti.createAccidentalBatch.action.saveAndContinue=Créer
+tutti.createAccidentalBatch.action.saveAndContinue.mnemonic=C
+tutti.createAccidentalBatch.action.saveAndContinue.tip=Enregistrer la capture accidentelle et saisir une autre capture
+tutti.createAccidentalBatch.field.accidentalDeadOrAlive=Mort ou vivant
+tutti.createAccidentalBatch.field.accidentalDeadOrAlive.tip=L'animal a-t-il été remis à l'eau mort ou vivant ?
+tutti.createAccidentalBatch.field.accidentalGender=Sexe
+tutti.createAccidentalBatch.field.accidentalGender.tip=Sexe
+tutti.createAccidentalBatch.field.accidentalLengthStepCaracteristic=Classe de taille
+tutti.createAccidentalBatch.field.accidentalLengthStepCaracteristic.tip=Classe de taille
+tutti.createAccidentalBatch.field.accidentalSize=Taille
+tutti.createAccidentalBatch.field.accidentalSize.tip=Taille
+tutti.createAccidentalBatch.field.accidentalSpecies=Espèce
+tutti.createAccidentalBatch.field.accidentalSpecies.tip=Espèce
+tutti.createAccidentalBatch.field.accidentalWeight=Poids
+tutti.createAccidentalBatch.field.accidentalWeight.tip=Poids
+tutti.createAccidentalBatch.title=Créer une capture accidentelle
+tutti.createBenthosBatch.action.addSpecies=...
+tutti.createBenthosBatch.action.addSpecies.mnemonic=.
+tutti.createBenthosBatch.action.addSpecies.tip=Sélectionner une autre espèce
+tutti.createBenthosBatch.action.cancel=Annuler
+tutti.createBenthosBatch.action.cancel.mnemonic=A
+tutti.createBenthosBatch.action.cancel.tip=Annuler la création du lot espèce
+tutti.createBenthosBatch.action.saveAndClose=Créer et Fermer
+tutti.createBenthosBatch.action.saveAndClose.mnemonic=F
+tutti.createBenthosBatch.action.saveAndClose.tip=Enregistrer la création du lot espèce et quitter l'écran
+tutti.createBenthosBatch.action.saveAndContinue=Créer
+tutti.createBenthosBatch.action.saveAndContinue.mnemonic=C
+tutti.createBenthosBatch.action.saveAndContinue.tip=Enregistrer la création du lot espèce et en saisir un autre
+tutti.createBenthosBatch.field.batchCount=Nombre
+tutti.createBenthosBatch.field.batchCount.tip=Saisir le nombre d'individus dans le lot
+tutti.createBenthosBatch.field.batchWeight=Poids du lot
+tutti.createBenthosBatch.field.batchWeight.tip=Poids du lot
+tutti.createBenthosBatch.field.category=Catégorie
+tutti.createBenthosBatch.field.category.tip=Choisir le mode de catégorisation
+tutti.createBenthosBatch.field.sampleCategory=V / HV
+tutti.createBenthosBatch.field.sampleCategory.tip=Catégorie Vrac / Hors Vrac
+tutti.createBenthosBatch.field.sampleWeight=Poids total catégorisé
+tutti.createBenthosBatch.field.sampleWeight.tip=Somme des poids saisis ci-dessous
+tutti.createBenthosBatch.field.species=Espèce du lot
+tutti.createBenthosBatch.field.species.tip=Espèce du lot
+tutti.createBenthosBatch.title=Créer un lot
+tutti.createBenthosMelag.comment.part1=Traitement issu d'un mélange composé de \:
+tutti.createBenthosMelag.comment.part2=- %s%s de %s
+tutti.createBenthosMelag.comment.part3=avec un poids d'élévation de %s%s
+tutti.createBenthosMelag.error.message=Erreur à la ligne %s \: le lot n'a pas de poids de sous échantillon ni de poids dans les mensurations
+tutti.createBenthosMelag.error.title=Erreur
+tutti.createIndividualObservationBatch.action.addSpecies=...
+tutti.createIndividualObservationBatch.action.addSpecies.mnemonic=.
+tutti.createIndividualObservationBatch.action.addSpecies.tip=Sélectionner une autre espèce
+tutti.createIndividualObservationBatch.action.cancel=Annuler
+tutti.createIndividualObservationBatch.action.cancel.mnemonic=A
+tutti.createIndividualObservationBatch.action.cancel.tip=Annuler la création de l'observation individuelle
+tutti.createIndividualObservationBatch.action.saveAndClose=Créer et Fermer
+tutti.createIndividualObservationBatch.action.saveAndClose.mnemonic=F
+tutti.createIndividualObservationBatch.action.saveAndClose.tip=Créer l'observation individuelle et fermer
+tutti.createIndividualObservationBatch.action.saveAndContinue=Créer et Continuer
+tutti.createIndividualObservationBatch.action.saveAndContinue.mnemonic=C
+tutti.createIndividualObservationBatch.action.saveAndContinue.tip=Créer et saisir une nouvelle observation indidivuelle
+tutti.createIndividualObservationBatch.confirm.alreadyUsedSpecies.help=Que voulez-vous faire?<ul><li><strong>Annuler</strong> pour annuler la création des données individuelles</li><li><strong>Ok</strong> pour confirmer la création des données individuellesd</li></ul>
+tutti.createIndividualObservationBatch.confirm.alreadyUsedSpecies.message=Il existe déjà des données individuelles pour l'espèce <strong>%s</strong><br/>Êtes-vous sûr de vouloir récupérer les données depuis l'onglet <strong>Espèces</strong>?
+tutti.createIndividualObservationBatch.confirm.alreadyUsedSpecies.title=Confirmer la création des données individuelles sur une espèce déjà utilisée
+tutti.createIndividualObservationBatch.confirm.help=Que voulez-vous faire?<ul><li><strong>Annuler</strong> pour ne pas créer les données individuelles</li><li><strong>Ok</strong> pour confirmer la création des données individuellesd</li></ul>
+tutti.createIndividualObservationBatch.confirm.message=Vous avez demandé la création des données individuelles pour l'espèce <strong>%s</strong> depuis les captures saisies.<br/><strong>%s données vont être créées</strong>.
+tutti.createIndividualObservationBatch.confirm.title=Confirmer la création des données individuelles
+tutti.createIndividualObservationBatch.field.createFromBatch=Créer les données depuis les captures
+tutti.createIndividualObservationBatch.field.createFromBatch.tip=Utiliser les données saisies dans les captures pour créer les données individuelles
+tutti.createIndividualObservationBatch.field.individualObservationLengthStepCaracteristic=Classe de taille
+tutti.createIndividualObservationBatch.field.individualObservationLengthStepCaracteristic.tip=Classe de taille
+tutti.createIndividualObservationBatch.field.individualObservationSize=Taille
+tutti.createIndividualObservationBatch.field.individualObservationSize.tip=Taille
+tutti.createIndividualObservationBatch.field.individualObservationSpecies=Espèce
+tutti.createIndividualObservationBatch.field.individualObservationSpecies.tip=Espèce
+tutti.createIndividualObservationBatch.field.individualObservationWeight=Poids
+tutti.createIndividualObservationBatch.field.individualObservationWeight.tip=Poids
+tutti.createIndividualObservationBatch.title=Créer une observation
+tutti.createIndividualObservationBatch.warn.nocount=Aucune donnée individuelle pour l'espèce <strong>%s</strong> ne sera remplie pour la raison suivante\:<br/>Aucune mensuration (ou dénombrement) renseigné pour cette espèce dans l'onglet <strong>Espèces</strong>.
+tutti.createIndividualObservationBatch.warn.nocount.title=Pas de mensuration pour l'éespèce sélectionnée
+tutti.createMarineLitterBatch.action.cancel=Annuler
+tutti.createMarineLitterBatch.action.cancel.mnemonic=A
+tutti.createMarineLitterBatch.action.cancel.tip=Annuler la création du lot macro-déchet
+tutti.createMarineLitterBatch.action.saveAndClose=Créer et Fermer
+tutti.createMarineLitterBatch.action.saveAndClose.mnemonic=F
+tutti.createMarineLitterBatch.action.saveAndClose.tip=Enregistrer la création du lot macro-déchet et fermer
+tutti.createMarineLitterBatch.action.saveAndContinue=Créer
+tutti.createMarineLitterBatch.action.saveAndContinue.mnemonic=C
+tutti.createMarineLitterBatch.action.saveAndContinue.tip=Enregistrer la création du lot macro-déchet et en saisir un autre
+tutti.createMarineLitterBatch.field.marineLitterCategory=Catégorie de déchets
+tutti.createMarineLitterBatch.field.marineLitterCategory.tip=Type de déchets observés
+tutti.createMarineLitterBatch.field.marineLitterSizeCategory=Catégorie de taille
+tutti.createMarineLitterBatch.field.marineLitterSizeCategory.tip=Classe de taille des déchets observés
+tutti.createMarineLitterBatch.field.number=Nombre
+tutti.createMarineLitterBatch.field.number.tip=Nombre d'objets dans la catégorie
+tutti.createMarineLitterBatch.field.weight=Poids
+tutti.createMarineLitterBatch.field.weight.tip=Poids
+tutti.createMarineLitterBatch.title=Créer un lot
+tutti.createSpeciesBatch.action.addSpecies=...
+tutti.createSpeciesBatch.action.addSpecies.mnemonic=.
+tutti.createSpeciesBatch.action.addSpecies.tip=Sélectionner une autre espèce
+tutti.createSpeciesBatch.action.cancel=Annuler
+tutti.createSpeciesBatch.action.cancel.mnemonic=A
+tutti.createSpeciesBatch.action.cancel.tip=Annuler la création du lot espèce
+tutti.createSpeciesBatch.action.saveAndClose=Créer et Fermer
+tutti.createSpeciesBatch.action.saveAndClose.mnemonic=F
+tutti.createSpeciesBatch.action.saveAndClose.tip=Enregistrer la création du lot espèce et fermer l'écran
+tutti.createSpeciesBatch.action.saveAndContinue=Créer
+tutti.createSpeciesBatch.action.saveAndContinue.mnemonic=C
+tutti.createSpeciesBatch.action.saveAndContinue.tip=Enregistrer la création du lot espèce et en saisir un autre
+tutti.createSpeciesBatch.field.batchCount=Nombre
+tutti.createSpeciesBatch.field.batchCount.tip=Saisir le nombre d'individus dans le lot
+tutti.createSpeciesBatch.field.batchWeight=Poids du lot
+tutti.createSpeciesBatch.field.batchWeight.tip=Poids du lot (non obligatoire à ce stade)
+tutti.createSpeciesBatch.field.category=Catégorie
+tutti.createSpeciesBatch.field.category.tip=Choisir le mode de catégorisation
+tutti.createSpeciesBatch.field.sampleCategory=V / HV
+tutti.createSpeciesBatch.field.sampleCategory.tip=Catégorie Vrac / Hors Vrac
+tutti.createSpeciesBatch.field.sampleWeight=Poids total catégorisé
+tutti.createSpeciesBatch.field.sampleWeight.tip=Somme des poids saisis ci-dessous
+tutti.createSpeciesBatch.field.species=Espèce du lot
+tutti.createSpeciesBatch.field.species.tip=Code campagne ou Code Rubin – Nom scientifique du lot à créer
+tutti.createSpeciesBatch.title=Créer un lot
+tutti.createSpeciesMelag.action.cancel=Annuler
+tutti.createSpeciesMelag.action.cancel.mnemonic=A
+tutti.createSpeciesMelag.action.cancel.tip=Annuler la création du MELAG (mélange)
+tutti.createSpeciesMelag.action.validate=Valider
+tutti.createSpeciesMelag.action.validate.mnemonic=V
+tutti.createSpeciesMelag.action.validate.tip=Valider la création du MELAG (mélange)
+tutti.createSpeciesMelag.comment.part1=Traitement issu d'un mélange composé de \:
+tutti.createSpeciesMelag.comment.part2=- %s%s de %s
+tutti.createSpeciesMelag.comment.part3=avec un poids d'élévation de %s%s
+tutti.createSpeciesMelag.error.message=Erreur à la ligne %s \: le lot n'a pas de poids de sous échantillon ni de poids dans les mensurations
+tutti.createSpeciesMelag.error.title=Erreur
+tutti.createSpeciesMelag.message=Combien pesait le MELAG (mélange) (%s) ?
+tutti.createSpeciesMelag.title=Poids du MELAG (mélange) (%s)
+tutti.db.deleteCache.error=Erreur à la suppression du cache de base
+tutti.dbMabager.title=Gérer les bases de données
+tutti.dbManager.action.chooseDbBackupFile=Sauvegarder la base de données
+tutti.dbManager.action.chooseDbExportFile=Exporter la base de données
+tutti.dbManager.action.chooseDbFile=Choisir la base à importer
+tutti.dbManager.action.exportDb=Exporter
+tutti.dbManager.action.exportDb.mnemonic=x
+tutti.dbManager.action.exportDb.tip=Exporter la base de données au format zip
+tutti.dbManager.action.importDb=Importer une base
+tutti.dbManager.action.importDb.backup.db=Avant de pouvoir importer une nouvelle base, vous devez sauvegarder la base courante.
+tutti.dbManager.action.importDb.mnemonic=i
+tutti.dbManager.action.importDb.tip=Importer la base de données au format zip
+tutti.dbManager.action.importdb.couldNotOpen=Impossible d'ouvrir la base importée
+tutti.dbManager.action.importdb.no.backup.db.choosen=Import annulé (vous n'avez pas choisi de fichier de sauvegarde).
+tutti.dbManager.action.importdb.no.import.file.choosen=Import annulé (vous n'avez pas choisi de fichier d'import).
+tutti.dbManager.action.installDb=Installer
+tutti.dbManager.action.installDb.backup.db=Avant de pouvoir réinstaller une nouvelle base, vous devez sauvegarder la base courante.
+tutti.dbManager.action.installDb.mnemonic=n
+tutti.dbManager.action.installDb.no.backup.db.choosen=Réinstallation annulée (vous n'avez pas choisi de fichier de sauvegarde).
+tutti.dbManager.action.installDb.tip=Télécharger puis installer la base de données
+tutti.dbManager.action.openDb=Ouvrir la base
+tutti.dbManager.action.openDb.couldNotOpen=Impossible d'ouvrir la base, elle est peut-être déjà utilisée par une autre application (ou une autre instance de l'application)
+tutti.dbManager.action.openDb.mnemonic=O
+tutti.dbManager.action.openDb.tip=Ouvrir la base de données
+tutti.dbManager.action.reinstallDb=Réinstaller
+tutti.dbManager.action.reinstallDb.mnemonic=n
+tutti.dbManager.action.reinstallDb.tip=Télécharger puis ré-installer la base de données
+tutti.dbManager.action.upgradeDb=Mettre à jour les référentiels
+tutti.dbManager.action.upgradeDb.check=Recherche des mises à jour de la base
+tutti.dbManager.action.upgradeDb.done=La mise à jour des référentiel en version <strong>%s</strong> est terminée.
+tutti.dbManager.action.upgradeDb.mnemonic=V
+tutti.dbManager.action.upgradeDb.no.backup.db.choosen=La base ne sera pas migrée (vous avez annulé la sauvegarde avant migration).
+tutti.dbManager.action.upgradeDb.opening=Ouverture de la base de données
+tutti.dbManager.action.upgradeDb.reloading=Rechargement de la base de données
+tutti.dbManager.action.upgradeDb.schema.not.update.message=<html><body>Votre base de données est en version %s et le bon fonctionnement de l'application est garanti sur une version plus ancienne (%s).<br/>Il se peut que l'application ne fonctionne pas correctement avec cette version de la base.<hr/>Nous vous recommandons \:<ul><li>De vérifier si une nouvelle version de l'application n'est pas disponible</li><li>De vous renseigner auprès des administrateurs de l'application</li></ul></body></html>
+tutti.dbManager.action.upgradeDb.schema.to.update.message=Votre base de données est en version %s, et le bon fonctionnement de l'application est garanti sur une version plus récente (%s).
+tutti.dbManager.action.upgradeDb.schema.to.update.message.help=Que voulez-vous faire ?<ul><li><strong>Oui</strong> pour migrer la base</li><li><strong>Annuler</strong> pour ne pas migrer et ne pas charger la base (la base ne sera alors pas utilisable dans cette version du logiciel).</li></ul>
+tutti.dbManager.action.upgradeDb.schema.too.high=Votre base de données est en version %s et le bon fonctionnement de l'application est garanti sur une version plus ancienne (%s).<br/>Il se peut que l'application ne fonctionne pas correctement avec cette version de la base.<br/>Nous vous recommandons \:<ul><li>De vérifier si une nouvelle version de l'application n'est pas disponible</li><li>De vous renseigner auprès des administrateurs de l'application</li></ul>
+tutti.dbManager.action.upgradeDb.schema.too.high.help=Souhaitez-vous poursuivre l'import de la base de données ?<ul><li><strong>Oui</strong> pour charger la base en version plus récente</li><li><strong>Annuler</strong> pour ne pas charger la base</li></ul>
+tutti.dbManager.action.upgradeDb.schema.version.not.found=L'application n'a pas pu déterminer la version de la base de données à importer. L'import ne peut pas être réalisé, veuillez contacter les administrateurs de l'application.
+tutti.dbManager.action.upgradeDb.tip=Mettre à jour les référentiels
+tutti.dbManager.action.upgradeDb.upToDate=<strong>Aucune mise à jour de base détectée</strong>
+tutti.dbManager.caracteristic.lastReferentialVersion=Version du référentiel disponible en mis à jour
+tutti.dbManager.caracteristic.referentialVersion=Version du référentiel utilisé
+tutti.dbManager.caracteristic.schemaVersion=Version du schema
+tutti.dbManager.caracteristic.url=Url de connexion
+tutti.dbManager.info.db.loaded=Tutti est connecté à une base de données<hr/>Caractéristiques de cette base \: %s
+tutti.dbManager.info.no.db.exist=Aucune base détectée.<hr/>Vous pouvez installer la dernière disponible sur le réseau via l'action <strong>installer</strong>; ou bien en importer une via l'action <strong>importer</strong>.
+tutti.dbManager.info.no.db.loaded=Une base a été détectée.<hr/>La base n'est pas ouverte, vous pouvez l'ouvrir via l'action <strong>Ouvrir</strong>.<br/>Si l'ouverture ne fonctionne pas; veuillez bien prendre soin de quitter les applications qui pourraient utiliser cette base.<br/>Caractéristiques de cette base \: %s
+tutti.dbManager.title.backup.db=Sauvegarde de la base
+tutti.dbManager.title.choose.dbBackupFile=Sauvegarder la base de données
+tutti.dbManager.title.choose.dbExportFile=Exporter la base de données
+tutti.dbManager.title.choose.dbImportFile=Importer la base de données
+tutti.dbManager.title.confirm.updatedb=Confirmer la mise à jour des réferentiels
+tutti.dbManager.title.schema.toupdate=Mise à jour de la base détéctée
+tutti.dbManager.updatedb.found=Une mise à jour des référentiels (version <strong>%s</strong>) est disponible.
+tutti.editAccidentalBatch.action.createBatch=Créer une capture accidentelle
+tutti.editAccidentalBatch.action.createBatch.mnemonic=C
+tutti.editAccidentalBatch.action.createBatch.tip=Créer une capture accidentelle
+tutti.editAccidentalBatch.action.exportMultiPost=Exporter les captures accidentelles
+tutti.editAccidentalBatch.action.exportMultiPost.destinationFile.button=Choisir le fichier pour l'export
+tutti.editAccidentalBatch.action.exportMultiPost.destinationFile.title=Exporter les lots de captures accidentelles
+tutti.editAccidentalBatch.action.exportMultiPost.mnemonic=E
+tutti.editAccidentalBatch.action.exportMultiPost.success=Les lots de captures accidentelles ont été exportés dans le fichier %s
+tutti.editAccidentalBatch.action.exportMultiPost.tip=Exporter les captures accidentelles pour les importer sur le poste maître
+tutti.editAccidentalBatch.action.importMultiPost=Importer des captures accidentelles
+tutti.editAccidentalBatch.action.importMultiPost.mnemonic=I
+tutti.editAccidentalBatch.action.importMultiPost.sourceFile.button=Choisir le fichier à importer
+tutti.editAccidentalBatch.action.importMultiPost.sourceFile.title=Importer des lots de captures accidentelles
+tutti.editAccidentalBatch.action.importMultiPost.success=Des lots de captures accidentelles ont été importés depuis le fichier %s
+tutti.editAccidentalBatch.action.importMultiPost.tip=Importer des captures accidentelles créées sur un poste satellite
+tutti.editAccidentalBatch.action.removeBatch=Supprimer la capture courante
+tutti.editAccidentalBatch.action.removeBatch.confirm.message=<html>Vous êtes sur le point de supprimer une capture accidentelle.<hr/>Êtes-vous sur de vouloir la supprimer ?</html>
+tutti.editAccidentalBatch.action.removeBatch.confirm.title=Suppression d'une capture accidentelle
+tutti.editAccidentalBatch.action.removeBatch.mnemonic=S
+tutti.editAccidentalBatch.action.removeBatch.tip=Supprimer la capture courante (celle de la ligne sélectionnée)
+tutti.editAccidentalBatch.table.header.comment=Commentaire
+tutti.editAccidentalBatch.table.header.comment.tip=Commentaire
+tutti.editAccidentalBatch.table.header.deadOrAlive=Mort ou vivant
+tutti.editAccidentalBatch.table.header.deadOrAlive.tip=L'animal a-t-il été remis à l'eau mort ou vivant ?
+tutti.editAccidentalBatch.table.header.file=Pièces-jointes
+tutti.editAccidentalBatch.table.header.file.tip=Pièces-jointes
+tutti.editAccidentalBatch.table.header.gender=Sexe
+tutti.editAccidentalBatch.table.header.gender.tip=Sexe (mâle, femelle, autre...)
+tutti.editAccidentalBatch.table.header.lengthStepCaracteristic=Classe de taille
+tutti.editAccidentalBatch.table.header.lengthStepCaracteristic.tip=Classe de taille
+tutti.editAccidentalBatch.table.header.otherCaracteristics=Autres caractéristiques
+tutti.editAccidentalBatch.table.header.otherCaracteristics.tip=Autres caractéristiques
+tutti.editAccidentalBatch.table.header.size=Taille
+tutti.editAccidentalBatch.table.header.size.tip=Taille (l'unité dépend de la classe de taille)
+tutti.editAccidentalBatch.table.header.species=Espèce
+tutti.editAccidentalBatch.table.header.species.tip=Espèce
+tutti.editAccidentalBatch.table.header.weight=Poids observé
+tutti.editAccidentalBatch.table.header.weight.tip=Poids observé
+tutti.editBenthosBatch.action.addSampleCategory=Ajouter une catégorie
+tutti.editBenthosBatch.action.addSampleCategory.mnemonic=A
+tutti.editBenthosBatch.action.addSampleCategory.tip=Ajouter une catégorie manquante
+tutti.editBenthosBatch.action.changeSampleCategory=Modifier la catégorie
+tutti.editBenthosBatch.action.changeSampleCategory.mnemonic=M
+tutti.editBenthosBatch.action.changeSampleCategory.tip=Modifier la catégorie de la cellule sélectionnée
+tutti.editBenthosBatch.action.createBatch=Créer un lot pour une espèce
+tutti.editBenthosBatch.action.createBatch.mnemonic=C
+tutti.editBenthosBatch.action.createBatch.tip=Créer un nouveau lot pour une espèce
+tutti.editBenthosBatch.action.createMelag=Espèces d'un MELAG (mélange)
+tutti.editBenthosBatch.action.createMelag.mnemonic=C
+tutti.editBenthosBatch.action.createMelag.tip=Calcul des poids des lots appartenant à un MELAG (mélange)
+tutti.editBenthosBatch.action.editFrequencies=Mensurations
+tutti.editBenthosBatch.action.editFrequencies.mnemonic=M
+tutti.editBenthosBatch.action.editFrequencies.tip=Éditer les mensurations
+tutti.editBenthosBatch.action.exportMultiPost=Exporter les lots de benthos
+tutti.editBenthosBatch.action.exportMultiPost.destinationFile.button=Choisir le fichier pour l'export
+tutti.editBenthosBatch.action.exportMultiPost.destinationFile.title=Exporter les lots du benthos
+tutti.editBenthosBatch.action.exportMultiPost.mnemonic=E
+tutti.editBenthosBatch.action.exportMultiPost.success=Les lots du benthos ont été exportés dans le fichier %s
+tutti.editBenthosBatch.action.exportMultiPost.tip=Exporter les lots de benthos pour les importer sur le poste maître
+tutti.editBenthosBatch.action.importMultiPost=Importer des lots de benthos
+tutti.editBenthosBatch.action.importMultiPost.mnemonic=I
+tutti.editBenthosBatch.action.importMultiPost.sourceFile.button=Choisir le fichier à importer
+tutti.editBenthosBatch.action.importMultiPost.sourceFile.title=Importer des lots de benthos
+tutti.editBenthosBatch.action.importMultiPost.success=Des lots de benthos ont été importés depuis le fichier %s
+tutti.editBenthosBatch.action.importMultiPost.tip=Importer des lots de benthos créés sur un poste satellite
+tutti.editBenthosBatch.action.removeBatch=Supprimer le lot
+tutti.editBenthosBatch.action.removeBatch.confirm.message=<html>Vous êtes sur le point de supprimer un lot de benthos.<hr/>Êtes-vous sur de vouloir le supprimer ?</html>
+tutti.editBenthosBatch.action.removeBatch.confirm.title=Suppression d'un lot de benthos
+tutti.editBenthosBatch.action.removeBatch.mnemonic=S
+tutti.editBenthosBatch.action.removeBatch.tip=Supprimer le lot courant (celui de la ligne sélectionnée) et tous ces fils
+tutti.editBenthosBatch.action.removeSubBatch=Supprimer les lots fils
+tutti.editBenthosBatch.action.removeSubBatch.confirm.message=<html>Vous êtes sur le point de supprimer les fils d'un lot de benthos.<hr/>Êtes-vous sur de vouloir les supprimer ?</html>
+tutti.editBenthosBatch.action.removeSubBatch.confirm.title=Suppression des fils d'un lot de benthos
+tutti.editBenthosBatch.action.removeSubBatch.mnemonic=f
+tutti.editBenthosBatch.action.removeSubBatch.tip=Supprimer tous les lots fils du lot sélectionné
+tutti.editBenthosBatch.action.renameBatch=Corriger l'espèce
+tutti.editBenthosBatch.action.renameBatch.mnemonic=o
+tutti.editBenthosBatch.action.renameBatch.tip=Corriger l'espèce
+tutti.editBenthosBatch.action.splitBatch=Catégoriser le lot
+tutti.editBenthosBatch.action.splitBatch.mnemonic=C
+tutti.editBenthosBatch.action.splitBatch.tip=Catégoriser le lot courant (celui de la ligne sélectionné)
+tutti.editBenthosBatch.error.sampleCategoryValue.notAvailable=La valeur %s de la catégorie %s est déjà utilisée
+tutti.editBenthosBatch.field.benthosTotalInertWeight=Poids inerte trié
+tutti.editBenthosBatch.field.benthosTotalInertWeight.tip=Poids de la fraction inerte restante après le tri du benthos (cailloux, vase, débris coquilliers, etc.)
+tutti.editBenthosBatch.field.benthosTotalLivingNotItemizedWeight=Poids vivant non détaillé trié
+tutti.editBenthosBatch.field.benthosTotalLivingNotItemizedWeight.tip=Poids de la fraction vivante restante après le tri du benthos (algues, matières vivantes non reconnaissable, etc.)
+tutti.editBenthosBatch.field.benthosTotalSampleSortedWeight=Poids VRAC trié
+tutti.editBenthosBatch.field.benthosTotalSampleSortedWeight.tip=Poids total du benthos trié
+tutti.editBenthosBatch.field.benthosTotalSortedWeight=Poids total VRAC
+tutti.editBenthosBatch.field.benthosTotalSortedWeight.tip=Poids total VRAC des espèces de type benthos dans la capture
+tutti.editBenthosBatch.field.benthosTotalUnsortedWeight=Poids total HORS VRAC
+tutti.editBenthosBatch.field.benthosTotalUnsortedWeight.tip=Poids total HORS VRAC des espèces de type benthos dans la capture
+tutti.editBenthosBatch.field.benthosTotalWeight=Poids TOTAL
+tutti.editBenthosBatch.field.benthosTotalWeight.tip=Poids total des espèces de type benthos dans la capture (Vrac + Hors Vrac)
+tutti.editBenthosBatch.filterBatch=Filtre
+tutti.editBenthosBatch.filterBatch.mode.all=Aucun
+tutti.editBenthosBatch.filterBatch.mode.all.tip=Pas de filtre (tous les lots sont visibles)
+tutti.editBenthosBatch.filterBatch.mode.leaf=Feuilles
+tutti.editBenthosBatch.filterBatch.mode.leaf.tip=Voir uniquement les lots *feuilles*
+tutti.editBenthosBatch.filterBatch.mode.root=Parents (%s)
+tutti.editBenthosBatch.filterBatch.mode.root.tip=Voir uniquement les lots *parents*
+tutti.editBenthosBatch.filterBatch.tip=Pour filtrer les lots
+tutti.editBenthosBatch.split.weightNotNull.help=Que voulez-vous faire ? <ul><li><strong>Annuler</strong> pour ne pas catégoriser le lot et garder le poids sous-échantilloné</li><li><strong>OK</strong> pour catégoriser le lot et supprimer le poids sous-échantillonné</li></ul>.
+tutti.editBenthosBatch.split.weightNotNull.message=Pour catégoriser un lot, il ne doit pas avoir de poids sous-échantillonné.
+tutti.editBenthosBatch.split.weightNotNull.title=Poids sous-échantillonné non nul
+tutti.editBenthosBatch.table.header.comment=Commentaire
+tutti.editBenthosBatch.table.header.comment.tip=Commentaire sur la ligne
+tutti.editBenthosBatch.table.header.computedNumber=Tailles/Poids ou Nombre
+tutti.editBenthosBatch.table.header.computedNumber.tip=Tailles/Poids ou Nombre d'individus dans le lot
+tutti.editBenthosBatch.table.header.file=Pièces jointes
+tutti.editBenthosBatch.table.header.file.tip=Pièces jointes associées à la ligne
+tutti.editBenthosBatch.table.header.species=Espèce
+tutti.editBenthosBatch.table.header.species.tip=Code campagne ou code Rubin – Nom scientifique
+tutti.editBenthosBatch.table.header.toConfirm=A Confirmer
+tutti.editBenthosBatch.table.header.toConfirm.tip=Case à cocher si il y a un doute sur l'identification de l'espèce
+tutti.editBenthosBatch.table.header.weight=Poids sous-échantillonné
+tutti.editBenthosBatch.table.header.weight.tip=Poids du lot mesuré ou dénombré
+tutti.editBenthosBatch.title.changeSampleCategoryValue=Changer la valeur de la catégorie %s
+tutti.editBenthosFrequencies.action.addLengthStepCaracteristic=...
+tutti.editBenthosFrequencies.action.addLengthStepCaracteristic.mnemonic=.
+tutti.editBenthosFrequencies.action.addLengthStepCaracteristic.tip=Sélectionner une autre caractéristique
+tutti.editBenthosFrequencies.action.cancel=Annuler
+tutti.editBenthosFrequencies.action.cancel.mnemonic=A
+tutti.editBenthosFrequencies.action.cancel.tip=Annuler l'édition des mensurations
+tutti.editBenthosFrequencies.action.generate=Générer
+tutti.editBenthosFrequencies.action.generate.mnemonic=G
+tutti.editBenthosFrequencies.action.generate.tip=Générer les mensurations
+tutti.editBenthosFrequencies.action.reset=Réinitialiser
+tutti.editBenthosFrequencies.action.reset.mnemonic=R
+tutti.editBenthosFrequencies.action.reset.tip=Supprimer toutes les mensurations saisies
+tutti.editBenthosFrequencies.action.saveAndClose=Enregistrer et Fermer
+tutti.editBenthosFrequencies.action.saveAndClose.mnemonic=F
+tutti.editBenthosFrequencies.action.saveAndClose.tip=Enregistrer les mensurations
+tutti.editBenthosFrequencies.action.saveAndContinue=Enregistrer et Continuer
+tutti.editBenthosFrequencies.action.saveAndContinue.mnemonic=C
+tutti.editBenthosFrequencies.action.saveAndContinue.tip=Enregistrer les mensurations et saisir les mensurations pour le lot suivant
+tutti.editBenthosFrequencies.error.length.doublon=La classe de taille <strong>%s</strong> est utilisée plusieurs fois (deuxième occurrence trouvée à la ligne <strong>%s</strong>), ce qui n'est pas autorisé.<hr/>Veuillez corriger cela pour pouvoir enregistrer les mensurations.
+tutti.editBenthosFrequencies.field.lengthStepCaracteristic=Type de mesure
+tutti.editBenthosFrequencies.field.lengthStepCaracteristic.tip=Méthode de mensuration des individus
+tutti.editBenthosFrequencies.field.maxStep=Classe max
+tutti.editBenthosFrequencies.field.maxStep.tip=Taille maximale mesurée
+tutti.editBenthosFrequencies.field.minStep=Classe min
+tutti.editBenthosFrequencies.field.minStep.tip=Taille minimale mesurée
+tutti.editBenthosFrequencies.field.mode.autoGen=Génération des classes
+tutti.editBenthosFrequencies.field.mode.autoGen.tip=Mode où toutes les classes de taille sont générées
+tutti.editBenthosFrequencies.field.mode.rafale=Mode "rafale"
+tutti.editBenthosFrequencies.field.mode.rafale.tip=Mode où on ne saisit uniquement la classe de taille (les nombres seront alors incrémentés...)
+tutti.editBenthosFrequencies.field.mode.simple=Mode simple
+tutti.editBenthosFrequencies.field.mode.simple.tip=Mode par défaut on on doit tout saisir (les classes de tailles et les nombres)
+tutti.editBenthosFrequencies.field.mode.simpleCounting=Mode simple dénombrement
+tutti.editBenthosFrequencies.field.mode.simpleCounting.tip=Mode par défaut si la classe de taille n'est pas renseignée dans le protocole
+tutti.editBenthosFrequencies.field.rafaleStep=Classe de taille à incrémenter
+tutti.editBenthosFrequencies.field.rafaleStep.tip=Saisir à la suite les différentes tailles mesurées
+tutti.editBenthosFrequencies.field.rows=Classes de taille
+tutti.editBenthosFrequencies.field.simpleCounting=Nombre
+tutti.editBenthosFrequencies.field.simpleCounting.tip=Saisir le nombre d'individus dans le lot
+tutti.editBenthosFrequencies.field.step=Pas de la classe de taille
+tutti.editBenthosFrequencies.field.step.tip=Pas de la classe de taille pour cette espèce (ex. \: 1 cm, 0,5 cm, 1 mm etc.)
+tutti.editBenthosFrequencies.field.totalNumber=Nombre total
+tutti.editBenthosFrequencies.field.totalNumber.tip=Nombre total d'individus des lignes valides
+tutti.editBenthosFrequencies.field.totalWeight=Poids total
+tutti.editBenthosFrequencies.field.totalWeight.tip=Poids total des lignes valides
+tutti.editBenthosFrequencies.label.no.configuration=< Pas de configuration >
+tutti.editBenthosFrequencies.simpleCountingAndFrequencies=Des mensurations ont été saisies dans le tableau. Saisir un simple dénombrement les effacera.
+tutti.editBenthosFrequencies.title=Mensuration
+tutti.editBenthosFrequencies.title.addLengthStepCaracteristic=Choisir une autre caractéristique
+tutti.editCaracteristics.title=%s - Autres caractéristiques
+tutti.editCatchBatch.action.cancelEditCatchBatch=Réinitialiser
+tutti.editCatchBatch.action.cancelEditCatchBatch.mnemonic=R
+tutti.editCatchBatch.action.cancelEditCatchBatch.tip=Réinitialiser l'édition de la capture
+tutti.editCatchBatch.action.cleanWeights=Supprimer les poids
+tutti.editCatchBatch.action.cleanWeights.done=%s poids en double ont été supprimés.
+tutti.editCatchBatch.action.cleanWeights.double.weight.detected=Des poids en doubles ont été detéctés \: %s
+tutti.editCatchBatch.action.cleanWeights.help=Que voulez-vous faire?<ul><li><strong>Annuler</strong> pour ne rien faire</li><li><strong>Ok</strong> pour enregister les modifications</li></ul>
+tutti.editCatchBatch.action.cleanWeights.mnemonic=S
+tutti.editCatchBatch.action.cleanWeights.no.double.weight.detected=Aucun poids en double détecté.
+tutti.editCatchBatch.action.cleanWeights.tip=Supprimer les poids superflus dans les captures espèces et benthos
+tutti.editCatchBatch.action.cleanWieghts.resume.title=Confirmer la suppression des poids en double
+tutti.editCatchBatch.action.computeWeights=Élever les poids
+tutti.editCatchBatch.action.computeWeights.double.weight.detected=<html><body>Des poids en doubles ont été detéctés \: %s</body></html>
+tutti.editCatchBatch.action.computeWeights.double.weight.detected.title=Poids en double détectés
+tutti.editCatchBatch.action.computeWeights.mnemonic=p
+tutti.editCatchBatch.action.computeWeights.no.double.weight.detected=Aucun poids en double détecté.
+tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.help=Est-ce bien une valeur observée ?<ul><li><strong>Non</strong> pour remplacer la valeur saisie par le poids calculé</li><li><strong>Oui</strong> pour garder la valeur saisie</li></ul>.
+tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.message.benthos=Le Poids total VRAC saisi sur le benthos est supérieur de moins de %s%% au Poids total Vrac trié.
+tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.message.species=Le Poids total VRAC saisi sur les espèces est supérieur de moins de %s%% au Poids total Vrac trié.
+tutti.editCatchBatch.action.computeWeights.replaceTotalSortedWeight.title=Poids total VRAC peu différent du Poids total Vrac trié
+tutti.editCatchBatch.action.computeWeights.tip=Élever les poids
+tutti.editCatchBatch.action.exportFishingOperationReport=Résumé PDF
+tutti.editCatchBatch.action.exportFishingOperationReport.mnemonic=P
+tutti.editCatchBatch.action.exportFishingOperationReport.tip=Envoyer le résumé au format pdf du trait sélectionné
+tutti.editCatchBatch.action.exportFishingOperationReportForSumatra=Résumé Sumatra
+tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.mnemonic=u
+tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.tip=Exporter le trait sélectionnée pour Sumatra (au format csv)
+tutti.editCatchBatch.action.saveCatchBatch=Enregistrer
+tutti.editCatchBatch.action.saveCatchBatch.mnemonic=S
+tutti.editCatchBatch.action.saveCatchBatch.tip=Enregistrer la capture
+tutti.editCatchBatch.askCancelEditBeforeLeaving.cancelEditCatchBatch=La capture n'est pas valide et ne peut pas être enregistrée
+tutti.editCatchBatch.askSaveBeforeLeaving.saveCatchBatch=Des modifications sur la capture n'ont pas été enregistrées
+tutti.editCatchBatch.field.benthosTotalSampleSortedWeight=Poids VRAC trié
+tutti.editCatchBatch.field.benthosTotalSampleSortedWeight.tip=Poids du VRAC trié dans le benthos
+tutti.editCatchBatch.field.benthosTotalSortedWeight=Poids total VRAC
+tutti.editCatchBatch.field.benthosTotalSortedWeight.tip=Poids total du VRAC benthos
+tutti.editCatchBatch.field.benthosTotalUnsortedWeight=Poids total HORS VRAC
+tutti.editCatchBatch.field.benthosTotalUnsortedWeight.tip=Poids total du HORS VRAC benthos
+tutti.editCatchBatch.field.benthosTotalWeight=Poids TOTAL
+tutti.editCatchBatch.field.benthosTotalWeight.tip=Poids total du benthos dans la capture (\= poids total Vrac + poids total Hors Vrac)
+tutti.editCatchBatch.field.catchTotalRejectedWeight=Poids total NON TRIÉ
+tutti.editCatchBatch.field.catchTotalRejectedWeight.tip=Poids de la fraction non triée à bord
+tutti.editCatchBatch.field.catchTotalSortedCarousselWeight=Carrousel observé
+tutti.editCatchBatch.field.catchTotalSortedCarousselWeight.tip=Sur Thalassa, poids total de la capture pesé sur la balance carrousel
+tutti.editCatchBatch.field.catchTotalSortedTremisWeight=Trémie
+tutti.editCatchBatch.field.catchTotalSortedTremisWeight.tip=Sur Thalassa, poids total de la capture pesé sur la balance trémie et envoyée sur la chaîne de tri
+tutti.editCatchBatch.field.catchTotalSortedWeight=Poids total VRAC
+tutti.editCatchBatch.field.catchTotalSortedWeight.tip=Poids total VRAC des espèces dans la capture (sans les captures accidentelles)
+tutti.editCatchBatch.field.catchTotalUnsortedWeight=Poids total HORS VRAC
+tutti.editCatchBatch.field.catchTotalUnsortedWeight.tip=Poids total HORS VRAC des espèces dans la capture (sans les captures accidentelles)
+tutti.editCatchBatch.field.catchTotalWeight=Poids TOTAL
+tutti.editCatchBatch.field.catchTotalWeight.tip=Poids total de la capture (sauf macro déchets et captures accidentelles)
+tutti.editCatchBatch.field.marineLitterTotalWeight=Poids TOTAL
+tutti.editCatchBatch.field.marineLitterTotalWeight.tip=Poids total des macro déchets dans la capture
+tutti.editCatchBatch.field.speciesTotalSampleSortedWeight=Poids VRAC trié
+tutti.editCatchBatch.field.speciesTotalSampleSortedWeight.tip=Poids total des espèces triées (poissons, crustacés etc.)
+tutti.editCatchBatch.field.speciesTotalSortedWeight=Poids total VRAC
+tutti.editCatchBatch.field.speciesTotalSortedWeight.tip=Poids total VRAC des espèces dans la capture (poissons, crustacés etc.)
+tutti.editCatchBatch.field.speciesTotalUnsortedWeight=Poids total HORS VRAC
+tutti.editCatchBatch.field.speciesTotalUnsortedWeight.tip=Poids total HORS VRAC des espèces dans la capture (poissons, crustacés etc.)
+tutti.editCatchBatch.field.speciesTotalWeight=Poids TOTAL
+tutti.editCatchBatch.field.speciesTotalWeight.tip=Poids total des espèces dans la capture (poissons, crustacés etc.)
+tutti.editCatchBatch.legend.benthos=Benthos
+tutti.editCatchBatch.legend.marineLitter=Macro déchets
+tutti.editCatchBatch.legend.species=Espèces
+tutti.editCatchBatch.legend.total=Capture
+tutti.editCruise.action.closeEditCruise=Fermer
+tutti.editCruise.action.closeEditCruise.mnemonic=F
+tutti.editCruise.action.closeEditCruise.tip=Fermer l'écran d'édition de campagne
+tutti.editCruise.action.editGearCaracteristics=Editer
+tutti.editCruise.action.editGearCaracteristics.tip=Editer les caractéristiques de l'engin
+tutti.editCruise.action.generateCampaignName=Générer le nom
+tutti.editCruise.action.generateCampaignName.mnemonic=G
+tutti.editCruise.action.generateName.tip=Générer le nom normalisé de la campagne
+tutti.editCruise.action.save.gearChanged.help=Les engins des traits de la campagne vont également être modifiés.<ul><li><strong>Annuler</strong> pour ne pas enregistrer les modifications de la campagne ni les traits</li><li><strong>OK</strong> pour enregistrer la campagne et modifier les engins des traits</li></ul>.
+tutti.editCruise.action.save.gearChanged.message=Les engins de la campagne ont été modifiés.
+tutti.editCruise.action.save.gearChanged.title=Engin(s) modifié(s)
+tutti.editCruise.action.save.vesselChanged.help=Le navire des traits de la campagne va également être modifié.<ul><li><strong>Annuler</strong> pour ne pas enregistrer les modifications de la campagne ni les traits</li><li><strong>OK</strong> pour enregistrer la campagne et modifier le navire des traits</li></ul>.
+tutti.editCruise.action.save.vesselChanged.message=Le navire de la campagne a été modifié.
+tutti.editCruise.action.save.vesselChanged.title=Navire modifié
+tutti.editCruise.action.saveCruise=Enregistrer
+tutti.editCruise.action.saveCruise.mnemonic=E
+tutti.editCruise.action.saveCruise.tip=Enregistrer la campagne
+tutti.editCruise.action.viewGearCaracteristics=Voir
+tutti.editCruise.action.viewGearCaracteristics.tip=Voir les caractéristiques de l'engin
+tutti.editCruise.askCancelEditBeforeLeaving.cancelSaveCruise=La campagne n'est pas valide et ne peut pas être enregistrée
+tutti.editCruise.askSaveBeforeLeaving.saveCruise=Des modifications sur la campagne n'ont pas été enregistrées
+tutti.editCruise.field.beginDate=Date de début
+tutti.editCruise.field.beginDate.tip=Date de début de la campagne
+tutti.editCruise.field.comment=Commentaire
+tutti.editCruise.field.comment.tip=Commentaire général sur la campagne
+tutti.editCruise.field.departureLocation=Port de départ
+tutti.editCruise.field.departureLocation.tip=Nom du port de départ de la campagne
+tutti.editCruise.field.endDate=Date de fin
+tutti.editCruise.field.endDate.tip=Date de fin de la campagne
+tutti.editCruise.field.gear=Engin(s)
+tutti.editCruise.field.gear.tip=Liste des engins présents à bord du navire au cours de la campagne et utilisés
+tutti.editCruise.field.headOfMission=Chef(s) de mission
+tutti.editCruise.field.headOfMission.tip=Liste du(des) chef(s) de missions sur l'ensemble de la campagne
+tutti.editCruise.field.headOfSortRoom=Responsable(s) de salle de tri
+tutti.editCruise.field.headOfSortRoom.tip=Liste du(des) responsable(s) de la salle de tri sur l'ensemble de la campagne
+tutti.editCruise.field.multirigNumber=Nombre de poches
+tutti.editCruise.field.multirigNumber.tip=Nombre de poche(s) associé à l'engin (le plus souvent \= 1)
+tutti.editCruise.field.name=Nom
+tutti.editCruise.field.name.tip=Nom normalisé de la campagne
+tutti.editCruise.field.program=Série
+tutti.editCruise.field.program.tip=Nom de la série de campagne
+tutti.editCruise.field.returnLocation=Port d'arrivée
+tutti.editCruise.field.returnLocation.tip=Nom du port d'arrivée de la campagne
+tutti.editCruise.field.surveyPart=Série partielle
+tutti.editCruise.field.surveyPart.tip=N° de la série partielle (mettre 1 si il y a une seule campagne dans l'année)
+tutti.editCruise.field.vessel=Navire
+tutti.editCruise.field.vessel.tip=Navire de la campagne
+tutti.editCruise.filterVessel.tip=Filtrer par type de navire
+tutti.editCruise.filterVesselType=Filtre \:
+tutti.editCruise.filterVesselType.all=Tout
+tutti.editCruise.filterVesselType.all.tip=Tout les navires
+tutti.editCruise.filterVesselType.fishing=Professionnels
+tutti.editCruise.filterVesselType.fishing.tip=Uniquement les navires professionnels
+tutti.editCruise.filterVesselType.scientific=Scientifiques
+tutti.editCruise.filterVesselType.scientific.tip=Uniquement les navires scientifiques
+tutti.editCruise.gearCaracteristics.title=Caractéristiques d'un engin
+tutti.editCruise.title.create.cruise=Créer une nouvelle campagne
+tutti.editCruise.title.edit.cruise=Éditer une campagne existante
+tutti.editFishingOperation.action.attachments.tip=Pièces-jointes de l'opération
+tutti.editFishingOperation.action.cancelEditFishingOperation=Annuler
+tutti.editFishingOperation.action.cancelEditFishingOperation.mnemonic=A
+tutti.editFishingOperation.action.cancelEditFishingOperation.tip=Annuler la création du trait
+tutti.editFishingOperation.action.deleteFishingOperation.message=Vous êtes sur le point de supprimer l'opération de pêche <strong>%s</strong>
+tutti.editFishingOperation.action.deleteFishingOperation.tip=Supprimer l'opération de pêche sélectionnée
+tutti.editFishingOperation.action.deleteFishingOperation.title=Supprimer l'opération de pêche sélectionnée
+tutti.editFishingOperation.action.editFishingOperation.tip=Éditer l'opération de pêche
+tutti.editFishingOperation.action.resetEditFishingOperation=Réinitialiser
+tutti.editFishingOperation.action.resetEditFishingOperation.mnemonic=R
+tutti.editFishingOperation.action.resetEditFishingOperation.tip=Réinitialiser l'édition du trait
+tutti.editFishingOperation.action.resetFishingOperationValidState=Réinitialiser
+tutti.editFishingOperation.action.resetFishingOperationValidState.mnemonic=é
+tutti.editFishingOperation.action.resetFishingOperationValidState.tip=Réinitialiser l'état de validation du trait
+tutti.editFishingOperation.action.saveEditFishingOperation.mnemonic=E
+tutti.editFishingOperation.action.saveEditFishingOperation.tip=Enregistrer le trait
+tutti.editFishingOperation.action.saveFishingOperation=Enregistrer
+tutti.editFishingOperation.askCancelEditBeforeLeaving.cancelEditFishingOperation=Le trait modifié n'est pas valide et ne peut pas être enregistré
+tutti.editFishingOperation.askSaveBeforeLeaving.createFishingOperation=Le trait n'a pas été créé
+tutti.editFishingOperation.askSaveBeforeLeaving.saveFishingOperation=Des modifications sur le trait n'ont pas été enregistrées
+tutti.editFishingOperation.duration.format=dj Hh m'm'
+tutti.editFishingOperation.field.comment=Commentaire
+tutti.editFishingOperation.field.comment.tip=Commentaire sur le trait
+tutti.editFishingOperation.field.duration=Durée
+tutti.editFishingOperation.field.duration.tip=Durée du trait calculée
+tutti.editFishingOperation.field.fishingOperationInvalid=Trait invalide
+tutti.editFishingOperation.field.fishingOperationNumber=Numéro de Trait
+tutti.editFishingOperation.field.fishingOperationNumber.tip=Numéro de Trait
+tutti.editFishingOperation.field.fishingOperationRectiligne=Trait rectiligne
+tutti.editFishingOperation.field.fishingOperationRectiligne.tip=Le trait est il rectiligne ?
+tutti.editFishingOperation.field.fishingOperationValid=Trait valide
+tutti.editFishingOperation.field.fishingOperationValid.tip=Trait valide
+tutti.editFishingOperation.field.fishingOperationValidity=Validité du trait
+tutti.editFishingOperation.field.gear=Engin
+tutti.editFishingOperation.field.gear.tip=Engin du trait
+tutti.editFishingOperation.field.gearDate=Date
+tutti.editFishingOperation.field.gearDate.tip=Dates de début et fin de trait
+tutti.editFishingOperation.field.gearLatitude=Latitude (%s)
+tutti.editFishingOperation.field.gearLatitude.tip=Latitude
+tutti.editFishingOperation.field.gearLongitude=Longitude (%s)
+tutti.editFishingOperation.field.gearLongitude.tip=Longitude
+tutti.editFishingOperation.field.gearShootingEnd=Fin de traîne
+tutti.editFishingOperation.field.gearShootingEnd.tip=Informations sur la fin de pêche
+tutti.editFishingOperation.field.gearShootingEndDate=Date de fin de traîne
+tutti.editFishingOperation.field.gearShootingEndLatitude=Latitude de fin de traîne
+tutti.editFishingOperation.field.gearShootingEndLatitude.tip=Latitude de fin de traîne
+tutti.editFishingOperation.field.gearShootingEndLatitudeDegree=Degré de latitude de fin de traîne
+tutti.editFishingOperation.field.gearShootingEndLatitudeDm=
+tutti.editFishingOperation.field.gearShootingEndLatitudeDmd=
+tutti.editFishingOperation.field.gearShootingEndLatitudeDms=
+tutti.editFishingOperation.field.gearShootingEndLatitudeMinute=Minute de latitude de fin de traîne
+tutti.editFishingOperation.field.gearShootingEndLatitudeSecond=Seconde de latitude de fin de traîne
+tutti.editFishingOperation.field.gearShootingEndLongitude=Longitude de fin de traîne
+tutti.editFishingOperation.field.gearShootingEndLongitude.tip=Longitude de fin de traîne
+tutti.editFishingOperation.field.gearShootingEndLongitudeDegree=Degré de longitude de fin de traîne
+tutti.editFishingOperation.field.gearShootingEndLongitudeDm=
+tutti.editFishingOperation.field.gearShootingEndLongitudeDmd=
+tutti.editFishingOperation.field.gearShootingEndLongitudeDms=
+tutti.editFishingOperation.field.gearShootingEndLongitudeMinute=Minute de longitude de fin de traîne
+tutti.editFishingOperation.field.gearShootingEndLongitudeSecond=Seconde de longitude de fin de traîne
+tutti.editFishingOperation.field.gearShootingStart=Début de traîne
+tutti.editFishingOperation.field.gearShootingStart.tip=Informations sur le début de pêche
+tutti.editFishingOperation.field.gearShootingStartDate=Date de début de traîne
+tutti.editFishingOperation.field.gearShootingStartLatitude=Latitude de début de traîne
+tutti.editFishingOperation.field.gearShootingStartLatitude.tip=Latitude de début de traîne
+tutti.editFishingOperation.field.gearShootingStartLatitudeDegree=Degré de latitude de début de traîne
+tutti.editFishingOperation.field.gearShootingStartLatitudeDm=
+tutti.editFishingOperation.field.gearShootingStartLatitudeDmd=
+tutti.editFishingOperation.field.gearShootingStartLatitudeDms=
+tutti.editFishingOperation.field.gearShootingStartLatitudeMinute=Minute de latitude de début de traîne
+tutti.editFishingOperation.field.gearShootingStartLatitudeSecond=Seconde de latitude de début de traîne
+tutti.editFishingOperation.field.gearShootingStartLongitude=Longitude de début de traîne
+tutti.editFishingOperation.field.gearShootingStartLongitude.tip=Longitude de début de traîne
+tutti.editFishingOperation.field.gearShootingStartLongitudeDegree=Degré de longitude de début de traîne
+tutti.editFishingOperation.field.gearShootingStartLongitudeDm=
+tutti.editFishingOperation.field.gearShootingStartLongitudeDmd=
+tutti.editFishingOperation.field.gearShootingStartLongitudeDms=
+tutti.editFishingOperation.field.gearShootingStartLongitudeMinute=Minute de longitude de début de traîne
+tutti.editFishingOperation.field.gearShootingStartLongitudeSecond=Seconde de longitude de début de traîne
+tutti.editFishingOperation.field.gearTime=Heure
+tutti.editFishingOperation.field.gearTime.tip=Heures de début et fin de trait
+tutti.editFishingOperation.field.location=Localité
+tutti.editFishingOperation.field.location.tip=Localité de la sous strate ou de la strate
+tutti.editFishingOperation.field.multirigAggregation=Numéro de poche
+tutti.editFishingOperation.field.multirigAggregation.tip=N° de la poche au regard du nombre de poches précisé dans la campagne
+tutti.editFishingOperation.field.recorderPerson=Saisisseur(s)
+tutti.editFishingOperation.field.recorderPerson.tip=Nom(s) du (des) personnes qui ont saisi la données de ce trait
+tutti.editFishingOperation.field.secondaryVessel=Navire(s) associé(s)
+tutti.editFishingOperation.field.secondaryVessel.tip=Navire(s) associé(s) au trait
+tutti.editFishingOperation.field.stationNumber=Code Station
+tutti.editFishingOperation.field.stationNumber.tip=Identifiant de la station
+tutti.editFishingOperation.field.strata=Strate
+tutti.editFishingOperation.field.strata.tip=Strate associée au trait
+tutti.editFishingOperation.field.subStrata=Sous strate
+tutti.editFishingOperation.field.subStrata.tip=Sous strate associée au trait
+tutti.editFishingOperation.field.trawlDistance=Distance chalutée (m)
+tutti.editFishingOperation.field.trawlDistance.inMilles.tip=%s milles marins
+tutti.editFishingOperation.field.trawlDistance.tip=Distance chalutée en mètres
+tutti.editFishingOperation.field.vessel=Navire
+tutti.editFishingOperation.field.vessel.tip=Navire du trait
+tutti.editFishingOperation.filterSecondaryVesselType=Filtre \:
+tutti.editFishingOperation.filterSecondaryVesselType.all=Tout
+tutti.editFishingOperation.filterSecondaryVesselType.all.tip=Tous les navires possibles
+tutti.editFishingOperation.filterSecondaryVesselType.fishing=Professionnels
+tutti.editFishingOperation.filterSecondaryVesselType.fishing.tip=Uniquement les navires professionnels
+tutti.editFishingOperation.filterSecondaryVesselType.onlyCruise=Associés
+tutti.editFishingOperation.filterSecondaryVesselType.onlyCruise.tip=Uniquement les navires déjà associés à d'autres traits de cette campagne
+tutti.editFishingOperation.filterSecondaryVesselType.scientific=Scientifiques
+tutti.editFishingOperation.filterSecondaryVesselType.scientific.tip=Uniquement les navires scientifiques
+tutti.editFishingOperation.filterSecondaryVesselType.tip=Filter les navires associés possible pour ce trait
+tutti.editFishingOperation.label.traitReminder=Trait \: %s
+tutti.editFishingOperation.label.traitReminder.inCreation=en cours de création
+tutti.editFishingOperation.message.operation.deleted=Opération de pêche <strong>%s</strong> supprimée.
+tutti.editFishingOperation.pane.other=Autres caractéristiques
+tutti.editFishingOperation.tab.general=Trait
+tutti.editIndividualObservationBatch.action.createBatch=Créer une observation
+tutti.editIndividualObservationBatch.action.createBatch.mnemonic=C
+tutti.editIndividualObservationBatch.action.createBatch.tip=Créer une nouvelle observation
+tutti.editIndividualObservationBatch.action.exportMultiPost=Exporter les observations
+tutti.editIndividualObservationBatch.action.exportMultiPost.destinationFile.button=Choisir le fichier pour l'export
+tutti.editIndividualObservationBatch.action.exportMultiPost.destinationFile.title=Exporter les lots d'observations individuelles
+tutti.editIndividualObservationBatch.action.exportMultiPost.mnemonic=E
+tutti.editIndividualObservationBatch.action.exportMultiPost.success=Les lots d'observations individuelles ont été exportés dans le fichier %s
+tutti.editIndividualObservationBatch.action.exportMultiPost.tip=Exporter les observations pour les importer sur le poste maître
+tutti.editIndividualObservationBatch.action.importMultiPost=Importer des observations
+tutti.editIndividualObservationBatch.action.importMultiPost.mnemonic=I
+tutti.editIndividualObservationBatch.action.importMultiPost.sourceFile.button=Choisir le fichier à importer
+tutti.editIndividualObservationBatch.action.importMultiPost.sourceFile.title=Importer des lots d'observations individuelles
+tutti.editIndividualObservationBatch.action.importMultiPost.success=Des lots d'observations individuelles ont été importés depuis le fichier %s
+tutti.editIndividualObservationBatch.action.importMultiPost.tip=Importer des observations créées sur un poste satellite
+tutti.editIndividualObservationBatch.action.removeAllBatch=Supprimer l'espèce
+tutti.editIndividualObservationBatch.action.removeAllBatch.confirm.message=<html>Vous êtes sur le point de supprimer toutes les observations individuelles (%s entrées) pour l'espèce %s.<hr/>Êtes-vous sur de vouloir les supprimer ?</html>
+tutti.editIndividualObservationBatch.action.removeAllBatch.confirm.title=Suppression des observations individuelles d'une espèce
+tutti.editIndividualObservationBatch.action.removeAllBatch.mnemonic=E
+tutti.editIndividualObservationBatch.action.removeAllBatch.tip=Supprimer toutes les lignes de l'espèce sélectionnée
+tutti.editIndividualObservationBatch.action.removeBatch=Supprimer la ligne sélectionnée
+tutti.editIndividualObservationBatch.action.removeBatch.confirm.message=<html>Vous êtes sur le point de supprimer une observation individuelle.<hr/>Êtes-vous sur de vouloir la supprimer ?</html>
+tutti.editIndividualObservationBatch.action.removeBatch.confirm.title=Suppression d'une observation individuelle
+tutti.editIndividualObservationBatch.action.removeBatch.mnemonic=S
+tutti.editIndividualObservationBatch.action.removeBatch.tip=Supprimer la ligne sélectionnée
+tutti.editIndividualObservationBatch.table.header.comment=Commentaire
+tutti.editIndividualObservationBatch.table.header.comment.tip=Commentaire
+tutti.editIndividualObservationBatch.table.header.file=Pièces jointes
+tutti.editIndividualObservationBatch.table.header.file.tip=Pièces jointes
+tutti.editIndividualObservationBatch.table.header.lengthStepCaracteristic=Classe de taille
+tutti.editIndividualObservationBatch.table.header.lengthStepCaracteristic.tip=Classe de taille
+tutti.editIndividualObservationBatch.table.header.otherCaracteristics=Autres caractéristiques
+tutti.editIndividualObservationBatch.table.header.otherCaracteristics.tip=Autres caractéristiques
+tutti.editIndividualObservationBatch.table.header.size=Taille
+tutti.editIndividualObservationBatch.table.header.size.tip=Taille
+tutti.editIndividualObservationBatch.table.header.species=Espèce
+tutti.editIndividualObservationBatch.table.header.species.tip=Espèce
+tutti.editIndividualObservationBatch.table.header.weight=Poids
+tutti.editIndividualObservationBatch.table.header.weight.tip=Poids
+tutti.editIndividualObservationCaracteristics.action.cancel=Annuler
+tutti.editIndividualObservationCaracteristics.action.cancel.mnemonic=A
+tutti.editIndividualObservationCaracteristics.action.cancel.tip=Annuler l'édition des caractéristiques de l'observation
+tutti.editIndividualObservationCaracteristics.action.removeCaracteristic=Supprimer la caractéristique sélectionnée
+tutti.editIndividualObservationCaracteristics.action.removeCaracteristic.mnemonic=S
+tutti.editIndividualObservationCaracteristics.action.removeCaracteristic.tip=Supprimer la caractéristique sélectionnée
+tutti.editIndividualObservationCaracteristics.action.save=Enregistrer
+tutti.editIndividualObservationCaracteristics.action.save.mnemonic=E
+tutti.editIndividualObservationCaracteristics.action.save.tip=Enregistrer les caractéristiques de l'observation
+tutti.editMarineLitterBatch.action.createBatch=Créer un lot de déchet
+tutti.editMarineLitterBatch.action.createBatch.mnemonic=C
+tutti.editMarineLitterBatch.action.createBatch.tip=Créer un nouveau lot de déchet
+tutti.editMarineLitterBatch.action.exportMultiPost=Exporter les lots de déchets
+tutti.editMarineLitterBatch.action.exportMultiPost.destinationFile.button=Choisir le fichier pour l'export
+tutti.editMarineLitterBatch.action.exportMultiPost.destinationFile.title=Exporter les lots de déchets
+tutti.editMarineLitterBatch.action.exportMultiPost.mnemonic=E
+tutti.editMarineLitterBatch.action.exportMultiPost.success=Les lots de déchets ont été exportés dans le fichier %s
+tutti.editMarineLitterBatch.action.exportMultiPost.tip=Exporter les lots de déchets pour les importer sur le poste maître
+tutti.editMarineLitterBatch.action.importMultiPost=Importer des lots de déchets
+tutti.editMarineLitterBatch.action.importMultiPost.mnemonic=I
+tutti.editMarineLitterBatch.action.importMultiPost.sourceFile.button=Choisir le fichier à importer
+tutti.editMarineLitterBatch.action.importMultiPost.sourceFile.title=Importer des lots de déchets
+tutti.editMarineLitterBatch.action.importMultiPost.success=Des lots de déchets ont été importés depuis le fichier %s
+tutti.editMarineLitterBatch.action.importMultiPost.tip=Importer des lots de déchets créés sur un poste satellite
+tutti.editMarineLitterBatch.action.removeBatch=Supprimer la ligne sélectionnée
+tutti.editMarineLitterBatch.action.removeBatch.confirm.message=<html>Vous êtes sur le point de supprimer un lot de déchets.<hr/>Êtes-vous sur de vouloir le supprimer ?</html>
+tutti.editMarineLitterBatch.action.removeBatch.confirm.title=Suppression d'un lot de déchets
+tutti.editMarineLitterBatch.action.removeBatch.mnemonic=S
+tutti.editMarineLitterBatch.action.removeBatch.tip=Supprimer la ligne sélectionnée
+tutti.editMarineLitterBatch.field.marineLitterTotalWeight=Poids total
+tutti.editMarineLitterBatch.field.marineLitterTotalWeight.tip=Poids total
+tutti.editMarineLitterBatch.table.header.comment=Commentaire
+tutti.editMarineLitterBatch.table.header.comment.tip=Commentaire
+tutti.editMarineLitterBatch.table.header.file=Pièces jointes
+tutti.editMarineLitterBatch.table.header.file.tip=Pièces jointes
+tutti.editMarineLitterBatch.table.header.marineLitterCategory=Catégorie
+tutti.editMarineLitterBatch.table.header.marineLitterCategory.tip=Catégorie de déchets
+tutti.editMarineLitterBatch.table.header.marineLitterSizeCategory=Catégorie de taille
+tutti.editMarineLitterBatch.table.header.marineLitterSizeCategory.tip=Catégorie de taille
+tutti.editMarineLitterBatch.table.header.number=Nombre
+tutti.editMarineLitterBatch.table.header.number.tip=Nombre d'objets
+tutti.editMarineLitterBatch.table.header.weight=Poids
+tutti.editMarineLitterBatch.table.header.weight.tip=Poids
+tutti.editProgram.action.closeEditProgram=Fermer
+tutti.editProgram.action.closeEditProgram.mnemonic=r
+tutti.editProgram.action.closeEditProgram.tip=Annuler l'édition (ou la création) de la série de campagne, ou fermer l'éditeur suite à un enregistrement
+tutti.editProgram.action.saveProgram=Enregistrer
+tutti.editProgram.action.saveProgram.mnemonic=E
+tutti.editProgram.action.saveProgram.tip=Enregistrer les modifications
+tutti.editProgram.askCancelEditBeforeLeaving.cancelSaveProgram=La série de campagne n'est pas valide et ne peut pas être enregistrée
+tutti.editProgram.askSaveBeforeLeaving.saveProgram=Des modifications sur la série de campagne n'ont pas été enregistrées
+tutti.editProgram.field.description=Description
+tutti.editProgram.field.description.tip=Description de la série, champ obligatoire
+tutti.editProgram.field.name=Nom
+tutti.editProgram.field.name.tip=Nom de la série de campagne (exemple EVHOE)
+tutti.editProgram.field.zone=Zone
+tutti.editProgram.field.zone.tip=Zone couverte par la série de campagne
+tutti.editProgram.title.create.program=Créer une nouvelle série de campagne
+tutti.editProgram.title.edit.program=Éditer une série de campagne existante
+tutti.editProtocol.action.addBenthosProtocol.mnemonic=j
+tutti.editProtocol.action.addBenthosProtocol.tip=Ajouter une espèce du benthos au protocole
+tutti.editProtocol.action.addSpeciesProtocol.mnemonic=j
+tutti.editProtocol.action.addSpeciesProtocol.tip=Ajouter une espèce au protocole
+tutti.editProtocol.action.chooseProtocolBenthosFile=Choisir le fichier des benthos
+tutti.editProtocol.action.chooseProtocolCaracteristicFile=Choisir le fichier des caractéristiques
+tutti.editProtocol.action.chooseProtocolSpeciesFile=Choisir le fichier des espèces
+tutti.editProtocol.action.closeEditProtocol=Fermer
+tutti.editProtocol.action.closeEditProtocol.mnemonic=F
+tutti.editProtocol.action.closeEditProtocol.tip=Fermer l'écran d'édition du protocole
+tutti.editProtocol.action.exportProtocolAllCaracteristic=Exporter toutes les caractéristiques du référentiel
+tutti.editProtocol.action.exportProtocolAllCaracteristic.mnemonic=t
+tutti.editProtocol.action.exportProtocolAllCaracteristic.tip=Exporter toutes les caractéristiques du référentiel (sans les affecter à un écran)
+tutti.editProtocol.action.exportProtocolBenthos=Exporter les espèces du benthos
+tutti.editProtocol.action.exportProtocolBenthos.mnemonic=b
+tutti.editProtocol.action.exportProtocolBenthos.tip=Exporter les espèce du benthos du protocole
+tutti.editProtocol.action.exportProtocolCaracteristic=Exporter les caractéristiques
+tutti.editProtocol.action.exportProtocolCaracteristic.mnemonic=c
+tutti.editProtocol.action.exportProtocolCaracteristic.tip=Exporter les caractéristiques du protocole
+tutti.editProtocol.action.exportProtocolSpecies=Exporter les espèces
+tutti.editProtocol.action.exportProtocolSpecies.mnemonic=è
+tutti.editProtocol.action.exportProtocolSpecies.tip=Exporter les espèces du protocole
+tutti.editProtocol.action.exportPupitri=Export Pupitri
+tutti.editProtocol.action.exportPupitri.mnemonic=p
+tutti.editProtocol.action.exportPupitri.tip=Exporter les espèces au format Pupitri
+tutti.editProtocol.action.importProtocolBenthos=Importer les benthos
+tutti.editProtocol.action.importProtocolBenthos.mnemonic=i
+tutti.editProtocol.action.importProtocolBenthos.tip=Importer les benthos dans le protocole
+tutti.editProtocol.action.importProtocolCaracteristic=Importer les caractéristiques
+tutti.editProtocol.action.importProtocolCaracteristic.mnemonic=i
+tutti.editProtocol.action.importProtocolCaracteristic.tip=Importer les caractéristiques dans le protocole
+tutti.editProtocol.action.importProtocolSpecies=Importer les espèces
+tutti.editProtocol.action.importProtocolSpecies.mnemonic=é
+tutti.editProtocol.action.importProtocolSpecies.tip=Importer les espèces dans le protocole
+tutti.editProtocol.action.removeBenthosProtocol=Supprimer les benthos
+tutti.editProtocol.action.removeBenthosProtocol.mnemonic=S
+tutti.editProtocol.action.removeBenthosProtocol.tip=Supprimer les benthos sélectionnés
+tutti.editProtocol.action.removeSpeciesProtocol=Supprimer les espèces
+tutti.editProtocol.action.removeSpeciesProtocol.mnemonic=S
+tutti.editProtocol.action.removeSpeciesProtocol.tip=Supprimer les espèces sélectionnées
+tutti.editProtocol.action.saveProtocol=Enregistrer
+tutti.editProtocol.action.saveProtocol.mnemonic=E
+tutti.editProtocol.action.saveProtocol.tip=Enregistrer le protocole
+tutti.editProtocol.action.selectOtherBenthos=...
+tutti.editProtocol.action.selectOtherBenthos.mnemonic=.
+tutti.editProtocol.action.selectOtherBenthos.tip=Sélectionner une autre espèce (dans les synonymes)
+tutti.editProtocol.action.selectOtherSpecies=...
+tutti.editProtocol.action.selectOtherSpecies.mnemonic=.
+tutti.editProtocol.action.selectOtherSpecies.tip=Sélectionner une autre espèce (dans les synonymes)
+tutti.editProtocol.askCancelEditBeforeLeaving.cancelSaveProtocol=Le protocole n'est pas valide et ne peut pas être enregistré
+tutti.editProtocol.askCancelEditBeforeLeaving.cancelSaveSampleCategoryModel=La catégorisation n'est pas valide et ne peut pas être enregistré
+tutti.editProtocol.askSaveBeforeLeaving.saveProtocol=Des modifications sur le protocole n'ont pas été enregistrées
+tutti.editProtocol.askSaveBeforeLeaving.saveSampleCategoryModel=Des modifications sur la catégorisation n'ont pas été enregistrées
+tutti.editProtocol.field.benthos.tip=Benthos
+tutti.editProtocol.field.comment=Commentaire
+tutti.editProtocol.field.comment.tip=Commentaire
+tutti.editProtocol.field.protocol.name=Nom
+tutti.editProtocol.field.protocol.name.tip=Nom du protocole
+tutti.editProtocol.field.species.tip=Espèces
+tutti.editProtocol.tab.benthos=Benthos
+tutti.editProtocol.tab.caracteristic=Caractéristiques
+tutti.editProtocol.tab.caracteristic.gearUseFeature=Mise en œuvre de l'engin
+tutti.editProtocol.tab.caracteristic.individualObservation=Observations individuelles
+tutti.editProtocol.tab.caracteristic.lengthClasses=Classes de taille
+tutti.editProtocol.tab.caracteristic.vesselUseFeature=Autres caractéristiques
+tutti.editProtocol.tab.info=Informations générales
+tutti.editProtocol.tab.species=Espèces
+tutti.editProtocol.table.header.calcifySample=Prélèvement de pièces calcifiées
+tutti.editProtocol.table.header.calcifySample.tip=Prélèvement de pièces calcifiées (pour les données individuelles)
+tutti.editProtocol.table.header.countIfNoFrequency=Dénombrement
+tutti.editProtocol.table.header.countIfNoFrequency.tip=L'espèce doit elle être dénombrée ?
+tutti.editProtocol.table.header.lengthStep=Mode de mensuration
+tutti.editProtocol.table.header.lengthStep.tip=Comment mesurer les classes de taille ? (si vide alors pas de mesure)
+tutti.editProtocol.table.header.speciesReferenceTaxonId=Espèce
+tutti.editProtocol.table.header.speciesReferenceTaxonId.tip=Code Rubin – Nom scientifique
+tutti.editProtocol.table.header.speciesSurveyCode=Code campagne
+tutti.editProtocol.table.header.speciesSurveyCode.tip=Code campagne (non synchronisable dans Harmonie)
+tutti.editProtocol.table.header.weight=Pesée
+tutti.editProtocol.table.header.weight.tip=L'espèce doit elle être pesée ?
+tutti.editProtocol.title.choose.benthosExportFile=Exporter les benthos
+tutti.editProtocol.title.choose.benthosImportFile=Importer les benthos
+tutti.editProtocol.title.choose.caracteristicExportFile=Exporter les caractéristiques
+tutti.editProtocol.title.choose.caracteristicImportFile=Importer les caractéristiques
+tutti.editProtocol.title.choose.speciesExportFile=Exporter les espèces
+tutti.editProtocol.title.choose.speciesImportFile=Importer les espèces
+tutti.editProtocol.title.create.protocol=Créer un nouveau protocole de saisie
+tutti.editProtocol.title.edit.protocol=Éditer un protocole de saisie existant
+tutti.editProtocol.warn.clean=Des catégories non reconnues ont été supprimées du protocole, ces modifications ne seront sauvegardées que lorsque vous cliquerez sur le bouton "Enregistrer".
+tutti.editProtocol.warn.clone=Le protocole que vous venez de cloner ne sera sauvegardé que lorsque vous cliquerez sur le bouton "Enregistrer".
+tutti.editProtocol.warn.import=Le protocole que vous venez d'importer ne sera sauvegardé que lorsque vous cliquerez sur le bouton "Enregistrer".
+tutti.editSampleCategoryModel.action.close=Fermer
+tutti.editSampleCategoryModel.action.close.mnemonic=F
+tutti.editSampleCategoryModel.action.close.tip=Fermer l'édition des catégories
+tutti.editSampleCategoryModel.action.moveDownEntry=Descendre
+tutti.editSampleCategoryModel.action.moveDownEntry.mnemonic=D
+tutti.editSampleCategoryModel.action.moveDownEntry.tip=Descendre l'entrée sélectionnée
+tutti.editSampleCategoryModel.action.moveUpEntry=Monter
+tutti.editSampleCategoryModel.action.moveUpEntry.mnemonic=M
+tutti.editSampleCategoryModel.action.moveUpEntry.tip=Monter l'entrée sélectionnée
+tutti.editSampleCategoryModel.action.removeEntry=Supprimer
+tutti.editSampleCategoryModel.action.removeEntry.mnemonic=S
+tutti.editSampleCategoryModel.action.removeEntry.tip=Supprimer l'entrée sélectionnée
+tutti.editSampleCategoryModel.action.save=Enregistrer
+tutti.editSampleCategoryModel.action.save.mnemonic=E
+tutti.editSampleCategoryModel.action.save.tip=Enregistrer les modifications
+tutti.editSampleCategoryModel.passwordDialog.error.message=Le mot de passe que vous avez entré est incorrect
+tutti.editSampleCategoryModel.passwordDialog.error.title=Mot de passe incorrect
+tutti.editSampleCategoryModel.passwordDialog.message=Vous souhaitez entrer dans une partie sensible de l'application
+tutti.editSampleCategoryModel.passwordDialog.title=Zone sensible
+tutti.editSampleCategoryModel.table.header.caracteristic=Caractéristique
+tutti.editSampleCategoryModel.table.header.caracteristic.tip=Caractéristique de la catégorie
+tutti.editSampleCategoryModel.table.header.label=Label
+tutti.editSampleCategoryModel.table.header.label.tip=Label de la catéogire (sera utilisée dans les entêtes de tableau)
+tutti.editSampleCategoryModel.title=Configurer les catégorisations
+tutti.editSpeciesBatch.action.addSampleCategory=Ajouter une catégorie
+tutti.editSpeciesBatch.action.addSampleCategory.mnemonic=A
+tutti.editSpeciesBatch.action.addSampleCategory.tip=Ajouter une catégorie manquante
+tutti.editSpeciesBatch.action.changeSampleCategory=Modifier la catégorie
+tutti.editSpeciesBatch.action.changeSampleCategory.mnemonic=M
+tutti.editSpeciesBatch.action.changeSampleCategory.tip=Modifier la catégorie de la cellule sélectionnée
+tutti.editSpeciesBatch.action.createBatch=Créer un lot pour une espèce
+tutti.editSpeciesBatch.action.createBatch.mnemonic=C
+tutti.editSpeciesBatch.action.createBatch.tip=Créer un nouveau lot pour une espèce
+tutti.editSpeciesBatch.action.createMelag=Espèces d'un MELAG (mélange)
+tutti.editSpeciesBatch.action.createMelag.mnemonic=C
+tutti.editSpeciesBatch.action.createMelag.tip=Calcul des poids des lots appartenant à un MELAG (mélange)
+tutti.editSpeciesBatch.action.editFrequencies=Mensurations
+tutti.editSpeciesBatch.action.editFrequencies.mnemonic=M
+tutti.editSpeciesBatch.action.editFrequencies.tip=Éditer les mensurations
+tutti.editSpeciesBatch.action.exportMultiPost=Exporter les lots d'espèces
+tutti.editSpeciesBatch.action.exportMultiPost.destinationFile.button=Choisir le fichier pour l'export
+tutti.editSpeciesBatch.action.exportMultiPost.destinationFile.title=Exporter les lots d'espèces
+tutti.editSpeciesBatch.action.exportMultiPost.mnemonic=E
+tutti.editSpeciesBatch.action.exportMultiPost.success=Les lots d'espèces ont été exportés dans le fichier %s
+tutti.editSpeciesBatch.action.exportMultiPost.tip=Exporter les lots d'espèces pour les importer sur le poste maître
+tutti.editSpeciesBatch.action.importMultiPost=Importer des lots d'espèces
+tutti.editSpeciesBatch.action.importMultiPost.mnemonic=I
+tutti.editSpeciesBatch.action.importMultiPost.sourceFile.button=Choisir le fichier à importer
+tutti.editSpeciesBatch.action.importMultiPost.sourceFile.title=Importer des lots d'espèces
+tutti.editSpeciesBatch.action.importMultiPost.success=Des lots d'espèces ont été importés depuis le fichier %s
+tutti.editSpeciesBatch.action.importMultiPost.tip=Importer des lots d'espèces créés sur un poste satellite
+tutti.editSpeciesBatch.action.importPupitri=Import Pupitri
+tutti.editSpeciesBatch.action.importPupitri.existingData.help=Que voulez-vous faire ?<ul><li><strong>Annuler</strong> pour ne pas importer les données Pupitri et conserver les espèces saisies</li><li><strong>OK</strong> pour supprimer les espèces existantes et les remplacer par les données de Pupitri</li></ul>
+tutti.editSpeciesBatch.action.importPupitri.existingData.message=Des espèces ont déjà été saisies dans la capture. Si vous continuez, elles vont être écrasées.
+tutti.editSpeciesBatch.action.importPupitri.existingData.title=Données existantes
+tutti.editSpeciesBatch.action.importPupitri.invalidSampleCategoryModel.message=<html><body>Le modèle de catégorisation n'est pas compatible pour un import pupitri.<br> Il manque les catégories suivantes \: <ul>%s</ul><hr/>Veuillez ajouter cette catégorie dans la configuration de catégorisation (menu administration).</body></html>
+tutti.editSpeciesBatch.action.importPupitri.invalidSampleCategoryModel.title=Modèle de catégorisation non compatible
+tutti.editSpeciesBatch.action.importPupitri.mnemonic=I
+tutti.editSpeciesBatch.action.importPupitri.success=Import Pupitri réussi \: %1s espèces importées, %2s espèces rejetées
+tutti.editSpeciesBatch.action.importPupitri.tip=Import Pupitri
+tutti.editSpeciesBatch.action.removeBatch=Supprimer le lot
+tutti.editSpeciesBatch.action.removeBatch.confirm.message=<html>Vous êtes sur le point de supprimer un lot d'espèces.<hr/>Êtes-vous sur de vouloir le supprimer ?</html>
+tutti.editSpeciesBatch.action.removeBatch.confirm.title=Suppression d'un lot d'espèces
+tutti.editSpeciesBatch.action.removeBatch.mnemonic=S
+tutti.editSpeciesBatch.action.removeBatch.tip=Supprimer le lot courant (celui de la ligne sélectionnée) et tous ces fils
+tutti.editSpeciesBatch.action.removeSubBatch=Supprimer les lots fils
+tutti.editSpeciesBatch.action.removeSubBatch.confirm.message=<html>Vous êtes sur le point de supprimer les fils d'un lot d'espèces.<hr/>Êtes-vous sur de vouloir les supprimer ?</html>
+tutti.editSpeciesBatch.action.removeSubBatch.confirm.title=Suppression des fils d'un lot d'espèces
+tutti.editSpeciesBatch.action.removeSubBatch.mnemonic=f
+tutti.editSpeciesBatch.action.removeSubBatch.tip=Supprimer tous les lots fils du lot sélectionné
+tutti.editSpeciesBatch.action.renameBatch=Corriger l'espèce
+tutti.editSpeciesBatch.action.renameBatch.mnemonic=o
+tutti.editSpeciesBatch.action.renameBatch.tip=Corriger l'espèce
+tutti.editSpeciesBatch.action.splitBatch=Catégoriser le lot
+tutti.editSpeciesBatch.action.splitBatch.mnemonic=C
+tutti.editSpeciesBatch.action.splitBatch.tip=Catégoriser le lot courant (celui de la ligne sélectionné)
+tutti.editSpeciesBatch.error.sampleCategoryValue.notAvailable=La valeur %s de la catégorie %s est déjà utilisée
+tutti.editSpeciesBatch.field.speciesTotalInertWeight=Poids inerte trié
+tutti.editSpeciesBatch.field.speciesTotalInertWeight.tip=Poids de la fraction inerte restante après le tri des espèces (cailloux, vase, débris coquilliers, etc.)
+tutti.editSpeciesBatch.field.speciesTotalLivingNotItemizedWeight=Poids vivant non détaillé trié
+tutti.editSpeciesBatch.field.speciesTotalLivingNotItemizedWeight.tip=Poids de la fraction vivante restante après le tri des espèces (algues, matières vivantes non reconnaissable, etc.)
+tutti.editSpeciesBatch.field.speciesTotalSampleSortedWeight=Poids VRAC trié
+tutti.editSpeciesBatch.field.speciesTotalSampleSortedWeight.tip=Poids total des espèces triées (poissons, crustacés etc.)
+tutti.editSpeciesBatch.field.speciesTotalSortedWeight=Poids total VRAC
+tutti.editSpeciesBatch.field.speciesTotalSortedWeight.tip=Poids total VRAC des espèces dans la capture (poissons, crustacés etc.)
+tutti.editSpeciesBatch.field.speciesTotalUnsortedWeight=Poids total HORS VRAC
+tutti.editSpeciesBatch.field.speciesTotalUnsortedWeight.tip=Poids total HORS VRAC des espèces dans la capture (sans les captures accidentelles)
+tutti.editSpeciesBatch.field.speciesTotalWeight=Poids TOTAL
+tutti.editSpeciesBatch.field.speciesTotalWeight.tip=Poids total des espèces dans la capture (poissons, crustacés etc.)
+tutti.editSpeciesBatch.filterBatch=Filtre
+tutti.editSpeciesBatch.filterBatch.mode.all=Aucun
+tutti.editSpeciesBatch.filterBatch.mode.all.tip=Pas de filtre (tous les lots sont visibles)
+tutti.editSpeciesBatch.filterBatch.mode.leaf=Feuilles
+tutti.editSpeciesBatch.filterBatch.mode.leaf.tip=Voir uniquement les lots *feuilles*
+tutti.editSpeciesBatch.filterBatch.mode.root=Parents (%s)
+tutti.editSpeciesBatch.filterBatch.mode.root.tip=Voir uniquement les lots *parents*
+tutti.editSpeciesBatch.filterSpeciesBatch.tip=Pour filtrer les lots
+tutti.editSpeciesBatch.split.weightNotNull.help=Que voulez-vous faire ? <ul><li><strong>Annuler</strong> pour ne pas catégoriser le lot et garder le poids sous-échantilloné</li><li><strong>OK</strong> pour catégoriser le lot et supprimer le poids sous-échantillonné</li></ul>.
+tutti.editSpeciesBatch.split.weightNotNull.message=Pour catégoriser un lot, il ne doit pas avoir de poids sous-échantillonné
+tutti.editSpeciesBatch.split.weightNotNull.title=Poids sous-échantillonné non nul
+tutti.editSpeciesBatch.table.header.comment=Commentaire
+tutti.editSpeciesBatch.table.header.computedNumber=Tailles/Poids ou Nombre
+tutti.editSpeciesBatch.table.header.file=Pièces jointes
+tutti.editSpeciesBatch.table.header.species=Espèce
+tutti.editSpeciesBatch.table.header.toConfirm=A Confirmer
+tutti.editSpeciesBatch.table.header.weight=Poids sous-échantillonné
+tutti.editSpeciesBatch.title.changeSampleCategoryValue=Changer la valeur de la catégorie %s
+tutti.editSpeciesFrequencies.action.addLengthStepCaracteristic=...
+tutti.editSpeciesFrequencies.action.addLengthStepCaracteristic.mnemonic=.
+tutti.editSpeciesFrequencies.action.addLengthStepCaracteristic.tip=Sélectionner une autre caractéristique
+tutti.editSpeciesFrequencies.action.cancel=Annuler
+tutti.editSpeciesFrequencies.action.cancel.mnemonic=A
+tutti.editSpeciesFrequencies.action.cancel.tip=Annuler l'édition des mensurations
+tutti.editSpeciesFrequencies.action.generate=Générer
+tutti.editSpeciesFrequencies.action.generate.mnemonic=G
+tutti.editSpeciesFrequencies.action.generate.tip=Générer les mensurations
+tutti.editSpeciesFrequencies.action.reset=Réinitialiser
+tutti.editSpeciesFrequencies.action.reset.mnemonic=R
+tutti.editSpeciesFrequencies.action.reset.tip=Supprimer toutes les mensurations saisies
+tutti.editSpeciesFrequencies.action.saveAndClose=Enregistrer et Fermer
+tutti.editSpeciesFrequencies.action.saveAndClose.mnemonic=F
+tutti.editSpeciesFrequencies.action.saveAndClose.tip=Enregistrer les mensurations
+tutti.editSpeciesFrequencies.action.saveAndContinue=Enregistrer et Continuer
+tutti.editSpeciesFrequencies.action.saveAndContinue.mnemonic=C
+tutti.editSpeciesFrequencies.action.saveAndContinue.tip=Enregistrer les mensurations et saisir les mensurations pour le lot suivant
+tutti.editSpeciesFrequencies.error.length.doublon=La classe de taille <strong>%s</strong> est utilisée plusieurs fois (deuxième occurrence trouvée à la ligne <strong>%s</strong>), ce qui n'est pas autorisé.<hr/>Veuillez corriger cela pour pouvoir enregistrer les mensurations.
+tutti.editSpeciesFrequencies.field.lengthStepCaracteristic=Type de mesure
+tutti.editSpeciesFrequencies.field.lengthStepCaracteristic.tip=Méthode de mensuration des individus
+tutti.editSpeciesFrequencies.field.maxStep=Classe max
+tutti.editSpeciesFrequencies.field.maxStep.tip=Taille maximale mesurée
+tutti.editSpeciesFrequencies.field.minStep=Classe min
+tutti.editSpeciesFrequencies.field.minStep.tip=Taille minimale mesurée
+tutti.editSpeciesFrequencies.field.mode.autoGen=Génération des classes
+tutti.editSpeciesFrequencies.field.mode.autoGen.tip=Mode où toutes les classes de taille sont générées
+tutti.editSpeciesFrequencies.field.mode.rafale=Mode "rafale"
+tutti.editSpeciesFrequencies.field.mode.rafale.tip=Mode où on ne saisit uniquement la classe de taille (les nombres seront alors incrémentés...)
+tutti.editSpeciesFrequencies.field.mode.simple=Mode simple
+tutti.editSpeciesFrequencies.field.mode.simple.tip=Mode par défaut on on doit tout saisir (les classes de tailles et les nombres)
+tutti.editSpeciesFrequencies.field.mode.simpleCounting=Mode simple dénombrement
+tutti.editSpeciesFrequencies.field.mode.simpleCounting.tip=Mode par défaut si la classe de taille n'est pas renseignée dans le protocole.
+tutti.editSpeciesFrequencies.field.rafaleStep=Classe de taille à incrémenter
+tutti.editSpeciesFrequencies.field.rafaleStep.tip=Saisir à la suite les différentes tailles mesurées
+tutti.editSpeciesFrequencies.field.rows=Classes de taille
+tutti.editSpeciesFrequencies.field.simpleCounting=Nombre
+tutti.editSpeciesFrequencies.field.simpleCounting.tip=Saisir le nombre d'individus dans le lot
+tutti.editSpeciesFrequencies.field.step=Pas de la classe de taille
+tutti.editSpeciesFrequencies.field.step.tip=Pas de la classe de taille pour cette espèce (ex. \: 1 cm, 0,5 cm, 1 mm etc.)
+tutti.editSpeciesFrequencies.field.totalNumber=Nombre total
+tutti.editSpeciesFrequencies.field.totalNumber.tip=Nombre total d'individus des lignes valides
+tutti.editSpeciesFrequencies.field.totalWeight=Poids total
+tutti.editSpeciesFrequencies.field.totalWeight.tip=Poids total des lignes valides
+tutti.editSpeciesFrequencies.label.no.configuration=< Pas de configuration >
+tutti.editSpeciesFrequencies.simpleCountingAndFrequencies=Des mensurations ont été saisies dans le tableau. Saisir un simple dénombrement les effacera.
+tutti.editSpeciesFrequencies.table.header.lengthStep=Classe de taille
+tutti.editSpeciesFrequencies.table.header.number=Nombre
+tutti.editSpeciesFrequencies.table.header.weight=Poids observé
+tutti.editSpeciesFrequencies.title=Mensuration
+tutti.error.about.could.not.reach.url=Récupération des versions de mises à jour impossible (l'url <strong>%s</strong> n'est pas joignable)
+tutti.error.delete.startActionFile=Impossible de supprimer le fichier %s
+tutti.error.errorpane.htmlmessage=<html><body><b>Une erreur s'est produite</b>\:<br/>%s</body></html>
+tutti.error.read.startActionFile=Impossible de lire le contenu du fichier %s
+tutti.error.update.bad.url.syntax=Mise à jour impossible (le format de l'url <strong>%s</strong> n'est pas valide)
+tutti.error.update.could.not.found.url=Mise à jour impossible (l'url <strong>%s</strong> n'existe pas)
+tutti.error.update.could.not.reach.url=Mise à jour impossible (l'url <strong>%s</strong> n'est pas joignable)
+tutti.error.write.startActionFile=impossible d'écrire dans le fichier %s
+tutti.exportCruise.action.exportErrors=Des erreurs sont apparues pendant l'élévation des poids de la campagne <strong>%s</strong>.<br/>L'export a cependant été réalisé.<hr/>Erreur(s) rencontrée(s) \: <br/>%s
+tutti.exportCruise.action.success=La campagne <strong>%s</strong> a été exportée dans le fichier <strong>%s</strong>.
+tutti.exportCruiseForSumatra.action.chooseFile=Choisir le fichier d'export
+tutti.exportCruiseForSumatra.action.success=La campagne sélectionnée a été exportée dans le fichier <strong>%s</strong>
+tutti.exportCruiseForSumatra.title.choose.exportFile=Exporter la campagne
+tutti.exportDb.step.closeDb=Fermeture de la base courante
+tutti.exportDb.step.createArchive=Création de l'archive %s
+tutti.exportDb.step.openDb=Réouverture de la base courante
+tutti.exportDb.step.reloadApplication=Redémarrage de l'application
+tutti.exportFishingOperationForSumatra.action.chooseFile=Choisir le fichier d'export
+tutti.exportFishingOperationForSumatra.action.success=Le trait a été exporté dans le fichier <strong>%s</strong>
+tutti.exportFishingOperationForSumatra.title.choose.exportFile=Exporter le trait de la campagne
+tutti.exportFishingOperationReport.action.chooseFile=Choisir le fichier de rapport
+tutti.exportFishingOperationReport.action.success=Le trait a été exporté dans le fichier <strong>%s</strong>
+tutti.exportFishingOperationReport.title.choose.exportFile=Exporter le trait de la campagne
+tutti.exportProgram.action.exportErrors=Des erreurs sont apparues pendant l'élévation des poids d'une campagne de la série <strong>%s</strong>.<br/>L'export a cependant été réalisé.<hr/>Erreur(s) rencontrée(s) \: <br/>%s
+tutti.exportProgram.action.success=La série de campagne <strong>%s</strong> a été exportée dans le fichier <strong>%s</strong>.
+tutti.exportProtocol.action.success=Protocole [%1s] exporté dans le fichier <strong>%2s</strong>.
+tutti.fishingOperations.action.deleteFishingOperation.mnemonic=S
+tutti.fishingOperations.action.deleteFishingOperation.tip=Supprimer l'opération de pêche sélectionnée
+tutti.fishingOperations.action.newFishingOperation.mnemonic=N
+tutti.fishingOperations.action.newFishingOperation.tip=Créer une nouvelle opération de pêche
+tutti.fishingOperations.info.no.fishingOperation.selected=< Aucun trait sélectionné >
+tutti.fishingOperations.title.edit.operations=Saisie des opérations de pêches (%s)
+tutti.fishingOperations.title.validate.operations=Validation des opérations de pêches (%s)
+tutti.fishingOperations.warn.catchBatch.invalidSampleCategoryModel=L'arbre d’échantillonnage n'est pas compatible (utilisation de catégories non configurées ou dans un mauvais ordre). Les captures ne seront pas visibles.
+tutti.fishingOperations.warn.catchBatch.notFound=Pas d'arbre d’échantillonnage associé à l'opération de pêche.
+tutti.fishingOperations.warn.invalid.batch.model=L'arbre d’échantillonnage n'est pas compatible. Les captures ne seront pas visibles.
+tutti.flash.info.all.caractristic.exported=Toutes les caractéristiques exportées dans le fichier <strong>%s</strong>.
+tutti.flash.info.benthos.add.to.protocol=Le benthos <strong>%s</strong> a été ajoutée au protocole.
+tutti.flash.info.benthos.imported.in.protocol=Benthos importés dans le protocole depuis le fichier <strong>%s</strong>.
+tutti.flash.info.benthos.imported.in.protocol.oneReplaced=Benthos importés dans le protocole depuis le fichier <strong>%s</strong>. 1 remplacée par son référent.
+tutti.flash.info.benthos.imported.in.protocol.severalReplaced=Benthos importés dans le protocole depuis le fichier <strong>%s</strong>. %s remplacées par leur référent.
+tutti.flash.info.benthos.remove.from.protocol=Les benthos ont été retirés du protocole.
+tutti.flash.info.benthos.replaced=Le benthos <strong>%s</strong> a été remplacé par son référent <strong>%s</strong>.
+tutti.flash.info.caracteristic.imported.in.protocol=Caractéristiques importées dans le protocole depuis le fichier <strong>%s</strong>.
+tutti.flash.info.caractristic.exported.from.protocol=Caractéristiques du protocole exportées dans le fichier <strong>%s</strong>.
+tutti.flash.info.cruiseCreated=La campagne <strong>%s</strong> a été créée.
+tutti.flash.info.cruiseSaved=La campagne <strong>%s</strong> a été enregistrée.
+tutti.flash.info.db.closed=La base <strong>%s</strong> est fermée.
+tutti.flash.info.db.exported=Base exportée dans l'archive <strong>%s</strong>.
+tutti.flash.info.db.exported.and.clean=Base exportée dans l'archive <strong>%s</strong>.
+tutti.flash.info.db.imported=La base de données <strong>%s</strong> est importée.
+tutti.flash.info.db.imported.but.closed=La base de données <strong>%s</strong> est importée mais n'a pas été ouverte.
+tutti.flash.info.db.not.opened=La base <strong>%s</strong> n'a pas été ouverte.
+tutti.flash.info.db.opened=La base de données <strong>%s</strong> est ouverte.
+tutti.flash.info.db.schema.updated=Le schéma de la base (version %s) a été mise à jour vers la version %s
+tutti.flash.info.programCreated=La série de campagne <strong>%s</strong> a été créée.
+tutti.flash.info.programSaved=La série de campagne <strong>%s</strong> a été enregistrée.
+tutti.flash.info.protocolCreated=Le protocole <strong>%s</strong> a été créé.
+tutti.flash.info.protocolSaved=Le protocole <strong>%s</strong> a été enregistré.
+tutti.flash.info.species.add.to.protocol=L'espèce <strong>%s</strong> a été ajoutée au protocole.
+tutti.flash.info.species.exported.from.protocol=Espèces du protocole exportées dans le fichier <strong>%s</strong>.
+tutti.flash.info.species.imported.in.protocol=Espèces importées dans le protocole depuis le fichier <strong>%s</strong>.
+tutti.flash.info.species.imported.in.protocol.oneReplaced=Espèces importées dans le protocole depuis le fichier <strong>%s</strong>. 1 remplacée par son référent.
+tutti.flash.info.species.imported.in.protocol.severalReplaced=Espèces importées dans le protocole depuis le fichier <strong>%s</strong>. %s remplacées par leur référent.
+tutti.flash.info.species.remove.from.protocol=Les espèces ont été retirées du protocole.
+tutti.flash.info.species.replaced=L'espèce <strong>%s</strong> a été remplacée par son référent <strong>%s</strong>.
+tutti.gear.noCaracteristics=Pas de caractéristiques.
+tutti.gear.withCaracteristics=Caractéristiques de l'engin %s
+tutti.gearCaracteristicsEditorTable.table.header.key=Caractéristique
+tutti.gearCaracteristicsEditorTable.table.header.value=Valeur
+tutti.gearUseFeatureTable.action.removeCaracteristic=Supprimer
+tutti.gearUseFeatureTable.action.removeCaracteristic.mnemonic=S
+tutti.gearUseFeatureTable.action.removeCaracteristic.tip=Supprimer la caractéristique
+tutti.gearUseFeatureTable.table.header.key=Caractéristique
+tutti.gearUseFeatureTable.table.header.value=Valeur
+tutti.gearUseFeatureTable.title=Mise en œuvre de l'engin
+tutti.help.mkDir.error=Erreur à la création du dossier d'aide
+tutti.i18n.deleteCache.error=Erreur à la suppression du cache de l'internationalisation
+tutti.i18n.mkDir.error=Erreur à la création du dossier d'internationalisation
+tutti.importDb.step.check.dbContext=Vérification du context de saisie
+tutti.importDb.step.checkSchemaVersion=Vérification de la version de la base
+tutti.importDb.step.closeDb=Fermeture de la base
+tutti.importDb.step.openDb=Ouverture de la base de données <strong>%s</strong>
+tutti.importDb.step.unzipArchive=Décompression de l'archive
+tutti.importDb.step.will.migrateSchema=Démarrage de la mise à jour du schéma de la base depuis la version %s vers la version %s
+tutti.importProtocol.action.success=Protocole [%s] lu depuis le fichier.
+tutti.importPupitri.carrouselFile.extension=car
+tutti.importPupitri.carrouselFile.extension.description=Fichier du carrousel (.car)
+tutti.importPupitri.error.fileMissing.message=Vous devez sélectionner un fichier pour le trémie et un fichier pour le carrousel pour pouvoir continuer l'import.
+tutti.importPupitri.error.fileMissing.title=Fichier non renseigné
+tutti.importPupitri.field.carrouselFile=Fichier du carrousel
+tutti.importPupitri.field.trunkFile=Fichier du trémie
+tutti.importPupitri.title=Import Pupitri
+tutti.importPupitri.trunkFile.extension=tnk
+tutti.importPupitri.trunkFile.extension.description=Fichier du trémie (.tnk)
+tutti.io.deleteTempDirectory.error=Erreur lors de la suppression du dossier temporaire
+tutti.io.mkDir.error=Erreur à la création du dossier %s
+tutti.label.tab.accidental=Captures accidentelles
+tutti.label.tab.benthos=Benthos
+tutti.label.tab.catches=Captures
+tutti.label.tab.catchesCaracteristics=Résumé
+tutti.label.tab.fishingOperation=Trait
+tutti.label.tab.individualObservations=Observations individuelles
+tutti.label.tab.marineLitter=Macro déchets
+tutti.label.tab.species=Espèces
+tutti.main.action.about=À propos
+tutti.main.action.about.mnemonic=À
+tutti.main.action.about.tip=À Propos
+tutti.main.action.changeLocale.mnemonic=l
+tutti.main.action.changeLocale.tip=Changer de langue
+tutti.main.action.changeLocaleFR=Français
+tutti.main.action.changeLocaleFR.mnemonic=F
+tutti.main.action.changeLocaleFR.tip=Passer en français
+tutti.main.action.changeLocaleUK=Anglais
+tutti.main.action.changeLocaleUK.mnemonic=A
+tutti.main.action.changeLocaleUK.tip=Passer en anglais
+tutti.main.action.configuration=Configuration
+tutti.main.action.configuration.mnemonic=C
+tutti.main.action.configuration.tip=Configurer l'application
+tutti.main.action.editCatches=Saisir les captures
+tutti.main.action.editCatches.mnemonic=S
+tutti.main.action.editCatches.tip=Éditer les captures
+tutti.main.action.editProgram.tip=Éditer la série de campagne
+tutti.main.action.editSampleCategoryModel=Configurer les catégorisations
+tutti.main.action.editSampleCategoryModel.mnemonic=o
+tutti.main.action.editSampleCategoryModel.tip=Configurer les catégorisations possibles
+tutti.main.action.editSelectedCruise=Campagne
+tutti.main.action.editSelectedCruise.mnemonic=C
+tutti.main.action.editSelectedCruise.tip=Éditer la campagne sélectionnée
+tutti.main.action.editSelectedProgram=Série de campagne
+tutti.main.action.editSelectedProgram.mnemonic=S
+tutti.main.action.editSelectedProtocol=Protocole
+tutti.main.action.editSelectedProtocol.mnemonic=P
+tutti.main.action.editSelectedProtocol.tip=Éditer le protocole sélectionné
+tutti.main.action.exit=Quitter
+tutti.main.action.exit.mnemonic=Q
+tutti.main.action.exit.tip=Quitter l'application
+tutti.main.action.goto.previousScreen.tip=Retour à l'écran précédent
+tutti.main.action.importTemporaryReferential=Référentiels temporaires
+tutti.main.action.importTemporaryReferential.mnemonic=R
+tutti.main.action.importTemporaryReferential.tip=Importer des référentiels temporaires
+tutti.main.action.manageDb=Gestionnaire de base
+tutti.main.action.manageDb.mnemonic=G
+tutti.main.action.manageDb.tip=Gérer la base de données utilisée par l'application
+tutti.main.action.reloadTutti=Redémarrer l'application
+tutti.main.action.report=Rapport
+tutti.main.action.report.mnemonic=R
+tutti.main.action.report.tip=Générer des rapports
+tutti.main.action.selectCruise=Sélectionner une campagne
+tutti.main.action.selectCruise.mnemonic=S
+tutti.main.action.selectCruise.tip=Sélectionner la campagne à utiliser
+tutti.main.action.showHelp=Aide
+tutti.main.action.showHelp.mnemonic=i
+tutti.main.action.showHelp.tip=Accéder à l'aide de l'application
+tutti.main.action.site=Site
+tutti.main.action.site.mnemonic=S
+tutti.main.action.site.tip=Accéder au site du projet Tutti (développement de l'application)
+tutti.main.action.updateApplication=Vérifier les mises à jour logiciels
+tutti.main.action.updateApplication.mnemonic=V
+tutti.main.action.updateApplication.tip=Vérifier les mises à jour logicielles
+tutti.main.action.updateReport=Vérifier les mises à jour des rapports
+tutti.main.action.updateReport.mnemonic=R
+tutti.main.action.updateReport.tip=Vérifier les mises à jour des rapports
+tutti.main.action.updateSpecificApplication.tip=Mettre à jour le module <strong>%s</strong>
+tutti.main.action.validateCatches=Valider les captures
+tutti.main.action.validateCatches.mnemonic=V
+tutti.main.action.validateCatches.tip=Valider les captures
+tutti.main.menu.actions=Actions
+tutti.main.menu.actions.mnemonic=c
+tutti.main.menu.actions.tip=Actions
+tutti.main.menu.administration=Administration
+tutti.main.menu.administration.mnemonic=d
+tutti.main.menu.administration.tip=Administrer l'application
+tutti.main.menu.changeLocale=Langue
+tutti.main.menu.file=Fichier
+tutti.main.menu.file.mnemonic=h
+tutti.main.menu.file.tip=Fichier
+tutti.main.menu.help=Aide
+tutti.main.menu.help.mnemonic=A
+tutti.main.menu.help.tip=Aide
+tutti.main.title.action=Allegro Campagne - v %s [%s]
+tutti.main.title.application=Allegro Campagne - v %s [%s]
+tutti.main.title.applicationName=Tutti
+tutti.main.title.noSelectedCruise=Pas de campagne sélectionné
+tutti.main.title.noSelectedProgram=Pas de série de campagne sélectionné
+tutti.main.title.noSelectedProtocol=Pas de protocole sélectionné
+tutti.main.title.nodb=Pas de base chargée
+tutti.main.title.selectedCruise=Campagne %s
+tutti.main.title.selectedProgram=Série de campagne %s
+tutti.main.title.selectedProtocol=Protocole %s
+tutti.manageTemporaryReferential.action.chooseReferentialGearFile.export=Exporter
+tutti.manageTemporaryReferential.action.chooseReferentialGearFile.export.success=Exemple de référentiel temporaire d'engins exporté dans le fichier %s
+tutti.manageTemporaryReferential.action.chooseReferentialGearFile.import=Importer
+tutti.manageTemporaryReferential.action.chooseReferentialGearFile.import.success=Référentiel temporaire d'engins importé depuis le fichier %s
+tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.export=Exporter
+tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.export.success=Exemple de référentiel temporaire de personnes exporté dans le fichier %s
+tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.import=Importer
+tutti.manageTemporaryReferential.action.chooseReferentialPersonFile.import.success=Référentiel temporaire de personnes importé depuis le fichier %s
+tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.export=Exporter
+tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.export.success=Exemple de référentiel temporaire d'espèces exporté dans le fichier %s
+tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.import=Importer
+tutti.manageTemporaryReferential.action.chooseReferentialSpeciesFile.import.success=Référentiel temporaire d'espèces importé depuis le fichier %s
+tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.export=Exporter
+tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.export.success=Exemple de référentiel temporaire de navires exporté dans le fichier %s
+tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.import=Importer
+tutti.manageTemporaryReferential.action.chooseReferentialVesselFile.import.success=Référentiel temporaire de navires importé depuis le fichier %s
+tutti.manageTemporaryReferential.action.exportTemporaryGearExample=Exporter
+tutti.manageTemporaryReferential.action.exportTemporaryGearExample.tip=Exporter un exemple de référentiel Engin
+tutti.manageTemporaryReferential.action.exportTemporaryPersonExample=Exporter
+tutti.manageTemporaryReferential.action.exportTemporaryPersonExample.tip=Exporter un exemple de référentiel Personne
+tutti.manageTemporaryReferential.action.exportTemporarySpeciesExample=Exporter
+tutti.manageTemporaryReferential.action.exportTemporarySpeciesExample.tip=Exporter un exemple de référentiel Espèces
+tutti.manageTemporaryReferential.action.exportTemporaryVesselExample=Exporter
+tutti.manageTemporaryReferential.action.exportTemporaryVesselExample.tip=Exporter un exemple de référentiel Navire
+tutti.manageTemporaryReferential.action.importTemporaryGear=Importer
+tutti.manageTemporaryReferential.action.importTemporaryGear.tip=Importer un référentiel temporaire d'engins
+tutti.manageTemporaryReferential.action.importTemporaryPerson=Importer
+tutti.manageTemporaryReferential.action.importTemporaryPerson.tip=Importer un référentiel temporaire de personnes
+tutti.manageTemporaryReferential.action.importTemporarySpecies=Importer
+tutti.manageTemporaryReferential.action.importTemporarySpecies.tip=Importer un référentiel temporaire d'espèces
+tutti.manageTemporaryReferential.action.importTemporaryVessel=Importer
+tutti.manageTemporaryReferential.action.importTemporaryVessel.tip=Importer un référentiel temporaire de navires
+tutti.manageTemporaryReferential.field.gear=Référentiel Engin
+tutti.manageTemporaryReferential.field.gear.tip=Gestion du référentiel temporaire pour les engins
+tutti.manageTemporaryReferential.field.person=Référentiel Personne
+tutti.manageTemporaryReferential.field.person.tip=Gestion du référentiel temporaire pour les personnes
+tutti.manageTemporaryReferential.field.species=Référentiel Espèce
+tutti.manageTemporaryReferential.field.species.tip=Gestion du référentiel temporaire pour les espèces
+tutti.manageTemporaryReferential.field.vessel=Référentiel Navire
+tutti.manageTemporaryReferential.field.vessel.tip=Gestion du référentiel temporaire pour les navires
+tutti.manageTemporaryReferential.passwordDialog.error.message=Le mot de passe que vous avez entré est incorrect
+tutti.manageTemporaryReferential.passwordDialog.error.title=Mot de passe incorrect
+tutti.manageTemporaryReferential.passwordDialog.message=Vous souhaitez entrer dans une partie sensible de l'application
+tutti.manageTemporaryReferential.passwordDialog.title=Zone sensible
+tutti.manageTemporaryReferential.title=importer des référentiels temporaires
+tutti.manageTemporaryReferential.title.choose.exportTemporaryGearExampleFile=Exporter un exemple de référentiel Engin
+tutti.manageTemporaryReferential.title.choose.exportTemporaryPersonExampleFile=Exporter un exemple de référentiel Personne
+tutti.manageTemporaryReferential.title.choose.exportTemporarySpeciesExampleFile=Exporter un exemple de référentiel Espèce
+tutti.manageTemporaryReferential.title.choose.exportTemporaryVesselExampleFile=Exporter un exemple de référentiel Navire
+tutti.manageTemporaryReferential.title.choose.importTemporaryGearFile=Importer un référentiel Engin
+tutti.manageTemporaryReferential.title.choose.importTemporaryPersonFile=Importer un référentiel Personne
+tutti.manageTemporaryReferential.title.choose.importTemporarySpeciesFile=Importer un référentiel Espèce
+tutti.manageTemporaryReferential.title.choose.importTemporaryVesselFile=Importer un référentiel Navire
+tutti.message.action.running=<html>Action <strong>%s</strong> en cours d'exécution...</html>
+tutti.multiPostImportLog.close=Fermer
+tutti.multiPostImportLog.close.mnemonic=F
+tutti.multiPostImportLog.close.tip=Fermer la popup
+tutti.multiPostImportLog.inertWeight=Poids inerte trié \: %s kg
+tutti.multiPostImportLog.livingNotItemizedWeight=Poids vivant non détaillé \: %s kg
+tutti.multiPostImportLog.message=Des données n'ont pas été importées car ces données avaient déjà été saisies \:
+tutti.multiPostImportLog.title=Lots non importés
+tutti.multiPostImportLog.totalSortedWeight=Poids total trié \: %s kg
+tutti.multiPostImportLog.totalWeight=Poids total \: %s kg
+tutti.openDb.step.check.dbContext=Vérification du context de saisie
+tutti.openDb.step.checkSchemaVersion=Vérification de la compatibilité de la base
+tutti.openDb.step.open=Ouverture de la base <strong>%s</strong>
+tutti.openDb.step.updateReferential=
+tutti.openDb.step.will.migrateSchema=Démarrage de la mise à jour du schéma de la base depuis la version %s vers la version %s
+tutti.option.cancel=Annuler
+tutti.option.cleanAndClone=Nettoyer et Cloner
+tutti.option.cleanAndEdit=Nettoyer et Éditer
+tutti.option.cleanAndImport=Nettoyer et Importer
+tutti.option.clone=Cloner
+tutti.option.edit=Éditer
+tutti.option.import=Importer
tutti.persistence.attachment.copyFile.error=Erreur lors de la copie de la pièce jointe %1s dans le fichier %2s
tutti.persistence.attachment.deleteFile.error=Erreur lors de la suppression de la pièce jointe %s
tutti.persistence.batch.validation.bad.sample.categories=Il existe des lots avec des catégories d'échantillon non compatible avec le modèle configuré \:<br/> %s
@@ -46,7 +1466,6 @@
tutti.persistence.error.no.convertor=Impossible de convertir en modeèle de catégorie le type %s avec la valeur %s
tutti.persistence.error.protocol.categories.not.compatible=Le protocole utilise des catégories non connues par la configuration des catégorisations \: <ul>%s</ul>
tutti.persistence.loader.error=Erreur de conversion du dossier %s en URL
-tutti.persistence.mkDir.error=Erreur lors de la création du dossier %s
tutti.persistence.protocol.delete.error=Erreur lors de la suppression du protocole %1s (fichier %2s)
tutti.persistence.protocol.fromFile.error=Erreur lors de l'import du protocole du fichier %s
tutti.persistence.synchronizeReferential.prepare.step1=Connexion à la base de synchronisation
@@ -57,3 +1476,400 @@
tutti.persistence.synchronizeReferential.synchronize.step2=Sauvegarde des données dans la base locale
tutti.persistence.synchronizeReferential.synchronizeTable=Mise à jour de la table %s
tutti.persistence.tableMetadata.instanciation.error=Erreur à l'initialisation de %s
+tutti.property.attachment=Pièce jointe
+tutti.property.caracteristic=Caractéristique
+tutti.property.country=Pays
+tutti.property.cruise=Campagne
+tutti.property.date=Date
+tutti.property.department=Département
+tutti.property.firstName=Prénom
+tutti.property.fishingOperation=Trait
+tutti.property.fishingOperationLocation=Lieu
+tutti.property.fishingOperationNumber=Numéro de trait
+tutti.property.fractionName=Fraction
+tutti.property.gear=Engin
+tutti.property.gearShootingStartDate=Date de début de traîne
+tutti.property.genusSpecies=Nom scientifique
+tutti.property.internationalRegistrationCode=Immatriculation internationale (ou nationale si non trouvée)
+tutti.property.label=Code
+tutti.property.lastName=Nom de Famille
+tutti.property.marineLitterCategory=Type de macro déchet
+tutti.property.matrixName=Support
+tutti.property.methodName=Méthode
+tutti.property.multirigAggregation=Numéro de poche
+tutti.property.name=Nom
+tutti.property.parameterName=Paramètre
+tutti.property.person=Personne
+tutti.property.program=Série de campagne
+tutti.property.protocol=Protocole de saisie
+tutti.property.rankOrder=Numéro d'ordre
+tutti.property.refTaxCode=Code RefTax
+tutti.property.set.error=Propriété %1s non trouvée sur l'objet de type %2s
+tutti.property.sortedUnsortedCategory=Vrac / Hors Vrac
+tutti.property.species=Espèce
+tutti.property.stationNumber=Numéro de station
+tutti.property.strata=Strate d'association
+tutti.property.surveyCode=Code campagne
+tutti.property.surveycode=
+tutti.property.tuttiLocation=Lieu
+tutti.property.user=Utilisateur
+tutti.property.vessel=Navire
+tutti.property.zone=Zone
+tutti.propety.no.species.speciesCode=\#
+tutti.propety.no.vessel.name=Nom inconnu
+tutti.propety.no.zone=Pas de zone
+tutti.propety.vessel.nation.registrationCode=%s (nat.)
+tutti.reimport.step.backupDb=Sauvegarde de la base dans l'archive %s
+tutti.reimport.step.closeDb=Fermeture de la base
+tutti.reimport.step.reloadApplication=Redémarrage de l'application...
+tutti.reinstallDb.step.backupDb=Sauvegarde de la base dans l'archive %s
+tutti.reinstallDb.step.closeDb=Fermeture de la base <strong>%s</strong>
+tutti.reinstallDb.step.reloadApplication=Redémarrage de l'application...
+tutti.report.action.cancel=Quitter
+tutti.report.action.cancel.mnemonic=Q
+tutti.report.action.cancel.tip=Quitter l'écran
+tutti.report.action.generate=Générer
+tutti.report.action.generate.mnemonic=G
+tutti.report.action.generate.tip=Générer le rapport
+tutti.report.action.showOutputFile=Voir
+tutti.report.action.showOutputFile.mnemonic=V
+tutti.report.action.showOutputFile.tip=Voir le rapport
+tutti.report.field.inputFile=Fichier de données
+tutti.report.field.inputFile.tip=Chemin vers le fichier de données
+tutti.report.field.outputFile=Rapport
+tutti.report.field.outputFile.tip=Chemin où générer le rapport
+tutti.report.field.report=Modèle
+tutti.report.field.report.tip=Modèle de rapport à générer
+tutti.report.generated=Le rapport a été généré dans le fichier <strong>%s</strong>
+tutti.report.title=Rapports
+tutti.selectBenthos.title=Choisissez une espèce du benthos
+tutti.selectCruise.action.chooseCruiseExportFile=Exporter
+tutti.selectCruise.action.chooseProgramExportFile=Exporter
+tutti.selectCruise.action.cloneProtocol=Cloner
+tutti.selectCruise.action.cloneProtocol.tip=Dupliquer le protocole sélectionné
+tutti.selectCruise.action.deleteProtocol=Supprimer
+tutti.selectCruise.action.deleteProtocol.message=Vous êtes sur le point de supprimer le protocole <strong>%s</strong>
+tutti.selectCruise.action.deleteProtocol.tip=Supprimer le protocole sélectionné
+tutti.selectCruise.action.deleteProtocol.title=Supprimer le protocole sélectionné
+tutti.selectCruise.action.editCatches=Saisir les captures
+tutti.selectCruise.action.editCatches.mnemonic=S
+tutti.selectCruise.action.editCatches.tip=Ouvrir les écrans de saisie des captures
+tutti.selectCruise.action.editCruise=Éditer
+tutti.selectCruise.action.editCruise.tip=Éditer la campagne sélectionnée
+tutti.selectCruise.action.editProgram=Éditer
+tutti.selectCruise.action.editProgram.tip=Éditer le programme sélectionné
+tutti.selectCruise.action.editProtocol=Éditer
+tutti.selectCruise.action.editProtocol.tip=Éditer le protocole sélectionné
+tutti.selectCruise.action.exportCruise=Exporter
+tutti.selectCruise.action.exportCruise.tip=Exporter la campagne sélectionnée
+tutti.selectCruise.action.exportCruiseForSumatra=Sumatra
+tutti.selectCruise.action.exportCruiseForSumatra.tip=Exporter la campagne sélectionnée pour Sumatra
+tutti.selectCruise.action.exportProgram=Exporter
+tutti.selectCruise.action.exportProgram.tip=Exporter la série sélectionnée
+tutti.selectCruise.action.exportProtocol=Exporter
+tutti.selectCruise.action.exportProtocol.tip=Exporter le protocole sélectionné
+tutti.selectCruise.action.importProtocol=Importer
+tutti.selectCruise.action.importProtocol.tip=Importer un protocole
+tutti.selectCruise.action.newCruise=Nouveau
+tutti.selectCruise.action.newCruise.tip=Créer une nouvelle campagne
+tutti.selectCruise.action.newProgram=Nouveau
+tutti.selectCruise.action.newProgram.tip=Créer une nouvelle série de campagne
+tutti.selectCruise.action.newProtocol=Nouveau
+tutti.selectCruise.action.newProtocol.tip=Créer un nouveau protocole
+tutti.selectCruise.action.sendCruiseReport=Envoyer
+tutti.selectCruise.action.sendCruiseReport.tip=Envoyer le rapport de la campagne
+tutti.selectCruise.action.validateCatches=Valider les captures
+tutti.selectCruise.action.validateCatches.mnemonic=V
+tutti.selectCruise.action.validateCatches.tip=Lancer le processus de validation des données
+tutti.selectCruise.field.cruise=Campagne
+tutti.selectCruise.field.cruise.tip=Nom de la campagne
+tutti.selectCruise.field.program=Série de campagne
+tutti.selectCruise.field.program.tip=Nom de la série de campagne
+tutti.selectCruise.field.protocol=Protocole de saisie
+tutti.selectCruise.field.protocol.tip=Nom du protocole de saisie
+tutti.selectCruise.title=Sélection de la campagne
+tutti.selectCruise.title.choose.exportCruiseFile=Exporter une campagne
+tutti.selectCruise.title.choose.exportFile=Exporter le protocole
+tutti.selectCruise.title.choose.exportProgramFile=Exporter une série de campagne
+tutti.selectCruise.title.choose.importFile=Importer le protocole
+tutti.selectCruise.warn.invalid.selected.data=Les données sélectionnées ne sont pas valides, impossible de saisir ou valider les captures.
+tutti.selectSpecies.action.cancel=Annuler
+tutti.selectSpecies.action.cancel.mnemonic=A
+tutti.selectSpecies.action.cancel.tip=Annuler la sélection de l'espèce
+tutti.selectSpecies.action.validate=Valider
+tutti.selectSpecies.action.validate.mnemonic=V
+tutti.selectSpecies.action.validate.tip=Valider la sélection de l'espèce
+tutti.selectSpecies.title=Choisissez une espèce
+tutti.sendCruiseReport.action.chooseFile=Choisir le fichier de rapport
+tutti.sendCruiseReport.action.error.mail.message=<html>Le client email n'a pas pu être ouvert.<hr/>Vous pouvez ouvrir manuellement votre client email et ajouter le fichier<br/><em>%s</em><br/>en pièce-jointe.</html>
+tutti.sendCruiseReport.action.error.mail.title=Impossible d'ouvrir le client d'email
+tutti.sendCruiseReport.action.success=Les captures ont correctement été exporté dans le fichier <strong>%s</strong>
+tutti.sendCruiseReport.mail.body=Bonjour,\n\nVeuillez trouver ci-joint le rapport des captures de la campagne %1s.\n*Pensez à joindre le fichier %2s*\n\nCordialement,\n\n*Votre nom*
+tutti.sendCruiseReport.mail.subject=Captures de la campagne %s
+tutti.sendCruiseReport.title.choose.exportFile=Envoyer les captures de la campagne
+tutti.service.compressZipFile.error=Erreur lors de la compression du dossier %1s dans le fichier %2s
+tutti.service.context.serviceInstanciation.error=Erreur lors de l'instanciation du service %s
+tutti.service.csv.parse.entityNotFound=L'entité de type %1s avec la propriété %2s de valeur %3s n'a pas été trouvée
+tutti.service.cvs.format.error=Erreur lors du formatage de la valeur %s
+tutti.service.cvs.mandatory.value=Valeur obligatoire
+tutti.service.export.catches.error=Erreur lors de l'export des captures
+tutti.service.export.closeContext.error=Erreur lors de la fermeture du contexte d'export
+tutti.service.export.context.error=Erreur lors de la création des fichiers pour l'export
+tutti.service.export.invalid.cruise=Erreur d'élévation de poids sur les traits de la campagne %s \:<ul>%s</ul>
+tutti.service.export.invalid.fishingOperation=<li>L'élévation des poids ne peut pas être réalisée sur le trait %s, pour la raison suivante \:<ul><li>%s</li></ul></li>
+tutti.service.export.operations.error=Erreur lors de l'export des traits
+tutti.service.export.parameters.error=Erreur lors de l'export des paramètres
+tutti.service.export.survey.error=Erreur lors de l'export de la campagne
+tutti.service.export.zip.error=Erreur lors de la création du zip d'export %s
+tutti.service.exportCruise.buildZip=Création de l'archive de l'export (fichier %s)
+tutti.service.exportCruise.checkCruise=Vérification de la campagne %s
+tutti.service.exportCruise.exportAccidentalCatches=<html>Export du fichier <strong>accidentalCatch.csv</strong> pour la campagne %s</html>
+tutti.service.exportCruise.exportCatches=<html>Export du fichier <strong>catch.csv</strong> pour la campagne %s</html>
+tutti.service.exportCruise.exportGearCaracteristics=<html>Export du fichier <strong>gearCaracteristics.csv</strong> pour la campagne %s</html>
+tutti.service.exportCruise.exportIndividualObservations=<html>Export du fichier <strong>individualObservation.csv</strong> pour la campagne %s</html>
+tutti.service.exportCruise.exportMarineLitters=<html>Export du fichier <strong>marineLitter.csv</strong> pour la campagne %s</html>
+tutti.service.exportCruise.exportOperations=<html>Export du fichier <strong>operations.csv</strong> pour la campagne %s</html>
+tutti.service.exportCruise.exportParameters=<html>Export du fichier <strong>parameters.csv</strong> pour la campagne %s</html>
+tutti.service.exportCruise.exportSpecies=<html>Export du fichier <strong>species.csv</strong> pour la campagne %s</html>
+tutti.service.exportCruise.exportSurvey=<html>Export du fichier <strong>survey.csv</strong> pour la campagne %s</html>
+tutti.service.exportSumatra.error.species.null=L'espèce est nulle
+tutti.service.exportSumatra.error.station.null=Le trait est nul
+tutti.service.exportSumatra.header.number=NbIndividus
+tutti.service.exportSumatra.header.species=Espèce
+tutti.service.exportSumatra.header.station=Station
+tutti.service.exportSumatra.header.weight=Total
+tutti.service.multipost.attachment.copy.error=Erreur lors de l'export de la pièce-jointe %s
+tutti.service.multipost.attachment.mkdir.error=Impossible de créer le répertoire %s
+tutti.service.multipost.export.attachments.error=Erreur lors de l'export des pièces-jointes
+tutti.service.multipost.export.batches.error=Erreur lors de l'export des lots
+tutti.service.multipost.export.deleteTempDirectory.error=Erreur lors de la suppression du dossier temporaire
+tutti.service.multipost.export.error=Erreur lors de la création du fichier d'export
+tutti.service.multipost.export.file.writer.error=Erreur à la création du fichier %s
+tutti.service.multipost.export.frequencies.error=Erreur lors de l'export des mensurations
+tutti.service.multipost.export.operation.error=Erreur lors de l'export des données du trait
+tutti.service.multipost.export.weight.error=Erreur lors de l'export des poids
+tutti.service.multipost.export.weights.error=Erreur lors de l'export des poids
+tutti.service.multipost.import.attachments.error=Erreur lors de l'import des pièces-jointes
+tutti.service.multipost.import.batches.error=Erreur lors de l'import des lots
+tutti.service.multipost.import.caracteristics.error=Erreur lors de l'import des caractéristiques
+tutti.service.multipost.import.frequencies.error=Erreur lors de l'import des mensurations
+tutti.service.multipost.import.operation.error=Erreur lors de l'import des données du trait
+tutti.service.multipost.import.weights.error=Erreur lors de l'import des poids
+tutti.service.multipost.import.wrongOperation.error=Opération est impossible<hr/>Les lots que vous essayez d'importer proviennent d'un autre trait \:<br/>%s
+tutti.service.multipost.uncompress.error=Erreur lors de la décompression de l'archive %s
+tutti.service.operations.cleanWeights.benthos.batch=Lot benthos
+tutti.service.operations.cleanWeights.error.redundant.frequencyWeight=Le poids (%s%s) du <strong>sous-échantillon</strong> vaut la somme des poids des <strong>échantillons mesurés</strong>
+tutti.service.operations.cleanWeights.error.redundant.sampleCategoryWeight=Le poids (%s%s) de la catégorie <strong>%s</strong> vaut celui de la catégorie supérieure <strong>%s</strong>
+tutti.service.operations.cleanWeights.error.redundant.weight=Le poids (%s%s) de <strong>sous-échantillon</strong> vaut celui de la plus fine catégorie <strong>%s</strong>
+tutti.service.operations.cleanWeights.species.batch=Lot espèce
+tutti.service.operations.computeWeights.error.benthos.incoherentCategoryWeight=Benthos - Le poids total des mensurations du lot de %s/%s - %s (%skg) est supérieur au poids de la catégorie (%skg)
+tutti.service.operations.computeWeights.error.benthos.incoherentParentCategoryWeight=Benthos - Le poids du lot de %s/%s - %s (%skg) est inférieur à la somme des poids de ses sous-catégories (%skg)
+tutti.service.operations.computeWeights.error.benthos.incoherentRowWeightCategory=Le poids de sous-échantillon est renseigné alors que le lot n'a pas de poids.
+tutti.service.operations.computeWeights.error.benthos.incoherentRowWeightFrequency=Benthos - Le poids total des mensurations du lot de %s/%s - %s (%skg) est différent du poids du sous-échantillon (%skg)
+tutti.service.operations.computeWeights.error.benthos.incoherentSampleWeight=Benthos - Le poids de sous-échantillon du lot %s/%s - %s (%skg) est supérieur au poids du lot (%skg)
+tutti.service.operations.computeWeights.error.benthos.incoherentTotalSorted=Le poids total Vrac du benthos est inférieur à la somme des poids Vrac triés, inerte trié et vivant non détaillé trié
+tutti.service.operations.computeWeights.error.benthos.noWeight=Benthos - Le lot de %s/%s - %s n'a pas de poids
+tutti.service.operations.computeWeights.error.incoherentRowWeightCategory=Le poids de sous-échantillon est renseigné alors que le lot n'a pas de poids.
+tutti.service.operations.computeWeights.error.incoherentTotal=Le poids total de la capture ne correspond pas à la somme des poids totaux Vrac, Hors Vrac et non triés
+tutti.service.operations.computeWeights.error.marineLitter.incoherentTotal=Le poids total des macro-déchets est inférieur à la somme des poids des macro-déchets saisis
+tutti.service.operations.computeWeights.error.species.incoherentCategoryWeight=Espèces - Le poids total des mensurations du lot de %s/%s - %s (%skg) est supérieur au poids de la catégorie (%skg)
+tutti.service.operations.computeWeights.error.species.incoherentParentCategoryWeight=Espèces - Le poids du lot de %s/%s - %s (%skg) est inférieur à la somme des poids de ses sous-catégories (%skg)
+tutti.service.operations.computeWeights.error.species.incoherentRowWeightCategory=Le poids de sous-échantillon est renseigné alors que le lot n'a pas de poids.
+tutti.service.operations.computeWeights.error.species.incoherentRowWeightFrequency=Espèces - Le poids total des mensurations du lot de %s/%s - %s (%skg) est différent du poids du sous-échantillon (%skg)
+tutti.service.operations.computeWeights.error.species.incoherentSampleWeight=Espèces - Le poids de sous-échantillon du lot %s/%s - %s (%skg) est supérieur au poids du lot (%skg)
+tutti.service.operations.computeWeights.error.species.incoherentTotalSorted=Le poids total Vrac des espèces est inférieur à la somme des poids Vrac triés, inerte trié et vivant non détaillé trié
+tutti.service.operations.computeWeights.error.species.noWeight=Espèces - Le lot de %s/%s/%s n'a pas de poids
+tutti.service.operations.exportCatchesReport.error=Erreur lors de la génération du rapport des captures
+tutti.service.operations.exportCatchesReport.specialRows.benthos.code=BENTHOS
+tutti.service.operations.exportCatchesReport.specialRows.benthos.name=Benthos
+tutti.service.operations.exportCatchesReport.specialRows.inertAndLivinngNotItemized.code=INERVEG
+tutti.service.operations.exportCatchesReport.specialRows.inertAndLivinngNotItemized.name=Inerte et végétal
+tutti.service.persistence.checkArchiveDb.error=L'archive de base de données %1s ne contient pas le dossier %2s
+tutti.service.persistence.checkImportstructure.fileNotExist=L'archive de base de données %s n'existe pas
+tutti.service.persistence.checkImportstructure.inlineForbidDirectory=La structure d'un import simplifié interdit deux niveaux de répertoire
+tutti.service.persistence.checkImportstructure.tooManyChildren=L'archive de base de données %s ne doit avoir qu'un sous-dossier
+tutti.service.persistence.copyDirectory.attachment.error=Erreur lors de la copie du dossier des pièces jointes
+tutti.service.persistence.copyDirectory.db.error=Erreur lors de la copie du dossier de base de données
+tutti.service.persistence.createDbDirectory.error=Impossible de créer le répertoire de base %s
+tutti.service.persistence.exportDb.deleteTempDir.error=Erreur lors de la suppression du dossier temporaire
+tutti.service.persistence.exportDb.zip.error=Erreur lors de la création de l'archive %s
+tutti.service.persistence.extractArchive.error=Erreur lors de l'extraction de l'archive %s
+tutti.service.persistence.getArchive.error=Erreur lors de la récupération de l'archive %s
+tutti.service.persistence.getChild.error=Erreur lors de la récupération du fils %s
+tutti.service.persistence.openArchive.error=Erreur lors de l'ouverture de l'archive %s
+tutti.service.protocol.export.benthos.error=Erreur lors de l'export du benthos dans le fichier %s
+tutti.service.protocol.export.caracteristics.all.error=Erreur lors de l'export des caractéristiques dans le fichier %s
+tutti.service.protocol.export.caracteristics.protocol.error=Erreur lors de l'export des caractéristiques du protocole dans le fichier %s
+tutti.service.protocol.export.species.error=Erreur lors de l'export des espèces dans le fichier %s
+tutti.service.protocol.import.benthos.error=Erreur lors de l'import du benthos du protocole %1s du fichier %2s
+tutti.service.protocol.import.species.error=Erreur lors de l'import des espèces du protocole %1s du fichier %2s
+tutti.service.protocol.import.taxonUsed.error=Le taxon référent d'id %s est déjà utilisé
+tutti.service.pupitri.export.species.error=Erreur lors de l'export des espèces pour Pupitri dans le fichier %s
+tutti.service.pupitri.import.attachment.comment=Import Pupitri du %s
+tutti.service.pupitri.import.carrousel.error=Erreur lors de l'import du fichier de carrousel %2s pour le trait %1s
+tutti.service.pupitri.import.trunk.error=Erreur lors de l'import du fichier de trémie %2s pour le trait %1s
+tutti.service.referential.export.gear.error=Erreur lors de l'export des engins dans le fichier %s
+tutti.service.referential.export.person.error=Erreur lors de l'export des personnes dans le fichier %s
+tutti.service.referential.export.species.error=Erreur lors de l'export des espèces dans le fichier %s
+tutti.service.referential.export.vessel.error=Erreur lors de l'export des navires dans le fichier %s
+tutti.service.referential.import.gear.existingName.error=L'engin '%2$s' n'a pas été ajouté au référentiel car il est déjà présent
+tutti.service.referential.import.gears.error=Erreur lors de l'import des engins du fichier %s
+tutti.service.referential.import.persons.error=Erreur lors de l'import des personnes du fichier %s
+tutti.service.referential.import.species.error=Erreur lors de l'import des espèces du fichier %s
+tutti.service.referential.import.species.existingName.error=L'espèce '%2$s' n'a pas été ajoutée au référentiel car elle est déjà présente
+tutti.service.referential.import.vessels.error=Erreur lors de l'import des navires du fichier %s
+tutti.service.referential.import.vessels.existingValue.error=Un navire avec le nom %1s et l'immatriculation %2s existe déjà dans le référentiel
+tutti.service.sumatra.export.error=Erreur lors de l'export Sumatra dans le fichier %s
+tutti.service.validateCruise.exportResult.error=Erreur lors de l'export des résultats de validation de la campagne dans le fichier %s
+tutti.service.validateCruise.operations.progress=Vérification du trait %s
+tutti.species.name.tip=Nom scientifique
+tutti.species.refTaxCode.tip=Code Rubin
+tutti.species.surveyCode.tip=Code campagne ou code rubin
+tutti.splitBenthosBatch.action.cancel=Annuler
+tutti.splitBenthosBatch.action.cancel.mnemonic=A
+tutti.splitBenthosBatch.action.cancel.tip=Annuler le sous-échantillonnage
+tutti.splitBenthosBatch.action.save=Enregistrer
+tutti.splitBenthosBatch.action.save.mnemonic=E
+tutti.splitBenthosBatch.action.save.tip=Sauver le sous-échantillonnage
+tutti.splitBenthosBatch.field.batchWeight=Poids du lot père
+tutti.splitBenthosBatch.field.batchWeight.tip=Poids du lot père (si renseigné)
+tutti.splitBenthosBatch.field.category=Catégorie
+tutti.splitBenthosBatch.field.category.tip=Choisir le mode de catégorisation
+tutti.splitBenthosBatch.field.sampleWeight=Poids total catégorisé
+tutti.splitBenthosBatch.field.sampleWeight.tip=Somme des poids saisis ci-dessous
+tutti.splitBenthosBatch.table.header.category=Catégorie
+tutti.splitBenthosBatch.table.header.selected=Sélection
+tutti.splitBenthosBatch.table.header.weight=Poids
+tutti.splitBenthosBatch.title=Catégorisation du lot
+tutti.splitSpeciesBatch.action.cancel=Annuler
+tutti.splitSpeciesBatch.action.cancel.mnemonic=A
+tutti.splitSpeciesBatch.action.cancel.tip=Annuler le sous-échantillonnage
+tutti.splitSpeciesBatch.action.save=Enregistrer
+tutti.splitSpeciesBatch.action.save.mnemonic=E
+tutti.splitSpeciesBatch.action.save.tip=Sauver le sous-échantillonnage
+tutti.splitSpeciesBatch.field.batchWeight=Poids total à catégoriser
+tutti.splitSpeciesBatch.field.batchWeightField.tip=Poids du lot père (si renseigné)
+tutti.splitSpeciesBatch.field.category=Catégorie
+tutti.splitSpeciesBatch.field.categoryField.tip=Choisir le mode de catégorisation
+tutti.splitSpeciesBatch.field.sampleWeight=Poids total catégorisé
+tutti.splitSpeciesBatch.field.sampleWeightField.tip=Somme des poids saisis ci-dessous
+tutti.splitSpeciesBatch.table.header.category=Catégorie
+tutti.splitSpeciesBatch.table.header.selected=Sélection
+tutti.splitSpeciesBatch.table.header.weight=Poids
+tutti.splitSpeciesBatch.title=Catégorisation du lot
+tutti.timeeditor.H=H
+tutti.ui.change.species.decorator=Changer la décoration
+tutti.update.db=Base de données
+tutti.update.help=Aide en ligne
+tutti.update.i18n=Traductions
+tutti.update.jre=Java
+tutti.update.report=Rapports
+tutti.update.tutti=Tutti
+tutti.updateApplication.checkUpdates=Recherche de mises à jour
+tutti.updateApplication.message.success=La mise à jour du logiciel nécessite le redémarrage de l'application
+tutti.updateApplication.noUpdate=<strong>Aucune mise à jour de l'application détectée.</strong>
+tutti.updateApplication.title.success=Redémarrage de l'application nécessaire...
+tutti.updateReport.message.success=La mise à jour des rapports nécessite le redémarrage de l'application
+tutti.updateReport.noUpdate=<strong>Aucune mise à jour de rapports détectée.</strong>
+tutti.updateReport.title.success=Redémarrage de l'application nécessaire...
+tutti.validateCruise.action.export.all.chooseFile.label=Choisir le fichier d'export
+tutti.validateCruise.action.export.all.chooseFile.title=Exporter les messages de validation de la campagne
+tutti.validateCruise.action.export.all.success=Les messages de validation des captures ont correctement été exporté dans le fichier %s
+tutti.validateCruise.action.export.all.tip=Exporter les messages de validation de la campagne
+tutti.validateCruise.action.export.operation.chooseFile.label=Choisir le fichier d'export
+tutti.validateCruise.action.export.operation.chooseFile.title=Exporter les messages de validation de l'opération
+tutti.validateCruise.action.export.operation.success=Les messages de validation de l'opération ont correctement été exporté dans le fichier %s
+tutti.validateCruise.action.export.operation.tip=Exporter les messages de validation de l'opération
+tutti.validateCruise.navigation.action.export.all.tip=Exporter les messages de validation de la campagne
+tutti.validateCruise.navigation.action.export.operation=Exporter
+tutti.validateCruise.navigation.action.export.operation.mnemonic=x
+tutti.validateCruise.navigation.action.export.operation.tip=Exporter les messages de validation de l'opération
+tutti.validateCruise.navigation.title=Traits
+tutti.validator.error.accidental.species.required=L'espèce est obligatoire
+tutti.validator.error.benthosBatch.species.required=L'espèce est obligatoire
+tutti.validator.error.benthosFrequency.lengthStepCaracteristic.required=La classe de taille est obligatoire
+tutti.validator.error.benthosFrequency.oneRowRequired=Au moins une classe de taille doit être observée
+tutti.validator.error.benthosFrequency.step.positiveValue=Le pas de la classe de taille doit être strictement positif
+tutti.validator.error.comment.too.long=Taille de commentaire trop longue (limitée à %s caractères)
+tutti.validator.error.createAccidentalBatch.species.required=L'espèce est obligatoire
+tutti.validator.error.createIndividualObservationBatch.lengthStepCaracteristic.required=La classe de taille est obligatoire
+tutti.validator.error.createIndividualObservationBatch.size.required=La taille est obligatoire
+tutti.validator.error.cruise.beginDate.required=La date de début est obligatoire
+tutti.validator.error.cruise.dates.endBeforeStart=La date de fin doit être après la date de début
+tutti.validator.error.cruise.departureLocation.required=Le port d'embarquement 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.multirigNumber.required=Le nombre de poche est obligatoire
+tutti.validator.error.cruise.name.required=Le nom de la campagne est obligatoire
+tutti.validator.error.cruise.program.required=La série est obligatoire
+tutti.validator.error.cruise.returnLocation.required=Le port de débarquement est obligatoire
+tutti.validator.error.cruise.vessel.required=Au moins un bateau doit être sélectionné
+tutti.validator.error.fishingOperation.catcher.required=Au moins un saisisseur est obligatoire
+tutti.validator.error.fishingOperation.comment.required=Le commentaire est obligatoire si le trait est invalide
+tutti.validator.error.fishingOperation.date.end.required=La date de la fin du trait est obligatoire
+tutti.validator.error.fishingOperation.date.start.required=La date du début du trait est obligatoire
+tutti.validator.error.fishingOperation.dates.endBeforeStart=La date de fin doit être après la date de début
+tutti.validator.error.fishingOperation.dates.endOutOfCruiseDates=La date de fin est en dehors des dates de la campagne
+tutti.validator.error.fishingOperation.dates.startOutOfCruiseDates=La date de début est en dehors des dates de la campagne
+tutti.validator.error.fishingOperation.dates.wrongTime=La durée du trait dépasse 45 minutes ou est inférieure à 20 minutes, merci de vérifier les dates/heures du trait
+tutti.validator.error.fishingOperation.existingKey=La clé code station/numéro de trait/date de début existe déjà
+tutti.validator.error.fishingOperation.fishingOperationNumber.required=Le numéro de trait est obligatoire
+tutti.validator.error.fishingOperation.fishingOperationValid.required=La validité du trait est obligatoire
+tutti.validator.error.fishingOperation.gear.required=L'engin est obligatoire
+tutti.validator.error.fishingOperation.invalid.dates.for.position=Les dates ne peuvent pas être identiques si les positions sont différentes
+tutti.validator.error.fishingOperation.invalid.position.for.dates=Si les positions sont identiques, les dates ne peuvent être identiques
+tutti.validator.error.fishingOperation.stationNumber.required=Le numéro de station est obligatoire
+tutti.validator.error.fishingOperation.stationNumber.too.long=Valeur trop longue (limitée à %s caractères)
+tutti.validator.error.fishingOperation.strataLocation.required=La strate, sous-strate ou localité doit être renseignée
+tutti.validator.error.fishingOperation.trawlDistance.required=La distance est obligatoire
+tutti.validator.error.fishingOperation.trawlDistance.tooLong=La distance du trait dépasse 3 milles marin (5556 m), merci de vérifier les coordonnées
+tutti.validator.error.fishingOperation.trawlNetNumber.required=Le numéro de poche est obligatoire
+tutti.validator.error.fishingOperation.vessel.required=Le navire est obligatoire
+tutti.validator.error.individualObservation.lengthStepCaracteristic.required=La classe de taille est obligatoire
+tutti.validator.error.individualObservation.size.required=La taille est obligatoire
+tutti.validator.error.individualObservation.species.required=L'espèce est obligatoire
+tutti.validator.error.individualObservation.weight.required=Le poids est obligatoire
+tutti.validator.error.latitude.end.required=La latitude de fin de traîne est obligatoire
+tutti.validator.error.latitude.start.required=La latitude de début de traîne est obligatoire
+tutti.validator.error.longitude.end.required=La longitude de fin de traîne est obligatoire
+tutti.validator.error.longitude.start.required=La longitude de début de traîne est obligatoire
+tutti.validator.error.marineLitter.marineLitterCategory.required=La catégorie du lot de macro-déchet est obligatoire
+tutti.validator.error.marineLitter.marineLitterSizeCategory.required=La catégorie de taille du lot de macro-déchet est obligatoire
+tutti.validator.error.marineLitter.number.required=Le nombre du lot de macro-déchet est obligatoire
+tutti.validator.error.program.description.required=La description de la série est obligatoire
+tutti.validator.error.program.description.too.long=Taille de la description trop longue (limitée à %s caractères)
+tutti.validator.error.program.existingKey=Le couple nom/zone existe déjà
+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.protocol.name.alreadyUsed=Le nom du protocole est déjà utilisé
+tutti.validator.error.protocol.name.required=Le nom du protocole est obligatoire
+tutti.validator.error.report.inputFile.notExists=Le fichier d'entrée n'eixste pas
+tutti.validator.error.report.inputFile.required=Le fichier d'entrée est obligatoire
+tutti.validator.error.report.outputFile.required=Le fichier de sortie est obligatoire
+tutti.validator.error.report.report.required=Un modèle de rapport doit être sélectionné
+tutti.validator.error.speciesBatch.species.required=L'espèce est obligatoire
+tutti.validator.error.speciesFrequency.lengthStepCaracteristic.required=La classe de taille est obligatoire
+tutti.validator.error.speciesFrequency.oneRowRequired=Au moins une classe de taille doit être observée
+tutti.validator.error.speciesFrequency.step.positiveValue=Le pas de la classe de taille doit être strictement positif
+tutti.validator.error.splitSpeciesBatch.sampleWeight.invalidValue=La somme des poids ventilés doit être strictement positive
+tutti.validator.error.splitSpeciesBatch.sampleWeight.sampleBatchGreaterThanBatchWeight=La somme des poids ventilés doit être inférieur ou égale à celle du poids du lot
+tutti.validator.error.splitSpeciesBatch.selectedCategory.required=La catégorie est obligatoire
+tutti.validator.export.message.error=\t- [ERREUR] %s
+tutti.validator.export.message.warning=\t- [WARNING] %s
+tutti.validator.export.operation=* %s \:
+tutti.validator.info.operation.noError=Trait sans erreur
+tutti.validator.warning.benthos.protocolNotRespected=Benthos - le lot de %s / %s ne suit pas les recommandations du protocole
+tutti.validator.warning.fishingOperation.batch.notFound=Pas d'arbre d’échantillonnage trouvé
+tutti.validator.warning.fishingOperation.invalid.batch.model=Arbre d’échantillonnage non compatible avec l'application
+tutti.validator.warning.latitude.outOfBounds=La Latitude doit être comprise entre -90.0 et 90.0
+tutti.validator.warning.longitude.outOfBounds=La longitude doit être comprise entre -180.0 et 180.0
+tutti.validator.warning.marineLitter.weight.required=Vous devez saisir la valeur du poids total des déchets<br/>ou le poids de chacune des catégories observées.
+tutti.validator.warning.species.protocolNotRespected=Espèces - le lot de %s / %s ne suit pas les recommandations du protocole
+tutti.vesselUseFeatureTable.action.removeCaracteristic=Supprimer
+tutti.vesselUseFeatureTable.action.removeCaracteristic.mnemonic=S
+tutti.vesselUseFeatureTable.action.removeCaracteristic.tip=Supprimer la caractéristique
+tutti.vesselUseFeatureTable.table.header.key=Caractéristique
+tutti.vesselUseFeatureTable.table.header.value=Valeur
+tutti.vesselUseFeatureTable.title=Autres paramètres
Modified: branches/tutti-with-ifremer-shared/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/config/TuttiPersistenceConfigTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,6 +25,7 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry;
import fr.ifremer.tutti.persistence.test.DatabaseResource;
@@ -72,7 +73,7 @@
Assert.assertFalse(configFile.exists());
- TuttiPersistenceConfig config = getConfig(configFile);
+ TuttiConfiguration config = getConfig(configFile);
SampleCategoryModelEntry vracHVrac = new SampleCategoryModelEntry();
vracHVrac.setCategoryId(1428);
@@ -119,7 +120,7 @@
Assert.assertFalse(configFile.exists());
- TuttiPersistenceConfig config = getConfig(configFile);
+ TuttiConfiguration config = getConfig(configFile);
SampleCategoryModelEntry e = new SampleCategoryModelEntry();
@@ -143,11 +144,11 @@
assertModelEntry(e, model2.getCategoryByIndex(0));
assertModelEntry(e2, model2.getCategoryByIndex(1));
- config.getConfig().save(configFile, false);
+ config.getApplicationConfig().save(configFile, false);
Assert.assertTrue(configFile.exists());
- TuttiPersistenceConfig config2 = getConfig(configFile);
+ TuttiConfiguration config2 = getConfig(configFile);
model2 = config2.getSampleCategoryModel();
Assert.assertNotNull(model2);
Assert.assertNotNull(model2.getCategory());
@@ -175,7 +176,7 @@
}
- protected TuttiPersistenceConfig getConfig(File configFile) throws ArgumentsParserException {
+ protected TuttiConfiguration getConfig(File configFile) throws ArgumentsParserException {
ApplicationConfig applicationConfig = new ApplicationConfig(configFile.getAbsolutePath());
DatabaseResource databaseResource = DatabaseResource.noDb();
@@ -183,7 +184,7 @@
applicationConfig.parse();
- TuttiPersistenceConfig config = new TuttiPersistenceConfig(applicationConfig);
+ TuttiConfiguration config = new TuttiConfiguration(applicationConfig);
return config;
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/pom.xml
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/pom.xml 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/pom.xml 2013-11-24 23:27:27 UTC (rev 1385)
@@ -48,6 +48,11 @@
</dependency>
<dependency>
+ <groupId>fr.ifremer.shared</groupId>
+ <artifactId>application</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils</artifactId>
</dependency>
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/AbstractTuttiService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/AbstractTuttiService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/AbstractTuttiService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import org.apache.commons.io.FileUtils;
import org.nuiton.util.ZipUtil;
@@ -75,7 +75,7 @@
}
} catch (IOException e) {
- throw new TuttiTechnicalException(_("tutti.service.compressZipFile.error", directory, zipFile), e);
+ throw new ApplicationTechnicalException(_("tutti.service.compressZipFile.error", directory, zipFile), e);
}
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/ClosedPersistenceService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/ClosedPersistenceService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/ClosedPersistenceService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,8 +25,6 @@
*/
import fr.ifremer.tutti.persistence.TuttiPersistenceNoDbImpl;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
-import fr.ifremer.tutti.service.config.TuttiServiceConfig;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -49,11 +47,6 @@
log.info("Open persistence driver " + getImplementationName());
}
- TuttiServiceConfig serviceConfig = context.getConfig();
-
- TuttiPersistenceConfig config = serviceConfig.getPersistenceConfig();
- TuttiPersistenceConfig.setInstance(config);
-
driver = new TuttiPersistenceNoDbImpl();
if (log.isInfoEnabled()) {
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -29,12 +29,12 @@
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import fr.ifremer.tutti.TuttiBusinessException;
-import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.shared.application.ApplicationBusinessException;
+import fr.ifremer.shared.application.ApplicationIOUtil;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.InvalidBatchModelException;
import fr.ifremer.tutti.persistence.TuttiPersistence;
import fr.ifremer.tutti.persistence.TuttiPersistenceNoDbImpl;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
@@ -66,7 +66,6 @@
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.service.TuttiEnumerationFile;
import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
-import fr.ifremer.tutti.service.config.TuttiServiceConfig;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -233,7 +232,7 @@
// create zip structure
- TuttiServiceConfig config = context.getConfig();
+ TuttiConfiguration config = context.getConfig();
String directoryName = String.format(
EXPORT_DIRECTORY_FORMAT,
@@ -244,30 +243,29 @@
directoryName);
try {
- TuttiIOUtil.forceMkdir(structureDirectory,
- _("tutti.service.mkDir.error", structureDirectory));
+ ApplicationIOUtil.forceMkdir(structureDirectory,
+ _("tutti.io.mkDir.error", structureDirectory));
if (log.isInfoEnabled()) {
log.info("Export directory: " + structureDirectory);
}
- TuttiPersistenceConfig pConfig = config.getPersistenceConfig();
- TuttiIOUtil.copyDirectory(pConfig.getDbDirectory(),
- new File(structureDirectory, "db"),
- _("tutti.service.persistence.copyDirectory.db.error"));
+ ApplicationIOUtil.copyDirectory(config.getDbDirectory(),
+ new File(structureDirectory, "db"),
+ _("tutti.service.persistence.copyDirectory.db.error"));
- TuttiIOUtil.copyDirectory(pConfig.getDbAttachmentDirectory(),
- new File(structureDirectory, "meas_files"),
- _("tutti.service.persistence.copyDirectory.attachment.error"));
+ ApplicationIOUtil.copyDirectory(config.getDbAttachmentDirectory(),
+ new File(structureDirectory, "meas_files"),
+ _("tutti.service.persistence.copyDirectory.attachment.error"));
// create zip
- TuttiIOUtil.zip(structureDirectory, file,
- _("tutti.service.persistence.exportDb.zip.error", file));
+ ApplicationIOUtil.zip(structureDirectory, file,
+ _("tutti.service.persistence.exportDb.zip.error", file));
} finally {
// delete temp files
- TuttiIOUtil.forceDeleteOnExit(
+ ApplicationIOUtil.forceDeleteOnExit(
structureDirectory,
_("tutti.service.persistence.exportDb.deleteTempDir.error", structureDirectory));
}
@@ -281,24 +279,24 @@
public ImportStructureType checkImportStructure(File file) {
if (!file.exists()) {
- throw new TuttiBusinessException(_("tutti.service.persistence.checkImportstructure.fileNotExist", file));
+ throw new ApplicationBusinessException(_("tutti.service.persistence.checkImportstructure.fileNotExist", file));
}
// check zip structure
- FileObject fileObject = TuttiIOUtil.resolveFile(
+ FileObject fileObject = ApplicationIOUtil.resolveFile(
"zip:" + file.getAbsolutePath(), _("tutti.service.persistence.getArchive.error", file));
- FileObject[] children = TuttiIOUtil.getChildren(fileObject, _("tutti.service.persistence.openArchive.error", file));
+ FileObject[] children = ApplicationIOUtil.getChildren(fileObject, _("tutti.service.persistence.openArchive.error", file));
if (children.length != 1) {
- throw new TuttiBusinessException(_("tutti.service.persistence.checkImportstructure.tooManyChildren", file));
+ throw new ApplicationBusinessException(_("tutti.service.persistence.checkImportstructure.tooManyChildren", file));
}
ImportStructureType result;
fileObject = children[0];
- children = TuttiIOUtil.getChildren(fileObject, _("tutti.service.persistence.openArchive.error", file));
+ children = ApplicationIOUtil.getChildren(fileObject, _("tutti.service.persistence.openArchive.error", file));
// try to detect a db directory
boolean dbDirectoyDetected = false;
@@ -324,9 +322,9 @@
// should have no directory
for (FileObject child : children) {
- FileType type = TuttiIOUtil.getType(child, "Could not get type of " + child);
+ FileType type = ApplicationIOUtil.getType(child, "Could not get type of " + child);
if (FileType.FOLDER.equals(type)) {
- throw new TuttiBusinessException(_("tutti.service.persistence.checkImportstructure.inlineForbidDirectory"));
+ throw new ApplicationBusinessException(_("tutti.service.persistence.checkImportstructure.inlineForbidDirectory"));
}
}
}
@@ -342,12 +340,12 @@
FileObject fileObject,
String dir,
boolean required) {
- FileObject directory = TuttiIOUtil.getChild(fileObject, dir, _("tutti.service.persistence.getChild.error", dir));
+ FileObject directory = ApplicationIOUtil.getChild(fileObject, dir, _("tutti.service.persistence.getChild.error", dir));
if (directory == null) {
String message = _("tutti.service.persistence.checkArchiveDb.error", file, dir);
if (required) {
- throw new TuttiBusinessException(message);
+ throw new ApplicationBusinessException(message);
}
if (log.isWarnEnabled()) {
@@ -371,18 +369,18 @@
// need a file to export
Preconditions.checkNotNull(file);
- TuttiServiceConfig config = context.getConfig();
+ TuttiConfiguration config = context.getConfig();
File target = config.getDataDirectory();
if (log.isInfoEnabled()) {
log.info("Import db to " + target);
}
- FileObject fileObject = TuttiIOUtil.resolveFile(
+ FileObject fileObject = ApplicationIOUtil.resolveFile(
"zip:" + file.getAbsolutePath(),
_("tutti.service.persistence.getArchive.error", file));
- FileObject[] children = TuttiIOUtil.getChildren(
+ FileObject[] children = ApplicationIOUtil.getChildren(
fileObject,
_("tutti.service.persistence.openArchive.error", file));
@@ -396,7 +394,7 @@
case INLINE:
target = new File(target, "db");
- TuttiIOUtil.forceMkdir(
+ ApplicationIOUtil.forceMkdir(
target,
_("tutti.service.persistence.createDbDirectory.error", file));
@@ -404,10 +402,10 @@
break;
}
- TuttiIOUtil.explode(fileObject,
- target,
- new AllFileSelector(),
- _("tutti.service.persistence.extractArchive.error", file));
+ ApplicationIOUtil.explode(fileObject,
+ target,
+ new AllFileSelector(),
+ _("tutti.service.persistence.extractArchive.error", file));
}
public boolean isDbLoaded() {
@@ -613,11 +611,8 @@
log.debug("Opening persistence service...");
}
- TuttiServiceConfig serviceConfig = context.getConfig();
-
- TuttiPersistenceConfig config = serviceConfig.getPersistenceConfig();
- TuttiPersistenceConfig.setInstance(config);
-
+ TuttiConfiguration config = context.getConfig();
+ TuttiConfiguration.setInstance(config);
if (config.isDbExists()) {
String jdbcUrl = config.getJdbcUrl();
@@ -634,11 +629,6 @@
driver.init();
}
-// if (log.isInfoEnabled()) {
-// log.info("Persistence driver *" +
-// driver.getImplementationName() + "* opened.");
-// }
-
TIME_LOG.log(t0, "Persistence driver *" +
driver.getImplementationName() + "* opened.");
}
@@ -654,11 +644,6 @@
IOUtils.closeQuietly(driver);
-// if (log.isInfoEnabled()) {
-// log.info("Persistence driver *" +
-// driver.getImplementationName() + "* closed.");
-// }
-
TIME_LOG.log(t0, "Persistence driver *" +
driver.getImplementationName() + "* closed.");
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDataContext.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDataContext.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDataContext.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,6 +26,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.Program;
@@ -37,7 +38,6 @@
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.service.config.TuttiServiceConfig;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -183,13 +183,13 @@
});
}
- public void open(TuttiServiceConfig config, PersistenceService persistenceService) {
+ public void open(TuttiConfiguration config, PersistenceService persistenceService) {
close();
this.service = persistenceService;
// attach protocol to service
this.service.setProtocol(getProtocol());
- loadSampleCategoryModel(config.getPersistenceConfig().getSampleCategoryModel());
+ loadSampleCategoryModel(config.getSampleCategoryModel());
}
@Override
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -29,10 +29,10 @@
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.opensymphony.xwork2.util.ValueStack;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
-import fr.ifremer.tutti.service.config.TuttiServiceConfig;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -61,7 +61,7 @@
private static final Log log =
LogFactory.getLog(TuttiServiceContext.class);
- protected final TuttiServiceConfig config;
+ protected final TuttiConfiguration config;
protected final TuttiDataContext dataContext;
@@ -70,12 +70,12 @@
protected final LoadingCache<Class<? extends TuttiService>, TuttiService> services;
public TuttiServiceContext(RessourceClassLoader resourceLoader,
- TuttiServiceConfig config) {
+ TuttiConfiguration config) {
this(resourceLoader, config, new TuttiDataContext());
}
public TuttiServiceContext(RessourceClassLoader resourceLoader,
- TuttiServiceConfig config,
+ TuttiConfiguration config,
TuttiDataContext dataContext) {
this.resourceLoader = resourceLoader;
this.config = config;
@@ -99,7 +99,7 @@
});
}
- public TuttiServiceConfig getConfig() {
+ public TuttiConfiguration getConfig() {
return config;
}
@@ -123,7 +123,7 @@
S s = (S) services.get(serviceType);
return s;
} catch (ExecutionException e) {
- throw new TuttiTechnicalException(_("tutti.service.context.serviceInstanciation.error", serviceType), e);
+ throw new ApplicationTechnicalException(_("tutti.service.context.serviceInstanciation.error", serviceType), e);
}
}
Deleted: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/WeightUnit.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/WeightUnit.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/WeightUnit.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,118 +0,0 @@
-package fr.ifremer.tutti.service;
-
-/*
- * #%L
- * Tutti :: Service
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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 static org.nuiton.i18n.I18n._;
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * Different types of weight unit.
- * <p/>
- * Created on 09/22/13.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 2.5
- */
-public enum WeightUnit {
-
- G(n_("tutti.common.unit.g"), n_("tutti.common.unit.short.g"), 1, "\\d{0,6}(\\.\\d{0,1})?") {
- @Override
- public Float fromEntity(Float weight) {
- return weight == null ? null : weight * 1000;
- }
-
- @Override
- public Float toEntity(Float weight) {
- return weight == null ? null : weight / 1000.0f;
- }
- },
- KG(n_("tutti.common.unit.kg"), n_("tutti.common.unit.short.kg"), 4, "\\d{0,6}(\\.\\d{0,4})?") {
- @Override
- public Float fromEntity(Float weight) {
- return weight;
- }
-
- @Override
- public Float toEntity(Float weight) {
- return weight;
- }
- };
-
- private final String i18nShortKey;
-
- private final String i18nKey;
-
- private final int numberDigits;
-
- private final String numberEditorPattern;
-
- WeightUnit(String i18nKey, String i18nShortKey, int numberDigits, String numberEditorPattern) {
- this.i18nKey = i18nKey;
- this.i18nShortKey = i18nShortKey;
- this.numberDigits = numberDigits;
- this.numberEditorPattern = numberEditorPattern;
- }
-
- public String getLabel() {
- return _(i18nKey);
- }
-
- public String getShortLabel() {
- return _(i18nShortKey);
- }
-
- public int getNumberDigits() {
- return numberDigits;
- }
-
- public String getNumberEditorPattern() {
- return numberEditorPattern;
- }
-
- /**
- * Transform the given {@code weight} coming from db to ui.
- *
- * @param weight weigth to transform
- * @return the ui representation of the given {@code weight}.
- */
- public abstract Float fromEntity(Float weight);
-
- /**
- * Transform the given {@code weight} coming from ui to db.
- *
- * @param weight weigth to transform
- * @return the db representation of the given {@code weight}.
- */
- public abstract Float toEntity(Float weight);
-
- public String decorateLabel(String label) {
- return String.format("%s (%s)", label, getShortLabel());
- }
-
- public String decorateTip(String tip) {
- String unit = _("tutti.common.unit");
- return String.format("%s (%s %s)", tip, unit, getLabel());
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingException.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingException.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingException.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,13 +24,13 @@
* #L%
*/
-import fr.ifremer.tutti.TuttiBusinessException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
/**
* @author kmorin <kmorin(a)codelutin.com>
* @since 2.0
*/
-public class TuttiWeightComputingException extends TuttiBusinessException {
+public class TuttiWeightComputingException extends ApplicationBusinessException {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ValidateCruiseOperationsService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ValidateCruiseOperationsService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ValidateCruiseOperationsService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,8 +26,8 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import fr.ifremer.tutti.TuttiBusinessException;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.InvalidBatchModelException;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
@@ -158,7 +158,7 @@
FileUtils.writeLines(file, lines);
} catch (IOException e) {
- throw new TuttiTechnicalException(_("tutti.service.validateCruise.exportResult.error", file));
+ throw new ApplicationTechnicalException(_("tutti.service.validateCruise.exportResult.error", file));
}
}
@@ -174,7 +174,7 @@
FileUtils.writeLines(file, lines);
} catch (IOException e) {
- throw new TuttiTechnicalException(_("tutti.service.validateCruise.exportResult.error", file));
+ throw new ApplicationTechnicalException(_("tutti.service.validateCruise.exportResult.error", file));
}
}
@@ -255,7 +255,7 @@
try {
weightComputingService.computeSpeciesBatch(batch);
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
errors.add(e.getMessage());
error = true;
}
@@ -278,7 +278,7 @@
try {
weightComputingService.computeBenthosBatch(batch);
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
errors.add(e.getMessage());
error = true;
}
@@ -294,7 +294,7 @@
Float weight = catchBatch == null ? null : catchBatch.getMarineLitterTotalWeight();
rootMarineLitterBatch = weightComputingService.getComputedMarineLitterBatches(fishingOperationId, weight);
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
errors.add(e.getMessage());
rootMarineLitterBatch = persistenceService.getRootMarineLitterBatch(fishingOperationId);
}
@@ -302,11 +302,11 @@
try {
if (catchBatch != null) {
weightComputingService.computeCatchBatchWeights(catchBatch,
- rootSpeciesBatch,
- rootBenthosBatch,
- rootMarineLitterBatch);
+ rootSpeciesBatch,
+ rootBenthosBatch,
+ rootMarineLitterBatch);
}
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
errors.add(e.getMessage());
}
@@ -434,7 +434,7 @@
}
/**
- * @param operation option to check
+ * @param operation option to check
* @param validationResult result of validation
*/
protected List<String> getExportLines(FishingOperation operation, NuitonValidatorResult validationResult) {
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightCleaningService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightCleaningService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightCleaningService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -30,6 +30,7 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatchFrequency;
@@ -45,7 +46,6 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.TuttiServiceContext;
-import fr.ifremer.tutti.service.WeightUnit;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightComputingService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightComputingService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightComputingService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,7 +25,7 @@
*/
import com.google.common.collect.Maps;
-import fr.ifremer.tutti.TuttiBusinessException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
@@ -121,7 +121,7 @@
try {
rootSpeciesBatch = getComputedSpeciesBatches(fishingOperationId);
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
result.put(fishingOperationId, e.getMessage());
rootSpeciesBatch = persistenceService.getRootSpeciesBatch(fishingOperationId, null);
}
@@ -130,7 +130,7 @@
try {
rootBenthosBatch = getComputedBenthosBatches(fishingOperationId);
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
result.put(fishingOperationId, e.getMessage());
rootBenthosBatch = persistenceService.getRootBenthosBatch(fishingOperationId, null);
}
@@ -140,7 +140,7 @@
Float weight = catchBatch == null ? null : catchBatch.getMarineLitterTotalWeight();
rootMarineLitterBatch = getComputedMarineLitterBatches(fishingOperationId, weight);
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
result.put(fishingOperationId, e.getMessage());
rootMarineLitterBatch = persistenceService.getRootMarineLitterBatch(fishingOperationId);
}
@@ -152,7 +152,7 @@
rootBenthosBatch,
rootMarineLitterBatch);
}
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
result.put(fishingOperationId, e.getMessage());
}
}
@@ -217,7 +217,7 @@
TuttiEntities.roundKiloGram(speciesTotalSortedWeight));
} else if (speciesTotalSortedWeight < speciesTotalComputedSortedWeight) {
- throw new TuttiBusinessException(_("tutti.service.operations.computeWeights.error.species.incoherentTotalSorted"));
+ throw new ApplicationBusinessException(_("tutti.service.operations.computeWeights.error.species.incoherentTotalSorted"));
}
catchBatch.setSpeciesTotalUnsortedComputedWeight(
TuttiEntities.roundKiloGram(speciesTotalComputedUnsortedWeight));
@@ -275,7 +275,7 @@
TuttiEntities.roundKiloGram(benthosTotalSortedWeight));
} else if (benthosTotalSortedWeight < benthosTotalComputedSortedWeight) {
- throw new TuttiBusinessException(_("tutti.service.operations.computeWeights.error.benthos.incoherentTotalSorted"));
+ throw new ApplicationBusinessException(_("tutti.service.operations.computeWeights.error.benthos.incoherentTotalSorted"));
}
catchBatch.setBenthosTotalUnsortedComputedWeight(
TuttiEntities.roundKiloGram(benthosTotalComputedUnsortedWeight));
@@ -311,7 +311,7 @@
marineLitterTotalWeight = marineLitterTotalComputedWeight;
} else if (marineLitterTotalComputedWeight != null && marineLitterTotalWeight < marineLitterTotalComputedWeight) {
- throw new TuttiBusinessException(_("tutti.service.operations.computeWeights.error.marineLitter.incoherentTotal"));
+ throw new ApplicationBusinessException(_("tutti.service.operations.computeWeights.error.marineLitter.incoherentTotal"));
}
// nothing to do with the marine litter weight, it is an isolated weight
@@ -330,7 +330,7 @@
if (rejectedWeight == null && totalWeight != null) {
if (!totalWeight.equals(totalUnsortedWeight
+ totalSortedWeight)) {
- throw new TuttiBusinessException(_("tutti.service.operations.computeWeights.error.incoherentTotal"));
+ throw new ApplicationBusinessException(_("tutti.service.operations.computeWeights.error.incoherentTotal"));
} else {
catchBatch.setCatchTotalRejectedComputedWeight(
@@ -350,7 +350,7 @@
+ rejectedWeight));
} else if (!totalWeight.equals(totalUnsortedWeight + totalSortedWeight + rejectedWeight)) {
- throw new TuttiBusinessException(_("tutti.service.operations.computeWeights.error.incoherentTotal"));
+ throw new ApplicationBusinessException(_("tutti.service.operations.computeWeights.error.incoherentTotal"));
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/multipost/MultiPostExportService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/multipost/MultiPostExportService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/multipost/MultiPostExportService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,8 +27,8 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Files;
-import fr.ifremer.tutti.TuttiIOUtil;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationIOUtil;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
@@ -621,7 +621,7 @@
ExportModel<R> exportModel,
List<R> rows,
String errorMessage) {
- Writer writer = TuttiIOUtil.newWriter(
+ Writer writer = ApplicationIOUtil.newWriter(
file,
n_("tutti.service.multipost.export.file.writer.error"));
try {
@@ -630,7 +630,7 @@
writer.close();
} catch (Exception e) {
- throw new TuttiTechnicalException(_(errorMessage, file), e);
+ throw new ApplicationTechnicalException(_(errorMessage, file), e);
} finally {
IOUtils.closeQuietly(writer);
}
@@ -643,14 +643,14 @@
AttachmentRowModel csvAttachmentModel = new AttachmentRowModel(csvSeparator);
File attachmentDirectory = new File(directory, ATTACHMENTS_DIRECTORY);
- TuttiIOUtil.forceMkdir(attachmentDirectory, _("tutti.service.multipost.attachment.mkdir.error", attachmentDirectory));
+ ApplicationIOUtil.forceMkdir(attachmentDirectory, _("tutti.service.multipost.attachment.mkdir.error", attachmentDirectory));
file2zip.add(attachmentDirectory);
for (AttachmentRow attachmentRow : attachmentRows) {
File attachmentFile = attachmentRow.getFile();
File destFile = new File(attachmentDirectory, attachmentFile.getName());
- TuttiIOUtil.copyFile(attachmentFile,
- destFile,
- _("tutti.service.multipost.attachment.copy.error", attachmentFile));
+ ApplicationIOUtil.copyFile(attachmentFile,
+ destFile,
+ _("tutti.service.multipost.attachment.copy.error", attachmentFile));
file2zip.add(destFile);
}
@@ -670,12 +670,12 @@
exportAttachments(directory, file2zip, attachmentRows);
try {
- TuttiIOUtil.zip(directory,
- file,
- file2zip,
- n_("tutti.service.multipost.export.error"));
+ ApplicationIOUtil.zip(directory,
+ file,
+ file2zip,
+ n_("tutti.service.multipost.export.error"));
} finally {
- TuttiIOUtil.deleteDirectory(directory, _("tutti.service.multipost.export.deleteTempDirectory.error", file));
+ ApplicationIOUtil.deleteDirectory(directory, _("tutti.service.multipost.export.deleteTempDirectory.error", file));
}
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/multipost/MultiPostImportService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/multipost/MultiPostImportService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/multipost/MultiPostImportService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -29,8 +29,8 @@
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Maps;
-import fr.ifremer.tutti.TuttiBusinessException;
-import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.shared.application.ApplicationBusinessException;
+import fr.ifremer.shared.application.ApplicationIOUtil;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.TuttiEntity;
@@ -170,7 +170,7 @@
@Override
public Map<String, Object> call() throws Exception {
- File tempDir = TuttiIOUtil.explodeZip(
+ File tempDir = ApplicationIOUtil.explodeZip(
context.getConfig().getTmpDirectory(),
file,
n_("tutti.service.multipost.uncompress.error"));
@@ -240,7 +240,7 @@
List<Species> speciesList) {
final Map<String, SpeciesBatch> batches = Maps.newHashMap();
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, SPECIES_FILE),
n_("tutti.service.multipost.import.batches.error"));
@@ -310,11 +310,11 @@
batches.put(row.getId(), batch);
}
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -329,7 +329,7 @@
ListMultimap<String, SpeciesBatchFrequency> frequencyMap =
ArrayListMultimap.create();
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, FREQUENCIES_FILE),
n_("tutti.service.multipost.import.frequencies.error"));
@@ -355,11 +355,11 @@
}
}
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -374,7 +374,7 @@
FishingOperation operation,
CatchWeightsRowModel weightsModel,
Map<String, Object> notImportedData) {
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, WEIGHTS_FILE),
n_("tutti.service.multipost.import.weights.error"));
@@ -411,11 +411,11 @@
}
persistenceService.saveCatchBatch(catchBatch);
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -440,7 +440,7 @@
@Override
public Map<String, Object> call() throws Exception {
- File tempDir = TuttiIOUtil.explodeZip(
+ File tempDir = ApplicationIOUtil.explodeZip(
context.getConfig().getTmpDirectory(),
file,
n_("tutti.service.multipost.uncompress.error"));
@@ -504,7 +504,7 @@
Map<String, BenthosBatch> notImportedBatches,
List<Species> speciesList) {
final Map<String, BenthosBatch> batches = Maps.newHashMap();
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, BENTHOS_FILE),
n_("tutti.service.multipost.import.batches.error"));
@@ -575,11 +575,11 @@
}
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -593,7 +593,7 @@
ListMultimap<String, BenthosBatchFrequency> frequencyMap =
ArrayListMultimap.create();
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, FREQUENCIES_FILE),
n_("tutti.service.multipost.import.frequencies.error"));
try {
@@ -618,11 +618,11 @@
}
}
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -637,7 +637,7 @@
FishingOperation operation,
CatchWeightsRowModel weightsModel,
Map<String, Object> notImportedData) {
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, WEIGHTS_FILE),
n_("tutti.service.multipost.import.weights.error"));
@@ -675,11 +675,11 @@
persistenceService.saveCatchBatch(catchBatch);
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -703,7 +703,7 @@
@Override
public Map<String, Object> call() throws Exception {
- File tempDir = TuttiIOUtil.explodeZip(
+ File tempDir = ApplicationIOUtil.explodeZip(
context.getConfig().getTmpDirectory(),
file,
n_("tutti.service.multipost.uncompress.error"));
@@ -765,7 +765,7 @@
Map<String, MarineLitterBatch> batches = Maps.newLinkedHashMap();
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, MARINE_LITTER_FILE),
n_("tutti.service.multipost.import.batches.error"));
@@ -814,12 +814,12 @@
}
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -831,7 +831,7 @@
MarineLitterWeightRowModel weightModel,
Map<String, Object> notImportedData) {
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, WEIGHTS_FILE),
n_("tutti.service.multipost.import.weights.error"));
@@ -871,7 +871,7 @@
@Override
public Void call() throws Exception {
- File tempDir = TuttiIOUtil.explodeZip(
+ File tempDir = ApplicationIOUtil.explodeZip(
context.getConfig().getTmpDirectory(),
file,
n_("tutti.service.multipost.uncompress.error"));
@@ -924,7 +924,7 @@
IndividualObservationRowModel csvModel = new IndividualObservationRowModel(csvSeparator,
speciesList,
caracteristics);
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, INDIVIDUAL_OBSERVATION_FILE),
n_("tutti.service.multipost.import.batches.error"));
@@ -949,12 +949,12 @@
batches.put(row.getBatchId(), batch);
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -967,7 +967,7 @@
CaracteristicRowModel caracteristicModel = new CaracteristicRowModel(csvSeparator,
caracteristics);
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, CARACTERISTIC_FILE),
n_("tutti.service.multipost.import.caracteristics.error"));
@@ -995,13 +995,13 @@
}
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -1023,7 +1023,7 @@
@Override
public Void call() throws Exception {
- File tempDir = TuttiIOUtil.explodeZip(
+ File tempDir = ApplicationIOUtil.explodeZip(
context.getConfig().getTmpDirectory(),
file,
n_("tutti.service.multipost.uncompress.error"));
@@ -1080,7 +1080,7 @@
Map<String, AccidentalBatch> batches = Maps.newLinkedHashMap();
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, ACCIDENTAL_CATCHES_FILE),
n_("tutti.service.multipost.import.batches.error"));
@@ -1113,12 +1113,12 @@
batches.put(row.getBatchId(), batch);
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -1132,7 +1132,7 @@
CaracteristicRowModel caracteristicModel = new CaracteristicRowModel(csvSeparator,
caracteristics);
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(file, CARACTERISTIC_FILE),
n_("tutti.service.multipost.import.caracteristics.error"));
@@ -1160,13 +1160,13 @@
}
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -1197,7 +1197,7 @@
protected <FO extends AbstractFishingOperationRow> void checkSameOperation(File directory,
AbstractFishingOperationRowModel<FO> fishingOperationRowModel,
FishingOperation operation) {
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(directory, WEIGHTS_FILE),
n_("tutti.service.multipost.import.operation.error"));
@@ -1215,9 +1215,9 @@
|| ObjectUtils.notEqual(row.getMultirigAggregation(), operation.getMultirigAggregation())
|| ObjectUtils.notEqual(rowDate, operationDate)) {
- throw new TuttiBusinessException(_("tutti.service.multipost.import.wrongOperation.error",
- decoratorService.getDecoratorByType(FishingOperation.class)
- .toString(operation)));
+ throw new ApplicationBusinessException(_("tutti.service.multipost.import.wrongOperation.error",
+ decoratorService.getDecoratorByType(FishingOperation.class)
+ .toString(operation)));
}
}
} finally {
@@ -1247,7 +1247,7 @@
}
};
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(directory, ATTACHMENTS_FILE),
n_("tutti.service.multipost.import.attachments.error"));
@@ -1271,12 +1271,12 @@
}
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
@@ -1309,7 +1309,7 @@
}
};
- Reader reader = TuttiIOUtil.newReader(
+ Reader reader = ApplicationIOUtil.newReader(
new File(directory, ATTACHMENTS_FILE),
n_("tutti.service.multipost.import.attachments.error"));
@@ -1333,12 +1333,12 @@
}
}
- TuttiIOUtil.close(importer, "Could not close importer");
+ ApplicationIOUtil.close(importer, "Could not close importer");
} finally {
IOUtils.closeQuietly(importer);
}
- TuttiIOUtil.close(reader, "Could not close reader");
+ ApplicationIOUtil.close(reader, "Could not close reader");
} finally {
IOUtils.closeQuietly(reader);
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/TuttiExportService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/TuttiExportService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/TuttiExportService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -29,9 +29,9 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Files;
-import fr.ifremer.tutti.TuttiBusinessException;
-import fr.ifremer.tutti.TuttiIOUtil;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
+import fr.ifremer.shared.application.ApplicationIOUtil;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
@@ -153,7 +153,7 @@
File basedir = new File(context.getConfig().newTempFile(
"exportProgram"), "exportProgram-" + programId);
- TuttiIOUtil.forceMkdir(basedir, _("tutti.service.mkDir.error", basedir));
+ ApplicationIOUtil.forceMkdir(basedir, _("tutti.io.mkDir.error", basedir));
ExportContext exportContext = createExportContext(basedir);
@@ -163,12 +163,12 @@
cruise = persistenceService.getCruise(cruise.getId());
exportCruise(cruise, exportContext, progressionModel);
}
- TuttiIOUtil.close(exportContext, _("tutti.service.export.closeContext.error"));
+ ApplicationIOUtil.close(exportContext, _("tutti.service.export.closeContext.error"));
progressionModel.setMessage(
_("tutti.service.exportCruise.buildZip", exportFile));
- TuttiIOUtil.zip(basedir, exportFile, _("tutti.service.export.zip.error", exportFile));
+ ApplicationIOUtil.zip(basedir, exportFile, _("tutti.service.export.zip.error", exportFile));
progressionModel.increments(1);
} finally {
IOUtils.closeQuietly(exportContext);
@@ -190,10 +190,10 @@
}
// check cruise fishing operations
- TuttiBusinessException checkError = null;
+ ApplicationBusinessException checkError = null;
try {
checkCruise(progressionModel, cruise);
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
// error while checking cruise
if (log.isDebugEnabled()) {
log.debug("Got a check cruise error", e);
@@ -204,18 +204,18 @@
File basedir = new File(context.getConfig().newTempFile(
"exportCruise"), "exportCruise-" + cruiseId);
- TuttiIOUtil.forceMkdir(basedir, _("tutti.service.mkDir.error", basedir));
+ ApplicationIOUtil.forceMkdir(basedir, _("tutti.io.mkDir.error", basedir));
ExportContext exportContext = createExportContext(basedir);
try {
exportCruise(cruise, exportContext, progressionModel);
- TuttiIOUtil.close(exportContext, _("tutti.service.export.closeContext.error"));
+ ApplicationIOUtil.close(exportContext, _("tutti.service.export.closeContext.error"));
progressionModel.setMessage(
_("tutti.service.exportCruise.buildZip", exportFile));
- TuttiIOUtil.zip(basedir, exportFile, _("tutti.service.export.zip.error", exportFile));
+ ApplicationIOUtil.zip(basedir, exportFile, _("tutti.service.export.zip.error", exportFile));
progressionModel.increments(1);
} finally {
IOUtils.closeQuietly(exportContext);
@@ -278,7 +278,7 @@
sb.append(_("tutti.service.export.invalid.fishingOperation", fishingOperationStr, entry.getValue()));
}
String cruiseStr = cruiseDecorator.toString(cruise);
- throw new TuttiBusinessException(
+ throw new ApplicationBusinessException(
_("tutti.service.export.invalid.cruise", cruiseStr, sb.toString()));
}
}
@@ -355,7 +355,7 @@
exportContext.surveyModel.prepareRows(rows, cruise, country);
exportContext.surveyExport.write(rows, exportContext.surveyWriter);
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.export.survey.error"), e);
+ throw new ApplicationTechnicalException(_("tutti.service.export.survey.error"), e);
}
}
@@ -380,7 +380,7 @@
exportContext.gearCaracteristicsExport.write(rows, exportContext.gearCaracteristicsWriter);
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.export.survey.error"), e);
+ throw new ApplicationTechnicalException(_("tutti.service.export.survey.error"), e);
}
}
@@ -404,7 +404,7 @@
exportContext.operationExport.write(rows, exportContext.operationWriter);
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.export.operations.error"), e);
+ throw new ApplicationTechnicalException(_("tutti.service.export.operations.error"), e);
}
}
@@ -421,7 +421,7 @@
}
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.export.parameters.error"), e);
+ throw new ApplicationTechnicalException(_("tutti.service.export.parameters.error"), e);
}
}
@@ -444,7 +444,7 @@
}
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.export.parameters.error"), e);
+ throw new ApplicationTechnicalException(_("tutti.service.export.parameters.error"), e);
}
}
@@ -470,7 +470,7 @@
}
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.export.parameters.error"), e);
+ throw new ApplicationTechnicalException(_("tutti.service.export.parameters.error"), e);
}
}
@@ -489,7 +489,7 @@
}
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.export.parameters.error"), e);
+ throw new ApplicationTechnicalException(_("tutti.service.export.parameters.error"), e);
}
}
@@ -579,7 +579,7 @@
}
} catch (Exception e) {
- throw new TuttiTechnicalException(
+ throw new ApplicationTechnicalException(
_("tutti.service.export.catches.error"), e);
}
}
@@ -592,7 +592,7 @@
exportContext.speciesExport.write(rows, exportContext.speciesWriter);
} catch (Exception e) {
- throw new TuttiTechnicalException(
+ throw new ApplicationTechnicalException(
_("tutti.service.export.catches.error"), e);
}
}
@@ -723,7 +723,7 @@
} catch (FileNotFoundException e) {
// should never happen
- throw new TuttiTechnicalException(_("tutti.service.export.context.error"), e);
+ throw new ApplicationTechnicalException(_("tutti.service.export.context.error"), e);
}
surveyModel = new SurveyExportModel(csvSeparator);
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,8 +26,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import fr.ifremer.tutti.TuttiBusinessException;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatch;
import fr.ifremer.tutti.persistence.entities.referential.Species;
@@ -102,11 +101,10 @@
*
* @param targetFile pdf file to generate
* @param locale generated pdf locale
- * @throws TuttiBusinessException
*/
public void generateCruisePDFFile(File targetFile,
String cruiseId,
- Locale locale) throws TuttiBusinessException {
+ Locale locale) {
List<String> allFishingOperation =
@@ -128,12 +126,11 @@
* @param targetFile pdf file to generate
* @param fishingOperationId id of the fishing operation to export
* @param locale generated pdf locale
- * @throws TuttiBusinessException
* @since 2.7
*/
public void generateFishingOperationPDFFile(File targetFile,
String fishingOperationId,
- Locale locale) throws TuttiBusinessException {
+ Locale locale) {
List<Map<String, Object>> operations = Lists.newArrayList();
@@ -277,7 +274,7 @@
os.close();
} catch (Exception ex) {
- throw new TuttiTechnicalException(_("tutti.service.operations.exportCatchesReport.error"), ex);
+ throw new ApplicationTechnicalException(_("tutti.service.operations.exportCatchesReport.error"), ex);
} finally {
IOUtils.closeQuietly(os);
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -28,7 +28,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.service.AbstractTuttiService;
@@ -146,7 +146,7 @@
writer.close();
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.sumatra.export.error", file), e);
+ throw new ApplicationTechnicalException(_("tutti.service.sumatra.export.error", file), e);
} finally {
IOUtils.closeQuietly(writer);
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/ProtocolImportExportService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/ProtocolImportExportService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/ProtocolImportExportService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -32,7 +32,7 @@
import com.google.common.collect.Multimap;
import com.google.common.collect.TreeMultimap;
import com.google.common.io.Files;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocols;
@@ -221,7 +221,7 @@
export.write(writer);
writer.close();
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.protocol.export.caracteristics.protocol.error", protocol.getName(), file), e);
+ throw new ApplicationTechnicalException(_("tutti.service.protocol.export.caracteristics.protocol.error", protocol.getName(), file), e);
} finally {
IOUtils.closeQuietly(writer);
}
@@ -290,7 +290,7 @@
} catch (ImportRuntimeException e) {
throw e;
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.protocol.import.species.error", protocol.getName(), file), e);
+ throw new ApplicationTechnicalException(_("tutti.service.protocol.import.species.error", protocol.getName(), file), e);
} finally {
IOUtils.closeQuietly(reader);
@@ -359,8 +359,8 @@
reader.close();
} catch (ImportRuntimeException e) {
throw e;
- }catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.protocol.import.benthos.error", protocol.getName(), file), e);
+ } catch (Exception e) {
+ throw new ApplicationTechnicalException(_("tutti.service.protocol.import.benthos.error", protocol.getName(), file), e);
} finally {
IOUtils.closeQuietly(reader);
}
@@ -397,7 +397,7 @@
export.write(writer);
writer.close();
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.protocol.export.species.error", file), e);
+ throw new ApplicationTechnicalException(_("tutti.service.protocol.export.species.error", file), e);
} finally {
IOUtils.closeQuietly(writer);
}
@@ -431,7 +431,7 @@
export.write(writer);
writer.close();
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.protocol.export.benthos.error", file), e);
+ throw new ApplicationTechnicalException(_("tutti.service.protocol.export.benthos.error", file), e);
} finally {
IOUtils.closeQuietly(writer);
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/SpeciesRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/SpeciesRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/SpeciesRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,7 +25,6 @@
*/
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.TuttiTechnicalException;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.TuttiCsvUtil;
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/PupitriImportExportService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/PupitriImportExportService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/PupitriImportExportService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -33,7 +33,7 @@
import com.google.common.collect.Multimaps;
import com.google.common.collect.Sets;
import com.google.common.io.Files;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
@@ -228,7 +228,7 @@
reader.close();
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.pupitri.import.trunk.error", operation.toString(), file), e);
+ throw new ApplicationTechnicalException(_("tutti.service.pupitri.import.trunk.error", operation.toString(), file), e);
} finally {
IOUtils.closeQuietly(importer);
@@ -415,7 +415,7 @@
} catch (Exception e) {
DecoratorService service = getService(DecoratorService.class);
- throw new TuttiTechnicalException(_("tutti.service.pupitri.import.carrousel.error", carrouselFile, service.getDecorator(operation).toString(operation)), e);//"Could not import carrousel data [" + operation.toString() + "] from file " + carrouselFile
+ throw new ApplicationTechnicalException(_("tutti.service.pupitri.import.carrousel.error", carrouselFile, service.getDecorator(operation).toString(operation)), e);//"Could not import carrousel data [" + operation.toString() + "] from file " + carrouselFile
} finally {
IOUtils.closeQuietly(carrouselImporter);
@@ -453,7 +453,7 @@
Export.exportToFile(speciesCsvModel, rows, target, Charsets.UTF_8, false);
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.pupitri.export.species.error", target), e);
+ throw new ApplicationTechnicalException(_("tutti.service.pupitri.export.species.error", target), e);
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/ReferentialImportExportService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/ReferentialImportExportService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/ReferentialImportExportService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -30,7 +30,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.io.Files;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Gears;
import fr.ifremer.tutti.persistence.entities.referential.Person;
@@ -120,7 +120,7 @@
} else {
message = e.getMessage();
}
- throw new TuttiTechnicalException(message, e);
+ throw new ApplicationTechnicalException(message, e);
} finally {
@@ -167,7 +167,7 @@
if (!existingIds.add(currentId)) {
// id was already in universe
- throw new TuttiTechnicalException(
+ throw new ApplicationTechnicalException(
_("tutti.service.referential.import.vessels.existingValue.error",
bean.getName(),
bean.getInternationalRegistrationCode()));
@@ -270,7 +270,7 @@
} else {
message = e.getMessage();
}
- throw new TuttiTechnicalException(message, e);
+ throw new ApplicationTechnicalException(message, e);
} finally {
@@ -308,7 +308,7 @@
} catch (IOException e) {
throw e;
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.referential.export.species.error", file), e);
+ throw new ApplicationTechnicalException(_("tutti.service.referential.export.species.error", file), e);
} finally {
IOUtils.closeQuietly(writer);
}
@@ -354,7 +354,7 @@
} catch (IOException e) {
throw e;
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.referential.export.vessel.error", file), e);
+ throw new ApplicationTechnicalException(_("tutti.service.referential.export.vessel.error", file), e);
} finally {
IOUtils.closeQuietly(writer);
}
@@ -391,7 +391,7 @@
} catch (IOException e) {
throw e;
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.referential.export.person.error", file), e);
+ throw new ApplicationTechnicalException(_("tutti.service.referential.export.person.error", file), e);
} finally {
IOUtils.closeQuietly(writer);
}
@@ -434,7 +434,7 @@
} catch (IOException e) {
throw e;
} catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.service.referential.export.gear.error", file), e);
+ throw new ApplicationTechnicalException(_("tutti.service.referential.export.gear.error", file), e);
} finally {
IOUtils.closeQuietly(writer);
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialSynchronizeService.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialSynchronizeService.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialSynchronizeService.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
import fr.ifremer.tutti.persistence.service.synchro.ReferentialSynchronizeResult;
@@ -66,16 +66,15 @@
protected Properties getRemoteProperties(File dbDirectory) {
Properties remoteConnectionProperties = new Properties();
- TuttiPersistenceConfig persistenceConfig =
- context.getConfig().getPersistenceConfig();
+ TuttiConfiguration config = context.getConfig();
String jdbcUrl = TuttiEntities.getJdbcUrl(dbDirectory,
- persistenceConfig.getDbName());
+ config.getDbName());
TuttiEntities.fillConnectionProperties(remoteConnectionProperties,
jdbcUrl,
- persistenceConfig.getJdbcUsername(),
- persistenceConfig.getJdbcPassword());
+ config.getJdbcUsername(),
+ config.getJdbcPassword());
return remoteConnectionProperties;
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties 2013-11-24 23:27:27 UTC (rev 1385)
@@ -21,6 +21,8 @@
tutti.config.option.weight.unit.marineLitter.description=
tutti.config.option.weight.unit.species.description=
tutti.config.service=
+tutti.io.deleteTempDirectory.error=
+tutti.io.mkDir.error=
tutti.property.attachment=
tutti.property.caracteristic=
tutti.property.country=
@@ -63,7 +65,6 @@
tutti.propety.no.zone=
tutti.propety.vessel.nation.registrationCode=
tutti.service.compressZipFile.error=
-tutti.service.config.deleteTempDirectory.error=
tutti.service.context.serviceInstanciation.error=
tutti.service.csv.parse.entityNotFound=
tutti.service.cvs.format.error=
@@ -94,7 +95,6 @@
tutti.service.exportSumatra.header.species=
tutti.service.exportSumatra.header.station=
tutti.service.exportSumatra.header.weight=
-tutti.service.mkDir.error=
tutti.service.multipost.attachment.copy.error=
tutti.service.multipost.attachment.mkdir.error=
tutti.service.multipost.export.attachments.error=
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2013-11-24 23:27:27 UTC (rev 1385)
@@ -21,6 +21,8 @@
tutti.config.option.weight.unit.marineLitter.description=Unité de poids à utiliser dans la saisies des macro-déchêts
tutti.config.option.weight.unit.species.description=Unité de poids à utiliser dans la saisies des espèces
tutti.config.service=Configuration des services de l'application
+tutti.io.deleteTempDirectory.error=Erreur lors de la suppression du dossier temporaire
+tutti.io.mkDir.error=Erreur à la création du dossier %s
tutti.property.attachment=Pièce jointe
tutti.property.caracteristic=Caractéristique
tutti.property.country=Pays
@@ -63,7 +65,6 @@
tutti.propety.no.zone=Pas de zone
tutti.propety.vessel.nation.registrationCode=%s (nat.)
tutti.service.compressZipFile.error=Erreur lors de la compression du dossier %1s dans le fichier %2s
-tutti.service.config.deleteTempDirectory.error=Erreur lors de la suppression du dossier temporaire
tutti.service.context.serviceInstanciation.error=Erreur lors de l'instanciation du service %s
tutti.service.csv.parse.entityNotFound=L'entité de type %1s avec la propriété %2s de valeur %3s n'a pas été trouvée
tutti.service.cvs.format.error=Erreur lors du formatage de la valeur %s
@@ -94,7 +95,6 @@
tutti.service.exportSumatra.header.species=Espèce
tutti.service.exportSumatra.header.station=Station
tutti.service.exportSumatra.header.weight=Total
-tutti.service.mkDir.error=Erreur à la création du dossier %s
tutti.service.multipost.attachment.copy.error=Erreur lors de l'export de la pièce-jointe %s
tutti.service.multipost.attachment.mkdir.error=Impossible de créer le répertoire %s
tutti.service.multipost.export.attachments.error=Erreur lors de l'export des pièces-jointes
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,10 +24,9 @@
* #L%
*/
+import fr.ifremer.tutti.TuttiConfiguration;
+import fr.ifremer.tutti.TuttiConfigurationOption;
import fr.ifremer.tutti.persistence.RessourceClassLoader;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfigOption;
-import fr.ifremer.tutti.service.config.TuttiServiceConfig;
-import fr.ifremer.tutti.service.config.TuttiServiceConfigOption;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
@@ -55,7 +54,7 @@
protected TuttiServiceContext serviceContext;
protected abstract TuttiServiceContext createServiceContext(RessourceClassLoader loader,
- TuttiServiceConfig config);
+ TuttiConfiguration config);
@Before
public void setUp() throws Exception {
@@ -70,20 +69,15 @@
ApplicationConfig applicationConfig =
new ApplicationConfig("tutti-test.properties");
applicationConfig.loadDefaultOptions(
- TuttiPersistenceConfigOption.values());
- applicationConfig.loadDefaultOptions(
- TuttiServiceConfigOption.values());
- applicationConfig.setDefaultOption(TuttiServiceConfigOption.BASEDIR.getKey(),
+ TuttiConfigurationOption.values());
+ applicationConfig.setDefaultOption(TuttiConfigurationOption.BASEDIR.getKey(),
datadirectory.getAbsolutePath());
-// applicationConfig.setDefaultOption(TuttiServiceConfigOption.DATA_DIRECTORY.getKey(),
-// new File(datadirectory, "data").getAbsolutePath());
applicationConfig.parse();
RessourceClassLoader loader =
new RessourceClassLoader(getClass().getClassLoader());
- TuttiServiceConfig config =
- new TuttiServiceConfig(applicationConfig);
+ TuttiConfiguration config = new TuttiConfiguration(applicationConfig);
serviceContext = createServiceContext(loader, config);
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.LabelAware;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.Attachments;
@@ -53,7 +54,6 @@
import fr.ifremer.tutti.persistence.entities.referential.TuttiLocations;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.entities.referential.Vessels;
-import fr.ifremer.tutti.service.config.TuttiServiceConfig;
import org.apache.commons.lang3.time.DateUtils;
import org.junit.Assert;
import org.junit.Before;
@@ -76,7 +76,7 @@
private DecoratorService service;
@Override
- protected TuttiServiceContext createServiceContext(RessourceClassLoader loader, TuttiServiceConfig config) {
+ protected TuttiServiceContext createServiceContext(RessourceClassLoader loader, TuttiConfiguration config) {
return new TuttiServiceContext(loader, config);
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/ServiceDbResource.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/ServiceDbResource.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/ServiceDbResource.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,9 +27,10 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Files;
-import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.shared.application.ApplicationIOUtil;
+import fr.ifremer.tutti.TuttiConfiguration;
+import fr.ifremer.tutti.TuttiConfigurationOption;
import fr.ifremer.tutti.persistence.RessourceClassLoader;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfigOption;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
@@ -37,8 +38,6 @@
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.test.DatabaseResource;
-import fr.ifremer.tutti.service.config.TuttiServiceConfig;
-import fr.ifremer.tutti.service.config.TuttiServiceConfigOption;
import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
import org.apache.commons.io.Charsets;
import org.apache.commons.io.IOUtils;
@@ -74,8 +73,8 @@
Pair<String, String>... entryAndExpectedContent) throws IOException {
Assert.assertTrue(zipFile.exists());
- File explodeDir = TuttiIOUtil.explodeZip(
- getServiceConfig().getTmpDirectory(),
+ File explodeDir = ApplicationIOUtil.explodeZip(
+ getConfig().getTmpDirectory(),
zipFile,
"could not explode archive zip");
for (Pair<String, String> stringStringPair : entryAndExpectedContent) {
@@ -118,7 +117,7 @@
}
protected TuttiServiceContext createServiceContext(RessourceClassLoader loader,
- TuttiServiceConfig config) {
+ TuttiConfiguration config) {
return new TuttiServiceContext(loader, config) {
Map<Class<?>, Integer> counts = Maps.newHashMap();
@@ -140,9 +139,7 @@
public void prepareConfig(ApplicationConfig applicationConfig,
File resourceDirectory) {
applicationConfig.loadDefaultOptions(
- TuttiPersistenceConfigOption.values());
- applicationConfig.loadDefaultOptions(
- TuttiServiceConfigOption.values());
+ TuttiConfigurationOption.values());
applicationConfig.setDefaultOption(
"tutti.basedir",
@@ -151,8 +148,6 @@
protected TuttiServiceContext serviceContext;
- protected TuttiServiceConfig serviceConfig;
-
public static ServiceDbResource readDb() {
return new ServiceDbResource("");
}
@@ -194,10 +189,6 @@
return serviceContext;
}
- public TuttiServiceConfig getServiceConfig() {
- return serviceConfig;
- }
-
public TuttiProtocol loadProtocol(File protocolFile) {
Assert.assertTrue(protocolFile.exists());
@@ -212,10 +203,8 @@
protected void before(Description description) throws Throwable {
super.before(description);
- serviceConfig = new TuttiServiceConfig(getConfig());
+ serviceContext = createServiceContext(loader, getConfig());
- serviceContext = createServiceContext(loader, serviceConfig);
-
I18n.init(null, Locale.FRANCE);
serviceContext.getConfig().setCsvSeparator(';');
}
@@ -286,7 +275,7 @@
Assert.assertFalse(allCountry.isEmpty());
TuttiLocation franceCountry = TuttiEntities.splitById(allCountry).get(countryCode);
Assert.assertNotNull(franceCountry);
- getServiceConfig().setExportCountry(franceCountry.getId());
+ getConfig().setExportCountry(franceCountry.getId());
return serviceContext;
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,6 +25,7 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Cruises;
@@ -37,7 +38,6 @@
import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.TuttiLocations;
import fr.ifremer.tutti.persistence.entities.referential.Vessels;
-import fr.ifremer.tutti.service.config.TuttiServiceConfig;
import org.apache.commons.lang3.time.DateUtils;
import org.junit.Assert;
import org.junit.Before;
@@ -59,7 +59,7 @@
@Override
protected TuttiServiceContext createServiceContext(RessourceClassLoader loader,
- TuttiServiceConfig config) {
+ TuttiConfiguration config) {
return new TuttiServiceContext(loader, config, dataContext = new TuttiDataContextFake());
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/WeightComputingServiceTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/WeightComputingServiceTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/WeightComputingServiceTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,8 +24,12 @@
* #L%
*/
-import fr.ifremer.tutti.TuttiBusinessException;
-import fr.ifremer.tutti.persistence.entities.data.*;
+import fr.ifremer.shared.application.ApplicationBusinessException;
+import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
+import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
+import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
+import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.ServiceDbResource;
import fr.ifremer.tutti.service.TuttiServiceContext;
@@ -99,7 +103,7 @@
weightComputingService.computeCatchBatchWeights(catchBatch, batches, null, null);
Assert.fail();
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
//ok, it is supposed to throw an exception
if (log.isInfoEnabled()) {
log.info("expected error on operation #2 : " + e.getMessage());
@@ -112,7 +116,7 @@
weightComputingService.computeCatchBatchWeights(catchBatch, null, batches, null);
Assert.fail();
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
//ok, it is supposed to throw an exception
if (log.isInfoEnabled()) {
log.info("expected error on operation #3 : " + e.getMessage());
@@ -125,7 +129,7 @@
weightComputingService.computeCatchBatchWeights(catchBatch, null, null, batches);
Assert.fail();
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
//ok, it is supposed to throw an exception
if (log.isInfoEnabled()) {
log.info("expected error on operation #4 : " + e.getMessage());
@@ -139,7 +143,7 @@
weightComputingService.computeCatchBatchWeights(catchBatch, speciesBatches, benthosBatches, null);
Assert.fail();
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
//ok, it is supposed to throw an exception
if (log.isInfoEnabled()) {
log.info("expected error on operation #5 : " + e.getMessage());
@@ -151,7 +155,7 @@
weightComputingService.computeCatchBatchWeights(catchBatch, null, null, null);
Assert.fail();
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
//ok, it is supposed to throw an exception
if (log.isInfoEnabled()) {
log.info("expected error on operation #6 : " + e.getMessage());
@@ -167,7 +171,7 @@
log.info("Weight computing worked on operation #7");
}
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
Assert.fail();
}
}
@@ -176,12 +180,12 @@
public void computeSpeciesBatch() {
BatchContainer<SpeciesBatch> speciesBatchContainer = persistenceService.getRootSpeciesBatch(OPERATION_1_ID, null);
List<SpeciesBatch> speciesBatches = speciesBatchContainer.getChildren();
- for (int i = 0 ; i < speciesBatches.size() - 1 ; i++) {
+ for (int i = 0; i < speciesBatches.size() - 1; i++) {
try {
SpeciesBatch batch = speciesBatches.get(i);
weightComputingService.computeSpeciesBatch(batch);
Assert.fail();
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
//ok, it is supposed to throw an exception
if (log.isInfoEnabled()) {
log.info("expected error on species batch #" + i + " : " + e.getMessage());
@@ -195,18 +199,18 @@
log.info("last species batch weight computing worked");
}
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
Assert.fail();
}
BatchContainer<BenthosBatch> benthosBatchContainer = persistenceService.getRootBenthosBatch(OPERATION_1_ID, null);
List<BenthosBatch> benthosBatches = benthosBatchContainer.getChildren();
- for (int i = 0 ; i < benthosBatches.size() - 1 ; i++) {
+ for (int i = 0; i < benthosBatches.size() - 1; i++) {
try {
BenthosBatch batch = benthosBatches.get(i);
weightComputingService.computeBenthosBatch(batch);
Assert.fail();
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
//ok, it is supposed to throw an exception
if (log.isInfoEnabled()) {
log.info("expected error on species batch #" + i + " : " + e.getMessage());
@@ -220,7 +224,7 @@
log.info("last benthos batch weight computing worked");
}
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
Assert.fail();
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/multipost/MultiPostExportServiceTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/multipost/MultiPostExportServiceTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/catches/multipost/MultiPostExportServiceTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -131,7 +131,7 @@
@Before
public void setUp() throws Exception {
- dataDirectory = dbResource.getServiceConfig().getDataDirectory();
+ dataDirectory = dbResource.getConfig().getDataDirectory();
TuttiServiceContext serviceContext = dbResource.getServiceContext();
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,13 +25,12 @@
*/
import com.google.common.io.Files;
-import fr.ifremer.tutti.TuttiBusinessException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.ServiceDbResource;
import fr.ifremer.tutti.service.TuttiServiceContext;
import fr.ifremer.tutti.service.catches.WeightComputingService;
-import fr.ifremer.tutti.service.export.generic.TuttiExportService;
import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
@@ -72,7 +71,7 @@
@Before
public void setUp() throws Exception {
- dataDirectory = dbResource.getServiceConfig().getDataDirectory();
+ dataDirectory = dbResource.getConfig().getDataDirectory();
dbResource.setCountryInConfig("12");
@@ -119,7 +118,7 @@
service.exportCruise(CRUISE_ID, exportFile, progressionModel);
// got an error after but export was still performed
Assert.fail();
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
// got an error
Assert.assertTrue(true);
}
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -34,7 +34,6 @@
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.ServiceDbResource;
import fr.ifremer.tutti.service.TuttiServiceContext;
-import fr.ifremer.tutti.service.export.generic.TuttiExportService;
import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
@@ -206,7 +205,7 @@
@Before
public void setUp() throws Exception {
- dataDirectory = dbResource.getServiceConfig().getDataDirectory();
+ dataDirectory = dbResource.getConfig().getDataDirectory();
TuttiServiceContext serviceContext = dbResource.getServiceContext();
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportServiceTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportServiceTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportServiceTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -63,7 +63,7 @@
@Before
public void setUp() throws Exception {
- dataDirectory = dbResource.getServiceConfig().getDataDirectory();
+ dataDirectory = dbResource.getConfig().getDataDirectory();
TuttiServiceContext serviceContext = dbResource.getServiceContext();
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,7 +27,6 @@
import fr.ifremer.tutti.service.ServiceDbResource;
import fr.ifremer.tutti.service.TuttiServiceContext;
import fr.ifremer.tutti.service.catches.TuttiWeightComputingException;
-import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportService;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
@@ -73,7 +72,7 @@
@Before
public void setUp() throws Exception {
- dataDirectory = dbResource.getServiceConfig().getDataDirectory();
+ dataDirectory = dbResource.getConfig().getDataDirectory();
TuttiServiceContext serviceContext = dbResource.getServiceContext();
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/protocol/ProtocolImportExportServiceTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/protocol/ProtocolImportExportServiceTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/protocol/ProtocolImportExportServiceTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -165,12 +165,12 @@
@Before
public void setUp() throws Exception {
- dbResource.getServiceConfig().setCsvSeparator(';');
+ dbResource.getConfig().setCsvSeparator(';');
service = dbResource.getServiceContext().getService(
ProtocolImportExportService.class);
- datadirectory = dbResource.getServiceConfig().getDataDirectory();
+ datadirectory = dbResource.getConfig().getDataDirectory();
}
@Test
Modified: branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/referential/ReferentialImportExportServiceTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/referential/ReferentialImportExportServiceTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-service/src/test/java/fr/ifremer/tutti/service/referential/ReferentialImportExportServiceTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,7 +26,7 @@
import com.google.common.base.Charsets;
import com.google.common.io.Files;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
@@ -92,7 +92,7 @@
@Before
public void setUp() throws Exception {
- dataDirectory = dbResource.getServiceConfig().getDataDirectory();
+ dataDirectory = dbResource.getConfig().getDataDirectory();
TuttiServiceContext serviceContext = dbResource.getServiceContext();
@@ -124,7 +124,7 @@
try {
service.importTemporarySpecies(file);
Assert.fail();
- } catch (TuttiTechnicalException e) {
+ } catch (ApplicationTechnicalException e) {
Assert.assertTrue(true);
}
}
@@ -161,7 +161,7 @@
try {
service.importTemporaryVessel(file);
Assert.fail();
- } catch (TuttiTechnicalException e) {
+ } catch (ApplicationTechnicalException e) {
Assert.assertTrue(true);
}
}
@@ -177,7 +177,7 @@
try {
service.importTemporaryVessel(file);
Assert.fail();
- } catch (TuttiTechnicalException e) {
+ } catch (ApplicationTechnicalException e) {
// good duplicate vessel
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/pom.xml
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/pom.xml 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/pom.xml 2013-11-24 23:27:27 UTC (rev 1385)
@@ -106,6 +106,16 @@
</dependency>
<dependency>
+ <groupId>fr.ifremer.shared</groupId>
+ <artifactId>application</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>fr.ifremer.shared</groupId>
+ <artifactId>application-swing</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils</artifactId>
</dependency>
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/filtered-resources/log4j.properties
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/filtered-resources/log4j.properties 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/filtered-resources/log4j.properties 2013-11-24 23:27:27 UTC (rev 1385)
@@ -32,6 +32,7 @@
# tutti levels
log4j.logger.fr.ifremer.tutti=INFO
+log4j.logger.fr.ifremer.shared=INFO
#log4j.logger.fr.ifremer.tutti.ui.swing.util=WARN
#log4j.logger.fr.ifremer.tutti.ui.swing.util.action=INFO
#log4j.logger.org.hibernate.SQL=DEBUG
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/RunTutti.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/RunTutti.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/RunTutti.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,14 +24,13 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.ui.swing.content.MainUI;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
import fr.ifremer.tutti.ui.swing.content.StartAction;
import fr.ifremer.tutti.ui.swing.content.UpdateApplicationAction;
import fr.ifremer.tutti.ui.swing.content.UpdateReportAction;
import fr.ifremer.tutti.ui.swing.util.TuttiExceptionHandler;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -65,18 +64,17 @@
log.info("Starting Tutti with arguments: " + Arrays.toString(args));
}
- // override default exception management (after config init)
- Thread.setDefaultUncaughtExceptionHandler(new TuttiExceptionHandler());
- // See http://forge.codelutin.com/issues/2055
- //System.setProperty("sun.awt.exception.handler", TuttiExceptionHandler.class.getName());
-
// Create configuration
- TuttiApplicationConfig config =
- new TuttiApplicationConfig("tutti.config", args);
+ TuttiConfiguration config = new TuttiConfiguration("tutti.config", args);
// Create application context
TuttiUIContext context = TuttiUIContext.newContext(config);
+ // override default exception management (after config init)
+ Thread.setDefaultUncaughtExceptionHandler(new TuttiExceptionHandler(context.getErrorHelper()));
+ // See http://forge.codelutin.com/issues/2055
+ //System.setProperty("sun.awt.exception.handler", TuttiExceptionHandler.class.getName());
+
// prepare context (mainly init configs, i18n)
context.init();
@@ -103,9 +101,9 @@
if (canUpdateApplication) {
// try to update jre - i18n - application - help and exit if so
- UpdateApplicationAction logicAction = TuttiActionHelper.createLogicAction(new MainUIHandler(context),
- UpdateApplicationAction.class);
- TuttiActionHelper.runActionAndWait(logicAction);
+ UpdateApplicationAction logicAction = context.getActionFactory().createLogicAction(new MainUIHandler(context),
+ UpdateApplicationAction.class);
+ context.getActionEngine().runActionAndWait(logicAction);
reload = logicAction.isReload();
}
@@ -115,9 +113,9 @@
if (canUpdateData) {
// try to update report and exit if so
- UpdateReportAction logicAction = TuttiActionHelper.createLogicAction(new MainUIHandler(context),
- UpdateReportAction.class);
- TuttiActionHelper.runActionAndWait(logicAction);
+ UpdateReportAction logicAction = context.getActionFactory().createLogicAction(new MainUIHandler(context),
+ UpdateReportAction.class);
+ context.getActionEngine().runActionAndWait(logicAction);
reload |= logicAction.isReload();
}
@@ -153,9 +151,9 @@
});
// launch start action (use the tutti-start-action file)
- StartAction uiAction = TuttiActionHelper.createLogicAction(
+ StartAction uiAction = context.getActionFactory().createLogicAction(
mainUI.getHandler(), StartAction.class);
- TuttiActionHelper.runAction(uiAction);
+ context.getActionEngine().runAction(uiAction);
}
public static void closeTutti(MainUIHandler handler, Integer exitCode) {
Added: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiActionFactory.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiActionFactory.java (rev 0)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiActionFactory.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -0,0 +1,38 @@
+package fr.ifremer.tutti.ui.swing;
+
+import fr.ifremer.shared.application.ApplicationTechnicalException;
+import fr.ifremer.shared.application.swing.AbstractApplicationUIHandler;
+import fr.ifremer.shared.application.swing.action.AbstractApplicationAction;
+import fr.ifremer.shared.application.swing.action.ApplicationActionFactory;
+import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import org.apache.commons.lang3.reflect.ConstructorUtils;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Created on 11/24/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since XXX
+ */
+public class TuttiActionFactory extends ApplicationActionFactory {
+
+ @Override
+ public <A extends AbstractApplicationAction> A createLogicAction(AbstractApplicationUIHandler handler,
+ Class<A> actionName) {
+ TuttiUIContext context = (TuttiUIContext) handler.getContext();
+ if (AbstractMainUITuttiAction.class.isAssignableFrom(actionName) &&
+ context.getMainUI() != null) {
+ handler = context.getMainUI().getHandler();
+ }
+
+ try {
+ // create action
+ A result = ConstructorUtils.invokeConstructor(actionName, (AbstractTuttiUIHandler) handler);
+ return result;
+ } catch (Exception e) {
+ throw new ApplicationTechnicalException(_("application.action.create.error", actionName), e);
+ }
+ }
+}
Property changes on: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiActionFactory.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,12 +27,12 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import fr.ifremer.shared.application.ApplicationIOUtil;
+import fr.ifremer.shared.application.swing.action.ApplicationActionException;
import fr.ifremer.tutti.LabelAware;
-import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.updater.ApplicationInfo;
@@ -153,7 +153,7 @@
if (log.isErrorEnabled()) {
log.error("Could not update from " + propertiesURL, eee);
}
- throw TuttiActionException.propagateError(action, eee);
+ throw ApplicationActionException.propagateError(action, eee);
}
protected boolean updateDoneJre(Map<String, ApplicationInfo> appToUpdate,
@@ -202,19 +202,18 @@
}
doRestart = true;
- TuttiPersistenceConfig persistenceConfig =
- context.getConfig().getServiceConfig().getPersistenceConfig();
+ TuttiConfiguration config = context.getConfig();
// must remove the enumeration file at exit
- File enumerationPath = persistenceConfig.getDbEnumerationPath();
- TuttiIOUtil.forceDeleteOnExit(
+ File enumerationPath = config.getDbEnumerationPath();
+ ApplicationIOUtil.forceDeleteOnExit(
enumerationPath,
_("tutti.applicationUpdater.updateDone.deleteDirectory.enum.error", enumerationPath)
);
// must remove the db conf file at exit
- File dbConfPath = persistenceConfig.getDbConfigurationPath();
- TuttiIOUtil.forceDeleteOnExit(
+ File dbConfPath = config.getDbConfigurationPath();
+ ApplicationIOUtil.forceDeleteOnExit(
dbConfPath,
_("tutti.applicationUpdater.updateDone.deleteDirectory.dbConf.error", dbConfPath)
);
@@ -222,14 +221,14 @@
//FIXME-check this is necessary: i18n is no more generated ?
// must also remove i18n directory
File i18nDirectory = context.getConfig().getI18nDirectory();
- TuttiIOUtil.forceDeleteOnExit(
+ ApplicationIOUtil.forceDeleteOnExit(
i18nDirectory,
_("tutti.applicationUpdater.updateDone.deleteDirectory.i18n.error", i18nDirectory)
);
// must remove db cache directory
- File cacheDirectory = context.getConfig().getServiceConfig().getPersistenceConfig().getCacheDirectory();
- TuttiIOUtil.forceDeleteOnExit(
+ File cacheDirectory = config.getCacheDirectory();
+ ApplicationIOUtil.forceDeleteOnExit(
cacheDirectory,
_("tutti.applicationUpdater.updateDone.deleteDirectory.caches.error", i18nDirectory)
);
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,15 +26,15 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
+import fr.ifremer.shared.application.swing.action.ApplicationActionException;
+import fr.ifremer.shared.application.swing.action.ApplicationActionUI;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
import fr.ifremer.tutti.persistence.service.synchro.ReferentialSynchronizeResult;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.referential.TuttiReferentialSynchronizeService;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionException;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionUI;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -144,7 +144,7 @@
if (log.isErrorEnabled()) {
log.error("Could not update db", error);
}
- throw new TuttiActionException(action, error);
+ throw new ApplicationActionException(action, error);
} else {
ApplicationInfo info = appToUpdate.get(DB_UPDATE_NAME);
if (info != null) {
@@ -157,9 +157,9 @@
// before install or update, regenerate db configuration files
- TuttiPersistenceConfig persistenceConfig = regenerateDbConf();
+ TuttiConfiguration configuration = regenerateDbConf();
- persistenceConfig.generateExternalDbFiles(true);
+ configuration.generateExternalDbFiles(true);
if (dbInstalled) {
@@ -180,17 +180,16 @@
if (log.isErrorEnabled()) {
log.error("Could not update from " + propertiesURL, eee);
}
- throw TuttiActionException.propagateError(action, eee);
+ throw ApplicationActionException.propagateError(action, eee);
}
- protected TuttiPersistenceConfig regenerateDbConf() {
+ protected TuttiConfiguration regenerateDbConf() {
- TuttiPersistenceConfig persistenceConfig =
- context.getConfig().getServiceConfig().getPersistenceConfig();
+ TuttiConfiguration config = context.getConfig();
context.showInformationMessage(
"Regénérer les fichiers de configuration de la base");
- return persistenceConfig;
+ return config;
}
protected File getDbDirectory(ApplicationInfo info) {
@@ -207,19 +206,19 @@
log.info("First time database was downloaded at version: " + info.newVersion);
}
File source = getDbDirectory(info);
- File target = context.getConfig().getServiceConfig().getPersistenceConfig().getDbDirectory();
+ File target = context.getConfig().getDbDirectory();
if (log.isInfoEnabled()) {
log.info("Copy from " + source + " to " + target);
}
try {
FileUtils.copyDirectory(source, target);
} catch (IOException e) {
- throw new TuttiTechnicalException(_("tutti.applicationUpdater.prepareFirstDB.copyDirectory.error", source, target), e);
+ throw new ApplicationTechnicalException(_("tutti.applicationUpdater.prepareFirstDB.copyDirectory.error", source, target), e);
}
try {
FileUtils.deleteDirectory(source.getParentFile());
} catch (IOException e) {
- throw new TuttiTechnicalException(_("tutti.applicationUpdater.prepareFirstDB.deleteDirectory.error", target), e);
+ throw new ApplicationTechnicalException(_("tutti.applicationUpdater.prepareFirstDB.deleteDirectory.error", target), e);
}
}
@@ -231,18 +230,18 @@
ReferentialSynchronizeResult result = new ReferentialSynchronizeResult();
File dbDirectory = getDbDirectory(info);
- TuttiActionUI actionUI = context.getActionUI();
+ ApplicationActionUI actionUI = context.getActionUI();
actionUI.getModel().setProgressionModel(result.getProgressionModel());
service.prepare(dbDirectory, result);
if (!result.isSuccess()) {
- throw new TuttiTechnicalException(_("tutti.applicationUpdater.synchroDB.prepare.error"), result.getError());
+ throw new ApplicationTechnicalException(_("tutti.applicationUpdater.synchroDB.prepare.error"), result.getError());
}
service.synchronize(dbDirectory, result);
if (!result.isSuccess()) {
- throw new TuttiTechnicalException(_("tutti.applicationUpdater.synchroDB.synchro.error"), result.getError());
+ throw new ApplicationTechnicalException(_("tutti.applicationUpdater.synchroDB.synchro.error"), result.getError());
}
// reset cache
@@ -253,7 +252,7 @@
persistence.clearAllCaches();
// replace the version.appup file content
- File target = context.getConfig().getServiceConfig().getPersistenceConfig().getDbDirectory();
+ File target = context.getConfig().getDbDirectory();
File versionFile = ApplicationUpdater.getVersionFile(target);
if (log.isInfoEnabled()) {
log.info("Replace content of file " + versionFile + " with " + info.newVersion);
@@ -261,7 +260,7 @@
try {
ApplicationUpdater.storeVersionFile(target, info.newVersion);
} catch (IOException e) {
- throw new TuttiTechnicalException(_("tutti.applicationUpdater.synchroDB.writeVersion.error", versionFile));
+ throw new ApplicationTechnicalException(_("tutti.applicationUpdater.synchroDB.writeVersion.error", versionFile));
}
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiReportUpdaterCallBack.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiReportUpdaterCallBack.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiReportUpdaterCallBack.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,9 +25,9 @@
*/
import com.google.common.collect.Maps;
+import fr.ifremer.shared.application.swing.action.ApplicationActionException;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.updater.ApplicationInfo;
@@ -116,7 +116,7 @@
if (log.isErrorEnabled()) {
log.error("Could not update from " + propertiesURL, eee);
}
- throw TuttiActionException.propagateError(action, eee);
+ throw ApplicationActionException.propagateError(action, eee);
}
protected boolean updateDoneReport(Map<String, ApplicationInfo> appToUpdate,
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,10 +27,17 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.ApplicationBusinessException;
+import fr.ifremer.shared.application.ApplicationConfiguration;
+import fr.ifremer.shared.application.ApplicationIOUtil;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
+import fr.ifremer.shared.application.swing.ApplicationUIContext;
+import fr.ifremer.shared.application.swing.action.ApplicationActionEngine;
+import fr.ifremer.shared.application.swing.action.ApplicationActionFactory;
+import fr.ifremer.shared.application.swing.action.ApplicationActionUI;
+import fr.ifremer.shared.application.swing.util.ApplicationErrorHelper;
import fr.ifremer.tutti.PropagatePropertyChangeListener;
-import fr.ifremer.tutti.TuttiBusinessException;
-import fr.ifremer.tutti.TuttiIOUtil;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.service.ClosedPersistenceService;
import fr.ifremer.tutti.service.DecoratorService;
@@ -38,25 +45,22 @@
import fr.ifremer.tutti.service.TuttiDataContext;
import fr.ifremer.tutti.service.TuttiServiceContext;
import fr.ifremer.tutti.service.ValidationService;
-import fr.ifremer.tutti.service.export.pdf.CatchesPdfExportService;
import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
import fr.ifremer.tutti.service.catches.WeightCleaningService;
import fr.ifremer.tutti.service.catches.WeightComputingService;
import fr.ifremer.tutti.service.catches.multipost.MultiPostExportService;
import fr.ifremer.tutti.service.catches.multipost.MultiPostImportService;
import fr.ifremer.tutti.service.export.generic.TuttiExportService;
+import fr.ifremer.tutti.service.export.pdf.CatchesPdfExportService;
+import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportService;
import fr.ifremer.tutti.service.protocol.ProtocolImportExportService;
import fr.ifremer.tutti.service.pupitri.PupitriImportExportService;
import fr.ifremer.tutti.service.referential.ReferentialImportExportService;
import fr.ifremer.tutti.service.referential.TuttiReferentialSynchronizeService;
import fr.ifremer.tutti.service.report.ReportService;
-import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportService;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.content.MainUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiErrorHelper;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.UIMessageNotifier;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionUI;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.swing.editor.bean.BeanDoubleList;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
@@ -76,6 +80,8 @@
import org.nuiton.i18n.init.UserI18nInitializer;
import org.nuiton.util.converter.ConverterUtil;
+import java.awt.Color;
+import java.awt.Component;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.Closeable;
@@ -98,7 +104,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class TuttiUIContext extends AbstractBean implements Closeable, UIMessageNotifier, JAXXHelpUIHandler, PropagatePropertyChangeListener.PropagatePropertyChange {
+public class TuttiUIContext extends AbstractBean implements Closeable, UIMessageNotifier, JAXXHelpUIHandler, PropagatePropertyChangeListener.PropagatePropertyChange, ApplicationUIContext {
/** Logger. */
private static final Log log = LogFactory.getLog(TuttiUIContext.class);
@@ -147,7 +153,7 @@
*
* @since 0.1
*/
- protected final TuttiApplicationConfig config;
+ protected final TuttiConfiguration config;
/**
* ClassLoader ressource.
@@ -175,7 +181,7 @@
*
* @since 1.0
*/
- protected final TuttiErrorHelper errorHelper;
+ protected final ApplicationErrorHelper errorHelper;
/**
* Shared data context.
@@ -235,7 +241,7 @@
private MainUI mainUI;
- private TuttiActionUI actionUI;
+ private ApplicationActionUI actionUI;
/**
* Flag to know if there is an exsiting db.
@@ -253,7 +259,11 @@
private Properties helpMapping;
- public static TuttiUIContext newContext(TuttiApplicationConfig config) {
+ private final ApplicationActionFactory tuttiActionFactory;
+
+ private final ApplicationActionEngine tuttiActionEngine;
+
+ public static TuttiUIContext newContext(TuttiConfiguration config) {
Preconditions.checkNotNull(config);
Preconditions.checkState(applicationContext == null,
"Application context was already opened!");
@@ -265,21 +275,31 @@
return applicationContext;
}
- public static TuttiErrorHelper getErrorHelper() {
+ public ApplicationErrorHelper getErrorHelper() {
return applicationContext.errorHelper;
}
- protected TuttiUIContext(TuttiApplicationConfig config) {
+ @Override
+ public String getI18nPrefix() {
+ return "i18n.property.";
+ }
+
+ @Override
+ public String getDateFormat() {
+ return getConfig().getDateFormat();
+ }
+
+ protected TuttiUIContext(TuttiConfiguration config) {
this.config = config;
this.resourceLoader = new RessourceClassLoader(Thread.currentThread().getContextClassLoader());
- this.serviceContext = new TuttiServiceContext(resourceLoader, config.getServiceConfig());
+ this.serviceContext = new TuttiServiceContext(resourceLoader, config);
Map<Class, State> additionalStates = Maps.newHashMap();
additionalStates.put(BeanFilterableComboBox.class, new BeanFilterableComboBoxState());
additionalStates.put(BeanDoubleList.class, new BeanDoubleListState());
this.swingSession = new SwingSession(getConfig().getUIConfigFile(), false, additionalStates);
- this.errorHelper = new TuttiErrorHelper(this);
+ this.errorHelper = new ApplicationErrorHelper(this);
this.dataContext = serviceContext.getDataContext();
PropagatePropertyChangeListener.listenAndPropagateAll(dataContext, this);
UIMessageNotifier logMessageNotifier = new UIMessageNotifier() {
@@ -301,15 +321,34 @@
};
this.messageNotifiers = Sets.newHashSet();
addMessageNotifier(logMessageNotifier);
+ tuttiActionFactory = new TuttiActionFactory();
+ tuttiActionEngine = new ApplicationActionEngine(tuttiActionFactory);
}
+ @Override
+ public ApplicationConfiguration getConfiguration() {
+ return config;
+ }
+
+ @Override
+ public Component getBodyUI() {
+ MainUI mainUI = getMainUI();
+ return mainUI == null ? null : mainUI.getBody();
+ }
+
+ @Override
+ public Component getStatusUI() {
+ MainUI mainUI = getMainUI();
+ return mainUI == null ? null : mainUI.getStatus();
+ }
+
//------------------------------------------------------------------------//
//-- Open / close methods --//
//------------------------------------------------------------------------//
public void init() {
- config.getServiceConfig().prepareDirectories();
+ config.prepareDirectories();
// use our special classLoader (which will read some files from resources from a configuration directory)
Thread.currentThread().setContextClassLoader(getResourceLoader());
@@ -335,7 +374,7 @@
// init db configuration
//--------------------------------------------------------------------//
- config.getServiceConfig().getPersistenceConfig().initConfig(getResourceLoader());
+ config.initConfig(getResourceLoader());
// // clean db cache (avoid a lots of headache :(
// File cacheDirectory = config.getServiceConfig().getPersistenceConfig().getCacheDirectory();
@@ -356,14 +395,14 @@
if (i18nDirectory.exists()) {
// clean i18n cache
- TuttiIOUtil.cleanDirectory(
+ ApplicationIOUtil.cleanDirectory(
i18nDirectory,
_("tutti.i18n.deleteCache.error", i18nDirectory));
}
}
- TuttiIOUtil.forceMkdir(i18nDirectory,
- _("tutti.i18n.mkDir.error", i18nDirectory));
+ ApplicationIOUtil.forceMkdir(i18nDirectory,
+ _("tutti.i18n.mkDir.error", i18nDirectory));
if (log.isDebugEnabled()) {
log.debug("I18N directory: " + i18nDirectory);
@@ -395,7 +434,7 @@
if (log.isDebugEnabled()) {
log.debug("Help directory: " + helpDirectory);
}
- TuttiIOUtil.forceMkdir(
+ ApplicationIOUtil.forceMkdir(
helpDirectory,
_("tutti.help.mkDir.error", helpDirectory));
@@ -421,7 +460,7 @@
//--------------------------------------------------------------------//
// init action UI
//--------------------------------------------------------------------//
- setActionUI(new TuttiActionUI(null, this));
+ setActionUI(new ApplicationActionUI(null, this));
}
public void open() {
@@ -446,8 +485,7 @@
setProtocolId(config.getProtocolId());
}
- boolean dbExists =
- config.getServiceConfig().getPersistenceConfig().isDbExists();
+ boolean dbExists = config.isDbExists();
setDbExist(dbExists);
@@ -519,7 +557,7 @@
// use real service
service = serviceContext.getService(PersistenceService.class);
- dataContext.open(config.getServiceConfig(), service);
+ dataContext.open(config, service);
}
} else {
service = serviceContext.getService(ClosedPersistenceService.class);
@@ -596,7 +634,7 @@
try {
serviceContext.close();
} catch (IOException e) {
- throw new TuttiTechnicalException(_("tutti.context.service.close.error"), e);
+ throw new ApplicationTechnicalException(_("tutti.context.service.close.error"), e);
}
dataContext.close();
@@ -695,7 +733,7 @@
//-- Config methods --//
//------------------------------------------------------------------------//
- public TuttiApplicationConfig getConfig() {
+ public TuttiConfiguration getConfig() {
return config;
}
@@ -716,6 +754,7 @@
//-- UI methods --//
//------------------------------------------------------------------------//
+ @Override
public MainUI getMainUI() {
return mainUI;
}
@@ -724,11 +763,12 @@
this.mainUI = mainUI;
}
- public TuttiActionUI getActionUI() {
+ @Override
+ public ApplicationActionUI getActionUI() {
return actionUI;
}
- public void setActionUI(TuttiActionUI actionUI) {
+ public void setActionUI(ApplicationActionUI actionUI) {
this.actionUI = actionUI;
}
@@ -746,24 +786,43 @@
firePropertyChange(PROPERTY_SCREEN, oldValue, screen);
}
+ @Override
public boolean isBusy() {
return busy;
}
+ @Override
public void setBusy(boolean busy) {
this.busy = busy;
firePropertyChange(PROPERTY_BUSY, null, busy);
}
+ @Override
public boolean isHideBody() {
return hideBody;
}
+ @Override
public void setHideBody(boolean hideBody) {
this.hideBody = hideBody;
firePropertyChange(PROPERTY_HIDE_BODY, null, hideBody);
}
+ @Override
+ public Color getColorBlockingLayer() {
+ return getConfig().getColorBlockingLayer();
+ }
+
+ @Override
+ public ApplicationActionFactory getActionFactory() {
+ return tuttiActionFactory;
+ }
+
+ @Override
+ public ApplicationActionEngine getActionEngine() {
+ return tuttiActionEngine;
+ }
+
//------------------------------------------------------------------------//
//-- UIMessageNotifier methods --//
//------------------------------------------------------------------------//
@@ -814,7 +873,7 @@
String value = (String) helpMapping.get(helpId);
if (value == null) {
- throw new TuttiTechnicalException(_("tutti.context.helpPage.notFound", helpId));
+ throw new ApplicationTechnicalException(_("tutti.context.helpPage.notFound", helpId));
}
String helpDirectory = getConfig().getHelpResourceWithLocale(value);
@@ -837,7 +896,7 @@
}
TuttiUIUtil.openLink(resolvedUri);
} catch (URISyntaxException e) {
- throw new TuttiTechnicalException(_("tutti.context.helpPage.notFound", resolvedUri));
+ throw new ApplicationTechnicalException(_("tutti.context.helpPage.notFound", resolvedUri));
}
}
@@ -883,7 +942,7 @@
public boolean checkUpdateApplicationReachable() {
boolean result = true;
- TuttiApplicationConfig config = getConfig();
+ TuttiConfiguration config = getConfig();
String url = config.getUpdateApplicationUrl();
try {
@@ -893,8 +952,8 @@
n_("tutti.error.update.could.not.reach.url"),
n_("tutti.error.update.could.not.found.url")
);
- } catch (TuttiBusinessException e) {
- TuttiUIContext.getErrorHelper().showWarningDialog(e.getMessage());
+ } catch (ApplicationBusinessException e) {
+ getErrorHelper().showWarningDialog(e.getMessage());
result = false;
}
return result;
@@ -903,7 +962,7 @@
public boolean checkUpdateDataReachable() {
boolean result = true;
- TuttiApplicationConfig config = getConfig();
+ TuttiConfiguration config = getConfig();
String url = config.getUpdateDataUrl();
try {
@@ -913,8 +972,8 @@
n_("tutti.error.update.could.not.reach.url"),
n_("tutti.error.update.could.not.found.url")
);
- } catch (TuttiBusinessException e) {
- TuttiUIContext.getErrorHelper().showWarningDialog(e.getMessage());
+ } catch (ApplicationBusinessException e) {
+ getErrorHelper().showWarningDialog(e.getMessage());
result = false;
}
return result;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -48,7 +48,7 @@
toolTipText: "tutti.main.action.configuration.tip";
i18nMnemonic: "tutti.main.action.configuration.mnemonic";
enabled: {model.getScreen() != TuttiScreen.CONFIG};
- _tuttiAction: {ShowConfigAction.class};
+ _applicationAction: {ShowConfigAction.class};
_help: {"tutti.main.menu.action.configuration.help"};
}
@@ -58,7 +58,7 @@
toolTipText: "tutti.main.action.editSampleCategoryModel.tip";
i18nMnemonic: "tutti.main.action.editSampleCategoryModel.mnemonic";
enabled: {model.getScreen() != TuttiScreen.EDIT_SAMPLE_CATEGORY_MODEL};
- _tuttiAction: {EditSampleCategoryModelAction.class};
+ _applicationAction: {EditSampleCategoryModelAction.class};
_help: {"tutti.main.menu.action.editSampleCategoryModel.help"};
}
@@ -68,7 +68,7 @@
toolTipText: "tutti.main.action.report.tip";
i18nMnemonic: "tutti.main.action.report.mnemonic";
enabled: {model.getScreen() != TuttiScreen.REPORT};
- _tuttiAction: {ShowReportAction.class};
+ _applicationAction: {ShowReportAction.class};
_help: {"tutti.main.menu.action.report.help"};
}
@@ -77,7 +77,7 @@
text: "tutti.main.action.exit";
toolTipText: "tutti.main.action.exit.tip";
i18nMnemonic: "tutti.main.action.exit.mnemonic";
- _tuttiAction: {CloseApplicationAction.class};
+ _applicationAction: {CloseApplicationAction.class};
_help: {"tutti.main.menu.action.exit.help"};
}
@@ -86,7 +86,7 @@
text: "tutti.main.action.updateApplication";
toolTipText: "tutti.main.action.updateApplication.tip";
i18nMnemonic: "tutti.main.action.updateApplication.mnemonic";
- _tuttiAction: {UpdateApplicationAction.class};
+ _applicationAction: {UpdateApplicationAction.class};
_help: {"tutti.main.menu.action.updateApplication.help"};
}
@@ -95,7 +95,7 @@
text: "tutti.main.action.updateReport";
toolTipText: "tutti.main.action.updateReport.tip";
i18nMnemonic: "tutti.main.action.updateReport.mnemonic";
- _tuttiAction: {UpdateReportAction.class};
+ _applicationAction: {UpdateReportAction.class};
_help: {"tutti.main.menu.action.updateReport.help"};
}
@@ -105,36 +105,36 @@
toolTipText: "tutti.main.action.manageDb.tip";
i18nMnemonic: "tutti.main.action.manageDb.mnemonic";
enabled: {model.getScreen() != TuttiScreen.MANAGE_DB};
- _tuttiAction: {ManageDbAction.class};
+ _applicationAction: {ManageDbAction.class};
_help: {"tutti.main.menu.action.manageDb.help"};
}
#menuChangeLocale {
- actionIcon: translate;
- text: "tutti.main.menu.changeLocale";
- toolTipText: "tutti.main.action.changeLocale.tip";
- i18nMnemonic: "tutti.main.action.changeLocale.mnemonic";
- _help: {"tutti.main.menu.action.changeLocale.help"};
+ actionIcon: translate;
+ text: "tutti.main.menu.changeLocale";
+ toolTipText: "tutti.main.action.changeLocale.tip";
+ i18nMnemonic: "tutti.main.action.changeLocale.mnemonic";
+ _help: {"tutti.main.menu.action.changeLocale.help"};
}
#menuChangeLocaleFR {
- actionIcon: i18n-fr;
- text: "tutti.main.action.changeLocaleFR";
- toolTipText: "tutti.main.action.changeLocaleFR.tip";
- i18nMnemonic: "tutti.main.action.changeLocaleFR.mnemonic";
- enabled: {!handler.acceptLocale(model.getLocale(), "fr_FR")};
- _tuttiAction: {ChangeToLocaleFRAction.class};
- _help: {"tutti.main.menu.action.changeLocaleFR.help"};
+ actionIcon: i18n-fr;
+ text: "tutti.main.action.changeLocaleFR";
+ toolTipText: "tutti.main.action.changeLocaleFR.tip";
+ i18nMnemonic: "tutti.main.action.changeLocaleFR.mnemonic";
+ enabled: {!handler.acceptLocale(model.getLocale(), "fr_FR")};
+ _applicationAction: {ChangeToLocaleFRAction.class};
+ _help: {"tutti.main.menu.action.changeLocaleFR.help"};
}
#menuChangeLocaleUK {
- actionIcon: i18n-uk;
- text: "tutti.main.action.changeLocaleUK";
- toolTipText: "tutti.main.action.changeLocaleUK.tip";
- i18nMnemonic: "tutti.main.action.changeLocaleUK.mnemonic";
- enabled: {!handler.acceptLocale(model.getLocale(), "en_GB")};
- _tuttiAction: {ChangeToLocaleUKAction.class};
- _help: {"tutti.main.menu.action.changeLocaleUK.help"};
+ actionIcon: i18n-uk;
+ text: "tutti.main.action.changeLocaleUK";
+ toolTipText: "tutti.main.action.changeLocaleUK.tip";
+ i18nMnemonic: "tutti.main.action.changeLocaleUK.mnemonic";
+ enabled: {!handler.acceptLocale(model.getLocale(), "en_GB")};
+ _applicationAction: {ChangeToLocaleUKAction.class};
+ _help: {"tutti.main.menu.action.changeLocaleUK.help"};
}
#menuActions {
@@ -150,7 +150,7 @@
toolTipText: "tutti.main.action.selectCruise.tip";
enabled: {model.getScreen() != TuttiScreen.SELECT_CRUISE};
i18nMnemonic: "tutti.main.action.selectCruise.mnemonic";
- _tuttiAction: {SelectCruiseAction.class};
+ _applicationAction: {SelectCruiseAction.class};
_help: {"tutti.main.menu.action.selectCruise.help"};
}
@@ -160,7 +160,7 @@
toolTipText: "tutti.main.action.editProgram.tip";
i18nMnemonic: "tutti.main.action.editSelectedProgram.mnemonic";
enabled: {model.getScreen() != TuttiScreen.EDIT_PROGRAM && model.isProgramFilled()};
- _tuttiAction: {EditSelectedProgramAction.class};
+ _applicationAction: {EditSelectedProgramAction.class};
_help: {"tutti.main.menu.action.editProgram.help"};
}
@@ -170,7 +170,7 @@
toolTipText: "tutti.main.action.editSelectedCruise.tip";
i18nMnemonic: "tutti.main.action.editSelectedCruise.mnemonic";
enabled: {model.getScreen() != TuttiScreen.EDIT_CRUISE && model.isCruiseFilled()};
- _tuttiAction: {EditSelectedCruiseAction.class};
+ _applicationAction: {EditSelectedCruiseAction.class};
_help: {"tutti.main.menu.action.editCruise.help"};
}
@@ -180,7 +180,7 @@
toolTipText: "tutti.main.action.editSelectedProtocol.tip";
i18nMnemonic: "tutti.main.action.editSelectedProtocol.mnemonic";
enabled: {model.getScreen() != TuttiScreen.EDIT_PROTOCOL && model.isProtocolFilled()};
- _tuttiAction: {EditSelectedProtocolAction.class};
+ _applicationAction: {EditSelectedProtocolAction.class};
_help: {"tutti.main.menu.action.editProtocol.help"};
}
@@ -190,7 +190,7 @@
toolTipText: "tutti.main.action.editCatches.tip";
i18nMnemonic: "tutti.main.action.editCatches.mnemonic";
enabled: {model.getScreen() != TuttiScreen.EDIT_FISHING_OPERATION && model.isCruiseFilled()};
- _tuttiAction: {EditSelectedCruiseCatchesAction.class};
+ _applicationAction: {EditSelectedCruiseCatchesAction.class};
_help: {"tutti.main.menu.action.editCatches.help"};
}
@@ -200,7 +200,7 @@
toolTipText: "tutti.main.action.validateCatches.tip";
i18nMnemonic: "tutti.main.action.validateCatches.mnemonic";
enabled: {model.getScreen() != TuttiScreen.VALIDATE_CRUISE && model.isCruiseFilled()};
- _tuttiAction: {ValidateSelectedCruiseCatchesAction.class};
+ _applicationAction: {ValidateSelectedCruiseCatchesAction.class};
_help: {"tutti.main.menu.action.validateCatches.help"};
}
@@ -217,7 +217,7 @@
toolTipText: "tutti.main.action.importTemporaryReferential.tip";
i18nMnemonic: "tutti.main.action.importTemporaryReferential.mnemonic";
enabled: {model.getScreen() != TuttiScreen.IMPORT_TEMPORARY_REFERENTIAL};
- _tuttiAction: {ImportTemporaryReferentialAction.class};
+ _applicationAction: {ImportTemporaryReferentialAction.class};
_help: {"tutti.main.menu.action.importTemporaryReferential.help"};
}
@@ -228,11 +228,11 @@
}
#menuShowHelp {
- actionIcon: help;
- text: "tutti.main.action.showHelp";
- toolTipText: "tutti.main.action.showHelp.tip";
- i18nMnemonic: "tutti.main.action.showHelp.mnemonic";
- _help: {"tutti.index.help"};
+ actionIcon: help;
+ text: "tutti.main.action.showHelp";
+ toolTipText: "tutti.main.action.showHelp.tip";
+ i18nMnemonic: "tutti.main.action.showHelp.mnemonic";
+ _help: {"tutti.index.help"};
}
#menuHelpSite {
@@ -248,7 +248,7 @@
toolTipText: "tutti.main.action.about.tip";
actionIcon: about;
i18nMnemonic: "tutti.main.action.about.mnemonic";
- _tuttiAction: {ShowAboutAction.class};
+ _applicationAction: {ShowAboutAction.class};
_help: {"tutti.main.menu.action.about.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,6 +25,9 @@
*/
import com.google.common.base.Preconditions;
+import fr.ifremer.shared.application.swing.action.ApplicationActionUI;
+import fr.ifremer.shared.application.swing.util.CloseableUI;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
@@ -32,7 +35,6 @@
import fr.ifremer.tutti.ui.swing.RunTutti;
import fr.ifremer.tutti.ui.swing.TuttiScreen;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.content.category.EditSampleCategoryModelUI;
import fr.ifremer.tutti.ui.swing.content.config.TuttiConfigUI;
import fr.ifremer.tutti.ui.swing.content.cruise.EditCruiseUI;
@@ -48,11 +50,9 @@
import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUI;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.CloseableUI;
import fr.ifremer.tutti.ui.swing.util.RemoveablePropertyChangeListener;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionUI;
import jaxx.runtime.JAXXBinding;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.session.SwingSession;
@@ -90,9 +90,9 @@
protected MainUIHandler(TuttiUIContext context, MainUI ui) {
super(context, ui);
- this.persistenceService = context.getPersistenceService();
- context.setMainUI(ui);
- context.setActionUI(new TuttiActionUI(ui, context));
+ this.persistenceService = getContext().getPersistenceService();
+ getContext().setMainUI(ui);
+ getContext().setActionUI(new ApplicationActionUI(ui, context));
}
public MainUIHandler(TuttiUIContext context) {
@@ -116,6 +116,7 @@
@Override
public void beforeInitUI() {
+ TuttiUIContext context = getContext();
context.addPropertyChangeListener(new RemoveablePropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
@@ -194,7 +195,7 @@
ui.applyDataBinding(MainUI.BINDING_MENU_CHANGE_LOCALE_UK_ENABLED);
// Init SwingSession
- SwingSession swingSession = context.getSwingSession();
+ SwingSession swingSession = getContext().getSwingSession();
swingSession.add(ui);
swingSession.save();
@@ -214,6 +215,8 @@
@Override
public void onCloseUI() {
+ TuttiUIContext context = getContext();
+
// remove any screen
context.setScreen(null);
context.removeMessageNotifier(this);
@@ -286,7 +289,7 @@
}
public void gotoSite() {
- TuttiApplicationConfig config = context.getConfig();
+ TuttiConfiguration config = getConfig();
URL siteURL = config.getSiteUrl();
@@ -317,7 +320,7 @@
public boolean quitCurrentScreen() {
boolean canClose;
- if (context.getScreen() == null || currentBody == null) {
+ if (getContext().getScreen() == null || currentBody == null) {
// no screen, surely can quit
canClose = true;
@@ -349,7 +352,7 @@
* @since 1.0
*/
public void reloadPersistenceService() {
- this.persistenceService = context.reloadPersistenceService();
+ this.persistenceService = getContext().reloadPersistenceService();
}
/**
@@ -368,6 +371,8 @@
protected void setScreen(TuttiScreen screen) {
+ TuttiUIContext context = getContext();
+
// close current body (if any)
if (currentBody != null) {
TuttiUI<?, ?> body = (TuttiUI<?, ?>) currentBody;
@@ -510,6 +515,7 @@
protected String getSelectedCruiseTitle() {
+ TuttiUIContext context = getContext();
String title;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowAboutAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowAboutAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ShowAboutAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,14 +27,13 @@
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.ui.swing.TuttiApplicationUpdaterCallBack;
import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
import fr.ifremer.tutti.ui.swing.TuttiReportUpdaterCallBack;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import jaxx.runtime.swing.AboutPanel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -86,19 +85,6 @@
}
-// TuttiApplicationConfig config = context.getConfig();
-// String url = config.getUpdateApplicationUrl();
-//
-// try {
-// TuttiUIUtil.tryToConnectToUpdateUrl(
-// url,
-// n_("tutti.error.about.could.not.reach.url"));
-// canUpdate = true;
-// } catch (TuttiBusinessException e) {
-// TuttiUIContext.getErrorHelper().showWarningDialog(e.getMessage());
-// canUpdate = false;
-// }
-
return doAction;
}
@@ -126,7 +112,7 @@
about.setTitle(_("tutti.about.title"));
about.setAboutText(_("tutti.about.message"));
- TuttiApplicationConfig config = getContext().getConfig();
+ TuttiConfiguration config = getConfig();
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
int inceptionYear = config.getInceptionYear();
String years;
@@ -196,8 +182,8 @@
target.put(type, info);
}
- protected void addUpdateTab(TuttiApplicationConfig config) {
- File current = config.getTuttiBasedir();
+ protected void addUpdateTab(TuttiConfiguration config) {
+ File current = config.getBasedir();
String urlApplication = config.getUpdateApplicationUrl();
String urlData = config.getUpdateDataUrl();
@@ -280,7 +266,7 @@
AbstractTuttiAction action;
if (TuttiDbUpdaterCallBack.DB_UPDATE_NAME.equals(appType)) {
- UpdateDbAction logicAction = TuttiActionHelper.createLogicAction(getHandler(), UpdateDbAction.class);
+ UpdateDbAction logicAction = getContext().getActionFactory().createLogicAction(getHandler(), UpdateDbAction.class);
action = logicAction;
if (!getContext().isDbExist()) {
@@ -289,24 +275,24 @@
_("tutti.dbManager.action.installDb.tip"));
}
} else if (TuttiReportUpdaterCallBack.REPORT_UPDATE_NAME.equals(appType)) {
- UpdateReportAction logicAction = TuttiActionHelper.createLogicAction(getHandler(), UpdateReportAction.class);
+ UpdateReportAction logicAction = getContext().getActionFactory().createLogicAction(getHandler(), UpdateReportAction.class);
action = logicAction;
} else {
TuttiApplicationUpdaterCallBack.UpdateType updateType =
TuttiApplicationUpdaterCallBack.UpdateType.valueOf(appType.toUpperCase());
- UpdateApplicationAction logicAction = TuttiActionHelper.createLogicAction(getHandler(), UpdateApplicationAction.class);
+ UpdateApplicationAction logicAction = getContext().getActionFactory().createLogicAction(getHandler(), UpdateApplicationAction.class);
logicAction.setTypes(updateType);
logicAction.setActionDescription(_("tutti.main.action.updateSpecificApplication.tip", updateType.getLabel()));
action = logicAction;
}
// close this dialog
- TuttiActionHelper.runAction(about.getClose());
+ getActionEngine().runAction(about.getClose());
// do update
- TuttiActionHelper.runAction(action);
+ getActionEngine().runAction(action);
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/StartAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/StartAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/StartAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,12 +24,11 @@
* #L%
*/
-import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.shared.application.ApplicationIOUtil;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.content.db.ImportDbAction;
import fr.ifremer.tutti.ui.swing.content.db.InstallDbAction;
import fr.ifremer.tutti.ui.swing.content.db.OpenDbAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -67,13 +66,13 @@
try {
// get action to execute
- String content = TuttiIOUtil.readContent(actionfile, _("tutti.error.read.startActionFile", actionfile));
+ String content = ApplicationIOUtil.readContent(actionfile, _("tutti.error.read.startActionFile", actionfile));
content = content.trim();
if (InstallDbAction.class.getName().equals(content)) {
// install db
- delegateAction = TuttiActionHelper.createLogicAction(handler, InstallDbAction.class);
+ delegateAction = getContext().getActionFactory().createLogicAction(handler, InstallDbAction.class);
if (log.isInfoEnabled()) {
log.info("Found install db action");
@@ -83,7 +82,7 @@
} else if (content.startsWith(ImportDbAction.class.getName())) {
// import db
- ImportDbAction action = TuttiActionHelper.createLogicAction(handler, ImportDbAction.class);
+ ImportDbAction action = getContext().getActionFactory().createLogicAction(handler, ImportDbAction.class);
File importFile = new File(content.substring(ImportDbAction.class.getName().length() + 1));
action.setImportFile(importFile);
delegateAction = action;
@@ -101,7 +100,7 @@
} finally {
// delete start action file
- TuttiIOUtil.deleteFile(
+ ApplicationIOUtil.deleteFile(
actionfile,
_("tutti.error.delete.startActionFile", actionfile));
}
@@ -117,7 +116,7 @@
// db already opened (happens when reloading ui)
// just go to select cruise screen
- SelectCruiseAction action = TuttiActionHelper.createLogicAction(handler, SelectCruiseAction.class);
+ SelectCruiseAction action = getContext().getActionFactory().createLogicAction(handler, SelectCruiseAction.class);
action.setSkipCheckCurrentScreen(true);
action.setActionDescription(getUI().getMenuActionSelectCruise().getToolTipText());
delegateAction = action;
@@ -127,7 +126,7 @@
if (context.isDbExist()) {
// open tutti db (using a fake button to have simple api)
- OpenDbAction action = TuttiActionHelper.createLogicAction(handler, OpenDbAction.class);
+ OpenDbAction action = getContext().getActionFactory().createLogicAction(handler, OpenDbAction.class);
action.setSkipCheckCurrentScreen(true);
action.setUpdateReferentiel(true);
delegateAction = action;
@@ -138,7 +137,7 @@
context.clearDbContext();
// go to manage db screen (to install db)
- ManageDbAction action = TuttiActionHelper.createLogicAction(handler, ManageDbAction.class);
+ ManageDbAction action = getContext().getActionFactory().createLogicAction(handler, ManageDbAction.class);
action.setSkipCheckCurrentScreen(true);
delegateAction = action;
}
@@ -153,7 +152,7 @@
@Override
public void doAction() throws Exception {
- TuttiActionHelper.runInternalAction(delegateAction);
+ getActionEngine().runInternalAction(delegateAction);
}
@Override
@@ -163,14 +162,14 @@
}
protected void deleteOldDatabaseDirectory() {
- File dbDirectory = getConfig().getServiceConfig().getPersistenceConfig().getDbDirectory();
+ File dbDirectory = getConfig().getDbDirectory();
if (dbDirectory.exists()) {
// delete it before install
if (log.isInfoEnabled()) {
log.info("Delete previous database directory: " + dbDirectory);
}
- TuttiIOUtil.deleteDirectory(dbDirectory, "Could not delete old db directory");
+ ApplicationIOUtil.deleteDirectory(dbDirectory, "Could not delete old db directory");
}
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateApplicationAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateApplicationAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateApplicationAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,13 +24,12 @@
* #L%
*/
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.ui.swing.RunTutti;
import fr.ifremer.tutti.ui.swing.TuttiApplicationUpdaterCallBack;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.updater.ApplicationUpdater;
@@ -85,9 +84,9 @@
reload = false;
TuttiUIContext context = getContext();
- TuttiApplicationConfig config = context.getConfig();
+ TuttiConfiguration config = getConfig();
- File current = config.getTuttiBasedir();
+ File current = config.getBasedir();
if (current == null || !current.exists()) {
// can not update application
@@ -97,7 +96,7 @@
} else {
String url = config.getUpdateApplicationUrl();
- File dest = new File(config.getTuttiBasedir(), "NEW");
+ File dest = new File(config.getBasedir(), "NEW");
if (log.isInfoEnabled()) {
log.info(String.format("Try to update jre, i18N, help or tutti (current application location: %s), using update url: %s", current, url));
@@ -154,10 +153,10 @@
getHandler().showSuccessMessage(_("tutti.updateApplication.title.success"),
_("tutti.updateApplication.message.success"));
- CloseApplicationAction action = TuttiActionHelper.createLogicAction(
+ CloseApplicationAction action = getContext().getActionFactory().createLogicAction(
getHandler(), CloseApplicationAction.class);
action.setExitCode(RunTutti.UPATE_EXIT_CODE);
- TuttiActionHelper.runAction(action);
+ getActionEngine().runAction(action);
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateDbAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateDbAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,10 +24,10 @@
* #L%
*/
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -106,7 +106,7 @@
@Override
public void doAction() {
TuttiUIContext context = getContext();
- TuttiApplicationConfig config = context.getConfig();
+ TuttiConfiguration config = getConfig();
File current = config.getDataDirectory();
String url = config.getUpdateDataUrl();
@@ -115,7 +115,7 @@
log.info(String.format("Try to install / update db (current data location: %s), using update url: %s", current, url));
}
- File dest = new File(config.getTuttiBasedir(), "NEW");
+ File dest = new File(config.getBasedir(), "NEW");
ProgressionModel progressionModel = new ProgressionModel();
context.getActionUI().getModel().setProgressionModel(progressionModel);
progressionModel.setMessage(_("tutti.dbManager.action.upgradeDb.check"));
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateReportAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateReportAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/UpdateReportAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,13 +24,12 @@
* #L%
*/
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.ui.swing.RunTutti;
import fr.ifremer.tutti.ui.swing.TuttiReportUpdaterCallBack;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.updater.ApplicationUpdater;
@@ -76,9 +75,9 @@
reload = false;
TuttiUIContext context = getContext();
- TuttiApplicationConfig config = context.getConfig();
+ TuttiConfiguration config = getConfig();
- File current = config.getTuttiBasedir();
+ File current = config.getBasedir();
if (current == null || !current.exists()) {
// can not update application
@@ -88,7 +87,7 @@
} else {
String url = config.getUpdateDataUrl();
- File dest = new File(config.getTuttiBasedir(), "NEW");
+ File dest = new File(config.getBasedir(), "NEW");
if (log.isInfoEnabled()) {
log.info(String.format("Try to update repport (current application location: %s), using update url: %s", current, url));
@@ -139,10 +138,10 @@
getHandler().showSuccessMessage(_("tutti.updateReport.title.success"),
_("tutti.updateReport.message.success"));
- CloseApplicationAction action = TuttiActionHelper.createLogicAction(
+ CloseApplicationAction action = getContext().getActionFactory().createLogicAction(
getHandler(), CloseApplicationAction.class);
action.setExitCode(RunTutti.UPATE_EXIT_CODE);
- TuttiActionHelper.runAction(action);
+ getActionEngine().runAction(action);
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ValidateSelectedCruiseCatchesAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ValidateSelectedCruiseCatchesAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ValidateSelectedCruiseCatchesAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -50,7 +50,6 @@
public void doAction() throws Exception {
Preconditions.checkState(getContext().isCruiseFilled());
getContext().setValidationContext(ValidationService.VALIDATION_CONTEXT_VALIDATE);
-// getContext().setScreen(null);
if (log.isInfoEnabled()) {
log.info("Validate operations of cruise: " + getContext().getCruiseId());
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -55,7 +55,7 @@
SampleCategoryModelEntry.class);
public EditSampleCategoryModelRowModel() {
- super(SampleCategoryModelEntry.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
}
public EditSampleCategoryModelRowModel(SampleCategoryModelEntry entry) {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,10 +24,9 @@
* #L%
*/
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry;
-import fr.ifremer.tutti.ui.swing.content.category.EditSampleCategoryModelRowModel;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import static org.nuiton.i18n.I18n.n_;
@@ -38,7 +37,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.4
*/
-public class EditSampleCategoryModelTableModel extends AbstractTuttiTableModel<EditSampleCategoryModelRowModel> {
+public class EditSampleCategoryModelTableModel extends AbstractApplicationTableModel<EditSampleCategoryModelRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -79,7 +79,7 @@
text: "tutti.editSampleCategoryModel.action.close";
toolTipText: "tutti.editSampleCategoryModel.action.close.tip";
i18nMnemonic: "tutti.editSampleCategoryModel.action.close.mnemonic";
- _tuttiAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
_help: {"tutti.editSampleCategoryModel.action.close.help"};
}
@@ -89,6 +89,6 @@
toolTipText: "tutti.editSampleCategoryModel.action.save.tip";
i18nMnemonic: "tutti.editSampleCategoryModel.action.save.mnemonic";
enabled: {model.isModify() && model.isValid()};
- _tuttiAction: {SaveSampleCategoryModelAction.class};
+ _applicationAction: {SaveSampleCategoryModelAction.class};
_help: {"tutti.editSampleCategoryModel.action.save.help"};
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/EditSampleCategoryModelUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -31,7 +31,7 @@
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.util.Cancelable;
-import fr.ifremer.tutti.ui.swing.util.CloseableUI;
+import fr.ifremer.shared.application.swing.util.CloseableUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import jaxx.runtime.SwingUtil;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/SaveSampleCategoryModelAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/SaveSampleCategoryModelAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/category/SaveSampleCategoryModelAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -54,7 +54,7 @@
if (log.isInfoEnabled()) {
log.info("Will save sampleCategoryModel: " + bean);
}
- getConfig().getServiceConfig().getPersistenceConfig().setSampleCategoryModel(bean);
+ getConfig().setSampleCategoryModel(bean);
getConfig().save();
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,16 +24,13 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfigOption;
-import fr.ifremer.tutti.service.config.TuttiServiceConfigOption;
+import fr.ifremer.tutti.TuttiConfiguration;
+import fr.ifremer.tutti.TuttiConfigurationOption;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfigOption;
import fr.ifremer.tutti.ui.swing.content.GoToPreviousScreenAction;
import fr.ifremer.tutti.ui.swing.content.ReloadTuttiAction;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import fr.ifremer.tutti.ui.swing.util.editor.TuttiLocationTableCell;
import fr.ifremer.tutti.ui.swing.util.editor.VesselTableCell;
import jaxx.runtime.SwingUtil;
@@ -86,7 +83,7 @@
initUI(ui);
- TuttiApplicationConfig config = getConfig();
+ TuttiConfiguration config = getConfig();
ConfigUIHelper helper = new ConfigUIHelper(config.getApplicationConfig(),
config.getConfigFile());
@@ -128,28 +125,30 @@
helper.addCategory(n_("tutti.config.category.applications"),
n_("tutti.config.category.applications.description"),
CALLBACK_APPLICATION)
- .addOption(TuttiServiceConfigOption.CSV_SEPARATOR)
+ .addOption(TuttiConfigurationOption.CSV_SEPARATOR)
.setOptionShortLabel(_("tutti.config.option.csv.separator.shortLabel"))
- .addOption(TuttiApplicationConfigOption.UI_CONFIG_FILE)
+ .addOption(TuttiConfigurationOption.UI_CONFIG_FILE)
.setOptionShortLabel(_("tutti.config.option.ui.config.file.shortLabel"))
- .addOption(TuttiApplicationConfigOption.TOTAL_SORTED_WEIGHTS_DIFFERENCE_RATE)
+ .addOption(TuttiConfigurationOption.TOTAL_SORTED_WEIGHTS_DIFFERENCE_RATE)
.setOptionShortLabel(_("tutti.config.option.weights.rate.difference.totalAndSorted.shortLabel"))
- .addOption(TuttiApplicationConfigOption.MAX_INDIVIDUAL_OBSERVATION_ROW_TO_CREATE)
+ .addOption(TuttiConfigurationOption.MAX_INDIVIDUAL_OBSERVATION_ROW_TO_CREATE)
.setOptionShortLabel(_("tutti.config.option.ui.individualObservationRowsToCreate.shortLabel"));
+ TuttiUIContext context = getContext();
+
if (context.isDbLoaded()) {
VesselTableCell vesselTableCellComponent = new VesselTableCell(context);
- helper.addOption(TuttiApplicationConfigOption.TREMIE_CAROUSSEL_VESSEL_ID)
+ helper.addOption(TuttiConfigurationOption.TREMIE_CAROUSSEL_VESSEL_ID)
.setOptionShortLabel(_("tutti.config.option.tremieCarousselVessel.shortLabel"))
.setOptionEditor(vesselTableCellComponent.getNewTableCellEditor())
.setOptionRenderer(vesselTableCellComponent.getNewTableCellRenderer());
TuttiLocationTableCell tuttiLocationTableCellComponent = new TuttiLocationTableCell(context);
- helper.addOption(TuttiServiceConfigOption.EXPORT_COUNTRY_ID)
+ helper.addOption(TuttiConfigurationOption.EXPORT_COUNTRY_ID)
.setOptionShortLabel(_("tutti.config.option.export.countryId.shortLabel"))
.setOptionEditor(tuttiLocationTableCellComponent.getNewTableCellEditor())
.setOptionRenderer(tuttiLocationTableCellComponent.getNewTableCellRenderer());
@@ -160,34 +159,34 @@
helper.addCategory(n_("tutti.config.category.ui"),
n_("tutti.config.category.ui.description"),
CALLBACK_UI)
- .addOption(TuttiApplicationConfigOption.COLOR_ALTERNATE_ROW)
+ .addOption(TuttiConfigurationOption.COLOR_ALTERNATE_ROW)
.setOptionShortLabel(_("tutti.config.option.ui.color.alternateRow.shortLabel"))
- .addOption(TuttiApplicationConfigOption.COLOR_SELECTED_ROW)
+ .addOption(TuttiConfigurationOption.COLOR_SELECTED_ROW)
.setOptionShortLabel(_("tutti.config.option.ui.color.selectedRow.shortLabel"))
- .addOption(TuttiApplicationConfigOption.COLOR_ROW_INVALID)
+ .addOption(TuttiConfigurationOption.COLOR_ROW_INVALID)
.setOptionShortLabel(_("tutti.config.option.ui.color.rowInvalid.shortLabel"))
- .addOption(TuttiApplicationConfigOption.COLOR_ROW_READ_ONLY)
+ .addOption(TuttiConfigurationOption.COLOR_ROW_READ_ONLY)
.setOptionShortLabel(_("tutti.config.option.ui.color.rowReadOnly.shortLabel"))
- .addOption(TuttiApplicationConfigOption.COLOR_CELL_WITH_VALUE)
+ .addOption(TuttiConfigurationOption.COLOR_CELL_WITH_VALUE)
.setOptionShortLabel(_("tutti.config.option.ui.color.cellWithValue.shortLabel"))
- .addOption(TuttiApplicationConfigOption.COLOR_ROW_TO_CONFIRM)
+ .addOption(TuttiConfigurationOption.COLOR_ROW_TO_CONFIRM)
.setOptionShortLabel(_("tutti.config.option.ui.color.rowToConfirm.shortLabel"))
- .addOption(TuttiApplicationConfigOption.COLOR_COMPUTED_WEIGHTS)
+ .addOption(TuttiConfigurationOption.COLOR_COMPUTED_WEIGHTS)
.setOptionShortLabel(_("tutti.config.option.ui.color.computedWeights.shortLabel"))
- .addOption(TuttiApplicationConfigOption.COLOR_BLOCKING_LAYER)
+ .addOption(TuttiConfigurationOption.COLOR_BLOCKING_LAYER)
.setOptionShortLabel(_("tutti.config.option.ui.color.blockingLayer.shortLabel"))
- .addOption(TuttiApplicationConfigOption.DATE_FORMAT)
+ .addOption(TuttiConfigurationOption.DATE_FORMAT)
.setOptionShortLabel(_("tutti.config.option.ui.dateFormat.shortLabel"))
- .addOption(TuttiApplicationConfigOption.COORDINATE_EDITOR_TYPE)
+ .addOption(TuttiConfigurationOption.COORDINATE_EDITOR_TYPE)
.setOptionShortLabel(_("tutti.config.option.ui.coordinateEditorType.shortLabel"));
// Weight Unit category
@@ -195,77 +194,77 @@
helper.addCategory(n_("tutti.config.category.weightUnit"),
n_("tutti.config.category.weightUnit.description"),
CALLBACK_UI)
- .addOption(TuttiServiceConfigOption.WEIGHT_UNIT_SPECIES)
+ .addOption(TuttiConfigurationOption.WEIGHT_UNIT_SPECIES)
.setOptionShortLabel(_("tutti.config.option.weight.unit.species.shortLabel"))
- .addOption(TuttiServiceConfigOption.WEIGHT_UNIT_BENTHOS)
+ .addOption(TuttiConfigurationOption.WEIGHT_UNIT_BENTHOS)
.setOptionShortLabel(_("tutti.config.option.weight.unit.benthos.shortLabel"))
- .addOption(TuttiServiceConfigOption.WEIGHT_UNIT_MARINE_LITTER)
+ .addOption(TuttiConfigurationOption.WEIGHT_UNIT_MARINE_LITTER)
.setOptionShortLabel(_("tutti.config.option.weight.unit.marineLitter.shortLabel"))
- .addOption(TuttiServiceConfigOption.WEIGHT_UNIT_INDIVIDUAL_OBSERVATION)
+ .addOption(TuttiConfigurationOption.WEIGHT_UNIT_INDIVIDUAL_OBSERVATION)
.setOptionShortLabel(_("tutti.config.option.weight.unit.individualObservation.shortLabel"))
- .addOption(TuttiServiceConfigOption.WEIGHT_UNIT_ACCIDENTAL_CATCH)
+ .addOption(TuttiConfigurationOption.WEIGHT_UNIT_ACCIDENTAL_CATCH)
.setOptionShortLabel(_("tutti.config.option.weight.unit.accidentalCatch.shortLabel"));
// Technical category
helper.addCategory(n_("tutti.config.category.technical"),
n_("tutti.config.category.technical.description"))
- .addOption(TuttiServiceConfigOption.BASEDIR)
+ .addOption(TuttiConfigurationOption.BASEDIR)
.setOptionShortLabel(_("tutti.config.option.basedir.shortLabel"))
- .addOption(TuttiServiceConfigOption.DATA_DIRECTORY)
+ .addOption(TuttiConfigurationOption.DATA_DIRECTORY)
.setOptionShortLabel(_("tutti.config.option.data.directory.shortLabel"))
- .addOption(TuttiServiceConfigOption.TMP_DIRECTORY)
+ .addOption(TuttiConfigurationOption.TMP_DIRECTORY)
.setOptionShortLabel(_("tutti.config.option.tmp.directory.shortLabel"))
- .addOption(TuttiApplicationConfigOption.TUTTI_I18N_DIRECTORY)
+ .addOption(TuttiConfigurationOption.I18N_DIRECTORY)
.setOptionShortLabel(_("tutti.config.option.i18n.directory.shortLabel"))
- .addOption(TuttiApplicationConfigOption.TUTTI_HELP_DIRECTORY)
+ .addOption(TuttiConfigurationOption.HELP_DIRECTORY)
.setOptionShortLabel(_("tutti.config.option.help.directory.shortLabel"))
- .addOption(TuttiServiceConfigOption.REPORT_DIRECTORY)
+ .addOption(TuttiConfigurationOption.REPORT_DIRECTORY)
.setOptionShortLabel(_("tutti.config.option.service.report.directory.shortLabel"))
- .addOption(TuttiPersistenceConfigOption.DB_DIRECTORY)
+ .addOption(TuttiConfigurationOption.DB_DIRECTORY)
.setOptionShortLabel(_("tutti.config.option.persistence.db.directory.shortLabel"))
- .addOption(TuttiPersistenceConfigOption.DB_ATTACHMENT_DIRECTORY)
+ .addOption(TuttiConfigurationOption.DB_ATTACHMENT_DIRECTORY)
.setOptionShortLabel(_("tutti.config.option.persistence.db.attachment.directory.shortLabel"))
- .addOption(TuttiPersistenceConfigOption.DB_PROTOCOL_DIRECTORY)
+ .addOption(TuttiConfigurationOption.DB_PROTOCOL_DIRECTORY)
.setOptionShortLabel(_("tutti.config.option.persistence.db.protocol.directory.shortLabel"))
- .addOption(TuttiPersistenceConfigOption.DB_CACHE_DIRECTORY)
+ .addOption(TuttiConfigurationOption.DB_CACHE_DIRECTORY)
.setOptionShortLabel(_("tutti.config.option.persistence.db.cache.directory.shortLabel"))
- .addOption(TuttiPersistenceConfigOption.DB_CONFIGURATION_PATH)
+ .addOption(TuttiConfigurationOption.DB_CONFIGURATION_PATH)
.setOptionShortLabel(_("tutti.config.option.persistence.db.configurationPath.shortLabel"))
- .addOption(TuttiPersistenceConfigOption.DB_ENUMERATION_PATH)
+ .addOption(TuttiConfigurationOption.DB_ENUMERATION_PATH)
.setOptionShortLabel(_("tutti.config.option.persistence.db.enumerationPath.shortLabel"))
- .addOption(TuttiPersistenceConfigOption.JDBC_URL)
+ .addOption(TuttiConfigurationOption.JDBC_URL)
.setOptionShortLabel(_("tutti.config.option.persistence.jdbc.url.shortLabel"))
- .addOption(TuttiServiceConfigOption.SITE_URL)
+ .addOption(TuttiConfigurationOption.SITE_URL)
.setOptionShortLabel(_("tutti.config.option.site.url.shortLabel"))
- .addOption(TuttiPersistenceConfigOption.DB_BACKUP_DIRECTORY)
+ .addOption(TuttiConfigurationOption.DB_BACKUP_DIRECTORY)
.setOptionShortLabel(_("tutti.config.option.persistence.db.backup.directory.shortLabel"))
- .addOption(TuttiServiceConfigOption.REPORT_BACKUP_DIRECTORY)
+ .addOption(TuttiConfigurationOption.REPORT_BACKUP_DIRECTORY)
.setOptionShortLabel(_("tutti.config.option.service.report.backup.directory.shortLabel"))
- .addOption(TuttiApplicationConfigOption.TUTTI_UPDATE_APPLICATION_URL)
+ .addOption(TuttiConfigurationOption.UPDATE_APPLICATION_URL)
.setOptionShortLabel(_("tutti.config.option.update.application.url.shortLabel"))
- .addOption(TuttiApplicationConfigOption.TUTTI_UPDATE_DATA_URL)
+ .addOption(TuttiConfigurationOption.UPDATE_DATA_URL)
.setOptionShortLabel(_("tutti.config.option.update.data.url.shortLabel"));
helper.setFinalizer(new MainCallBackFinalizer(CALLBACK_APPLICATION));
@@ -274,7 +273,7 @@
@Override
public void run() {
- TuttiActionHelper.runInternalAction(
+ getContext().getActionEngine().runInternalAction(
TuttiConfigUIHandler.this,
GoToPreviousScreenAction.class);
@@ -301,8 +300,8 @@
}
protected void reloadApplication() {
- ReloadTuttiAction action = TuttiActionHelper.createLogicAction(this, ReloadTuttiAction.class);
- TuttiActionHelper.runAction(action);
+ ReloadTuttiAction action = getContext().getActionFactory().createLogicAction(this, ReloadTuttiAction.class);
+ getContext().getActionEngine().runAction(action);
// TuttiActionHelper.runActionAndWait(this, ReloadTuttiAction.class);
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -54,7 +54,7 @@
text: "tutti.editCruise.action.editGearCaracteristics";
toolTipText: "tutti.editCruise.action.editGearCaracteristics.tip";
enabled: {model.isCanEditGearCatacteristic()};
- _tuttiAction: {EditGearCaracteristicsAction.class};
+ _applicationAction: {EditGearCaracteristicsAction.class};
_help: {"tutti.editCruise.action.editGearCaracteristics.help"};
}
@@ -63,7 +63,7 @@
text: "tutti.editCruise.action.viewGearCaracteristics";
toolTipText: "tutti.editCruise.action.viewGearCaracteristics.tip";
enabled: {model.isCanShowGearCatacteristic()};
- _tuttiAction: {ViewGearCaracteristicsAction.class};
+ _applicationAction: {ViewGearCaracteristicsAction.class};
_help: {"tutti.editCruise.action.viewGearCaracteristics.help"};
}
@@ -266,7 +266,7 @@
text: "tutti.editCruise.action.saveCruise";
toolTipText: "tutti.editCruise.action.saveCruise.tip";
i18nMnemonic: "tutti.editCruise.action.saveCruise.mnemonic";
- _tuttiAction: {SaveCruiseAction.class};
+ _applicationAction: {SaveCruiseAction.class};
enabled: {model.isModify() && model.isValid()};
_help: {"tutti.editCruise.action.save.help"};
}
@@ -276,7 +276,7 @@
text: "tutti.editCruise.action.closeEditCruise";
toolTipText: "tutti.editCruise.action.closeEditCruise.tip";
i18nMnemonic: "tutti.editCruise.action.closeEditCruise.mnemonic";
- _tuttiAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
_help: {"tutti.editCruise.action.close.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,6 +26,7 @@
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
+import fr.ifremer.shared.application.swing.util.CloseableUI;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
@@ -38,7 +39,6 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.CloseableUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.context.JAXXContextEntryDef;
@@ -105,9 +105,9 @@
*/
protected JPopupMenu gearPopupMenu;
- public EditCruiseUIHandler(TuttiUI parentUi, EditCruiseUI ui) {
+ public EditCruiseUIHandler(TuttiUI<?, ?> parentUi, EditCruiseUI ui) {
super(parentUi.getHandler().getContext(), ui);
- persistenceService = context.getPersistenceService();
+ persistenceService = getContext().getPersistenceService();
}
@@ -118,7 +118,7 @@
EditCruiseUIModel model = new EditCruiseUIModel();
- if (context.isCruiseFilled()) {
+ if (getContext().isCruiseFilled()) {
// load existing cruise
Cruise cruise = getDataContext().getCruise();
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -109,7 +109,7 @@
BinderFactory.newBinder(Cruise.class, EditCruiseUIModel.class);
public EditCruiseUIModel() {
- super(Cruise.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
}
@Override
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -22,8 +22,8 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import static org.nuiton.i18n.I18n.n_;
@@ -32,7 +32,7 @@
* @author kmorin <kmorin(a)codelutin.com>
* @since 1.4
*/
-public class GearCaracteristicsEditorTableModel extends AbstractTuttiTableModel<GearCaracteristicsEditorRowModel> {
+public class GearCaracteristicsEditorTableModel extends AbstractApplicationTableModel<GearCaracteristicsEditorRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/GearCaracteristicsEditorUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -60,7 +60,7 @@
protected final PersistenceService persistenceService = getContext().getPersistenceService();
- public GearCaracteristicsEditorUIHandler(TuttiUI parentUi,
+ public GearCaracteristicsEditorUIHandler(TuttiUI<?,?> parentUi,
GearCaracteristicsEditorUI ui) {
super(parentUi.getHandler().getContext(), ui, GearCaracteristicsEditorRowModel.PROPERTY_VALUE);
}
@@ -162,8 +162,8 @@
{
addColumnToModel(columnModel,
- new CaracteristicValueEditor(context),
- new CaracteristicValueRenderer(context),
+ new CaracteristicValueEditor(getContext()),
+ new CaracteristicValueRenderer(getContext()),
GearCaracteristicsEditorTableModel.VALUE);
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -37,7 +37,7 @@
#exportButton {
actionIcon: export;
toolTipText: "tutti.validateCruise.navigation.action.export.all.tip";
- _tuttiAction: {ExportCruiseValidationMessagesAction.class};
+ _applicationAction: {ExportCruiseValidationMessagesAction.class};
_help: {"tutti.validateCruise.navigation.action.export.all.help"};
}
@@ -50,7 +50,7 @@
text: "tutti.validateCruise.navigation.action.export.operation";
toolTipText: "tutti.validateCruise.navigation.action.export.operation.tip";
i18nMnemonic: "tutti.validateCruise.navigation.action.export.operation.mnemonic";
- _tuttiAction: {ExportOperationValidationMessagesAction.class};
+ _applicationAction: {ExportOperationValidationMessagesAction.class};
enabled: {model.getSelectedFishingOperation() != null};
_help: {"tutti.validateCruise.navigation.action.export.operation.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,16 +27,15 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.swing.action.ApplicationActionUIModel;
+import fr.ifremer.shared.application.swing.util.CloseableUI;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.CloseableUI;
import fr.ifremer.tutti.ui.swing.util.RemoveablePropertyChangeListener;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionUIModel;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
@@ -79,9 +78,9 @@
protected EditCruiseFishingOperationAction editFishingOperationAction;
- public ValidateCruiseUIHandler(TuttiUI parentUi, ValidateCruiseUI ui) {
+ public ValidateCruiseUIHandler(TuttiUI<?, ?> parentUi, ValidateCruiseUI ui) {
super(parentUi.getHandler().getContext(), ui);
- validationService = context.getValidateCruiseOperationsService();
+ validationService = getContext().getValidateCruiseOperationsService();
}
@Override
@@ -90,7 +89,7 @@
ValidateCruiseUIModel model = new ValidateCruiseUIModel();
ProgressionModel progressionModel = new ProgressionModel();
- TuttiActionUIModel actionUIModel = context.getActionUI().getModel();
+ ApplicationActionUIModel actionUIModel = getContext().getActionUI().getModel();
actionUIModel.setProgressionModel(progressionModel);
model.setValidator(validationService.validateCruiseOperations(progressionModel));
actionUIModel.setProgressionModel(null);
@@ -101,7 +100,7 @@
public void propertyChange(PropertyChangeEvent evt) {
FishingOperation operation = (FishingOperation) evt.getNewValue();
editFishingOperationAction.setFishingOperation(operation);
- TuttiActionHelper.runAction(editFishingOperationAction);
+ getContext().getActionEngine().runAction(editFishingOperationAction);
}
});
@@ -112,7 +111,7 @@
public void afterInitUI() {
initUI(ui);
- editFishingOperationAction = TuttiActionHelper.createLogicAction(this, EditCruiseFishingOperationAction.class);
+ editFishingOperationAction = getContext().getActionFactory().createLogicAction(this, EditCruiseFishingOperationAction.class);
ui.getOperationPanel().getModel().setSelectedFishingOperation(null);
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/CloseDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/CloseDbAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/CloseDbAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,11 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import static org.nuiton.i18n.I18n._;
@@ -40,10 +37,6 @@
*/
public class CloseDbAction extends AbstractMainUITuttiAction {
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(CloseDbAction.class);
-
protected String jdbcUrl;
public CloseDbAction(MainUIHandler handler) {
@@ -55,7 +48,7 @@
boolean canContinue = super.prepareAction();
if (canContinue) {
- jdbcUrl = TuttiPersistenceConfig.getInstance().getJdbcUrl();
+ jdbcUrl = getConfig().getJdbcUrl();
}
return canContinue;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -43,7 +43,7 @@
text: {handler.getInstallButtonText(model.isDbExist())};
toolTipText: {handler.getInstallButtonTip(model.isDbExist())};
i18nMnemonic: "tutti.dbManager.action.installDb.mnemonic";
- _tuttiAction: {InstallOrReinstallDbAction.class};
+ _applicationAction: {InstallOrReinstallDbAction.class};
_help: {"tutti.dbManager.action.installDb.help"};
}
@@ -51,7 +51,7 @@
actionIcon: import-db;
text: "tutti.dbManager.action.importDb";
i18nMnemonic: "tutti.dbManager.action.importDb.mnemonic";
- _tuttiAction: {ImportOrReimportDbAction.class};
+ _applicationAction: {ImportOrReimportDbAction.class};
toolTipText: "tutti.dbManager.action.importDb.tip";
_help: {"tutti.dbManager.action.importDb.help"};
}
@@ -61,7 +61,7 @@
text: "tutti.dbManager.action.openDb";
i18nMnemonic: "tutti.dbManager.action.openDb.mnemonic";
visible: {model.isDbExist() && !model.isDbLoaded()};
- _tuttiAction: {OpenDbAction.class};
+ _applicationAction: {OpenDbAction.class};
toolTipText: "tutti.dbManager.action.openDb.tip";
_help: {"tutti.dbManager.action.openDb.help"};
}
@@ -71,7 +71,7 @@
text: "tutti.dbManager.action.upgradeDb";
i18nMnemonic: "tutti.dbManager.action.upgradeDb.mnemonic";
visible: {model.isDbLoaded()};
- _tuttiAction: {UpdateDbAction.class};
+ _applicationAction: {UpdateDbAction.class};
toolTipText: "tutti.dbManager.action.upgradeDb.tip";
_help: {"tutti.dbManager.action.upgradeDb.help"};
}
@@ -81,7 +81,7 @@
text: "tutti.dbManager.action.exportDb";
i18nMnemonic: "tutti.dbManager.action.exportDb.mnemonic";
visible: {model.isDbLoaded()};
- _tuttiAction: {ExportDbAction.class};
+ _applicationAction: {ExportDbAction.class};
toolTipText: "tutti.dbManager.action.exportDb.tip";
_help: {"tutti.dbManager.action.exportDb.help"};
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/DbManagerUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,9 +25,9 @@
*/
import com.google.common.collect.Maps;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.lang3.StringUtils;
@@ -78,9 +78,9 @@
if (dbExist) {
- TuttiApplicationConfig config = getConfig();
+ TuttiConfiguration config = getConfig();
- String jdbcUrl = config.getServiceConfig().getPersistenceConfig().getJdbcUrl();
+ String jdbcUrl = config.getJdbcUrl();
Map<String, String> caracteristics = Maps.newLinkedHashMap();
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportDbAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportDbAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,16 +25,14 @@
*/
import com.google.common.base.Preconditions;
-import fr.ifremer.tutti.TuttiBusinessException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
import fr.ifremer.tutti.ui.swing.content.SelectCruiseAction;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.Version;
@@ -90,7 +88,7 @@
if (doAction) {
- jdbcUrl = TuttiPersistenceConfig.getInstance().getJdbcUrl();
+ jdbcUrl = getConfig().getJdbcUrl();
if (importFile == null) {
@@ -168,7 +166,7 @@
handler.reloadPersistenceService();
// could not load db
- throw new TuttiBusinessException(_("tutti.dbManager.action.importdb.couldNotOpen"), e);
+ throw new ApplicationBusinessException(_("tutti.dbManager.action.importdb.couldNotOpen"), e);
}
// ------------------------------------------------------------------ //
@@ -265,7 +263,7 @@
// ------------------------------------------------------------------ //
progressionModel.increments(_("tutti.importDb.step.closeDb"));
- TuttiActionHelper.runInternalAction(handler, CloseDbAction.class);
+ getActionEngine().runInternalAction(handler, CloseDbAction.class);
return;
}
@@ -307,7 +305,7 @@
// --- change screen //
// ------------------------------------------------------------------ //
- TuttiActionHelper.runInternalAction(handler, SelectCruiseAction.class);
+ getActionEngine().runInternalAction(handler, SelectCruiseAction.class);
}
@Override
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportOrReimportDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportOrReimportDbAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ImportOrReimportDbAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,7 +26,6 @@
import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
/**
* To import or reimport a db (will delegate to correct action).
@@ -48,11 +47,11 @@
if (getContext().isDbExist()) {
// reimport action
- delegateAction = TuttiActionHelper.createLogicAction(getHandler(), ReimportDbAction.class);
+ delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), ReimportDbAction.class);
} else {
// import action
- delegateAction = TuttiActionHelper.createLogicAction(getHandler(), ImportDbAction.class);
+ delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), ImportDbAction.class);
}
setActionDescription(delegateAction.getActionDescription());
@@ -63,7 +62,7 @@
@Override
public void doAction() throws Exception {
- TuttiActionHelper.runInternalAction(delegateAction);
+ getActionEngine().runInternalAction(delegateAction);
}
@Override
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallDbAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallDbAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,13 +25,11 @@
*/
import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.updater.ApplicationUpdater;
@@ -91,8 +89,7 @@
// --- install db //
// ------------------------------------------------------------------ //
- TuttiUIContext context = getContext();
- TuttiApplicationConfig config = context.getConfig();
+ TuttiConfiguration config = getConfig();
File current = config.getDataDirectory();
String url = config.getUpdateDataUrl();
@@ -101,7 +98,7 @@
log.info(String.format("Try to install / update db (current data location: %s), using update url: %s", current, url));
}
- File dest = new File(config.getTuttiBasedir(), "NEW");
+ File dest = new File(config.getBasedir(), "NEW");
progressionModel.increments(_("tutti.dbManager.action.upgradeDb.check"));
TuttiDbUpdaterCallBack callback =
@@ -124,6 +121,6 @@
// --- open db //
// ------------------------------------------------------------------ //
- TuttiActionHelper.runInternalAction(getHandler(), OpenDbAction.class);
+ getActionEngine().runInternalAction(getHandler(), OpenDbAction.class);
}
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallOrReinstallDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallOrReinstallDbAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/InstallOrReinstallDbAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,7 +26,6 @@
import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
/**
* To install or reinstall a db (will delegate to correct action).
@@ -48,11 +47,11 @@
if (getContext().isDbExist()) {
// reinstall action
- delegateAction = TuttiActionHelper.createLogicAction(getHandler(), ReinstallDbAction.class);
+ delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), ReinstallDbAction.class);
} else {
// install action
- delegateAction = TuttiActionHelper.createLogicAction(getHandler(), InstallDbAction.class);
+ delegateAction = getContext().getActionFactory().createLogicAction(getHandler(), InstallDbAction.class);
}
setActionDescription(delegateAction.getActionDescription());
@@ -63,7 +62,7 @@
@Override
public void doAction() throws Exception {
- TuttiActionHelper.runInternalAction(delegateAction);
+ getActionEngine().runInternalAction(delegateAction);
}
@Override
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/OpenDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/OpenDbAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/OpenDbAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,18 +24,16 @@
* #L%
*/
-import fr.ifremer.tutti.TuttiBusinessException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
+import fr.ifremer.shared.application.swing.action.ApplicationUIAction;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.persistence.TuttiPersistence;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
import fr.ifremer.tutti.ui.swing.TuttiDbUpdaterCallBack;
import fr.ifremer.tutti.ui.swing.TuttiScreen;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiUIAction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.updater.ApplicationInfo;
@@ -139,7 +137,7 @@
log.debug("Will open db...");
}
- jdbcUrl = TuttiPersistenceConfig.getInstance().getJdbcUrl();
+ jdbcUrl = getConfig().getJdbcUrl();
// at the beginning 3 steps (open db + check version + check db context)
ProgressionModel progressionModel = new ProgressionModel();
@@ -164,7 +162,7 @@
getHandler().reloadPersistenceService();
// could not load db
- throw new TuttiBusinessException(_("tutti.dbManager.action.openDb.couldNotOpen"));
+ throw new ApplicationBusinessException(_("tutti.dbManager.action.openDb.couldNotOpen"));
}
// ------------------------------------------------------------------ //
@@ -187,7 +185,7 @@
log.info("Detected schema application version:" + applicationVersion);
}
- TuttiApplicationConfig config = getConfig();
+ TuttiConfiguration config = getConfig();
if (dbVersion.equals(applicationVersion)) {
// database schema is up to date
@@ -220,7 +218,7 @@
// ask user file where to backup db
file = saveFile(
- config.getServiceConfig().getPersistenceConfig().getDbBackupDirectory(),
+ config.getDbBackupDirectory(),
"tutti-db-" + ExportDbAction.df.format(new Date()),
"zip",
_("tutti.dbManager.title.choose.dbBackupFile"),
@@ -263,7 +261,7 @@
// ------------------------------------------------------------------ //
progressionModel.increments(_("tutti.importDb.step.closeDb"));
- TuttiActionHelper.runInternalAction(getHandler(), CloseDbAction.class);
+ getActionEngine().runInternalAction(getHandler(), CloseDbAction.class);
setScreen(TuttiScreen.MANAGE_DB);
super.doAction();
@@ -279,11 +277,11 @@
// --- backup current db //
// ------------------------------------------------------------------ //
- TuttiUIAction<ExportDbAction> backupAction =
- TuttiActionHelper.createUIAction(getHandler(), ExportDbAction.class);
+ ApplicationUIAction<ExportDbAction> backupAction =
+ getActionFactory().createUIAction(getHandler(), ExportDbAction.class);
backupAction.getLogicAction().setProgressionModel(getProgressionModel());
backupAction.getLogicAction().setFile(file);
- TuttiActionHelper.runInternalAction(backupAction.getLogicAction());
+ getActionEngine().runInternalAction(backupAction.getLogicAction());
// ------------------------------------------------------------------ //
// --- update schema //
@@ -308,7 +306,7 @@
File current = config.getDataDirectory();
String url = config.getUpdateDataUrl();
- File dest = new File(config.getTuttiBasedir(), "NEW");
+ File dest = new File(config.getBasedir(), "NEW");
progressionModel.setMessage(_("tutti.dbManager.action.upgradeDb.check"));
TuttiDbUpdaterCallBack callback =
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReimportDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReimportDbAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReimportDbAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,9 +25,8 @@
*/
import com.google.common.base.Preconditions;
-import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.shared.application.ApplicationIOUtil;
import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
import fr.ifremer.tutti.ui.swing.RunTutti;
import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
@@ -66,7 +65,7 @@
if (doAction) {
- jdbcUrl = TuttiPersistenceConfig.getInstance().getJdbcUrl();
+ jdbcUrl = getConfig().getJdbcUrl();
if (getModel().isDbExist()) {
@@ -77,7 +76,7 @@
// choose backup file
backupFile = saveFile(
- getConfig().getServiceConfig().getPersistenceConfig().getDbBackupDirectory(),
+ getConfig().getDbBackupDirectory(),
"tutti-db-" + ExportDbAction.df.format(new Date()),
"zip",
_("tutti.dbManager.title.choose.dbExportFile"),
@@ -157,7 +156,7 @@
String actionContent = ImportDbAction.class.getName() + ":" + importFile.getAbsolutePath();
File startActionFile = getConfig().getStartActionFile();
- TuttiIOUtil.writeContent(startActionFile, actionContent, _("tutti.error.write.startActionFile", startActionFile));
+ ApplicationIOUtil.writeContent(startActionFile, actionContent, _("tutti.error.write.startActionFile", startActionFile));
// restart application
progressionModel.increments(_("tutti.reimport.step.reloadApplication"));
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReinstallDbAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReinstallDbAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/db/ReinstallDbAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,15 +25,12 @@
*/
import com.google.common.base.Preconditions;
-import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.shared.application.ApplicationIOUtil;
import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfig;
import fr.ifremer.tutti.ui.swing.RunTutti;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import java.io.File;
import java.util.Date;
@@ -48,10 +45,6 @@
*/
public class ReinstallDbAction extends AbstractMainUITuttiAction {
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ReinstallDbAction.class);
-
protected File backupFile;
protected String jdbcUrl;
@@ -72,18 +65,6 @@
// check db url is reachable
TuttiUIContext context = getContext();
doAction = context.checkUpdateDataReachable();
-// TuttiApplicationConfig config = context.getConfig();
-// String url = config.getUpdateApplicationUrl();
-//
-// try {
-// TuttiUIUtil.tryToConnectToUpdateUrl(
-// url,
-// n_("tutti.error.update.could.not.reach.url")
-// );
-// } catch (TuttiBusinessException e) {
-// TuttiUIContext.getErrorHelper().showWarningDialog(e.getMessage());
-// doAction = false;
-// }
}
if (doAction) {
@@ -91,7 +72,7 @@
jdbcUrl = null;
backupFile = null;
- jdbcUrl = TuttiPersistenceConfig.getInstance().getJdbcUrl();
+ jdbcUrl = getConfig().getJdbcUrl();
if (getModel().isDbExist()) {
@@ -102,7 +83,7 @@
// choose backup file
backupFile = saveFile(
- getConfig().getServiceConfig().getPersistenceConfig().getDbBackupDirectory(),
+ getConfig().getDbBackupDirectory(),
"tutti-db-" + ExportDbAction.df.format(new Date()),
"zip",
_("tutti.dbManager.title.choose.dbExportFile"),
@@ -155,7 +136,7 @@
String actionContent = InstallDbAction.class.getName();
File startActionFile = getConfig().getStartActionFile();
- TuttiIOUtil.writeContent(startActionFile, actionContent, _("tutti.error.write.startActionFile", startActionFile));
+ ApplicationIOUtil.writeContent(startActionFile, actionContent, _("tutti.error.write.startActionFile", startActionFile));
// restart application
progressionModel.increments(_("tutti.reinstallDb.step.reloadApplication"));
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportCruiseAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,7 +25,7 @@
*/
import com.google.common.base.Preconditions;
-import fr.ifremer.tutti.TuttiBusinessException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.service.export.generic.TuttiExportService;
@@ -106,16 +106,16 @@
// }
// }
- TuttiBusinessException exportError = null;
+ ApplicationBusinessException exportError = null;
TuttiExportService service = getContext().getTuttiExportService();
try {
service.exportCruise(cruise.getId(), file, progressionModel);
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
String errorMessage;
errorMessage = _("tutti.exportCruise.action.exportErrors", cruise.getName(), e.getMessage());
- exportError = new TuttiBusinessException(errorMessage);
+ exportError = new ApplicationBusinessException(errorMessage);
}
sendMessage(_("tutti.exportCruise.action.success",
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProgramAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,7 +25,7 @@
*/
import com.google.common.base.Preconditions;
-import fr.ifremer.tutti.TuttiBusinessException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
@@ -108,17 +108,17 @@
// log.info("Will use protocol " + protocol.getName());
// }
// }
- TuttiBusinessException exportError = null;
+ ApplicationBusinessException exportError = null;
TuttiExportService service = getContext().getTuttiExportService();
try {
service.exportProgram(program.getId(), file, progressionModel);
- } catch (TuttiBusinessException e) {
+ } catch (ApplicationBusinessException e) {
String errorMessage;
errorMessage = _("tutti.exportProgram.action.exportErrors", program.getName(), e.getMessage());
- exportError = new TuttiBusinessException(errorMessage);
+ exportError = new ApplicationBusinessException(errorMessage);
}
handler.resetEditProgramAction();
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -65,7 +65,7 @@
#editProgramButton {
actionIcon: edit;
text: "tutti.selectCruise.action.editProgram";
- _tuttiAction: {EditProgramAction.class};
+ _applicationAction: {EditProgramAction.class};
toolTipText: "tutti.selectCruise.action.editProgram.tip";
_help: {"tutti.selectCruise.action.editProgram.help"};
}
@@ -74,7 +74,7 @@
actionIcon: export;
text: "tutti.selectCruise.action.exportProgram";
enabled: false;
- _tuttiAction: {ExportProgramAction.class};
+ _applicationAction: {ExportProgramAction.class};
toolTipText: "tutti.selectCruise.action.exportProgram.tip";
_help: {"tutti.selectCruise.action.exportProgram.help"};
}
@@ -82,7 +82,7 @@
#newProgramButton {
actionIcon: add;
text: "tutti.selectCruise.action.newProgram";
- _tuttiAction: {NewProgramAction.class};
+ _applicationAction: {NewProgramAction.class};
toolTipText: "tutti.selectCruise.action.newProgram.tip";
_help: {"tutti.selectCruise.action.newProgram.help"};
}
@@ -111,7 +111,7 @@
#editCruiseButton {
actionIcon: edit;
text: "tutti.selectCruise.action.editCruise";
- _tuttiAction: {EditCruiseAction.class};
+ _applicationAction: {EditCruiseAction.class};
toolTipText: "tutti.selectCruise.action.editCruise.tip";
_help: {"tutti.selectCruise.action.editCruise.help"};
}
@@ -120,7 +120,7 @@
actionIcon: export;
text: "tutti.selectCruise.action.exportCruise";
enabled: false;
- _tuttiAction: {ExportCruiseAction.class};
+ _applicationAction: {ExportCruiseAction.class};
toolTipText: "tutti.selectCruise.action.exportCruise.tip";
_help: {"tutti.selectCruise.action.exportCruise.help"};
}
@@ -129,7 +129,7 @@
actionIcon: email;
text: "tutti.selectCruise.action.sendCruiseReport";
toolTipText: "tutti.selectCruise.action.sendCruiseReport.tip";
- _tuttiAction: {SendCruiseReportAction.class};
+ _applicationAction: {SendCruiseReportAction.class};
_help: {"tutti.selectCruise.action.sendCruiseReport.help"};
}
@@ -137,7 +137,7 @@
actionIcon: export;
text: "tutti.selectCruise.action.exportCruiseForSumatra";
toolTipText: "tutti.selectCruise.action.exportCruiseForSumatra.tip";
- _tuttiAction: {ExportCruiseForSumatraAction.class};
+ _applicationAction: {ExportCruiseForSumatraAction.class};
_help: {"tutti.selectCruise.action.exportCruiseForSumatra.help"};
}
@@ -145,7 +145,7 @@
actionIcon: add;
text: "tutti.selectCruise.action.newCruise";
enabled: {model.isProgramFound()};
- _tuttiAction: {NewCruiseAction.class};
+ _applicationAction: {NewCruiseAction.class};
toolTipText: "tutti.selectCruise.action.newCruise.tip";
_help: {"tutti.selectCruise.action.newCruise.help"};
}
@@ -179,7 +179,7 @@
#newProtocolButton {
actionIcon: add;
text: "tutti.selectCruise.action.newProtocol";
- _tuttiAction: {NewProtocolAction.class};
+ _applicationAction: {NewProtocolAction.class};
toolTipText: "tutti.selectCruise.action.newProtocol.tip";
_help: {"tutti.selectCruise.action.newProtocol.help"};
}
@@ -187,7 +187,7 @@
#importProtocolButton {
actionIcon: import;
text: "tutti.selectCruise.action.importProtocol";
- _tuttiAction: {ImportProtocolAction.class};
+ _applicationAction: {ImportProtocolAction.class};
toolTipText: "tutti.selectCruise.action.importProtocol.tip";
_help: {"tutti.selectCruise.action.importProtocol.help"};
}
@@ -195,7 +195,7 @@
#editProtocolButton {
actionIcon: edit;
text: "tutti.selectCruise.action.editProtocol";
- _tuttiAction: {EditProtocolAction.class};
+ _applicationAction: {EditProtocolAction.class};
toolTipText: "tutti.selectCruise.action.editProtocol.tip";
_help: {"tutti.selectCruise.action.editProtocol.help"};
}
@@ -203,7 +203,7 @@
#cloneProtocolButton {
actionIcon: copy;
text: "tutti.selectCruise.action.cloneProtocol";
- _tuttiAction: {CloneProtocolAction.class};
+ _applicationAction: {CloneProtocolAction.class};
toolTipText: "tutti.selectCruise.action.cloneProtocol.tip";
_help: {"tutti.selectCruise.action.cloneProtocol.help"};
}
@@ -211,7 +211,7 @@
#exportProtocolButton {
actionIcon: export;
text: "tutti.selectCruise.action.exportProtocol";
- _tuttiAction: {ExportProtocolAction.class};
+ _applicationAction: {ExportProtocolAction.class};
toolTipText: "tutti.selectCruise.action.exportProtocol.tip";
_help: {"tutti.selectCruise.action.exportProtocol.help"};
}
@@ -219,7 +219,7 @@
#deleteProtocolButton {
actionIcon: delete;
text: "tutti.selectCruise.action.deleteProtocol";
- _tuttiAction: {DeleteProtocolAction.class};
+ _applicationAction: {DeleteProtocolAction.class};
toolTipText: "tutti.selectCruise.action.deleteProtocol.tip";
_help: {"tutti.selectCruise.action.deleteProtocol.help"};
}
@@ -228,7 +228,7 @@
actionIcon: edit;
text: "tutti.selectCruise.action.editCatches";
i18nMnemonic: "tutti.selectCruise.action.editCatches.mnemonic";
- _tuttiAction: {EditCatchesAction.class};
+ _applicationAction: {EditCatchesAction.class};
enabled: {model.isValid() && uiContext.isCruiseFilled()};
toolTipText: "tutti.selectCruise.action.editCatches.tip";
_help: {"tutti.selectCruise.action.editCatches.help"};
@@ -239,7 +239,7 @@
text: "tutti.selectCruise.action.validateCatches";
toolTipText: "tutti.selectCruise.action.validateCatches.tip";
i18nMnemonic: "tutti.selectCruise.action.validateCatches.mnemonic";
- _tuttiAction: {ValidateCatchesAction.class};
+ _applicationAction: {ValidateCatchesAction.class};
enabled: {model.isValid() && uiContext.isCruiseFilled()};
_help: {"tutti.selectCruise.action.validateCatches.help"};
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -31,7 +31,6 @@
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.collections.CollectionUtils;
@@ -74,7 +73,7 @@
public SelectCruiseUIHandler(TuttiUI<?, ?> parentUI, SelectCruiseUI ui) {
super(parentUI.getHandler().getContext(), ui);
- persistenceService = context.getPersistenceService();
+ persistenceService = getContext().getPersistenceService();
}
@Override
@@ -101,7 +100,7 @@
Program selectedProgram = null;
List<Cruise> cruises = null;
- if (context.isProgramFilled()) {
+ if (getContext().isProgramFilled()) {
selectedProgram = getDataContext().getProgram();
cruises = persistenceService.getAllCruise(selectedProgram.getId());
}
@@ -115,7 +114,7 @@
} else {
Cruise selectedCruise = null;
- if (context.isCruiseFilled()) {
+ if (getContext().isCruiseFilled()) {
selectedCruise = getDataContext().getCruise();
}
model.setCruise(selectedCruise);
@@ -198,7 +197,7 @@
public void propertyChange(PropertyChangeEvent evt) {
Program newValue = (Program) evt.getNewValue();
boolean noProgram = newValue == null;
- context.setProgramId(noProgram ? null : newValue.getId());
+ getContext().setProgramId(noProgram ? null : newValue.getId());
if (log.isInfoEnabled()) {
log.info("Selected program: " + newValue);
}
@@ -229,7 +228,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
Cruise newValue = (Cruise) evt.getNewValue();
- context.setCruiseId(newValue == null ? null : newValue.getId());
+ getContext().setCruiseId(newValue == null ? null : newValue.getId());
}
});
@@ -237,7 +236,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
TuttiProtocol newValue = (TuttiProtocol) evt.getNewValue();
- context.setProtocolId(newValue == null ? null : newValue.getId());
+ getContext().setProtocolId(newValue == null ? null : newValue.getId());
}
});
@@ -348,7 +347,7 @@
protected void startComboFirstAction(MouseEvent event) {
JComboBox combo = (JComboBox) event.getSource();
- TuttiActionHelper.runAction((AbstractButton) combo.getItemAt(0));
+ getContext().getActionEngine().runAction((AbstractButton) combo.getItemAt(0));
}
protected void startEditAction(boolean canEdit, ActionEvent event) {
@@ -361,7 +360,7 @@
// (see http://forge.codelutin.com/issues/2032)
existingCombo.setSelectedIndex(0);
existingCombo.hidePopup();
- TuttiActionHelper.runAction(selectedAction);
+ getContext().getActionEngine().runAction(selectedAction);
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -75,7 +75,7 @@
protected TuttiProtocol protocol;
public SelectCruiseUIModel() {
- super(Cruise.class, null, null);
+ super(null, null);
}
public List<Program> getPrograms() {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,7 +25,7 @@
*/
import com.google.common.base.Preconditions;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.service.export.pdf.CatchesPdfExportService;
import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
@@ -105,7 +105,7 @@
TuttiUIUtil.mail(_("tutti.sendCruiseReport.mail.subject", cruise.getName()),
_("tutti.sendCruiseReport.mail.body", cruise.getName(), file.getAbsolutePath()));
- } catch (TuttiTechnicalException e) {
+ } catch (ApplicationTechnicalException e) {
JOptionPane.showMessageDialog(getContext().getMainUI(),
_("tutti.sendCruiseReport.action.error.mail.message", file),
_("tutti.sendCruiseReport.action.error.mail.title"),
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchTableUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -28,9 +28,9 @@
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.jdesktop.swingx.JXTable;
@@ -40,7 +40,6 @@
import org.jdesktop.swingx.sort.TableSortController;
import org.jdesktop.swingx.table.TableColumnModelExt;
-import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
import java.awt.Color;
import java.awt.Component;
@@ -52,7 +51,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public abstract class AbstractTuttiBatchTableUIHandler<R extends AbstractTuttiBeanUIModel, M extends AbstractTuttiBatchUIModel<R, M>, T extends AbstractTuttiTableModel<R>, UI extends TuttiUI<M, ?>> extends AbstractTuttiTableUIHandler<R, M, UI> {
+public abstract class AbstractTuttiBatchTableUIHandler<R extends AbstractTuttiBeanUIModel, M extends AbstractTuttiBatchUIModel<R, M>, T extends AbstractApplicationTableModel<R>, UI extends TuttiUI<M, ?>> extends AbstractTuttiTableUIHandler<R, M, UI> {
protected abstract ColumnIdentifier<R> getCommentIdentifier();
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/CancelEditFishingOperationAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/CancelEditFishingOperationAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/CancelEditFishingOperationAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,7 +26,6 @@
*/
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -54,7 +53,7 @@
public EditFishingOperationAction getEditAction() {
if (editAction == null) {
- editAction = TuttiActionHelper.createLogicAction(
+ editAction = getContext().getActionFactory().createLogicAction(
getHandler().getParentUi().getHandler(),
EditFishingOperationAction.class);
}
@@ -72,7 +71,7 @@
}
// cancel to create a new fishingOperation
action.setFishingOperation(null);
- TuttiActionHelper.runInternalAction(action);
+ getActionEngine().runInternalAction(action);
} else {
@@ -84,7 +83,7 @@
action.setCheckPreviousEdit(false);
action.setFishingOperation(getModel().getFishingOperation());
action.setInternalAction(true);
- TuttiActionHelper.runInternalAction(action);
+ getActionEngine().runInternalAction(action);
}
//FIXME-TC Make sure this works again
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -51,7 +51,6 @@
import fr.ifremer.tutti.ui.swing.content.operation.fishing.VesselUseFeatureTabUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -291,12 +290,12 @@
// persist previous fishing operation
if (fishingOperationModified) {
getSaveFishingOperationAction().setUpdateUI(false);
- TuttiActionHelper.runInternalAction(getSaveFishingOperationAction());
+ getActionEngine().runInternalAction(getSaveFishingOperationAction());
}
if (catchBatchModified) {
getSaveCatchBatchAction().setUpdateUI(false);
- TuttiActionHelper.runInternalAction(getSaveCatchBatchAction());
+ getActionEngine().runInternalAction(getSaveCatchBatchAction());
}
canContinue = true;
@@ -417,7 +416,7 @@
public void displayValidationErrors() {
if (CollectionUtils.isNotEmpty(errorMessages)) {
for (String errorMessage : errorMessages) {
- TuttiUIContext.getErrorHelper().showErrorDialog(errorMessage, null);
+ getContext().getErrorHelper().showErrorDialog(errorMessage, null);
}
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -627,7 +627,7 @@
toolTipText: "tutti.editFishingOperation.action.saveEditFishingOperation.tip";
i18nMnemonic: "tutti.editFishingOperation.action.saveEditFishingOperation.mnemonic";
enabled: {model.isValid() && model.isModify()};
- _tuttiAction: {SaveFishingOperationAction.class};
+ _applicationAction: {SaveFishingOperationAction.class};
_help: {"tutti.editFishingOperation.action.saveEditFishingOperation.help"};
}
@@ -636,6 +636,6 @@
text: "tutti.editFishingOperation.action.cancelEditFishingOperation";
toolTipText: "tutti.editFishingOperation.action.cancelEditFishingOperation.tip";
i18nMnemonic: "tutti.editFishingOperation.action.cancelEditFishingOperation.mnemonic";
- _tuttiAction: {CancelEditFishingOperationAction.class};
+ _applicationAction: {CancelEditFishingOperationAction.class};
_help: {"tutti.editFishingOperation.action.cancelEditFishingOperation.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2013-11-24 23:27:27 UTC (rev 1385)
@@ -34,15 +34,15 @@
fr.ifremer.tutti.ui.swing.content.operation.fishing.GearUseFeatureTabUI
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
- fr.ifremer.tutti.ui.swing.spatial.CoordinateEditorType
- fr.ifremer.tutti.ui.swing.spatial.DmsCoordinateEditor
- fr.ifremer.tutti.ui.swing.spatial.DmdCoordinateEditor
+ fr.ifremer.shared.application.type.CoordinateEditorType
fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment
- fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor
jaxx.runtime.swing.editor.bean.BeanFilterableComboBox
jaxx.runtime.swing.editor.bean.BeanDoubleList
jaxx.runtime.swing.editor.NumberEditor
+ jaxx.runtime.swing.editor.SimpleTimeEditor
+ jaxx.runtime.swing.editor.gis.DmsCoordinateEditor
+ jaxx.runtime.swing.editor.gis.DmdCoordinateEditor
jaxx.runtime.swing.CardLayout2Ext
org.jdesktop.swingx.JXDatePicker
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,6 +27,8 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import fr.ifremer.shared.application.ApplicationDataUtil;
+import fr.ifremer.shared.application.type.CoordinateEditorType;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
@@ -44,10 +46,7 @@
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiTabContainerUIHandler;
import fr.ifremer.tutti.ui.swing.util.TabHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import fr.ifremer.tutti.ui.swing.util.caracteristics.GearCaracteristicListCellRenderer;
-import fr.ifremer.tutti.ui.swing.spatial.CoordinateEditorType;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.time.DateUtils;
@@ -178,13 +177,14 @@
public void setQuadrantValue(int value) {
if (log.isInfoEnabled()) {
- log.info("New quadrant value: "+value);
+ log.info("New quadrant value: " + value);
}
}
public boolean isQuadrantSelected(Integer value, int requiredValue) {
return value != null && value == requiredValue;
}
+
/**
* To monitor changes on the incoming fishing operation.
*
@@ -196,7 +196,7 @@
EditFishingOperationUI ui) {
super(parentUi.getHandler().getContext(), ui);
this.parentUi = parentUi;
- this.persistenceService = context.getPersistenceService();
+ this.persistenceService = getContext().getPersistenceService();
this.fishingOperationMonitor = new TuttiBeanMonitor<EditFishingOperationUIModel>(
EditFishingOperationUIModel.PROPERTY_STATION_NUMBER,
EditFishingOperationUIModel.PROPERTY_FISHING_OPERATION_NUMBER,
@@ -511,7 +511,7 @@
public void propertyChange(PropertyChangeEvent evt) {
JButton button = ui.getCancelButton();
CancelEditFishingOperationAction action =
- TuttiActionHelper.getLogicAction(button);
+ getContext().getActionFactory().getLogicAction(button);
if (evt.getNewValue() == null) {
button.setText(_("tutti.editFishingOperation.action.cancelEditFishingOperation"));
button.setToolTipText(_("tutti.editFishingOperation.action.cancelEditFishingOperation.tip"));
@@ -568,13 +568,13 @@
public void setDate(ActionEvent event, String property) {
JXDatePicker field = (JXDatePicker) event.getSource();
Date value = field.getDate();
- Date date = (Date) TuttiUIUtil.getProperty(getModel(), property);
+ Date date = (Date) ApplicationDataUtil.getProperty(getModel(), property);
if (value != null && date != null) {
Calendar cal = DateUtils.toCalendar(date);
value = DateUtils.setHours(value, cal.get(Calendar.HOUR_OF_DAY));
value = DateUtils.setMinutes(value, cal.get(Calendar.MINUTE));
}
- TuttiUIUtil.setProperty(getModel(), property, value);
+ ApplicationDataUtil.setProperty(getModel(), property, value);
}
//------------------------------------------------------------------------//
@@ -622,12 +622,12 @@
// ActionEvent event = new ActionEvent(this, newIndex, null);
switch (answer) {
case JOptionPane.OK_OPTION:
- TuttiActionHelper.runAction(ui.getSaveButton());
+ getContext().getActionEngine().runAction(ui.getSaveButton());
result = true;
break;
case JOptionPane.NO_OPTION:
- TuttiActionHelper.runAction(ui.getCancelButton());
+ getContext().getActionEngine().runAction(ui.getCancelButton());
result = true;
break;
default:
@@ -644,7 +644,7 @@
if (result) {
// ok will revert any modification
- TuttiActionHelper.runAction(ui.getCancelButton());
+ getContext().getActionEngine().runAction(ui.getCancelButton());
}
}
@@ -713,7 +713,7 @@
public String getTrawlDistanceTooltipText(Float trawlDistance) {
String result = trawlDistance == null ?
null :
- _("tutti.editFishingOperation.field.trawlDistance.inMilles.tip", TuttiUIUtil.getDistanceInMilles(trawlDistance));
+ _("tutti.editFishingOperation.field.trawlDistance.inMilles.tip", ApplicationDataUtil.getDistanceInMilles(trawlDistance));
return result;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,6 +25,7 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.shared.application.ApplicationDataUtil;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
@@ -36,13 +37,12 @@
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.ui.swing.spatial.CoordinateEditorType;
-import fr.ifremer.tutti.ui.swing.spatial.DmdCoordinate;
-import fr.ifremer.tutti.ui.swing.spatial.DmsCoordinate;
+import fr.ifremer.shared.application.type.CoordinateEditorType;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.TabContentModel;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
+import jaxx.runtime.swing.editor.gis.DmdCoordinate;
+import jaxx.runtime.swing.editor.gis.DmsCoordinate;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nuiton.util.DateUtil;
@@ -266,7 +266,7 @@
BinderFactory.newBinder(FishingOperation.class, EditFishingOperationUIModel.class);
public EditFishingOperationUIModel() {
- super(FishingOperation.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
}
public boolean isLoadingData() {
@@ -928,7 +928,7 @@
if (getGearShootingStartLatitude() != null && getGearShootingStartLongitude() != null
&& getGearShootingEndLatitude() != null && getGearShootingEndLongitude() != null) {
- Integer distance = TuttiUIUtil.computeDistanceInMeters(
+ Integer distance = ApplicationDataUtil.computeDistanceInMeters(
getGearShootingStartLatitude(),
getGearShootingStartLongitude(),
getGearShootingEndLatitude(),
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -35,7 +35,7 @@
actionIcon: add;
toolTipText: "tutti.fishingOperations.action.newFishingOperation.tip";
i18nMnemonic: "tutti.fishingOperations.action.newFishingOperation.mnemonic";
- _tuttiAction: {NewFishingOperationAction.class};
+ _applicationAction: {NewFishingOperationAction.class};
_help: {"tutti.fishingOperations.action.newFishingOperation.help"};
}
@@ -44,7 +44,7 @@
enabled:{model.getSelectedFishingOperation() != null};
toolTipText: "tutti.fishingOperations.action.deleteFishingOperation.tip";
i18nMnemonic: "tutti.fishingOperations.action.deleteFishingOperation.mnemonic";
- _tuttiAction: {DeleteFishingOperationAction.class};
+ _applicationAction: {DeleteFishingOperationAction.class};
_help: {"tutti.fishingOperations.action.deleteFishingOperation.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,6 +25,7 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.shared.application.swing.util.CloseableUI;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
@@ -34,9 +35,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiTabContainerUIHandler;
-import fr.ifremer.tutti.ui.swing.util.CloseableUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -66,10 +65,10 @@
protected EditFishingOperationAction editFishingOperationAction;
- public FishingOperationsUIHandler(TuttiUI parentUI,
+ public FishingOperationsUIHandler(TuttiUI<?, ?> parentUI,
FishingOperationsUI ui) {
super(parentUI.getHandler().getContext(), ui);
- persistenceService = context.getPersistenceService();
+ persistenceService = getContext().getPersistenceService();
}
//------------------------------------------------------------------------//
@@ -129,7 +128,7 @@
initUI(ui);
editFishingOperationAction =
- TuttiActionHelper.createLogicAction(this, EditFishingOperationAction.class);
+ getContext().getActionFactory().createLogicAction(this, EditFishingOperationAction.class);
FishingOperationsUIModel model = getModel();
@@ -163,11 +162,11 @@
if (SwingUtilities.isEventDispatchThread()) {
// launch a long action
- TuttiActionHelper.runAction(editFishingOperationAction);
+ getContext().getActionEngine().runAction(editFishingOperationAction);
} else {
// run as an internal action (of embedded action)
- TuttiActionHelper.runInternalAction(editFishingOperationAction);
+ getContext().getActionEngine().runInternalAction(editFishingOperationAction);
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/AbstractImportMultiPostAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -31,7 +31,6 @@
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import org.jdesktop.beans.AbstractBean;
import java.io.File;
@@ -57,8 +56,8 @@
public EditFishingOperationAction getEditAction() {
FishingOperationsUI parentUI = getUI().getParentContainer(FishingOperationsUI.class);
if (editAction == null) {
- editAction = TuttiActionHelper.createLogicAction(parentUI.getHandler(),
- EditFishingOperationAction.class);
+ editAction = getContext().getActionFactory().createLogicAction(parentUI.getHandler(),
+ EditFishingOperationAction.class);
}
return editAction;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CancelEditCatchBatchAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CancelEditCatchBatchAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/CancelEditCatchBatchAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -29,7 +29,6 @@
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationAction;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -60,8 +59,8 @@
public EditFishingOperationAction getEditAction() {
if (editAction == null) {
- editAction = TuttiActionHelper.createLogicAction(getHandler().getParentHandler(),
- EditFishingOperationAction.class);
+ editAction = getContext().getActionFactory().createLogicAction(getHandler().getParentHandler(),
+ EditFishingOperationAction.class);
}
return editAction;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeBatchWeightsAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeBatchWeightsAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ComputeBatchWeightsAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -313,7 +313,7 @@
protected int getFinestCategoryColumn(Integer categoryId) {
int column = 1;
- List<Integer> samplingOrderIds = getConfig().getServiceConfig().getSamplingOrderIds();
+ List<Integer> samplingOrderIds = getConfig().getSamplingOrderIds();
int index = samplingOrderIds.indexOf(categoryId);
if (index > -1) {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -332,7 +332,7 @@
text: "tutti.editCatchBatch.action.exportFishingOperationReport";
toolTipText: "tutti.editCatchBatch.action.exportFishingOperationReport.tip";
i18nMnemonic: "tutti.editCatchBatch.action.exportFishingOperationReport.mnemonic";
- _tuttiAction: {ExportFishingOperationReportAction.class};
+ _applicationAction: {ExportFishingOperationReportAction.class};
_help: {"tutti.editCatchBatch.action.exportFishingOperationReport.help"};
}
@@ -341,7 +341,7 @@
text: "tutti.editCatchBatch.action.exportFishingOperationReportForSumatra";
toolTipText: "tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.tip";
i18nMnemonic: "tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.mnemonic";
- _tuttiAction: {ExportFishingOperationForSumatraAction.class};
+ _applicationAction: {ExportFishingOperationForSumatraAction.class};
_help: {"tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.help"};
}
@@ -351,7 +351,7 @@
toolTipText: "tutti.editCatchBatch.action.saveCatchBatch.tip";
i18nMnemonic: "tutti.editCatchBatch.action.saveCatchBatch.mnemonic";
enabled: {model.isModify()};
- _tuttiAction: {SaveCatchBatchAction.class};
+ _applicationAction: {SaveCatchBatchAction.class};
_help: {"tutti.editCatchBatch.action.saveCatchBatch.help"};
}
@@ -360,7 +360,7 @@
text: "tutti.editCatchBatch.action.cancelEditCatchBatch";
toolTipText: "tutti.editCatchBatch.action.cancelEditCatchBatch.tip";
i18nMnemonic: "tutti.editCatchBatch.action.cancelEditCatchBatch.mnemonic";
- _tuttiAction: {CancelEditCatchBatchAction.class};
+ _applicationAction: {CancelEditCatchBatchAction.class};
_help: {"tutti.editCatchBatch.action.cancelEditCatchBatch.help"};
}
@@ -369,7 +369,7 @@
text: "tutti.editCatchBatch.action.cleanWeights";
toolTipText: "tutti.editCatchBatch.action.cleanWeights.tip";
i18nMnemonic: "tutti.editCatchBatch.action.cleanWeights.mnemonic";
- _tuttiAction: {CleanBatchWeightsAction.class};
+ _applicationAction: {CleanBatchWeightsAction.class};
_help: {"tutti.editCatchBatch.action.cleanWeights.help"};
}
@@ -378,6 +378,6 @@
text: "tutti.editCatchBatch.action.computeWeights";
toolTipText: "tutti.editCatchBatch.action.computeWeights.tip";
i18nMnemonic: "tutti.editCatchBatch.action.computeWeights.mnemonic";
- _tuttiAction: {ComputeBatchWeightsAction.class};
+ _applicationAction: {ComputeBatchWeightsAction.class};
_help: {"tutti.editCatchBatch.action.computeWeights.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2013-11-24 23:27:27 UTC (rev 1385)
@@ -59,7 +59,7 @@
static org.nuiton.i18n.I18n._
static jaxx.runtime.SwingUtil.getStringValue
- static fr.ifremer.tutti.ui.swing.util.TuttiUIUtil.getWeightStringValue
+ static fr.ifremer.shared.application.ApplicationDataUtil.getWeightStringValue
</import>
<script><![CDATA[
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,7 +25,6 @@
*/
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI;
import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUIHandler;
@@ -41,7 +40,6 @@
import fr.ifremer.tutti.ui.swing.util.TabHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import jaxx.runtime.swing.CardLayout2Ext;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
@@ -228,7 +226,7 @@
case JOptionPane.OK_OPTION:
// persist catch batch
- TuttiActionHelper.runAction(getUI().getSaveButton());
+ getContext().getActionEngine().runAction(getUI().getSaveButton());
result = true;
break;
@@ -239,7 +237,7 @@
// so since we will edit a new operation, nothing to do here
// persist catch batch
- TuttiActionHelper.runAction(getUI().getCancelButton());
+ getContext().getActionEngine().runAction(getUI().getCancelButton());
result = true;
break;
@@ -257,7 +255,7 @@
if (result) {
// ok will revert any modification
- TuttiActionHelper.runAction(ui.getCancelButton());
+ getContext().getActionEngine().runAction(ui.getCancelButton());
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -28,6 +28,7 @@
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
@@ -38,7 +39,6 @@
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.TabContentModel;
import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
-import fr.ifremer.tutti.service.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
import org.apache.commons.collections.CollectionUtils;
import org.nuiton.util.beans.Binder;
@@ -172,7 +172,7 @@
WeightUnit benthosWeightUnit,
WeightUnit marineLitterWeightUnit,
WeightUnit individualObservationWeightUnit) {
- super(CatchBatch.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
//FIXME See if this can be configurable or guess from other weightUnits
if (WeightUnit.G == speciesWeightUnit &&
WeightUnit.G == benthosWeightUnit) {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryColumnIdentifier.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryColumnIdentifier.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryColumnIdentifier.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,7 +25,7 @@
*/
import fr.ifremer.tutti.persistence.entities.data.SampleCategory;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import java.io.Serializable;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryComponent.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryComponent.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryComponent.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,10 +24,10 @@
* #L%
*/
+import fr.ifremer.shared.application.ApplicationDataUtil;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.persistence.entities.data.SampleCategory;
-import fr.ifremer.tutti.service.WeightUnit;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.swing.editor.NumberEditor;
import org.apache.commons.lang3.StringUtils;
@@ -320,12 +320,12 @@
} else if (computedNumber != null) {
if (sampleCategory.hasOnlyOneFrequency()) {
- text += TuttiUIUtil.getWeightStringValue(computedNumber);
+ text += ApplicationDataUtil.getWeightStringValue(computedNumber);
} else {
String color = Integer.toHexString(computedWeightColor.getRGB()).substring(2);
text += "<em style='color: #" + color + "'>" +
- TuttiUIUtil.getWeightStringValue(computedNumber) + "</em>";
+ ApplicationDataUtil.getWeightStringValue(computedNumber) + "</em>";
}
} else {
text += "-";
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,6 +25,7 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
import fr.ifremer.tutti.persistence.entities.data.AccidentalBatchs;
@@ -34,7 +35,6 @@
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
import fr.ifremer.tutti.ui.swing.util.caracteristics.CaracteristicMapColumnRowModel;
@@ -86,7 +86,7 @@
AccidentalBatch.class);
public AccidentalBatchRowModel(WeightUnit weightUnit) {
- super(AccidentalBatch.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
this.weightUnit = weightUnit;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,10 +24,10 @@
* #L%
*/
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.individualobservation.IndividualObservationBatchRowModel;
-import fr.ifremer.tutti.service.WeightUnit;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.type.WeightUnit;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import static org.nuiton.i18n.I18n.n_;
@@ -36,7 +36,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class AccidentalBatchTableModel extends AbstractTuttiTableModel<AccidentalBatchRowModel> {
+public class AccidentalBatchTableModel extends AbstractApplicationTableModel<AccidentalBatchRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -54,7 +54,7 @@
text: "tutti.editAccidentalBatch.action.importMultiPost";
toolTipText: "tutti.editAccidentalBatch.action.importMultiPost.tip";
i18nMnemonic: "tutti.editAccidentalBatch.action.importMultiPost.mnemonic";
- _tuttiAction: {ImportMultiPostAction.class};
+ _applicationAction: {ImportMultiPostAction.class};
_help: {"tutti.editAccidentalBatch.action.importMultiPost.help"};
}
@@ -63,7 +63,7 @@
text: "tutti.editAccidentalBatch.action.exportMultiPost";
toolTipText: "tutti.editAccidentalBatch.action.exportMultiPost.tip";
i18nMnemonic: "tutti.editAccidentalBatch.action.exportMultiPost.mnemonic";
- _tuttiAction: {ExportMultiPostAction.class};
+ _applicationAction: {ExportMultiPostAction.class};
_help: {"tutti.editAccidentalBatch.action.exportMultiPost.help"};
}
@@ -80,7 +80,7 @@
text: "tutti.editAccidentalBatch.action.removeBatch";
toolTipText: "tutti.editAccidentalBatch.action.removeBatch.tip";
i18nMnemonic: "tutti.editAccidentalBatch.action.removeBatch.mnemonic";
- _tuttiAction: {RemoveAccidentalBatchAction.class};
+ _applicationAction: {RemoveAccidentalBatchAction.class};
enabled: {model.isRemoveBatchEnabled()};
_help: {"tutti.editAccidentalBatch.action.removeBatch.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -35,7 +35,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.ValidationService;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
@@ -53,7 +53,7 @@
import fr.ifremer.tutti.ui.swing.util.caracteristics.CaracteristicMapEditorUI;
import fr.ifremer.tutti.ui.swing.util.comment.CommentCellEditor;
import fr.ifremer.tutti.ui.swing.util.comment.CommentCellRenderer;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -51,7 +51,7 @@
private static final Log log =
LogFactory.getLog(CreateAccidentalBatchUIHandler.class);
- public CreateAccidentalBatchUIHandler(TuttiUI parentUi,
+ public CreateAccidentalBatchUIHandler(TuttiUI<?,?> parentUi,
CreateAccidentalBatchUI ui) {
super(parentUi.getHandler().getContext(), ui);
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -47,7 +47,7 @@
AccidentalBatchs.newAccidentalBatch();
public CreateAccidentalBatchUIModel() {
- super(CreateAccidentalBatchUIModel.class, null, null);
+ super(null, null);
}
public Species getSpecies() {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,6 +26,8 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+import fr.ifremer.shared.application.ApplicationDataUtil;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
@@ -36,12 +38,10 @@
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.WeightUnit;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryAble;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.frequency.BenthosFrequencyRowModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -196,7 +196,7 @@
public BenthosBatchRowModel(WeightUnit weightUnit,
SampleCategoryModel sampleCategoryModel) {
- super(BenthosBatch.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
this.weightUnit = weightUnit;
this.sampleCategoryModel = sampleCategoryModel;
@@ -339,8 +339,8 @@
public void setSampleCategoryValue(Integer sampleCategoryId, Serializable value) {
SampleCategory<?> sampleCategory =
getSampleCategoryById(sampleCategoryId);
- TuttiUIUtil.setProperty(sampleCategory,
- SampleCategory.PROPERTY_CATEGORY_VALUE, value);
+ ApplicationDataUtil.setProperty(sampleCategory,
+ SampleCategory.PROPERTY_CATEGORY_VALUE, value);
firePropertyChange(PROPERTY_SAMPLE_CATEGORY_VALUE, null, sampleCategory);
}
@@ -348,8 +348,8 @@
public void setSampleCategoryWeight(Integer sampleCategoryId, Object value) {
SampleCategory<?> sampleCategory =
getSampleCategoryById(sampleCategoryId);
- TuttiUIUtil.setProperty(sampleCategory,
- SampleCategory.PROPERTY_CATEGORY_WEIGHT, value);
+ ApplicationDataUtil.setProperty(sampleCategory,
+ SampleCategory.PROPERTY_CATEGORY_WEIGHT, value);
firePropertyChange(PROPERTY_SAMPLE_CATEGORY_WEIGHT, null, sampleCategory);
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,13 +27,13 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.persistence.entities.data.SampleCategory;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryColumnIdentifier;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.table.TableColumnModelExt;
@@ -50,7 +50,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class BenthosBatchTableModel extends AbstractTuttiTableModel<BenthosBatchRowModel> {
+public class BenthosBatchTableModel extends AbstractApplicationTableModel<BenthosBatchRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -205,7 +205,7 @@
text: "tutti.editBenthosBatch.action.removeBatch";
toolTipText: "tutti.editBenthosBatch.action.removeBatch.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.removeBatch.mnemonic";
- _tuttiAction: {RemoveBenthosBatchAction.class};
+ _applicationAction: {RemoveBenthosBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRemoveBatchEnabled()};
_help: {"tutti.editBenthosBatch.action.removeBatch.help"};
}
@@ -215,7 +215,7 @@
text: "tutti.editBenthosBatch.action.removeSubBatch";
toolTipText: "tutti.editBenthosBatch.action.removeSubBatch.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.removeSubBatch.mnemonic";
- _tuttiAction: {RemoveBenthosSubBatchAction.class};
+ _applicationAction: {RemoveBenthosSubBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRemoveSubBatchEnabled()};
_help: {"tutti.editBenthosBatch.action.removeSubBatch.help"};
}
@@ -225,7 +225,7 @@
text: "tutti.editBenthosBatch.action.renameBatch";
toolTipText: "tutti.editBenthosBatch.action.renameBatch.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.renameBatch.mnemonic";
- _tuttiAction: {RenameBenthosBatchAction.class};
+ _applicationAction: {RenameBenthosBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRenameBatchEnabled()};
_help: {"tutti.editBenthosBatch.action.renameBatch.help"};
}
@@ -235,7 +235,7 @@
text: "tutti.editBenthosBatch.action.createMelag";
toolTipText: "tutti.editBenthosBatch.action.createMelag.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.createMelag.mnemonic";
- _tuttiAction: {CreateBenthosMelagAction.class};
+ _applicationAction: {CreateBenthosMelagAction.class};
enabled: {!model.isTableViewModeLeaf() && model.isCreateMelagEnabled()};
_help: {"tutti.editBenthosBatch.action.createMelag.help"};
}
@@ -254,7 +254,7 @@
text: "tutti.editBenthosBatch.action.importMultiPost";
toolTipText: "tutti.editBenthosBatch.action.importMultiPost.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.importMultiPost.mnemonic";
- _tuttiAction: {ImportMultiPostAction.class};
+ _applicationAction: {ImportMultiPostAction.class};
_help: {"tutti.editBenthosBatch.action.importMultiPost.help"};
}
@@ -263,7 +263,7 @@
text: "tutti.editBenthosBatch.action.exportMultiPost";
toolTipText: "tutti.editBenthosBatch.action.exportMultiPost.tip";
i18nMnemonic: "tutti.editBenthosBatch.action.exportMultiPost.mnemonic";
- _tuttiAction: {ExportMultiPostAction.class};
+ _applicationAction: {ExportMultiPostAction.class};
_help: {"tutti.editBenthosBatch.action.exportMultiPost.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx 2013-11-24 23:27:27 UTC (rev 1385)
@@ -37,10 +37,9 @@
javax.swing.ListSelectionModel
java.awt.Color
- java.awt.Dimension
static org.nuiton.i18n.I18n._
- static fr.ifremer.tutti.ui.swing.util.TuttiUIUtil.getWeightStringValue
+ static fr.ifremer.shared.application.ApplicationDataUtil.getWeightStringValue
</import>
<script><![CDATA[
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,6 +27,8 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
@@ -42,7 +44,6 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.TuttiDecorator;
import fr.ifremer.tutti.service.ValidationService;
-import fr.ifremer.tutti.service.WeightUnit;
import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
@@ -50,6 +51,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryColumnIdentifier;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryComponent;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.SpeciesBatchDecorator;
import fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.create.CreateBenthosBatchUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.create.CreateBenthosBatchUIModel;
@@ -57,7 +59,6 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.frequency.BenthosFrequencyRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.split.SplitBenthosBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.split.SplitBenthosBatchUI;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.SpeciesBatchDecorator;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
@@ -69,7 +70,6 @@
import fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataTableCell;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.editor.NumberEditor;
import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
@@ -159,7 +159,7 @@
SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM);
qualitative_unsorted_id =
- context.getPersistenceService().getEnumerationFile().QUALITATIVE_UNSORTED_ID;
+ getContext().getPersistenceService().getEnumerationFile().QUALITATIVE_UNSORTED_ID;
weightUnit = getConfig().getBenthosWeightUnit();
@@ -1345,7 +1345,7 @@
// set the surveycode, do it only on the parent,
// the species of the parent is set to the children in loadBatchRow
- if (parentRow == null && context.isProtocolFilled()) {
+ if (parentRow == null && getContext().isProtocolFilled()) {
// get the surveycode from the species list of the model
List<Species> speciesList = getDataContext().getReferentBenthosWithSurveyCode();
int i = speciesList.indexOf(newRow.getSpecies());
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/CreateBenthosMelagAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/CreateBenthosMelagAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/CreateBenthosMelagAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,7 +26,7 @@
import com.google.common.collect.Maps;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.frequency.BenthosFrequencyRowModel;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
import fr.ifremer.tutti.ui.swing.util.species.EnterMelagWeightDialog;
import jaxx.runtime.SwingUtil;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -139,7 +139,7 @@
text: "tutti.createBenthosBatch.action.addSpecies";
toolTipText: "tutti.createBenthosBatch.action.addSpecies.tip";
i18nMnemonic: "tutti.createBenthosBatch.action.addSpecies.mnemonic";
- _tuttiAction: {SelectSpeciesForBenthosBatchAction.class};
+ _applicationAction: {SelectSpeciesForBenthosBatchAction.class};
_help: {"tutti.createBenthosBatch.action.addSpecies.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -44,7 +44,7 @@
import fr.ifremer.tutti.ui.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
@@ -96,13 +96,13 @@
*/
protected final WeightUnit weightUnit;
- public CreateBenthosBatchUIHandler(TuttiUI parentUi,
+ public CreateBenthosBatchUIHandler(TuttiUI<?,?> parentUi,
CreateBenthosBatchUI ui) {
super(parentUi.getHandler().getContext(), ui,
SplitBenthosBatchRowModel.PROPERTY_SELECTED,
SplitBenthosBatchRowModel.PROPERTY_CATEGORY_VALUE,
SplitBenthosBatchRowModel.PROPERTY_WEIGHT);
- this.persistenceService = context.getPersistenceService();
+ this.persistenceService = getContext().getPersistenceService();
this.weightUnit = getConfig().getBenthosWeightUnit();
this.sampleCategoryModel = getDataContext().getSampleCategoryModel();
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyCellComponent.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -32,7 +32,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUI;
import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,11 +26,11 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatchFrequency;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatchFrequencys;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.service.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -130,7 +130,7 @@
}
public BenthosFrequencyRowModel(WeightUnit weightUnit) {
- super(BenthosBatchFrequency.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
this.weightUnit = weightUnit;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,9 +25,9 @@
*/
import com.google.common.collect.Maps;
-import fr.ifremer.tutti.service.WeightUnit;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.shared.application.type.WeightUnit;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import java.beans.PropertyChangeEvent;
@@ -43,7 +43,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class BenthosFrequencyTableModel extends AbstractTuttiTableModel<BenthosFrequencyRowModel> {
+public class BenthosFrequencyTableModel extends AbstractApplicationTableModel<BenthosFrequencyRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -79,7 +79,7 @@
}
#totalWeightField {
- text: {TuttiUIUtil.getWeightStringValue(model.getTotalWeight())};
+ text: {getWeightStringValue(model.getTotalWeight())};
enabled: false;
_computed: true;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx 2013-11-24 23:27:27 UTC (rev 1385)
@@ -49,6 +49,7 @@
static org.nuiton.i18n.I18n._
static jaxx.runtime.SwingUtil.getStringValue
+ static fr.ifremer.shared.application.ApplicationDataUtil.getWeightStringValue
</import>
<script><![CDATA[
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,12 +27,13 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.ApplicationDataUtil;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
@@ -219,7 +220,7 @@
BenthosFrequencyUIModel model = getModel();
- if (context.isProtocolFilled()) {
+ if (getContext().isProtocolFilled()) {
// FIXME 20130128 kmorin: the species have no technical id
speciesProtocol =
@@ -431,7 +432,7 @@
List<BenthosFrequencyRowModel> rows = Lists.newArrayList(rowsByStep.values());
for (float i = minStep, step = model.getStep(); i <= maxStep;
- i = TuttiUIUtil.getRoundedLengthStep(i + step, true)) {
+ i = ApplicationDataUtil.getRoundedLengthStep(i + step, true)) {
if (!existingKeys.contains(i)) {
@@ -689,7 +690,7 @@
String message =
_("tutti.editBenthosFrequencies.error.length.doublon",
doublon, index + 1);
- TuttiUIContext.getErrorHelper().showErrorDialog(
+ getContext().getErrorHelper().showErrorDialog(
message);
// focus to first error row
@@ -730,7 +731,7 @@
String message =
_("tutti.editBenthosFrequencies.error.length.doublon",
doublon, index + 1);
- TuttiUIContext.getErrorHelper().showErrorDialog(
+ getContext().getErrorHelper().showErrorDialog(
message);
// focus to first error row
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -28,7 +28,7 @@
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
import java.util.List;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -83,7 +83,7 @@
SplitBenthosBatchRowModel.class);
public SplitBenthosBatchRowModel() {
- super(SplitBenthosBatchRowModel.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
}
public SampleCategoryModelEntry getCategorytype() {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,9 +24,9 @@
* #L%
*/
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SelectedCategoryAble;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import static org.nuiton.i18n.I18n.n_;
@@ -38,7 +38,7 @@
* @since 0.3
*/
public class SplitBenthosBatchTableModel
- extends AbstractTuttiTableModel<SplitBenthosBatchRowModel> {
+ extends AbstractApplicationTableModel<SplitBenthosBatchRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -28,7 +28,7 @@
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SelectedCategoryAble;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
import java.util.List;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -31,7 +31,7 @@
import fr.ifremer.tutti.persistence.entities.data.IndividualObservationBatchs;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
import fr.ifremer.tutti.ui.swing.util.caracteristics.CaracteristicMapColumnRowModel;
@@ -91,7 +91,7 @@
IndividualObservationBatch.class);
public IndividualObservationBatchRowModel(WeightUnit weightUnit) {
- super(IndividualObservationBatch.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
this.weightUnit = weightUnit;
if (getCaracteristics() == null) {
setCaracteristics(new CaracteristicMap());
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -22,9 +22,9 @@
* #L%
*/
-import fr.ifremer.tutti.service.WeightUnit;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.type.WeightUnit;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import static org.nuiton.i18n.I18n.n_;
@@ -33,7 +33,7 @@
* @author kmorin <kmorin(a)codelutin.com>
* @since 1.4
*/
-public class IndividualObservationBatchTableModel extends AbstractTuttiTableModel<IndividualObservationBatchRowModel> {
+public class IndividualObservationBatchTableModel extends AbstractApplicationTableModel<IndividualObservationBatchRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -48,7 +48,7 @@
text: "tutti.editIndividualObservationBatch.action.importMultiPost";
toolTipText: "tutti.editIndividualObservationBatch.action.importMultiPost.tip";
i18nMnemonic: "tutti.editIndividualObservationBatch.action.importMultiPost.mnemonic";
- _tuttiAction: {ImportMultiPostAction.class};
+ _applicationAction: {ImportMultiPostAction.class};
_help: {"tutti.editIndividualObservationBatch.action.importMultiPost.help"};
}
@@ -57,7 +57,7 @@
text: "tutti.editIndividualObservationBatch.action.exportMultiPost";
toolTipText: "tutti.editIndividualObservationBatch.action.exportMultiPost.tip";
i18nMnemonic: "tutti.editIndividualObservationBatch.action.exportMultiPost.mnemonic";
- _tuttiAction: {ExportMultiPostAction.class};
+ _applicationAction: {ExportMultiPostAction.class};
_help: {"tutti.editIndividualObservationBatch.action.exportMultiPost.help"};
}
@@ -74,7 +74,7 @@
text: "tutti.editIndividualObservationBatch.action.removeBatch";
toolTipText: "tutti.editIndividualObservationBatch.action.removeBatch.tip";
i18nMnemonic: "tutti.editIndividualObservationBatch.action.removeBatch.mnemonic";
- _tuttiAction: {RemoveIndividualObservationBatchAction.class};
+ _applicationAction: {RemoveIndividualObservationBatchAction.class};
enabled: {model.isRemoveBatchEnabled()};
_help: {"tutti.editIndividualObservationBatch.action.removeBatch.help"};
}
@@ -84,7 +84,7 @@
text: "tutti.editIndividualObservationBatch.action.removeAllBatch";
toolTipText: "tutti.editIndividualObservationBatch.action.removeAllBatch.tip";
i18nMnemonic: "tutti.editIndividualObservationBatch.action.removeAllBatch.mnemonic";
- _tuttiAction: {RemoveAllIndividualObservationBatchAction.class};
+ _applicationAction: {RemoveAllIndividualObservationBatchAction.class};
enabled: {model.isRemoveBatchEnabled()};
_help: {"tutti.editIndividualObservationBatch.action.removeAllBatch.help"};
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/IndividualObservationBatchUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -35,7 +35,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.ValidationService;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
@@ -56,7 +56,7 @@
import fr.ifremer.tutti.ui.swing.util.comment.CommentCellEditor;
import fr.ifremer.tutti.ui.swing.util.comment.CommentCellRenderer;
import fr.ifremer.tutti.ui.swing.util.table.CaracteristicColumnIdentifier;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.collections.CollectionUtils;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -98,7 +98,7 @@
text: "tutti.createIndividualObservationBatch.action.addSpecies";
toolTipText: "tutti.createIndividualObservationBatch.action.addSpecies.tip";
i18nMnemonic: "tutti.createIndividualObservationBatch.action.addSpecies.mnemonic";
- _tuttiAction: {SelectSpeciesForIndividualObservationBatchAction.class};
+ _applicationAction: {SelectSpeciesForIndividualObservationBatchAction.class};
_help: {"tutti.createIndividualObservationBatch.action.addSpecies.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,6 +25,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.ApplicationDataUtil;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.IndividualObservationBatch;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
@@ -41,7 +42,6 @@
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel;
import jaxx.runtime.SwingUtil;
@@ -78,7 +78,7 @@
private static final Log log =
LogFactory.getLog(CreateIndividualObservationBatchUIHandler.class);
- public CreateIndividualObservationBatchUIHandler(TuttiUI parentUi,
+ public CreateIndividualObservationBatchUIHandler(TuttiUI<?,?> parentUi,
CreateIndividualObservationBatchUI ui) {
super(parentUi.getHandler().getContext(), ui);
}
@@ -237,7 +237,7 @@
@Override
public void keyReleased(KeyEvent e) {
String value = textField.getText();
- TuttiUIUtil.setProperty(editorModel, CreateIndividualObservationBatchUIModel.CaracteristicMapPropertyEditor.PROPERTY_PROPERTY, value);
+ ApplicationDataUtil.setProperty(editorModel, CreateIndividualObservationBatchUIModel.CaracteristicMapPropertyEditor.PROPERTY_PROPERTY, value);
}
});
editor = textField;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/individualobservation/create/CreateIndividualObservationBatchUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -108,7 +108,7 @@
Lists.newArrayList();
public CreateIndividualObservationBatchUIModel(List<Caracteristic> defaultCaracteristic) {
- super(IndividualObservationBatch.class, null, null);
+ super(null, null);
this.defaultCaracteristic = defaultCaracteristic;
editObject.setCaracteristics(new CaracteristicMap());
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -32,7 +32,7 @@
import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatchs;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -81,7 +81,7 @@
MarineLitterBatch.class);
public MarineLitterBatchRowModel(WeightUnit weightUnit) {
- super(MarineLitterBatch.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
this.weightUnit = weightUnit;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,9 +24,9 @@
* #L%
*/
-import fr.ifremer.tutti.service.WeightUnit;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.shared.application.type.WeightUnit;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import static org.nuiton.i18n.I18n.n_;
@@ -35,7 +35,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class MarineLitterBatchTableModel extends AbstractTuttiTableModel<MarineLitterBatchRowModel> {
+public class MarineLitterBatchTableModel extends AbstractApplicationTableModel<MarineLitterBatchRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -71,7 +71,7 @@
text: "tutti.editMarineLitterBatch.action.importMultiPost";
toolTipText: "tutti.editMarineLitterBatch.action.importMultiPost.tip";
i18nMnemonic: "tutti.editMarineLitterBatch.action.importMultiPost.mnemonic";
- _tuttiAction: {ImportMultiPostAction.class};
+ _applicationAction: {ImportMultiPostAction.class};
_help: {"tutti.editMarineLitterBatch.action.importMultiPost.help"};
}
@@ -80,7 +80,7 @@
text: "tutti.editMarineLitterBatch.action.exportMultiPost";
toolTipText: "tutti.editMarineLitterBatch.action.exportMultiPost.tip";
i18nMnemonic: "tutti.editMarineLitterBatch.action.exportMultiPost.mnemonic";
- _tuttiAction: {ExportMultiPostAction.class};
+ _applicationAction: {ExportMultiPostAction.class};
_help: {"tutti.editMarineLitterBatch.action.exportMultiPost.help"};
}
@@ -98,7 +98,7 @@
text: "tutti.editMarineLitterBatch.action.removeBatch";
toolTipText: "tutti.editMarineLitterBatch.action.removeBatch.tip";
i18nMnemonic: "tutti.editMarineLitterBatch.action.removeBatch.mnemonic";
- _tuttiAction: {RemoveMarineLitterBatchAction.class};
+ _applicationAction: {RemoveMarineLitterBatchAction.class};
enabled: {model.isRemoveBatchEnabled()};
_help: {"tutti.editMarineLitterBatch.action.removeBatch.help"};
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -34,7 +34,7 @@
import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.service.ValidationService;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
@@ -48,7 +48,7 @@
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentCellRenderer;
import fr.ifremer.tutti.ui.swing.util.comment.CommentCellEditor;
import fr.ifremer.tutti.ui.swing.util.comment.CommentCellRenderer;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -60,10 +60,10 @@
private final TuttiPersistence persistenceService;
- public CreateMarineLitterBatchUIHandler(TuttiUI parentUi,
+ public CreateMarineLitterBatchUIHandler(TuttiUI<?,?> parentUi,
CreateMarineLitterBatchUI ui) {
super(parentUi.getHandler().getContext(), ui);
- this.persistenceService = context.getPersistenceService();
+ this.persistenceService = getContext().getPersistenceService();
}
//------------------------------------------------------------------------//
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -58,7 +58,7 @@
ArrayListMultimap.create();
public CreateMarineLitterBatchUIModel() {
- super(CreateMarineLitterBatchUIModel.class, null, null);
+ super(null, null);
}
public CaracteristicQualitativeValue getMarineLitterCategory() {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateSpeciesMelagAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateSpeciesMelagAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateSpeciesMelagAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,7 +26,7 @@
import com.google.common.collect.Maps;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyRowModel;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
import fr.ifremer.tutti.ui.swing.util.species.EnterMelagWeightDialog;
import jaxx.runtime.SwingUtil;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -36,7 +36,6 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
@@ -71,8 +70,8 @@
public EditFishingOperationAction getEditAction() {
if (editAction == null) {
- editAction = TuttiActionHelper.createLogicAction(getHandler().getParentUi().getHandler().getParentHandler(),
- EditFishingOperationAction.class);
+ editAction = getContext().getActionFactory().createLogicAction(getHandler().getParentUi().getHandler().getParentHandler(),
+ EditFishingOperationAction.class);
}
return editAction;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/ImportPupitriPopupUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,8 +26,6 @@
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import javax.swing.JOptionPane;
@@ -40,10 +38,6 @@
*/
public class ImportPupitriPopupUIHandler {
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(ImportPupitriPopupUIHandler.class);
-
protected final ImportPupitriPopupUI ui;
protected final TuttiUIContext context;
@@ -65,7 +59,7 @@
}
protected void resetFields() {
- ui.getTrunkFile().setSelectedFilePath( null);
+ ui.getTrunkFile().setSelectedFilePath(null);
}
public void open() {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,6 +26,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+import fr.ifremer.shared.application.ApplicationDataUtil;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
@@ -36,12 +37,11 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchs;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryAble;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyRowModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -164,7 +164,7 @@
public SpeciesBatchRowModel(WeightUnit weightUnit,
SampleCategoryModel sampleCategoryModel) {
- super(SpeciesBatch.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
this.weightUnit = weightUnit;
this.sampleCategoryModel = sampleCategoryModel;
categories = new SampleCategory[sampleCategoryModel.getNbSampling()];
@@ -491,8 +491,8 @@
public void setSampleCategoryValue(Integer sampleCategoryId, Serializable value) {
SampleCategory<?> sampleCategory =
getSampleCategoryById(sampleCategoryId);
- TuttiUIUtil.setProperty(sampleCategory,
- SampleCategory.PROPERTY_CATEGORY_VALUE, value);
+ ApplicationDataUtil.setProperty(sampleCategory,
+ SampleCategory.PROPERTY_CATEGORY_VALUE, value);
firePropertyChange(PROPERTY_SAMPLE_CATEGORY_VALUE, null, sampleCategory);
}
@@ -500,8 +500,8 @@
public void setSampleCategoryWeight(Integer sampleCategoryId, Object value) {
SampleCategory<?> sampleCategory =
getSampleCategoryById(sampleCategoryId);
- TuttiUIUtil.setProperty(sampleCategory,
- SampleCategory.PROPERTY_CATEGORY_WEIGHT, value);
+ ApplicationDataUtil.setProperty(sampleCategory,
+ SampleCategory.PROPERTY_CATEGORY_WEIGHT, value);
firePropertyChange(PROPERTY_SAMPLE_CATEGORY_WEIGHT, null, sampleCategory);
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,13 +27,13 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.persistence.entities.data.SampleCategory;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryColumnIdentifier;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.table.TableColumnModelExt;
@@ -50,7 +50,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class SpeciesBatchTableModel extends AbstractTuttiTableModel<SpeciesBatchRowModel> {
+public class SpeciesBatchTableModel extends AbstractApplicationTableModel<SpeciesBatchRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -181,7 +181,7 @@
text: "tutti.editSpeciesBatch.action.removeBatch";
toolTipText: "tutti.editSpeciesBatch.action.removeBatch.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.removeBatch.mnemonic";
- _tuttiAction: {RemoveSpeciesBatchAction.class};
+ _applicationAction: {RemoveSpeciesBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRemoveBatchEnabled()};
_help: {"tutti.editSpeciesBatch.action.removeBatch.help"};
}
@@ -191,7 +191,7 @@
text: "tutti.editSpeciesBatch.action.removeSubBatch";
toolTipText: "tutti.editSpeciesBatch.action.removeSubBatch.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.removeSubBatch.mnemonic";
- _tuttiAction: {RemoveSpeciesSubBatchAction.class};
+ _applicationAction: {RemoveSpeciesSubBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRemoveSubBatchEnabled()};
_help: {"tutti.editSpeciesBatch.action.removeSubBatch.help"};
}
@@ -201,7 +201,7 @@
text: "tutti.editSpeciesBatch.action.renameBatch";
toolTipText: "tutti.editSpeciesBatch.action.renameBatch.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.renameBatch.mnemonic";
- _tuttiAction: {RenameSpeciesBatchAction.class};
+ _applicationAction: {RenameSpeciesBatchAction.class};
enabled: {model.isTableViewModeAll() && model.isRenameBatchEnabled()};
_help: {"tutti.editSpeciesBatch.action.renameBatch.help"};
}
@@ -211,7 +211,7 @@
text: "tutti.editSpeciesBatch.action.createMelag";
toolTipText: "tutti.editSpeciesBatch.action.createMelag.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.createMelag.mnemonic";
- _tuttiAction: {CreateSpeciesMelagAction.class};
+ _applicationAction: {CreateSpeciesMelagAction.class};
enabled: {!model.isTableViewModeLeaf() && model.isCreateMelagEnabled()};
_help: {"tutti.editSpeciesBatch.action.createMelag.help"};
}
@@ -230,7 +230,7 @@
text: "tutti.editSpeciesBatch.action.importPupitri";
toolTipText: "tutti.editSpeciesBatch.action.importPupitri.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.importPupitri.mnemonic";
- _tuttiAction: {ImportPupitriAction.class};
+ _applicationAction: {ImportPupitriAction.class};
_help: {"tutti.editSpeciesBatch.action.importPupitri.help"};
}
@@ -239,7 +239,7 @@
text: "tutti.editSpeciesBatch.action.importMultiPost";
toolTipText: "tutti.editSpeciesBatch.action.importMultiPost.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.importMultiPost.mnemonic";
- _tuttiAction: {ImportMultiPostAction.class};
+ _applicationAction: {ImportMultiPostAction.class};
_help: {"tutti.editSpeciesBatch.action.importMultiPost.help"};
}
@@ -248,7 +248,7 @@
text: "tutti.editSpeciesBatch.action.exportMultiPost";
toolTipText: "tutti.editSpeciesBatch.action.exportMultiPost.tip";
i18nMnemonic: "tutti.editSpeciesBatch.action.exportMultiPost.mnemonic";
- _tuttiAction: {ExportMultiPostAction.class};
+ _applicationAction: {ExportMultiPostAction.class};
_help: {"tutti.editSpeciesBatch.action.exportMultiPost.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-11-24 23:27:27 UTC (rev 1385)
@@ -37,10 +37,9 @@
javax.swing.ListSelectionModel
java.awt.Color
- java.awt.Dimension
static org.nuiton.i18n.I18n._
- static fr.ifremer.tutti.ui.swing.util.TuttiUIUtil.getWeightStringValue
+ static fr.ifremer.shared.application.ApplicationDataUtil.getWeightStringValue
</import>
<script><![CDATA[
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -42,7 +42,7 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.TuttiDecorator;
import fr.ifremer.tutti.service.ValidationService;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
@@ -68,7 +68,7 @@
import fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataTableCell;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.editor.NumberEditor;
import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
@@ -160,7 +160,7 @@
SpeciesBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM);
qualitative_unsorted_id =
- context.getPersistenceService().getEnumerationFile().QUALITATIVE_UNSORTED_ID;
+ getContext().getPersistenceService().getEnumerationFile().QUALITATIVE_UNSORTED_ID;
weightUnit = getConfig().getSpeciesWeightUnit();
@@ -1353,7 +1353,7 @@
// set the surveycode, do it only on the parent,
// the species of the parent is set to the children in loadBatchRow
- if (parentRow == null && context.isProtocolFilled()) {
+ if (parentRow == null && getContext().isProtocolFilled()) {
// get the surveycode from the species list of the model
List<Species> speciesList = getDataContext().getReferentSpeciesWithSurveyCode();
int i = speciesList.indexOf(newRow.getSpecies());
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -139,7 +139,7 @@
text: "tutti.createSpeciesBatch.action.addSpecies";
toolTipText: "tutti.createSpeciesBatch.action.addSpecies.tip";
i18nMnemonic: "tutti.createSpeciesBatch.action.addSpecies.mnemonic";
- _tuttiAction: {SelectSpeciesForSpeciesBatchAction.class};
+ _applicationAction: {SelectSpeciesForSpeciesBatchAction.class};
_help: {"tutti.createSpeciesBatch.action.addSpecies.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -44,7 +44,7 @@
import fr.ifremer.tutti.ui.swing.util.Cancelable;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
@@ -97,13 +97,13 @@
*/
protected final WeightUnit weightUnit;
- public CreateSpeciesBatchUIHandler(TuttiUI parentUi,
+ public CreateSpeciesBatchUIHandler(TuttiUI<?,?> parentUi,
CreateSpeciesBatchUI ui) {
super(parentUi.getHandler().getContext(), ui,
SplitSpeciesBatchRowModel.PROPERTY_SELECTED,
SplitSpeciesBatchRowModel.PROPERTY_CATEGORY_VALUE,
SplitSpeciesBatchRowModel.PROPERTY_WEIGHT);
- this.persistenceService = context.getPersistenceService();
+ this.persistenceService = getContext().getPersistenceService();
this.weightUnit = getConfig().getSpeciesWeightUnit();
this.sampleCategoryModel = getDataContext().getSampleCategoryModel();
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyCellComponent.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -32,7 +32,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -31,7 +31,7 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequencys;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -130,7 +130,7 @@
}
public SpeciesFrequencyRowModel(WeightUnit weightUnit) {
- super(SpeciesBatchFrequency.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
this.weightUnit = weightUnit;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,9 +25,9 @@
*/
import com.google.common.collect.Maps;
-import fr.ifremer.tutti.service.WeightUnit;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.type.WeightUnit;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import java.beans.PropertyChangeEvent;
@@ -43,7 +43,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class SpeciesFrequencyTableModel extends AbstractTuttiTableModel<SpeciesFrequencyRowModel> {
+public class SpeciesFrequencyTableModel extends AbstractApplicationTableModel<SpeciesFrequencyRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -79,7 +79,7 @@
}
#totalWeightField {
- text: {TuttiUIUtil.getWeightStringValue(model.getTotalWeight())};
+ text: {getWeightStringValue(model.getTotalWeight())};
enabled: false;
_computed: true;
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx 2013-11-24 23:27:27 UTC (rev 1385)
@@ -49,6 +49,7 @@
static org.nuiton.i18n.I18n._
static jaxx.runtime.SwingUtil.getStringValue
+ static fr.ifremer.shared.application.ApplicationDataUtil.getWeightStringValue
</import>
<script><![CDATA[
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,12 +27,13 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.ApplicationDataUtil;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.service.WeightUnit;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
@@ -219,7 +220,7 @@
SpeciesFrequencyUIModel model = getModel();
- if (context.isProtocolFilled()) {
+ if (getContext().isProtocolFilled()) {
// FIXME 20130128 kmorin: the species have no technical id
speciesProtocol = persistenceService.toSpeciesProtocolMap();
@@ -428,7 +429,7 @@
List<SpeciesFrequencyRowModel> rows = Lists.newArrayList(rowsByStep.values());
for (float i = minStep, step = model.getStep(); i <= maxStep;
- i = TuttiUIUtil.getRoundedLengthStep(i + step, true)) {
+ i = ApplicationDataUtil.getRoundedLengthStep(i + step, true)) {
if (!existingKeys.contains(i)) {
@@ -687,8 +688,7 @@
String message =
_("tutti.editSpeciesFrequencies.error.length.doublon",
doublon, index + 1);
- TuttiUIContext.getErrorHelper().showErrorDialog(
- message);
+ getContext().getErrorHelper().showErrorDialog(message);
// focus to first error row
TuttiUIUtil.selectFirstCellOnRow(getTable(), index, false);
@@ -728,8 +728,7 @@
String message =
_("tutti.editSpeciesFrequencies.error.length.doublon",
doublon, index + 1);
- TuttiUIContext.getErrorHelper().showErrorDialog(
- message);
+ getContext().getErrorHelper().showErrorDialog(message);
// focus to first error row
TuttiUIUtil.selectFirstCellOnRow(getTable(), index, false);
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -28,7 +28,7 @@
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
import java.util.List;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -72,7 +72,7 @@
protected boolean editable;
public SplitSpeciesBatchRowModel() {
- super(SplitSpeciesBatchRowModel.class, null, null);
+ super(null, null);
}
public SampleCategoryModelEntry getCategorytype() {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,9 +24,9 @@
* #L%
*/
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SelectedCategoryAble;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import static org.nuiton.i18n.I18n.n_;
@@ -38,7 +38,7 @@
* @since 0.3
*/
public class SplitSpeciesBatchTableModel
- extends AbstractTuttiTableModel<SplitSpeciesBatchRowModel> {
+ extends AbstractApplicationTableModel<SplitSpeciesBatchRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -28,7 +28,7 @@
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SelectedCategoryAble;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
import java.util.List;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -47,7 +47,7 @@
protected Serializable value;
public AbstractCaracteristicRowModel() {
- super(Serializable.class, null, null);
+ super(null, null);
}
public AbstractCaracteristicRowModel(Caracteristic key, Serializable value) {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -27,6 +27,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
@@ -34,7 +35,6 @@
import fr.ifremer.tutti.ui.swing.content.operation.EditFishingOperationUI;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
import jaxx.runtime.validator.swing.SwingValidator;
@@ -51,7 +51,7 @@
public abstract class AbstractCaracteristicTabUIHandler
<RM extends AbstractCaracteristicRowModel<RM>,
M extends AbstractCaracteristicTabUIModel<RM, M>,
- TM extends AbstractTuttiTableModel<RM>,
+ TM extends AbstractApplicationTableModel<RM>,
UI extends TuttiUI<M, ?>>
extends AbstractTuttiTableUIHandler<RM, M, UI> {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTabUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTabUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTabUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -32,8 +32,6 @@
import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueEditor;
import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueRenderer;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
@@ -45,9 +43,6 @@
*/
public class GearUseFeatureTabUIHandler extends AbstractCaracteristicTabUIHandler<GearUseFeatureRowModel, GearUseFeatureTabUIModel, GearUseFeatureTableModel, GearUseFeatureTabUI> {
- private final static Log log =
- LogFactory.getLog(GearUseFeatureTabUIHandler.class);
-
public GearUseFeatureTabUIHandler(EditFishingOperationUI parentUi,
GearUseFeatureTabUI ui) {
super(parentUi, ui, GearUseFeatureRowModel.PROPERTY_VALUE);
@@ -111,8 +106,8 @@
{
addColumnToModel(columnModel,
- new CaracteristicValueEditor(context),
- new CaracteristicValueRenderer(context),
+ new CaracteristicValueEditor(getContext()),
+ new CaracteristicValueRenderer(getContext()),
GearUseFeatureTableModel.VALUE);
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/GearUseFeatureTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import static org.nuiton.i18n.I18n.n_;
@@ -34,7 +34,7 @@
* @author kmorin
* @since 0.3
*/
-public class GearUseFeatureTableModel extends AbstractTuttiTableModel<GearUseFeatureRowModel> {
+public class GearUseFeatureTableModel extends AbstractApplicationTableModel<GearUseFeatureRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTabUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTabUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTabUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -32,8 +32,6 @@
import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueEditor;
import fr.ifremer.tutti.ui.swing.util.editor.CaracteristicValueRenderer;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
@@ -45,9 +43,6 @@
*/
public class VesselUseFeatureTabUIHandler extends AbstractCaracteristicTabUIHandler<VesselUseFeatureRowModel, VesselUseFeatureTabUIModel, VesselUseFeatureTableModel, VesselUseFeatureTabUI> {
- private final static Log log =
- LogFactory.getLog(VesselUseFeatureTabUIHandler.class);
-
public VesselUseFeatureTabUIHandler(EditFishingOperationUI parentUi,
VesselUseFeatureTabUI ui) {
super(parentUi, ui, VesselUseFeatureRowModel.PROPERTY_VALUE);
@@ -110,8 +105,8 @@
{
addColumnToModel(columnModel,
- new CaracteristicValueEditor(context),
- new CaracteristicValueRenderer(context),
+ new CaracteristicValueEditor(getContext()),
+ new CaracteristicValueRenderer(getContext()),
VesselUseFeatureTableModel.VALUE);
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/VesselUseFeatureTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import static org.nuiton.i18n.I18n.n_;
@@ -34,7 +34,7 @@
* @author kmorin
* @since 0.3
*/
-public class VesselUseFeatureTableModel extends AbstractTuttiTableModel<VesselUseFeatureRowModel> {
+public class VesselUseFeatureTableModel extends AbstractApplicationTableModel<VesselUseFeatureRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -80,7 +80,7 @@
text: "tutti.editProgram.action.saveProgram";
toolTipText: "tutti.editProgram.action.saveProgram.tip";
i18nMnemonic: "tutti.editProgram.action.saveProgram.mnemonic";
- _tuttiAction: {SaveProgramAction.class};
+ _applicationAction: {SaveProgramAction.class};
enabled: {model.isModify() && model.isValid()};
_help: {"tutti.editProgram.action.saveProgram.help"};
}
@@ -90,6 +90,6 @@
text: "tutti.editProgram.action.closeEditProgram";
toolTipText: "tutti.editProgram.action.closeEditProgram.tip";
i18nMnemonic: "tutti.editProgram.action.closeEditProgram.mnemonic";
- _tuttiAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
_help: {"tutti.editProgram.action.cancelProgram.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -28,7 +28,7 @@
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.CloseableUI;
+import fr.ifremer.shared.application.swing.util.CloseableUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
@@ -68,9 +68,9 @@
*/
private final PersistenceService persistenceService;
- public EditProgramUIHandler(TuttiUI parentUi, EditProgramUI ui) {
+ public EditProgramUIHandler(TuttiUI<?,?> parentUi, EditProgramUI ui) {
super(parentUi.getHandler().getContext(), ui);
- this.persistenceService = context.getPersistenceService();
+ this.persistenceService = getContext().getPersistenceService();
}
@Override
@@ -80,7 +80,7 @@
EditProgramUIModel model = new EditProgramUIModel();
- String programId = context.getProgramId();
+ String programId = getContext().getProgramId();
if (programId == null) {
if (log.isInfoEnabled()) {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -57,7 +57,7 @@
public EditProgramUIModel() {
- super(Program.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
}
@Override
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesRowModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesRowModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesRowModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -78,7 +78,7 @@
SpeciesProtocol.class);
public EditProtocolSpeciesRowModel() {
- super(SpeciesProtocol.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
}
@Override
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,10 +25,10 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import java.util.List;
@@ -39,7 +39,7 @@
* @author kmorin
* @since 0.3
*/
-public class EditProtocolSpeciesTableModel extends AbstractTuttiTableModel<EditProtocolSpeciesRowModel> {
+public class EditProtocolSpeciesTableModel extends AbstractApplicationTableModel<EditProtocolSpeciesRowModel> {
public static final ColumnIdentifier<EditProtocolSpeciesRowModel> SPECIES_ID = ColumnIdentifier.newId(
EditProtocolSpeciesRowModel.PROPERTY_SPECIES,
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -140,7 +140,7 @@
toolTipText: "tutti.editProtocol.action.saveProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.saveProtocol.mnemonic";
enabled: {model.isModify() && model.isValid()};
- _tuttiAction: {SaveProtocolAction.class};
+ _applicationAction: {SaveProtocolAction.class};
_help: {"tutti.editProtocol.action.saveProtocol.help"};
}
@@ -149,7 +149,7 @@
text: "tutti.editProtocol.action.closeEditProtocol";
toolTipText: "tutti.editProtocol.action.closeEditProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.closeEditProtocol.mnemonic";
- _tuttiAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
+ _applicationAction: {fr.ifremer.tutti.ui.swing.content.SelectCruiseAction.class};
_help: {"tutti.editProtocol.action.closeEditProtocol.help"};
}
@@ -157,7 +157,7 @@
text: "tutti.editProtocol.action.selectOtherSpecies";
toolTipText: "tutti.editProtocol.action.selectOtherSpecies.tip";
i18nMnemonic: "tutti.editProtocol.action.selectOtherSpecies.mnemonic";
- _tuttiAction: {SelectOtherSpeciesAction.class};
+ _applicationAction: {SelectOtherSpeciesAction.class};
_help: {"tutti.editProtocol.action.selectOtherSpecies.help"};
}
@@ -165,7 +165,7 @@
actionIcon: add;
toolTipText: "tutti.editProtocol.action.addSpeciesProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.addSpeciesProtocol.mnemonic";
- _tuttiAction: {AddSpeciesProtocolAction.class};
+ _applicationAction: {AddSpeciesProtocolAction.class};
enabled: {speciesComboBox.getSelectedItem() != null};
_help: {"tutti.editProtocol.action.addSpeciesProtocol.help"};
}
@@ -175,7 +175,7 @@
text: "tutti.editProtocol.action.removeSpeciesProtocol";
toolTipText: "tutti.editProtocol.action.removeSpeciesProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.removeSpeciesProtocol.mnemonic";
- _tuttiAction: {RemoveSpeciesProtocolAction.class};
+ _applicationAction: {RemoveSpeciesProtocolAction.class};
enabled: {model.isRemoveSpeciesEnabled()};
_help: {"tutti.editProtocol.action.removeSpeciesProtocol.help"};
}
@@ -185,7 +185,7 @@
text: "tutti.editProtocol.action.importProtocolSpecies";
toolTipText: "tutti.editProtocol.action.importProtocolSpecies.tip";
i18nMnemonic: "tutti.editProtocol.action.importProtocolSpecies.mnemonic";
- _tuttiAction: {ImportProtocolSpeciesAction.class};
+ _applicationAction: {ImportProtocolSpeciesAction.class};
_help: {"tutti.editProtocol.action.importProtocolSpecies.help"};
}
@@ -194,7 +194,7 @@
text: "tutti.editProtocol.action.exportProtocolSpecies";
toolTipText: "tutti.editProtocol.action.exportProtocolSpecies.tip";
i18nMnemonic: "tutti.editProtocol.action.exportProtocolSpecies.mnemonic";
- _tuttiAction: {ExportProtocolSpeciesAction.class};
+ _applicationAction: {ExportProtocolSpeciesAction.class};
_help: {"tutti.editProtocol.action.exportProtocolSpecies.help"};
}
@@ -203,7 +203,7 @@
text: "tutti.editProtocol.action.exportPupitri";
toolTipText: "tutti.editProtocol.action.exportPupitri.tip";
i18nMnemonic: "tutti.editProtocol.action.exportPupitri.mnemonic";
- _tuttiAction: {ExportPupitriAction.class};
+ _applicationAction: {ExportPupitriAction.class};
_help: {"tutti.editProtocol.action.exportPupitri.help"};
}
@@ -211,7 +211,7 @@
text: "tutti.editProtocol.action.selectOtherBenthos";
toolTipText: "tutti.editProtocol.action.selectOtherBenthos.tip";
i18nMnemonic: "tutti.editProtocol.action.selectOtherBenthos.mnemonic";
- _tuttiAction: {SelectOtherBenthosAction.class};
+ _applicationAction: {SelectOtherBenthosAction.class};
_help: {"tutti.editProtocol.action.selectOtherBenthos.help"};
}
@@ -219,7 +219,7 @@
actionIcon: add;
toolTipText: "tutti.editProtocol.action.addBenthosProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.addBenthosProtocol.mnemonic";
- _tuttiAction: {AddBenthosProtocolAction.class};
+ _applicationAction: {AddBenthosProtocolAction.class};
enabled: {benthosComboBox.getSelectedItem() != null};
_help: {"tutti.editProtocol.action.addBenthosProtocol.help"};
}
@@ -229,7 +229,7 @@
text: "tutti.editProtocol.action.removeBenthosProtocol";
toolTipText: "tutti.editProtocol.action.removeBenthosProtocol.tip";
i18nMnemonic: "tutti.editProtocol.action.removeBenthosProtocol.mnemonic";
- _tuttiAction: {RemoveBenthosProtocolAction.class};
+ _applicationAction: {RemoveBenthosProtocolAction.class};
enabled: {model.isRemoveBenthosEnabled()};
_help: {"tutti.editProtocol.action.removeBenthosProtocol.help"};
}
@@ -239,7 +239,7 @@
text: "tutti.editProtocol.action.importProtocolBenthos";
toolTipText: "tutti.editProtocol.action.importProtocolBenthos.tip";
i18nMnemonic: "tutti.editProtocol.action.importProtocolBenthos.mnemonic";
- _tuttiAction: {ImportProtocolBenthosAction.class};
+ _applicationAction: {ImportProtocolBenthosAction.class};
_help: {"tutti.editProtocol.action.importProtocolBenthos.help"};
}
@@ -248,7 +248,7 @@
text: "tutti.editProtocol.action.exportProtocolBenthos";
toolTipText: "tutti.editProtocol.action.exportProtocolBenthos.tip";
i18nMnemonic: "tutti.editProtocol.action.exportProtocolBenthos.mnemonic";
- _tuttiAction: {ExportProtocolBenthosAction.class};
+ _applicationAction: {ExportProtocolBenthosAction.class};
_help: {"tutti.editProtocol.action.exportProtocolBenthos.help"};
}
@@ -257,7 +257,7 @@
text: "tutti.editProtocol.action.importProtocolCaracteristic";
toolTipText: "tutti.editProtocol.action.importProtocolCaracteristic.tip";
i18nMnemonic: "tutti.editProtocol.action.importProtocolCaracteristic.mnemonic";
- _tuttiAction: {ImportProtocolCaracteristicAction.class};
+ _applicationAction: {ImportProtocolCaracteristicAction.class};
_help: {"tutti.editProtocol.action.importProtocolCaracteristic.help"};
}
@@ -266,7 +266,7 @@
text: "tutti.editProtocol.action.exportProtocolCaracteristic";
toolTipText: "tutti.editProtocol.action.exportProtocolCaracteristic.tip";
i18nMnemonic: "tutti.editProtocol.action.exportProtocolCaracteristic.mnemonic";
- _tuttiAction: {ExportProtocolCaracteristicAction.class};
+ _applicationAction: {ExportProtocolCaracteristicAction.class};
_help: {"tutti.editProtocol.action.exportProtocolCaracteristic.tip"};
}
@@ -275,7 +275,7 @@
text: "tutti.editProtocol.action.exportProtocolAllCaracteristic";
toolTipText: "tutti.editProtocol.action.exportProtocolAllCaracteristic.tip";
i18nMnemonic: "tutti.editProtocol.action.exportProtocolAllCaracteristic.mnemonic";
- _tuttiAction: {ExportAllCaracteristicAction.class};
+ _applicationAction: {ExportAllCaracteristicAction.class};
_help: {"tutti.editProtocol.action.exportProtocolAllCaracteristic.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -43,7 +43,7 @@
import fr.ifremer.tutti.ui.swing.content.home.EditProtocolAction;
import fr.ifremer.tutti.ui.swing.content.home.ImportProtocolAction;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.CloseableUI;
+import fr.ifremer.shared.application.swing.util.CloseableUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
@@ -123,10 +123,10 @@
protected List<BeanDoubleList<Caracteristic>> allDoubleLists;
- public EditProtocolUIHandler(TuttiUI parentUi, EditProtocolUI ui) {
+ public EditProtocolUIHandler(TuttiUI<?,?> parentUi, EditProtocolUI ui) {
super(parentUi.getHandler().getContext(), ui);
- this.persistenceService = context.getPersistenceService();
- this.sampleCategoryModel = context.getDataContext().getSampleCategoryModel();
+ this.persistenceService = getContext().getPersistenceService();
+ this.sampleCategoryModel = getContext().getDataContext().getSampleCategoryModel();
}
public JXTable getSpeciesTable() {
@@ -200,7 +200,7 @@
TuttiProtocol protocol;
- if (context.isProtocolFilled()) {
+ if (getContext().isProtocolFilled()) {
// load existing protocol
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -128,7 +128,7 @@
BinderFactory.newBinder(TuttiProtocol.class, EditProtocolUIModel.class);
public EditProtocolUIModel() {
- super(TuttiProtocol.class, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
}
@Override
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/MandatorySampleCategoryColumnIdentifier.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/MandatorySampleCategoryColumnIdentifier.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/MandatorySampleCategoryColumnIdentifier.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
/**
* @author tchemit <chemit(a)codelutin.com>
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ManageTemporaryReferentialUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ManageTemporaryReferentialUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/referential/ManageTemporaryReferentialUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -40,7 +40,7 @@
#exportSpeciesExampleButton {
actionIcon: export;
text: "tutti.manageTemporaryReferential.action.exportTemporarySpeciesExample";
- _tuttiAction: {ExportTemporarySpeciesExampleAction.class};
+ _applicationAction: {ExportTemporarySpeciesExampleAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.exportTemporarySpeciesExample.tip";
_help: {"tutti.manageTemporaryReferential.action.exportTemporarySpeciesExample.help"};
}
@@ -48,7 +48,7 @@
#importSpeciesButton {
actionIcon: import;
text: "tutti.manageTemporaryReferential.action.importTemporarySpecies";
- _tuttiAction: {ImportTemporarySpeciesAction.class};
+ _applicationAction: {ImportTemporarySpeciesAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.importTemporarySpecies.tip";
_help: {"tutti.manageTemporaryReferential.action.importTemporarySpecies.help"};
}
@@ -62,7 +62,7 @@
#exportVesselExampleButton {
actionIcon: export;
text: "tutti.manageTemporaryReferential.action.exportTemporaryVesselExample";
- _tuttiAction: {ExportTemporaryVesselExampleAction.class};
+ _applicationAction: {ExportTemporaryVesselExampleAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.exportTemporaryVesselExample.tip";
_help: {"tutti.manageTemporaryReferential.action.exportTemporaryVesselExample.help"};
}
@@ -70,7 +70,7 @@
#importVesselButton {
actionIcon: import;
text: "tutti.manageTemporaryReferential.action.importTemporaryVessel";
- _tuttiAction: {ImportTemporaryVesselAction.class};
+ _applicationAction: {ImportTemporaryVesselAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.importTemporaryVessel.tip";
_help: {"tutti.manageTemporaryReferential.action.importTemporaryVessel.help"};
}
@@ -84,7 +84,7 @@
#exportGearExampleButton {
actionIcon: export;
text: "tutti.manageTemporaryReferential.action.exportTemporaryGearExample";
- _tuttiAction: {ExportTemporaryGearExampleAction.class};
+ _applicationAction: {ExportTemporaryGearExampleAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.exportTemporaryGearExample.tip";
_help: {"tutti.manageTemporaryReferential.action.exportTemporaryGearExample.help"};
}
@@ -92,7 +92,7 @@
#importGearButton {
actionIcon: import;
text: "tutti.manageTemporaryReferential.action.importTemporaryGear";
- _tuttiAction: {ImportTemporaryGearAction.class};
+ _applicationAction: {ImportTemporaryGearAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.importTemporaryGear.tip";
_help: {"tutti.manageTemporaryReferential.action.importTemporaryGear.help"};
}
@@ -106,7 +106,7 @@
#exportPersonExampleButton {
actionIcon: export;
text: "tutti.manageTemporaryReferential.action.exportTemporaryPersonExample";
- _tuttiAction: {ExportTemporaryPersonExampleAction.class};
+ _applicationAction: {ExportTemporaryPersonExampleAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.exportTemporaryPersonExample.tip";
_help: {"tutti.manageTemporaryReferential.action.exportTemporaryPersonExample.help"};
}
@@ -114,7 +114,7 @@
#importPersonButton {
actionIcon: import;
text: "tutti.manageTemporaryReferential.action.importTemporaryPerson";
- _tuttiAction: {ImportTemporaryPersonAction.class};
+ _applicationAction: {ImportTemporaryPersonAction.class};
toolTipText: "tutti.manageTemporaryReferential.action.importTemporaryPerson.tip";
_help: {"tutti.manageTemporaryReferential.action.importTemporaryPerson.help"};
}
\ No newline at end of file
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -93,7 +93,7 @@
text: "tutti.report.action.cancel";
toolTipText: "tutti.report.action.cancel.tip";
i18nMnemonic: "tutti.report.action.cancel.mnemonic";
- _tuttiAction: {GoToPreviousScreenAction.class};
+ _applicationAction: {GoToPreviousScreenAction.class};
_help: {"tutti.report.action.cancel.help"};
}
@@ -102,7 +102,7 @@
text: "tutti.report.action.generate";
toolTipText: "tutti.report.action.generate.tip";
i18nMnemonic: "tutti.report.action.generate.mnemonic";
- _tuttiAction: {GenerateReportAction.class};
+ _applicationAction: {GenerateReportAction.class};
enabled: {model.isValid()};
_help: {"tutti.report.action.generate.help"};
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,10 +26,9 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+import fr.ifremer.shared.application.swing.util.CloseableUI;
import fr.ifremer.tutti.service.report.ReportService;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.CloseableUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.swing.editor.FileEditor;
@@ -63,9 +62,9 @@
*/
private final ReportService reportService;
- public ReportUIHandler(TuttiUI parentUi, ReportUI ui) {
+ public ReportUIHandler(TuttiUI<?, ?> parentUi, ReportUI ui) {
super(parentUi.getHandler().getContext(), ui);
- this.reportService = context.getReportService();
+ this.reportService = getContext().getReportService();
}
@Override
@@ -151,7 +150,7 @@
desktop.browse(file.toURI());
} catch (IOException e) {
- TuttiUIContext.getErrorHelper().showErrorDialog(_("swing.error.cannot.open.file"));
+ getContext().getErrorHelper().showErrorDialog(_("swing.error.cannot.open.file"));
}
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/report/ReportUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -60,7 +60,7 @@
protected final ReportModel editObject = new ReportModel();
public ReportUIModel() {
- super(ReportModel.class, null, toBeanBinder);
+ super(null, toBeanBinder);
}
public List<File> getReports() {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiBeanUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiBeanUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiBeanUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -59,8 +59,7 @@
private final Binder<B, E> toBeanBinder;
- protected AbstractTuttiBeanUIModel(Class<E> entityType,
- Binder<E, B> fromBeanBinder,
+ protected AbstractTuttiBeanUIModel(Binder<E, B> fromBeanBinder,
Binder<B, E> toBeanBinder) {
this.fromBeanBinder = fromBeanBinder;
this.toBeanBinder = toBeanBinder;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -53,7 +53,7 @@
* @param currentIndex
* @param newIndex
* @return <code>false</code> if you want to prevent the tab change,
- * <code>true</code> otherwise
+ * <code>true</code> otherwise
*/
protected boolean onTabChanged(int currentIndex, int newIndex) {
boolean result = true;
@@ -76,8 +76,8 @@
*
* @param index the index of the tab
* @return the tab handler of the index i if the handler implements
- * the {@link TabHandler} interface,
- * <code>null</code> otherwise
+ * the {@link TabHandler} interface,
+ * <code>null</code> otherwise
*/
protected TabHandler getTabHandler(int index) {
TabHandler tabHandler = null;
@@ -96,7 +96,7 @@
}
@Override
- protected void initUI(TuttiUI ui) {
+ protected void initUI(UI ui) {
super.initUI(ui);
final JTabbedPane tabPanel = getTabPanel();
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,236 +25,174 @@
*/
import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.swing.AbstractApplicationUIHandler;
+import fr.ifremer.shared.application.swing.action.ApplicationActionUI;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.shared.application.type.ApplicationProgressionModel;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.LabelAware;
-import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.persistence.entities.TuttiEntity;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.entities.data.SampleCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.TuttiDataContext;
-import fr.ifremer.tutti.service.WeightUnit;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.content.MainUI;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
-import fr.ifremer.tutti.ui.swing.spatial.DmdCoordinateEditor;
-import fr.ifremer.tutti.ui.swing.spatial.DmsCoordinateEditor;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionUI;
import fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment;
-import fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor;
import fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataEditor;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.JAXXWidgetUtil;
-import jaxx.runtime.swing.editor.FileEditor;
import jaxx.runtime.swing.editor.NumberEditor;
-import jaxx.runtime.swing.editor.bean.BeanDoubleList;
-import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
-import jaxx.runtime.swing.editor.bean.BeanUIUtil;
-import jaxx.runtime.swing.editor.cell.NumberCellEditor;
-import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
-import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXDatePicker;
import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
-import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
import org.jdesktop.swingx.decorator.ComponentAdapter;
import org.jdesktop.swingx.decorator.FontHighlighter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
-import org.jdesktop.swingx.table.TableColumnExt;
import org.nuiton.decorator.Decorator;
-import org.nuiton.decorator.JXPathDecorator;
import org.nuiton.validator.bean.simple.SimpleBeanValidator;
import javax.swing.AbstractAction;
-import javax.swing.AbstractButton;
-import javax.swing.Action;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JOptionPane;
-import javax.swing.JPopupMenu;
import javax.swing.JRootPane;
-import javax.swing.JScrollPane;
-import javax.swing.JSpinner;
-import javax.swing.JTable;
import javax.swing.JTextField;
-import javax.swing.JViewport;
import javax.swing.KeyStroke;
-import javax.swing.ListCellRenderer;
-import javax.swing.ListSelectionModel;
-import javax.swing.ScrollPaneConstants;
-import javax.swing.SwingConstants;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
-import javax.swing.border.LineBorder;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.ListSelectionEvent;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumnModel;
-import javax.swing.text.JTextComponent;
-import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
-import java.awt.Point;
-import java.awt.Rectangle;
import java.awt.event.ActionEvent;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-import java.awt.event.HierarchyEvent;
-import java.awt.event.HierarchyListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.Serializable;
-import java.text.ParseException;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
-import static org.nuiton.i18n.I18n._;
-
/**
* Contract of any UI handler.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public abstract class AbstractTuttiUIHandler<M, UI extends TuttiUI<M, ?>> implements UIMessageNotifier {
+public abstract class AbstractTuttiUIHandler<M, UI extends TuttiUI<M, ?>> extends fr.ifremer.shared.application.swing.AbstractApplicationUIHandler<M, UI> implements UIMessageNotifier {
/** Logger. */
private static final Log log =
LogFactory.getLog(AbstractTuttiUIHandler.class);
- public abstract void beforeInitUI();
+// public abstract void beforeInitUI();
+//
+// public abstract void afterInitUI();
+//
+// public abstract void onCloseUI();
+//
+// public abstract SwingValidator<M> getValidator();
- public abstract void afterInitUI();
+// /**
+// * Global application context.
+// *
+// * @since 0.1
+// */
+// protected final TuttiUIContext context;
+//
+// /**
+// * UI handled.
+// *
+// * @since 0.1
+// */
+// protected final UI ui;
- public abstract void onCloseUI();
-
- public abstract SwingValidator<M> getValidator();
-
- /**
- * Global application context.
- *
- * @since 0.1
- */
- protected final TuttiUIContext context;
-
- /**
- * UI handled.
- *
- * @since 0.1
- */
- protected final UI ui;
-
protected AbstractTuttiUIHandler(TuttiUIContext context, UI ui) {
- this.context = context;
- this.ui = ui;
+ super(context, ui);
+// this.context = context;
+// this.ui = ui;
}
//------------------------------------------------------------------------//
//-- Public methods --//
//------------------------------------------------------------------------//
- public DefaultComboBoxModel newComboModel(Object... items) {
- return new DefaultComboBoxModel(items);
- }
+// public DefaultComboBoxModel newComboModel(Object... items) {
+// return new DefaultComboBoxModel(items);
+// }
- public final M getModel() {
- return ui.getModel();
- }
+// public final M getModel() {
+// return ui.getModel();
+// }
+//
+// public final UI getUI() {
+// return ui;
+// }
- public final UI getUI() {
- return ui;
- }
-
@Override
public void showInformationMessage(String message) {
- context.showInformationMessage(message);
+ getContext().showInformationMessage(message);
}
public TuttiUIContext getContext() {
- return context;
+ return (TuttiUIContext) super.getContext();
}
public TuttiDataContext getDataContext() {
return getContext().getDataContext();
}
- public TuttiApplicationConfig getConfig() {
- return context.getConfig();
+ public TuttiConfiguration getConfig() {
+ return getContext().getConfig();
}
- public void setText(KeyEvent event, String property) {
- JTextComponent field = (JTextComponent) event.getSource();
- String value = field.getText();
- TuttiUIUtil.setProperty(getModel(), property, value);
- }
+// public void setText(KeyEvent event, String property) {
+// JTextComponent field = (JTextComponent) event.getSource();
+// String value = field.getText();
+// TuttiUIUtil.setProperty(getModel(), property, value);
+// }
- public void setFile(ActionEvent event, String property) {
- FileEditor field = (FileEditor) event.getSource();
- File value = field.getSelectedFile();
- TuttiUIUtil.setProperty(getModel(), property, value);
- }
+// public void setFile(ActionEvent event, String property) {
+// FileEditor field = (FileEditor) event.getSource();
+// File value = field.getSelectedFile();
+// TuttiUIUtil.setProperty(getModel(), property, value);
+// }
- public void setBoolean(ItemEvent event, String property) {
- boolean value = event.getStateChange() == ItemEvent.SELECTED;
- TuttiUIUtil.setProperty(getModel(), property, value);
- }
+// public void setBoolean(ItemEvent event, String property) {
+// boolean value = event.getStateChange() == ItemEvent.SELECTED;
+// 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 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();
- ListSelectionModel selectionModel = list.getSelectionModel();
+// public void selectListData(ListSelectionEvent event, String property) {
+// if (!event.getValueIsAdjusting()) {
+// JList list = (JList) event.getSource();
+// ListSelectionModel selectionModel = list.getSelectionModel();
+//
+// selectionModel.setValueIsAdjusting(true);
+// try {
+// List selectedList = Lists.newLinkedList();
+//
+// for (int index : list.getSelectedIndices()) {
+// Object o = list.getModel().getElementAt(index);
+// selectedList.add(o);
+// }
+// TuttiUIUtil.setProperty(getModel(), property, selectedList);
+// } finally {
+// selectionModel.setValueIsAdjusting(false);
+// }
+// }
+// }
- selectionModel.setValueIsAdjusting(true);
- try {
- List selectedList = Lists.newLinkedList();
-
- for (int index : list.getSelectedIndices()) {
- Object o = list.getModel().getElementAt(index);
- selectedList.add(o);
- }
- TuttiUIUtil.setProperty(getModel(), property, selectedList);
- } finally {
- selectionModel.setValueIsAdjusting(false);
- }
- }
- }
-
public void openDialog(TuttiUI dialogContent,
String title, Dimension dim) {
Component topestUI = getTopestUI();
@@ -271,7 +209,7 @@
result.setSize(dim);
- final AbstractTuttiUIHandler handler = dialogContent.getHandler();
+ final AbstractApplicationUIHandler handler = dialogContent.getHandler();
if (handler instanceof Cancelable) {
@@ -313,67 +251,67 @@
public static final String CONFIRMATION_FORMAT = "<html>%s<hr/><br/>%s</html>";
- public int askSaveBeforeLeaving(String message) {
- String htmlMessage = String.format(
- CONFIRMATION_FORMAT,
- message,
- _("tutti.common.askSaveBeforeLeaving.help"));
- int result = JOptionPane.showConfirmDialog(
- getTopestUI(),
- htmlMessage,
- _("tutti.common.askSaveBeforeLeaving.title"),
- JOptionPane.YES_NO_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- return result;
- }
+// public int askSaveBeforeLeaving(String message) {
+// String htmlMessage = String.format(
+// CONFIRMATION_FORMAT,
+// message,
+// _("tutti.common.askSaveBeforeLeaving.help"));
+// int result = JOptionPane.showConfirmDialog(
+// getTopestUI(),
+// htmlMessage,
+// _("tutti.common.askSaveBeforeLeaving.title"),
+// JOptionPane.YES_NO_CANCEL_OPTION,
+// JOptionPane.QUESTION_MESSAGE);
+// return result;
+// }
- public boolean askCancelEditBeforeLeaving(String message) {
- String htmlMessage = String.format(
- CONFIRMATION_FORMAT,
- message,
- _("tutti.common.askCancelEditBeforeLeaving.help"));
- int i = JOptionPane.showConfirmDialog(
- getTopestUI(),
- htmlMessage,
- _("tutti.common.askCancelEditBeforeLeaving.title"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+// public boolean askCancelEditBeforeLeaving(String message) {
+// String htmlMessage = String.format(
+// CONFIRMATION_FORMAT,
+// message,
+// _("tutti.common.askCancelEditBeforeLeaving.help"));
+// int i = JOptionPane.showConfirmDialog(
+// getTopestUI(),
+// htmlMessage,
+// _("tutti.common.askCancelEditBeforeLeaving.title"),
+// JOptionPane.OK_CANCEL_OPTION,
+// JOptionPane.QUESTION_MESSAGE);
+//
+// boolean result = i == JOptionPane.OK_OPTION;
+// return result;
+// }
- boolean result = i == JOptionPane.OK_OPTION;
- return result;
- }
+// public void showSuccessMessage(String title, String message) {
+//
+// Component topestUI = getTopestUI();
+// boolean alwaysOnTop = false;
+//
+// if (topestUI instanceof JDialog) {
+// alwaysOnTop = ((JDialog) topestUI).isAlwaysOnTop();
+// }
+//
+// if (alwaysOnTop) {
+// ((JDialog) topestUI).setAlwaysOnTop(false);
+// }
+// try {
+//
+// JOptionPane.showMessageDialog(
+// topestUI,
+// message,
+// title,
+// JOptionPane.INFORMATION_MESSAGE,
+// UIManager.getIcon("info")
+// );
+// } finally {
+// if (alwaysOnTop) {
+// ((JDialog) topestUI).setAlwaysOnTop(true);
+// }
+// }
+// }
- public void showSuccessMessage(String title, String message) {
-
- Component topestUI = getTopestUI();
- boolean alwaysOnTop = false;
-
- if (topestUI instanceof JDialog) {
- alwaysOnTop = ((JDialog) topestUI).isAlwaysOnTop();
- }
-
- if (alwaysOnTop) {
- ((JDialog) topestUI).setAlwaysOnTop(false);
- }
- try {
-
- JOptionPane.showMessageDialog(
- topestUI,
- message,
- title,
- JOptionPane.INFORMATION_MESSAGE,
- UIManager.getIcon("info")
- );
- } finally {
- if (alwaysOnTop) {
- ((JDialog) topestUI).setAlwaysOnTop(true);
- }
- }
- }
-
public Component getTopestUI() {
Component result;
- TuttiActionUI actionUI = getContext().getActionUI();
+ ApplicationActionUI actionUI = getContext().getActionUI();
// if (actionUI.isVisible()) {
result = actionUI;
// } else {
@@ -383,16 +321,17 @@
}
public void clearValidators() {
- MainUI main = context.getMainUI();
+ MainUI main = getContext().getMainUI();
Preconditions.checkNotNull(
main, "No mainUI registred in application context");
MainUIHandler handler = main.getHandler();
handler.clearValidators();
}
+ @Override
public <O> Decorator<O> getDecorator(Class<O> type, String name) {
DecoratorService decoratorService =
- context.getDecoratorService();
+ getContext().getDecoratorService();
Preconditions.checkNotNull(type);
@@ -407,81 +346,81 @@
return decorator;
}
- public void autoSelectRowInTable(MouseEvent e, JPopupMenu popup) {
+// public void autoSelectRowInTable(MouseEvent e, JPopupMenu popup) {
+//
+// boolean rightClick = SwingUtilities.isRightMouseButton(e);
+//
+// if (rightClick || SwingUtilities.isLeftMouseButton(e)) {
+//
+// // get the coordinates of the mouse click
+// Point p = e.getPoint();
+//
+// JXTable source = (JXTable) e.getSource();
+//
+// int[] selectedRows = source.getSelectedRows();
+// int[] selectedColumns = source.getSelectedColumns();
+//
+// // get the row index at this point
+// int rowIndex = source.rowAtPoint(p);
+//
+// // get the column index at this point
+// int columnIndex = source.columnAtPoint(p);
+//
+// if (log.isDebugEnabled()) {
+// log.debug("At point [" + p + "] found Row " + rowIndex + ", Column " + columnIndex);
+// }
+//
+// boolean canContinue = true;
+//
+// if (source.isEditing()) {
+//
+// // stop editing
+// boolean stopEdit = source.getCellEditor().stopCellEditing();
+// if (!stopEdit) {
+// if (log.isWarnEnabled()) {
+// log.warn("Could not stop edit cell...");
+// }
+// canContinue = false;
+// }
+// }
+//
+// if (canContinue) {
+//
+// // select row (could empty selection)
+// if (rowIndex == -1) {
+// source.clearSelection();
+// } else if (!ArrayUtils.contains(selectedRows, rowIndex)) {
+// if (ListSelectionModel.MULTIPLE_INTERVAL_SELECTION == source.getSelectionMode()) {
+// // add to selection
+// source.addRowSelectionInterval(rowIndex, rowIndex);
+// } else {
+// // set selection
+// source.setRowSelectionInterval(rowIndex, rowIndex);
+// }
+// }
+//
+// // select column (could empty selection)
+// if (columnIndex == -1) {
+// source.clearSelection();
+// } else if (!ArrayUtils.contains(selectedColumns, columnIndex)) {
+// source.setColumnSelectionInterval(columnIndex, columnIndex);
+// }
+//
+// if (rightClick) {
+//
+// // use now model coordinate
+// int modelRowIndex = source.convertRowIndexToModel(rowIndex);
+// int modelColumnIndex = source.convertColumnIndexToModel(columnIndex);
+//
+// beforeOpenPopup(modelRowIndex, modelColumnIndex);
+//
+// // on right click show popup
+// popup.show(source, e.getX(), e.getY());
+// }
+// }
+// }
+// }
- boolean rightClick = SwingUtilities.isRightMouseButton(e);
-
- if (rightClick || SwingUtilities.isLeftMouseButton(e)) {
-
- // get the coordinates of the mouse click
- Point p = e.getPoint();
-
- JXTable source = (JXTable) e.getSource();
-
- int[] selectedRows = source.getSelectedRows();
- int[] selectedColumns = source.getSelectedColumns();
-
- // get the row index at this point
- int rowIndex = source.rowAtPoint(p);
-
- // get the column index at this point
- int columnIndex = source.columnAtPoint(p);
-
- if (log.isDebugEnabled()) {
- log.debug("At point [" + p + "] found Row " + rowIndex + ", Column " + columnIndex);
- }
-
- boolean canContinue = true;
-
- if (source.isEditing()) {
-
- // stop editing
- boolean stopEdit = source.getCellEditor().stopCellEditing();
- if (!stopEdit) {
- if (log.isWarnEnabled()) {
- log.warn("Could not stop edit cell...");
- }
- canContinue = false;
- }
- }
-
- if (canContinue) {
-
- // select row (could empty selection)
- if (rowIndex == -1) {
- source.clearSelection();
- } else if (!ArrayUtils.contains(selectedRows, rowIndex)) {
- if (ListSelectionModel.MULTIPLE_INTERVAL_SELECTION == source.getSelectionMode()) {
- // add to selection
- source.addRowSelectionInterval(rowIndex, rowIndex);
- } else {
- // set selection
- source.setRowSelectionInterval(rowIndex, rowIndex);
- }
- }
-
- // select column (could empty selection)
- if (columnIndex == -1) {
- source.clearSelection();
- } else if (!ArrayUtils.contains(selectedColumns, columnIndex)) {
- source.setColumnSelectionInterval(columnIndex, columnIndex);
- }
-
- if (rightClick) {
-
- // use now model coordinate
- int modelRowIndex = source.convertRowIndexToModel(rowIndex);
- int modelColumnIndex = source.convertColumnIndexToModel(columnIndex);
-
- beforeOpenPopup(modelRowIndex, modelColumnIndex);
-
- // on right click show popup
- popup.show(source, e.getX(), e.getY());
- }
- }
- }
- }
-
protected void addHighlighters(final JXTable table) {
HighlightPredicate notSelectedPredicate = new HighlightPredicate.NotHighlightPredicate(HighlightPredicate.IS_SELECTED);
@@ -491,7 +430,7 @@
boolean result = false;
if (adapter.isEditable()) {
- AbstractTuttiTableModel model = (AbstractTuttiTableModel) table.getModel();
+ AbstractApplicationTableModel model = (AbstractApplicationTableModel) table.getModel();
int viewRow = adapter.row;
int modelRow = adapter.convertRowIndexToModel(viewRow);
AbstractTuttiBeanUIModel row = (AbstractTuttiBeanUIModel) model.getEntry(modelRow);
@@ -589,112 +528,124 @@
});
}
- public void openRowMenu(KeyEvent e, JPopupMenu popup) {
+// public void openRowMenu(KeyEvent e, JPopupMenu popup) {
+//
+// if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU) {
+//
+// JXTable source = (JXTable) e.getSource();
+//
+// // get the lowest selected row
+// int[] selectedRows = source.getSelectedRows();
+// int lowestRow = -1;
+// for (int row : selectedRows) {
+// lowestRow = Math.max(lowestRow, row);
+// }
+// // get the selected column
+// int selectedColumn = source.getSelectedColumn();
+// Rectangle r = source.getCellRect(lowestRow, selectedColumn, true);
+//
+// // get the point in the middle lower of the cell
+// Point p = new Point(r.x + r.width / 2, r.y + r.height);
+//
+// if (log.isDebugEnabled()) {
+// log.debug("Row " + lowestRow + " found t point [" + p + "]");
+// }
+//
+// boolean canContinue = true;
+//
+// if (source.isEditing()) {
+//
+// // stop editing
+// boolean stopEdit = source.getCellEditor().stopCellEditing();
+// if (!stopEdit) {
+// if (log.isWarnEnabled()) {
+// log.warn("Could not stop edit cell...");
+// }
+// canContinue = false;
+// }
+// }
+//
+// if (canContinue) {
+//
+// // use now model coordinate
+// int rowIndex = source.convertRowIndexToModel(lowestRow);
+// int columnIndex = source.convertColumnIndexToModel(selectedColumn);
+// beforeOpenPopup(rowIndex, columnIndex);
+//
+// popup.show(source, p.x, p.y);
+// }
+// }
+// }
- if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU) {
-
- JXTable source = (JXTable) e.getSource();
-
- // get the lowest selected row
- int[] selectedRows = source.getSelectedRows();
- int lowestRow = -1;
- for (int row : selectedRows) {
- lowestRow = Math.max(lowestRow, row);
- }
- // get the selected column
- int selectedColumn = source.getSelectedColumn();
- Rectangle r = source.getCellRect(lowestRow, selectedColumn, true);
-
- // get the point in the middle lower of the cell
- Point p = new Point(r.x + r.width / 2, r.y + r.height);
-
- if (log.isDebugEnabled()) {
- log.debug("Row " + lowestRow + " found t point [" + p + "]");
- }
-
- boolean canContinue = true;
-
- if (source.isEditing()) {
-
- // stop editing
- boolean stopEdit = source.getCellEditor().stopCellEditing();
- if (!stopEdit) {
- if (log.isWarnEnabled()) {
- log.warn("Could not stop edit cell...");
- }
- canContinue = false;
- }
- }
-
- if (canContinue) {
-
- // use now model coordinate
- int rowIndex = source.convertRowIndexToModel(lowestRow);
- int columnIndex = source.convertColumnIndexToModel(selectedColumn);
- beforeOpenPopup(rowIndex, columnIndex);
-
- popup.show(source, p.x, p.y);
- }
- }
- }
-
//------------------------------------------------------------------------//
//-- Init methods --//
//------------------------------------------------------------------------//
- protected void initUI(TuttiUI ui) {
- for (Map.Entry<String, Object> entry : ui.get$objectMap().entrySet()) {
- Object component = entry.getValue();
- if (component instanceof NumberEditor) {
+ @Override
+ protected void initUIComponent(Object component) {
+ if (component instanceof ButtonAttachment) {
- initNumberEditor((NumberEditor) component);
- } else if (component instanceof JXDatePicker) {
-
- initDatePicker((JXDatePicker) component);
- } else if (component instanceof SimpleTimeEditor) {
-
- initTimeEditor((SimpleTimeEditor) component);
- } else if (component instanceof ButtonAttachment) {
-
- initButtonAttachment((ButtonAttachment) component);
- } else if (component instanceof JLabel) {
-
- initLabel((JLabel) component);
- } else if (component instanceof JTextField) {
-
- initTextField((JTextField) component);
- } else if (component instanceof AbstractButton) {
-
- initButton((AbstractButton) component);
- } else if (component instanceof JScrollPane) {
-
- initScrollPane((JScrollPane) component);
- } else if (component instanceof DmsCoordinateEditor) {
-
- initCoordinateDMSEditor((DmsCoordinateEditor) component);
- } else if (component instanceof DmdCoordinateEditor) {
-
- initCoordinateDMDEditor((DmdCoordinateEditor) component);
- }
+ initButtonAttachment((ButtonAttachment) component);
+ } else {
+ super.initUIComponent(component);
}
-
- ((Component) ui).addHierarchyListener(new HierarchyListener() {
- @Override
- public void hierarchyChanged(HierarchyEvent e) {
- JComponent component = getComponentToFocus();
- if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0
- && e.getChanged().isShowing()
- && component != null) {
- component.requestFocus();
- }
- }
- });
}
- protected abstract JComponent getComponentToFocus();
+// protected void initUI(TuttiUI ui) {
+//
+// for (Map.Entry<String, Object> entry : ui.get$objectMap().entrySet()) {
+// Object component = entry.getValue();
+// if (component instanceof NumberEditor) {
+//
+// initNumberEditor((NumberEditor) component);
+// } else if (component instanceof JXDatePicker) {
+//
+// initDatePicker((JXDatePicker) component);
+// } else if (component instanceof SimpleTimeEditor) {
+//
+// initTimeEditor((SimpleTimeEditor) component);
+// } else if (component instanceof ButtonAttachment) {
+//
+// initButtonAttachment((ButtonAttachment) component);
+// } else if (component instanceof JLabel) {
+//
+// initLabel((JLabel) component);
+// } else if (component instanceof JTextField) {
+//
+// initTextField((JTextField) component);
+// } else if (component instanceof AbstractButton) {
+//
+// initButton((AbstractButton) component);
+// } else if (component instanceof JScrollPane) {
+//
+// initScrollPane((JScrollPane) component);
+// } else if (component instanceof DmsCoordinateEditor) {
+//
+// initCoordinateDMSEditor((DmsCoordinateEditor) component);
+// } else if (component instanceof DmdCoordinateEditor) {
+//
+// initCoordinateDMDEditor((DmdCoordinateEditor) component);
+// }
+// }
+//
+// ((Component) ui).addHierarchyListener(new HierarchyListener() {
+// @Override
+// public void hierarchyChanged(HierarchyEvent e) {
+// JComponent component = getComponentToFocus();
+// if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0
+// && e.getChanged().isShowing()
+// && component != null) {
+// component.requestFocus();
+// }
+// }
+// });
+// }
+// protected abstract JComponent getComponentToFocus();
+
protected void initTextField(JTextField jTextField) {
+ super.initTextField(jTextField);
Boolean computed = (Boolean) jTextField.getClientProperty("computed");
if (computed != null && computed) {
Font font = jTextField.getFont().deriveFont(Font.ITALIC);
@@ -703,23 +654,24 @@
jTextField.setEnabled(false);
jTextField.setDisabledTextColor(getConfig().getColorComputedWeights());
}
- if (isAutoSelectOnFocus(jTextField)) {
- addAutoSelectOnFocus(jTextField);
- }
+// if (isAutoSelectOnFocus(jTextField)) {
+// addAutoSelectOnFocus(jTextField);
+// }
}
protected void initLabel(JLabel jLabel) {
- Boolean strongStyle = (Boolean) jLabel.getClientProperty("strongStyle");
- Boolean italicStyle = (Boolean) jLabel.getClientProperty("italicStyle");
- Font font = jLabel.getFont();
- int style = font.getStyle();
- if (strongStyle != null && strongStyle) {
- style |= Font.BOLD;
- }
- if (italicStyle != null && italicStyle) {
- style |= Font.ITALIC;
- }
- jLabel.setFont(font.deriveFont(style));
+ super.initLabel(jLabel);
+// Boolean strongStyle = (Boolean) jLabel.getClientProperty("strongStyle");
+// Boolean italicStyle = (Boolean) jLabel.getClientProperty("italicStyle");
+// Font font = jLabel.getFont();
+// int style = font.getStyle();
+// if (strongStyle != null && strongStyle) {
+// style |= Font.BOLD;
+// }
+// if (italicStyle != null && italicStyle) {
+// style |= Font.ITALIC;
+// }
+// jLabel.setFont(font.deriveFont(style));
WeightUnit weightUnit = (WeightUnit) jLabel.getClientProperty("addWeightUnit");
if (weightUnit != null) {
@@ -750,279 +702,277 @@
component.init();
}
- protected void initButton(AbstractButton abstractButton) {
+// protected void initButton(AbstractButton abstractButton) {
+//
+// Class actionName = (Class) abstractButton.getClientProperty("tuttiAction");
+// if (actionName != null) {
+// Action action = TuttiActionHelper.createUIAction(this, abstractButton, actionName);
+// abstractButton.setAction(action);
+// }
+// }
+//
+// /**
+// * Prépare un component de choix d'entités pour un type d'entité donné et
+// * pour un service de persistance donné.
+// *
+// * @param comboBox le component graphique à initialiser
+// */
+// protected <E extends Serializable> void initBeanFilterableComboBox(
+// BeanFilterableComboBox<E> comboBox,
+// List<E> data,
+// E selectedData) {
+//
+// initBeanFilterableComboBox(comboBox, data, selectedData, null);
+// }
+//
+// protected <E extends Serializable> void initBeanFilterableComboBox(
+// BeanFilterableComboBox<E> comboBox,
+// List<E> data,
+// E selectedData,
+// String decoratorContext) {
+//
+// Preconditions.checkNotNull(comboBox, "No comboBox!");
+//
+// Class<E> beanType = comboBox.getBeanType();
+//
+// Preconditions.checkNotNull(beanType, "No beanType on the combobox!");
+//
+// Decorator<E> decorator = getDecorator(beanType, decoratorContext);
+//
+// if (data == null) {
+// data = Lists.newArrayList();
+// }
+//
+// if (log.isDebugEnabled()) {
+// log.debug("entity comboBox list [" + beanType.getName() + "] : " +
+// (data == null ? 0 : data.size()));
+// }
+//
+// comboBox.setI18nPrefix("tutti.property.");
+//
+// // add data list to combo box
+// comboBox.init((JXPathDecorator<E>) decorator, data);
+//
+// comboBox.setSelectedItem(selectedData);
+//
+// if (log.isDebugEnabled()) {
+// log.debug("combo [" + beanType.getName() + "] : " +
+// comboBox.getData().size());
+// }
+// }
- Class actionName = (Class) abstractButton.getClientProperty("tuttiAction");
- if (actionName != null) {
- Action action = TuttiActionHelper.createUIAction(this, abstractButton, actionName);
- abstractButton.setAction(action);
- }
- }
+// /**
+// * Prépare un component de choix d'entités pour un type d'entité donné et
+// * pour un service de persistance donné.
+// *
+// * @param list le component graphique à initialiser
+// * @param data la liste des données à mettre dans la liste de gauche
+// * @param selectedData la liste des données à mettre dans la liste de droite
+// */
+// protected <E extends Serializable> void initBeanList(
+// BeanDoubleList<E> list,
+// List<E> data,
+// List<E> selectedData,
+// Decorator<E> selectedDecorator) {
+//
+// Preconditions.checkNotNull(list, "No list!");
+//
+// Class<E> beanType = list.getBeanType();
+// Preconditions.checkNotNull(beanType, "No beanType on the double list!");
+//
+// Decorator<E> decorator = getDecorator(beanType, null);
+//
+// if (log.isDebugEnabled()) {
+// log.debug("entity list [" + beanType.getName() + "] : " +
+// (data == null ? 0 : data.size()));
+// }
+//
+// list.setI18nPrefix("tutti.property.");
+//
+// // add data list to combo box
+// list.init((JXPathDecorator<E>) decorator,
+// (JXPathDecorator<E>) selectedDecorator,
+// data,
+// selectedData);
+//
+// if (log.isDebugEnabled()) {
+// log.debug("Jlist [" + beanType.getName() + "] : " +
+// list.getUniverseList().getModel().getSize());
+// }
+// }
- /**
- * Prépare un component de choix d'entités pour un type d'entité donné et
- * pour un service de persistance donné.
- *
- * @param comboBox le component graphique à initialiser
- */
- protected <E extends Serializable> void initBeanFilterableComboBox(
- BeanFilterableComboBox<E> comboBox,
- List<E> data,
- E selectedData) {
+// /**
+// * Prépare un component de choix d'entités pour un type d'entité donné et
+// * pour un service de persistance donné.
+// *
+// * @param list le component graphique à initialiser
+// * @param data la liste des données à mettre dans la liste de gauche
+// * @param selectedData la liste des données à mettre dans la liste de droite
+// */
+// protected <E extends Serializable> void initBeanList(
+// BeanDoubleList<E> list,
+// List<E> data,
+// List<E> selectedData) {
+//
+// initBeanList(list, data, selectedData, null);
+// }
- initBeanFilterableComboBox(comboBox, data, selectedData, null);
- }
+// protected void initNumberEditor(NumberEditor editor) {
+// if (log.isDebugEnabled()) {
+// 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);
+// }
+//
+// if (isAutoSelectOnFocus(editor)) {
+//
+// addAutoSelectOnFocus(editor.getTextField());
+// }
+// }
- protected <E extends Serializable> void initBeanFilterableComboBox(
- BeanFilterableComboBox<E> comboBox,
- List<E> data,
- E selectedData,
- String decoratorContext) {
+// protected void initTimeEditor(SimpleTimeEditor editor) {
+// if (log.isDebugEnabled()) {
+// log.debug("init time editor " + editor.getName() +
+// " for property " + editor.getModel().getProperty());
+// }
+// editor.init();
+//
+// if (isAutoSelectOnFocus(editor)) {
+// addAutoSelectOnFocus(((JSpinner.DefaultEditor) editor.getHour().getEditor()).getTextField());
+// addAutoSelectOnFocus(((JSpinner.DefaultEditor) editor.getMinute().getEditor()).getTextField());
+// }
+// }
- Preconditions.checkNotNull(comboBox, "No comboBox!");
+// protected void initCoordinateDMSEditor(DmsCoordinateEditor editor) {
+// editor.init();
+// }
+//
+// protected void initCoordinateDMDEditor(DmdCoordinateEditor editor) {
+// editor.init();
+// }
- Class<E> beanType = comboBox.getBeanType();
+// protected void initDatePicker(final JXDatePicker picker) {
+//
+// if (log.isDebugEnabled()) {
+// log.debug("disable JXDatePicker editor" + picker.getName());
+// }
+// String dateFormat = getConfig().getDateFormat();
+// picker.setFormats(dateFormat);
+// picker.setToolTipText(_("tutti.common.datefield.tip", dateFormat));
+// picker.getEditor().addFocusListener(new FocusAdapter() {
+//
+// @Override
+// public void focusLost(FocusEvent e) {
+// try {
+// picker.commitEdit();
+//
+// } catch (ParseException ex) {
+// if (log.isDebugEnabled()) {
+// log.debug("format error", ex);
+// }
+// picker.requestFocus();
+// }
+// }
+// });
+//
+// if (isAutoSelectOnFocus(picker)) {
+// addAutoSelectOnFocus(picker.getEditor());
+// }
+// }
- Preconditions.checkNotNull(beanType, "No beanType on the combobox!");
+// protected void initScrollPane(JScrollPane scrollPane) {
+// Boolean onlyVerticalScrollable = (Boolean) scrollPane.getClientProperty("onlyVerticalScrollable");
+// if (onlyVerticalScrollable != null && onlyVerticalScrollable) {
+// scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+// scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
+//
+// final JViewport viewport = scrollPane.getViewport();
+// viewport.addChangeListener(new ChangeListener() {
+// @Override
+// public void stateChanged(ChangeEvent e) {
+// Dimension newDimension = new Dimension(viewport.getExtentSize().width,
+// viewport.getViewSize().height);
+// viewport.setViewSize(newDimension);
+// }
+// });
+// }
+// }
- Decorator<E> decorator = getDecorator(beanType, decoratorContext);
+// protected boolean isAutoSelectOnFocus(JComponent comp) {
+// Object selectOnFocus = comp.getClientProperty("selectOnFocus");
+// return selectOnFocus != null && Boolean.valueOf(selectOnFocus.toString());
+// }
- if (data == null) {
- data = Lists.newArrayList();
- }
+// protected void addAutoSelectOnFocus(JTextField jTextField) {
+// jTextField.addFocusListener(new FocusAdapter() {
+// @Override
+// public void focusGained(final FocusEvent e) {
+// SwingUtilities.invokeLater(new Runnable() {
+// @Override
+// public void run() {
+// JTextField source = (JTextField) e.getSource();
+// source.selectAll();
+// }
+// });
+//
+// }
+// });
+// }
- if (log.isDebugEnabled()) {
- log.debug("entity comboBox list [" + beanType.getName() + "] : " +
- (data == null ? 0 : data.size()));
- }
-
- comboBox.setI18nPrefix("tutti.property.");
-
- // add data list to combo box
- comboBox.init((JXPathDecorator<E>) decorator, data);
-
- comboBox.setSelectedItem(selectedData);
-
- if (log.isDebugEnabled()) {
- log.debug("combo [" + beanType.getName() + "] : " +
- comboBox.getData().size());
- }
- }
-
- /**
- * Prépare un component de choix d'entités pour un type d'entité donné et
- * pour un service de persistance donné.
- *
- * @param list le component graphique à initialiser
- * @param data la liste des données à mettre dans la liste de gauche
- * @param selectedData la liste des données à mettre dans la liste de droite
- */
- protected <E extends TuttiEntity> void initBeanList(
- BeanDoubleList<E> list,
- List<E> data,
- List<E> selectedData,
- Decorator<E> selectedDecorator) {
-
- Preconditions.checkNotNull(list, "No list!");
-
- Class<E> beanType = list.getBeanType();
- Preconditions.checkNotNull(beanType, "No beanType on the double list!");
-
- DecoratorService decoratorService =
- context.getDecoratorService();
- Decorator<E> decorator = decoratorService.getDecoratorByType(beanType);
-
- if (log.isDebugEnabled()) {
- log.debug("entity list [" + beanType.getName() + "] : " +
- (data == null ? 0 : data.size()));
- }
-
- list.setI18nPrefix("tutti.property.");
-
- // add data list to combo box
- list.init((JXPathDecorator<E>) decorator,
- (JXPathDecorator<E>) selectedDecorator,
- data,
- selectedData);
-
- if (log.isDebugEnabled()) {
- log.debug("Jlist [" + beanType.getName() + "] : " +
- list.getUniverseList().getModel().getSize());
- }
- }
-
- /**
- * Prépare un component de choix d'entités pour un type d'entité donné et
- * pour un service de persistance donné.
- *
- * @param list le component graphique à initialiser
- * @param data la liste des données à mettre dans la liste de gauche
- * @param selectedData la liste des données à mettre dans la liste de droite
- */
- protected <E extends TuttiEntity> void initBeanList(
- BeanDoubleList<E> list,
- List<E> data,
- List<E> selectedData) {
-
- initBeanList(list, data, selectedData, null);
- }
-
- protected void initNumberEditor(NumberEditor editor) {
- if (log.isDebugEnabled()) {
- 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);
- }
-
- if (isAutoSelectOnFocus(editor)) {
-
- addAutoSelectOnFocus(editor.getTextField());
- }
- }
-
- protected void initTimeEditor(SimpleTimeEditor editor) {
- if (log.isDebugEnabled()) {
- log.debug("init time editor " + editor.getName() +
- " for property " + editor.getModel().getProperty());
- }
- editor.init();
-
- if (isAutoSelectOnFocus(editor)) {
- addAutoSelectOnFocus(((JSpinner.DefaultEditor) editor.getHour().getEditor()).getTextField());
- addAutoSelectOnFocus(((JSpinner.DefaultEditor) editor.getMinute().getEditor()).getTextField());
- }
- }
-
- protected void initCoordinateDMSEditor(DmsCoordinateEditor editor) {
- editor.init();
- }
-
- protected void initCoordinateDMDEditor(DmdCoordinateEditor editor) {
- editor.init();
- }
-
- protected void initDatePicker(final JXDatePicker picker) {
-
- if (log.isDebugEnabled()) {
- log.debug("disable JXDatePicker editor" + picker.getName());
- }
- String dateFormat = getConfig().getDateFormat();
- picker.setFormats(dateFormat);
- picker.setToolTipText(_("tutti.common.datefield.tip", dateFormat));
- picker.getEditor().addFocusListener(new FocusAdapter() {
-
- @Override
- public void focusLost(FocusEvent e) {
- try {
- picker.commitEdit();
-
- } catch (ParseException ex) {
- if (log.isDebugEnabled()) {
- log.debug("format error", ex);
- }
- picker.requestFocus();
- }
- }
- });
-
- if (isAutoSelectOnFocus(picker)) {
- addAutoSelectOnFocus(picker.getEditor());
- }
- }
-
- protected void initScrollPane(JScrollPane scrollPane) {
- Boolean onlyVerticalScrollable = (Boolean) scrollPane.getClientProperty("onlyVerticalScrollable");
- if (onlyVerticalScrollable != null && onlyVerticalScrollable) {
- scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
- scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
-
- final JViewport viewport = scrollPane.getViewport();
- viewport.addChangeListener(new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- Dimension newDimension = new Dimension(viewport.getExtentSize().width,
- viewport.getViewSize().height);
- viewport.setViewSize(newDimension);
- }
- });
- }
- }
-
- protected boolean isAutoSelectOnFocus(JComponent comp) {
- Object selectOnFocus = comp.getClientProperty("selectOnFocus");
- return selectOnFocus != null && Boolean.valueOf(selectOnFocus.toString());
- }
-
- protected void addAutoSelectOnFocus(JTextField jTextField) {
- jTextField.addFocusListener(new FocusAdapter() {
- @Override
- public void focusGained(final FocusEvent e) {
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- JTextField source = (JTextField) e.getSource();
- source.selectAll();
- }
- });
-
- }
- });
- }
-
//------------------------------------------------------------------------//
//-- Internal methods --//
//------------------------------------------------------------------------//
- protected boolean quitScreen(boolean modelIsValid,
- boolean modelIsModify,
- String askGiveUpMessage,
- String askSaveMessage,
- Action saveAction) {
- boolean result;
+// protected boolean quitScreen(boolean modelIsValid,
+// boolean modelIsModify,
+// String askGiveUpMessage,
+// String askSaveMessage,
+// Action saveAction) {
+// boolean result;
+//
+// if (!modelIsValid) {
+//
+// // model is not valid
+// // ask user to qui or not
+// result = askCancelEditBeforeLeaving(askGiveUpMessage);
+//
+// } else if (modelIsModify) {
+//
+// // something is modify ask user what to do
+// int answer = askSaveBeforeLeaving(askSaveMessage);
+// switch (answer) {
+// case JOptionPane.YES_OPTION:
+//
+// // ok save
+// saveAction.actionPerformed(null);
+// result = true;
+// break;
+// case JOptionPane.NO_OPTION:
+//
+// // do not save but can still quit the screen (so nothing to do)
+// result = true;
+// break;
+// default:
+// // do not save and stay here (so nothing to do)
+// result = false;
+//
+// }
+// } else {
+//
+// // model is valid and not modify, can safely quit screen
+// result = true;
+// }
+// return result;
+// }
- if (!modelIsValid) {
-
- // model is not valid
- // ask user to qui or not
- result = askCancelEditBeforeLeaving(askGiveUpMessage);
-
- } else if (modelIsModify) {
-
- // something is modify ask user what to do
- int answer = askSaveBeforeLeaving(askSaveMessage);
- switch (answer) {
- case JOptionPane.YES_OPTION:
-
- // ok save
- saveAction.actionPerformed(null);
- result = true;
- break;
- case JOptionPane.NO_OPTION:
-
- // do not save but can still quit the screen (so nothing to do)
- result = true;
- break;
- default:
- // do not save and stay here (so nothing to do)
- result = false;
-
- }
- } else {
-
- // model is valid and not modify, can safely quit screen
- result = true;
- }
- return result;
- }
-
protected void registerValidators(SwingValidator... validators) {
- MainUI main = context.getMainUI();
+ MainUI main = getContext().getMainUI();
Preconditions.checkNotNull(
main, "No mainUI registred in application context");
MainUIHandler handler = main.getHandler();
@@ -1032,37 +982,37 @@
}
}
- protected String decorate(Object object) {
- return decorate(object, null);
- }
+// protected String decorate(Serializable object) {
+// return decorate(object, null);
+// }
+//
+// protected String decorate(Serializable object, String context) {
+// String result = "";
+// if (object != null) {
+// result = getDecorator(object.getClass(), context).toString(object);
+// }
+// return result;
+// }
+//
+// protected <O extends Serializable> ListCellRenderer newListCellRender(Class<O> type) {
+//
+// return newListCellRender(type, null);
+// }
+//
+// protected <O extends Serializable> ListCellRenderer newListCellRender(Class<O> type, String name) {
+//
+// Decorator<O> decorator = getDecorator(type, name);
+// return newListCellRender(decorator);
+// }
+//
+// protected <O> ListCellRenderer newListCellRender(Decorator<O> decorator) {
+//
+// Preconditions.checkNotNull(decorator);
+//
+// ListCellRenderer result = new DecoratorListCellRenderer(decorator);
+// return result;
+// }
- protected String decorate(Object object, String context) {
- String result = "";
- if (object != null) {
- result = getDecorator(object.getClass(), context).toString(object);
- }
- return result;
- }
-
- protected <O> ListCellRenderer newListCellRender(Class<O> type) {
-
- return newListCellRender(type, null);
- }
-
- protected <O> ListCellRenderer newListCellRender(Class<O> type, String name) {
-
- Decorator<O> decorator = getDecorator(type, name);
- return newListCellRender(decorator);
- }
-
- protected <O> ListCellRenderer newListCellRender(Decorator<O> decorator) {
-
- Preconditions.checkNotNull(decorator);
-
- ListCellRenderer result = new DecoratorListCellRenderer(decorator);
- return result;
- }
-
protected void listenValidatorValid(SimpleBeanValidator validator,
final AbstractTuttiBeanUIModel model) {
validator.addPropertyChangeListener(SimpleBeanValidator.VALID_PROPERTY, new PropertyChangeListener() {
@@ -1117,195 +1067,195 @@
ui.getHandler().onCloseUI();
}
- protected <B> void changeValidatorContext(String newContext,
- SwingValidator<B> validator) {
- B bean = validator.getBean();
- validator.setContext(newContext);
- validator.setBean(bean);
- }
+// protected <B> void changeValidatorContext(String newContext,
+// SwingValidator<B> validator) {
+// B bean = validator.getBean();
+// validator.setContext(newContext);
+// validator.setBean(bean);
+// }
- protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addColumnToModel(TableColumnModel model,
- TableCellEditor editor,
- TableCellRenderer renderer,
- ColumnIdentifier<R> identifier) {
+// protected <R> TableColumnExt addColumnToModel(TableColumnModel model,
+// TableCellEditor editor,
+// TableCellRenderer renderer,
+// ColumnIdentifier<R> identifier) {
+//
+// return addColumnToModel(model, editor, renderer, identifier, null);
+// }
- return addColumnToModel(model, editor, renderer, identifier, null);
- }
+// protected <R> TableColumnExt addColumnToModel(TableColumnModel model,
+// TableCellEditor editor,
+// TableCellRenderer renderer,
+// ColumnIdentifier<R> identifier,
+// WeightUnit weightUnit) {
+//
+// TableColumnExt col = new TableColumnExt(model.getColumnCount());
+// col.setCellEditor(editor);
+// col.setCellRenderer(renderer);
+// String label = _(identifier.getHeaderI18nKey());
+// if (weightUnit != null) {
+// label = weightUnit.decorateLabel(label);
+// }
+// col.setHeaderValue(label);
+// String tip = _(identifier.getHeaderTipI18nKey());
+// if (weightUnit != null) {
+// tip = weightUnit.decorateTip(tip);
+// }
+// col.setToolTipText(tip);
+//
+// col.setIdentifier(identifier);
+// model.addColumn(col);
+// // by default no column is sortable, must specify it
+// col.setSortable(false);
+// return col;
+// }
- protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addColumnToModel(TableColumnModel model,
- TableCellEditor editor,
- TableCellRenderer renderer,
- ColumnIdentifier<R> identifier,
- WeightUnit weightUnit) {
+// protected <R> TableColumnExt addColumnToModel(TableColumnModel model,
+// ColumnIdentifier<R> identifier) {
+//
+// return addColumnToModel(model, null, null, identifier, null);
+// }
- TableColumnExt col = new TableColumnExt(model.getColumnCount());
- col.setCellEditor(editor);
- col.setCellRenderer(renderer);
- String label = _(identifier.getHeaderI18nKey());
- if (weightUnit != null) {
- label = weightUnit.decorateLabel(label);
- }
- col.setHeaderValue(label);
- String tip = _(identifier.getHeaderTipI18nKey());
- if (weightUnit != null) {
- tip = weightUnit.decorateTip(tip);
- }
- col.setToolTipText(tip);
+// protected <R> TableColumnExt addFloatColumnToModel(TableColumnModel model,
+// ColumnIdentifier<R> identifier,
+// String numberPattern,
+// JTable table) {
+//
+// NumberCellEditor<Float> editor =
+// JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
+// editor.getNumberEditor().setSelectAllTextOnError(true);
+// editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+// editor.getNumberEditor().setNumberPattern(numberPattern);
+//
+// TableCellRenderer renderer =
+// newNumberCellRenderer(table.getDefaultRenderer(Number.class));
+//
+// return addColumnToModel(model, editor, renderer, identifier, null);
+// }
- col.setIdentifier(identifier);
- model.addColumn(col);
- // by default no column is sortable, must specify it
- col.setSortable(false);
- return col;
- }
+// protected <R> TableColumnExt addFloatColumnToModel(TableColumnModel model,
+// ColumnIdentifier<R> identifier,
+// WeightUnit weightUnit,
+// JTable table) {
+//
+// Preconditions.checkNotNull(weightUnit);
+// NumberCellEditor<Float> editor =
+// JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
+// editor.getNumberEditor().setSelectAllTextOnError(true);
+// editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+// editor.getNumberEditor().setNumberPattern(weightUnit.getNumberEditorPattern());
+//
+// TableCellRenderer renderer =
+// newNumberCellRenderer(table.getDefaultRenderer(Number.class));
+//
+// return addColumnToModel(model, editor, renderer, identifier, weightUnit);
+// }
- protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addColumnToModel(TableColumnModel model,
- ColumnIdentifier<R> identifier) {
+// protected <R> TableColumnExt addIntegerColumnToModel(TableColumnModel model,
+// ColumnIdentifier<R> identifier,
+// String numberPattern,
+// JTable table) {
+//
+// NumberCellEditor<Integer> editor =
+// JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false);
+// editor.getNumberEditor().setSelectAllTextOnError(true);
+// editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+// editor.getNumberEditor().setNumberPattern(numberPattern);
+//
+// TableCellRenderer renderer = newNumberCellRenderer(table.getDefaultRenderer(Number.class));
+// return addColumnToModel(model, editor, renderer, identifier, null);
+// }
- return addColumnToModel(model, null, null, identifier, null);
- }
- protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addFloatColumnToModel(TableColumnModel model,
- ColumnIdentifier<R> identifier,
- String numberPattern,
- JTable table) {
+// TableCellRenderer newNumberCellRenderer(final TableCellRenderer defaultRenderer) {
+// TableCellRenderer result = new TableCellRenderer() {
+// @Override
+// public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+// Component result = defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+// if (result instanceof JLabel) {
+// JLabel jLabel = (JLabel) result;
+// jLabel.setHorizontalTextPosition(SwingConstants.RIGHT);
+//
+// }
+// return result;
+// }
+// };
+// return result;
+// }
- NumberCellEditor<Float> editor =
- JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
- editor.getNumberEditor().setSelectAllTextOnError(true);
- editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
- editor.getNumberEditor().setNumberPattern(numberPattern);
- TableCellRenderer renderer =
- newNumberCellRenderer(table.getDefaultRenderer(Number.class));
+// protected <R> TableColumnExt addBooleanColumnToModel(TableColumnModel model,
+// ColumnIdentifier<R> identifier,
+// JTable table) {
+//
+// return addColumnToModel(model,
+// table.getDefaultEditor(Boolean.class),
+// table.getDefaultRenderer(Boolean.class),
+// identifier,
+// null);
+// }
- return addColumnToModel(model, editor, renderer, identifier, null);
- }
+// protected <R, B> TableColumnExt addComboDataColumnToModel(TableColumnModel model,
+// ColumnIdentifier<R> identifier,
+// Decorator<B> decorator,
+// List<B> data) {
+// JComboBox comboBox = new JComboBox();
+// comboBox.setRenderer(newListCellRender(decorator));
+//
+// List<B> dataToList = Lists.newArrayList(data);
+//
+// // add a null value at first position
+// if (!dataToList.isEmpty() && dataToList.get(0) != null) {
+// dataToList.add(0, null);
+// }
+// SwingUtil.fillComboBox(comboBox, dataToList, null);
+//
+// ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+// BeanUIUtil.decorate(comboBox, converter);
+// ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox);
+//
+// return addColumnToModel(model,
+// editor,
+// newTableCellRender(decorator),
+// identifier,
+// null);
+// }
- protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addFloatColumnToModel(TableColumnModel model,
- ColumnIdentifier<R> identifier,
- WeightUnit weightUnit,
- JTable table) {
+// protected <O extends Serializable> TableCellRenderer newTableCellRender(Class<O> type) {
+//
+// return newTableCellRender(type, null);
+// }
- Preconditions.checkNotNull(weightUnit);
- NumberCellEditor<Float> editor =
- JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
- editor.getNumberEditor().setSelectAllTextOnError(true);
- editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
- editor.getNumberEditor().setNumberPattern(weightUnit.getNumberEditorPattern());
+// protected <O extends Serializable> TableCellRenderer newTableCellRender(Class<O> type, String name) {
+//
+// Decorator<O> decorator = getDecorator(type, name);
+//
+// TableCellRenderer result = newTableCellRender(decorator);
+// return result;
+// }
- TableCellRenderer renderer =
- newNumberCellRenderer(table.getDefaultRenderer(Number.class));
+// protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) {
+//
+// Preconditions.checkNotNull(decorator);
+//
+// DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator, true);
+// return result;
+// }
- return addColumnToModel(model, editor, renderer, identifier, weightUnit);
- }
+// /**
+// * Hook to prepare popup just before showing it.
+// * <p/>
+// * The right place to update actions accessibility; a quite better design
+// * than trying to update each time something change in the table...
+// *
+// * @param rowIndex selected row index (or lowest selected one)
+// * @param columnIndex selected column index
+// * @since 2.6
+// */
+// protected void beforeOpenPopup(int rowIndex, int columnIndex) {
+//
+// }
- protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addIntegerColumnToModel(TableColumnModel model,
- ColumnIdentifier<R> identifier,
- String numberPattern,
- JTable table) {
-
- NumberCellEditor<Integer> editor =
- JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false);
- editor.getNumberEditor().setSelectAllTextOnError(true);
- editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
- editor.getNumberEditor().setNumberPattern(numberPattern);
-
- TableCellRenderer renderer = newNumberCellRenderer(table.getDefaultRenderer(Number.class));
- return addColumnToModel(model, editor, renderer, identifier, null);
- }
-
-
- TableCellRenderer newNumberCellRenderer(final TableCellRenderer defaultRenderer) {
- TableCellRenderer result = new TableCellRenderer() {
- @Override
- public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
- Component result = defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
- if (result instanceof JLabel) {
- JLabel jLabel = (JLabel) result;
- jLabel.setHorizontalTextPosition(SwingConstants.RIGHT);
-
- }
- return result;
- }
- };
- return result;
- }
-
-
- protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addBooleanColumnToModel(TableColumnModel model,
- ColumnIdentifier<R> identifier,
- JTable table) {
-
- return addColumnToModel(model,
- table.getDefaultEditor(Boolean.class),
- table.getDefaultRenderer(Boolean.class),
- identifier,
- null);
- }
-
- protected <R extends AbstractTuttiBeanUIModel, B> TableColumnExt addComboDataColumnToModel(TableColumnModel model,
- ColumnIdentifier<R> identifier,
- Decorator<B> decorator,
- List<B> data) {
- JComboBox comboBox = new JComboBox();
- comboBox.setRenderer(newListCellRender(decorator));
-
- List<B> dataToList = Lists.newArrayList(data);
-
- // add a null value at first position
- if (!dataToList.isEmpty() && dataToList.get(0) != null) {
- dataToList.add(0, null);
- }
- SwingUtil.fillComboBox(comboBox, dataToList, null);
-
- ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
- BeanUIUtil.decorate(comboBox, converter);
- ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox);
-
- return addColumnToModel(model,
- editor,
- newTableCellRender(decorator),
- identifier,
- null);
- }
-
- protected <O> TableCellRenderer newTableCellRender(Class<O> type) {
-
- return newTableCellRender(type, null);
- }
-
- protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) {
-
- Decorator<O> decorator = getDecorator(type, name);
-
- TableCellRenderer result = newTableCellRender(decorator);
- return result;
- }
-
- protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) {
-
- Preconditions.checkNotNull(decorator);
-
- DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator, true);
- return result;
- }
-
- /**
- * Hook to prepare popup just before showing it.
- * <p/>
- * The right place to update actions accessibility; a quite better design
- * than trying to update each time something change in the table...
- *
- * @param rowIndex selected row index (or lowest selected one)
- * @param columnIndex selected column index
- * @since 2.6
- */
- protected void beforeOpenPopup(int rowIndex, int columnIndex) {
-
- }
-
protected String buildReminderLabelTitle(Species species,
Iterable<SampleCategory<?>> categories,
String prefix,
@@ -1341,9 +1291,9 @@
protected void incrementsMessage(String message) {
- TuttiActionUI actionUI = context.getActionUI();
+ ApplicationActionUI actionUI = getContext().getActionUI();
if (actionUI != null) {
- ProgressionModel progressionModel = actionUI.getModel().getProgressionModel();
+ ApplicationProgressionModel progressionModel = actionUI.getModel().getProgressionModel();
if (progressionModel != null)
progressionModel.increments(message);
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/CloseableUI.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/CloseableUI.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/CloseableUI.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,42 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-/**
- * Contract to close an ui.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0.2
- */
-public interface CloseableUI {
-
- /**
- * Try to quit UI.
- *
- * @return {@code true} if ui is safe to quit, {@code false} otherwise
- * (means must stay on it).
- */
- boolean quitUI();
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiColorHighlighter.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,66 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import org.jdesktop.swingx.decorator.AbstractHighlighter;
-import org.jdesktop.swingx.decorator.ComponentAdapter;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.util.PaintUtils;
-
-import java.awt.Color;
-import java.awt.Component;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class TuttiColorHighlighter extends AbstractHighlighter {
-
- protected Color color;
-
- protected boolean foreground;
-
- public TuttiColorHighlighter(HighlightPredicate predicate, Color color, boolean foreground) {
- super(predicate);
- this.color = color;
- this.foreground = foreground;
- }
-
- @Override
- protected Component doHighlight(Component component, ComponentAdapter adapter) {
-
- if (foreground) {
- component.setForeground(color);
-
- } else {
- component.setBackground(color);
- if (adapter.isSelected()) {
- component.setForeground(PaintUtils.computeForeground(color));
- }
- }
-
- return component;
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiErrorHelper.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiErrorHelper.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiErrorHelper.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,113 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiBusinessException;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import org.jdesktop.swingx.JXErrorPane;
-import org.jdesktop.swingx.error.ErrorInfo;
-import org.jdesktop.swingx.error.ErrorReporter;
-import org.nuiton.csv.ImportRuntimeException;
-
-import javax.swing.JOptionPane;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * helper around errors in Tutti.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class TuttiErrorHelper implements ErrorReporter {
-
- protected TuttiUIContext context;
-
- public TuttiErrorHelper(TuttiUIContext context) {
- this.context = context;
- }
-
- /**
- * Display a user friendly error frame.
- *
- * @param message message for user
- * @param cause exception cause
- */
- public void showErrorDialog(String message, Throwable cause) {
-
- if (cause == null) {
- JOptionPane.showMessageDialog(context.getMainUI(), "<html><body>" + message + "</body></html>",
- _("tutti.error.ui.business.error"),
- JOptionPane.ERROR_MESSAGE);
- } else if (cause instanceof TuttiBusinessException) {
- JOptionPane.showMessageDialog(context.getMainUI(), "<html><body>" + cause.getMessage() + "</body></html>",
- _("tutti.error.ui.business.error"),
- JOptionPane.ERROR_MESSAGE);
- } else if (cause instanceof ImportRuntimeException) {
- JOptionPane.showMessageDialog(context.getMainUI(), cause.getMessage(),
- _("tutti.error.ui.business.error"),
- JOptionPane.ERROR_MESSAGE);
- } else {
-
- JXErrorPane pane = new JXErrorPane();
- ErrorInfo info = new ErrorInfo(_("tutti.error.ui.other.error"),
- _("tutti.error.errorpane.htmlmessage", message), null, null,
- cause, null, null);
- pane.setErrorInfo(info);
- pane.setErrorReporter(this);
- JXErrorPane.showDialog(context.getActionUI(), pane);
- }
-
- }
-
- /**
- * Display a user friendly error frame.
- *
- * @param message message for user
- */
- public void showErrorDialog(String message) {
- showErrorDialog(message, null);
- }
-
- @Override
- public void reportError(ErrorInfo errorInfo) throws NullPointerException {
-
- showErrorDialog(errorInfo.getBasicErrorMessage(), errorInfo.getErrorException());
- }
-
- /**
- * Display a user friendly warning frame.
- *
- * @param message message for user
- */
- public void showWarningDialog(String message) {
-
- JOptionPane.showMessageDialog(context.getMainUI(), "<html><body>" + message + "</body></html>",
- _("tutti.error.ui.business.warning"),
- JOptionPane.WARNING_MESSAGE);
-
- }
-
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiExceptionHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiExceptionHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiExceptionHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,12 +24,11 @@
* #L%
*/
-import fr.ifremer.tutti.TuttiTechnicalException;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
+import fr.ifremer.shared.application.swing.action.ApplicationActionException;
+import fr.ifremer.shared.application.swing.util.ApplicationErrorHelper;
+import fr.ifremer.shared.application.swing.util.ApplicationExceptionHandler;
import fr.ifremer.tutti.ui.swing.content.AbstractChangeScreenAction;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionException;
-import jaxx.runtime.swing.JAXXRuntimeException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -44,62 +43,48 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.0
*/
-public class TuttiExceptionHandler implements Thread.UncaughtExceptionHandler {
+public class TuttiExceptionHandler extends ApplicationExceptionHandler {
private static final Log log =
LogFactory.getLog(TuttiExceptionHandler.class);
- @Override
- public void uncaughtException(Thread t, Throwable ex) {
- handleException(t.getName(), ex);
+ public TuttiExceptionHandler(ApplicationErrorHelper errorHelper) {
+ super(errorHelper);
}
- public void handle(Throwable thrown) {
- // for EDT exceptions
- handleException(Thread.currentThread().getName(), thrown);
- }
-
+ @Override
protected void handleException(String tname, Throwable ex) {
if (log.isErrorEnabled()) {
log.error("Global application exception [" + tname + "]", ex);
}
- Throwable cause = ex;
+ Throwable cause = getCause(ex);
- if (cause instanceof TuttiTechnicalException) {
- cause = cause.getCause();
- }
-
- if (cause instanceof JAXXRuntimeException) {
- cause = cause.getCause();
- }
-
boolean backToScreen = false;
AbstractTuttiAction action = null;
- if (cause instanceof TuttiActionException) {
+ if (cause instanceof ApplicationActionException) {
- TuttiActionException actionException = (TuttiActionException) cause;
+ ApplicationActionException actionException = (ApplicationActionException) cause;
cause = cause.getCause();
if (log.isDebugEnabled()) {
log.debug("Action error cause:", cause);
}
- action = actionException.getAction();
+ action = (AbstractTuttiAction) actionException.getAction();
if (action instanceof AbstractChangeScreenAction) {
backToScreen = true;
}
}
- TuttiUIContext.getErrorHelper().showErrorDialog(cause.getMessage(), cause);
+ showErrorDialog(cause.getMessage(), cause);
if (backToScreen) {
action.getContext().setFallBackScreen();
}
}
-
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUI.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUI.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUI.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,121 +24,16 @@
* #L%
*/
-import fr.ifremer.tutti.service.WeightUnit;
-import jaxx.runtime.JAXXObject;
+import fr.ifremer.shared.application.swing.ApplicationUI;
-import javax.swing.UIManager;
-import java.awt.Font;
-
/**
* Contract to place on each generated jaxx ui.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public interface TuttiUI<M, H extends AbstractTuttiUIHandler<M, ?>> extends JAXXObject {
+public interface TuttiUI<M, H extends AbstractTuttiUIHandler<M, ?>> extends ApplicationUI<M, H> {
- M getModel();
-
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 2 digits.
- *
- * @since 0.1
- */
- public static final String INT_2_DIGITS_PATTERN = "\\d{0,2}";
-
- /**
- * Pattern to use for signed numeric values in editors with max 2 digits.
- *
- * @since 1.0
- */
- public static final String SIGNED_INT_2_DIGITS_PATTERN = "-?\\d{0,2}";
-
- /**
- * Pattern to use for short numeric values in editors with max 3 digits.
- *
- * @since 0.1
- */
- public static final String INT_3_DIGITS_PATTERN = "\\d{0,3}";
-
- /**
- * Pattern to use for singed numeric values in editors with max 3 digits.
- *
- * @since 1.0
- */
- public static final String SIGNED_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 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 0.1
- */
- public static final String INT_7_DIGITS_PATTERN = "\\d{0,7}";
-
- /**
- * Pattern to use for decimal numeric values with 1 decimal digits in
- * editors.
- *
- * @since 0.1
- */
- public static final String DECIMAL1_PATTERN = WeightUnit.G.getNumberEditorPattern();
-
- /**
- * Pattern to use for decimal numeric values with 2 decimal digits in
- * editors.
- *
- * @since 0.1
- */
- public static final String DECIMAL2_PATTERN = "\\d{0,6}(\\.\\d{0,2})?";
-
- /**
- * Pattern to use for decimal numeric values with 3 decimal digits in
- * editors.
- *
- * @since 0.1
- */
- public static final String DECIMAL3_PATTERN = "\\d{0,6}(\\.\\d{0,3})?";
-
- /**
- * Pattern to use for decimal numeric values with 4 decimal digits in
- * editors.
- *
- * @since 2.6
- */
- public static final String DECIMAL4_PATTERN = WeightUnit.KG.getNumberEditorPattern();
-
- /**
- * Pattern to use for decimal numeric values with 2 digits + 3 decimal digits in
- * editors.
- *
- * @since 1.0
- */
- public static final String DECIMAL2_DIGITS_PATTERN = "\\d{0,2}(\\.\\d*)?";
-
- public static final Font TEXTFIELD_NORMAL_FONT = UIManager.getDefaults().getFont("TextField.font");
-
- public static final Font TEXTFIELD_COMPUTED_FONT = UIManager.getDefaults().getFont("TextField.font").deriveFont(Font.ITALIC);
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiUIUtil.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,21 +25,17 @@
*/
import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
-import fr.ifremer.tutti.TuttiBusinessException;
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationBusinessException;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.shared.application.swing.util.ApplicationUIUtil;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.TuttiDecorator;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import jaxx.runtime.SwingUtil;
-import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.io.IOUtils;
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.decorator.Highlighter;
import org.jdesktop.swingx.table.TableColumnExt;
import javax.swing.ButtonGroup;
@@ -47,11 +43,8 @@
import javax.swing.JPopupMenu;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JSeparator;
-import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.JTableHeader;
-import java.awt.Color;
-import java.awt.Desktop;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -60,12 +53,8 @@
import java.io.InputStream;
import java.io.Serializable;
import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
import java.util.List;
import static org.nuiton.i18n.I18n._;
@@ -76,7 +65,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public final class TuttiUIUtil {
+public final class TuttiUIUtil extends ApplicationUIUtil {
public static final String SPECIES_DECORATOR = "decorator";
@@ -85,177 +74,147 @@
/** Logger. */
private static final Log log = LogFactory.getLog(TuttiUIUtil.class);
- public static final double EARTH_RADIUS = 6378288.0;
-
private TuttiUIUtil() {
// never instanciate util class
}
- 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 TuttiTechnicalException(_("tutti.property.set.error", property, bean.getClass().getName()), e);
- }
- }
+// 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 TuttiTechnicalException(_("tutti.property.set.error", property, 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 TuttiTechnicalException(_("tutti.property.get.error", property, 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 TuttiTechnicalException(_("tutti.property.get.error", property, 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);
+// }
- public static Highlighter newBackgroundColorHighlighter(HighlightPredicate predicate, Color color) {
- return new TuttiColorHighlighter(predicate, color, false);
- }
+ // private static DecimalFormatSymbols symbols;
+//
+// public static DecimalFormatSymbols getDecimalFormatSymbols() {
+// if (symbols == null) {
+// symbols = new DecimalFormatSymbols();
+// symbols.setDecimalSeparator('.');
+// symbols.setGroupingSeparator(' ');
+// }
+// return symbols;
+// }
+//
+// private static DecimalFormat decimalFormat;
+//
+// public static DecimalFormat getDecimalFormat(int minDecimal, int maxDecimal) {
+// if (decimalFormat == null) {
+// decimalFormat = new DecimalFormat();
+// decimalFormat.setDecimalFormatSymbols(getDecimalFormatSymbols());
+// decimalFormat.setGroupingUsed(false);
+// }
+// decimalFormat.setMinimumFractionDigits(minDecimal);
+// decimalFormat.setMaximumFractionDigits(maxDecimal);
+// return decimalFormat;
+// }
- public static Highlighter newForegroundColorHighlighter(HighlightPredicate predicate, Color color) {
- return new TuttiColorHighlighter(predicate, color, true);
- }
+// public static String getWeightStringValue(Float weight) {
+// String textValue;
+// if (weight != null) {
+// DecimalFormat weightDecimalFormat = getDecimalFormat(1, 3);
+// textValue = weightDecimalFormat.format(weight);
+//
+// } else {
+// textValue = "";
+// }
+// return textValue;
+// }
+//
+// public static void openLink(URL url) {
+// try {
+// openLink(url.toURI());
+// } catch (URISyntaxException e) {
+// throw new TuttiTechnicalException(_("application.error.cannot.open.link", url), e);
+// }
+// }
+//
+// public static Desktop getDesktopForBrowse() {
+//
+// if (!Desktop.isDesktopSupported()) {
+// throw new TuttiTechnicalException(
+// _("application.error.desktop.not.supported"));
+// }
+//
+// Desktop desktop = Desktop.getDesktop();
+//
+// if (!desktop.isSupported(Desktop.Action.BROWSE)) {
+//
+// throw new TuttiTechnicalException(
+// _("application.error.desktop.browse.not.supported"));
+// }
+//
+// return desktop;
+// }
+//
+// public static void openLink(URI uri) {
+//
+// Desktop desktop = getDesktopForBrowse();
+//
+// try {
+//
+// desktop.browse(uri);
+// } catch (Exception e) {
+//
+// throw new TuttiTechnicalException(
+// _("application.error.cannot.open.link", uri), e);
+// }
+// }
+//
+// public static Desktop getDesktopForMail() {
+//
+// if (!Desktop.isDesktopSupported()) {
+// throw new TuttiTechnicalException(
+// _("application.error.desktop.not.supported"));
+// }
+//
+// Desktop desktop = Desktop.getDesktop();
+//
+// if (!desktop.isSupported(Desktop.Action.MAIL)) {
+//
+// throw new TuttiTechnicalException(
+// _("application.error.desktop.mail.not.supported"));
+// }
+//
+// return desktop;
+// }
+//
+// public static void mail(String subject, String body) {
+//
+// Desktop desktop = getDesktopForMail();
+//
+// try {
+// URI mailtoURI = new URI("mailto", null, null, "subject=" + subject + "&body=" + body, null);
+// desktop.mail(mailtoURI);
+//
+// } catch (Exception e) {
+//
+// throw new TuttiTechnicalException(
+// _("application.error.cannot.mail"), e);
+// }
+// }
- public static int computeDistanceInMeters(Float startLatitude,
- Float startLongitude,
- Float endLatitude,
- Float endLongitude) {
-
- double sLat = startLatitude * Math.PI / 180.0;
- double sLong = startLongitude * Math.PI / 180.0;
- double eLat = endLatitude * Math.PI / 180.0;
- double eLong = endLongitude * Math.PI / 180.0;
-
- Double d = EARTH_RADIUS *
- (Math.PI / 2 - Math.asin(Math.sin(eLat) * Math.sin(sLat)
- + Math.cos(eLong - sLong) * Math.cos(eLat) * Math.cos(sLat)));
- return d.intValue();
- }
-
- public static String getDistanceInMilles(Float distance) {
- String distanceText;
- if (distance != null) {
- Float distanceInMilles = distance / 1852;
- distanceText = String.format("%.3f", distanceInMilles);
-
- } else {
- distanceText = "";
- }
- return distanceText;
- }
-
- private static DecimalFormatSymbols symbols;
-
- public static DecimalFormatSymbols getDecimalFormatSymbols() {
- if (symbols == null) {
- symbols = new DecimalFormatSymbols();
- symbols.setDecimalSeparator('.');
- symbols.setGroupingSeparator(' ');
- }
- return symbols;
- }
-
- private static DecimalFormat decimalFormat;
-
- public static DecimalFormat getDecimalFormat(int minDecimal, int maxDecimal) {
- if (decimalFormat == null) {
- decimalFormat = new DecimalFormat();
- decimalFormat.setDecimalFormatSymbols(getDecimalFormatSymbols());
- decimalFormat.setGroupingUsed(false);
- }
- decimalFormat.setMinimumFractionDigits(minDecimal);
- decimalFormat.setMaximumFractionDigits(maxDecimal);
- return decimalFormat;
- }
-
- public static String getWeightStringValue(Float weight) {
- String textValue;
- if (weight != null) {
- DecimalFormat weightDecimalFormat = getDecimalFormat(1, 3);
- textValue = weightDecimalFormat.format(weight);
-
- } else {
- textValue = "";
- }
- return textValue;
- }
-
- public static void openLink(URL url) {
- try {
- openLink(url.toURI());
- } catch (URISyntaxException e) {
- throw new TuttiTechnicalException(_("swing.error.cannot.open.link", url), e);
- }
- }
-
- public static Desktop getDesktopForBrowse() {
-
- if (!Desktop.isDesktopSupported()) {
- throw new TuttiTechnicalException(
- _("swing.error.desktop.not.supported"));
- }
-
- Desktop desktop = Desktop.getDesktop();
-
- if (!desktop.isSupported(Desktop.Action.BROWSE)) {
-
- throw new TuttiTechnicalException(
- _("swing.error.desktop.browse.not.supported"));
- }
-
- return desktop;
- }
-
- public static void openLink(URI uri) {
-
- Desktop desktop = getDesktopForBrowse();
-
- try {
-
- desktop.browse(uri);
- } catch (Exception e) {
-
- throw new TuttiTechnicalException(
- _("swing.error.cannot.open.link", uri), e);
- }
- }
-
- public static Desktop getDesktopForMail() {
-
- if (!Desktop.isDesktopSupported()) {
- throw new TuttiTechnicalException(
- _("swing.error.desktop.not.supported"));
- }
-
- Desktop desktop = Desktop.getDesktop();
-
- if (!desktop.isSupported(Desktop.Action.MAIL)) {
-
- throw new TuttiTechnicalException(
- _("swing.error.desktop.mail.not.supported"));
- }
-
- return desktop;
- }
-
- public static void mail(String subject, String body) {
-
- Desktop desktop = getDesktopForMail();
-
- try {
- URI mailtoURI = new URI("mailto", null, null, "subject=" + subject + "&body=" + body, null);
- desktop.mail(mailtoURI);
-
- } catch (Exception e) {
-
- throw new TuttiTechnicalException(
- _("swing.error.cannot.mail"), e);
- }
- }
-
public static void tryToConnectToUpdateUrl(String urlAsString,
String badUrlFormatI18nKey,
String notReachI18nKey,
@@ -268,7 +227,7 @@
if (log.isDebugEnabled()) {
log.debug("Bad url syntax at " + urlAsString, e);
}
- throw new TuttiBusinessException(_(badUrlFormatI18nKey, urlAsString));
+ throw new ApplicationBusinessException(_(badUrlFormatI18nKey, urlAsString));
}
URLConnection urlConnection;
@@ -281,7 +240,7 @@
if (log.isDebugEnabled()) {
log.debug("Could not connect to " + urlAsString, e);
}
- throw new TuttiBusinessException(_(notReachI18nKey, urlAsString));
+ throw new ApplicationBusinessException(_(notReachI18nKey, urlAsString));
}
// try to open the resource (fail if resources does not exist)
@@ -297,25 +256,19 @@
if (log.isDebugEnabled()) {
log.debug("Could not found file at to " + urlAsString, e);
}
- throw new TuttiBusinessException(_(notFoundI18nKey, urlAsString));
+ throw new ApplicationBusinessException(_(notFoundI18nKey, urlAsString));
}
}
- public static float getRoundedLengthStep(float lengthStep, boolean aroundUp) {
- int intValue = (int) ((lengthStep + (aroundUp ? 0.001f : 0f)) * 10);
- float result = intValue / 10f;
- return result;
- }
-
public static <E> TuttiDecorator<E> getSpeciesColumnDecorator(TableColumnExt tableColumn) {
TuttiDecorator<E> decorator = (TuttiDecorator<E>)
tableColumn.getClientProperty(SPECIES_DECORATOR);
return decorator;
}
- public static <R extends Serializable, T extends AbstractTuttiTableModel<R>> void installSpeciesColumnComparatorPopup(JXTable table,
- TableColumnExt speciesColumn,
- String... tips) {
+ public static <R extends Serializable, T extends AbstractApplicationTableModel<R>> void installSpeciesColumnComparatorPopup(JXTable table,
+ TableColumnExt speciesColumn,
+ String... tips) {
ButtonGroup buttonGroup = new ButtonGroup();
@@ -354,83 +307,83 @@
}
- public static void selectFirstCellOnFirstRowAndStopEditing(JXTable table) {
+// public static void selectFirstCellOnFirstRowAndStopEditing(JXTable table) {
+//
+// // select first cell
+// doSelectCell(table, 0, 0);
+//
+// if (table.isEditing()) {
+//
+// // but no edit it
+// table.getCellEditor().stopCellEditing();
+// }
+// }
+//
+// public static void selectFirstCellOnLastRow(JXTable table) {
+//
+// // select first cell
+// doSelectCell(table, table.getRowCount() - 1, 0);
+// }
+//
+// public static void selectFirstCellOnRow(JXTable table, int row, boolean stopEdit) {
+//
+// // select first cell
+// doSelectCell(table, row, 0);
+//
+// if (stopEdit && table.isEditing()) {
+//
+// table.getCellEditor().stopCellEditing();
+// }
+// }
- // select first cell
- doSelectCell(table, 0, 0);
+// public static void doSelectCell(JTable table,
+// int rowIndex,
+// int columnIndex) {
+//
+// int rowCount = table.getRowCount();
+// if (rowCount == 0) {
+//
+// // no row, can not selected any cell
+// if (log.isWarnEnabled()) {
+// log.warn("No row in table, can not select any cell");
+// }
+// return;
+// }
+// int columnCount = table.getColumnCount();
+// if (columnCount == 0) {
+//
+// // no column, can not selected any cell
+// if (log.isWarnEnabled()) {
+// log.warn("No column in table, can not select any cell");
+// }
+// return;
+// }
+// if (columnIndex > columnCount) {
+// if (log.isWarnEnabled()) {
+// log.warn(String.format("ColumnIndex: %s is more than columnCount %s", columnIndex, columnCount));
+// }
+// columnIndex = columnCount - 1;
+// }
+// if (columnIndex < 0) {
+// columnIndex = 0;
+// }
+// if (rowIndex >= rowCount) {
+// if (log.isWarnEnabled()) {
+// log.warn(String.format("RowIndex: %s is more than rowCount %s", rowIndex, rowCount));
+// }
+// rowIndex = rowCount - 1;
+// }
+// if (rowIndex < 0) {
+// rowIndex = 0;
+// }
+//
+// table.setColumnSelectionInterval(columnIndex, columnIndex);
+// table.setRowSelectionInterval(rowIndex, rowIndex);
+// table.editCellAt(rowIndex, columnIndex);
+// }
- if (table.isEditing()) {
+ protected static class SpeciesDecoratorListener<R extends Serializable, T extends AbstractApplicationTableModel<R>> implements ActionListener {
- // but no edit it
- table.getCellEditor().stopCellEditing();
- }
- }
-
- public static void selectFirstCellOnLastRow(JXTable table) {
-
- // select first cell
- doSelectCell(table, table.getRowCount() - 1, 0);
- }
-
- public static void selectFirstCellOnRow(JXTable table, int row, boolean stopEdit) {
-
- // select first cell
- doSelectCell(table, row, 0);
-
- if (stopEdit && table.isEditing()) {
-
- table.getCellEditor().stopCellEditing();
- }
- }
-
- public static void doSelectCell(JTable table,
- int rowIndex,
- int columnIndex) {
-
- int rowCount = table.getRowCount();
- if (rowCount == 0) {
-
- // no row, can not selected any cell
- if (log.isWarnEnabled()) {
- log.warn("No row in table, can not select any cell");
- }
- return;
- }
- int columnCount = table.getColumnCount();
- if (columnCount == 0) {
-
- // no column, can not selected any cell
- if (log.isWarnEnabled()) {
- log.warn("No column in table, can not select any cell");
- }
- return;
- }
- if (columnIndex > columnCount) {
- if (log.isWarnEnabled()) {
- log.warn(String.format("ColumnIndex: %s is more than columnCount %s", columnIndex, columnCount));
- }
- columnIndex = columnCount - 1;
- }
- if (columnIndex < 0) {
- columnIndex = 0;
- }
- if (rowIndex >= rowCount) {
- if (log.isWarnEnabled()) {
- log.warn(String.format("RowIndex: %s is more than rowCount %s", rowIndex, rowCount));
- }
- rowIndex = rowCount - 1;
- }
- if (rowIndex < 0) {
- rowIndex = 0;
- }
-
- table.setColumnSelectionInterval(columnIndex, columnIndex);
- table.setRowSelectionInterval(rowIndex, rowIndex);
- table.editCellAt(rowIndex, columnIndex);
- }
-
- protected static class SpeciesDecoratorListener<R extends Serializable, T extends AbstractTuttiTableModel<R>> implements ActionListener {
-
protected final JXTable table;
protected final ButtonGroup buttonGroup;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/AbstractTuttiAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/AbstractTuttiAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/AbstractTuttiAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,27 +24,20 @@
* #L%
*/
-import com.google.common.base.Preconditions;
+import fr.ifremer.shared.application.swing.action.AbstractApplicationAction;
+import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.service.TuttiDataContext;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import jaxx.runtime.FileChooserUtil;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jdesktop.beans.AbstractBean;
-import org.nuiton.decorator.Decorator;
import org.nuiton.util.StringUtil;
import javax.swing.JOptionPane;
import java.awt.Component;
-import java.io.File;
-import static org.nuiton.i18n.I18n._;
-
/**
* Tutti base action.
*
@@ -52,108 +45,56 @@
* @since 1.0
*/
public abstract class AbstractTuttiAction<M extends AbstractBean, UI extends TuttiUI<M, ?>, H extends AbstractTuttiUIHandler<M, UI>>
- extends AbstractBean {
+ extends AbstractApplicationAction<M, UI, H> {
- /** Logger. */
- private static final Log log = LogFactory.getLog(AbstractTuttiAction.class);
-
- public static final String PROPERTY_DONE = "done";
-
- protected final H handler;
-
- protected String actionDescription;
-
- protected final boolean hideBody;
-
- protected final Object lock = new Object();
-
public abstract void doAction() throws Exception;
protected AbstractTuttiAction(H handler, boolean hideBody) {
- this.handler = handler;
- this.hideBody = hideBody;
+ super(handler, hideBody);
}
- public boolean prepareAction() throws Exception {
- // by default nothing to prepare
- return true;
- }
-
- protected void releaseAction() {
- // by default nothing to clean
- firePropertyChange(PROPERTY_DONE, null, true);
- }
-
- public void postSuccessAction() {
- // by default nothing to do after action
- }
-
- public void postFailedAction(Throwable error) {
- // by default nothing to do after action
- }
-
- public H getHandler() {
- return handler;
- }
-
- public M getModel() {
- return handler.getModel();
- }
-
- public final UI getUI() {
- return handler.getUI();
- }
-
+ @Override
public TuttiUIContext getContext() {
return handler.getContext();
}
- public String getActionDescription() {
- return actionDescription;
- }
-
- public void setActionDescription(String actionDescription) {
- this.actionDescription = actionDescription;
- }
-
public void setProgressionModel(ProgressionModel progressionModel) {
- getContext().getActionUI().getModel().setProgressionModel(progressionModel);
+ super.setProgressionModel(progressionModel);
}
+ @Override
protected ProgressionModel getProgressionModel() {
- return getContext().getActionUI().getModel().getProgressionModel();
+ return (ProgressionModel) getContext().getActionUI().getModel().getProgressionModel();
}
- public boolean isHideBody() {
- return hideBody;
- }
-
public TuttiDataContext getDataContext() {
return getContext().getDataContext();
}
- protected TuttiApplicationConfig getConfig() {
+ @Override
+ protected TuttiConfiguration getConfig() {
return getContext().getConfig();
}
+ @Override
protected void sendMessage(String message) {
getContext().showInformationMessage(message);
}
- protected <O> Decorator<O> getDecorator(Class<O> type, String name) {
- Decorator<O> decorator = handler.getDecorator(type, name);
- Preconditions.checkNotNull(decorator);
- return decorator;
+ @Override
+ protected void createProgressionModelIfRequired(int total) {
+ ProgressionModel progressionModel = getProgressionModel();
+ if (progressionModel == null) {
+ progressionModel = new ProgressionModel();
+ progressionModel.setTotal(total);
+ progressionModel.setMessage("");
+ progressionModel.setCurrent(0);
+ setProgressionModel(progressionModel);
+ } else {
+ progressionModel.adaptTotal(total);
+ }
}
- protected String decorate(Object object) {
- return getDecorator(object.getClass(), null).toString(object);
- }
-
- protected String decorate(Object object, String context) {
- return getDecorator(object.getClass(), context).toString(object);
- }
-
protected boolean askAdminPassword(String askMessage,
String askMessageTitle,
String errorMessage,
@@ -187,175 +128,4 @@
} while (!result && answer != null);
return result;
}
-
- /**
- * Choisir un fichier via un sélecteur graphique de fichiers.
- *
- * @param title le titre du dialogue de sélection
- * @param buttonLabel le label du boutton d'acceptation
- * @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
- */
- protected File chooseFile(String title,
- String buttonLabel,
- String... filters) {
-
- File file = FileChooserUtil.getFile(title,
- buttonLabel,
- getContext().getMainUI(),
- filters);
- if (log.isDebugEnabled()) {
- log.debug(title + " : " + file);
- }
- if (file != null) {
- File newDir = file.isDirectory() ? file : file.getParentFile();
- FileChooserUtil.setCurrentDirectory(newDir);
- }
- return file;
- }
-
- /**
- * Sauver un fichier via un sélecteur graphique de fichiers.
- *
- * @param title le titre du dialogue de sélection
- * @param buttonLabel le label du boutton d'acceptation
- * @param filters les filtres + descriptions sur le sélecteur de
- * fichiers
- * @return le fichier choisi ou {@code null} si pas de fichier choisi ou
- * pas voulu écrasé un fichier existant.
- */
- protected File saveFile(File defaultFile,
- String filename,
- String extension,
- String title,
- String buttonLabel,
- String... filters) {
-
- if (defaultFile != null && FileChooserUtil.isCurrentDirectoryDefault()) {
-
- // set default directory to this one
- FileChooserUtil.setCurrentDirectory(defaultFile);
- }
- File file = saveFile(filename, extension, title, buttonLabel, filters);
- return file;
- }
-
- /**
- * Sauver un fichier via un sélecteur graphique de fichiers.
- *
- * @param title le titre du dialogue de sélection
- * @param buttonLabel le label du boutton d'acceptation
- * @param filters les filtres + descriptions sur le sélecteur de
- * fichiers
- * @return le fichier choisi ou {@code null} si pas de fichier choisi ou
- * pas voulu écrasé un fichier existant.
- */
- protected File saveFile(String filename,
- String extension,
- String title,
- String buttonLabel,
- String... filters) {
-
- boolean withExtension = StringUtils.isNotBlank(extension);
- String filenameSuffix = withExtension ? "." + extension : "";
- File file = FileChooserUtil.saveFile(filename + filenameSuffix, title, buttonLabel, getContext().getMainUI(), filters);
- if (log.isDebugEnabled()) {
- log.debug(title + " : " + file);
- }
- if (file != null) {
- Preconditions.checkState(!file.isDirectory());
-
- // add extension if missing
- if (withExtension && !file.getName().endsWith(filenameSuffix)) {
- file = new File(file.getParentFile(), file.getName() + filenameSuffix);
- }
-
- // ask user to confirm overwrite.
- boolean confirm = askOverwriteFile(file);
-
- if (confirm) {
-
- // on conserve le répertoire (pour une prochaine utilisation)
- FileChooserUtil.setCurrentDirectory(file.getParentFile());
- } else {
-
- // l'utilisateur n'a pas confirmé l'écrasement
- // donc pas de fichier en retour
- file = null;
- }
- }
-
- return file;
- }
-
- protected boolean askOverwriteFile(File file) {
- boolean result;
- if (file.exists()) {
-
- // file exists ask user to overwrite
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- _("tutti.common.askOverwriteFile.message", file),
- _("tutti.common.askOverwriteFile.help"));
-
- result = JOptionPane.showConfirmDialog(
- getHandler().getTopestUI(),
- htmlMessage,
- _("tutti.common.askOverwriteFile.title"),
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
- } else {
-
- // file does not exist
- result = true;
- }
- return result;
- }
-
- protected boolean askBeforeDelete(String title, String message) {
- String htmlMessage = String.format(
- AbstractTuttiUIHandler.CONFIRMATION_FORMAT,
- message,
- _("tutti.common.askBeforeDelete.help"));
- int i = JOptionPane.showConfirmDialog(
- getHandler().getTopestUI(),
- htmlMessage,
- title,
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE);
-
- boolean result = i == JOptionPane.OK_OPTION;
- return result;
- }
-
- protected void displayInfoMessage(String title, String message) {
- JOptionPane.showMessageDialog(
- getHandler().getTopestUI(),
- message,
- title,
- JOptionPane.INFORMATION_MESSAGE);
- }
-
- protected void displayWarningMessage(String title, String message) {
- JOptionPane.showMessageDialog(
- getHandler().getTopestUI(),
- message,
- title,
- JOptionPane.WARNING_MESSAGE);
- }
-
- protected void createProgressionModelIfRequired(int total) {
- ProgressionModel progressionModel = getProgressionModel();
- if (progressionModel==null) {
- progressionModel = new ProgressionModel();
- progressionModel.setTotal(total);
- progressionModel.setMessage("");
- progressionModel.setCurrent(0);
- setProgressionModel(progressionModel);
- } else {
- progressionModel.adaptTotal(total);
- }
- }
}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionException.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionException.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionException.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,58 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util.action;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-/**
- * To boxe any error of a {@link AbstractTuttiAction}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.1
- */
-public class TuttiActionException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- private final AbstractTuttiAction action;
-
- public TuttiActionException(AbstractTuttiAction action, Throwable cause) {
- super(cause);
- this.action = action;
- }
-
- public static TuttiActionException propagateError(AbstractTuttiAction action,
- Throwable cause) {
- TuttiActionException result;
- if (cause instanceof TuttiActionException) {
- result = ((TuttiActionException) cause);
- } else {
- result = new TuttiActionException(action, cause);
- }
- return result;
- }
-
- public AbstractTuttiAction getAction() {
- return action;
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionHelper.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionHelper.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionHelper.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,158 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util.action;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.TuttiTechnicalException;
-import fr.ifremer.tutti.ui.swing.content.AbstractMainUITuttiAction;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import org.apache.commons.lang3.reflect.ConstructorUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.AbstractButton;
-import javax.swing.Action;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * Useful method around TuttiUIAction.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.2
- */
-public class TuttiActionHelper {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(TuttiActionHelper.class);
-
- public static <A extends AbstractTuttiAction> void runInternalAction(A action) {
- Throwable error = null;
-
- try {
- action.doAction();
- action.postSuccessAction();
- } catch (Throwable e) {
- error = e;
- if (log.isErrorEnabled()) {
- log.error("Error in action:", e);
- }
- throw TuttiActionException.propagateError(action, e);
- } finally {
- try {
- if (error != null) {
- action.postFailedAction(error);
- }
- } finally {
-
- action.releaseAction();
- }
- }
- }
-
- public static <A extends AbstractTuttiAction> void runInternalAction(AbstractTuttiUIHandler handler,
- Class<A> actionName) {
- A action = createLogicAction(handler, actionName);
- runInternalAction(action);
- }
-
- public static <A extends AbstractTuttiAction> void runAction(A action) {
- TuttiUIAction<A> uiAction = createUIAction(null, action);
- uiAction.actionPerformed(null);
- }
-
- public static void runAction(AbstractButton button) {
- button.getAction().actionPerformed(null);
- }
-
- public static <A extends AbstractTuttiAction> void runActionAndWait(A action) {
- TuttiUIAction<A> uiAction = createUIAction(null, action);
- uiAction.launchActionAndWait();
- }
-
- public static <A extends AbstractTuttiAction> void runActionAndWait(AbstractTuttiUIHandler handler,
- Class<A> actionName) {
- A logicAction = createLogicAction(handler, actionName);
- runActionAndWait(logicAction);
- }
-
- public static <A extends AbstractTuttiAction> TuttiUIAction<A> createUIAction(AbstractTuttiUIHandler handler,
- Class<A> actionName) {
- return createUIAction(handler, null, actionName);
- }
-
-
- public static <A extends AbstractTuttiAction> TuttiUIAction<A> createUIAction(AbstractTuttiUIHandler handler,
- AbstractButton abstractButton,
- Class<A> actionName) {
- try {
-
- // create logic action
- A logicAction = createLogicAction(handler, actionName);
-
- // create ui action
- TuttiUIAction<A> result = createUIAction(abstractButton, logicAction);
- return result;
- } catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.action.create.error", actionName), e);
- }
-
- }
-
- public static <A extends AbstractTuttiAction> TuttiUIAction<A> createUIAction(AbstractButton abstractButton,
- A logicAction) {
-
- // create ui action
- TuttiUIAction<A> result = new TuttiUIAction<A>(abstractButton,
- logicAction);
- return result;
-
-
- }
-
- public static <A extends AbstractTuttiAction> A createLogicAction(AbstractTuttiUIHandler handler,
- Class<A> actionName) {
- try {
-
- if (AbstractMainUITuttiAction.class.isAssignableFrom(actionName) &&
- handler.getContext().getMainUI() != null) {
- handler = handler.getContext().getMainUI().getHandler();
- }
-
- // create action
- A result = ConstructorUtils.invokeConstructor(actionName, handler);
- return result;
- } catch (Exception e) {
- throw new TuttiTechnicalException(_("tutti.action.create.error", actionName), e);
- }
- }
-
- public static <A extends AbstractTuttiAction> A getLogicAction(AbstractButton b) {
- Action action = b.getAction();
- Preconditions.checkNotNull(action);
- Preconditions.checkState(action instanceof TuttiUIAction);
- return ((TuttiUIAction<A>) action).getLogicAction();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionSwingWorker.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionSwingWorker.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionSwingWorker.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,186 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util.action;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.SwingUtilities;
-import javax.swing.SwingWorker;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Timer;
-import java.util.TimerTask;
-
-/**
- * Worker to execute logic action.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0.3
- */
-public class TuttiActionSwingWorker<A extends AbstractTuttiAction> extends SwingWorker<Void, String> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(TuttiActionSwingWorker.class);
-
- /**
- * Timer used to launch timerTask (to open load dialog).
- *
- * @since 1.0.2
- */
- private static final Timer t = new Timer();
-
- protected final TuttiActionUI actionUI;
-
- protected final A action;
-
- protected Throwable error;
-
- protected TimerTask timer;
-
- protected TuttiActionSwingWorker(A action) {
-
- this.action = action;
- this.actionUI = action.getContext().getActionUI();
- }
-
- public Throwable getError() {
- return error;
- }
-
- public boolean isFailed() {
- return error != null;
- }
-
- @Override
- protected Void doInBackground() throws Exception {
-
- if (!isCancelled()) {
-
- timer = new TuttiActionTimerTask();
-
- t.schedule(timer, 1000);
-
- try {
-
- action.doAction();
-
- } catch (Throwable e) {
- if (log.isErrorEnabled()) {
- log.error("Task [" + this + "] Error while doAction: ", e);
- }
- error = e;
- } finally {
- if (log.isDebugEnabled()) {
- log.debug("Task [" + this + "] done");
- }
- }
- }
- return null;
- }
-
- @Override
- protected void done() {
- super.done();
-
- if (log.isDebugEnabled()) {
- log.debug("Task [" + this + "] execute done method after all");
- }
-
- if (error == null) {
-
- // success hook
- action.postSuccessAction();
- } else {
-
- // fail hook
- action.postFailedAction(error);
- }
-
- action.releaseAction();
-
- if (timer != null) {
-
- timer.cancel();
- }
-
- actionUI.close();
-
- updateBusyState(false);
- }
-
- protected void updateBusyState(boolean busy) {
-
- boolean hideBody = action.isHideBody();
-
- action.getContext().setBusy(busy);
-
- if (hideBody) {
- action.getContext().setHideBody(!busy);
- }
-
- }
-
- protected class TuttiActionTimerTask extends TimerTask {
-
- public TuttiActionTimerTask() {
- action.addPropertyChangeListener(AbstractTuttiAction.PROPERTY_DONE, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
-
- if (actionUI.isVisible()) {
- actionUI.close();
- }
-
- // we do NOT want the timer to wake up then the actionUI dialog
- cancel();
- }
- });
- }
-
- @Override
- public void run() {
- if (isCancelled() || isDone()) {
-
- if (log.isDebugEnabled()) {
- log.debug("Task [" + action + "] was already canceled or done, do nothing");
- }
- } else {
-
- if (log.isDebugEnabled()) {
- log.debug("Task [" + action + "] is started, show waiting dialog");
- }
-
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- actionUI.open(action);
- }
- });
- }
- }
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUI.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUI.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUI.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,68 +0,0 @@
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-#busyBlockLayerUI {
- useIcon:false;
- blockingColor: {handler.getConfig().getColorBlockingLayer()};
- block:{true};
-}
-
-#globalPanel {
- border: {new TitledBorder((String) null)};
-}
-
-#globalActionLabel {
- border: {new EmptyBorder(5, 5, 5, 5)};
-}
-
-#globalProgressBar {
- indeterminate: true;
-}
-
-#taskPanel {
- visible: false;
- border: {new TitledBorder((String) null)};
-}
-
-#taskProgressBar {
- indeterminate: false;
-}
-
-#taskActionLabel {
- border: {new EmptyBorder(5, 5, 5, 5)};
-}
-
-#informationPanel {
- visible: false;
- border: {new TitledBorder((String) null)};
-}
-
-#informationLabel {
- border: {new EmptyBorder(5, 5, 5, 5)};
-}
-
-#okAction {
- actionIcon: information;
- text: "tutti.action.ok";
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUI.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUI.jaxx 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUI.jaxx 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,82 +0,0 @@
-<!--
- #%L
- Tutti :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 - 2013 Ifremer
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-<JDialog width='300' height='200' modal='true'
- undecorated='true'
- implements='fr.ifremer.tutti.ui.swing.util.TuttiUI<TuttiActionUIModel, TuttiActionUIHandler>'>
- <import>
-
- fr.ifremer.tutti.ui.swing.util.TuttiUI
- fr.ifremer.tutti.ui.swing.TuttiUIContext
-
- jaxx.runtime.swing.BlockingLayerUI
-
- javax.swing.border.EmptyBorder
- </import>
-
- <script><![CDATA[
-
- public TuttiActionUI(JFrame frame, TuttiUIContext context) {
- super(frame, true);
- TuttiActionUIHandler handler = new TuttiActionUIHandler(context, this);
- setContextValue(handler);
- handler.beforeInitUI();
- }
-
- public void open(AbstractTuttiAction action) {
- getModel().setAction(action);
- }
-
- public void close() {
- getModel().clear();
- }
-
- protected void $afterCompleteSetup() {
- handler.afterInitUI();
- }
- ]]></script>
-
-
- <BlockingLayerUI id='busyBlockLayerUI'/>
-
- <TuttiActionUIHandler id='handler'
- initializer='getContextValue(TuttiActionUIHandler.class)'/>
-
- <TuttiActionUIModel id='model'
- initializer='getContextValue(TuttiActionUIModel.class)'/>
-
- <JPanel id='rootPanel' layout='{new BorderLayout()}'
- constraints='BorderLayout.CENTER' decorator='boxed'>
- <JPanel id='globalPanel' constraints='BorderLayout.NORTH'
- layout='{new BorderLayout()}'>
- <JLabel id='globalActionLabel' constraints='BorderLayout.CENTER'/>
- <JProgressBar id='globalProgressBar' constraints='BorderLayout.SOUTH'/>
- </JPanel>
- <JPanel id='taskPanel' constraints='BorderLayout.CENTER'
- layout='{new BorderLayout()}'>
- <JLabel id='taskActionLabel' constraints='BorderLayout.CENTER'/>
- <JProgressBar id='taskProgressBar' constraints='BorderLayout.SOUTH'/>
- </JPanel>
- </JPanel>
-
-</JDialog>
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,275 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util.action;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import fr.ifremer.tutti.ui.swing.content.MainUI;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.StatusMessagePanel;
-import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JComponent;
-import java.awt.Container;
-import java.awt.Cursor;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import static org.nuiton.i18n.I18n._;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class TuttiActionUIHandler extends AbstractTuttiUIHandler<TuttiActionUIModel, TuttiActionUI> {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(TuttiActionUIHandler.class);
-
- public TuttiActionUIHandler(TuttiUIContext context, TuttiActionUI ui) {
- super(context, ui);
- }
-
- protected PropertyChangeListener progressionListener = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
-
- String propertyName = evt.getPropertyName();
- if (ProgressionModel.PROPERTY_MESSAGE.equals(propertyName)) {
-
- // change message
- String newMessage = (String) evt.getNewValue();
- ui.getTaskActionLabel().setText("<html><body>" + newMessage + "</body></html>");
- ui.pack();
- } else if (ProgressionModel.PROPERTY_TOTAL.equals(propertyName)) {
-
- // change total progressbar max
- ui.getTaskProgressBar().setMaximum((Integer) evt.getNewValue());
-
- } else if (ProgressionModel.PROPERTY_CURRENT.equals(propertyName)) {
-
- // change value of progress bar
- ui.getTaskProgressBar().setValue((Integer) evt.getNewValue());
- }
- }
- };
-
- protected ComponentListener listener = new ComponentAdapter() {
- boolean moving;
-
- boolean resizing;
-
- @Override
- public void componentMoved(ComponentEvent e) {
-
- MainUI mainUI = (MainUI) e.getSource();
-
- if (!moving && mainUI.isShowing()) {
-
- moving = true;
- try {
- setLocation(mainUI);
- } finally {
- moving = false;
- }
- }
- }
-
- @Override
- public void componentResized(ComponentEvent e) {
-
- MainUI mainUI = (MainUI) e.getSource();
-
- if (!resizing && mainUI.isShowing()) {
-
- resizing = true;
- try {
- setSize(mainUI);
- } finally {
- resizing = false;
- }
- }
- }
- };
-
- //------------------------------------------------------------------------//
- //-- AbstractTuttiUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- public void beforeInitUI() {
- TuttiActionUIModel model = new TuttiActionUIModel();
- ui.setContextValue(model);
-
- model.addPropertyChangeListener(TuttiActionUIModel.PROPERTY_ACTION, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
-
- // udpate global label
- AbstractTuttiAction action = (AbstractTuttiAction) evt.getNewValue();
-
- if (log.isDebugEnabled()) {
- log.debug("Action to use: " + action);
- }
- if (action == null) {
-
- // stoping action
- hideAction();
- } else {
-
- // starting action
- showAction(action);
- }
- }
- });
-
- model.addPropertyChangeListener(TuttiActionUIModel.PROPERTY_PROGRESSION_MODEL, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
-
- // change progression model
-
- ProgressionModel oldValue = (ProgressionModel) evt.getOldValue();
- ProgressionModel newValue = (ProgressionModel) evt.getNewValue();
-
- if (log.isDebugEnabled()) {
- log.debug("progression model: " + newValue);
- }
- if (oldValue != null) {
- oldValue.removePropertyChangeListener(progressionListener);
- }
-
- if (newValue == null) {
-
- // remove progression model
- ui.getTaskPanel().setVisible(false);
- } else {
-
- // use progression model
- ui.getTaskPanel().setVisible(true);
-
- newValue.addPropertyChangeListener(progressionListener);
- }
- }
- });
- }
-
- @Override
- public void afterInitUI() {
-
- initUI(ui);
-
- // installation layer de blocage en mode busy
- SwingUtil.setLayerUI(ui.getRootPanel(), ui.getBusyBlockLayerUI());
-
- ui.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- }
-
- @Override
- protected JComponent getComponentToFocus() {
- return null;
- }
-
- @Override
- public void onCloseUI() {
-
- }
-
- @Override
- public SwingValidator<TuttiActionUIModel> getValidator() {
- return null;
- }
-
- //------------------------------------------------------------------------//
- //-- Internal methods --//
- //------------------------------------------------------------------------//
-
- protected void hideAction() {
- ui.setVisible(false);
- }
-
- protected void showAction(AbstractTuttiAction action) {
- ui.setTitle(_("tutti.main.title.action",
- getConfig().getVersion(),
- action.getActionDescription()));
- ui.getGlobalActionLabel().setText(
- _("tutti.message.action.running",
- action.getActionDescription()));
- ui.pack();
-
- MainUI mainUI = getContext().getMainUI();
- if (mainUI != null) {
- mainUI.addComponentListener(listener);
-
- setLocation(mainUI);
- setSize(mainUI);
- }
- try {
- ui.setVisible(true);
- } finally {
- if (mainUI != null) {
- mainUI.removeComponentListener(listener);
- }
- }
- }
-
- protected void setLocation(MainUI mainUI) {
- Container component = mainUI.getBody();
- StatusMessagePanel status = mainUI.getStatus();
- int width = component == null ? 0 : component.getWidth();
- int height = component == null ? 0 : component.getHeight() + status.getHeight();
-
- int x;
- int y;
- if (height == 0) {
- x = mainUI.getX() + 5;
- y = mainUI.getY() + 15;
- } else {
- x = mainUI.getX() + (mainUI.getWidth() - width);
- y = mainUI.getY() + (mainUI.getHeight() - height);
- }
- ui.setLocation(x, y);
- }
-
- protected void setSize(MainUI mainUI) {
- // Better to let his own size to the action progress bar
- // see http://forge.codelutin.com/issues/3263
-// Container component = mainUI.getBody();
-// int width = component == null ? 0 : component.getWidth();
-
- ui.pack();
-
-// if (width != 0 && ui.getWidth() < width) {
-// ui.setSize(width, ui.getHeight());
-// }
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiActionUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,75 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util.action;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.persistence.ProgressionModel;
-import org.jdesktop.beans.AbstractSerializableBean;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public class TuttiActionUIModel extends AbstractSerializableBean {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_ACTION = "action";
-
- public static final String PROPERTY_PROGRESSION_MODEL = "progressionModel";
-
- protected AbstractTuttiAction action;
-
- protected ProgressionModel progressionModel;
-
- public ProgressionModel getProgressionModel() {
- return progressionModel;
- }
-
- public void setProgressionModel(ProgressionModel progressionModel) {
- Object oldValue = getProgressionModel();
- this.progressionModel = progressionModel;
- firePropertyChange(PROPERTY_PROGRESSION_MODEL, oldValue, progressionModel);
- }
-
- public AbstractTuttiAction getAction() {
- return action;
- }
-
- public void setAction(AbstractTuttiAction action) {
- Preconditions.checkNotNull(action, "action can not be null");
- Object oldValue = getAction();
- this.action = action;
- firePropertyChange(PROPERTY_ACTION, oldValue, action);
- }
-
- public void clear() {
- setProgressionModel(null);
-
- Object oldValue = getAction();
- action = null;
- firePropertyChange(PROPERTY_ACTION, oldValue, null);
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiUIAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiUIAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiUIAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,228 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util.action;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 - 2013 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a 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.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.TimeLog;
-
-import javax.swing.AbstractAction;
-import javax.swing.AbstractButton;
-import javax.swing.Icon;
-import javax.swing.SwingUtilities;
-import java.awt.event.ActionEvent;
-import java.util.concurrent.CancellationException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * Abstract tutti ui action which launch a {@link AbstractTuttiAction}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0.2
- */
-public class TuttiUIAction<A extends AbstractTuttiAction> extends AbstractAction {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(TuttiUIAction.class);
-
- private static final TimeLog TIME_LOG = new TimeLog(TuttiUIAction.class);
-
- public static final ExecutorService waitingThread =
- Executors.newSingleThreadExecutor();
-
- private static final String LOGIC_ACTION = "logicAction";
-
- private final Object lock = new Object();
-
- private boolean wait;
-
- private long t0;
-
- public TuttiUIAction(AbstractButton button, A action) {
-
- putValue(LOGIC_ACTION, action);
-
- // fill the ui action from the button
- setActionKey(action.getClass().getName());
- if (button != null) {
- setActionIcon(button.getIcon());
- setActionName(button.getText());
- setActionDescription(button.getToolTipText());
- setActionMnemonic(button.getMnemonic());
- }
- }
-
- public void launchActionAndWait() {
- wait = true;
- actionPerformed(null);
- lock();
- }
-
-
- @Override
- public final void actionPerformed(final ActionEvent event) {
-
- t0 = TimeLog.getTime();
-
- if (log.isInfoEnabled()) {
- log.info("Task [" + getLogicAction().getClass().getSimpleName() + "] starting");
- }
-
- // prepare action
- boolean doAction;
-
- A action = getLogicAction();
-
- // reset status message
- action.sendMessage("");
-
- try {
- doAction = action.prepareAction();
- } catch (Exception e) {
- action.releaseAction();
- throw TuttiActionException.propagateError(action, e);
- }
-
- if (doAction) {
-
- final TuttiActionSwingWorker<A> worker =
- new TuttiActionSwingWorker<A>(action);
-
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
-
- // make ui busy
- worker.updateBusyState(true);
-
- }
- });
-
- if (log.isDebugEnabled()) {
- log.debug("Before execute of action " + action);
- }
-
- // perform and release action
- worker.execute();
-
- // wait until action is done
- waitingThread.execute(
- new Runnable() {
- @Override
- public void run() {
-
- A action = getLogicAction();
- try {
- try {
- worker.get();
- } catch (ExecutionException e) {
- // don't care .
- } catch (CancellationException e) {
- // dont care ?
- } catch (InterruptedException e) {
- // don't care ?
- }
- if (log.isDebugEnabled()) {
- log.debug("After execute of action " + action + " (worker done? " + worker.isDone() + ")");
- }
-
- if (worker.isFailed()) {
-
- throw TuttiActionException.propagateError(action, worker.getError());
- }
- } finally {
- unlock();
- }
- }
- }
- );
-
- } else {
-
- try {
- // release action
- action.releaseAction();
-
- } finally {
- unlock();
- }
- }
- }
-
- public void setActionIcon(Icon actionIcon) {
- putValue(SMALL_ICON, actionIcon);
- putValue(LARGE_ICON_KEY, actionIcon);
- }
-
- public void setActionKey(String actionKey) {
- putValue(ACTION_COMMAND_KEY, actionKey);
- }
-
- public void setActionName(String actionName) {
- putValue(NAME, actionName);
- }
-
- public void setActionDescription(String actionDescription) {
- putValue(SHORT_DESCRIPTION, actionDescription);
- getLogicAction().setActionDescription(actionDescription);
- }
-
- public void setActionMnemonic(int key) {
- putValue(MNEMONIC_KEY, key);
- }
-
- public A getLogicAction() {
- return (A) getValue(LOGIC_ACTION);
- }
-
- protected void lock() {
- if (wait) {
- synchronized (lock) {
- try {
-
- lock.wait();
-
- } catch (InterruptedException e) {
- throw TuttiActionException.propagateError(getLogicAction(), e);
- } finally {
- wait = false;
- }
- }
- }
- }
-
- protected void unlock() {
- TIME_LOG.log(t0, "Task [" + getLogicAction().getClass().getSimpleName() + "] End");
- if (wait) {
- synchronized (lock) {
- lock.notifyAll();
- }
- }
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentCellEditor.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentCellEditor.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentCellEditor.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -28,7 +28,7 @@
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -63,7 +63,7 @@
protected JTable table;
- protected AbstractTuttiTableModel<AbstractTuttiBeanUIModel> tableModel;
+ protected AbstractApplicationTableModel<AbstractTuttiBeanUIModel> tableModel;
protected Integer rowIndex;
@@ -95,7 +95,7 @@
int row,
int column) {
this.table = table;
- this.tableModel = (AbstractTuttiTableModel<AbstractTuttiBeanUIModel>) table.getModel();
+ this.tableModel = (AbstractApplicationTableModel<AbstractTuttiBeanUIModel>) table.getModel();
rowIndex = row;
columnIndex = column;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentEditorUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentEditorUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentEditorUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,14 +24,13 @@
* #L%
*/
-import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.shared.application.ApplicationTechnicalException;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.Attachments;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.ComponentMover;
import jaxx.runtime.swing.ComponentResizer;
@@ -258,7 +257,7 @@
File file = persistenceService.getAttachmentFile(attachment.getId());
if (!file.exists()) {
- throw new TuttiTechnicalException(_("tutti.attachmentEditor.fileNotFound", file.getAbsolutePath()));
+ throw new ApplicationTechnicalException(_("tutti.attachmentEditor.fileNotFound", file.getAbsolutePath()));
}
Desktop desktop = TuttiUIUtil.getDesktopForBrowse();
@@ -266,16 +265,16 @@
desktop.browse(file.toURI());
} catch (IOException e) {
- TuttiUIContext.getErrorHelper().showErrorDialog(_("swing.error.cannot.open.file"));
+ getContext().getErrorHelper().showErrorDialog(_("swing.error.cannot.open.file"));
}
}
public void saveAttachment(Attachment attachment) {
- SaveAttachmentAction action = TuttiActionHelper.createLogicAction(
+ SaveAttachmentAction action = getContext().getActionFactory().createLogicAction(
this, SaveAttachmentAction.class);
action.setAttachment(attachment);
- TuttiActionHelper.runAction(action);
+ getContext().getActionEngine().runAction(action);
// boolean hackDialog = ui.isAlwaysOnTop();
// if (hackDialog) {
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/SaveAttachmentAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/SaveAttachmentAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/SaveAttachmentAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.shared.application.ApplicationIOUtil;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
@@ -59,8 +59,8 @@
attachmentFile = getContext().getPersistenceService().getAttachmentFile(attachment.getId());
file = saveFile(
- TuttiIOUtil.getBaseName(attachment.getName()),
- TuttiIOUtil.getExtension(attachmentFile.getName()),
+ ApplicationIOUtil.getBaseName(attachment.getName()),
+ ApplicationIOUtil.getExtension(attachmentFile.getName()),
_("tutti.attachmentEditor.saveAttachment.title"),
_("tutti.attachmentEditor.saveAttachment.button"));
doAction = file != null;
@@ -79,8 +79,8 @@
}
try {
- TuttiIOUtil.copyFile(attachmentFile, file,
- _("tutti.attachmentEditor.saveAttachment.error.message", attachmentFile, file.getName()));
+ ApplicationIOUtil.copyFile(attachmentFile, file,
+ _("tutti.attachmentEditor.saveAttachment.error.message", attachmentFile, file.getName()));
sendMessage(
_("tutti.attachmentEditor.saveAttachment.success.message", file.getName()));
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapCellComponent.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapCellComponent.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapCellComponent.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,13 +24,13 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import jaxx.runtime.SwingUtil;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.logging.Log;
@@ -141,7 +141,7 @@
protected JTable table;
- protected AbstractTuttiTableModel<CaracteristicMapColumnRowModel> tableModel;
+ protected AbstractApplicationTableModel<CaracteristicMapColumnRowModel> tableModel;
protected CaracteristicMapColumnRowModel editRow;
@@ -241,7 +241,7 @@
boolean isSelected,
int row,
int column) {
- tableModel = (AbstractTuttiTableModel) table.getModel();
+ tableModel = (AbstractApplicationTableModel) table.getModel();
this.table = table;
rowIndex = row;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -22,8 +22,8 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
-import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
import static org.nuiton.i18n.I18n.n_;
@@ -32,7 +32,7 @@
* @author kmorin <kmorin(a)codelutin.com>
* @since 1.4
*/
-public class CaracteristicMapEditorTableModel extends AbstractTuttiTableModel<CaracteristicMapEditorRowModel> {
+public class CaracteristicMapEditorTableModel extends AbstractApplicationTableModel<CaracteristicMapEditorRowModel> {
private static final long serialVersionUID = 1L;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/caracteristics/CaracteristicMapEditorUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -155,8 +155,8 @@
{
addColumnToModel(columnModel,
- new CaracteristicValueEditor(context),
- new CaracteristicValueRenderer(context),
+ new CaracteristicValueEditor(getContext()),
+ new CaracteristicValueRenderer(getContext()),
CaracteristicMapEditorTableModel.VALUE);
}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentCellEditor.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentCellEditor.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentCellEditor.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,11 +25,11 @@
*/
import com.google.common.base.Preconditions;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.persistence.entities.CommentAware;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -63,7 +63,7 @@
protected JTable table;
- protected AbstractTuttiTableModel<AbstractTuttiBeanUIModel> tableModel;
+ protected AbstractApplicationTableModel<AbstractTuttiBeanUIModel> tableModel;
protected Integer rowIndex;
@@ -95,7 +95,7 @@
int row,
int column) {
this.table = table;
- this.tableModel = (AbstractTuttiTableModel<AbstractTuttiBeanUIModel>) table.getModel();
+ this.tableModel = (AbstractApplicationTableModel<AbstractTuttiBeanUIModel>) table.getModel();
rowIndex = row;
columnIndex = column;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.css
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.css 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.css 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,44 +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%
- */
-
-#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};
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.jaxx 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditor.jaxx 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,62 +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%
- -->
-<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
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,266 +0,0 @@
-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 jaxx.runtime.swing.editor.bean.BeanUIUtil;
-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.lang.reflect.Method;
-import java.util.Calendar;
-import java.util.Date;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-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);
-
- } else {
- model.setTimeModel(null);
- }
-
- }
- });
-
- // 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);
- }
-
- mutator = BeanUIUtil.getMutator(bean, property);
- }
- return mutator;
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/SimpleTimeEditorModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,111 +0,0 @@
-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;
- }
-
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditorHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditorHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataEditorHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,9 +25,9 @@
* #L%
*/
+import fr.ifremer.shared.application.ApplicationDataUtil;
import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.swing.editor.NumberEditorHandler;
import org.apache.commons.logging.Log;
@@ -127,7 +127,7 @@
Number computedData = bean.getComputedData();
if (editor.isUseFloat()
&& decimalNumber != null && computedData != null) {
- DecimalFormat decimalFormat = TuttiUIUtil.getDecimalFormat(1, decimalNumber);
+ DecimalFormat decimalFormat = ApplicationDataUtil.getDecimalFormat(1, decimalNumber);
modelText = decimalFormat.format(computedData);
} else {
modelText = JAXXUtil.getStringValue(computedData);
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataTableCell.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataTableCell.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/editor/TuttiComputedOrNotDataTableCell.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,10 +24,10 @@
* #L%
*/
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.ApplicationDataUtil;
+import fr.ifremer.shared.application.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.JAXXUtil;
import javax.swing.AbstractCellEditor;
@@ -224,7 +224,7 @@
foreground = computedDataColor;
if (useFloat && decimalNumber != null && dataValue != null) {
- DecimalFormat decimalFormat = TuttiUIUtil.getDecimalFormat(1, decimalNumber);
+ DecimalFormat decimalFormat = ApplicationDataUtil.getDecimalFormat(1, decimalNumber);
text = JAXXUtil.getStringValue(decimalFormat.format(dataValue));
} else {
text = JAXXUtil.getStringValue(dataValue);
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/EnterMelagWeightDialog.jaxx
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/EnterMelagWeightDialog.jaxx 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/EnterMelagWeightDialog.jaxx 2013-11-24 23:27:27 UTC (rev 1385)
@@ -23,7 +23,7 @@
-->
<JDialog id='dialog' layout='{new BorderLayout()}'>
<import>
- fr.ifremer.tutti.service.WeightUnit
+ fr.ifremer.shared.application.type.WeightUnit;
java.awt.Component;
java.awt.event.WindowAdapter;
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/SelectSpeciesUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/SelectSpeciesUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/SelectSpeciesUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -46,7 +46,7 @@
protected Species selectedSpecies;
public SelectSpeciesUIModel() {
- super(SelectSpeciesUIModel.class, null, null);
+ super(null, null);
}
public List<Species> getSpecies() {
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractSelectTableAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,103 +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 fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.AbstractAction;
-import javax.swing.JTable;
-
-/**
- * Abstract action to select something in a table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public abstract class AbstractSelectTableAction<M extends AbstractTuttiTableModel> extends AbstractAction {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(AbstractSelectTableAction.class);
-
- private final M model;
-
- private final JTable table;
-
- public AbstractSelectTableAction(M model, JTable table) {
- this.model = model;
- this.table = table;
- }
-
- protected void doSelectCell(int rowIndex, int columnIndex) {
-
- if (log.isDebugEnabled()) {
- log.debug("Will select cell at " +
- getCellCoordinate(rowIndex, columnIndex));
- }
- TuttiUIUtil.doSelectCell(table, rowIndex, columnIndex);
- }
-
- protected int getSelectedRow() {
- int result = table.getSelectedRow();
- return result;
- }
-
- protected int getSelectedColumn() {
- int result = table.getSelectedColumn();
- return result;
- }
-
- protected int getRowCount() {
- return table.getRowCount();
- }
-
- protected int getColumnCount() {
- return table.getColumnCount();
- }
-
- protected boolean isCellEditable(int rowIndex, int columnIndex) {
- boolean result;
- result = rowIndex > -1 && columnIndex > -1 &&
-// rowIndex < getRowCount() && columnIndex < getColumnCount() &&
- table.isCellEditable(rowIndex, columnIndex);
- return result;
- }
-
- protected boolean isCreateNewRow() {
- return model.isCreateNewRow();
- }
-
- protected String getCellCoordinate(int rowIndex, int columnIndex) {
- return " [" + rowIndex + ", " + columnIndex + "]";
- }
-
- protected void addNewRow() {
- model.addNewRow();
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,301 +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 com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import jaxx.runtime.SwingUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.table.TableColumnModelExt;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumn;
-import java.io.Serializable;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @param <R> type of a row.
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public abstract class AbstractTuttiTableModel<R extends Serializable> extends AbstractTableModel {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(AbstractTuttiTableModel.class);
-
- /**
- * Data in the model.
- *
- * @since 0.2
- */
- protected List<R> rows;
-
- /**
- * Set of non editable columns.
- *
- * @since 0.2
- */
- protected Set<ColumnIdentifier<?>> noneEditableCols;
-
- /**
- * Creates a new row when moving to next editable cell / row ?
- *
- * @since 0.3
- */
- protected final boolean createNewRow;
-
- /**
- * Creates a first empty row when setting a null or empty list of rows ?
- *
- * @since 0.3
- */
- protected final boolean createEmptyRowIsEmpty;
-
- /**
- * Identifiers of columns (in initial order).
- *
- * @since 1.1
- */
- protected final List<ColumnIdentifier<R>> identifiers;
-
- public abstract R createNewRow();
-
- protected AbstractTuttiTableModel(TableColumnModelExt columnModel,
- boolean createNewRow,
- boolean createEmptyRowIsEmpty) {
- this.identifiers = Lists.newArrayListWithCapacity(columnModel.getColumnCount());
- for (TableColumn tc : columnModel.getColumns(true)) {
- this.identifiers.add((ColumnIdentifier<R>) tc.getIdentifier());
- }
- this.createNewRow = createNewRow;
- this.createEmptyRowIsEmpty = createEmptyRowIsEmpty;
- }
-
- public final List<R> getRows() {
- return rows;
- }
-
- public final void setRows(List<R> data) {
-
- // can't accept a empty data list
- Preconditions.checkNotNull(data, "Data list can not be null.");
-
- this.rows = null;
- if (createEmptyRowIsEmpty && data.isEmpty()) {
-
- if (log.isDebugEnabled()) {
- log.debug("Creates a first empty row on tableModel " + this);
- }
- // add a first edit line
- data.add(createNewRow());
- }
- if (log.isDebugEnabled()) {
- log.debug("Set " + data.size() + " row(s) in table model " + this);
- }
- this.rows = data;
- onRowsChanged(data);
- fireTableDataChanged();
- }
-
- public boolean isCreateNewRow() {
- return createNewRow;
- }
-
- public boolean isCreateEmptyRowIsEmpty() {
- return createEmptyRowIsEmpty;
- }
-
- public final void addNewRow() {
- R newValue = createNewRow();
- addNewRow(newValue);
- }
-
- public final void addNewRow(R newValue) {
-
- 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(rowIndex, newValue);
-
- onRowAdded(rowIndex, newValue);
- fireTableRowsInserted(rowIndex, rowIndex);
- }
-
- public final void fireTableRowsInserted(R newValue) {
-
- Preconditions.checkNotNull(newValue, "Row can not be null.");
-
- int rowIndex = getRowIndex(newValue);
- fireTableRowsInserted(rowIndex, rowIndex);
- }
-
- public final int 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);
- return rowIndex;
- }
-
- public final R removeRow(int rowIndex) {
- SwingUtil.ensureRowIndex(this, rowIndex);
-
- List<R> data = getRows();
-
- R result = data.remove(rowIndex);
-
- fireTableRowsDeleted(rowIndex, rowIndex);
- return result;
- }
-
- protected void onRowsChanged(List<R> data) {
- // by default do nothing
- }
-
- protected void onRowAdded(int rowIndex, R newValue) {
- // by default do nothing
- }
-
- public final int getRowIndex(R row) {
- int result = rows == null ? -1 : rows.indexOf(row);
- return result;
- }
-
- public final R getEntry(int rowIndex) {
- SwingUtil.ensureRowIndex(this, rowIndex);
- List<R> data = getRows();
- R result = data == null ? null : data.get(rowIndex);
- return result;
- }
-
- public final void setNoneEditableCols(ColumnIdentifier<?>... noneEditableCols) {
- this.noneEditableCols = Sets.newHashSet(noneEditableCols);
- }
-
- @Override
- public final int getRowCount() {
- return rows == null ? 0 : rows.size();
- }
-
- @Override
- public final int getColumnCount() {
- return identifiers.size();
- }
-
- @Override
- public final Object getValueAt(int rowIndex, int columnIndex) {
- R entry = getEntry(rowIndex);
- ColumnIdentifier<R> identifier = getIdentifier(columnIndex);
- if (log.isDebugEnabled()) {
- log.debug("columnIndex: " + columnIndex + " :: " + identifier.getPropertyName());
- }
- Object result = identifier.getValue(entry);
- return result;
- }
-
- @Override
- public final void setValueAt(Object aValue, int rowIndex, int columnIndex) {
- if (log.isDebugEnabled()) {
- log.debug("setValueAt " + aValue);
- }
- R entry = getEntry(rowIndex);
- ColumnIdentifier<R> identifier = getIdentifier(columnIndex);
- setValueAt(aValue, rowIndex, columnIndex, identifier, entry);
- }
-
- @Override
- public final boolean isCellEditable(int rowIndex, int columnIndex) {
- ColumnIdentifier<R> identifier = getIdentifier(columnIndex);
- boolean result = isCellEditable(rowIndex, columnIndex, identifier);
- return result;
- }
-
- protected void setValueAt(Object aValue,
- int rowIndex,
- int columnIndex,
- ColumnIdentifier<R> propertyName,
- R entry) {
- if (log.isDebugEnabled()) {
- log.debug("setValueAt " + aValue);
- }
- propertyName.setValue(entry, aValue);
- }
-
- protected boolean isCellEditable(int rowIndex,
- int columnIndex,
- ColumnIdentifier<R> propertyName) {
- boolean result = !noneEditableCols.contains(propertyName);
- return result;
- }
-
- public final void fireTableCellUpdated(int rowIndex,
- ColumnIdentifier<R>... identifiers) {
- for (ColumnIdentifier<R> identifier : identifiers) {
- int columnIndex = this.identifiers.indexOf(identifier);
- fireTableCellUpdated(rowIndex, columnIndex);
- }
- }
-
- public final void fireTableRowUpdatedShell(Set<R> shell) {
-
- int minRowIndex1 = getColumnCount();
- int maxRowIndex1 = 0;
-
- for (R r : shell) {
- int rowIndex1 = getRowIndex(r);
- minRowIndex1 = Math.min(minRowIndex1, rowIndex1);
- maxRowIndex1 = Math.max(maxRowIndex1, rowIndex1);
- }
- fireTableRowsUpdated(minRowIndex1, maxRowIndex1);
- }
-
- protected void collectShell(R row, Set<R> collectedRows) {
-
- // by default just add the incoming row
- collectedRows.add(row);
- }
-
- protected ColumnIdentifier<R> getIdentifier(int columnIndex) {
- ColumnIdentifier<R> identifier = identifiers.get(columnIndex);
- return identifier;
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -26,6 +26,11 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
+import fr.ifremer.shared.application.swing.table.AbstractApplicationTableModel;
+import fr.ifremer.shared.application.swing.table.MoveToNextEditableCellAction;
+import fr.ifremer.shared.application.swing.table.MoveToNextEditableRowAction;
+import fr.ifremer.shared.application.swing.table.MoveToPreviousEditableCellAction;
+import fr.ifremer.shared.application.swing.table.MoveToPreviousEditableRowAction;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategoryComponent.SampleCategoryEditor;
@@ -73,7 +78,7 @@
* @return the table model handled byt the main table.
* @since 0.2
*/
- public abstract AbstractTuttiTableModel<R> getTableModel();
+ public abstract AbstractApplicationTableModel<R> getTableModel();
/**
* @return the main table of the ui.
@@ -387,7 +392,7 @@
"There is already a tableSelectionListener registred, " +
"remove it before invoking this method.");
- final AbstractTuttiTableModel<R> model = getTableModel();
+ final AbstractApplicationTableModel<R> model = getTableModel();
final MoveToNextEditableCellAction nextCellAction =
MoveToNextEditableCellAction.newAction(model, table);
final MoveToPreviousEditableCellAction previousCellAction =
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -61,7 +61,7 @@
protected AbstractTuttiTableUIModel(Class<E> entityType,
Binder<E, B> fromBeanBinder,
Binder<B, E> toBeanBinder) {
- super(entityType, fromBeanBinder, toBeanBinder);
+ super(fromBeanBinder, toBeanBinder);
addPropertyChangeListener(PROPERTY_ROWS_IN_ERROR, new PropertyChangeListener() {
@Override
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicColumnIdentifier.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicColumnIdentifier.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/CaracteristicColumnIdentifier.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -25,6 +25,7 @@
*/
import com.google.common.base.Preconditions;
+import fr.ifremer.shared.application.swing.table.ColumnIdentifier;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/ColumnIdentifier.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,103 +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 fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
-
-import java.io.Serializable;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class ColumnIdentifier<R> implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private final String propertyName;
-
- private final String headerI18nKey;
-
- private final String headerTipI18nKey;
-
- public static <R> ColumnIdentifier<R> newId(String propertyName,
- String headerI18nKey,
- String headerTipI18nKey) {
- return new ColumnIdentifier<R>(propertyName,
- headerI18nKey,
- headerTipI18nKey);
- }
-
- public static <R> ColumnIdentifier<R> newReadOnlyId(String propertyName,
- String headerI18nKey,
- String headerTipI18nKey) {
- return new ColumnIdentifier<R>(propertyName,
- headerI18nKey,
- headerTipI18nKey) {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void setValue(R entry, Object value) {
- // no set
- }
- };
- }
-
- protected 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);
- }
- }
-
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableCellAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,102 +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 org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JTable;
-import java.awt.event.ActionEvent;
-
-/**
- * Action to select next editable cell in a table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MoveToNextEditableCellAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(MoveToNextEditableCellAction.class);
-
- public static <M extends AbstractTuttiTableModel> MoveToNextEditableCellAction<M> newAction(M model, JTable table) {
- return new MoveToNextEditableCellAction<M>(model, table);
- }
-
- protected MoveToNextEditableCellAction(M model, JTable table) {
- super(model, table);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-
- int currentRow = getSelectedRow();
- int currentColumn = getSelectedColumn();
-
- if (log.isDebugEnabled()) {
- log.debug("Move to previous editable cell " +
- getCellCoordinate(currentRow, currentColumn));
- }
-
- int columnCount = getColumnCount();
-
- int rowCount = getRowCount();
-
- if (currentRow <= rowCount || currentColumn <= columnCount) {
-
- // go to next cell
- currentColumn++;
- boolean canSelect = true;
-
- // select next cell
- if (currentColumn >= columnCount) {
-
- // no more cell, so will move to next editable column on next row
- currentColumn = 0;
- currentRow++;
-
- if (currentRow == rowCount) {
-
- if (isCreateNewRow()) {
-
- // create a new row in model
- addNewRow();
- } else {
-
- // can not create new row, so do nothing
- canSelect = false;
- }
- }
- }
-
- if (canSelect) {
- doSelectCell(currentRow, currentColumn);
- }
- }
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToNextEditableRowAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,95 +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 org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JTable;
-import java.awt.event.ActionEvent;
-
-/**
- * Action to select next editable row in a table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MoveToNextEditableRowAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(MoveToNextEditableRowAction.class);
-
- public static <M extends AbstractTuttiTableModel> MoveToNextEditableRowAction<M> newAction(M model, JTable table) {
- return new MoveToNextEditableRowAction<M>(model, table);
- }
-
- protected MoveToNextEditableRowAction(M model, JTable table) {
- super(model, table);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- int currentRow = getSelectedRow();
- int currentColumn = getSelectedColumn();
-
- if (log.isDebugEnabled()) {
- log.debug("Move to next row editable cell " +
- getCellCoordinate(currentRow, currentColumn));
- }
-
- int rowCount = getRowCount();
-
- // I commented the part of the code to skip the not editable cells (ref #2704)
-// while (currentRow < rowCount) {
- if (currentRow < rowCount) {
- // go to next cell
- currentRow++;
- boolean canSelect = true;
-
- // select next cell
- if (currentRow >= rowCount) {
-
- if (log.isDebugEnabled()) {
- log.debug("No next row");
- }
- if (isCreateNewRow()) {
-
- // create a new row in model
- addNewRow();
-
- } else {
- canSelect = false;
- }
- }
-
- if (canSelect) {
- doSelectCell(currentRow, currentColumn);
- }
- }
- }
-}
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableCellAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,92 +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 org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JTable;
-import java.awt.event.ActionEvent;
-
-/**
- * Action to select previous editable cell in a table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MoveToPreviousEditableCellAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(MoveToPreviousEditableCellAction.class);
-
- public static <M extends AbstractTuttiTableModel> MoveToPreviousEditableCellAction<M> newAction(M model, JTable table) {
- return new MoveToPreviousEditableCellAction<M>(model, table);
- }
-
- protected MoveToPreviousEditableCellAction(M model, JTable table) {
- super(model, table);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- int currentRow = getSelectedRow();
- int currentColumn = getSelectedColumn();
-
- if (log.isDebugEnabled()) {
- log.debug("Move to previous editable cell, " +
- getCellCoordinate(currentRow, currentColumn));
- }
-
- int columnCount = getColumnCount();
-
- // I commented the part of the code to skip the not editable cells (ref #2704)
-// while (currentRow > 0 || currentColumn > 0) {
- if (currentRow > 0 || currentColumn > 0) {
-
- // go to next cell
- currentColumn--;
-
- // select next cell
- if (currentColumn < 0) {
-
- currentColumn = columnCount - 1;
- currentRow--;
- }
-
-// if (isCellEditable(currentRow, currentColumn)) {
- doSelectCell(currentRow, currentColumn);
-// break;
-// } else {
-// if (log.isDebugEnabled()) {
-// log.debug("Cell not editable at " +
-// getCellCoordinate(currentRow, currentColumn));
-// }
-// }
- }
- }
-}
\ No newline at end of file
Deleted: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/MoveToPreviousEditableRowAction.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,88 +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 org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JTable;
-import java.awt.event.ActionEvent;
-
-/**
- * Action to select previous editable row in a table.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class MoveToPreviousEditableRowAction<M extends AbstractTuttiTableModel> extends AbstractSelectTableAction<M> {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(MoveToPreviousEditableRowAction.class);
-
- public static <M extends AbstractTuttiTableModel> MoveToPreviousEditableRowAction<M> newAction(M model, JTable table) {
- return new MoveToPreviousEditableRowAction<M>(model, table);
- }
-
- protected MoveToPreviousEditableRowAction(M model, JTable table) {
- super(model, table);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-
- int currentRow = getSelectedRow();
- int currentColumn = getSelectedColumn();
-
- if (log.isDebugEnabled()) {
- log.debug("Move to previous row editable cell " +
- getCellCoordinate(currentRow, currentColumn));
- }
-
- int rowCount = getRowCount();
-
- // I commented the part of the code to skip the not editable cells (ref #2704)
-// while (currentRow > 0) {
- if (currentRow > 0) {
-
- // go to next cell
- currentRow--;
-// boolean canSelect = isCellEditable(currentRow, currentColumn);
-//
-// if (canSelect) {
- doSelectCell(currentRow, currentColumn);
-
-// break;
-// } else {
-// if (log.isDebugEnabled()) {
-// log.debug("Cell not editable at " +
-// getCellCoordinate(currentRow, currentColumn));
-// }
-// }
- }
- }
-}
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,4 +1,10 @@
BOUUH=
+application.action.create.error=
+application.error.cannot.mail=
+application.error.cannot.open.link=
+application.error.desktop.browse.not.supported=
+application.error.desktop.mail.not.supported=
+application.error.desktop.not.supported=
coordinate.action.reset.tip=
observe.common.quadrant1=
observe.common.quadrant2=
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-11-24 23:27:27 UTC (rev 1385)
@@ -1,8 +1,9 @@
-BOUUH=
-observe.common.quadrant1=(1) NE
-observe.common.quadrant2=(2) SE
-observe.common.quadrant3=(3) SW
-observe.common.quadrant4=(4) NW
+application.action.create.error=
+application.error.cannot.mail=
+application.error.cannot.open.link=
+application.error.desktop.browse.not.supported=
+application.error.desktop.mail.not.supported=
+application.error.desktop.not.supported=
swing.error.cannot.mail=Erreur lors de l'ouverture du client mail
swing.error.cannot.open.file=Aucun programme n'est défini pour ouvrir ce type de fichier. Enregistrez le fichier et ouvrez le en dehors de l'application
swing.error.cannot.open.link=Impossible d'ouvrir le fichier %s
@@ -1128,11 +1129,7 @@
tutti.editSpeciesFrequencies.title=Mensuration
tutti.error.about.could.not.reach.url=Récupération des versions de mises à jour impossible (l'url <strong>%s</strong> n'est pas joignable)
tutti.error.delete.startActionFile=Impossible de supprimer le fichier %s
-tutti.error.errorpane.htmlmessage=<html><body><b>Une erreur s'est produite</b>\:<br/>%s</body></html>
tutti.error.read.startActionFile=Impossible de lire le contenu du fichier %s
-tutti.error.ui.business.error=Erreur
-tutti.error.ui.business.warning=Avertissement
-tutti.error.ui.other.error=Erreur
tutti.error.update.bad.url.syntax=Mise à jour impossible (le format de l'url <strong>%s</strong> n'est pas valide)
tutti.error.update.could.not.found.url=Mise à jour impossible (l'url <strong>%s</strong> n'existe pas)
tutti.error.update.could.not.reach.url=Mise à jour impossible (l'url <strong>%s</strong> n'est pas joignable)
Modified: branches/tutti-with-ifremer-shared/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModelTest.java
===================================================================
--- branches/tutti-with-ifremer-shared/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModelTest.java 2013-11-24 23:21:18 UTC (rev 1384)
+++ branches/tutti-with-ifremer-shared/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModelTest.java 2013-11-24 23:27:27 UTC (rev 1385)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.service.WeightUnit;
+import fr.ifremer.shared.application.type.WeightUnit;
import org.junit.Assert;
import org.junit.Test;
1
0
Author: tchemit
Date: 2013-11-25 00:21:18 +0100 (Mon, 25 Nov 2013)
New Revision: 1384
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1384
Log:
to use ifremer-shared on tutti
Added:
branches/tutti-with-ifremer-shared/
1
0