Author: tchemit Date: 2013-01-18 13:40:25 +0100 (Fri, 18 Jan 2013) New Revision: 222 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/222 Log: #1852: [ERGO] - Barre de progression pour les actions longues (mise en place des actions pour l'?\195?\169cran de d?\195?\169marrage et les menus) Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedCruiseAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedCruiseCatchesAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedProgramAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedProtocolAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/SelectCruiseAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/ValidateSelectedCruiseCatchesAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCruiseAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProgramAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewCruiseAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProgramAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ValidateCatchesAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ActionListCellRenderer.java Removed: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/AbstractHomeAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProtocolAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiAction.java (from rev 220, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/AbstractHomeAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,126 @@ +package fr.ifremer.tutti.ui.swing; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy 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 jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.ErrorDialogUI; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.beans.AbstractBean; + +import javax.swing.AbstractAction; +import java.awt.event.ActionEvent; +import java.util.Timer; +import java.util.TimerTask; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public abstract class AbstractTuttiAction<M extends AbstractBean, H extends AbstractTuttiUIHandler<M>> extends AbstractAction { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(AbstractTuttiAction.class); + + private static final Timer t = new Timer(); + + private final H handler; + + protected abstract void doAction(ActionEvent event); + + public AbstractTuttiAction(H handler, + String name, + String icon, + String text, + String tip) { + this.handler = handler; + putValue(LARGE_ICON_KEY, SwingUtil.createActionIcon(icon)); + putValue(ACTION_COMMAND_KEY, name); + putValue(NAME, text); + putValue(SHORT_DESCRIPTION, tip); + } + + @Override + public final void actionPerformed(ActionEvent event) { + + if (log.isInfoEnabled()) { + log.info("Will starts action: " + this); + } + TimerTask timer = new TimerTask() { + @Override + public void run() { + if (log.isInfoEnabled()) { + log.info("Task [" + AbstractTuttiAction.this + "] is started since 1 second!!!"); + } + + TuttiUIUtil.updateBusyState(getContext().getMainUI(), true); + } + + @Override + public boolean cancel() { + if (log.isInfoEnabled()) { + log.info("Task [" + AbstractTuttiAction.this + "] canceled."); + } + TuttiUIUtil.updateBusyState(getContext().getMainUI(), false); + boolean cancel = super.cancel(); + return cancel; + } + }; + + try { + + t.schedule(timer, 500); + doAction(event); + } catch (Exception e) { + ErrorDialogUI.showError(e); + } finally { + if (log.isInfoEnabled()) { + log.info("After action: " + this); + } + timer.cancel(); + } + } + + public TuttiUIContext getContext() { + return handler.getContext(); + } + + public H getHandler() { + return handler; + } + + public M getModel() { + return handler.getModel(); + } + + protected void setMnemonic(int key) { + putValue(MNEMONIC_KEY, key); + } +} Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/AbstractTuttiUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -50,6 +50,7 @@ import org.nuiton.validator.bean.simple.SimpleBeanValidator; import javax.swing.AbstractAction; +import javax.swing.DefaultComboBoxModel; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; @@ -94,7 +95,7 @@ public abstract void onCloseUI(); - protected abstract M getModel(); + public abstract M getModel(); protected final TuttiUIContext context; @@ -106,6 +107,10 @@ //-- Public methods --// //------------------------------------------------------------------------// + public DefaultComboBoxModel newComboModel(Object... items) { + return new DefaultComboBoxModel(items); + } + @Override public void showInformationMessage(String message) { context.showInformationMessage(message); Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedCruiseAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedCruiseAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedCruiseAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,64 @@ +package fr.ifremer.tutti.ui.swing; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy 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 org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class EditSelectedCruiseAction extends AbstractTuttiAction<TuttiUIContext, MainUIHandler> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(EditSelectedCruiseAction.class); + + public EditSelectedCruiseAction(MainUIHandler handler) { + super(handler, + "editCruise", + "edit", + _("tutti.action.editCruise"), + _("tutti.action.editCruise.tip")); + } + + @Override + protected void doAction(ActionEvent e) { + Preconditions.checkState(getContext().isCruiseFilled()); + if (log.isInfoEnabled()) { + log.info("Edit cruise: " + getContext().getCruiseId()); + } + getContext().setScreen(TuttiScreen.EDIT_CRUISE); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedCruiseAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedCruiseCatchesAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedCruiseCatchesAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedCruiseCatchesAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,60 @@ +package fr.ifremer.tutti.ui.swing; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy 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 java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class EditSelectedCruiseCatchesAction extends AbstractTuttiAction<TuttiUIContext, MainUIHandler> { + + private static final long serialVersionUID = 1L; + + public EditSelectedCruiseCatchesAction(MainUIHandler handler) { + super(handler, + "editCatches", + "edit", + _("tutti.action.editCatches"), + _("tutti.action.editCatches.tip") + ); + setMnemonic('C'); + } + + @Override + protected void doAction(ActionEvent e) { + Preconditions.checkState(getContext().isCruiseFilled()); + getContext().setValidationContext(TuttiUIContext.VALIDATION_CONTEXT_EDIT); + getContext().setScreen(null); + getContext().setScreen(TuttiScreen.EDIT_FISHING_OPERATION); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedCruiseCatchesAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedProgramAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedProgramAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedProgramAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,64 @@ +package fr.ifremer.tutti.ui.swing; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy 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 org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class EditSelectedProgramAction extends AbstractTuttiAction<TuttiUIContext, MainUIHandler> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(EditSelectedProgramAction.class); + + public EditSelectedProgramAction(MainUIHandler handler) { + super(handler, + "editProgram", + "edit", + _("tutti.action.editProgram"), + _("tutti.action.editProgram.tip")); + } + + @Override + protected void doAction(ActionEvent e) { + Preconditions.checkState(getContext().getProgramId() != null); + if (log.isInfoEnabled()) { + log.info("Edit program: " + getContext().getProgramId()); + } + getContext().setScreen(TuttiScreen.EDIT_PROGRAM); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedProgramAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedProtocolAction.java (from rev 220, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedProtocolAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/EditSelectedProtocolAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,65 @@ +package fr.ifremer.tutti.ui.swing; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy 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 org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class EditSelectedProtocolAction extends AbstractTuttiAction<TuttiUIContext, MainUIHandler> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(EditSelectedProtocolAction.class); + + public EditSelectedProtocolAction(MainUIHandler handler) { + super(handler, + "editProtocol", + "edit", + _("tutti.action.editProtocol"), + _("tutti.action.editProtocol.tip")); + setMnemonic('P'); + } + + @Override + protected void doAction(ActionEvent e) { + Preconditions.checkState(getContext().isProtocolFilled()); + if (log.isInfoEnabled()) { + log.info("Edit protocol: " + getContext().getProtocolId()); + } + getContext().setScreen(TuttiScreen.EDIT_PROTOCOL); + } +} Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.css 2013-01-18 12:40:25 UTC (rev 222) @@ -52,43 +52,40 @@ mnemonic: A; } +#menuActionSelectCruise { + enabled: {model.getScreen() != TuttiScreen.SELECT_CRUISE}; + action: {selectCruiseAction}; +} -#menuActionManageProtocol { - text: "tutti.action.manageProtocol"; - toolTipText: "tutti.action.manageProtocol.tip"; - mnemonic: P; - enabled: {model.getScreen() != TuttiScreen.EDIT_PROTOCOL && model.isProtocolFilled()}; - /*actionIcon: "protocol";*/ +#menuActionEditProgram { + enabled: {model.getScreen() != TuttiScreen.EDIT_PROGRAM && model.isProgramFilled()}; + action: {editProgramAction}; } -#menuActionSelectCampaign { - text: "tutti.action.selectCampaign"; - toolTipText: "tutti.action.selectCampaign.tip"; - mnemonic: S; - enabled: {model.getScreen() != TuttiScreen.SELECT_CRUISE}; - /*actionIcon: "cruise";*/ +#menuActionEditCruise { + enabled: {model.getScreen() != TuttiScreen.EDIT_CRUISE && model.isCruiseFilled()}; + action: {editCruiseAction}; } -#menuActionFillCatches { - text: "tutti.action.fillCatches"; - toolTipText: "tutti.action.fillCatches.tip"; - mnemonic: C; +#menuActionEditProtocol { + enabled: {model.getScreen() != TuttiScreen.EDIT_PROTOCOL && model.isProtocolFilled()}; + action: {editProtocolAction}; +} + +#menuActionEditCatches { enabled: {( - TuttiUIContext.VALIDATION_CONTEXT_VALIDATE.equals(model.getValidationContext()) - || model.getScreen() != TuttiScreen.EDIT_FISHING_OPERATION - ) && model.isCruiseContextFilled()}; - actionIcon: edit; + !TuttiUIContext.VALIDATION_CONTEXT_EDIT.equals(model.getValidationContext()) + || model.getScreen() != TuttiScreen.EDIT_FISHING_OPERATION + ) && model.isCruiseFilled()}; + action: {editCatchesAction}; } #menuActionValidateCatches { - text: "tutti.action.validateCatches"; - toolTipText: "tutti.action.validateCatches.tip"; - mnemonic: V; enabled: {( - !TuttiUIContext.VALIDATION_CONTEXT_VALIDATE.equals(model.getValidationContext()) - || model.getScreen() != TuttiScreen.EDIT_FISHING_OPERATION - ) && model.isCruiseContextFilled()}; - actionIcon: validate; + !TuttiUIContext.VALIDATION_CONTEXT_VALIDATE.equals(model.getValidationContext()) + || model.getScreen() != TuttiScreen.EDIT_FISHING_OPERATION + ) && model.isCruiseFilled()}; + action: {validateCatchesAction}; } #menuSynchronisations { Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.jaxx 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUI.jaxx 2013-01-18 12:40:25 UTC (rev 222) @@ -39,6 +39,13 @@ <MainUIHandler id='handler' initializer='getContextValue(MainUIHandler.class)'/> + <SelectCruiseAction id='selectCruiseAction' constructorParams='handler'/> + <EditSelectedProtocolAction id='editProtocolAction' constructorParams='handler'/> + <EditSelectedProgramAction id='editProgramAction' constructorParams='handler'/> + <EditSelectedCruiseAction id='editCruiseAction' constructorParams='handler'/> + <EditSelectedCruiseCatchesAction id='editCatchesAction' constructorParams='handler'/> + <ValidateSelectedCruiseCatchesAction id='validateCatchesAction' constructorParams='handler'/> + <script><![CDATA[ public MainUI(TuttiUIContext context) { @@ -73,14 +80,12 @@ </JMenu> <JMenu id='menuActions'> - <JMenuItem id='menuActionManageProtocol' - onActionPerformed="getHandler().showManageProtocol()"/> - <JMenuItem id='menuActionSelectCampaign' - onActionPerformed="getHandler().showSelectCampaign()"/> - <JMenuItem id='menuActionFillCatches' - onActionPerformed="getHandler().showFillCatches()"/> - <JMenuItem id='menuActionValidateCatches' - onActionPerformed="getHandler().showFillCatches()"/> + <JMenuItem id='menuActionSelectCruise'/> + <JMenuItem id='menuActionEditProgram'/> + <JMenuItem id='menuActionEditCruise'/> + <JMenuItem id='menuActionEditProtocol'/> + <JMenuItem id='menuActionEditCatches'/> + <JMenuItem id='menuActionValidateCatches'/> </JMenu> <JMenu id='menuSynchronisations'> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/MainUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -35,23 +35,24 @@ import fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI; import fr.ifremer.tutti.ui.swing.content.program.EditProgramUI; import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI; -import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil; -import java.awt.Desktop; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.net.URL; -import java.util.Calendar; -import javax.swing.JComponent; -import javax.swing.JToolBar; import jaxx.runtime.swing.AboutPanel; import jaxx.runtime.swing.ErrorDialogUI; import jaxx.runtime.validator.swing.SwingValidator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import static org.nuiton.i18n.I18n._; import org.nuiton.util.ApplicationConfig; import org.nuiton.widget.SwingSession; +import javax.swing.JComponent; +import javax.swing.JToolBar; +import java.awt.Desktop; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.net.URL; +import java.util.Calendar; + +import static org.nuiton.i18n.I18n._; + /** * @author tchemit <chemit@codelutin.com> * @since 0.1 @@ -62,7 +63,7 @@ private static final Log log = LogFactory.getLog(MainUIHandler.class); public static final String CLONE_PROTOCOL = "cloneProtocol"; - + protected MainUI ui; protected JComponent currentBody; @@ -74,6 +75,7 @@ this.ui = ui; this.persistenceService = context.getService(PersistenceService.class); context.addMessageNotifier(this); + context.setMainUI(ui); } //------------------------------------------------------------------------// @@ -113,38 +115,26 @@ //SwingUtil.getLayer(ui.getBody()).setUI(new BetaLayerUI()); changeTitle(); - + JToolBar bar = ui.getBottomBar(); ui.getStatus().addWidget(bar, 0); TuttiScreen screen; -// if (context.isCruiseContextFilled()) { -// -// // direct fill catches screen -// screen = TuttiScreen.EDIT_FISHING_OPERATION; -// } else { -// -// // go to select cruise screen -// screen = TuttiScreen.SELECT_CRUISE; -// } - screen = TuttiScreen.SELECT_CRUISE; context.setScreen(screen); - + } @Override public void onCloseUI() { -// closeCurrentBody(); - context.close(); } @Override - protected TuttiUIContext getModel() { + public TuttiUIContext getModel() { return ui.getModel(); } @@ -161,13 +151,6 @@ // Close the application RunTutti.closeTutti(ui, false); - // Re-open the context -// try { -// context.open(); -// } catch (Exception ex) { -// ErrorDialogUI.showError(ex); -// } - RunTutti.startTutti(context); } @@ -281,11 +264,11 @@ public void registerValidator(SwingValidator validator) { ui.getValidatorMessageWidget().registerValidator(validator); } - + public void clearValidators() { ui.getValidatorMessageWidget().clearValidators(); } - + //------------------------------------------------------------------------// //-- Internal methods --// //------------------------------------------------------------------------// @@ -294,9 +277,6 @@ try { - // busy ui - TuttiUIUtil.updateBusyState(ui, true); - // close current body (if any) if (currentBody != null) { TuttiUI<?, ?> body = (TuttiUI<?, ?>) currentBody; @@ -358,7 +338,7 @@ screenUI = new EditProtocolUI(ui); break; - + case CLONE_PROTOCOL: screenTitle = _("tutti.title.create.protocol"); ui.setContextValue(true, CLONE_PROTOCOL); @@ -389,14 +369,8 @@ } } catch (Exception e) { - ErrorDialogUI.showError(e); - // go back to home context.setScreen(TuttiScreen.SELECT_CRUISE); - } finally { - - // free ui - TuttiUIUtil.updateBusyState(ui, false); } } Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/SelectCruiseAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/SelectCruiseAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/SelectCruiseAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,56 @@ +package fr.ifremer.tutti.ui.swing; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy 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.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class SelectCruiseAction extends AbstractTuttiAction<TuttiUIContext, MainUIHandler> { + + private static final long serialVersionUID = 1L; + + public SelectCruiseAction(MainUIHandler handler) { + super(handler, + "selectCruise", + "home", + _("tutti.action.selectCruise"), + _("tutti.action.selectCruise.tip") + ); + setMnemonic('S'); + } + + @Override + protected void doAction(ActionEvent e) { +// Preconditions.checkNotNull(getContext().isCruiseFilled()); + getContext().setScreen(TuttiScreen.SELECT_CRUISE); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/SelectCruiseAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2013-01-18 12:40:25 UTC (rev 222) @@ -70,8 +70,10 @@ public static final String PROPERTY_SCREEN = "screen"; - public static final String PROPERTY_CRUISE_CONTEXT_FILLED = "cruiseContextFilled"; + public static final String PROPERTY_PROGRAM_FILLED = "programFilled"; + public static final String PROPERTY_CRUISE__FILLED = "cruiseFilled"; + public static final String PROPERTY_PROTOCOL_FILLED = "protocolFilled"; public static final String PROPERTY_VALIDATION_CONTEXT = "validationContext"; @@ -158,6 +160,8 @@ */ private String validationContext; + private MainUI mainUI; + public static TuttiUIContext newContext(TuttiConfig config) { Preconditions.checkNotNull(config); Preconditions.checkState(applicationContext == null, @@ -208,39 +212,44 @@ return protocolId; } - public boolean isCruiseContextFilled() { - return StringUtils.isNotBlank(programId) && - StringUtils.isNotBlank(cruiseId); + public boolean isCruiseFilled() { + return isProgramFilled() && StringUtils.isNotBlank(cruiseId); } public boolean isProtocolFilled() { return StringUtils.isNotBlank(protocolId); } + public boolean isProgramFilled() { + return StringUtils.isNotBlank(programId); + } + + public TuttiScreen getScreen() { return screen; } public void setProgramId(String programId) { - boolean oldValue = isCruiseContextFilled(); + boolean oldProgramFilled = isProgramFilled(); + boolean oldCruiseFilled = isCruiseFilled(); this.programId = programId; // always propagate the change firePropertyChange(PROPERTY_PROGRAM_ID, -1, programId); - firePropertyChange(PROPERTY_CRUISE_CONTEXT_FILLED, - oldValue, isCruiseContextFilled()); + firePropertyChange(PROPERTY_PROGRAM_FILLED, oldProgramFilled, isProgramFilled()); + firePropertyChange(PROPERTY_CRUISE__FILLED, oldCruiseFilled, isCruiseFilled()); } public void setCruiseId(String cruiseId) { - boolean oldValue = isCruiseContextFilled(); + boolean oldValue = isCruiseFilled(); this.cruiseId = cruiseId; // always propagate the change firePropertyChange(PROPERTY_CRUISE_ID, -1, cruiseId); - firePropertyChange(PROPERTY_CRUISE_CONTEXT_FILLED, - oldValue, isCruiseContextFilled()); + firePropertyChange(PROPERTY_CRUISE__FILLED, + oldValue, isCruiseFilled()); } public void setProtocolId(String protocolId) { @@ -293,7 +302,8 @@ PersistenceService persistenceService = getService(PersistenceService.class); - if (protocolId != null) { + if (isProtocolFilled()) { + TuttiProtocol protocol = persistenceService.getProtocol(protocolId); if (protocol == null) { @@ -307,7 +317,7 @@ } } - if (programId != null) { + if (isProgramFilled()) { Program program = persistenceService.getProgram(programId); if (program == null) { @@ -330,7 +340,7 @@ setProgramId(programId); // test cruiseId - if (cruiseId != null) { + if (isCruiseFilled()) { Cruise cruise = persistenceService.getCruise(cruiseId); @@ -399,6 +409,7 @@ } removePropertyChangeListener(listener); } + setMainUI(null); } protected void saveContextToConfig() { @@ -426,4 +437,12 @@ public RessourceClassLoader getResourceLoader() { return resourceLoader; } + + public void setMainUI(MainUI mainUI) { + this.mainUI = mainUI; + } + + public MainUI getMainUI() { + return mainUI; + } } Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/ValidateSelectedCruiseCatchesAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/ValidateSelectedCruiseCatchesAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/ValidateSelectedCruiseCatchesAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,59 @@ +package fr.ifremer.tutti.ui.swing; + +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy 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 java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class ValidateSelectedCruiseCatchesAction extends AbstractTuttiAction<TuttiUIContext, MainUIHandler> { + + private static final long serialVersionUID = 1L; + + public ValidateSelectedCruiseCatchesAction(MainUIHandler handler) { + super(handler, + "validateCatches", + "validate", + _("tutti.action.validateCatches"), + _("tutti.action.validateCatches.tip") + ); + } + + @Override + protected void doAction(ActionEvent e) { + Preconditions.checkState(getContext().isCruiseFilled()); + getContext().setValidationContext(TuttiUIContext.VALIDATION_CONTEXT_VALIDATE); + getContext().setScreen(null); + getContext().setScreen(TuttiScreen.EDIT_FISHING_OPERATION); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/ValidateSelectedCruiseCatchesAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -267,7 +267,7 @@ } @Override - protected EditCruiseUIModel getModel() { + public EditCruiseUIModel getModel() { return ui.getModel(); } Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/AbstractHomeAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/AbstractHomeAction.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/AbstractHomeAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -1,62 +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.TuttiUIContext; -import jaxx.runtime.SwingUtil; - -import javax.swing.AbstractAction; - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since 1.0 - */ -public abstract class AbstractHomeAction extends AbstractAction { - - private static final long serialVersionUID = 1L; - - protected final TuttiUIContext context; - - protected final SelectCruiseUIModel model; - - public AbstractHomeAction(TuttiUIContext context, - SelectCruiseUIModel model, - String name, - String icon, - String text, - String tip) { - this.context = context; - this.model = model; - putValue(LARGE_ICON_KEY, SwingUtil.createActionIcon(icon)); - putValue(ACTION_COMMAND_KEY, name); - putValue(NAME, name); - putValue(SHORT_DESCRIPTION, text); - putValue(LONG_DESCRIPTION, tip); - - } - -} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -1,71 +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.ezware.oxbow.swingbits.util.Preconditions; -import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; -import fr.ifremer.tutti.ui.swing.TuttiScreen; -import fr.ifremer.tutti.ui.swing.TuttiUIContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.awt.event.ActionEvent; - -import static org.nuiton.i18n.I18n._; - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since 1.0 - */ -public class CloneProtocolAction extends AbstractHomeAction { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = LogFactory.getLog(CloneProtocolAction.class); - - public CloneProtocolAction(TuttiUIContext context, - SelectCruiseUIModel model) { - super(context, - model, - "cloneProtocol", - "copy", - _("tutti.action.clone"), - _("tutti.action.clone.protocol.tip")); - } - - @Override - public void actionPerformed(ActionEvent e) { - TuttiProtocol protocol = model.getProtocol(); - Preconditions.checkNotNull(protocol); - if (log.isInfoEnabled()) { - log.info("Clone protocol: " + protocol.getId()); - } - context.setProtocolId(protocol.getId()); - context.setScreen(TuttiScreen.CLONE_PROTOCOL); - } -} Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java (from rev 220, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/CloneProtocolAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,69 @@ +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.ezware.oxbow.swingbits.util.Preconditions; +import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; +import fr.ifremer.tutti.ui.swing.AbstractTuttiAction; +import fr.ifremer.tutti.ui.swing.TuttiScreen; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class CloneProtocolAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUIHandler> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(CloneProtocolAction.class); + + public CloneProtocolAction(SelectCruiseUIHandler handler) { + super(handler, + "cloneProtocol", + "copy", + _("tutti.action.clone"), + _("tutti.action.clone.protocol.tip")); + } + + @Override + protected void doAction(ActionEvent e) { + TuttiProtocol protocol = getModel().getProtocol(); + Preconditions.checkNotNull(protocol); + if (log.isInfoEnabled()) { + log.info("Clone protocol: " + protocol.getId()); + } + getContext().setProtocolId(protocol.getId()); + getContext().setScreen(TuttiScreen.CLONE_PROTOCOL); + } +} Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,61 @@ +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.AbstractTuttiAction; +import fr.ifremer.tutti.ui.swing.TuttiScreen; +import fr.ifremer.tutti.ui.swing.TuttiUIContext; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class EditCatchesAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUIHandler> { + + private static final long serialVersionUID = 1L; + + public EditCatchesAction(SelectCruiseUIHandler handler) { + super(handler, + "editCatches", + "edit", + _("tutti.action.editCatches"), + _("tutti.action.editCatches.tip") + ); + } + + @Override + protected void doAction(ActionEvent e) { + Preconditions.checkState(getContext().isCruiseFilled()); + getContext().setValidationContext(TuttiUIContext.VALIDATION_CONTEXT_EDIT); + getContext().setScreen(TuttiScreen.EDIT_FISHING_OPERATION); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCruiseAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCruiseAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCruiseAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,62 @@ +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.ezware.oxbow.swingbits.util.Preconditions; +import fr.ifremer.tutti.persistence.entities.data.Cruise; +import fr.ifremer.tutti.ui.swing.AbstractTuttiAction; +import fr.ifremer.tutti.ui.swing.TuttiScreen; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class EditCruiseAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUIHandler> { + + private static final long serialVersionUID = 1L; + + public EditCruiseAction(SelectCruiseUIHandler handler) { + super(handler, + "editCruise", + "edit", + _("tutti.action.edit"), + _("tutti.action.editCruise.tip") + ); + } + + @Override + protected void doAction(ActionEvent e) { + Cruise cruise = getModel().getCruise(); + Preconditions.checkNotNull(cruise); + getContext().setCruiseId(cruise.getId()); + getContext().setScreen(TuttiScreen.EDIT_CRUISE); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCruiseAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProgramAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProgramAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProgramAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,62 @@ +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.ezware.oxbow.swingbits.util.Preconditions; +import fr.ifremer.tutti.persistence.entities.data.Program; +import fr.ifremer.tutti.ui.swing.AbstractTuttiAction; +import fr.ifremer.tutti.ui.swing.TuttiScreen; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class EditProgramAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUIHandler> { + + private static final long serialVersionUID = 1L; + + public EditProgramAction(SelectCruiseUIHandler handler) { + super(handler, + "editProgram", + "edit", + _("tutti.action.edit"), + _("tutti.action.editProgram.tip") + ); + } + + @Override + protected void doAction(ActionEvent e) { + Program program = getModel().getProgram(); + Preconditions.checkNotNull(program); + getContext().setProgramId(program.getId()); + getContext().setScreen(TuttiScreen.EDIT_PROGRAM); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProgramAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -1,70 +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.ezware.oxbow.swingbits.util.Preconditions; -import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; -import fr.ifremer.tutti.ui.swing.TuttiScreen; -import fr.ifremer.tutti.ui.swing.TuttiUIContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.awt.event.ActionEvent; - -import static org.nuiton.i18n.I18n._; - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since 1.0 - */ -public class EditProtocolAction extends AbstractHomeAction { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = LogFactory.getLog(EditProtocolAction.class); - public EditProtocolAction(TuttiUIContext context, - SelectCruiseUIModel model) { - super(context, - model, - "editProtocol", - "edit", - _("tutti.action.edit"), - _("tutti.action.edit.protocol.tip")); - } - - @Override - public void actionPerformed(ActionEvent e) { - TuttiProtocol protocol = model.getProtocol(); - Preconditions.checkNotNull(protocol); - if (log.isInfoEnabled()) { - log.info("Edit protocol: "+protocol.getId()); - } - context.setProtocolId(protocol.getId()); - context.setScreen(TuttiScreen.EDIT_PROTOCOL); - } -} Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java (from rev 220, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditProtocolAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,69 @@ +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.ezware.oxbow.swingbits.util.Preconditions; +import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; +import fr.ifremer.tutti.ui.swing.AbstractTuttiAction; +import fr.ifremer.tutti.ui.swing.TuttiScreen; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class EditProtocolAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUIHandler> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(EditProtocolAction.class); + + public EditProtocolAction(SelectCruiseUIHandler handler) { + super(handler, + "editProtocol", + "edit", + _("tutti.action.edit"), + _("tutti.action.edit.protocol.tip")); + } + + @Override + protected void doAction(ActionEvent e) { + TuttiProtocol protocol = getModel().getProtocol(); + Preconditions.checkNotNull(protocol); + if (log.isInfoEnabled()) { + log.info("Edit protocol: " + protocol.getId()); + } + getContext().setProtocolId(protocol.getId()); + getContext().setScreen(TuttiScreen.EDIT_PROTOCOL); + } +} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -1,70 +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.ezware.oxbow.swingbits.util.Preconditions; -import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; -import fr.ifremer.tutti.ui.swing.TuttiUIContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.awt.event.ActionEvent; - -import static org.nuiton.i18n.I18n._; - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since 1.0 - */ -public class ExportProtocolAction extends AbstractHomeAction { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = - LogFactory.getLog(ExportProtocolAction.class); - - public ExportProtocolAction(TuttiUIContext context, - SelectCruiseUIModel model) { - super(context, - model, - "exportProtocol", - "export", - _("tutti.action.export"), - _("tutti.action.export.protocol.tip")); - } - - @Override - public void actionPerformed(ActionEvent e) { - TuttiProtocol protocol = model.getProtocol(); - Preconditions.checkNotNull(protocol); - - if (log.isInfoEnabled()) { - log.info("Export protocol: " + protocol.getId()); - } - } -} Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java (from rev 220, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ExportProtocolAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,68 @@ +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.ezware.oxbow.swingbits.util.Preconditions; +import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; +import fr.ifremer.tutti.ui.swing.AbstractTuttiAction; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class ExportProtocolAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUIHandler> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(ExportProtocolAction.class); + + public ExportProtocolAction(SelectCruiseUIHandler handler) { + super(handler, + "exportProtocol", + "export", + _("tutti.action.export"), + _("tutti.action.export.protocol.tip")); + } + + @Override + protected void doAction(ActionEvent e) { + TuttiProtocol protocol = getModel().getProtocol(); + Preconditions.checkNotNull(protocol); + + if (log.isInfoEnabled()) { + log.info("Export protocol: " + protocol.getId()); + } + } +} Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -1,65 +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.TuttiUIContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.awt.event.ActionEvent; - -import static org.nuiton.i18n.I18n._; - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since 1.0 - */ -public class ImportProtocolAction extends AbstractHomeAction { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = - LogFactory.getLog(ImportProtocolAction.class); - - public ImportProtocolAction(TuttiUIContext context, - SelectCruiseUIModel model) { - super(context, - model, - "importProtocol", - "import", - _("tutti.action.import"), - _("tutti.action.import.protocol.tip")); - } - - @Override - public void actionPerformed(ActionEvent e) { - if (log.isInfoEnabled()) { - log.info("TODO Import protocol!"); - } - } -} Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java (from rev 220, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java) =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ImportProtocolAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,63 @@ +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.AbstractTuttiAction; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class ImportProtocolAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUIHandler> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(ImportProtocolAction.class); + + public ImportProtocolAction(SelectCruiseUIHandler handler) { + super(handler, + "importProtocol", + "import", + _("tutti.action.import"), + _("tutti.action.import.protocol.tip")); + } + + @Override + protected void doAction(ActionEvent e) { + if (log.isInfoEnabled()) { + log.info("TODO Import protocol!"); + } + } +} Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewCruiseAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewCruiseAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewCruiseAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,58 @@ +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.AbstractTuttiAction; +import fr.ifremer.tutti.ui.swing.TuttiScreen; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class NewCruiseAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUIHandler> { + + private static final long serialVersionUID = 1L; + + public NewCruiseAction(SelectCruiseUIHandler handler) { + super(handler, + "newCruise", + "add", + _("tutti.action.new"), + _("tutti.action.newCruise.tip") + ); + } + + @Override + protected void doAction(ActionEvent e) { + getContext().setCruiseId(null); + getContext().setScreen(TuttiScreen.EDIT_CRUISE); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewCruiseAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProgramAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProgramAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProgramAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,59 @@ +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.AbstractTuttiAction; +import fr.ifremer.tutti.ui.swing.TuttiScreen; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class NewProgramAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUIHandler> { + + private static final long serialVersionUID = 1L; + + public NewProgramAction(SelectCruiseUIHandler handler) { + super(handler, + "newProgram", + "add", + _("tutti.action.new"), + _("tutti.action.newProgram.tip") + ); + } + + @Override + protected void doAction(ActionEvent e) { + getContext().setProgramId(null); + getContext().setCruiseId(null); + getContext().setScreen(TuttiScreen.EDIT_PROGRAM); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProgramAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProtocolAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProtocolAction.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/NewProtocolAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -24,8 +24,8 @@ * #L% */ +import fr.ifremer.tutti.ui.swing.AbstractTuttiAction; import fr.ifremer.tutti.ui.swing.TuttiScreen; -import fr.ifremer.tutti.ui.swing.TuttiUIContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -39,17 +39,15 @@ * @author tchemit <chemit@codelutin.com> * @since 1.0 */ -public class NewProtocolAction extends AbstractHomeAction { +public class NewProtocolAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUIHandler> { private static final long serialVersionUID = 1L; /** Logger. */ private static final Log log = LogFactory.getLog(NewProtocolAction.class); - public NewProtocolAction(TuttiUIContext context, - SelectCruiseUIModel model) { - super(context, - model, + public NewProtocolAction(SelectCruiseUIHandler handler) { + super(handler, "newProtocol", "add", _("tutti.action.new"), @@ -57,11 +55,11 @@ } @Override - public void actionPerformed(ActionEvent e) { + protected void doAction(ActionEvent e) { if (log.isInfoEnabled()) { log.info("New protocol"); } - context.setProtocolId(null); - context.setScreen(TuttiScreen.EDIT_PROTOCOL); + getContext().setProtocolId(null); + getContext().setScreen(TuttiScreen.EDIT_PROTOCOL); } } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2013-01-18 12:40:25 UTC (rev 222) @@ -41,13 +41,15 @@ #editProgramButton { enabled: {model.isProgramFound()}; - text: "tutti.action.edit"; - actionIcon: edit; + action: {editProgramAction}; + /*text: "tutti.action.edit"; + actionIcon: edit;*/ } #newProgramButton { - text: "tutti.action.new"; - actionIcon: add; + action: {newProgramAction}; + /*text: "tutti.action.new"; + actionIcon: add;*/ } #cruiseLabel { @@ -63,14 +65,16 @@ #editCruiseButton { enabled: {model.isProgramFound() && model.isCruiseFound()}; - text: "tutti.action.edit"; - actionIcon: edit; + action: {editCruiseAction} + /*text: "tutti.action.edit"; + actionIcon: edit;*/ } #newCruiseButton { - actionIcon: add; enabled: {model.isProgramFound()}; - text: "tutti.action.new"; + action: {newCruiseAction}; + /*actionIcon: add; + text: "tutti.action.new";*/ } #protocolLabel { @@ -84,18 +88,26 @@ enabled: {!protocolCombobox.isEmpty()}; } +#newProtocolComboBox { + model: {handler.newComboModel(newProtocolAction, importProtocolAction)}; + renderer: {new ActionListCellRenderer()}; +} #editProtocolComboBox { + model: {handler.newComboModel(editProtocolAction, cloneProtocolAction, exportProtocolAction)}; enabled: {model.isProtocolFound()}; + renderer: {new ActionListCellRenderer()}; } -#fillFishingOperationsButton { - text: "tutti.action.fillCatches"; - enabled: {uiContext.isCruiseContextFilled()}; +#editCatchesButton { + action: {editCatchesAction}; + enabled: {uiContext.isCruiseFilled()}; + /*text: "tutti.action.fillCatches";*/ actionIcon: edit; } -#validateFishingOperationsButton { - text: "tutti.action.validateCatches"; - enabled: {uiContext.isCruiseContextFilled()}; +#validateCatchesButton { + action: {validateCatchesAction}; + enabled: {uiContext.isCruiseFilled()}; + /*text: "tutti.action.validateCatches";*/ actionIcon: validate; } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2013-01-18 12:40:25 UTC (rev 222) @@ -29,6 +29,7 @@ fr.ifremer.tutti.persistence.entities.data.Cruise fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol fr.ifremer.tutti.ui.swing.TuttiUIContext + fr.ifremer.tutti.ui.swing.util.ActionListCellRenderer jaxx.runtime.swing.editor.bean.BeanComboBox @@ -58,6 +59,22 @@ <SelectCruiseUIModel id='model' initializer='getContextValue(SelectCruiseUIModel.class)'/> + <NewProgramAction id='newProgramAction' constructorParams='handler'/> + <EditProgramAction id='editProgramAction' constructorParams='handler'/> + + <NewCruiseAction id='newCruiseAction' constructorParams='handler'/> + <EditCruiseAction id='editCruiseAction' constructorParams='handler'/> + + <NewProtocolAction id='newProtocolAction' constructorParams='handler'/> + <ImportProtocolAction id='importProtocolAction' constructorParams='handler'/> + + <EditProtocolAction id='editProtocolAction' constructorParams='handler'/> + <CloneProtocolAction id='cloneProtocolAction' constructorParams='handler'/> + <ExportProtocolAction id='exportProtocolAction' constructorParams='handler'/> + + <EditCatchesAction id='editCatchesAction' constructorParams='handler'/> + <ValidateCatchesAction id='validateCatchesAction' constructorParams='handler'/> + <Table fill='both' constraints='BorderLayout.CENTER'> <row> <cell anchor='west'> @@ -69,10 +86,10 @@ </cell> <cell> <JPanel layout='{new GridLayout(1,0)}'> - <JButton id='editProgramButton' - onActionPerformed='handler.showSelectedProgram()'/> - <JButton id='newProgramButton' - onActionPerformed='handler.showNewProgram()'/> + <JButton id='editProgramButton'/> + <!--onActionPerformed='handler.showSelectedProgram()'/>--> + <JButton id='newProgramButton'/> + <!--onActionPerformed='handler.showNewProgram()'/>--> </JPanel> </cell> </row> @@ -86,10 +103,10 @@ </cell> <cell> <JPanel layout='{new GridLayout(1,0)}'> - <JButton id='editCruiseButton' - onActionPerformed='handler.showSelectedCruise()'/> - <JButton id='newCruiseButton' - onActionPerformed='handler.showNewCruise()'/> + <JButton id='editCruiseButton'/> + <!--onActionPerformed='handler.showSelectedCruise()'/>--> + <JButton id='newCruiseButton'/> + <!--onActionPerformed='handler.showNewCruise()'/>--> </JPanel> </cell> </row> @@ -105,21 +122,20 @@ <JPanel layout='{new GridLayout(1,0)}'> <JComboBox id='editProtocolComboBox' onMouseEntered='if (editProtocolComboBox.isEnabled()) { editProtocolComboBox.showPopup(); }' - onActionPerformed='handler.showSelectedProtocol(event)'/> + onActionPerformed='handler.startExistingProtocolAction(event)'/> <JComboBox id='newProtocolComboBox' onMouseEntered='newProtocolComboBox.showPopup()' - onActionPerformed='handler.showNewProtocol(event)'/> - + onActionPerformed='handler.startNewProtocolAction(event)'/> </JPanel> </cell> </row> <row> <cell columns='3'> <JPanel layout='{new GridLayout(1,0)}'> - <JButton id='fillFishingOperationsButton' - onActionPerformed='handler.showFillCatches()'/> - <JButton id='validateFishingOperationsButton' - onActionPerformed='handler.showValidateCatches()'/> + <JButton id='editCatchesButton'/> + <!--onActionPerformed='handler.showFillCatches()'/>--> + <JButton id='validateCatchesButton'/> + <!--onActionPerformed='handler.showValidateCatches()'/>--> </JPanel> </cell> </row> Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -31,7 +31,6 @@ import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.ui.swing.AbstractTuttiUIHandler; -import fr.ifremer.tutti.ui.swing.TuttiScreen; import fr.ifremer.tutti.ui.swing.TuttiUIContext; import jaxx.runtime.swing.editor.bean.BeanComboBox; import org.apache.commons.collections.CollectionUtils; @@ -39,13 +38,7 @@ import org.apache.commons.logging.LogFactory; import javax.swing.Action; -import javax.swing.DefaultComboBoxModel; -import javax.swing.DefaultListCellRenderer; -import javax.swing.Icon; import javax.swing.JComboBox; -import javax.swing.JList; -import javax.swing.border.EmptyBorder; -import java.awt.Component; import java.awt.event.ActionEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -74,7 +67,7 @@ } @Override - protected SelectCruiseUIModel getModel() { + public SelectCruiseUIModel getModel() { return ui.getModel(); } @@ -183,21 +176,18 @@ model.getProtocols(), model.getProtocol()); - DefaultComboBoxModel newProtocolActions = new DefaultComboBoxModel(); - newProtocolActions.addElement(new NewProtocolAction(context, model)); - newProtocolActions.addElement(new ImportProtocolAction(context, model)); - JComboBox newProtocolComboBox = ui.getNewProtocolComboBox(); - newProtocolComboBox.setModel(newProtocolActions); - newProtocolComboBox.setRenderer(new ActionListCellRenderer()); +// JComboBox newProtocolComboBox = ui.getNewProtocolComboBox(); +// DefaultComboBoxModel newProtocolActions = (DefaultComboBoxModel) newProtocolComboBox.getModel(); +// newProtocolActions.addElement(new NewProtocolAction(this)); +// newProtocolActions.addElement(new ImportProtocolAction(this)); +// +// JComboBox editProtocolComboBox = ui.getEditProtocolComboBox(); +// DefaultComboBoxModel editProtocolActions = (DefaultComboBoxModel) editProtocolComboBox.getModel(); +// editProtocolActions.addElement(new EditSelectedProtocolAction(this)); +// editProtocolActions.addElement(new CloneProtocolAction(this)); +// editProtocolActions.addElement(new ExportProtocolAction(this)); +// editProtocolComboBox.setModel(editProtocolActions); - DefaultComboBoxModel editProtocolActions = new DefaultComboBoxModel(); - editProtocolActions.addElement(new EditProtocolAction(context, model)); - editProtocolActions.addElement(new CloneProtocolAction(context, model)); - editProtocolActions.addElement(new ExportProtocolAction(context, model)); - JComboBox editProtocolComboBox = ui.getEditProtocolComboBox(); - editProtocolComboBox.setModel(editProtocolActions); - editProtocolComboBox.setRenderer(new ActionListCellRenderer()); - // newProtocolCombo.addMouseListener(new MouseAdapter() { // // @Override @@ -274,6 +264,9 @@ context.setProtocolId(newValue == null ? null : newValue.getId()); } }); + + ui.applyDataBinding(SelectCruiseUI.BINDING_EDIT_PROGRAM_BUTTON_ENABLED); + ui.applyDataBinding(SelectCruiseUI.BINDING_EDIT_CRUISE_BUTTON_ENABLED); } @Override @@ -287,136 +280,17 @@ } } - public void showFillCatches() { - context.setValidationContext(TuttiUIContext.VALIDATION_CONTEXT_EDIT); - context.setScreen(TuttiScreen.EDIT_FISHING_OPERATION); - } - - public void showValidateCatches() { - context.setValidationContext(TuttiUIContext.VALIDATION_CONTEXT_VALIDATE); - context.setScreen(TuttiScreen.EDIT_FISHING_OPERATION); - } - - public void showSelectedProgram() { - - Program program = getModel().getProgram(); - context.setProgramId(program.getId()); - context.setScreen(TuttiScreen.EDIT_PROGRAM); - } - - public void showNewProgram() { - context.setProgramId(null); - context.setCruiseId(null); - context.setScreen(TuttiScreen.EDIT_PROGRAM); - } - - public void showSelectedCruise() { - Cruise cruise = getModel().getCruise(); - context.setCruiseId(cruise.getId()); - context.setScreen(TuttiScreen.EDIT_CRUISE); - } - - public void showNewCruise() { - context.setCruiseId(null); - context.setScreen(TuttiScreen.EDIT_CRUISE); - } - - public void showSelectedProtocol(ActionEvent event) { + public void startExistingProtocolAction(ActionEvent event) { JComboBox newProtocolCombo = (JComboBox) event.getSource(); Action selectedAction = (Action) newProtocolCombo.getSelectedItem(); selectedAction.actionPerformed(event); -// TuttiProtocol protocol = getModel().getProtocol(); -// Preconditions.checkNotNull(protocol, -// "Protocol can not be null for a edit action"); -// switch (selectedAction) { -// case EDIT: -// context.setProtocolId(protocol.getId()); -// context.setScreen(TuttiScreen.EDIT_PROTOCOL); -// break; -// -// case CLONE: -// context.setProtocolId(protocol.getId()); -// context.setScreen(TuttiScreen.CLONE_PROTOCOL); -// break; -// -// case EXPORT: -// //TODO kmorin 20130115 import protocol -// } } - public void showNewProtocol(ActionEvent event) { + public void startNewProtocolAction(ActionEvent event) { JComboBox newProtocolCombo = (JComboBox) event.getSource(); Action selectedAction = (Action) newProtocolCombo.getSelectedItem(); selectedAction.actionPerformed(event); -// switch (selectedAction) { -// case NEW: -// context.setProtocolId(null); -// context.setScreen(TuttiScreen.EDIT_PROTOCOL); -// break; -// case IMPORT: -// //TODO kmorin 20130115 import protocol -// } } - -// protected enum NewProtocolAction { -// -// NEW(n_("tutti.action.new"), "add"), -// EDIT(n_("tutti.action.edit"), "edit"), -// CLONE(n_("tutti.action.clone"), "copy"), -// IMPORT(n_("tutti.action.import"), "import"), -// EXPORT(n_("tutti.action.export"), "export"); -// -// protected String label; -// -// protected String iconPath; -// -// protected ImageIcon icon; -// -// private NewProtocolAction(String label, String iconPath) { -// this.label = label; -// this.iconPath = iconPath; -// } -// -// public String getLabel() { -// return label; -// } -// -// public ImageIcon getIcon() { -// if (icon == null) { -// icon = SwingUtil.createActionIcon(iconPath); -// } -// return icon; -// } -// -// @Override -// public String toString() { -// return _(label); -// } -// -// } - - public static 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 = (Action) value; - setIcon((Icon) action.getValue(Action.LARGE_ICON_KEY)); - setText((String) action.getValue(Action.SHORT_DESCRIPTION)); - setToolTipText((String) action.getValue(Action.LONG_DESCRIPTION)); - setBorder(border); - return result; - } - } } Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ValidateCatchesAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ValidateCatchesAction.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ValidateCatchesAction.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,61 @@ +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.AbstractTuttiAction; +import fr.ifremer.tutti.ui.swing.TuttiScreen; +import fr.ifremer.tutti.ui.swing.TuttiUIContext; + +import java.awt.event.ActionEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class ValidateCatchesAction extends AbstractTuttiAction<SelectCruiseUIModel, SelectCruiseUIHandler> { + + private static final long serialVersionUID = 1L; + + public ValidateCatchesAction(SelectCruiseUIHandler handler) { + super(handler, + "validateCatches", + "validate", + _("tutti.action.validateCatches"), + _("tutti.action.validateCatches.tip") + ); + } + + @Override + protected void doAction(ActionEvent e) { + Preconditions.checkState(getContext().isCruiseFilled()); + getContext().setValidationContext(TuttiUIContext.VALIDATION_CONTEXT_VALIDATE); + getContext().setScreen(TuttiScreen.EDIT_FISHING_OPERATION); + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/ValidateCatchesAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -324,7 +324,7 @@ } @Override - protected EditFishingOperationUIModel getModel() { + public EditFishingOperationUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -177,7 +177,7 @@ } @Override - protected FishingOperationsUIModel getModel() { + public FishingOperationsUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -127,7 +127,7 @@ } @Override - protected EditCatchesUIModel getModel() { + public EditCatchesUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -176,7 +176,7 @@ //------------------------------------------------------------------------// @Override - protected AccidentalBatchUIModel getModel() { + public AccidentalBatchUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -179,7 +179,7 @@ //------------------------------------------------------------------------// @Override - protected BenthosBatchUIModel getModel() { + public BenthosBatchUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/macrowaste/MacroWasteBatchUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -181,7 +181,7 @@ //------------------------------------------------------------------------// @Override - protected MacroWasteBatchUIModel getModel() { + public MacroWasteBatchUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -177,7 +177,7 @@ //------------------------------------------------------------------------// @Override - protected PlanktonBatchUIModel getModel() { + public PlanktonBatchUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -373,7 +373,7 @@ //------------------------------------------------------------------------// @Override - protected SpeciesBatchUIModel getModel() { + public SpeciesBatchUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -144,7 +144,7 @@ //------------------------------------------------------------------------// @Override - protected SpeciesFrequencyUIModel getModel() { + public SpeciesFrequencyUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -169,7 +169,7 @@ } @Override - protected CreateSpeciesBatchUIModel getModel() { + public CreateSpeciesBatchUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -140,7 +140,7 @@ //------------------------------------------------------------------------// @Override - protected SplitSpeciesBatchUIModel getModel() { + public SplitSpeciesBatchUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/environment/EnvironmentTabUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -121,7 +121,7 @@ //------------------------------------------------------------------------// @Override - protected EnvironmentTabUIModel getModel() { + public EnvironmentTabUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/gearshooting/GearShootingTabUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -124,7 +124,7 @@ //------------------------------------------------------------------------// @Override - protected GearShootingTabUIModel getModel() { + public GearShootingTabUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/hydrology/HydrologyTabUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -140,7 +140,7 @@ //------------------------------------------------------------------------// @Override - protected HydrologyTabUIModel getModel() { + public HydrologyTabUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -126,7 +126,7 @@ } @Override - protected EditProgramUIModel getModel() { + public EditProgramUIModel getModel() { return ui.getModel(); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2013-01-18 12:40:25 UTC (rev 222) @@ -163,7 +163,7 @@ //------------------------------------------------------------------------// @Override - protected EditProtocolUIModel getModel() { + public EditProtocolUIModel getModel() { return ui.getModel(); } Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ActionListCellRenderer.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ActionListCellRenderer.java (rev 0) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ActionListCellRenderer.java 2013-01-18 12:40:25 UTC (rev 222) @@ -0,0 +1,61 @@ +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.JList; +import javax.swing.border.EmptyBorder; +import java.awt.Component; + +/** +* TODO +* +* @author tchemit <chemit@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 = (Action) value; + 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; + } +} Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/ActionListCellRenderer.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties =================================================================== --- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-01-18 11:33:30 UTC (rev 221) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-01-18 12:40:25 UTC (rev 222) @@ -5,27 +5,35 @@ tutti.action.cancel=Annuler tutti.action.casino-import=Import Casino tutti.action.clone=Cloner -tutti.action.clone.protocol.tip= +tutti.action.clone.protocol.tip=Dupliquer le protocole sélectionné tutti.action.close=Fermer tutti.action.configuration=Configuration tutti.action.configuration.tip=Configurer Tutti tutti.action.createSpeciesBatch=Créer un lot pour une espèce tutti.action.edit=Editer -tutti.action.edit.protocol.tip= +tutti.action.edit.protocol.tip=Éditer le protocole sélectionné +tutti.action.editCatches=Saisir les captures +tutti.action.editCatches.tip=Saisir des captures +tutti.action.editCruise=Campagne +tutti.action.editCruise.tip=Éditer la campagne sélectionnée +tutti.action.editProgram=Programme +tutti.action.editProgram.tip=Éditer le programme sélectionné +tutti.action.editProtocol=Protocole +tutti.action.editProtocol.tip= tutti.action.exit=Quitter tutti.action.exit.tip=Quitter l'application tutti.action.export=Exporter -tutti.action.export.protocol.tip= -tutti.action.fillCatches=Saisir les captures -tutti.action.fillCatches.tip=Saisir des captures +tutti.action.export.protocol.tip=Exporter le protocole sélectionné tutti.action.generate=Générer tutti.action.generateCampaignName=Générer le nom tutti.action.import=Importer -tutti.action.import.protocol.tip= +tutti.action.import.protocol.tip=Importer un protocole tutti.action.manageProtocol=Protocole tutti.action.manageProtocol.tip=Gérer les protocoles tutti.action.new=Nouveau -tutti.action.new.protocol.tip= +tutti.action.new.protocol.tip=Créer un nouve protocole +tutti.action.newCruise.tip=Créer une nouvelle campagne +tutti.action.newProgram.tip=Créer une nouvelle série de campagne tutti.action.pupitri-import=Import PUPITRI tutti.action.reload.actions=Recharger les actions tutti.action.reload.application=Recharger l'application @@ -38,8 +46,8 @@ tutti.action.removeSpeciesSubBatch.tip=Supprimer tous les lots fils du lot sélectionné tutti.action.reset.fishingOperationValidState=Réinitialiser tutti.action.save=Enregistrer -tutti.action.selectCampaign=Campagne -tutti.action.selectCampaign.tip=Sélectionner la campagne à utiliser +tutti.action.selectCruise=Campagne +tutti.action.selectCruise.tip=Sélectionner la campagne à utiliser tutti.action.site=Site tutti.action.site.tip=Accéder au site du projet Tutti tutti.action.splitSpeciesBatch=Catégoriser le lot