mailman.cloud.codelutin.com
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Observe-commits

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2013 -----
  • December
  • November
  • October
  • September
observe-commits@list.forge.codelutin.com

April 2018

  • 1 participants
  • 53 discussions
[Git][ultreiaio/ird-observe][develop] Make change focus action works again
by Tony CHEMIT 07 Apr '18

07 Apr '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 8c4e21bd by Tony CHEMIT at 2018-04-07T12:53:18Z Make change focus action works again - - - - - 2 changed files: - client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java - client/src/main/java/fr/ird/observe/client/ui/util/ObserveBlockingLayerUI.java Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java +++ b/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java @@ -27,6 +27,7 @@ import fr.ird.observe.client.configuration.ClientConfig; import fr.ird.observe.client.db.ClientDataContext; import fr.ird.observe.client.db.ObserveSwingDataSource; import fr.ird.observe.client.ui.actions.UIActionSupport; +import fr.ird.observe.client.ui.actions.main.global.ChangeFocusGlobalUIAction; import fr.ird.observe.client.ui.content.ContentUI; import fr.ird.observe.client.ui.content.ContentUIManager; import fr.ird.observe.client.ui.content.ObserveActionMap; @@ -441,36 +442,12 @@ public class ObserveMainUIInitializer { init(ui.getNavigationUI().getTree()); ui.getNavigationView().setRightDecoration(ui.getNavigationUI().getToolbar()); -// ui.getNavigationView().addComponentListener(new ComponentAdapter() { -// -// @Override -// public void componentResized(ComponentEvent e) { -// -// JComponent source = (JComponent) e.getSource(); -// -// NavigationTreeHeader actions = ui.getNavigationUI(); -// -// Dimension preferredLayoutSize = actions.getLayout().preferredLayoutSize(actions); -// -// Dimension showLonglineSize = actions.getShowLongline().getSize(); -// Dimension showSeineSize = actions.getShowSeine().getSize(); -// Dimension showReferential = actions.getShowReferential().getSize(); -// Dimension showEmpty = actions.getShowEmptyProgram().getSize(); -// int minWidth = 18 + (int) Math.max(showLonglineSize.getWidth() + showSeineSize.getWidth(), showReferential.getWidth() + showEmpty.getWidth()); -// source.setMinimumSize(new Dimension(minWidth, (int) source.getSize().getHeight())); -// log.debug("Header resized to minumun: " + source.getMinimumSize()); -// -// int maxWidth = ui.getNavigationView().getWidth() - 10; -// -// int currentWidth = (int) preferredLayoutSize.getWidth(); -// int height = 32; -// if (currentWidth > maxWidth) { -// height += 32; -// } -// actions.setPreferredSize(new Dimension(maxWidth, height)); -// -// } -// }); + ChangeFocusGlobalUIAction action = (ChangeFocusGlobalUIAction) Objects.requireNonNull(actionMap.get(ChangeFocusGlobalUIAction.ACTION_NAME)); + + // register this action since there is no editor on which attach this action + ui.getRootPane().getActionMap().put(ChangeFocusGlobalUIAction.ACTION_NAME, action); + ui.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(action.getAcceleratorKey(), ChangeFocusGlobalUIAction.ACTION_NAME); + } protected void init(ObserveActionMap actionMap, AbstractButton editor) { ===================================== client/src/main/java/fr/ird/observe/client/ui/util/ObserveBlockingLayerUI.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/util/ObserveBlockingLayerUI.java +++ b/client/src/main/java/fr/ird/observe/client/ui/util/ObserveBlockingLayerUI.java @@ -22,25 +22,12 @@ package fr.ird.observe.client.ui.util; * #L% */ -import com.google.common.collect.ImmutableSet; -import fr.ird.observe.client.ObserveSwingApplicationContext; -import fr.ird.observe.client.ui.actions.UIActionSupport; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.awt.event.MouseWheelEvent; -import java.util.Set; -import javax.swing.Action; -import javax.swing.ActionMap; -import javax.swing.InputMap; -import javax.swing.JComponent; -import javax.swing.KeyStroke; -import javax.swing.SwingUtilities; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.jdesktop.jxlayer.JXLayer; import org.nuiton.jaxx.runtime.swing.BlockingLayerUI; +import javax.swing.JComponent; +import java.awt.event.MouseWheelEvent; + /** * Created on 09/11/16. * View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/8c4e21bd10a0f0d5c155d4f92bb… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/8c4e21bd10a0f0d5c155d4f92bb… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Fix widget decorator labels
by Tony CHEMIT 07 Apr '18

07 Apr '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: e782f414 by Tony CHEMIT at 2018-04-07T12:08:18Z Fix widget decorator labels - - - - - 2 changed files: - client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java - dto/src/main/java/fr/ird/observe/dto/decoration/ObserveI18nLabelsBuilder.java Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java @@ -24,7 +24,6 @@ package fr.ird.observe.client.ui.content; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; -import fr.ird.observe.dto.I18nEnumHelper; import fr.ird.observe.client.ObserveSwingApplicationContext; import fr.ird.observe.client.ui.ObserveKeyStrokes; import fr.ird.observe.client.ui.actions.UIActionSupport; @@ -42,53 +41,15 @@ import fr.ird.observe.client.ui.util.BooleanEditor; import fr.ird.observe.client.ui.util.UIHelper; import fr.ird.observe.client.ui.util.tripMap.ObserveMapPane; import fr.ird.observe.client.validation.ObserveSwingValidator; +import fr.ird.observe.dto.I18nEnumHelper; +import fr.ird.observe.dto.IdDto; import fr.ird.observe.dto.decoration.DecoratorService; import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper; import fr.ird.observe.dto.decoration.ObserveI18nLabelsBuilder; import fr.ird.observe.dto.decoration.decorators.DataReferenceDecorator; import fr.ird.observe.dto.decoration.decorators.ReferentialReferenceDecorator; -import fr.ird.observe.dto.IdDto; import fr.ird.observe.dto.reference.DataDtoReference; import fr.ird.observe.dto.reference.ReferentialDtoReference; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.awt.event.ItemEvent; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.EnumSet; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import javax.swing.AbstractAction; -import javax.swing.AbstractButton; -import javax.swing.Action; -import javax.swing.InputMap; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JFormattedTextField; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JScrollBar; -import javax.swing.JSpinner; -import javax.swing.JTabbedPane; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.KeyStroke; -import javax.swing.ListCellRenderer; -import javax.swing.SwingUtilities; -import javax.swing.border.LineBorder; -import javax.swing.table.TableCellEditor; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; @@ -117,6 +78,45 @@ import org.nuiton.jaxx.widgets.temperature.TemperatureEditorConfig; import org.nuiton.jaxx.widgets.temperature.TemperatureFormat; import org.nuiton.util.DateUtil; +import javax.swing.AbstractAction; +import javax.swing.AbstractButton; +import javax.swing.Action; +import javax.swing.InputMap; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JFormattedTextField; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JScrollBar; +import javax.swing.JSpinner; +import javax.swing.JTabbedPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.KeyStroke; +import javax.swing.ListCellRenderer; +import javax.swing.SwingUtilities; +import javax.swing.border.LineBorder; +import javax.swing.table.TableCellEditor; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.ItemEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; import static org.nuiton.i18n.I18n.t; @@ -404,8 +404,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>> log.debug("init combobox for " + beanComboBox.getBeanType()); } Class referenceType = beanComboBox.getBeanType(); - - beanComboBox.setI18nLabelBuilder(new ObserveI18nLabelsBuilder(referenceType)); + beanComboBox.setI18nLabelBuilder(ObserveI18nLabelsBuilder.createFromReferenceType(referenceType)); beanComboBox.setI18nPrefix("observe.common."); beanComboBox.setMinimumSize(new Dimension(0, 24)); beanComboBox.getResetButton().setToolTipText(beanComboBox.getResetButton().getToolTipText() + " (ctrl + R)"); @@ -461,7 +460,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>> log.debug("init list for " + beanList.getBeanType()); Class referenceType = beanList.getBeanType(); - beanList.setI18nLabelBuilder(new ObserveI18nLabelsBuilder(referenceType)); + beanList.setI18nLabelBuilder(ObserveI18nLabelsBuilder.createFromReferenceType(referenceType)); if (ReferentialDtoReference.class.isAssignableFrom(referenceType)) { prepareReferentialEntityList(referenceType, beanList); } else { @@ -474,7 +473,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>> beanList.setI18nPrefix("observe.common."); Class referenceType = beanList.getBeanType(); - beanList.setI18nLabelBuilder(new ObserveI18nLabelsBuilder(referenceType)); + beanList.setI18nLabelBuilder(ObserveI18nLabelsBuilder.createFromReferenceType(referenceType)); beanList.getAddButton().setFocusable(false); beanList.getRemoveButton().setFocusable(false); ===================================== dto/src/main/java/fr/ird/observe/dto/decoration/ObserveI18nLabelsBuilder.java ===================================== --- a/dto/src/main/java/fr/ird/observe/dto/decoration/ObserveI18nLabelsBuilder.java +++ b/dto/src/main/java/fr/ird/observe/dto/decoration/ObserveI18nLabelsBuilder.java @@ -26,6 +26,9 @@ import com.google.common.collect.ImmutableMap; import fr.ird.observe.dto.referential.I18nReferentialDto; import fr.ird.observe.dto.referential.ReferentialDto; import java.util.Map; +import java.util.Objects; + +import fr.ird.observe.spi.DtoModelHelper; import org.nuiton.decorator.MultiJXPathDecorator; import org.nuiton.jaxx.widgets.select.I18nLabelsBuilder; @@ -70,6 +73,11 @@ public class ObserveI18nLabelsBuilder extends I18nLabelsBuilder { .put("country", "") .build(); + public static ObserveI18nLabelsBuilder createFromReferenceType(Class referenceType) { + Class dtoType = DtoModelHelper.getReferencesInitializer().getReferenceToDtoClassMapping().forAny(Objects.requireNonNull(referenceType)); + return new ObserveI18nLabelsBuilder(Objects.requireNonNull(dtoType)); + } + public ObserveI18nLabelsBuilder(Class beanType) { super(beanType); } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/e782f414b36804e17d3409a8965… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/e782f414b36804e17d3409a8965… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][feature/v8_maquette] 9 commits: Fix some navigation issues (scrollpane does not work, on select node is not…
by Tony CHEMIT 06 Apr '18

06 Apr '18
Tony CHEMIT pushed to branch feature/v8_maquette at ultreiaio / ird-observe Commits: 4eb6a93b by Tony CHEMIT at 2018-04-06T07:04:58Z Fix some navigation issues (scrollpane does not work, on select node is not expand) + review navigation ui design - - - - - 5a189e8b by Tony CHEMIT at 2018-04-06T08:07:07Z fix update node in navigation on save, create or delete - - - - - 2c763489 by Tony CHEMIT at 2018-04-06T12:50:05Z Ajout de la donnée observe_longline.ActivityLogbook (See #907) Maquettage - - - - - d9785b05 by Tony CHEMIT at 2018-04-06T12:50:05Z Ajout de la donnée observe_longline.SetLogbook (See #909) - - - - - a5f8091a by Tony CHEMIT at 2018-04-06T12:50:05Z Ajout de la donnée observe_longline.CatchLogbook (See #911) Maquettage - - - - - a4f91c7f by Tony CHEMIT at 2018-04-06T12:50:05Z update i18n (see #911, see #907, see #909) - - - - - 72e81617 by Tony CHEMIT at 2018-04-06T12:50:05Z Ajout de la donnée observe_longline.Landing (See #912) Maquettage - - - - - 84ab7724 by Tony CHEMIT at 2018-04-06T12:50:05Z Ajout de la donnée observe_longline.SampleLogbook (see #913) Maquettage - - - - - a86d092c by Tony CHEMIT at 2018-04-06T16:28:17Z Réusinage de la donnée observe_longline.Trip (See #904) Maquettage - - - - - 30 changed files: - client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx - client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseAndCreateUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseOpenUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/GoDownUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/GoUpUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivityLonglinesUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivitySeinesUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveMultipleDataUIActionSupport.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveRoutesUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveSingleDataUIActionSupport.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripsUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/ReOpenUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/ResetEditUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/SelectNodeUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/main/global/ChangeFocusGlobalUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/navigation/GotoActionSupport.java - client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/storage/ReloadStorageAction.java - client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/content/ContentUIModel.java - client/src/main/java/fr/ird/observe/client/ui/content/ObserveFocusManager.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUI.jaxx - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUI.jcss - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUIHandler.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUIModel.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUI.jaxx - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUI.jcss - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUIHandler.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUIModel.java The diff was not included because it is too large. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/2dc500e7dae6137fa34b5d6d86… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/2dc500e7dae6137fa34b5d6d86… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] fix update node in navigation on save, create or delete
by Tony CHEMIT 06 Apr '18

06 Apr '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 5a189e8b by Tony CHEMIT at 2018-04-06T08:07:07Z fix update node in navigation on save, create or delete - - - - - 3 changed files: - client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUI.jaxx - client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUIModel.java Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUI.jaxx ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUI.jaxx +++ b/client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUI.jaxx @@ -22,10 +22,10 @@ <fr.ird.observe.client.ui.content.ContentUI abstract='true' superGenericType='E, U' - genericType='E extends IdDto, U extends ContentOpenableUI&lt;E, U&gt;'> + genericType='E extends DataDto, U extends ContentOpenableUI&lt;E, U&gt;'> <import> - fr.ird.observe.dto.IdDto + fr.ird.observe.dto.data.DataDto fr.ird.observe.client.ui.actions.content.CloseAndCreateUIAction fr.ird.observe.client.ui.actions.content.CloseOpenUIAction ===================================== client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUIHandler.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUIHandler.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUIHandler.java @@ -6,15 +6,15 @@ * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public + * + * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% @@ -24,40 +24,38 @@ package fr.ird.observe.client.ui.content.open; import fr.ird.observe.client.ObserveSwingApplicationContext; import fr.ird.observe.client.db.ObserveSwingDataSource; import fr.ird.observe.client.db.constants.DataContextType; -import fr.ird.observe.client.ui.util.UIHelper; import fr.ird.observe.client.ui.content.ContentMode; import fr.ird.observe.client.ui.content.ContentUIHandler; import fr.ird.observe.client.ui.tree.navigation.NavigationTree; import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport; +import fr.ird.observe.client.ui.tree.navigation.nodes.ReferenceNavigationTreeNodeSupport; import fr.ird.observe.client.ui.tree.navigation.nodes.longline.ProgramLonglineNavigationTreeNode; import fr.ird.observe.client.ui.tree.navigation.nodes.seine.ProgramSeineNavigationTreeNode; +import fr.ird.observe.client.ui.util.UIHelper; import fr.ird.observe.client.validation.ClientValidationContext; -import fr.ird.observe.dto.IdDto; +import fr.ird.observe.dto.data.DataDto; import fr.ird.observe.dto.data.longline.TripLonglineDto; import fr.ird.observe.dto.data.seine.TripSeineDto; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.validator.NuitonValidatorScope; - import static org.nuiton.i18n.I18n.t; /** * @author Tony Chemit - dev(a)tchemit.fr * @since 1.0 */ -public abstract class ContentOpenableUIHandler<E extends IdDto, U extends ContentOpenableUI<E, U>> extends ContentUIHandler<E, U> { +public abstract class ContentOpenableUIHandler<E extends DataDto, U extends ContentOpenableUI<E, U>> extends ContentUIHandler<E, U> { - protected static final String POSITION_OPENABLE = "positionOpenable"; + private static final String POSITION_OPENABLE = "positionOpenable"; /** Logger */ static private final Log log = LogFactory.getLog(ContentOpenableUIHandler.class); - + private static final String UPDATE_TRIP_NODE = "updateTripNode"; protected final String closeMessage; - public ContentOpenableUIHandler(DataContextType parentType, - DataContextType type, - String closeMessage) { + public ContentOpenableUIHandler(DataContextType parentType, DataContextType type, String closeMessage) { super(parentType, type); this.closeMessage = closeMessage; } @@ -122,6 +120,18 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten } } + @Override + protected void afterDelete() { + super.afterDelete(); + NavigationTree treeHelper = getNavigationTree(); + NavigationTreeNodeSupport parent = treeHelper.getSelectedNode().getParent(); + if (!(parent instanceof ReferenceNavigationTreeNodeSupport)) { + parent = parent.getParent(); + } + parent.reload(); + treeHelper.reloadNode(parent, false); + } + public abstract boolean doCloseData(); public final void afterCloseData() { @@ -138,7 +148,7 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten removeAllMessages(ui); addMessage(ui, NuitonValidatorScope.INFO, - getTypeI18nKey(bean.getClass()), t(closeMessage)); + getTypeI18nKey(bean.getClass()), t(closeMessage)); NavigationTree treeHelper = getNavigationTree(); treeHelper.reloadSelectedNode(bean instanceof TripSeineDto || bean instanceof TripLonglineDto, true); @@ -159,6 +169,11 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten NavigationTreeNodeSupport node = treeHelper.getSelectedNode(); NavigationTreeNodeSupport parentNode = node.getParent(); + NavigationTreeNodeSupport parentDataNode = parentNode; + if (!(parentNode instanceof ReferenceNavigationTreeNodeSupport)) { + parentDataNode = parentNode.getParent(); + } + boolean create = node.getId() == null; E bean = getBean(); @@ -181,6 +196,10 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten // on crée le noeud final de la marée node = treeHelper.addOpenable(parentNode, bean); + if (parentNode != parentDataNode) { + parentDataNode.reload(); + treeHelper.reloadNode(parentDataNode, false); + } // arrêt de l'édition de l'écran courant stopEditUI(); @@ -202,6 +221,11 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten treeHelper.selectNode(node); } + node.reload(); + if (parentNode != parentDataNode) { + parentDataNode.reload(); + treeHelper.reloadNode(parentDataNode, false); + } // on repaint le noeud et ses enfants treeHelper.reloadSelectedNode(false, true); } @@ -286,8 +310,6 @@ public abstract class ContentOpenableUIHandler<E extends IdDto, U extends Conten } } - private static final String UPDATE_TRIP_NODE = "updateTripNode"; - protected void repaintTripNode() { Boolean updateTripNode = getUi().getContextValue(Boolean.class, UPDATE_TRIP_NODE); ===================================== client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUIModel.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUIModel.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/open/ContentOpenableUIModel.java @@ -23,6 +23,7 @@ package fr.ird.observe.client.ui.content.open; import fr.ird.observe.client.ui.content.ContentUIModel; import fr.ird.observe.dto.IdDto; +import fr.ird.observe.dto.data.DataDto; /** * Le modèle pour un écran d'édition avec des fils. @@ -30,7 +31,7 @@ import fr.ird.observe.dto.IdDto; * @author Tony Chemit - dev(a)tchemit.fr * @since 1.5 */ -public abstract class ContentOpenableUIModel<E extends IdDto> extends ContentUIModel<E> { +public abstract class ContentOpenableUIModel<E extends DataDto> extends ContentUIModel<E> { public static final String PROPERTY_CAN_REOPEN = "canReopen"; View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/5a189e8b6502dcbb9f8b8a93bf3… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/5a189e8b6502dcbb9f8b8a93bf3… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Fix some navigation issues (scrollpane does not work, on select node is not…
by Tony CHEMIT 06 Apr '18

06 Apr '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 4eb6a93b by Tony CHEMIT at 2018-04-06T07:04:58Z Fix some navigation issues (scrollpane does not work, on select node is not expand) + review navigation ui design - - - - - 22 changed files: - client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx - client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseAndCreateUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseOpenUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/GoDownUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/GoUpUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivityLonglinesUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivitySeinesUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveMultipleDataUIActionSupport.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveRoutesUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveSingleDataUIActionSupport.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripsUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/ReOpenUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/ResetEditUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/SelectNodeUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/main/global/ChangeFocusGlobalUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/navigation/GotoActionSupport.java - client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/storage/ReloadStorageAction.java - client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/content/ref/ReferenceHomeUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTree.java Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx +++ b/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx @@ -78,9 +78,6 @@ fr.ird.observe.client.ui.content.ContentUIManager fr.ird.observe.client.ui.content.ObserveActionMap fr.ird.observe.client.ui.tree.navigation.NavigationUI - fr.ird.observe.client.ui.tree.navigation.NavigationTree - fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel - fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel fr.ird.observe.client.ui.util.UIHelper fr.ird.observe.client.ui.util.ObserveBlockingLayerUI @@ -255,7 +252,6 @@ protected void finalize() throws Throwable { <JXTitledPanel id='navigationView'> <NavigationUI id="navigationUI" initializer="new NavigationUI((JAXXContext)this)"/> - <NavigationTree id="navigation" initializer="navigationUI.getTree()"/> </JXTitledPanel> <!-- right : (content + messages) --> ===================================== client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java +++ b/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java @@ -153,7 +153,7 @@ public class ObserveMainUIInitializer { // set fullscreen propery on main ui ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(config.isFullScreen() ? ui : null); - new ObserveNavigationTreeShowPopupAction(ui.getNavigation(), ui.getNavigationUI(), ui.getNavigationPopup()); + new ObserveNavigationTreeShowPopupAction(ui.getNavigationUI().getTree(), ui.getNavigationUI(), ui.getNavigationPopup()); return ui; } @@ -180,7 +180,7 @@ public class ObserveMainUIInitializer { log.debug("No open Data source."); return; } - if (ui.getNavigation().isSelectionEmpty()) { + if (ui.getNavigationUI().getTree().isSelectionEmpty()) { log.debug("No selection, show empty panel..."); boolean foundEmptySelection = false; @@ -260,12 +260,12 @@ public class ObserveMainUIInitializer { JComponent focusOwner; if (ui.getFocusOwner() == ui) { focusOnNavigation = true; - focusOwner = ui.getNavigation(); + focusOwner = ui.getNavigationUI().getTree(); } else { focusOwner = (JComponent) ui.getFocusOwner(); if (focusOwner != null) { - if (ui.getNavigation().equals(focusOwner)) { + if (ui.getNavigationUI().getTree().equals(focusOwner)) { focusOnNavigation = true; } if (ui.getNavigationUI().equals(focusOwner)) { @@ -277,7 +277,7 @@ public class ObserveMainUIInitializer { if (!focusOnNavigation) { Container focusOwnerParent = focusOwner.getParent(); while (focusOwnerParent != null) { - if (ui.getNavigation().equals(focusOwnerParent)) { + if (ui.getNavigationUI().getTree().equals(focusOwnerParent)) { focusOnNavigation = true; break; } @@ -337,7 +337,7 @@ public class ObserveMainUIInitializer { oldMode = ui.getModel().getMode(); - ids = ui.getNavigation().getSelectedIds(); + ids = ui.getNavigationUI().getTree().getSelectedIds(); ErrorDialogUI.init(null); @@ -368,7 +368,7 @@ public class ObserveMainUIInitializer { if (oldMode == ObserveUIMode.DB) { // on met à jour le modèle de navigation - NavigationTreeModel treeModel = ui.getNavigation().getTreeModel(); + NavigationTreeModel treeModel = ui.getNavigationUI().getTree().getTreeModel(); treeModel.load(config); treeModel.populate(); @@ -378,7 +378,7 @@ public class ObserveMainUIInitializer { // selection du noeud d'ouverture (le noeud precedemment selectionne, // ou le noeud le plus ouvert // ou le premier program si aucune donnée ouverte) - ui.getNavigation().selectInitialNode(); + ui.getNavigationUI().getTree().selectInitialNode(); } // show ui @@ -405,7 +405,7 @@ public class ObserveMainUIInitializer { // ajout d'un ecouteur sur la navigation pour toujours mettre la scrollbar // tout à droite a chaque selection - ui.getNavigation().addTreeSelectionListener(this::changeNavigationNode); + ui.getNavigationUI().getTree().addTreeSelectionListener(this::changeNavigationNode); SwingValidatorUtil.installUI(ui.getErrorTable(), new ObserveValidatorMessageTableRenderer()); @@ -433,12 +433,12 @@ public class ObserveMainUIInitializer { } }; ui.getNavigationView().addMouseListener(mouseAdapter); - ui.getNavigation().addMouseListener(mouseAdapter); + ui.getNavigationUI().getTree().addMouseListener(mouseAdapter); ui.getNavigationUI().addMouseListener(mouseAdapter); init(ui.getSplitpane()); init(ui.getSplitpane2()); - init(ui.getNavigation()); + init(ui.getNavigationUI().getTree()); ui.getNavigationView().setRightDecoration(ui.getNavigationUI().getToolbar()); // ui.getNavigationView().addComponentListener(new ComponentAdapter() { @@ -555,7 +555,7 @@ public class ObserveMainUIInitializer { ui.getContextValue(SwingValidatorMessageTableModel.class).clear(); // clean tree model - NavigationTree tree = ui.getNavigation(); + NavigationTree tree = ui.getNavigationUI().getTree(); tree.clearModel(); progressModel.incrementsCurrentStep(); @@ -574,7 +574,7 @@ public class ObserveMainUIInitializer { */ public void loadNavigationUI(ProgressModel progressModel) { - NavigationTree tree = ui.getNavigation(); + NavigationTree tree = ui.getNavigationUI().getTree(); NavigationTreeModel treeModel = tree.getTreeModel(); treeModel.populate(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseAndCreateUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseAndCreateUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseAndCreateUIAction.java @@ -78,7 +78,7 @@ public class CloseAndCreateUIAction extends AbstractContentUIAction { return; } - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); boolean wasCollapsed = isOpenActivityNodeCollapsed(tree, dataContext); @@ -120,7 +120,7 @@ public class CloseAndCreateUIAction extends AbstractContentUIAction { return; } - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); boolean wasCollapsed = isOpenActivityNodeCollapsed(tree, dataContext); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseOpenUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseOpenUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseOpenUIAction.java @@ -102,7 +102,7 @@ public class CloseOpenUIAction extends AbstractContentUIAction { private void closeData(ObserveSwingApplicationContext applicationContext, ContentUI<?, ?> ui, String id) { - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport selectedNode = tree.getSelectedNode(); NavigationTreeNodeSupport node = tree.getChild(selectedNode, id); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/GoDownUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/GoDownUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/GoDownUIAction.java @@ -71,7 +71,7 @@ public class GoDownUIAction extends AbstractContentUIAction { public void updateAction(JAXXObject ui, AbstractButton editor) { ObserveMainUI mainUI = getMainUI(); - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); JPopupMenu scopePopup = mainUI.getScopeDownPopup(); SelectNodeUIAction action = (SelectNodeUIAction) mainUI.getObserveActionMap().get(SelectNodeUIAction.ACTION_NAME); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/GoUpUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/GoUpUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/GoUpUIAction.java @@ -73,7 +73,7 @@ public class GoUpUIAction extends AbstractContentUIAction { @Override public void updateAction(JAXXObject ui, AbstractButton editor) { - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport<?> node; ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivityLonglinesUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivityLonglinesUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivityLonglinesUIAction.java @@ -73,7 +73,7 @@ public class MoveActivityLonglinesUIAction extends MoveMultipleDataUIActionSuppo ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport oldTripLonglineNode = oldActivitiesNode.getParent(); NavigationTreeNodeSupport programNode = oldTripLonglineNode.getParent(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivitySeinesUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivitySeinesUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivitySeinesUIAction.java @@ -73,7 +73,7 @@ public class MoveActivitySeinesUIAction extends MoveMultipleDataUIActionSupport< ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport oldRouteNode = oldParentNode.getParent(); NavigationTreeNodeSupport routesNode = oldRouteNode.getParent(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveMultipleDataUIActionSupport.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveMultipleDataUIActionSupport.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveMultipleDataUIActionSupport.java @@ -71,7 +71,7 @@ public abstract class MoveMultipleDataUIActionSupport<U extends ContentListUI<?, @SuppressWarnings("unchecked") U ui = (U) ui1; - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport node = treeHelper.getSelectedNode(); NavigationTreeNodeSupport oldParentNode = node.getParent().isRoot() ? node : node.getParent(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveRoutesUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveRoutesUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveRoutesUIAction.java @@ -72,7 +72,7 @@ public class MoveRoutesUIAction extends MoveMultipleDataUIActionSupport<RoutesUI void updateUI(RoutesUI ui, NavigationTreeNodeSupport oldRoutesNode, String tripSeineId, ImmutableSet<String> routeIds, List<Integer> positions) { ObserveOpenDataManager openDataManager = getOpenDataManager(); - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport oldTripSeineNode = oldRoutesNode.getParent(); NavigationTreeNodeSupport programNode = oldTripSeineNode.getParent(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveSingleDataUIActionSupport.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveSingleDataUIActionSupport.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveSingleDataUIActionSupport.java @@ -50,7 +50,7 @@ public abstract class MoveSingleDataUIActionSupport extends UIActionSupport { @Override public final void actionPerformed(ActionEvent e) { - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport node = treeHelper.getSelectedNode(); NavigationTreeNodeSupport oldParentNode = node.getParent().getParent().equals(node.getRoot()) ? node.getParent() : node.getParent().getParent(); Optional<String> optionalNewParentId = getNewParentId(getMainUI(), oldParentNode); @@ -62,7 +62,7 @@ public abstract class MoveSingleDataUIActionSupport extends UIActionSupport { private void apply(NavigationTreeNodeSupport oldParentNode, String dataId, String newParentId) { - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport node = treeHelper.getSelectedNode(); NavigationTreeNodeSupport grandParentNode = oldParentNode.getParent(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripUIAction.java @@ -94,7 +94,7 @@ public abstract class MoveTripUIAction extends MoveSingleDataUIActionSupport { static Optional<String> chooseNewProgram(ObserveMainUI mainUI, GearType gearType, String oldProgramId) { - NavigationTree treeHelper = mainUI.getNavigation(); + NavigationTree treeHelper = mainUI.getNavigationUI().getTree(); // racine NavigationTreeNodeSupport rootNode = treeHelper.getRootNode(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripsUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripsUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripsUIAction.java @@ -77,7 +77,7 @@ public abstract class MoveTripsUIAction<U extends ContentListUI<?, ?, ?, ?>> ext ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport rootNode = treeHelper.getRootNode(); NavigationTreeNodeSupport newProgramNode = treeHelper.getChild(rootNode, newParentId); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/ReOpenUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/ReOpenUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/ReOpenUIAction.java @@ -70,7 +70,7 @@ public class ReOpenUIAction extends AbstractContentUIAction { String id = selectedData.getId(); - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport selectedNode = tree.getSelectedNode(); NavigationTreeNodeSupport node = tree.getChild(selectedNode, id); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/ResetEditUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/ResetEditUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/ResetEditUIAction.java @@ -57,7 +57,7 @@ public class ResetEditUIAction extends AbstractContentUIAction { if (ui.getModel().isCreatingMode()) { ui.stopEdit(); - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport parentNode = tree.getSelectedNode().getParent(); tree.removeNode(tree.getSelectedNode()); tree.selectNode(parentNode); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/SelectNodeUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/SelectNodeUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/SelectNodeUIAction.java @@ -92,6 +92,6 @@ public class SelectNodeUIAction extends AbstractContentUIAction { NavigationTreeNodeSupport node = (NavigationTreeNodeSupport) source.getClientProperty(NODE); Objects.requireNonNull(node); - SwingUtilities.invokeLater(() -> getMainUI().getNavigation().selectNode(node)); + SwingUtilities.invokeLater(() -> getMainUI().getNavigationUI().getTree().selectNode(node)); } } ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/main/global/ChangeFocusGlobalUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/main/global/ChangeFocusGlobalUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/main/global/ChangeFocusGlobalUIAction.java @@ -76,7 +76,7 @@ public class ChangeFocusGlobalUIAction extends UIActionSupport { log.info("Focus to navigation"); } getMainUI().getModel().setFocusOnNavigation(true); - focusComponent = getMainUI().getNavigation(); + focusComponent = getMainUI().getNavigationUI().getTree(); } SwingUtilities.invokeLater(focusComponent::requestFocusInWindow); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/navigation/GotoActionSupport.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/navigation/GotoActionSupport.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/navigation/GotoActionSupport.java @@ -89,7 +89,7 @@ public abstract class GotoActionSupport extends MenuActionSupport { return; } - NavigationTree navigation = getMainUI().getNavigation(); + NavigationTree navigation = getMainUI().getNavigationUI().getTree(); getNodeToSelect(navigation, dataContext).ifPresent(navigation::selectNode); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/storage/ReloadStorageAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/storage/ReloadStorageAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/storage/ReloadStorageAction.java @@ -82,7 +82,7 @@ public class ReloadStorageAction extends MenuActionSupport { ui.getModel().setBusy(false); - Object[] ids = ui.getNavigation().getSelectedIds(); + Object[] ids = ui.getNavigationUI().getTree().getSelectedIds(); try { ===================================== client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java @@ -222,7 +222,7 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U } public static NavigationTree getNavigationTree() { - return ObserveSwingApplicationContext.get().getMainUI().getNavigation(); + return ObserveSwingApplicationContext.get().getMainUI().getNavigationUI().getTree(); } /** @@ -444,10 +444,10 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U if (focusOnNavigation) { SwingUtilities.invokeLater(() -> { Component focusOwner = mainUI.getFocusOwner(); - if (!mainUI.getNavigation().equals(focusOwner)) { + if (!mainUI.getNavigationUI().getTree().equals(focusOwner)) { SwingUtilities.invokeLater(() -> { - mainUI.getNavigation().requestFocusInWindow(); + mainUI.getNavigationUI().getTree().requestFocusInWindow(); log.debug("Focus old owner: " + focusOwner); log.debug("Focus new owner: " + mainUI.getFocusOwner()); ===================================== client/src/main/java/fr/ird/observe/client/ui/content/ref/ReferenceHomeUIHandler.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/ref/ReferenceHomeUIHandler.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/ref/ReferenceHomeUIHandler.java @@ -68,7 +68,7 @@ public class ReferenceHomeUIHandler extends ContentUIHandler<ProgramDto, Referen JPanel panel = ui.getBody(); String nodeName = ui.getModel().getNodeName(); - NavigationTree navigation = ObserveSwingApplicationContext.get().getMainUI().getNavigation(); + NavigationTree navigation = ObserveSwingApplicationContext.get().getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport<?> referentialNode = navigation.getReferentialNode(nodeName); for (Class<? extends ReferentialDto> type : ui.getModel().getTypes()) { ===================================== client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTree.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTree.java +++ b/client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTree.java @@ -153,7 +153,14 @@ public class NavigationTree extends JXTree { return; } TreePath path = e.getPath(); - getTreeModel().open((NavigationTreeNodeSupport) path.getLastPathComponent()); + NavigationTreeNodeSupport selectedNode = (NavigationTreeNodeSupport) path.getLastPathComponent(); + try { + getTreeModel().open((NavigationTreeNodeSupport) path.getLastPathComponent()); + } finally { + if (!selectedNode.isLeaf()) { + SwingUtilities.invokeLater(() -> expandPath(path)); + } + } }); NavigationTreeCellRenderer renderer = new NavigationTreeCellRenderer(); @@ -202,7 +209,7 @@ public class NavigationTree extends JXTree { /** * Sélectionne le noeud dans l'arbre de navigation. - * <p> + * * <b>Note:</b> cette méthode doit être appelée après un rechargement du * modèle de navigation. */ View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/4eb6a93b689a88eb9c87c2583af… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/4eb6a93b689a88eb9c87c2583af… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Fix navigation tree scrollPane and his jaxx design
by Tony CHEMIT 05 Apr '18

05 Apr '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 4d78fa47 by Tony CHEMIT at 2018-04-05T21:21:34Z Fix navigation tree scrollPane and his jaxx design - - - - - 21 changed files: - client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx - client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseAndCreateUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseOpenUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/GoDownUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/GoUpUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivityLonglinesUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivitySeinesUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveMultipleDataUIActionSupport.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveRoutesUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveSingleDataUIActionSupport.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripsUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/ReOpenUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/ResetEditUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/content/SelectNodeUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/main/global/ChangeFocusGlobalUIAction.java - client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/navigation/GotoActionSupport.java - client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/storage/ReloadStorageAction.java - client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/content/ref/ReferenceHomeUIHandler.java Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx +++ b/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx @@ -78,9 +78,6 @@ fr.ird.observe.client.ui.content.ContentUIManager fr.ird.observe.client.ui.content.ObserveActionMap fr.ird.observe.client.ui.tree.navigation.NavigationUI - fr.ird.observe.client.ui.tree.navigation.NavigationTree - fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel - fr.ird.observe.client.ui.tree.navigation.NavigationTreeModel fr.ird.observe.client.ui.util.UIHelper fr.ird.observe.client.ui.util.ObserveBlockingLayerUI @@ -255,7 +252,6 @@ protected void finalize() throws Throwable { <JXTitledPanel id='navigationView'> <NavigationUI id="navigationUI" initializer="new NavigationUI((JAXXContext)this)"/> - <NavigationTree id="navigation" initializer="navigationUI.getTree()"/> </JXTitledPanel> <!-- right : (content + messages) --> ===================================== client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java +++ b/client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java @@ -153,7 +153,7 @@ public class ObserveMainUIInitializer { // set fullscreen propery on main ui ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(config.isFullScreen() ? ui : null); - new ObserveNavigationTreeShowPopupAction(ui.getNavigation(), ui.getNavigationUI(), ui.getNavigationPopup()); + new ObserveNavigationTreeShowPopupAction(ui.getNavigationUI().getTree(), ui.getNavigationUI(), ui.getNavigationPopup()); return ui; } @@ -180,7 +180,7 @@ public class ObserveMainUIInitializer { log.debug("No open Data source."); return; } - if (ui.getNavigation().isSelectionEmpty()) { + if (ui.getNavigationUI().getTree().isSelectionEmpty()) { log.debug("No selection, show empty panel..."); boolean foundEmptySelection = false; @@ -260,12 +260,12 @@ public class ObserveMainUIInitializer { JComponent focusOwner; if (ui.getFocusOwner() == ui) { focusOnNavigation = true; - focusOwner = ui.getNavigation(); + focusOwner = ui.getNavigationUI().getTree(); } else { focusOwner = (JComponent) ui.getFocusOwner(); if (focusOwner != null) { - if (ui.getNavigation().equals(focusOwner)) { + if (ui.getNavigationUI().getTree().equals(focusOwner)) { focusOnNavigation = true; } if (ui.getNavigationUI().equals(focusOwner)) { @@ -277,7 +277,7 @@ public class ObserveMainUIInitializer { if (!focusOnNavigation) { Container focusOwnerParent = focusOwner.getParent(); while (focusOwnerParent != null) { - if (ui.getNavigation().equals(focusOwnerParent)) { + if (ui.getNavigationUI().getTree().equals(focusOwnerParent)) { focusOnNavigation = true; break; } @@ -337,7 +337,7 @@ public class ObserveMainUIInitializer { oldMode = ui.getModel().getMode(); - ids = ui.getNavigation().getSelectedIds(); + ids = ui.getNavigationUI().getTree().getSelectedIds(); ErrorDialogUI.init(null); @@ -368,7 +368,7 @@ public class ObserveMainUIInitializer { if (oldMode == ObserveUIMode.DB) { // on met à jour le modèle de navigation - NavigationTreeModel treeModel = ui.getNavigation().getTreeModel(); + NavigationTreeModel treeModel = ui.getNavigationUI().getTree().getTreeModel(); treeModel.load(config); treeModel.populate(); @@ -378,7 +378,7 @@ public class ObserveMainUIInitializer { // selection du noeud d'ouverture (le noeud precedemment selectionne, // ou le noeud le plus ouvert // ou le premier program si aucune donnée ouverte) - ui.getNavigation().selectInitialNode(); + ui.getNavigationUI().getTree().selectInitialNode(); } // show ui @@ -405,7 +405,7 @@ public class ObserveMainUIInitializer { // ajout d'un ecouteur sur la navigation pour toujours mettre la scrollbar // tout à droite a chaque selection - ui.getNavigation().addTreeSelectionListener(this::changeNavigationNode); + ui.getNavigationUI().getTree().addTreeSelectionListener(this::changeNavigationNode); SwingValidatorUtil.installUI(ui.getErrorTable(), new ObserveValidatorMessageTableRenderer()); @@ -433,12 +433,12 @@ public class ObserveMainUIInitializer { } }; ui.getNavigationView().addMouseListener(mouseAdapter); - ui.getNavigation().addMouseListener(mouseAdapter); + ui.getNavigationUI().getTree().addMouseListener(mouseAdapter); ui.getNavigationUI().addMouseListener(mouseAdapter); init(ui.getSplitpane()); init(ui.getSplitpane2()); - init(ui.getNavigation()); + init(ui.getNavigationUI().getTree()); ui.getNavigationView().setRightDecoration(ui.getNavigationUI().getToolbar()); // ui.getNavigationView().addComponentListener(new ComponentAdapter() { @@ -555,7 +555,7 @@ public class ObserveMainUIInitializer { ui.getContextValue(SwingValidatorMessageTableModel.class).clear(); // clean tree model - NavigationTree tree = ui.getNavigation(); + NavigationTree tree = ui.getNavigationUI().getTree(); tree.clearModel(); progressModel.incrementsCurrentStep(); @@ -574,7 +574,7 @@ public class ObserveMainUIInitializer { */ public void loadNavigationUI(ProgressModel progressModel) { - NavigationTree tree = ui.getNavigation(); + NavigationTree tree = ui.getNavigationUI().getTree(); NavigationTreeModel treeModel = tree.getTreeModel(); treeModel.populate(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseAndCreateUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseAndCreateUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseAndCreateUIAction.java @@ -78,7 +78,7 @@ public class CloseAndCreateUIAction extends AbstractContentUIAction { return; } - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); boolean wasCollapsed = isOpenActivityNodeCollapsed(tree, dataContext); @@ -120,7 +120,7 @@ public class CloseAndCreateUIAction extends AbstractContentUIAction { return; } - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); boolean wasCollapsed = isOpenActivityNodeCollapsed(tree, dataContext); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseOpenUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseOpenUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/CloseOpenUIAction.java @@ -102,7 +102,7 @@ public class CloseOpenUIAction extends AbstractContentUIAction { private void closeData(ObserveSwingApplicationContext applicationContext, ContentUI<?, ?> ui, String id) { - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport selectedNode = tree.getSelectedNode(); NavigationTreeNodeSupport node = tree.getChild(selectedNode, id); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/GoDownUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/GoDownUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/GoDownUIAction.java @@ -71,7 +71,7 @@ public class GoDownUIAction extends AbstractContentUIAction { public void updateAction(JAXXObject ui, AbstractButton editor) { ObserveMainUI mainUI = getMainUI(); - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); JPopupMenu scopePopup = mainUI.getScopeDownPopup(); SelectNodeUIAction action = (SelectNodeUIAction) mainUI.getObserveActionMap().get(SelectNodeUIAction.ACTION_NAME); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/GoUpUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/GoUpUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/GoUpUIAction.java @@ -73,7 +73,7 @@ public class GoUpUIAction extends AbstractContentUIAction { @Override public void updateAction(JAXXObject ui, AbstractButton editor) { - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport<?> node; ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivityLonglinesUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivityLonglinesUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivityLonglinesUIAction.java @@ -73,7 +73,7 @@ public class MoveActivityLonglinesUIAction extends MoveMultipleDataUIActionSuppo ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport oldTripLonglineNode = oldActivitiesNode.getParent(); NavigationTreeNodeSupport programNode = oldTripLonglineNode.getParent(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivitySeinesUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivitySeinesUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveActivitySeinesUIAction.java @@ -73,7 +73,7 @@ public class MoveActivitySeinesUIAction extends MoveMultipleDataUIActionSupport< ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport oldRouteNode = oldParentNode.getParent(); NavigationTreeNodeSupport routesNode = oldRouteNode.getParent(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveMultipleDataUIActionSupport.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveMultipleDataUIActionSupport.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveMultipleDataUIActionSupport.java @@ -71,7 +71,7 @@ public abstract class MoveMultipleDataUIActionSupport<U extends ContentListUI<?, @SuppressWarnings("unchecked") U ui = (U) ui1; - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport node = treeHelper.getSelectedNode(); NavigationTreeNodeSupport oldParentNode = node.getParent().isRoot() ? node : node.getParent(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveRoutesUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveRoutesUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveRoutesUIAction.java @@ -72,7 +72,7 @@ public class MoveRoutesUIAction extends MoveMultipleDataUIActionSupport<RoutesUI void updateUI(RoutesUI ui, NavigationTreeNodeSupport oldRoutesNode, String tripSeineId, ImmutableSet<String> routeIds, List<Integer> positions) { ObserveOpenDataManager openDataManager = getOpenDataManager(); - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport oldTripSeineNode = oldRoutesNode.getParent(); NavigationTreeNodeSupport programNode = oldTripSeineNode.getParent(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveSingleDataUIActionSupport.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveSingleDataUIActionSupport.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveSingleDataUIActionSupport.java @@ -50,7 +50,7 @@ public abstract class MoveSingleDataUIActionSupport extends UIActionSupport { @Override public final void actionPerformed(ActionEvent e) { - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport node = treeHelper.getSelectedNode(); NavigationTreeNodeSupport oldParentNode = node.getParent().getParent().equals(node.getRoot()) ? node.getParent() : node.getParent().getParent(); Optional<String> optionalNewParentId = getNewParentId(getMainUI(), oldParentNode); @@ -62,7 +62,7 @@ public abstract class MoveSingleDataUIActionSupport extends UIActionSupport { private void apply(NavigationTreeNodeSupport oldParentNode, String dataId, String newParentId) { - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport node = treeHelper.getSelectedNode(); NavigationTreeNodeSupport grandParentNode = oldParentNode.getParent(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripUIAction.java @@ -94,7 +94,7 @@ public abstract class MoveTripUIAction extends MoveSingleDataUIActionSupport { static Optional<String> chooseNewProgram(ObserveMainUI mainUI, GearType gearType, String oldProgramId) { - NavigationTree treeHelper = mainUI.getNavigation(); + NavigationTree treeHelper = mainUI.getNavigationUI().getTree(); // racine NavigationTreeNodeSupport rootNode = treeHelper.getRootNode(); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripsUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripsUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/MoveTripsUIAction.java @@ -77,7 +77,7 @@ public abstract class MoveTripsUIAction<U extends ContentListUI<?, ?, ?, ?>> ext ObserveSwingApplicationContext applicationContext = ObserveSwingApplicationContext.get(); ObserveOpenDataManager openDataManager = applicationContext.getOpenDataManager(); - NavigationTree treeHelper = getMainUI().getNavigation(); + NavigationTree treeHelper = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport rootNode = treeHelper.getRootNode(); NavigationTreeNodeSupport newProgramNode = treeHelper.getChild(rootNode, newParentId); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/ReOpenUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/ReOpenUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/ReOpenUIAction.java @@ -70,7 +70,7 @@ public class ReOpenUIAction extends AbstractContentUIAction { String id = selectedData.getId(); - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport selectedNode = tree.getSelectedNode(); NavigationTreeNodeSupport node = tree.getChild(selectedNode, id); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/ResetEditUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/ResetEditUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/ResetEditUIAction.java @@ -57,7 +57,7 @@ public class ResetEditUIAction extends AbstractContentUIAction { if (ui.getModel().isCreatingMode()) { ui.stopEdit(); - NavigationTree tree = getMainUI().getNavigation(); + NavigationTree tree = getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport parentNode = tree.getSelectedNode().getParent(); tree.removeNode(tree.getSelectedNode()); tree.selectNode(parentNode); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/content/SelectNodeUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/content/SelectNodeUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/content/SelectNodeUIAction.java @@ -92,6 +92,6 @@ public class SelectNodeUIAction extends AbstractContentUIAction { NavigationTreeNodeSupport node = (NavigationTreeNodeSupport) source.getClientProperty(NODE); Objects.requireNonNull(node); - SwingUtilities.invokeLater(() -> getMainUI().getNavigation().selectNode(node)); + SwingUtilities.invokeLater(() -> getMainUI().getNavigationUI().getTree().selectNode(node)); } } ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/main/global/ChangeFocusGlobalUIAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/main/global/ChangeFocusGlobalUIAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/main/global/ChangeFocusGlobalUIAction.java @@ -76,7 +76,7 @@ public class ChangeFocusGlobalUIAction extends UIActionSupport { log.info("Focus to navigation"); } getMainUI().getModel().setFocusOnNavigation(true); - focusComponent = getMainUI().getNavigation(); + focusComponent = getMainUI().getNavigationUI().getTree(); } SwingUtilities.invokeLater(focusComponent::requestFocusInWindow); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/navigation/GotoActionSupport.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/navigation/GotoActionSupport.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/navigation/GotoActionSupport.java @@ -89,7 +89,7 @@ public abstract class GotoActionSupport extends MenuActionSupport { return; } - NavigationTree navigation = getMainUI().getNavigation(); + NavigationTree navigation = getMainUI().getNavigationUI().getTree(); getNodeToSelect(navigation, dataContext).ifPresent(navigation::selectNode); ===================================== client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/storage/ReloadStorageAction.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/storage/ReloadStorageAction.java +++ b/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/storage/ReloadStorageAction.java @@ -82,7 +82,7 @@ public class ReloadStorageAction extends MenuActionSupport { ui.getModel().setBusy(false); - Object[] ids = ui.getNavigation().getSelectedIds(); + Object[] ids = ui.getNavigationUI().getTree().getSelectedIds(); try { ===================================== client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java @@ -222,7 +222,7 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U } public static NavigationTree getNavigationTree() { - return ObserveSwingApplicationContext.get().getMainUI().getNavigation(); + return ObserveSwingApplicationContext.get().getMainUI().getNavigationUI().getTree(); } /** @@ -444,10 +444,10 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U if (focusOnNavigation) { SwingUtilities.invokeLater(() -> { Component focusOwner = mainUI.getFocusOwner(); - if (!mainUI.getNavigation().equals(focusOwner)) { + if (!mainUI.getNavigationUI().getTree().equals(focusOwner)) { SwingUtilities.invokeLater(() -> { - mainUI.getNavigation().requestFocusInWindow(); + mainUI.getNavigationUI().getTree().requestFocusInWindow(); log.debug("Focus old owner: " + focusOwner); log.debug("Focus new owner: " + mainUI.getFocusOwner()); ===================================== client/src/main/java/fr/ird/observe/client/ui/content/ref/ReferenceHomeUIHandler.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/ref/ReferenceHomeUIHandler.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/ref/ReferenceHomeUIHandler.java @@ -68,7 +68,7 @@ public class ReferenceHomeUIHandler extends ContentUIHandler<ProgramDto, Referen JPanel panel = ui.getBody(); String nodeName = ui.getModel().getNodeName(); - NavigationTree navigation = ObserveSwingApplicationContext.get().getMainUI().getNavigation(); + NavigationTree navigation = ObserveSwingApplicationContext.get().getMainUI().getNavigationUI().getTree(); NavigationTreeNodeSupport<?> referentialNode = navigation.getReferentialNode(nodeName); for (Class<? extends ReferentialDto> type : ui.getModel().getTypes()) { View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/4d78fa47e770d7c68d510a5ee8d… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/4d78fa47e770d7c68d510a5ee8d… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][feature/v8_maquette] Ajout de la donnée observe_longline.SampleLogbook (see #913) Maquettage
by Tony CHEMIT 04 Apr '18

04 Apr '18
Tony CHEMIT pushed to branch feature/v8_maquette at ultreiaio / ird-observe Commits: 2dc500e7 by Tony CHEMIT at 2018-04-04T18:08:41Z Ajout de la donnée observe_longline.SampleLogbook (see #913) Maquettage - - - - - 30 changed files: - client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/content/ContentUIModel.java - client/src/main/java/fr/ird/observe/client/ui/content/data/longline/LandingUI.jcss - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SampleLogbookUI.jaxx - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SampleLogbookUI.jcss - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SampleLogbookUIHandler.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SampleLogbookUIModel.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SamplePartLogbookUI.jaxx - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SamplePartLogbookUI.jcss - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SamplePartLogbookUIHandler.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SamplePartLogbookUIModel.java - client/src/main/java/fr/ird/observe/client/ui/content/table/ContentTableModel.java - client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/longline/ActivityLonglineNavigationTreeNode.java - + client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/longline/ActivitySampleLogbookLonglineNavigationTreeNode.java - client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/longline/TripLonglineNavigationTreeNode.java - + client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/longline/TripSampleLogbookLonglineNavigationTreeNode.java - client/src/main/resources/i18n/client_en_GB.properties - client/src/main/resources/i18n/client_es_ES.properties - client/src/main/resources/i18n/client_fr_FR.properties - + dto/src/main/java/fr/ird/observe/dto/data/longline/SampleLogbookDto.java - dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java - dto/src/main/models/Observe.model - dto/src/main/resources/i18n/dto_en_GB.properties - dto/src/main/resources/i18n/dto_es_ES.properties - dto/src/main/resources/i18n/dto_fr_FR.properties - + persistence/src/main/java/fr/ird/observe/binder/data/longline/SampleLogbookEntityDtoBinder.java - + persistence/src/main/java/fr/ird/observe/binder/data/longline/SamplePartLogbookEntityDtoBinder.java - + validation/src/main/resources/fr/ird/observe/dto/data/longline/SampleLogbookDto-create-error-validation.xml - + validation/src/main/resources/fr/ird/observe/dto/data/longline/SampleLogbookDto-update-error-validation.xml - + validation/src/main/resources/fr/ird/observe/dto/data/longline/SamplePartLogbookDto-update-error-validation.xml The diff was not included because it is too large. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/2dc500e7dae6137fa34b5d6d868… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/2dc500e7dae6137fa34b5d6d868… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Deleted 4 commits: Ajout de la donnée observe_longline.ActivityLogbook (See #907) Maquettage
by Tony CHEMIT 03 Apr '18

03 Apr '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below. Deleted commits: 30fedc4d by Tony CHEMIT at 2018-04-03T20:13:33Z Ajout de la donnée observe_longline.ActivityLogbook (See #907) Maquettage - - - - - e6646c3e by Tony CHEMIT at 2018-04-03T20:13:33Z Ajout de la donnée observe_longline.SetLogbook (See #909) - - - - - 018ebdbf by Tony CHEMIT at 2018-04-03T20:13:33Z Ajout de la donnée observe_longline.CatchLogbook (See #911) Maquettage - - - - - 355b9469 by Tony CHEMIT at 2018-04-03T20:13:33Z update i18n (see #911, see #907, see #909) - - - - - 15 changed files: - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUI.jaxx - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUI.jcss - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUIHandler.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUIModel.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUI.jaxx - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUI.jcss - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUIHandler.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUIModel.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUI.jaxx - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUI.jcss - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUIHandler.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUIModel.java - client/src/main/resources/i18n/client_en_GB.properties - client/src/main/resources/i18n/client_es_ES.properties - client/src/main/resources/i18n/client_fr_FR.properties Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUI.jaxx ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUI.jaxx @@ -0,0 +1,192 @@ +<!-- + #%L + ObServe :: Client + %% + Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> + +<fr.ird.observe.client.ui.content.open.ContentOpenableUI + i18nFormat="observe.common.ActivityLonglineDto.%s" + superGenericType='ActivityLonglineDto, ActivityLonglineLogbookUI' + contentTitle='{n("observe.common.ActivityLonglineDto.title")}'> + + <style source="../../Common.jcss"/> + + <import> + fr.ird.observe.dto.data.longline.ActivityLonglineDto + fr.ird.observe.dto.data.longline.ActivityLonglineReference + fr.ird.observe.dto.data.longline.SetLonglineDto + fr.ird.observe.dto.referential.FpaZoneReference + fr.ird.observe.dto.referential.longline.VesselActivityLonglineReference + fr.ird.observe.dto.referential.seine.WindReference + fr.ird.observe.dto.referential.DataQualityReference + + fr.ird.observe.client.ui.actions.content.AddActivityLonglineSetUIAction + fr.ird.observe.client.ui.actions.content.DeleteDataUIAction + fr.ird.observe.client.ui.actions.main.global.DeleteDataGlobalUIAction + fr.ird.observe.client.ui.actions.main.global.OpenDataGlobalUIAction + fr.ird.observe.client.ui.actions.main.global.CloseDataGlobalUIAction + fr.ird.observe.client.ui.actions.main.global.NewNextDataGlobalUIAction + fr.ird.observe.client.ui.util.JComment + + org.nuiton.jaxx.widgets.temperature.TemperatureFormat + org.nuiton.jaxx.widgets.temperature.TemperatureEditor + org.nuiton.jaxx.widgets.temperature.TemperatureEditorConfig + + org.nuiton.jaxx.widgets.number.NumberEditor + org.nuiton.jaxx.widgets.select.BeanComboBox + + org.nuiton.jaxx.widgets.datetime.DateTimeEditor + org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor + + java.awt.Dimension + + static fr.ird.observe.client.ui.util.UIHelper.getStringValue + static org.nuiton.i18n.I18n.n + </import> + + <!-- model --> + <ActivityLonglineLogbookUIModel id='model'/> + + <!-- edit bean --> + <ActivityLonglineDto id='bean'/> + + <!-- validator --> + <BeanValidator id='validator' autoField='true' beanClass='fr.ird.observe.dto.data.longline.ActivityLonglineDto' + errorTableModel='{getErrorTableModel()}' context='create'> + + <field name='longitude' component='coordinatesEditor'/> + <field name='latitude' component='coordinatesEditor'/> + <field name='quadrant' component='coordinatesEditor'/> + + </BeanValidator> + + <!-- formulaire --> + <JPanel id="body"> + <Table fill='both' constraints="BorderLayout.CENTER"> + + <!-- date - time --> + <row> + <cell columns="2" weightx="1"> + <DateTimeEditor id='timeStamp' constructorParams='this'/> + </cell> + </row> + + <!-- position --> + <row> + <cell columns="2" weightx="1"> + <CoordinatesEditor id='coordinatesEditor' constructorParams='this'/> + </cell> + </row> + + <!-- activity vessel --> + <row> + <cell anchor='west'> + <JLabel id='vesselActivityLonglineLabel'/> + </cell> + <cell anchor='east' fill="both"> + <BeanComboBox id='vesselActivityLongline' genericType='VesselActivityLonglineReference' + constructorParams='this'/> + </cell> + </row> + + <!--zone FPA--> + <row> + <cell anchor='west'> + <JLabel id='fpaZoneLabel'/> + </cell> + <cell anchor='east' fill="both"> + <BeanComboBox id='fpaZone' genericType='FpaZoneReference' constructorParams='this'/> + </cell> + </row> + + <!-- vitesse vessel --> + <row> + <cell anchor='west'> + <JLabel id='vesselSpeedLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <NumberEditor id='vesselSpeed' constructorParams='this' styleClass="float2"/> + </cell> + </row> + + <!-- température de surface --> + <row> + <cell anchor='west'> + <JLabel id='seaSurfaceTemperatureLabel'/> + </cell> + <cell anchor='east' fill="both"> + <TemperatureEditor id='seaSurfaceTemperature' constructorParams='this'/> + </cell> + </row> + + <!-- vent beaufort --> + <row> + <cell anchor='west'> + <JLabel id='windLabel'/> + </cell> + <cell anchor='east' fill="both"> + <BeanComboBox id='wind' genericType='WindReference' constructorParams='this'/> + </cell> + </row> + + <!-- dataQuality --> + <row> + <cell anchor='west'> + <JLabel id='dataQualityLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <BeanComboBox id='dataQuality' genericType='DataQualityReference' constructorParams='this'/> + </cell> + </row> + + <!-- activité observation --> + <row> + <cell anchor='west'> + <JLabel id='relatedObservedActivityLabel'/> + </cell> + <cell anchor='east' fill="both"> + <BeanComboBox id='relatedObservedActivity' genericType='ActivityLonglineReference' constructorParams='this'/> + </cell> + </row> + + <!-- comment --> + <row> + <cell columns='2' weighty="1"> + <JComment id="comment"/> + </cell> + </row> + </Table> + </JPanel> + + <!-- surcharge des actions (pour appliquer la css specifique) --> + <JButton id='delete'/> + <JButton id='reopen'/> + <JButton id='close'/> + <JButton id='closeAndCreate'/> + <JButton id='actionDown'/> + + <Table id='extraActions' fill="both" weightx="1" insets='2'> + <row> + <cell weightx="0.5" fill="both"> + <JButton id='addSet'/> + </cell> + </row> + </Table> + +</fr.ird.observe.client.ui.content.open.ContentOpenableUI> ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUI.jcss ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUI.jcss @@ -0,0 +1,99 @@ +/* + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +#model { + editable:true; + modified:{validator.isChanged()}; + valid:{validator.isValid()}; +} + +#body { + layout:{new BorderLayout()}; +} + +#extraActions { + visible:{model.isUpdatingMode()}; +} + +#timeStamp { + propertyDate:{ActivityLonglineDto.PROPERTY_TIME_STAMP}; + propertyDayDate:{ActivityLonglineUIModel.PROPERTY_DATE}; + propertyTimeDate:{ActivityLonglineUIModel.PROPERTY_TIME}; + date:{bean.getTimeStamp()}; +} + +#coordinatesEditor { + propertyLatitude:{ActivityLonglineDto.PROPERTY_LATITUDE}; + propertyLongitude:{ActivityLonglineDto.PROPERTY_LONGITUDE}; + propertyQuadrant:{ActivityLonglineDto.PROPERTY_QUADRANT}; +} + +#vesselActivityLongline { + property:{ActivityLonglineDto.PROPERTY_VESSEL_ACTIVITY_LONGLINE}; + selectedItem:{bean.getVesselActivityLongline()}; + enabled:{!model.isUpdatingMode()}; +} + +#fpaZone { + property:{ActivityLonglineDto.PROPERTY_FPA_ZONE}; + selectedItem:{bean.getFpaZone()}; +} + +#seaSurfaceTemperature { + format:{TemperatureFormat.C}; + storageTemperature:{bean.getSeaSurfaceTemperature()}; +} + +#dataQuality { + property:{ActivityLonglineDto.PROPERTY_DATA_QUALITY}; + selectedItem:{bean.getDataQuality()}; +} + +#reopen { + _toolTipText:{t("observe.common.ActivityDto.action.reopen.tip")}; +} + +#close { + enabled:{!model.isModified() && (model.isHistoricalData() || model.isValid())}; + _toolTipText:{t("observe.common.ActivityDto.action.close.tip")}; +} + +#closeAndCreate { + _globalAction:{NewNextDataGlobalUIAction.ACTION_NAME}; + enabled:{!model.isModified() && (model.isHistoricalData() || model.isValid())}; + _text:{t("observe.common.ActivityDto.action.closeAndCreate")}; + _toolTipText:{t("observe.common.ActivityDto.action.closeAndCreate.tip")}; +} + +#delete { + _globalAction:{DeleteDataGlobalUIAction.ACTION_NAME}; + _toolTipText:{t("observe.common.ActivityDto.action.delete.tip")}; +} + +#addSet { + actionIcon:add; + text:"observe.common.ActivityLonglineDto.action.addSet"; + toolTipText:"observe.common.ActivityLonglineDto.action.addSet.tip"; + enabled:{!model.isModified() && model.isValid() && model.isSetOperation() && ! bean.isHasSetLongline()}; + _observeAction:{AddActivityLonglineSetUIAction.ACTION_NAME}; + +} ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUIHandler.java ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUIHandler.java @@ -0,0 +1,306 @@ +package fr.ird.observe.client.ui.content.data.longline; + +/* + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy 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.ird.observe.client.ObserveSwingApplicationContext; +import fr.ird.observe.client.db.ClientDataContext; +import fr.ird.observe.client.db.constants.DataContextType; +import fr.ird.observe.client.ui.content.ContentMode; +import fr.ird.observe.client.ui.content.ContentUIModel; +import fr.ird.observe.client.ui.content.open.ContentOpenableUIHandler; +import fr.ird.observe.client.validation.ClientValidationContext; +import fr.ird.observe.dto.data.longline.ActivityLonglineDto; +import fr.ird.observe.dto.data.longline.ActivityLonglineHelper; +import fr.ird.observe.dto.data.longline.TripLonglineDto; +import fr.ird.observe.dto.form.Form; +import fr.ird.observe.dto.reference.DataDtoReference; +import fr.ird.observe.dto.result.TripChildSaveResultDto; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; +import org.nuiton.validator.NuitonValidatorScope; + +import javax.swing.SwingUtilities; +import java.util.Optional; + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + +/** + * Created on 8/29/14. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 3.7 + */ +class ActivityLonglineLogbookUIHandler extends ContentOpenableUIHandler<ActivityLonglineDto, ActivityLonglineLogbookUI> implements UIHandler<ActivityLonglineLogbookUI> { + + /** Logger */ + private static final Log log = LogFactory.getLog(ActivityLonglineLogbookUIHandler.class); + + ActivityLonglineLogbookUIHandler() { + super(DataContextType.TripLongline, DataContextType.ActivityLongline, n("observe.common.ActivityLonglineDto.message.not.open")); + } + + @Override + protected boolean doOpenData() { + boolean result = getOpenDataManager().canOpenActivityLongline(getSelectedParentId()); + if (result) { + String setLonglineId = Optional.ofNullable(getBean().getSetLongline()).map(DataDtoReference::getId).orElse(null); + getOpenDataManager().openActivityLongline(getSelectedParentId(), getSelectedId(), setLonglineId); + + } + return result; + } + + @Override + public boolean doCloseData() { + boolean result = getOpenDataManager().isOpenActivityLongline(getSelectedId()); + if (result) { + getOpenDataManager().closeActivityLongline(getSelectedId()); + } + return result; + } + + @Override + protected ContentMode getContentMode(ClientDataContext dataContext) { + + String activityId = getSelectedId(); + + if (activityId == null) { + + // mode creation + return ContentMode.CREATE; + } + + // l'activity existe en base + if (getOpenDataManager().isOpenActivityLongline(getSelectedId())) { + + // l'activity est ouverte, donc modifiable + return ContentMode.UPDATE; + } + + ActivityLonglineLogbookUI ui = getUi(); + + // l'activity n'est pas ouverte, donc pas éditable + if (!getOpenDataManager().isOpenTripLongline(getSelectedParentId())) { + + // la marée n'est pas ouverte + addMessage(ui, + NuitonValidatorScope.INFO, + getTypeI18nKey(TripLonglineDto.class), + t("observe.common.TripLonglineDto.message.not.open")); + + if (getModel().isHistoricalData()) { + + addInfoMessage(t("observe.common.DataDto.message.historical.data")); + } + + } else { + + // seule l'activity n'est pas ouverte + addInfoMessage(t(closeMessage)); + } + + return ContentMode.READ; + } + + @Override + public void openUI() { + super.openUI(); + + getUi().getCoordinatesEditor().resetModel(); + + String tripId = getSelectedParentId(); + String activityId = getSelectedId(); + + if (log.isInfoEnabled()) { + log.info(prefix + "tripId = " + tripId); + log.info(prefix + "activityId = " + activityId); + } + + ContentMode mode = computeContentMode(); + if (log.isInfoEnabled()) { + log.info(prefix + "content mode " + mode); + } + ActivityLonglineDto bean = getBean(); + + boolean create = activityId == null; + + Form<ActivityLonglineDto> form; + if (create) { + + // create mode + form = getActivityLonglineService().preCreate(tripId); + + } else { + + // update mode + form = getActivityLonglineService().loadForm(activityId); + + } + + setContentMode(mode); + + loadReferentialReferenceSetsInModel(form); + + getModel().setForm(form); + ActivityLonglineHelper.copyActivityLonglineDto(form.getObject(), bean); + + if (log.isDebugEnabled()) { + log.debug(" long - lat = " + bean.getLongitude() + " - " + bean.getLatitude()); + } + finalizeOpenUI(mode, create); + + // Mise à jour du composant de coordonnées + // 1. Mise à jour latitude/longitude: + getUi().getCoordinatesEditor().setLatitudeAndLongitude(bean.getLatitude(), bean.getLongitude()); + + // 2. Mise à jour du quadrant : + // Si le bean de données contient un quadrant, on met simplement à jour le composant de coordonnées pour sélectionner le quadrant voulu + // sinon, on réinitialise les quadrants du composant afin qu'aucun d'eux ne soit sélectionné (par exemple dans le cas de la création de la première activité d'une marée) + if (bean.getQuadrant() == null) { + getUi().getCoordinatesEditor().resetQuadrant(); + } else { + getUi().getCoordinatesEditor().setQuadrant(bean.getQuadrant()); + } + + // on annule la modification engendree par ce binding + getModel().setModified(create); + } + + @Override + public void startEditUI(String... binding) { + ActivityLonglineLogbookUI ui = getUi(); + + ContentUIModel<ActivityLonglineDto> model = getModel(); + + boolean create = model.getMode() == ContentMode.CREATE; + String contextName = getValidatorContextName(model.getMode()); + ui.getValidator().setContext(contextName); + if (create) { + addMessage(ui, + NuitonValidatorScope.INFO, + getTypeI18nKey(ActivityLonglineDto.class), + t("observe.common.ActivityLonglineDto.message.creating")); + } else { + addMessage(ui, + NuitonValidatorScope.INFO, + getTypeI18nKey(ActivityLonglineDto.class), + t("observe.common.ActivityLonglineDto.message.updating")); + } + + super.startEditUI( + ActivityLonglineLogbookUI.BINDING_TIME_STAMP_DATE, + ActivityLonglineLogbookUI.BINDING_SEA_SURFACE_TEMPERATURE_STORAGE_TEMPERATURE, + ActivityLonglineLogbookUI.BINDING_COMMENT_MODEL, + ActivityLonglineLogbookUI.BINDING_VESSEL_ACTIVITY_LONGLINE_SELECTED_ITEM, + ActivityLonglineLogbookUI.BINDING_FPA_ZONE_SELECTED_ITEM, + ActivityLonglineLogbookUI.BINDING_CLOSE_ENABLED, + ActivityLonglineLogbookUI.BINDING_CLOSE_AND_CREATE_ENABLED); + model.setModified(create); + } + + @Override + protected void prepareValidationContext() { + super.prepareValidationContext(); + + ClientValidationContext validationContext = ObserveSwingApplicationContext.get().getValidationContext(); + validationContext.setCoordinatesEditor("coordinate", getUi().getCoordinatesEditor()); + + } + + @Override + protected boolean doSave(ActivityLonglineDto bean) { + + boolean notPersisted = bean.isNotPersisted(); + + String tripId = getSelectedParentId(); + + TripChildSaveResultDto saveResult = getActivityLonglineService().save(tripId, getModel().getBean()); + saveResult.toDto(bean); + + setUpdateMareeNodeTag(saveResult.isTripEndDateUpdated()); + + obtainChildPosition(bean); + + if (notPersisted) { + // ouverture de l'activité après création + getOpenDataManager().openActivityLongline(getSelectedParentId(), bean.getId(), null); + + if (ActivityLonglineHelper.FISHING_OPERATION_ID.equals(bean.getVesselActivityLongline().getId())) { + + // création de l'opération de pêche + SwingUtilities.invokeLater(() -> getUi().getAddSet().doClick()); + } + } + + return true; + } + + @Override + protected int getOpenablePosition(String parentId, ActivityLonglineDto bean) { + return getActivityLonglineService().getActivityLonglinePositionInTripLongline(parentId, bean.getId()); + } + + @Override + protected boolean doDelete(ActivityLonglineDto bean) { + + if (askToDelete(bean)) { + return false; + } + if (log.isInfoEnabled()) { + log.info("Will delete Activity " + bean.getId()); + } + + String tripId = getSelectedParentId(); + boolean wasTripEndDateUpdated = getActivityLonglineService().delete(tripId, bean.getId()); + if (log.isInfoEnabled()) { + log.info("Delete done for Activity " + bean.getId()); + } + getOpenDataManager().closeActivityLongline(bean.getId()); + + setUpdateMareeNodeTag(wasTripEndDateUpdated); + return true; + + } + + @Override + protected void afterSave(boolean refresh) { + super.afterSave(refresh); + repaintTripNode(); + } + + @Override + protected void afterDelete() { + super.afterDelete(); + repaintTripNode(); + } + + @Override + protected boolean obtainCanReopen(boolean create) { + + return !create && getOpenDataManager().canOpenActivityLongline(getSelectedParentId()); + + } + +} ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUIModel.java ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/ActivityLonglineLogbookUIModel.java @@ -0,0 +1,88 @@ +package fr.ird.observe.client.ui.content.data.longline; + +/* + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy 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.ird.observe.client.ui.content.open.ContentOpenableUIModel; +import fr.ird.observe.dto.data.longline.ActivityLonglineDto; +import fr.ird.observe.dto.referential.longline.VesselActivityLonglineHelper; +import fr.ird.observe.dto.referential.longline.VesselActivityLonglineReference; +import org.nuiton.util.DateUtil; + +import java.util.Date; + +/** + * Created on 9/26/14. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since XXX + */ +public class ActivityLonglineLogbookUIModel extends ContentOpenableUIModel<ActivityLonglineDto> { + + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_SET_OPERATION = "setOperation"; + + public static final String PROPERTY_DATE = "date"; + + public static final String PROPERTY_TIME = "time"; + + public ActivityLonglineLogbookUIModel() { + super(ActivityLonglineDto.class); + + getBean().addPropertyChangeListener(ActivityLonglineDto.PROPERTY_VESSEL_ACTIVITY_LONGLINE, evt -> { + boolean oldValue = VesselActivityLonglineHelper.isSetOperation((VesselActivityLonglineReference) evt.getOldValue()); + boolean newValue = VesselActivityLonglineHelper.isSetOperation((VesselActivityLonglineReference) evt.getNewValue()); + firePropertyChange(PROPERTY_SET_OPERATION, oldValue, newValue); + }); + } + + public boolean isSetOperation() { + return VesselActivityLonglineHelper.isSetOperation(bean.getVesselActivityLongline()); + } + + public Date getDate() { + Date timeStamp = bean.getTimeStamp(); + return timeStamp == null ? null : DateUtil.getDay(timeStamp); + } + + public Date getTime() { + Date timeStamp = bean.getTimeStamp(); + return timeStamp == null ? null : DateUtil.getTime(timeStamp, false, false); + } + + public void setDate(Date date) { + Date timeStamp = bean.getTimeStamp(); + if (timeStamp != null) { + Date dateAndTime = date == null ? timeStamp : DateUtil.getDateAndTime(date, timeStamp, true, false); + bean.setTimeStamp(dateAndTime); + } + } + + public void setTime(Date time) { + Date timeStamp = bean.getTimeStamp(); + if (timeStamp != null) { + Date dateAndTime = time == null ? timeStamp : DateUtil.getDateAndTime(timeStamp, time, false, false); + bean.setTimeStamp(dateAndTime); + } + } +} ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUI.jaxx ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUI.jaxx @@ -0,0 +1,282 @@ +<!-- + #%L + ObServe :: Client + %% + Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> + +<fr.ird.observe.client.ui.content.table.ContentTableUI + i18nFormat="observe.common.CatchLonglineDto.%s" + superGenericType='SetLonglineCatchDto, CatchLonglineDto, CatchLonglineLogbookUI' + contentTitle='{n("observe.common.CatchLonglineDto.title")}' + newEntryText='{n("observe.common.CatchLonglineDto.action.new")}' + newEntryTip='{n("observe.common.CatchLonglineDto.action.new.tip")}' + saveNewEntryText='{n("observe.common.CatchLonglineDto.action.create")}' + saveNewEntryTip='{n("observe.common.CatchLonglineDto.action.create.tip")}'> + + <style source="../CommonTable.jcss"/> + + <import> + fr.ird.observe.dto.data.longline.BasketReference + fr.ird.observe.dto.data.longline.BranchlineDto + fr.ird.observe.dto.data.longline.BranchlineReference + fr.ird.observe.dto.data.longline.CatchLonglineDto + fr.ird.observe.dto.data.longline.SectionReference + fr.ird.observe.dto.data.longline.SetLonglineCatchDto + fr.ird.observe.dto.referential.SpeciesReference + fr.ird.observe.dto.referential.SexReference + fr.ird.observe.dto.referential.longline.BaitHaulingStatusReference + fr.ird.observe.dto.referential.longline.CatchFateLonglineReference + fr.ird.observe.dto.referential.longline.HealthnessReference + fr.ird.observe.dto.referential.longline.HookPositionReference + fr.ird.observe.dto.referential.longline.MaturityStatusReference + fr.ird.observe.dto.referential.longline.StomacFullnessReference + fr.ird.observe.client.constants.CatchAcquisitionMode + fr.ird.observe.client.ui.content.table.* + fr.ird.observe.client.ui.util.BooleanEditor + fr.ird.observe.client.ui.util.JComment + + org.nuiton.jaxx.widgets.number.NumberEditor + org.nuiton.jaxx.widgets.select.BeanComboBox + org.nuiton.jaxx.widgets.select.FilterableDoubleList + org.nuiton.jaxx.widgets.datetime.DateTimeEditor + org.nuiton.jaxx.widgets.datetime.TimeEditor + + java.awt.Dimension + + java.util.Collection + + org.apache.commons.lang3.BooleanUtils + + static fr.ird.observe.client.ui.util.UIHelper.getStringValue + static org.nuiton.i18n.I18n.n + </import> + + <!-- model --> + <CatchLonglineLogbookUIModel id='model'/> + + <!-- edit bean --> + <SetLonglineCatchDto id='bean'/> + + <!-- table edit bean --> + <CatchLonglineDto id='tableEditBean'/> + + <!-- table model --> + <ContentTableModel id='tableModel' genericType='SetLonglineCatchDto, CatchLonglineDto'/> + + <!-- edit branchline --> + <BranchlineDto id='branchlineBean' initializer='new BranchlineDto()'/> + + <!-- le validateur de l'écran --> + <BeanValidator id='validator' context='update' + beanClass='fr.ird.observe.dto.data.longline.SetLonglineCatchDto' + errorTableModel='{getErrorTableModel()}'> + </BeanValidator> + + <!-- le validateur d'une entrée de tableau --> + <BeanValidator id='validatorTable' autoField='true' context='update' + beanClass='fr.ird.observe.dto.data.longline.CatchLonglineDto' + errorTableModel='{getErrorTableModel()}' + parentValidator='{validator}'/> + + <JPopupMenu id='catchLonglinesPopup'> + <JMenuItem id='moveCatchLonglineUp' onActionPerformed='getHandler().moveCatchLonglineUp()'/> + <JMenuItem id='moveCatchLonglineDown' onActionPerformed='getHandler().moveCatchLonglineDown()'/> + </JPopupMenu> + + <ButtonGroup id='acquisitionModeGroup' + onStateChanged='getHandler().updateCatchAcquisitionMode((CatchAcquisitionMode) acquisitionModeGroup.getSelectedValue())'/> + + <Table id='editorPanel' fill='both' insets='0'> + <row> + <cell weightx="1" weighty="1"> + <JTabbedPane id='mainTabbedPane'> + <tab id='caracteristicTab' computeI18n=""> + <Table id='editForm' fill='both' insets='1'> + + <row> + <cell columns="4"> + <JPanel layout="{new GridLayout()}"> + + <!-- acquisition Mode --> + <JPanel id='acquisitionModePanel'> + <JRadioButton id='acquisitionModeIndividual'/> + <JRadioButton id='acquisitionModeGrouped'/> + </JPanel> + + </JPanel> + </cell> + </row> + + <!-- speciesCatch --> + <!-- tagNumber --> + <row> + <cell> + <JLabel id='speciesCatchLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <BeanComboBox id='speciesCatch' genericType='SpeciesReference' constructorParams='this'/> + </cell> + <cell anchor='west'> + <JLabel id='tagNumberLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <JPanel layout='{new BorderLayout()}'> + <JToolBar id='tagNumberToolbar' constraints='BorderLayout.WEST'> + <JButton id='resetTagNumber' styleClass='resetButton'/> + </JToolBar> + <JTextField id='tagNumber' constraints='BorderLayout.CENTER'/> + </JPanel> + </cell> + </row> + + <!-- count --> + <row> + <cell> + <JLabel id='countLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <NumberEditor id='count' constructorParams='this' styleClass="int6"/> + </cell> + </row> + + <!-- count --> + <!-- total weight --> + <row> + <cell> + <JLabel id='totalWeightLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <NumberEditor id='totalWeight' constructorParams='this' styleClass="float3"/> + </cell> + <cell> + <JLabel id='weightDeterminationMethodLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <BeanComboBox id='weightDeterminationMethod' constructorParams='this' genericType='HealthnessReference'/> + </cell> + </row> + + + <!-- catch healthness --> + <row> + <cell> + <JLabel id='catchHealthnessLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <BeanComboBox id='catchHealthness' constructorParams='this' genericType='HealthnessReference'/> + </cell> + </row> + + <!-- catch fate --> + <!-- discard healthness --> + <row> + <cell> + <JLabel id='catchFateLonglineLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <BeanComboBox id='catchFateLongline' constructorParams='this' genericType='CatchFateLonglineReference'/> + </cell> + <cell> + <JLabel id='discardHealthnessLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <BeanComboBox id='discardHealthness' constructorParams='this' genericType='HealthnessReference'/> + </cell> + </row> + + <!-- onBordDataProcessing --> + <row> + <cell> + <JLabel id='onBordDataProcessingLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <BeanComboBox id='onBordDataProcessing' constructorParams='this' genericType='CatchFateLonglineReference'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <JPanel layout='{new BorderLayout()}'> + <JToolBar id='photoReferencesToolbar' constraints='BorderLayout.WEST'> + <JButton id='resetPhotoReferences' styleClass='resetButton'/> + </JToolBar> + <JTextField id='photoReferences' constraints='BorderLayout.CENTER'/> + </JPanel> + </cell> + </row> + </Table> + </tab> + + <tab id='depredatedTab' computeI18n=""> + + <Table id='depredatedForm' fill='both' insets='1'> + + <!-- depredated --> + <row> + <cell anchor='west' fill="both"> + <JCheckBox id='depredated' styleClass="i18n"/> + </cell> + </row> + + <!-- beatDiameter --> + <row> + <cell> + <JLabel id='beatDiameterLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <NumberEditor id='beatDiameter' constructorParams='this' styleClass="float3"/> + </cell> + </row> + <!-- countDepredated --> + <row> + <cell> + <JLabel id='countDepredatedLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <NumberEditor id='countDepredated' constructorParams='this' styleClass="float3"/> + </cell> + </row> + <!-- depredatedProportion --> + <row> + <cell> + <JLabel id='depredatedProportionLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <NumberEditor id='depredatedProportion' constructorParams='this' styleClass="float3"/> + </cell> + </row> + + <!-- predator --> + <row> + <cell columns="2" fill="both" weighty="0.7"> + <JScrollPane id='predatorPane'> + <FilterableDoubleList id='predator' genericType='SpeciesReference'/> + </JScrollPane> + </cell> + </row> + + </Table> + </tab> + </JTabbedPane> + </cell> + </row> + <row> + <cell weighty='1'> + <JComment id="comment"/> + </cell> + </row> + </Table> +</fr.ird.observe.client.ui.content.table.ContentTableUI> \ No newline at end of file ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUI.jcss ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUI.jcss @@ -0,0 +1,360 @@ +/* + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +.i18nBranchline { + computeI18n:"observe.common.BranchlineDto.%s" +} + +#model { + valid:{validator.isValid() && validatorTable.isValid()}; + canSaveRow:{validatorTable.isChanged() && validatorTable.isValid() }; + canResetRow:{validatorTable.isChanged()}; +} + +#moveCatchLonglineUp { + text: "observe.common.CatchLonglineDto.action.moveCatchLonglineUp"; + toolTipText: "observe.common.CatchLonglineDto.action.moveCatchLonglineUp.tip"; + actionIcon: go-up; +} + +#moveCatchLonglineDown { + text: "observe.common.CatchLonglineDto.action.moveCatchLonglineDown"; + toolTipText: "observe.common.CatchLonglineDto.action.moveCatchLonglineDown.tip"; + actionIcon: go-down; +} + + +/* ***************************************************************************** */ +/* CARACTERISTIC TAB ********************************************************** */ +/* ***************************************************************************** */ + +#caracteristicTab { + icon:{handler.getErrorIconIfFalse(model.isCaracteristicsTabValid())}; +} + +#acquisitionModeGroup { + selectedValue:{CatchAcquisitionMode.valueOf(tableEditBean.getAcquisitionMode())}; +} + +#acquisitionModePanel { + border:{new TitledBorder(t("observe.common.CatchLonglineDto.acquisitionMode"))}; + layout:{new GridLayout(0,1)}; +} + +#acquisitionModeIndividual { + buttonGroup:acquisitionModeGroup; + value:{CatchAcquisitionMode.INDIVIDUAL}; + text:{CatchAcquisitionMode.INDIVIDUAL.toString()}; + selected:{tableEditBean.getAcquisitionMode() == 0}; + enabled:{!tableModel.isEditable() || tableModel.isCreate()}; +} + +#acquisitionModeGrouped { + buttonGroup:acquisitionModeGroup; + value:{CatchAcquisitionMode.GROUPED}; + text:{CatchAcquisitionMode.GROUPED.toString()}; + selected:{tableEditBean.getAcquisitionMode() == 1}; + enabled:{!tableModel.isEditable() || tableModel.isCreate()}; +} + +#locationOnLonglinePanel { + border:{new TitledBorder(t("observe.common.CatchLonglineDto.locationOnLongline"))}; +} + +#section { + property:{CatchLonglineDto.PROPERTY_SECTION}; + selectedItem:{tableEditBean.getSection()}; + force:true; + _listNoLoad:{true}; +} + +#basket { + property:{CatchLonglineDto.PROPERTY_BASKET}; + selectedItem:{tableEditBean.getBasket()}; + _listNoLoad:{true}; +} + +#branchline { + property:{CatchLonglineDto.PROPERTY_BRANCHLINE}; + selectedItem:{tableEditBean.getBranchline()}; + _listNoLoad:{true}; +} + +#speciesCatch { + property:{CatchLonglineDto.PROPERTY_SPECIES_CATCH}; + selectedItem:{tableEditBean.getSpeciesCatch()}; +} + +#resetPhotoReferences { + toolTipText:"observe.common.CatchLonglineDto.action.reset.photoReferences.tip"; + _resetTablePropertyName:{CatchLonglineDto.PROPERTY_PHOTO_REFERENCES}; +} + +#photoReferences { + text:{getStringValue(tableEditBean.getPhotoReferences())}; + _tablePropertyName:{CatchLonglineDto.PROPERTY_PHOTO_REFERENCES}; +} + +#resetTagNumber { + toolTipText:"observe.common.DataDto.action.resetTagNumber"; + _resetTablePropertyName:{CatchLonglineDto.PROPERTY_TAG_NUMBER}; + enabled:{tableEditBean.getAcquisitionMode() == 0}; +} + +#tagNumber { + text:{getStringValue(tableEditBean.getTagNumber())}; + _tablePropertyName:{CatchLonglineDto.PROPERTY_TAG_NUMBER}; + enabled:{tableEditBean.getAcquisitionMode() == 0}; +} + +#count { + property:{CatchLonglineDto.PROPERTY_COUNT}; + numberValue:{tableEditBean.getCount()}; +} + +#totalWeight { + property:{CatchLonglineDto.PROPERTY_TOTAL_WEIGHT}; + numberValue:{tableEditBean.getTotalWeight()}; +} + +#hookWhenDiscarded { + _tablePropertyName:{CatchLonglineDto.PROPERTY_HOOK_WHEN_DISCARDED}; + booleanValue:{tableEditBean.getHookWhenDiscarded()}; +} + +#catchFateLongline { + property:{CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE}; + selectedItem:{tableEditBean.getCatchFateLongline()}; +} + +#catchHealthness { + property:{CatchLonglineDto.PROPERTY_CATCH_HEALTHNESS}; + selectedItem:{tableEditBean.getCatchHealthness()}; +} + +#discardHealthness { + property:{CatchLonglineDto.PROPERTY_DISCARD_HEALTHNESS}; + selectedItem:{tableEditBean.getDiscardHealthness()}; +} + +#catchFateLongline { + property:{CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE}; + selectedItem:{tableEditBean.getCatchFateLongline()}; +} + +#hookPosition { + property:{CatchLonglineDto.PROPERTY_HOOK_POSITION}; + selectedItem:{tableEditBean.getHookPosition()}; +} + +#comment { + title:"observe.common.CatchLonglineDto.comment"; +} + +/* ***************************************************************************** */ +/* DEPREDATED TAB ************************************************************* */ +/* ***************************************************************************** */ + +#depredatedFormTab { + icon:{handler.getErrorIconIfFalse(model.isDepredatedTabValid())}; +} + +#beatDiameter { + property:{CatchLonglineDto.PROPERTY_BEAT_DIAMETER}; + numberValue:{tableEditBean.getBeatDiameter()}; +} + +#depredated { + horizontalTextPosition:{JCheckBox.LEFT}; + _tablePropertyName:{CatchLonglineDto.PROPERTY_DEPREDATED}; + selected:{BooleanUtils.isTrue(tableEditBean.getDepredated())}; +} + +#predatorPane { + minimumSize:{new Dimension(10,150)}; +} + +#predator { + property: predator; + selected:{(Collection)tableEditBean.getPredator()}; + showListLabel: true; + universeLabel:{t("observe.common.CatchLonglineDto.availablePredator")}; + selectedLabel:{t("observe.common.CatchLonglineDto.selectedPredator")}; +} + +/* ***************************************************************************** */ +/* FOOD AND SEXUAL TAB ******************************************************** */ +/* ***************************************************************************** */ + +#foodAndSexualFormTab { + icon:{handler.getErrorIconIfFalse(model.isFoodAndSexualTabValid())}; +} + +#foodAndSexualForm { + border:{new TitledBorder( (String) null)}; +} + +#sex { + property:{CatchLonglineDto.PROPERTY_SEX}; + selectedItem:{tableEditBean.getSex()}; +} + +#stomacFullness { + property:{CatchLonglineDto.PROPERTY_STOMAC_FULLNESS}; + selectedItem:{tableEditBean.getStomacFullness()}; +} + +#maturityStatus { + property:{CatchLonglineDto.PROPERTY_MATURITY_STATUS}; + selectedItem:{tableEditBean.getMaturityStatus()}; +} + +#gonadeWeight { + property:{CatchLonglineDto.PROPERTY_GONADE_WEIGHT}; + numberValue:{tableEditBean.getGonadeWeight()}; +} + +/* ***************************************************************************** */ +/* SIZE MEASURES TAB ********************************************************** */ +/* ***************************************************************************** */ + +#sizeMeasuresFormTab { + icon:{handler.getErrorIconIfFalse(sizeMeasuresTableModel.isValid())}; +} + +#sizeMeasuresTable { + model: {sizeMeasuresTableModel}; +} + +#addSizeMeasure { + text: "observe.common.CatchLonglineDto.action.addSizeMeasure"; + toolTipText: "observe.common.CatchLonglineDto.action.addSizeMeasure.tip"; + actionIcon: add; +} + +#deleteSelectedSizeMeasure { + text: "observe.common.CatchLonglineDto.action.deleteSelectedSizeMeasure"; + toolTipText: "observe.common.CatchLonglineDto.action.deleteSelectedSizeMeasure.tip"; + actionIcon: delete; +} + +/* ***************************************************************************** */ +/* WEIGHT MEASURES TAB ******************************************************** */ +/* ***************************************************************************** */ + +#weightMeasuresFormTab { + icon:{handler.getErrorIconIfFalse(weightMeasuresTableModel.isValid())}; +} + +#weightMeasuresTable { + model: {weightMeasuresTableModel}; +} + +#addWeightMeasure { + text: "observe.common.CatchLonglineDto.action.addWeightMeasure"; + toolTipText: "observe.common.CatchLonglineDto.action.addWeightMeasure.tip"; + actionIcon: add; +} + +#deleteSelectedWeightMeasure { + text: "observe.common.CatchLonglineDto.action.deleteSelectedWeightMeasure"; + toolTipText: "observe.common.CatchLonglineDto.action.deleteSelectedWeightMeasure.tip"; + actionIcon: delete; +} + +/* ***************************************************************************** */ +/* BRANCHLINE TAB ************************************************************* */ +/* ***************************************************************************** */ + +#branchlineFormTab { + icon:{handler.getErrorIconIfFalse(model.isBranchlineTabValid())}; + enabled:{!tableModel.isCreate() && tableEditBean.getBranchline() != null}; +} + +#branchlineForm { + border:{new TitledBorder( (String) null)}; + visible:{!tableModel.isCreate() && tableEditBean.getBranchline() != null}; +} + +#depthRecorder { + horizontalTextPosition:{JCheckBox.LEFT}; + _branchlineBeanPropertyName:{BranchlineDto.PROPERTY_DEPTH_RECORDER}; + selected:{BooleanUtils.isTrue(branchlineBean.getDepthRecorder())}; +} + +#hookLost { + horizontalTextPosition:{JCheckBox.LEFT}; + _branchlineBeanPropertyName:{BranchlineDto.PROPERTY_HOOK_LOST}; + selected:{BooleanUtils.isTrue(branchlineBean.getHookLost())}; +} + +#traceCutOff { + horizontalTextPosition:{JCheckBox.LEFT}; + _branchlineBeanPropertyName:{BranchlineDto.PROPERTY_TRACE_CUT_OFF}; + selected:{BooleanUtils.isTrue(branchlineBean.getTraceCutOff())}; +} + +#timer { + horizontalTextPosition:{JCheckBox.LEFT}; + _branchlineBeanPropertyName:{BranchlineDto.PROPERTY_TIMER}; + selected:{BooleanUtils.isTrue(branchlineBean.getTimer())}; +} + +#timeSinceContact { + propertyTime:{CatchLonglineUIModel.PROPERTY_BRANCHLINE_TIME_SINCE_CONTACT}; + bean:{model}; + enabled:{BooleanUtils.isTrue(branchlineBean.getTimer())}; + time:{model.getBranchlineTimeSinceContact()}; + showTimeEditorSlider:false; +} + +#timerTimeOnBoard { + date:{branchlineBean.getTimerTimeOnBoard()}; + propertyDate: {BranchlineDto.PROPERTY_TIMER_TIME_ON_BOARD}; + bean:{branchlineBean}; + showTimeEditorSlider:false; + enabled:{BooleanUtils.isTrue(branchlineBean.getTimer())}; +} + +#baitHaulingStatus { + property:{BranchlineDto.PROPERTY_BAIT_HAULING_STATUS}; + bean:{branchlineBean}; + selectedItem:{branchlineBean.getBaitHaulingStatus()}; +} + +#branchlineActions { + visible:{tableModel.isEditable()}; +} + +#resetBranchline { + text:"observe.common.CatchLonglineDto.resetBranchline"; + toolTipText:"observe.common.CatchLonglineDto.resetBranchline.tip"; + actionIcon:"revert"; + enabled:{branchlineValidator.isChanged()}; +} + +#saveBranchline{ + text:"observe.common.CatchLonglineDto.saveBranchline"; + toolTipText:"observe.common.CatchLonglineDto.saveBranchline.tip"; + actionIcon:"save"; + enabled:{branchlineValidator.isChanged() && branchlineValidator.isValid()}; +} ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUIHandler.java ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUIHandler.java @@ -0,0 +1,508 @@ +package fr.ird.observe.client.ui.content.data.longline; + +/* + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy 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.ird.observe.client.ObserveSwingApplicationContext; +import fr.ird.observe.client.constants.CatchAcquisitionMode; +import fr.ird.observe.client.db.constants.DataContextType; +import fr.ird.observe.client.ui.content.ContentUIModel; +import fr.ird.observe.client.ui.content.table.ContentTableModel; +import fr.ird.observe.client.ui.content.table.ContentTableUIHandler; +import fr.ird.observe.client.ui.content.table.ContentTableUIInitializer; +import fr.ird.observe.client.ui.tree.navigation.NavigationTree; +import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport; +import fr.ird.observe.client.ui.tree.navigation.nodes.longline.TripLonglineNavigationTreeNode; +import fr.ird.observe.client.ui.util.UIHelper; +import fr.ird.observe.client.ui.util.table.AutotSelectRowAndShowPopupActionSupport; +import fr.ird.observe.dto.data.longline.BranchlineDto; +import fr.ird.observe.dto.data.longline.CatchLonglineDto; +import fr.ird.observe.dto.data.longline.SetLonglineCatchDto; +import fr.ird.observe.dto.data.longline.TripLonglineReference; +import fr.ird.observe.dto.form.Form; +import fr.ird.observe.dto.form.FormDefinition; +import fr.ird.observe.dto.reference.DtoReferenceCollection; +import fr.ird.observe.dto.referential.SpeciesDto; +import fr.ird.observe.dto.referential.SpeciesReference; +import fr.ird.observe.dto.referential.longline.CatchFateLonglineReference; +import fr.ird.observe.dto.referential.longline.HealthnessReference; +import fr.ird.observe.dto.result.SaveResultDto; +import fr.ird.observe.spi.DtoModelHelper; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; +import org.nuiton.jaxx.validator.swing.SwingValidatorMessage; +import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel; +import org.nuiton.validator.NuitonValidatorScope; + +import javax.swing.JComponent; +import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.event.TableModelListener; +import javax.swing.table.DefaultTableCellRenderer; +import java.beans.PropertyChangeListener; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + +/** + * Created on 9/11/14. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 3.7 + */ +public class CatchLonglineLogbookUIHandler extends ContentTableUIHandler<SetLonglineCatchDto, CatchLonglineDto, CatchLonglineLogbookUI> implements UIHandler<CatchLonglineLogbookUI> { + + /** Logger */ + private static final Log log = LogFactory.getLog(CatchLonglineLogbookUIHandler.class); + private static final String GROUPED_TRIP_TYPE_ID = "fr.ird.observe.entities.referentiel.longline.TripType#1239832686136#0.1"; + // Compute valid state of tab from the error table + protected final TableModelListener computeTabValidStateListener; + private final PropertyChangeListener catchFateChanged; + private final PropertyChangeListener depredatedChanged; + + CatchLonglineLogbookUIHandler() { + super(DataContextType.SetLongline); + computeTabValidStateListener = e -> { + + SwingValidatorMessageTableModel source = (SwingValidatorMessageTableModel) e.getSource(); + computeTabValidState(source); + + }; + catchFateChanged = evt -> onCatchFateChanged((CatchFateLonglineReference) evt.getNewValue()); + depredatedChanged = evt -> onDepredatedChanged((Boolean) evt.getNewValue(), (CatchLonglineDto) evt.getSource()); + + addReferentialFilter(CatchLonglineDto.PROPERTY_SPECIES_CATCH, (ReferentialReferencesFilter<SpeciesDto, SpeciesReference>) incomingReferences -> { + String speciesListId = ObserveSwingApplicationContext.get().getConfig().getSpeciesListLonglineCatchId(); + String tripLonglineId = getDataContext().getSelectedTripLonglineId(); + List<SpeciesReference> result = getTripLonglineService().getSpeciesByListAndTrip(tripLonglineId, speciesListId).toList(); + return DtoReferenceCollection.filterEnabled(result); + }); + + addReferentialFilter(CatchLonglineDto.PROPERTY_PREDATOR, (ReferentialReferencesFilter<SpeciesDto, SpeciesReference>) incomingReferences -> { + String speciesListId = ObserveSwingApplicationContext.get().getConfig().getSpeciesListLonglineDepredatorId(); + String tripLonglineId = getDataContext().getSelectedTripLonglineId(); + List<SpeciesReference> result = getTripLonglineService().getSpeciesByListAndTrip(tripLonglineId, speciesListId).toList(); + return DtoReferenceCollection.filterEnabled(result); + }); + } + + @Override + public CatchLonglineLogbookUIModel getModel() { + return (CatchLonglineLogbookUIModel) super.getModel(); + } + + @Override + public void afterInit(CatchLonglineLogbookUI ui) { + + ContentTableUIInitializer<SetLonglineCatchDto, CatchLonglineDto, CatchLonglineLogbookUI> uiInitializer = new ContentTableUIInitializer<>(ui); + uiInitializer.initUI(); + + ui.setTitle(t(updateTitle(ui.getContentTitle()))); + updateTitle(getModel().getMode()); + + installFocusTraversalPolicy(); + + CatchLonglineLogbookUIModel model = ui.getModel(); + + model.addPropertyChangeListener(ContentUIModel.PROPERTY_FORM, evt -> updateUiWithReferenceSetsFromModel()); + } + + @Override + public void openUI() { + + if (log.isInfoEnabled()) { + log.info("OpenUI: " + getModel()); + } + + super.openUI(); + + // To be sure always remove listener (could prevent some leaks) + getUi().getErrorTableModel().removeTableModelListener(computeTabValidStateListener); + // listen messages to see if required to add + getUi().getErrorTableModel().addTableModelListener(computeTabValidStateListener); + + SwingValidatorMessageTableModel errorTableModel = getUi().getErrorTableModel(); + computeTabValidState(errorTableModel); + + } + + void updateCatchAcquisitionMode(CatchAcquisitionMode newMode) { + + if (log.isDebugEnabled()) { + log.debug("Change CatchAcquisitionMode " + newMode); + } + if (newMode == null) { + + // mode null (cela peut arriver avec les bindings) + return; + } + + CatchLonglineLogbookUI ui = getUi(); + + boolean createMode = ui.getTableModel().isCreate(); + + CatchLonglineDto editBean = ui.getTableEditBean(); + + switch (newMode) { + + case GROUPED: + + if (createMode) { + + editBean.setTotalWeight(null); + editBean.setCount(null); + editBean.setHookPosition(null); + + } + + break; + + case INDIVIDUAL: + + if (createMode) { + + // on positionne le count à 1 (seule valeur possible) + editBean.setCount(1); + + } + + break; + } + + boolean isGrouped = CatchAcquisitionMode.GROUPED.equals(newMode); + + ui.getTotalWeight().setEnabled(isGrouped); + ui.getCount().setEnabled(isGrouped); + + if (createMode) { + + // on propage le mode de saisie dans le bean + editBean.setAcquisitionMode(newMode.ordinal()); + + } + } + + @Override + protected void onSelectedRowChanged(int editingRow, CatchLonglineDto bean, boolean create) { + + if (log.isInfoEnabled()) { + log.info("Selected row changed: " + editingRow + ", create? " + create); + } + + CatchLonglineLogbookUI ui = getUi(); + + CatchLonglineTableModel tableModel = getTableModel(); + + if (!tableModel.isEditable()) { + return; + } + + JComponent requestFocus; + + CatchAcquisitionMode acquisitionModeEnum; + + if (tableModel.isCreate()) { + + // go back to first pane + ui.getMainTabbedPane().setSelectedIndex(0); + + NavigationTree treeHelper = getNavigationTree(); + NavigationTreeNodeSupport selectedNode = treeHelper.getSelectedNode(); + while (!(selectedNode instanceof TripLonglineNavigationTreeNode)) { + selectedNode = selectedNode.getParent(); + } + TripLonglineReference tripReference = ((TripLonglineNavigationTreeNode) selectedNode).getData(); + String tripTypeId = tripReference.getTripTypeId(); + if (log.isInfoEnabled()) { + log.info("Use tripId: " + tripTypeId); + } + acquisitionModeEnum = GROUPED_TRIP_TYPE_ID.equals(tripTypeId) ? CatchAcquisitionMode.GROUPED : CatchAcquisitionMode.INDIVIDUAL; + + ui.getPredator().setEnabled(false); + ui.getDiscardHealthness().setEnabled(false); + ui.getBeatDiameter().setEnabled(false); + + requestFocus = ui.getSpeciesCatch(); + + } else { + + int acquisitionMode = bean.getAcquisitionMode(); + + acquisitionModeEnum = CatchAcquisitionMode.valueOf(acquisitionMode); + + if (acquisitionModeEnum.equals(CatchAcquisitionMode.GROUPED)) { + + requestFocus = ui.getCount(); + + } else { + + requestFocus = ui.getCatchHealthness(); + + } + + //FIXME Voir si pas besoin aussi de relancer les binding (catchFateChanged, branchlineChanged) ? + onDepredatedChanged(bean.getDepredated(), bean); + + } + + ui.getAcquisitionModeGroup().setSelectedValue(null); + ui.getAcquisitionModeGroup().setSelectedValue(acquisitionModeEnum); + + bean.removePropertyChangeListener(CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE, catchFateChanged); + bean.addPropertyChangeListener(CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE, catchFateChanged); + + bean.removePropertyChangeListener(CatchLonglineDto.PROPERTY_DEPREDATED, depredatedChanged); + bean.addPropertyChangeListener(CatchLonglineDto.PROPERTY_DEPREDATED, depredatedChanged); + + UIHelper.askFocus(requestFocus); + + } + + @Override + protected void initTableUI(DefaultTableCellRenderer renderer) { + + CatchLonglineLogbookUI ui = getUi(); + { + // init main table + + JTable table = ui.getTable(); + + UIHelper.setI18nTableHeaderRenderer( + table, + + n("observe.common.CatchLonglineDto.table.speciesCatch"), + n("observe.common.CatchLonglineDto.table.speciesCatch.tip"), + n("observe.common.CatchLonglineDto.table.acquisitionMode"), + n("observe.common.CatchLonglineDto.table.acquisitionMode.tip"), + n("observe.common.CatchLonglineDto.table.count"), + n("observe.common.CatchLonglineDto.table.count.tip"), + n("observe.common.CatchLonglineDto.table.catchHealthness"), + n("observe.common.CatchLonglineDto.table.catchHealthness.tip"), + n("observe.common.CatchLonglineDto.table.catchFateLongline"), + n("observe.common.CatchLonglineDto.table.catchFateLongline.tip"), + n("observe.common.CatchLonglineDto.table.discardHealthness"), + n("observe.common.CatchLonglineDto.table.discardHealthness.tip"), + n("observe.common.CatchLonglineDto.table.depredated"), + n("observe.common.CatchLonglineDto.table.depredated.tip"), + n("observe.common.CatchLonglineDto.table.comment"), + n("observe.common.CatchLonglineDto.table.comment.tip")); + + + UIHelper.setTableColumnRenderer(table, 0, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, SpeciesReference.class)); + UIHelper.setTableColumnRenderer(table, 1, UIHelper.newEnumTableCellRenderer(renderer, CatchAcquisitionMode.class)); + UIHelper.setTableColumnRenderer(table, 2, UIHelper.newEmptyNumberTableCellRenderer(renderer)); + UIHelper.setTableColumnRenderer(table, 3, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, HealthnessReference.class)); + UIHelper.setTableColumnRenderer(table, 4, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, CatchFateLonglineReference.class)); + UIHelper.setTableColumnRenderer(table, 5, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, HealthnessReference.class)); + UIHelper.setTableColumnRenderer(table, 6, UIHelper.newBooleanTableCellRenderer(renderer)); + UIHelper.setTableColumnRenderer(table, 7, UIHelper.newStringTableCellRenderer(renderer, 10, true)); + + new CatchLonglinesAutotSelectRowAndShowPopupAction(ui, ui.getTableScrollPane(), table, ui.getCatchLonglinesPopup()); + + } + + getTableModel().addPropertyChangeListener(ContentTableModel.CREATE_PROPERTY, evt -> { + Boolean oldValue = (Boolean) evt.getOldValue(); + Boolean newValue = (Boolean) evt.getNewValue(); + setTableModelCreate(oldValue, newValue); + }); + } + + @Override + protected String getEditBeanIdToLoad() { + return getDataContext().getSelectedSetLonglineId(); + } + + @Override + protected void doPersist(SetLonglineCatchDto bean) { + SaveResultDto saveResult = getSetLonglineCatchService().save(bean); + bean.setLastUpdateDate(saveResult.getLastUpdateDate()); + } + + @Override + protected boolean prepareSave(SetLonglineCatchDto editBean, List<CatchLonglineDto> objets) throws Exception { + boolean doSave = super.prepareSave(editBean, objets); + if (doSave) { + editBean.setCatchLongline(objets); + } + return doSave; + } + + @Override + protected void loadEditBean(String beanId) { + + Form<SetLonglineCatchDto> form = getSetLonglineCatchService().loadForm(beanId); + + CatchLonglineLogbookUIModel model = getModel(); + + // On supprime l'entrée sélectionnée dans le tableau + getTableModel().setSelectedRow(-1); + + loadReferentialReferenceSetsInModel(form); + + Optional<FormDefinition<BranchlineDto>> optionalFormDefinition = DtoModelHelper.getOptionalFormDefinition(BranchlineDto.class); + optionalFormDefinition.ifPresent(branchlineDtoFormDefinition -> loadReferentialReferenceSetsInModel(branchlineDtoFormDefinition, false)); + + model.setForm(form); + } + + @Override + protected void closeSafeUI() { + + if (log.isInfoEnabled()) { + log.info("CloseUI: " + getModel()); + } + super.closeSafeUI(); + + // remove listener + getUi().getErrorTableModel().removeTableModelListener(computeTabValidStateListener); + + } + + private void setTableModelCreate(Boolean oldValue, Boolean newValue) { + + if (BooleanUtils.isTrue(oldValue) && BooleanUtils.isFalse(newValue)) { + + // just save a row + // reload acquisition mode (will rebind some stuff) + + CatchAcquisitionMode acquisitionModeEnum = (CatchAcquisitionMode) getUi().getAcquisitionModeGroup().getSelectedValue(); + + getUi().getAcquisitionModeGroup().setSelectedValue(null); + getUi().getAcquisitionModeGroup().setSelectedValue(acquisitionModeEnum); + + } + + } + + private void onCatchFateChanged(CatchFateLonglineReference newValue) { + + CatchLonglineLogbookUI ui = getUi(); + + if (newValue == null || !"fr.ird.observe.entities.referentiel.longline.CatchFateLongline#1239832686125#0.3".equals(newValue.getId())) { + + // not discarded + ui.getDiscardHealthness().setEnabled(false); + + getTableEditBean().setHookWhenDiscarded(null); + getTableEditBean().setDiscardHealthness(null); + + } else { + + // discarded + ui.getDiscardHealthness().setEnabled(true); + } + + } + + private void onDepredatedChanged(Boolean newValue, CatchLonglineDto tableEditBean) { + + CatchLonglineLogbookUI ui = getUi(); + + if (BooleanUtils.isTrue(newValue)) { + + // depredated + ui.getBeatDiameter().setEnabled(true); + ui.getPredator().setEnabled(true); + + } else { + + // not depredated + ui.getBeatDiameter().setEnabled(false); + ui.getPredator().setEnabled(false); + tableEditBean.setBeatDiameter(null); + tableEditBean.setPredator(null); + + } + + } + + protected void computeTabValidState(SwingValidatorMessageTableModel errorTableModel) { + + Set<String> errorProperties = new HashSet<>(); + int rowCount = errorTableModel.getRowCount(); + for (int i = 0; i < rowCount; i++) { + + SwingValidatorMessage row = errorTableModel.getRow(i); + if (NuitonValidatorScope.ERROR.equals(row.getScope())) { + errorProperties.add(row.getField()); + } + } + + boolean caracteristicsTabValid = !errorProperties.removeAll(CatchLonglineLogbookUIModel.CARACTERISTIC_TAB_PROPERTIES); + boolean depredatedTabValid = !errorProperties.removeAll(CatchLonglineLogbookUIModel.DEPREDATED_TAB_PROPERTIES); + + CatchLonglineLogbookUIModel model = getModel(); + + model.setCaracteristicsTabValid(caracteristicsTabValid); + model.setDepredatedTabValid(depredatedTabValid); + } + + @Override + protected CatchLonglineTableModel getTableModel() { + return (CatchLonglineTableModel) super.getTableModel(); + } + + public void moveCatchLonglineUp() { + int selectedRow = getUi().getTable().getSelectedRow(); + getTableModel().moveUp(selectedRow); + } + + public void moveCatchLonglineDown() { + int selectedRow = getUi().getTable().getSelectedRow(); + getTableModel().moveDown(selectedRow); + } + + static class CatchLonglinesAutotSelectRowAndShowPopupAction extends AutotSelectRowAndShowPopupActionSupport { + + private final CatchLonglineLogbookUI ui; + + CatchLonglinesAutotSelectRowAndShowPopupAction(CatchLonglineLogbookUI ui, + JScrollPane pane, + JTable table, + JPopupMenu popup) { + super(pane, table, popup); + this.ui = ui; + } + + @Override + protected void beforeOpenPopup(int modelRowIndex, int modelColumnIndex) { + + CatchLonglineTableModel model = (CatchLonglineTableModel) getTable().getModel(); + + boolean canMoveUp = !ui.getModel().isCanSaveRow() && modelRowIndex > 0; + boolean canMoveDown = !ui.getModel().isCanSaveRow() && modelRowIndex < model.getRowCount() - 1; + + ui.getMoveCatchLonglineUp().setEnabled(canMoveUp); + ui.getMoveCatchLonglineDown().setEnabled(canMoveDown); + + } + + } +} ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUIModel.java ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineLogbookUIModel.java @@ -0,0 +1,152 @@ +package fr.ird.observe.client.ui.content.data.longline; + +/* + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.collect.ImmutableSet; +import fr.ird.observe.client.ui.content.table.ContentTableMeta; +import fr.ird.observe.client.ui.content.table.ContentTableModel; +import fr.ird.observe.client.ui.content.table.ContentTableUIModel; +import fr.ird.observe.client.ui.content.table.ObserveContentTableUI; +import fr.ird.observe.dto.data.longline.CatchLonglineDto; +import fr.ird.observe.dto.data.longline.SetLonglineCatchDto; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderModelBuilder; + +import java.util.Arrays; +import java.util.List; +import java.util.Set; + +/** + * Created on 9/26/14. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 3.7 + */ +public class CatchLonglineLogbookUIModel extends ContentTableUIModel<SetLonglineCatchDto, CatchLonglineDto> { + + public static final String PROPERTY_CARACTERISTICS_TAB_VALID = "caracteristicsTabValid"; + + public static final String PROPERTY_DEPREDATED_TAB_VALID = "depredatedTabValid"; + + public static final Set<String> CARACTERISTIC_TAB_PROPERTIES = + ImmutableSet.<String>builder().add(CatchLonglineDto.PROPERTY_SPECIES_CATCH, + CatchLonglineDto.PROPERTY_PHOTO_REFERENCES, + CatchLonglineDto.PROPERTY_COUNT, + CatchLonglineDto.PROPERTY_TOTAL_WEIGHT, + CatchLonglineDto.PROPERTY_CATCH_HEALTHNESS, + CatchLonglineDto.PROPERTY_HOOK_POSITION, + CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE, + CatchLonglineDto.PROPERTY_DISCARD_HEALTHNESS, + CatchLonglineDto.PROPERTY_TAG_NUMBER, + CatchLonglineDto.PROPERTY_HOOK_WHEN_DISCARDED).build(); + + public static final Set<String> DEPREDATED_TAB_PROPERTIES = + ImmutableSet.<String>builder().add(CatchLonglineDto.PROPERTY_DEPREDATED, + CatchLonglineDto.PROPERTY_BEAT_DIAMETER, + CatchLonglineDto.PROPERTY_PREDATOR).build(); + + + private static final long serialVersionUID = 1L; + + protected boolean caracteristicsTabValid; + + protected boolean depredatedTabValid; + + public CatchLonglineLogbookUIModel(CatchLonglineUI ui) { + super(SetLonglineCatchDto.class, + CatchLonglineDto.class, + new String[]{ + SetLonglineCatchDto.PROPERTY_CATCH_LONGLINE + }, + new String[]{CatchLonglineDto.PROPERTY_SPECIES_CATCH, + CatchLonglineDto.PROPERTY_ACQUISITION_MODE, + CatchLonglineDto.PROPERTY_COUNT, + CatchLonglineDto.PROPERTY_CATCH_HEALTHNESS, + CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE, + CatchLonglineDto.PROPERTY_DISCARD_HEALTHNESS, + CatchLonglineDto.PROPERTY_DEPREDATED, + CatchLonglineDto.PROPERTY_NUMBER, + CatchLonglineDto.PROPERTY_HOME_ID, + CatchLonglineDto.PROPERTY_HOOK_POSITION, + CatchLonglineDto.PROPERTY_HOOK_WHEN_DISCARDED, + CatchLonglineDto.PROPERTY_MATURITY_STATUS, + CatchLonglineDto.PROPERTY_PHOTO_REFERENCES, + CatchLonglineDto.PROPERTY_SEX, + CatchLonglineDto.PROPERTY_PREDATOR, + CatchLonglineDto.PROPERTY_STOMAC_FULLNESS, + CatchLonglineDto.PROPERTY_TOTAL_WEIGHT, + CatchLonglineDto.PROPERTY_BEAT_DIAMETER, + CatchLonglineDto.PROPERTY_GONADE_WEIGHT, + CatchLonglineDto.PROPERTY_TAG_NUMBER, + CatchLonglineDto.PROPERTY_COMMENT + }); + + List<ContentTableMeta<CatchLonglineDto>> metas = Arrays.asList( + ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_SPECIES_CATCH, false), + ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_ACQUISITION_MODE, false), + ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_COUNT, false), + ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_CATCH_HEALTHNESS, false), + ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_CATCH_FATE_LONGLINE, false), + ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_DISCARD_HEALTHNESS, false), + ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_DEPREDATED, false), + ContentTableModel.newTableMeta(CatchLonglineDto.class, CatchLonglineDto.PROPERTY_COMMENT, false)); + + initModel(ui, metas); + + } + + public boolean isCaracteristicsTabValid() { + return caracteristicsTabValid; + } + + public void setCaracteristicsTabValid(boolean caracteristicsTabValid) { + this.caracteristicsTabValid = caracteristicsTabValid; + firePropertyChange(PROPERTY_CARACTERISTICS_TAB_VALID, null, caracteristicsTabValid); + } + + public boolean isDepredatedTabValid() { + return depredatedTabValid; + } + + public void setDepredatedTabValid(boolean depredatedTabValid) { + this.depredatedTabValid = depredatedTabValid; + firePropertyChange(PROPERTY_DEPREDATED_TAB_VALID, null, depredatedTabValid); + } + + @Override + protected CatchLonglineTableModel createTableModel(ObserveContentTableUI<SetLonglineCatchDto, CatchLonglineDto, ?> ui, List<ContentTableMeta<CatchLonglineDto>> contentTableMetas) { + return new CatchLonglineTableModel(ui, contentTableMetas); + } + + @Override + protected BinderModelBuilder<CatchLonglineDto, CatchLonglineDto> prepareChildLoador(String binderName) { + + BinderModelBuilder<CatchLonglineDto, CatchLonglineDto> builder = super.prepareChildLoador(binderName); + + builder.addCollectionStrategy(Binder.CollectionStrategy.duplicate, CatchLonglineDto.PROPERTY_PREDATOR); + + return builder; + + } + +} ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUI.jaxx ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUI.jaxx @@ -0,0 +1,452 @@ +<!-- + #%L + ObServe :: Client + %% + Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> + +<fr.ird.observe.client.ui.content.ContentUI + i18nFormat="observe.common.SetLonglineDto.%s" + superGenericType='SetLonglineDto, SetLonglineLogbookUI' + contentTitle='{n("observe.common.SetLonglineDto.title")}'> + + <import> + fr.ird.observe.dto.data.longline.SetLonglineDto + fr.ird.observe.dto.referential.longline.SettingShapeReference + fr.ird.observe.dto.referential.longline.LineTypeReference + fr.ird.observe.dto.referential.longline.LightsticksTypeReference + fr.ird.observe.dto.referential.longline.LightsticksColorReference + + fr.ird.observe.client.ui.actions.content.DeleteDataUIAction + fr.ird.observe.client.ui.actions.content.ResetEditUIAction + fr.ird.observe.client.ui.actions.content.SaveEditUIAction + fr.ird.observe.client.ui.actions.main.global.DeleteDataGlobalUIAction + fr.ird.observe.client.ui.actions.main.global.NewNextDataGlobalUIAction + fr.ird.observe.client.ui.actions.main.global.ResetDataGlobalUIAction + fr.ird.observe.client.ui.actions.main.global.SaveDataGlobalUIAction + + fr.ird.observe.client.ui.content.ContentUIModel + fr.ird.observe.client.ui.util.BooleanEditor + fr.ird.observe.client.ui.util.JComment + + org.nuiton.jaxx.widgets.number.NumberEditor + org.nuiton.jaxx.widgets.select.BeanComboBox + org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor + org.nuiton.jaxx.widgets.datetime.DateTimeEditor + + org.apache.commons.lang3.BooleanUtils + + java.awt.Dimension + + static fr.ird.observe.client.ui.util.UIHelper.getStringValue + static org.nuiton.i18n.I18n.n + </import> + + <style source="../../Common.jcss"/> + + <!-- model --> + <SetLonglineLogbookUIModel id='model'/> + + <!-- edit bean --> + <SetLonglineDto id='bean'/> + + <!-- validator --> + <BeanValidator id='validator' autoField='true' context='update' + beanClass='fr.ird.observe.dto.data.longline.SetLonglineDto' + errorTableModel='{getErrorTableModel()}'> + + <field name='settingStartLongitude' component='settingStartCoordinates'/> + <field name='settingStartLatitude' component='settingStartCoordinates'/> + <field name='settingStartQuadrant' component='settingStartCoordinates'/> + + <field name='settingEndLongitude' component='settingEndCoordinates'/> + <field name='settingEndLatitude' component='settingEndCoordinates'/> + <field name='settingEndQuadrant' component='settingEndCoordinates'/> + + <field name='haulingStartLongitude' component='haulingStartCoordinates'/> + <field name='haulingStartLatitude' component='haulingStartCoordinates'/> + <field name='haulingStartQuadrant' component='haulingStartCoordinates'/> + + <field name='haulingEndLongitude' component='haulingEndCoordinates'/> + <field name='haulingEndLatitude' component='haulingEndCoordinates'/> + <field name='haulingEndQuadrant' component='haulingEndCoordinates'/> + + </BeanValidator> + + <!-- formulaire --> + <JPanel id="body" layout='{new BorderLayout()}'> + + <Table insets="0" fill="both" constraints='BorderLayout.CENTER'> + <row> + <cell anchor="north"> + <JTabbedPane id='mainTabbedPane'> + <tab id='settingTab' computeI18n=""> + <JPanel layout='{new BorderLayout()}'> + <Table fill='both' constraints='BorderLayout.NORTH'> + + <!-- homeId --> + <row> + <cell anchor='west'> + <JLabel id='homeIdLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <JPanel layout='{new BorderLayout()}'> + <JToolBar id='homeIdToolbar' constraints='BorderLayout.WEST'> + <JButton id='resetHomeId' constraints='BorderLayout.WEST' styleClass='resetButton'/> + </JToolBar> + <JTextField id='homeId' constraints='BorderLayout.CENTER'/> + </JPanel> + </cell> + </row> + <!-- number --> + <row> + <cell anchor='west'> + <JLabel id='numberLabel'/> + </cell> + <cell columns="2" weightx="1" fill="both"> + <NumberEditor id='number' constructorParams='this' styleClass="int6"/> + </cell> + </row> + <!-- setting shape --> + <row> + <cell anchor='west'> + <JLabel id='settingShapeLabel'/> + </cell> + <cell columns="3" fill="both"> + <BeanComboBox id='settingShape' constructorParams='this' genericType='SettingShapeReference'/> + </cell> + </row> + <row> + <cell columns="2"> + <Table insets="0" fill='both'> + <!-- setting start timeStamp --> + <row> + <cell weightx="1"> + <DateTimeEditor id='settingStartTimeStamp' constructorParams='this'/> + </cell> + </row> + + <!-- setting start position --> + <row> + <cell anchor="east"> + <CoordinatesEditor id='settingStartCoordinates' constructorParams='this'/> + </cell> + </row> + + <!-- setting end timeStamp --> + <row> + <cell> + <DateTimeEditor id='settingEndTimeStamp' constructorParams='this'/> + </cell> + </row> + + <!-- setting end position --> + <row> + <cell anchor="east"> + <CoordinatesEditor id='settingEndCoordinates' constructorParams='this'/> + </cell> + </row> + </Table> + </cell> + </row> + </Table> + </JPanel> + + </tab> + + <tab id='settingCaracteristicsTab' computeI18n=""> + <Table fill='both'> + + <!-- setting vessel speed --> + <row> + <cell> + <JLabel id='settingVesselSpeedLabel'/> + </cell> + <cell columns="3"> + <NumberEditor id='settingVesselSpeed' constructorParams='this' styleClass="float3"/> + </cell> + </row> + <!-- time between hooks --> + <row> + <cell anchor='west'> + <JLabel id='timeBetweenHooksLabel'/> + </cell> + <cell fill='both' weightx="1" columns="3"> + <NumberEditor id='timeBetweenHooks' constructorParams='this' styleClass="long10"/> + </cell> + </row> + <!-- total line length --> + <row> + <cell anchor='west'> + <JLabel id='totalLineLengthLabel'/> + </cell> + <cell fill='both' weightx="1" columns="3"> + <NumberEditor id='totalLineLength' constructorParams='this' styleClass="long10"/> + </cell> + </row> + <!-- basket line length --> + <row> + <cell anchor='west'> + <JLabel id='basketLineLengthLabel'/> + </cell> + <cell fill='both' weightx="1" columns="3"> + <NumberEditor id='basketLineLength' constructorParams='this' styleClass="long10"/> + </cell> + </row> + <!-- lengthBetweenBranchlines --> + <row> + <cell anchor='west'> + <JLabel id='lengthBetweenBranchlinesLabel'/> + </cell> + <cell fill='both' weightx="1" columns="3"> + <NumberEditor id='lengthBetweenBranchlines' constructorParams='this' styleClass="long10"/> + </cell> + </row> + + <!-- shooter used --> + <!-- shooter speed --> + <row> + <cell anchor="east"> + <JCheckBox id='shooterUsed' styleClass="i18n"/> + </cell> + <cell> + <JLabel id='shooterSpeedLabel'/> + </cell> + <cell columns="2"> + <NumberEditor id='shooterSpeed' constructorParams='this' styleClass="float3"/> + </cell> + </row> + <!-- max depth targeted (m) --> + <row> + <cell> + <JLabel id='maxDepthTargetedLabel'/> + </cell> + <cell columns="3"> + <NumberEditor id='maxDepthTargeted' constructorParams='this' styleClass="int6"/> + </cell> + </row> + <!-- total section count --> + <row> + <cell anchor='west'> + <JLabel id='totalSectionsCountLabel'/> + </cell> + <cell fill='both' weightx="1" columns="3"> + <NumberEditor id='totalSectionsCount' constructorParams='this' styleClass="int6"/> + </cell> + </row> + <!-- basket per section count --> + <!-- total basket count --> + <row> + <cell anchor='west'> + <JLabel id='basketsPerSectionCountLabel'/> + </cell> + <cell fill='both' weightx="1"> + <NumberEditor id='basketsPerSectionCount' constructorParams='this' styleClass="int6"/> + </cell> + <cell anchor='west'> + <JLabel id='totalBasketsCountLabel'/> + </cell> + <cell fill='both' weightx="1"> + <NumberEditor id='totalBasketsCount' constructorParams='this' styleClass="int6"/> + </cell> + </row> + <!-- branchlines per basket count --> + <!-- total hooks count --> + <row> + <cell anchor='west'> + <JLabel id='branchlinesPerBasketCountLabel'/> + </cell> + <cell fill='both' weightx="1"> + <NumberEditor id='branchlinesPerBasketCount' constructorParams='this' styleClass="int6"/> + </cell> + <cell anchor='west'> + <JLabel id='totalHooksCountLabel'/> + </cell> + <cell fill='both' weightx="1"> + <NumberEditor id='totalHooksCount' constructorParams='this' styleClass="int6"/> + </cell> + </row> + <!-- line type --> + <row> + <cell anchor='west'> + <JLabel id='lineTypeLabel'/> + </cell> + <cell columns="3"> + <BeanComboBox id='lineType' constructorParams='this' genericType='LineTypeReference'/> + </cell> + </row> + <!-- weighted swivels --> + <!-- swivels weights --> + <row> + <cell anchor="east"> + <JCheckBox id='weightedSwivel' styleClass="i18n"/> + </cell> + <cell anchor="west"> + <JLabel id='swivelWeightLabel'/> + </cell> + <cell columns="2"> + <NumberEditor id='swivelWeight' constructorParams='this' styleClass="float3"/> + </cell> + </row> + + <!-- weighted snaps --> + <!-- snap weights --> + <row> + <cell anchor='east'> + <JCheckBox id='weightedSnap' styleClass="i18n"/> + </cell> + <cell> + <JLabel id='snapWeightLabel'/> + </cell> + <cell columns="2"> + <NumberEditor id='snapWeight' constructorParams='this' styleClass="float3"/> + </cell> + </row> + <!-- monitored --> + <row> + <cell anchor='east'> + <JCheckBox id='monitored' styleClass="i18n"/> + </cell> + </row> + </Table> + </tab> + + <tab id='lightstickssTab' computeI18n=""> + <JPanel layout='{new BorderLayout()}'> + <Table fill='both' constraints='BorderLayout.NORTH'> + <!-- lightsticksUsed --> + <row> + <cell anchor='east'> + <JCheckBox id='lightsticksUsed' styleClass="i18n"/> + </cell> + </row> + <!-- lightsticks per basket count --> + <row> + <cell anchor='west'> + <JLabel id='lightsticksPerBasketCountLabel'/> + </cell> + <cell fill='both' weightx="1" columns="3"> + <NumberEditor id='lightsticksPerBasketCount' constructorParams='this' styleClass="int6"/> + </cell> + </row> + <!-- lightsticks type --> + <row> + <cell anchor='west'> + <JLabel id='lightsticksTypeLabel'/> + </cell> + <cell columns="3"> + <BeanComboBox id='lightsticksType' constructorParams='this' genericType='LightsticksTypeReference'/> + </cell> + </row> + <!-- lightsticks color --> + <row> + <cell anchor='west'> + <JLabel id='lightsticksColorLabel'/> + </cell> + <cell columns="3"> + <BeanComboBox id='lightsticksColor' constructorParams='this' genericType='LightsticksColorReference'/> + </cell> + </row> + </Table> + </JPanel> + </tab> + + <tab id='haulingTab' computeI18n=""> + + <JPanel layout='{new BorderLayout()}'> + <Table fill='both' constraints='BorderLayout.NORTH'> + + <!-- hauling same direction as setting --> + <row> + <cell> + <JLabel id='haulingDirectionSameAsSettingLabel'/> + </cell> + <cell> + <BooleanEditor id='haulingDirectionSameAsSetting'/> + </cell> + </row> + + <!-- hauling start timeStamp --> + <row> + <cell columns="2" weightx="1"> + <DateTimeEditor id='haulingStartTimeStamp' constructorParams='this'/> + </cell> + </row> + + <!-- hauling start position --> + <row> + <cell columns="2" anchor='east'> + <CoordinatesEditor id='haulingStartCoordinates' constructorParams='this'/> + </cell> + </row> + + <!-- hauling end timeStamp --> + <row> + <cell columns="2" weightx="1"> + <DateTimeEditor id='haulingEndTimeStamp' constructorParams='this'/> + </cell> + </row> + + <!-- hauling end position --> + <row> + <cell columns="2" anchor='east'> + <CoordinatesEditor id='haulingEndCoordinates' constructorParams='this'/> + </cell> + </row> + + <row> + <!-- hauling breaks --> + <cell anchor="west"> + <JLabel id='haulingBreaksLabel'/> + </cell> + <cell weightx="1" fill="both"> + <NumberEditor id='haulingBreaks' constructorParams='this' styleClass="int6"/> + </cell> + </row> + </Table> + </JPanel> + </tab> + </JTabbedPane> + </cell> + </row> + + <row> + <cell fill="both" weighty="1" weightx="1"> + <JComment id="comment"/> + </cell> + </row> + + </Table> + </JPanel> + + <!-- actions --> + <Table id="actions" fill='both' weightx='1' insets='0'> + <row> + <cell weightx="0.5" fill="both"> + <JButton id='reset'/> + </cell> + <cell weightx="0.5"> + <JButton id='save'/> + </cell> + <cell weightx="0.5"> + <JButton id='delete'/> + </cell> + </row> + </Table> + +</fr.ird.observe.client.ui.content.ContentUI> ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUI.jcss ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUI.jcss @@ -0,0 +1,254 @@ +/* + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +#model { + editable:true; + modified:{validator.isChanged()}; + valid:{validator.isValid()}; + enabled:{!model.isReadingMode()}; +} + +/* ***************************************************************************** */ +/* SETTING TAB **************************************************************** */ +/* ***************************************************************************** */ + +#settingTab { + icon:{handler.getErrorIconIfFalse(model.isSettingTabValid())}; +} + +#homeId { + text: {getStringValue(bean.getHomeId())}; + _propertyName: {SetLonglineDto.PROPERTY_HOME_ID}; +} + +#resetHomeId { + _resetPropertyName: {SetLonglineDto.PROPERTY_HOME_ID}; + toolTipText:"observe.common.SetLonglineDto.action.reset.homeId.tip"; +} + +#number { + property: {SetLonglineDto.PROPERTY_NUMBER}; + numberValue:{bean.getNumber()}; +} + +#settingStartTimeStamp { + date:{bean.getSettingStartTimeStamp()}; + propertyDate: {SetLonglineDto.PROPERTY_SETTING_START_TIME_STAMP}; +} + +#settingStartCoordinates { + propertyLatitude:{SetLonglineDto.PROPERTY_SETTING_START_LATITUDE}; + propertyLongitude:{SetLonglineDto.PROPERTY_SETTING_START_LONGITUDE}; + propertyQuadrant:{SetLonglineDto.PROPERTY_SETTING_START_QUADRANT}; + latitude:{bean.getSettingStartLatitude()}; + longitude:{bean.getSettingStartLongitude()}; + quadrant:{bean.getSettingStartQuadrant()}; +} + +#settingEndTimeStamp { + date:{bean.getSettingEndTimeStamp()}; + propertyDate: {SetLonglineDto.PROPERTY_SETTING_END_TIME_STAMP}; +} + +#settingEndCoordinates { + propertyLatitude:{SetLonglineDto.PROPERTY_SETTING_END_LATITUDE}; + propertyLongitude:{SetLonglineDto.PROPERTY_SETTING_END_LONGITUDE}; + propertyQuadrant:{SetLonglineDto.PROPERTY_SETTING_END_QUADRANT}; + latitude:{bean.getSettingEndLatitude()}; + longitude:{bean.getSettingEndLongitude()}; + quadrant:{bean.getSettingEndQuadrant()}; +} + +/* ***************************************************************************** */ +/* SETTING CARACTERISTICS TAB ************************************************* */ +/* ***************************************************************************** */ + +#settingCaracteristicsTab { + icon:{handler.getErrorIconIfFalse(model.isSettingCaracteristicsTabValid())}; +} + +#settingVesselSpeed { + property:{SetLonglineDto.PROPERTY_SETTING_VESSEL_SPEED}; + numberValue:{bean.getSettingVesselSpeed()}; +} + +#shooterUsed { + horizontalTextPosition:{JCheckBox.LEFT}; + _propertyName:{SetLonglineDto.PROPERTY_SHOOTER_USED}; + selected:{BooleanUtils.isTrue(bean.getShooterUsed())}; +} + +#shooterSpeed { + enabled:{BooleanUtils.isTrue(bean.getShooterUsed())}; + property:{SetLonglineDto.PROPERTY_SHOOTER_SPEED}; + numberValue:{bean.getShooterSpeed()}; +} + +#settingShape { + property:{SetLonglineDto.PROPERTY_SETTING_SHAPE}; + selectedItem:{bean.getSettingShape()}; +} + +#weightedSwivel { + horizontalTextPosition:{JCheckBox.LEFT}; + _propertyName:{SetLonglineDto.PROPERTY_WEIGHTED_SWIVEL}; + selected:{BooleanUtils.isTrue(bean.getWeightedSwivel())}; +} + +#swivelWeight { + enabled:{BooleanUtils.isTrue(bean.getWeightedSwivel())}; + property:{SetLonglineDto.PROPERTY_SWIVEL_WEIGHT}; + numberValue:{bean.getSwivelWeight()}; +} + +#weightedSnap { + horizontalTextPosition:{JCheckBox.LEFT}; + _propertyName:{SetLonglineDto.PROPERTY_WEIGHTED_SNAP}; + selected:{BooleanUtils.isTrue(bean.getWeightedSnap())}; +} + +#snapWeight { + enabled:{BooleanUtils.isTrue(bean.getWeightedSnap())}; + property:{SetLonglineDto.PROPERTY_SNAP_WEIGHT}; + numberValue:{bean.getSnapWeight()}; +} + +#lineType { + property:{SetLonglineDto.PROPERTY_LINE_TYPE}; + selectedItem:{bean.getLineType()}; +} + +#maxDepthTargeted { + property:{SetLonglineDto.PROPERTY_MAX_DEPTH_TARGETED}; + numberValue:{bean.getMaxDepthTargeted()}; +} + +#monitored { + horizontalTextPosition:{JCheckBox.LEFT}; + _propertyName:{SetLonglineDto.PROPERTY_MONITORED}; + selected:{BooleanUtils.isTrue(bean.getMonitored())}; +} + +#lightsticksType { + property:{SetLonglineDto.PROPERTY_LIGHTSTICKS_TYPE}; + selectedItem:{bean.getLightsticksType()}; + enabled:{bean.getLightsticksPerBasketCount() !=null && bean.getLightsticksPerBasketCount() > 0}; +} + +#lightsticksColor { + property:{SetLonglineDto.PROPERTY_LIGHTSTICKS_COLOR}; + selectedItem:{bean.getLightsticksColor()}; + enabled:{bean.getLightsticksPerBasketCount() !=null && bean.getLightsticksPerBasketCount() > 0}; +} + +#timeBetweenHooks { + property:{SetLonglineDto.PROPERTY_TIME_BETWEEN_HOOKS}; + numberValue:{bean.getTimeBetweenHooks()}; +} + +#lightsticksPerBasketCount { + property:{SetLonglineDto.PROPERTY_LIGHTSTICKS_PER_BASKET_COUNT}; + numberValue:{bean.getLightsticksPerBasketCount()}; +} + +#basketsPerSectionCount { + property:{SetLonglineDto.PROPERTY_BASKETS_PER_SECTION_COUNT}; + numberValue:{bean.getBasketsPerSectionCount()}; +} + +#totalBasketsCount { + property:{SetLonglineDto.PROPERTY_TOTAL_BASKETS_COUNT}; + numberValue:{bean.getTotalBasketsCount()}; +} + +#branchlinesPerBasketCount { + property:{SetLonglineDto.PROPERTY_BRANCHLINES_PER_BASKET_COUNT}; + numberValue:{bean.getBranchlinesPerBasketCount()}; +} + +#totalSectionsCount { + property:{SetLonglineDto.PROPERTY_TOTAL_SECTIONS_COUNT}; + numberValue:{bean.getTotalSectionsCount()}; +} + +#totalHooksCount { + property:{SetLonglineDto.PROPERTY_TOTAL_HOOKS_COUNT}; + numberValue:{bean.getTotalHooksCount()}; +} + +/* ***************************************************************************** */ +/* HAULING TAB **************************************************************** */ +/* ***************************************************************************** */ + +#haulingTab { + icon:{handler.getErrorIconIfFalse(model.isHaulingTabValid())}; +} + +#haulingDirectionSameAsSetting { + booleanValue:{bean.getHaulingDirectionSameAsSetting()}; + _propertyName: {SetLonglineDto.PROPERTY_HAULING_DIRECTION_SAME_AS_SETTING}; +} + +#haulingStartTimeStamp { + date:{bean.getHaulingStartTimeStamp()}; + propertyDate: {SetLonglineDto.PROPERTY_HAULING_START_TIME_STAMP}; +} + +#haulingStartCoordinates { + propertyLatitude:{SetLonglineDto.PROPERTY_HAULING_START_LATITUDE}; + propertyLongitude:{SetLonglineDto.PROPERTY_HAULING_START_LONGITUDE}; + propertyQuadrant:{SetLonglineDto.PROPERTY_HAULING_START_QUADRANT}; + latitude:{bean.getHaulingStartLatitude()}; + longitude:{bean.getHaulingStartLongitude()}; + quadrant:{bean.getHaulingStartQuadrant()}; +} + +#haulingEndTimeStamp { + date:{bean.getHaulingEndTimeStamp()}; + propertyDate: {SetLonglineDto.PROPERTY_HAULING_END_TIME_STAMP}; +} + +#haulingEndCoordinates { + propertyLatitude:{SetLonglineDto.PROPERTY_HAULING_END_LATITUDE}; + propertyLongitude:{SetLonglineDto.PROPERTY_HAULING_END_LONGITUDE}; + propertyQuadrant:{SetLonglineDto.PROPERTY_HAULING_END_QUADRANT}; + latitude:{bean.getHaulingEndLatitude()}; + longitude:{bean.getHaulingEndLongitude()}; + quadrant:{bean.getHaulingEndQuadrant()}; +} + +#haulingBreaks { + property:{SetLonglineDto.PROPERTY_HAULING_BREAKS}; + numberValue:{bean.getHaulingBreaks()}; +} + +#delete { + _globalAction:{DeleteDataGlobalUIAction.ACTION_NAME}; +} + +#save { + _globalAction:{SaveDataGlobalUIAction.ACTION_NAME}; +} + +#reset { + _globalAction:{ResetDataGlobalUIAction.ACTION_NAME}; +} ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUIHandler.java ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUIHandler.java @@ -0,0 +1,495 @@ +package fr.ird.observe.client.ui.content.data.longline; + +/* + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy 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.ird.observe.client.ObserveSwingApplicationContext; +import fr.ird.observe.client.db.ClientDataContext; +import fr.ird.observe.client.db.ObserveSwingDataSource; +import fr.ird.observe.client.db.constants.DataContextType; +import fr.ird.observe.client.ui.content.ContentMode; +import fr.ird.observe.client.ui.content.ContentUIHandler; +import fr.ird.observe.client.ui.content.ContentUIModel; +import fr.ird.observe.client.ui.tree.navigation.NavigationTree; +import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport; +import fr.ird.observe.client.validation.ClientValidationContext; +import fr.ird.observe.dto.data.longline.ActivityLonglineDto; +import fr.ird.observe.dto.data.longline.SetLonglineDto; +import fr.ird.observe.dto.data.longline.SetLonglineHelper; +import fr.ird.observe.dto.data.longline.SetLonglineReference; +import fr.ird.observe.dto.form.Form; +import fr.ird.observe.dto.result.SaveResultDto; +import fr.ird.observe.spi.DtoModelHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; +import org.nuiton.jaxx.validator.swing.SwingValidatorMessage; +import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel; +import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; +import org.nuiton.jaxx.widgets.gis.CoordinateFormat; +import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditorModel; +import org.nuiton.jaxx.widgets.hidor.HidorButton; +import org.nuiton.validator.NuitonValidatorScope; + +import javax.swing.event.TableModelListener; +import java.beans.PropertyChangeListener; +import java.util.HashSet; +import java.util.Set; + +import static org.nuiton.i18n.I18n.t; + +/** + * Created on 9/1/14. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 3.7 + */ +public class SetLonglineLogbookUIHandler extends ContentUIHandler<SetLonglineDto, SetLonglineLogbookUI> implements UIHandler<SetLonglineLogbookUI> { + + /** Logger */ + private static final Log log = LogFactory.getLog(SetLonglineLogbookUIHandler.class); + + // Compute valid state of tab from the error table + protected final TableModelListener computeTabValidStateListener; + + // Change toogle target visible on all TimeEditors + private final PropertyChangeListener onToogleTimeEditorSliderChangedListener; + + // Change toogle target visible on all TimeEditors + private final PropertyChangeListener onCoordinateFormatChangedListener; + + private boolean toogleTimeEditorSliderIsChanging; + + private boolean coordinateFormatChangedIsChanging; + + SetLonglineLogbookUIHandler() { + super(DataContextType.ActivityLongline, DataContextType.SetLongline); + computeTabValidStateListener = e -> { + + SwingValidatorMessageTableModel source = (SwingValidatorMessageTableModel) e.getSource(); + computeTabValidState(source); + + }; + onToogleTimeEditorSliderChangedListener = evt -> { + Boolean newValue = (Boolean) evt.getNewValue(); + onToogleTimeEditorSliderChanged(newValue); + }; + onCoordinateFormatChangedListener = evt -> { + CoordinateFormat newValue = (CoordinateFormat) evt.getNewValue(); + onCoordinateFormatChanged(newValue); + }; + } + + @Override + protected boolean computeCanWrite(ObserveSwingDataSource source) { + return source.canWriteData(); + } + + @Override + protected ContentMode getContentMode(ClientDataContext dataContext) { + + String setId = getSelectedId(); + + if (setId == null) { + + // mode creation + return ContentMode.CREATE; + + } + + if (getOpenDataManager().isOpenActivityLongline(dataContext.getSelectedActivityLonglineId())) { + + // l'activité est ouverte, mode édition + return ContentMode.UPDATE; + + } + + // l'activité n'est pas ouverte, mode lecture + addMessage(getUi(), + NuitonValidatorScope.INFO, + getTypeI18nKey(ActivityLonglineDto.class), + t("observe.common.ActivityLonglineDto.message.not.open")); + + return ContentMode.READ; + + } + + @Override + public void afterInit(SetLonglineLogbookUI ui) { + super.afterInit(ui); + + ui.getSettingStartTimeStamp().getSliderHidor().addPropertyChangeListener(HidorButton.PROPERTY_TARGET_VISIBLE, onToogleTimeEditorSliderChangedListener); + ui.getSettingEndTimeStamp().getSliderHidor().addPropertyChangeListener(HidorButton.PROPERTY_TARGET_VISIBLE, onToogleTimeEditorSliderChangedListener); + ui.getHaulingStartTimeStamp().getSliderHidor().addPropertyChangeListener(HidorButton.PROPERTY_TARGET_VISIBLE, onToogleTimeEditorSliderChangedListener); + ui.getHaulingEndTimeStamp().getSliderHidor().addPropertyChangeListener(HidorButton.PROPERTY_TARGET_VISIBLE, onToogleTimeEditorSliderChangedListener); + + ui.getSettingStartCoordinates().getModel().addPropertyChangeListener(CoordinatesEditorModel.PROPERTY_FORMAT, onCoordinateFormatChangedListener); + ui.getSettingEndCoordinates().getModel().addPropertyChangeListener(CoordinatesEditorModel.PROPERTY_FORMAT, onCoordinateFormatChangedListener); + ui.getHaulingStartCoordinates().getModel().addPropertyChangeListener(CoordinatesEditorModel.PROPERTY_FORMAT, onCoordinateFormatChangedListener); + ui.getHaulingEndCoordinates().getModel().addPropertyChangeListener(CoordinatesEditorModel.PROPERTY_FORMAT, onCoordinateFormatChangedListener); + + } + + @Override + public void openUI() { + + getUi().getSettingStartCoordinates().resetModel(); + getUi().getSettingEndCoordinates().resetModel(); + getUi().getHaulingStartCoordinates().resetModel(); + getUi().getHaulingEndCoordinates().resetModel(); + + if (log.isInfoEnabled()) { + log.info("OpenUI: " + getModel()); + } + super.openUI(); + + String activityId = getSelectedParentId(); + String setId = getSelectedId(); + + if (log.isInfoEnabled()) { + log.info("activityId = " + activityId); + log.info("setId = " + setId); + } + ContentMode mode = computeContentMode(); + + SetLonglineDto bean = getBean(); + + Form<SetLonglineDto> form; + if (setId == null) { + + // create mode + form = getSetLonglineService().preCreate(activityId); + + } else { + + // update mode + form = getSetLonglineService().loadForm(setId); + + } + + loadReferentialReferenceSetsInModel(form); + + getModel().setForm(form); + SetLonglineHelper.copySetLonglineDto(form.getObject(), bean); + + // 1. Mise à jour latitude/longitude: + getUi().getSettingStartCoordinates().setLatitudeAndLongitude(bean.getSettingStartLatitude(), bean.getSettingStartLongitude()); + // 2. Mise à jour du quadrant : + // Si le bean de données contient un quadrant, on met simplement à jour le composant de coordonnées pour sélectionner le quadrant voulu + // sinon, on réinitialise les quadrants du composant afin qu'aucun d'eux ne soit sélectionné (par exemple dans le cas de la création de la première activité d'une route) + if (bean.getSettingStartQuadrant() == null) { + getUi().getSettingStartCoordinates().resetQuadrant(); + } else { + getUi().getSettingStartCoordinates().setQuadrant(bean.getSettingStartQuadrant()); + } + + // 1. Mise à jour latitude/longitude: + getUi().getSettingEndCoordinates().setLatitudeAndLongitude(bean.getSettingEndLatitude(), bean.getSettingEndLongitude()); + // 2. Mise à jour du quadrant : + // Si le bean de données contient un quadrant, on met simplement à jour le composant de coordonnées pour sélectionner le quadrant voulu + // sinon, on réinitialise les quadrants du composant afin qu'aucun d'eux ne soit sélectionné (par exemple dans le cas de la création de la première activité d'une route) + if (bean.getSettingEndQuadrant() == null) { + getUi().getSettingEndCoordinates().resetQuadrant(); + } else { + getUi().getSettingEndCoordinates().setQuadrant(bean.getSettingEndQuadrant()); + } + + // 1. Mise à jour latitude/longitude: + getUi().getHaulingStartCoordinates().setLatitudeAndLongitude(bean.getHaulingStartLatitude(), bean.getHaulingStartLongitude()); + // 2. Mise à jour du quadrant : + // Si le bean de données contient un quadrant, on met simplement à jour le composant de coordonnées pour sélectionner le quadrant voulu + // sinon, on réinitialise les quadrants du composant afin qu'aucun d'eux ne soit sélectionné (par exemple dans le cas de la création de la première activité d'une route) + if (bean.getHaulingStartQuadrant() == null) { + getUi().getHaulingStartCoordinates().resetQuadrant(); + } else { + getUi().getHaulingStartCoordinates().setQuadrant(bean.getHaulingStartQuadrant()); + } + + // 1. Mise à jour latitude/longitude: + getUi().getHaulingEndCoordinates().setLatitudeAndLongitude(bean.getHaulingEndLatitude(), bean.getHaulingEndLongitude()); + // 2. Mise à jour du quadrant : + // Si le bean de données contient un quadrant, on met simplement à jour le composant de coordonnées pour sélectionner le quadrant voulu + // sinon, on réinitialise les quadrants du composant afin qu'aucun d'eux ne soit sélectionné (par exemple dans le cas de la création de la première activité d'une route) + if (bean.getHaulingEndQuadrant() == null) { + getUi().getHaulingEndCoordinates().resetQuadrant(); + } else { + getUi().getHaulingEndCoordinates().setQuadrant(bean.getHaulingEndQuadrant()); + } + + // utilisation du mode requis + setContentMode(mode); + + // To be sure always remove listener (could prevent some leaks) + getUi().getErrorTableModel().removeTableModelListener(computeTabValidStateListener); + // listen messages to see if required to add + getUi().getErrorTableModel().addTableModelListener(computeTabValidStateListener); + + SwingValidatorMessageTableModel errorTableModel = getUi().getErrorTableModel(); + computeTabValidState(errorTableModel); + + if (mode != ContentMode.READ) { + getUi().startEdit(null); + } + + } + + @Override + protected void closeSafeUI() { + + if (log.isInfoEnabled()) { + log.info("CloseUI: " + getModel()); + } + super.closeSafeUI(); + + // remove listener + getUi().getErrorTableModel().removeTableModelListener(computeTabValidStateListener); + + } + + @Override + public void startEditUI(String... binding) { + + ContentUIModel<SetLonglineDto> model = getModel(); + boolean create = model.getMode() == ContentMode.CREATE; + String contextName = getValidatorContextName(model.getMode()); + getUi().getValidator().setContext(contextName); + if (create) { + addInfoMessage(t("observe.common.SetLonglineDto.message.creating")); + } else { + addInfoMessage(t("observe.common.SetLonglineDto.message.updating")); + } + + super.startEditUI(SetLonglineLogbookUI.BINDING_COMMENT_MODEL, + + // setting tab + SetLonglineLogbookUI.BINDING_HOME_ID_TEXT, + SetLonglineLogbookUI.BINDING_NUMBER_NUMBER_VALUE, + + SetLonglineLogbookUI.BINDING_SETTING_START_TIME_STAMP_DATE, + SetLonglineLogbookUI.BINDING_SETTING_START_COORDINATES_LATITUDE, + SetLonglineLogbookUI.BINDING_SETTING_START_COORDINATES_LONGITUDE, + + SetLonglineLogbookUI.BINDING_SETTING_END_TIME_STAMP_DATE, + SetLonglineLogbookUI.BINDING_SETTING_END_COORDINATES_LATITUDE, + SetLonglineLogbookUI.BINDING_SETTING_END_COORDINATES_LONGITUDE, + + // setting caracteristics tab + SetLonglineLogbookUI.BINDING_SETTING_VESSEL_SPEED_NUMBER_VALUE, + SetLonglineLogbookUI.BINDING_SHOOTER_USED_SELECTED, + SetLonglineLogbookUI.BINDING_SHOOTER_SPEED_NUMBER_VALUE, + SetLonglineLogbookUI.BINDING_TIME_BETWEEN_HOOKS_NUMBER_VALUE, + SetLonglineLogbookUI.BINDING_SETTING_SHAPE_SELECTED_ITEM, + SetLonglineLogbookUI.BINDING_WEIGHTED_SWIVEL_SELECTED, + SetLonglineLogbookUI.BINDING_SWIVEL_WEIGHT_NUMBER_VALUE, + SetLonglineLogbookUI.BINDING_WEIGHTED_SNAP_SELECTED, + SetLonglineLogbookUI.BINDING_SNAP_WEIGHT_NUMBER_VALUE, + SetLonglineLogbookUI.BINDING_LINE_TYPE_SELECTED_ITEM, + SetLonglineLogbookUI.BINDING_MAX_DEPTH_TARGETED_NUMBER_VALUE, + SetLonglineLogbookUI.BINDING_MONITORED_SELECTED, + SetLonglineLogbookUI.BINDING_LIGHTSTICKS_TYPE_SELECTED_ITEM, + SetLonglineLogbookUI.BINDING_LIGHTSTICKS_COLOR_SELECTED_ITEM, + SetLonglineLogbookUI.BINDING_LIGHTSTICKS_PER_BASKET_COUNT_NUMBER_VALUE, + SetLonglineLogbookUI.BINDING_BASKETS_PER_SECTION_COUNT_NUMBER_VALUE, + SetLonglineLogbookUI.BINDING_TOTAL_BASKETS_COUNT_NUMBER_VALUE, + SetLonglineLogbookUI.BINDING_BRANCHLINES_PER_BASKET_COUNT_NUMBER_VALUE, + SetLonglineLogbookUI.BINDING_TOTAL_SECTIONS_COUNT_NUMBER_VALUE, + SetLonglineLogbookUI.BINDING_TOTAL_HOOKS_COUNT_NUMBER_VALUE, + + // hauling tab + SetLonglineLogbookUI.BINDING_HAULING_DIRECTION_SAME_AS_SETTING_BOOLEAN_VALUE, + + SetLonglineLogbookUI.BINDING_HAULING_START_TIME_STAMP_DATE, + SetLonglineLogbookUI.BINDING_HAULING_START_COORDINATES_LATITUDE, + SetLonglineLogbookUI.BINDING_HAULING_START_COORDINATES_LONGITUDE, + + SetLonglineLogbookUI.BINDING_HAULING_END_TIME_STAMP_DATE, + SetLonglineLogbookUI.BINDING_HAULING_END_COORDINATES_LATITUDE, + SetLonglineLogbookUI.BINDING_HAULING_END_COORDINATES_LONGITUDE, + + SetLonglineLogbookUI.BINDING_HAULING_BREAKS_NUMBER_VALUE); + + model.setModified(create); + + } + + @Override + protected boolean doSave(SetLonglineDto bean) { + + String activityId = getSelectedParentId(); + + boolean notPersisted = bean.isNotPersisted(); + + SaveResultDto saveResult = getSetLonglineService().save(activityId, bean); + saveResult.toDto(bean); + + if (notPersisted) { + getOpenDataManager().openSetLongline(activityId, bean.getId()); + } + + return true; + + } + + @Override + protected void afterSave(boolean refresh) { + + super.afterSave(refresh); + + SetLonglineDto bean = getBean(); + + SwingValidatorUtil.setValidatorChanged(getUi(), false); + + NavigationTree treeHelper = getNavigationTree(); + + NavigationTreeNodeSupport node = treeHelper.getSelectedNode(); + boolean create = node.getId() == null; + + if (create) { + + getModel().setMode(ContentMode.UPDATE); + + // remove old node and recreate new node + NavigationTreeNodeSupport parentNode = node.getParent(); + treeHelper.removeNode(node); + + SetLonglineReference reference = DtoModelHelper.fromDataDto(SetLonglineDto.class).toReference(getDecoratorService().getReferentialLocale(), bean); + node = treeHelper.addSetLongline(parentNode, reference); + + stopEditUI(); + treeHelper.selectNode(node); + + } else { + + // select ancestor node + treeHelper.reloadSelectedNode(false, false); + + } + + } + + @Override + protected boolean doDelete(SetLonglineDto bean) { + + if (askToDelete(bean)) { + return false; + } + + String activityId = getSelectedParentId(); + getSetLonglineService().delete(activityId, bean.getId()); + + return true; + + } + + @Override + protected void prepareValidationContext() { + super.prepareValidationContext(); + + ClientValidationContext validationContext = ObserveSwingApplicationContext.get().getValidationContext(); + validationContext.setCoordinatesEditor("haulingStart", getUi().getHaulingStartCoordinates()); + validationContext.setCoordinatesEditor("haulingEnd", getUi().getHaulingEndCoordinates()); + validationContext.setCoordinatesEditor("settingStart", getUi().getSettingStartCoordinates()); + validationContext.setCoordinatesEditor("settingEnd", getUi().getSettingEndCoordinates()); + + } + + + protected void computeTabValidState(SwingValidatorMessageTableModel errorTableModel) { + + Set<String> errorProperties = new HashSet<>(); + int rowCount = errorTableModel.getRowCount(); + for (int i = 0; i < rowCount; i++) { + + SwingValidatorMessage row = errorTableModel.getRow(i); + if (NuitonValidatorScope.ERROR.equals(row.getScope())) { + errorProperties.add(row.getField()); + } + } + + boolean settingTabValid = !errorProperties.removeAll(SetLonglineLogbookUIModel.SETTING_TAB_PROPERTIES); + boolean settingCaracteristicsTabValid = !errorProperties.removeAll(SetLonglineLogbookUIModel.SETTING_CARACTERISTICS_TAB_PROPERTIES); + boolean haulingTabValid = !errorProperties.removeAll(SetLonglineLogbookUIModel.HAULING_TAB_PROPERTIES); + + SetLonglineLogbookUIModel model = (SetLonglineLogbookUIModel) getModel(); + model.setSettingTabValid(settingTabValid); + model.setSettingCaracteristicsTabValid(settingCaracteristicsTabValid); + model.setHaulingTabValid(haulingTabValid); + + } + + private void onToogleTimeEditorSliderChanged(boolean newValue) { + + if (!toogleTimeEditorSliderIsChanging) { + + toogleTimeEditorSliderIsChanging = true; + + boolean selected = !newValue; + + try { + + getUi().getSettingStartTimeStamp().getSliderHidor().setSelected(selected); + getUi().getSettingStartTimeStamp().getSliderHidor().setTargetVisible(newValue); + + getUi().getSettingEndTimeStamp().getSliderHidor().setSelected(selected); + getUi().getSettingEndTimeStamp().getSliderHidor().setTargetVisible(newValue); + + getUi().getHaulingStartTimeStamp().getSliderHidor().setSelected(selected); + getUi().getHaulingStartTimeStamp().getSliderHidor().setTargetVisible(newValue); + + getUi().getHaulingEndTimeStamp().getSliderHidor().setSelected(selected); + getUi().getHaulingEndTimeStamp().getSliderHidor().setTargetVisible(newValue); + + } finally { + + toogleTimeEditorSliderIsChanging = false; + + } + + } + + } + + private synchronized void onCoordinateFormatChanged(CoordinateFormat newValue) { + + if (!coordinateFormatChangedIsChanging) { + + coordinateFormatChangedIsChanging = true; + + try { + + getUi().getSettingStartCoordinates().setFormat(newValue); + getUi().getSettingEndCoordinates().setFormat(newValue); + + getUi().getHaulingStartCoordinates().setFormat(newValue); + getUi().getHaulingEndCoordinates().setFormat(newValue); + + } finally { + + coordinateFormatChangedIsChanging = false; + + } + + } + + } + +} ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUIModel.java ===================================== --- /dev/null +++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/SetLonglineLogbookUIModel.java @@ -0,0 +1,132 @@ +package fr.ird.observe.client.ui.content.data.longline; + +/* + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.collect.ImmutableSet; +import fr.ird.observe.client.ui.content.ContentUIModel; +import fr.ird.observe.dto.data.longline.SetLonglineDto; + +import java.util.Set; + +/** + * Created on 9/28/14. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since XXX + */ +public class SetLonglineLogbookUIModel extends ContentUIModel<SetLonglineDto> { + + public static final String PROPERTY_SETTING_TAB_VALID = "settingTabValid"; + + public static final String PROPERTY_SETTING_CARACTERISTICS_TAB_VALID = "settingCaracteristicsTabValid"; + + public static final String PROPERTY_HAULING_TAB_VALID = "haulingTabValid"; + + public static final Set<String> SETTING_TAB_PROPERTIES = + ImmutableSet.<String>builder().add( + SetLonglineDto.PROPERTY_HOME_ID, + SetLonglineDto.PROPERTY_NUMBER, + SetLonglineDto.PROPERTY_SETTING_START_TIME_STAMP, + SetLonglineDto.PROPERTY_SETTING_START_LATITUDE, + SetLonglineDto.PROPERTY_SETTING_START_LONGITUDE, + SetLonglineDto.PROPERTY_SETTING_END_TIME_STAMP, + SetLonglineDto.PROPERTY_SETTING_END_LATITUDE, + SetLonglineDto.PROPERTY_SETTING_END_LONGITUDE + ).build(); + + public static final Set<String> SETTING_CARACTERISTICS_TAB_PROPERTIES = + ImmutableSet.<String>builder().add( + SetLonglineDto.PROPERTY_SETTING_SHAPE, + SetLonglineDto.PROPERTY_LINE_TYPE, + SetLonglineDto.PROPERTY_LIGHTSTICKS_TYPE, + SetLonglineDto.PROPERTY_LIGHTSTICKS_COLOR, + SetLonglineDto.PROPERTY_SETTING_VESSEL_SPEED, + SetLonglineDto.PROPERTY_MAX_DEPTH_TARGETED, + SetLonglineDto.PROPERTY_SHOOTER_USED, + SetLonglineDto.PROPERTY_SHOOTER_SPEED, + SetLonglineDto.PROPERTY_WEIGHTED_SWIVEL, + SetLonglineDto.PROPERTY_SWIVEL_WEIGHT, + SetLonglineDto.PROPERTY_WEIGHTED_SNAP, + SetLonglineDto.PROPERTY_SNAP_WEIGHT, + SetLonglineDto.PROPERTY_MONITORED, + SetLonglineDto.PROPERTY_TIME_BETWEEN_HOOKS, + SetLonglineDto.PROPERTY_BASKETS_PER_SECTION_COUNT, + SetLonglineDto.PROPERTY_BRANCHLINES_PER_BASKET_COUNT, + SetLonglineDto.PROPERTY_LIGHTSTICKS_PER_BASKET_COUNT, + SetLonglineDto.PROPERTY_TOTAL_SECTIONS_COUNT, + SetLonglineDto.PROPERTY_TOTAL_BASKETS_COUNT, + SetLonglineDto.PROPERTY_TOTAL_HOOKS_COUNT + ).build(); + + public static final Set<String> HAULING_TAB_PROPERTIES = + ImmutableSet.<String>builder().add( + SetLonglineDto.PROPERTY_HAULING_DIRECTION_SAME_AS_SETTING, + SetLonglineDto.PROPERTY_HAULING_START_LATITUDE, + SetLonglineDto.PROPERTY_HAULING_START_LONGITUDE, + SetLonglineDto.PROPERTY_HAULING_START_TIME_STAMP, + SetLonglineDto.PROPERTY_HAULING_END_LATITUDE, + SetLonglineDto.PROPERTY_HAULING_END_LONGITUDE, + SetLonglineDto.PROPERTY_HAULING_END_TIME_STAMP, + SetLonglineDto.PROPERTY_HAULING_BREAKS + ).build(); + + private static final long serialVersionUID = 1L; + + protected boolean settingTabValid; + + protected boolean settingCaracteristicsTabValid; + + protected boolean haulingTabValid; + + public SetLonglineLogbookUIModel() { + super(SetLonglineDto.class); + } + + public boolean isHaulingTabValid() { + return haulingTabValid; + } + + public void setHaulingTabValid(boolean haulingTabValid) { + this.haulingTabValid = haulingTabValid; + firePropertyChange(PROPERTY_HAULING_TAB_VALID, null, haulingTabValid); + } + + public boolean isSettingCaracteristicsTabValid() { + return settingCaracteristicsTabValid; + } + + public void setSettingCaracteristicsTabValid(boolean settingCaracteristicsTabValid) { + this.settingCaracteristicsTabValid = settingCaracteristicsTabValid; + firePropertyChange(PROPERTY_SETTING_CARACTERISTICS_TAB_VALID, null, settingCaracteristicsTabValid); + } + + public boolean isSettingTabValid() { + return settingTabValid; + } + + public void setSettingTabValid(boolean settingTabValid) { + this.settingTabValid = settingTabValid; + firePropertyChange(PROPERTY_SETTING_TAB_VALID, null, settingTabValid); + } + +} ===================================== client/src/main/resources/i18n/client_en_GB.properties ===================================== --- a/client/src/main/resources/i18n/client_en_GB.properties +++ b/client/src/main/resources/i18n/client_en_GB.properties @@ -364,8 +364,11 @@ observe.common.ActivityLonglineDto.message.no.active.found.for.other.trip=No ope observe.common.ActivityLonglineDto.message.nonForTrip=< No activity for current trip > observe.common.ActivityLonglineDto.message.not.open=Activity is not opened, no edit possible. observe.common.ActivityLonglineDto.message.updating=Updating an activity +observe.common.ActivityLonglineDto.relatedObservedActivity=Observed activity observe.common.ActivityLonglineDto.timeStamp=timestamp observe.common.ActivityLonglineDto.titles=Activities +observe.common.ActivityLonglineDto.vesselSpeed=Speed +observe.common.ActivityLonglineDto.wind=Wind observe.common.ActivitySeineDto.action.addFloatingObject=Add FAD observe.common.ActivitySeineDto.action.addFloatingObject.tip=Add a FAD to the activity observe.common.ActivitySeineDto.action.addSet=Add a Set @@ -454,11 +457,14 @@ observe.common.CatchLonglineDto.availablePredator=Avaiable predators observe.common.CatchLonglineDto.beatDiameter=Beat diameter observe.common.CatchLonglineDto.branchlineTab=Branchline observe.common.CatchLonglineDto.caracteristicTab=Caracteristics +observe.common.CatchLonglineDto.countDepredated=\#TODO observe.common.CatchLonglineDto.depredated=Depredated +observe.common.CatchLonglineDto.depredatedProportion=\#TODO observe.common.CatchLonglineDto.depredatedTab=Depredation observe.common.CatchLonglineDto.foodAndSexualTab=Food and sexual maturity observe.common.CatchLonglineDto.hookWhenDiscarded=Discarded with hook observe.common.CatchLonglineDto.locationOnLongline=Location on longline +observe.common.CatchLonglineDto.onBordDataProcessing=On bord data processing observe.common.CatchLonglineDto.photoReferences=Photo references observe.common.CatchLonglineDto.resetBranchline=Cancel observe.common.CatchLonglineDto.resetBranchline.tip=Cancel any modification @@ -490,6 +496,7 @@ observe.common.CatchLonglineDto.table.speciesCatch=Species observe.common.CatchLonglineDto.table.speciesCatch.tip=Species observe.common.CatchLonglineDto.tagNumber=Tag number observe.common.CatchLonglineDto.totalWeight=Total weight (kg) +observe.common.CatchLonglineDto.weightDeterminationMethod=Weight Determination method observe.common.CatchLonglineDto.weightMeasuresTab=Weights observe.common.DataDto.action.createEntry.tip=Create a new entry observe.common.DataDto.action.deleteEntry.tip=Delete entry in edition @@ -912,14 +919,20 @@ observe.common.SensorUsedDto.table.sensorType.tip=Sensor type observe.common.SetDto.action.goToOpen.short=Open set observe.common.SetDto.action.goToOpen.tip=Open set observe.common.SetLonglineDto.action.reset.homeId.tip=Reset home id +observe.common.SetLonglineDto.basketLineLength=\#TODO observe.common.SetLonglineDto.haulingTab=Hauling +observe.common.SetLonglineDto.lengthBetweenBranchlines=\#TODO +observe.common.SetLonglineDto.lightsticksUsed=\#TODO +observe.common.SetLonglineDto.lightstickssTab=\#TODO observe.common.SetLonglineDto.message.creating=Creating fishing operation observe.common.SetLonglineDto.message.updating=Updating fishing operation observe.common.SetLonglineDto.monitored=Monitored observe.common.SetLonglineDto.settingCaracteristicsTab=Caracteristics observe.common.SetLonglineDto.settingTab=Setting +observe.common.SetLonglineDto.shooterUsed=Shooter used observe.common.SetLonglineDto.targetCatchCompositionEstimatedByObserver=Composition estimated by observer? observe.common.SetLonglineDto.targetDiscardCatchCompositionEstimatedByObserver=Composition estimated by observer? +observe.common.SetLonglineDto.totalLineLength=\#TODO observe.common.SetLonglineDto.weightedSnap=Weighted snap observe.common.SetLonglineDto.weightedSwivel=Weighted swivel observe.common.SetLonglineGlobalCompositionDto.availableMitigationType=Available mitigations ===================================== client/src/main/resources/i18n/client_es_ES.properties ===================================== --- a/client/src/main/resources/i18n/client_es_ES.properties +++ b/client/src/main/resources/i18n/client_es_ES.properties @@ -364,8 +364,11 @@ observe.common.ActivityLonglineDto.message.no.active.found.for.other.trip=Ningun observe.common.ActivityLonglineDto.message.nonForTrip=< Ninguna actividad por la marea actual > observe.common.ActivityLonglineDto.message.not.open=La actividad no está abierta, imposible modificar. observe.common.ActivityLonglineDto.message.updating=Se está modificando la actividad actual. +observe.common.ActivityLonglineDto.relatedObservedActivity=\#TODO observe.common.ActivityLonglineDto.timeStamp=Timestamp observe.common.ActivityLonglineDto.titles=Actividades +observe.common.ActivityLonglineDto.vesselSpeed=\#TODO +observe.common.ActivityLonglineDto.wind=\#TODO observe.common.ActivitySeineDto.action.addFloatingObject=Añadir un DCP observe.common.ActivitySeineDto.action.addFloatingObject.tip=Añadir un objeto flotante a la actividad observe.common.ActivitySeineDto.action.addSet=Añadir un lance @@ -454,11 +457,14 @@ observe.common.CatchLonglineDto.availablePredator=Deprepadaores disponibles observe.common.CatchLonglineDto.beatDiameter=Diametro de la mordedura observe.common.CatchLonglineDto.branchlineTab=Arponcillo observe.common.CatchLonglineDto.caracteristicTab=Características +observe.common.CatchLonglineDto.countDepredated=\#TODO observe.common.CatchLonglineDto.depredated=Victima de depredación +observe.common.CatchLonglineDto.depredatedProportion=\#TODO observe.common.CatchLonglineDto.depredatedTab=Depredación observe.common.CatchLonglineDto.foodAndSexualTab=Alimentación y maturidad sexual observe.common.CatchLonglineDto.hookWhenDiscarded=Echazado con el anzuelo observe.common.CatchLonglineDto.locationOnLongline=Posición sobre la línea +observe.common.CatchLonglineDto.onBordDataProcessing=On bord data processing \#TODO observe.common.CatchLonglineDto.photoReferences=Referencias foto observe.common.CatchLonglineDto.resetBranchline=Cancelar observe.common.CatchLonglineDto.resetBranchline.tip=Cancelar las modificaciones sobre el arponcillo @@ -490,6 +496,7 @@ observe.common.CatchLonglineDto.table.speciesCatch=Especie observe.common.CatchLonglineDto.table.speciesCatch.tip=Especie observe.common.CatchLonglineDto.tagNumber=Numéro d'échantillon \#TODO observe.common.CatchLonglineDto.totalWeight=Peso total (kg) +observe.common.CatchLonglineDto.weightDeterminationMethod=\#TODO observe.common.CatchLonglineDto.weightMeasuresTab=Pesos (kg) observe.common.DataDto.action.createEntry.tip=Crear una nueva entrada observe.common.DataDto.action.deleteEntry.tip=Cancelar la edición de la entrada actual @@ -912,14 +919,20 @@ observe.common.SensorUsedDto.table.sensorType.tip=Tipo de sensor observe.common.SetDto.action.goToOpen.short=Lance abierto observe.common.SetDto.action.goToOpen.tip=Acceder al lance abierto observe.common.SetLonglineDto.action.reset.homeId.tip=Reiniciar el id de negocio +observe.common.SetLonglineDto.basketLineLength=\#TODO observe.common.SetLonglineDto.haulingTab=Arrastre +observe.common.SetLonglineDto.lengthBetweenBranchlines=\#TODO +observe.common.SetLonglineDto.lightsticksUsed=\#TODO +observe.common.SetLonglineDto.lightstickssTab=\#TODO observe.common.SetLonglineDto.message.creating=Lance en proceso de creación. observe.common.SetLonglineDto.message.updating=La operación de pesca está en proceso de modificación. observe.common.SetLonglineDto.monitored=Instrumentada observe.common.SetLonglineDto.settingCaracteristicsTab=Características observe.common.SetLonglineDto.settingTab=Calada +observe.common.SetLonglineDto.shooterUsed=Shooter used \#TODO observe.common.SetLonglineDto.targetCatchCompositionEstimatedByObserver=Composition estimée par l'observateur ? \#TODO observe.common.SetLonglineDto.targetDiscardCatchCompositionEstimatedByObserver=Composition estimée par l'observateur ? \#TODO +observe.common.SetLonglineDto.totalLineLength=Total line length (m) \#TODO observe.common.SetLonglineDto.weightedSnap=Snap lesté observe.common.SetLonglineDto.weightedSwivel=Émerillon lesté observe.common.SetLonglineGlobalCompositionDto.availableMitigationType=Atenuaciónes disponibles ===================================== client/src/main/resources/i18n/client_fr_FR.properties ===================================== --- a/client/src/main/resources/i18n/client_fr_FR.properties +++ b/client/src/main/resources/i18n/client_fr_FR.properties @@ -364,8 +364,11 @@ observe.common.ActivityLonglineDto.message.no.active.found.for.other.trip=Aucune observe.common.ActivityLonglineDto.message.nonForTrip=< Aucune activité pour la marée courante > observe.common.ActivityLonglineDto.message.not.open=L'opération de pêche n'est pas ouverte, aucune modification possible. observe.common.ActivityLonglineDto.message.updating=L'activité est en cours de modification. +observe.common.ActivityLonglineDto.relatedObservedActivity=Activité observée observe.common.ActivityLonglineDto.timeStamp=Horodatage observe.common.ActivityLonglineDto.titles=Activités +observe.common.ActivityLonglineDto.vesselSpeed=Vitesse du courant (nd) +observe.common.ActivityLonglineDto.wind=Vent Beaufort observe.common.ActivitySeineDto.action.addFloatingObject=Ajouter un DCP observe.common.ActivitySeineDto.action.addFloatingObject.tip=Ajouter un objet flottant à l'activité observe.common.ActivitySeineDto.action.addSet=Ajouter la calée @@ -454,11 +457,14 @@ observe.common.CatchLonglineDto.availablePredator=Prédateurs disponibles observe.common.CatchLonglineDto.beatDiameter=Diamètre de la morsure observe.common.CatchLonglineDto.branchlineTab=Avançon observe.common.CatchLonglineDto.caracteristicTab=Caractéristiques +observe.common.CatchLonglineDto.countDepredated=Nombre déprédaté observe.common.CatchLonglineDto.depredated=Victime de déprédation +observe.common.CatchLonglineDto.depredatedProportion=Proportion déprédaté observe.common.CatchLonglineDto.depredatedTab=Déprédation observe.common.CatchLonglineDto.foodAndSexualTab=Alimentation et maturité sexuelle observe.common.CatchLonglineDto.hookWhenDiscarded=Rejeté avec hameçon observe.common.CatchLonglineDto.locationOnLongline=Position sur la ligne +observe.common.CatchLonglineDto.onBordDataProcessing=Traitement effectué à bord observe.common.CatchLonglineDto.photoReferences=Références photo observe.common.CatchLonglineDto.resetBranchline=Annuler observe.common.CatchLonglineDto.resetBranchline.tip=Annuler les modifications sur l'avançon @@ -490,6 +496,7 @@ observe.common.CatchLonglineDto.table.speciesCatch=Espèce observe.common.CatchLonglineDto.table.speciesCatch.tip=Espèce observe.common.CatchLonglineDto.tagNumber=Id marque observe.common.CatchLonglineDto.totalWeight=Poids total (kg) +observe.common.CatchLonglineDto.weightDeterminationMethod=Méthode d'estimation observe.common.CatchLonglineDto.weightMeasuresTab=Poids (kg) observe.common.DataDto.action.createEntry.tip=Créer une nouvelle entrée observe.common.DataDto.action.deleteEntry.tip=Supprimer l'entrée en cours d'édition @@ -912,14 +919,20 @@ observe.common.SensorUsedDto.table.sensorType.tip=Type de capteur observe.common.SetDto.action.goToOpen.short=Calée ouverte observe.common.SetDto.action.goToOpen.tip=Accéder à la calée ouverte observe.common.SetLonglineDto.action.reset.homeId.tip=Réinitialiser l'id métier +observe.common.SetLonglineDto.basketLineLength=Longueur de la ligne par panier (m) observe.common.SetLonglineDto.haulingTab=Virage +observe.common.SetLonglineDto.lengthBetweenBranchlines=Distance entre avançons (m) +observe.common.SetLonglineDto.lightsticksUsed=Utilisation des cyalumes ? +observe.common.SetLonglineDto.lightstickssTab=Cyalumes observe.common.SetLonglineDto.message.creating=L'opération de pêche est en cours de création. observe.common.SetLonglineDto.message.updating=L'opération de pêche est en cours de modification. observe.common.SetLonglineDto.monitored=Instrumentée observe.common.SetLonglineDto.settingCaracteristicsTab=Caractéristiques observe.common.SetLonglineDto.settingTab=Filage +observe.common.SetLonglineDto.shooterUsed=Utilisation du shooter observe.common.SetLonglineDto.targetCatchCompositionEstimatedByObserver=Composition estimée par l'observateur ? observe.common.SetLonglineDto.targetDiscardCatchCompositionEstimatedByObserver=Composition estimée par l'observateur ? +observe.common.SetLonglineDto.totalLineLength=Longueur totale de la ligne (m) observe.common.SetLonglineDto.weightedSnap=Snap lesté observe.common.SetLonglineDto.weightedSwivel=Émerillon lesté observe.common.SetLonglineGlobalCompositionDto.availableMitigationType=Atténuations disponibles View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/0fb8cb2d7fde3846a306b71857… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/0fb8cb2d7fde3846a306b71857… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe] Pushed new branch feature/v8_maquette
by Tony CHEMIT 03 Apr '18

03 Apr '18
Tony CHEMIT pushed new branch feature/v8_maquette at ultreiaio / ird-observe --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/tree/feature/v8_maquette You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 17 commits: Ajout du référentiel observe_common.DataQuality (Closes #895)
by Tony CHEMIT 03 Apr '18

03 Apr '18
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 279f46d6 by Tony CHEMIT at 2018-04-03T20:13:24Z Ajout du référentiel observe_common.DataQuality (Closes #895) - - - - - 2d8494c8 by Tony CHEMIT at 2018-04-03T20:13:32Z Correction des labels sur les enums avec methods - - - - - 59c09cb4 by Tony CHEMIT at 2018-04-03T20:13:32Z fix option type - - - - - 20029748 by Tony CHEMIT at 2018-04-03T20:13:32Z fix some references API - - - - - 5627f267 by Tony CHEMIT at 2018-04-03T20:13:32Z add more log levels in tests - - - - - 1db069f0 by Tony CHEMIT at 2018-04-03T20:13:32Z fix i18n typo - - - - - 8b8b05cf by Tony CHEMIT at 2018-04-03T20:13:32Z improve gis triggers (if not migration can&#39;t work since it will trigger the gis computation on each activity changed, and here we modify all activities...) - - - - - d944529b by Tony CHEMIT at 2018-04-03T20:13:32Z improve longline position api (but still could be improved ?) - - - - - f799a4a0 by Tony CHEMIT at 2018-04-03T20:13:32Z improve sql request api (requires now db version) - - - - - 0718ae70 by Tony CHEMIT at 2018-04-03T20:13:32Z optimize dependences + add missing license header - - - - - 8156f85c by Tony CHEMIT at 2018-04-03T20:13:32Z fix a template - - - - - 27381abd by Tony CHEMIT at 2018-04-03T20:13:32Z Amélioration de l&#39;arbre de navigation - - - - - 0fb8cb2d by Tony CHEMIT at 2018-04-03T20:13:32Z Correction d&#39;un appel a UIHelper.askUser - - - - - 30fedc4d by Tony CHEMIT at 2018-04-03T20:13:33Z Ajout de la donnée observe_longline.ActivityLogbook (See #907) Maquettage - - - - - e6646c3e by Tony CHEMIT at 2018-04-03T20:13:33Z Ajout de la donnée observe_longline.SetLogbook (See #909) - - - - - 018ebdbf by Tony CHEMIT at 2018-04-03T20:13:33Z Ajout de la donnée observe_longline.CatchLogbook (See #911) Maquettage - - - - - 355b9469 by Tony CHEMIT at 2018-04-03T20:13:33Z update i18n (see #911, see #907, see #909) - - - - - 30 changed files: - client-configuration/pom.xml - client-configuration/src/main/config/Client.ini - client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java - + client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfig.java - + client-configuration/src/main/java/fr/ird/observe/client/configuration/NavigationTreeConfigBean.java - client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties - client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties - client-configuration/src/main/resources/i18n/client-configuration_fr_FR.properties - client/pom.xml - client/src/main/assembly/dist/obstuna-admin/extra/create-postgis-1-activity.sql → client/src/main/assembly/dist/obstuna-admin/extra/01_create-postgis-1-activity.sql - client/src/main/assembly/dist/obstuna-admin/extra/create-postgis-2-harbour.sql → client/src/main/assembly/dist/obstuna-admin/extra/02_create-postgis-2-harbour.sql - client/src/main/assembly/dist/obstuna-admin/extra/create-postgis-3-activity-seine.sql → client/src/main/assembly/dist/obstuna-admin/extra/03_create-postgis-3-activity-seine.sql - client/src/main/assembly/dist/obstuna-admin/extra/create-postgis-4-activity-longine.sql → client/src/main/assembly/dist/obstuna-admin/extra/04_create-postgis-4-activity-longine.sql - client/src/main/assembly/dist/obstuna-admin/extra/function_enhanced_sets_school_types.sql → client/src/main/assembly/dist/obstuna-admin/extra/05_function_enhanced_sets_school_types.sql - client/src/main/ftl/dataSourceConnectionReport_en.ftl - client/src/main/ftl/dataSourceConnectionReport_es.ftl - client/src/main/ftl/dataSourceConnectionReport_fr.ftl - client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java - client/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jaxx - client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java - client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/admin/LaunchAdminActionSupport.java - client/src/main/java/fr/ird/observe/client/ui/admin/AdminStep.java - client/src/main/java/fr/ird/observe/client/ui/admin/AdminTabUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/admin/AdminUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/admin/resume/ShowResumeUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/admin/save/SaveLocalUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/data/DataSynchroModel.java - client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jaxx - client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroConfigUI.jcss - client/src/main/java/fr/ird/observe/client/ui/admin/synchronize/referential/ng/ReferentialSynchroModel.java The diff was not included because it is too large. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/cdbaa4e78c89734f40c43e7cc0… --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/cdbaa4e78c89734f40c43e7cc0… You're receiving this email because of your account on gitlab.com.
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.