Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

18 changed files:

Changes:

  • client/src/main/java/fr/ird/observe/client/ui/ObserveMainUIInitializer.java
    ... ... @@ -416,6 +416,7 @@ public class ObserveMainUIInitializer {
    416 416
             ui.getNavigationView().addMouseListener(mouseAdapter);
    
    417 417
             ui.getNavigationUI().getTree().addMouseListener(mouseAdapter);
    
    418 418
             ui.getNavigationUI().addMouseListener(mouseAdapter);
    
    419
    +        ui.getNavigationUI().getHandler().init(actionMap);
    
    419 420
     
    
    420 421
             init(ui.getSplitpane());
    
    421 422
             init(ui.getSplitpane2());
    

  • client/src/main/java/fr/ird/observe/client/ui/actions/content/tree/NavigationConfigUIActionSupport.java
    1
    +package fr.ird.observe.client.ui.actions.content.tree;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ui.ObserveMainUI;
    
    26
    +import fr.ird.observe.client.ui.actions.main.menu.MenuActionSupport;
    
    27
    +
    
    28
    +import javax.swing.Icon;
    
    29
    +import javax.swing.KeyStroke;
    
    30
    +import java.awt.event.ActionEvent;
    
    31
    +
    
    32
    +/**
    
    33
    + * Created by tchemit on 03/10/2018.
    
    34
    + *
    
    35
    + * @author Tony Chemit - dev@tchemit.fr
    
    36
    + */
    
    37
    +public abstract class NavigationConfigUIActionSupport extends MenuActionSupport {
    
    38
    +
    
    39
    +    NavigationConfigUIActionSupport(ObserveMainUI mainUI, String actionCommandKey, String label, String shortDescription, Icon actionIcon, KeyStroke acceleratorKey) {
    
    40
    +        super(mainUI, actionCommandKey, label, shortDescription, null, acceleratorKey);
    
    41
    +        putValue(SMALL_ICON, actionIcon);
    
    42
    +    }
    
    43
    +
    
    44
    +    @Override
    
    45
    +    protected void doActionPerformed(ActionEvent e) {
    
    46
    +        getMainUI().getNavigationUI().getHandler().tryToUpdateNavigationTree();
    
    47
    +    }
    
    48
    +}

  • client/src/main/java/fr/ird/observe/client/ui/actions/content/tree/ToggleConfigureNavigationConfigUIAction.java
    1
    +package fr.ird.observe.client.ui.actions.content.tree;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ui.ObserveKeyStrokes;
    
    26
    +import fr.ird.observe.client.ui.ObserveMainUI;
    
    27
    +import fr.ird.observe.client.ui.actions.UIActionSupport;
    
    28
    +
    
    29
    +import java.awt.event.ActionEvent;
    
    30
    +
    
    31
    +import static org.nuiton.i18n.I18n.n;
    
    32
    +
    
    33
    +/**
    
    34
    + * Created by tchemit on 03/10/2018.
    
    35
    + *
    
    36
    + * @author Tony Chemit - dev@tchemit.fr
    
    37
    + */
    
    38
    +public class ToggleConfigureNavigationConfigUIAction extends UIActionSupport {
    
    39
    +
    
    40
    +    public static final String ACTION_NAME = ToggleConfigureNavigationConfigUIAction.class.getName();
    
    41
    +
    
    42
    +    public ToggleConfigureNavigationConfigUIAction(ObserveMainUI mainUI) {
    
    43
    +        super(mainUI, ACTION_NAME, null, n("observe.tree.action.configure.tip"), "generate", ObserveKeyStrokes.KEY_STROKE_NAVIGATION_CONFIGURE);
    
    44
    +    }
    
    45
    +
    
    46
    +    @Override
    
    47
    +    public void actionPerformed(ActionEvent e) {
    
    48
    +        getMainUI().getNavigationUI().getHandler().configure();
    
    49
    +    }
    
    50
    +
    
    51
    +}

  • client/src/main/java/fr/ird/observe/client/ui/actions/content/tree/ToggleShowEmptyNavigationConfigUIAction.java
    1
    +package fr.ird.observe.client.ui.actions.content.tree;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ui.ObserveKeyStrokes;
    
    26
    +import fr.ird.observe.client.ui.ObserveMainUI;
    
    27
    +import fr.ird.observe.client.ui.util.UIHelper;
    
    28
    +
    
    29
    +import static org.nuiton.i18n.I18n.n;
    
    30
    +
    
    31
    +/**
    
    32
    + * Created by tchemit on 03/10/2018.
    
    33
    + *
    
    34
    + * @author Tony Chemit - dev@tchemit.fr
    
    35
    + */
    
    36
    +public class ToggleShowEmptyNavigationConfigUIAction extends NavigationConfigUIActionSupport {
    
    37
    +
    
    38
    +    public static final String ACTION_NAME = ToggleShowEmptyNavigationConfigUIAction.class.getName();
    
    39
    +
    
    40
    +    public ToggleShowEmptyNavigationConfigUIAction(ObserveMainUI mainUI) {
    
    41
    +        super(mainUI, ACTION_NAME, n("observe.constant.ObserveModelType.EMPTY"), n("observe.constant.ObserveModelType.EMPTY.description"), UIHelper.getUIManagerIcon("navigation.data.seine.TripSeine-16"), ObserveKeyStrokes.KEY_STROKE_SHOW_EMPTY_PROGRAM);
    
    42
    +    }
    
    43
    +
    
    44
    +}

  • client/src/main/java/fr/ird/observe/client/ui/actions/content/tree/ToggleShowLonglineNavigationConfigUIAction.java
    1
    +package fr.ird.observe.client.ui.actions.content.tree;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ui.ObserveKeyStrokes;
    
    26
    +import fr.ird.observe.client.ui.ObserveMainUI;
    
    27
    +import fr.ird.observe.client.ui.util.UIHelper;
    
    28
    +
    
    29
    +import static org.nuiton.i18n.I18n.n;
    
    30
    +
    
    31
    +/**
    
    32
    + * Created by tchemit on 03/10/2018.
    
    33
    + *
    
    34
    + * @author Tony Chemit - dev@tchemit.fr
    
    35
    + */
    
    36
    +public class ToggleShowLonglineNavigationConfigUIAction extends NavigationConfigUIActionSupport {
    
    37
    +
    
    38
    +    public static final String ACTION_NAME = ToggleShowLonglineNavigationConfigUIAction.class.getName();
    
    39
    +
    
    40
    +    public ToggleShowLonglineNavigationConfigUIAction(ObserveMainUI mainUI) {
    
    41
    +        super(mainUI, ACTION_NAME, n("observe.constant.ObserveModelType.LL"), n("observe.constant.ObserveModelType.LL.description"), UIHelper.getUIManagerIcon("navigation.referential.Program-16"), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE);
    
    42
    +    }
    
    43
    +
    
    44
    +}

  • client/src/main/java/fr/ird/observe/client/ui/actions/content/tree/ToggleShowReferentialNavigationConfigUIAction.java
    1
    +package fr.ird.observe.client.ui.actions.content.tree;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ui.ObserveKeyStrokes;
    
    26
    +import fr.ird.observe.client.ui.ObserveMainUI;
    
    27
    +import fr.ird.observe.client.ui.util.UIHelper;
    
    28
    +
    
    29
    +import static org.nuiton.i18n.I18n.n;
    
    30
    +
    
    31
    +/**
    
    32
    + * Created by tchemit on 03/10/2018.
    
    33
    + *
    
    34
    + * @author Tony Chemit - dev@tchemit.fr
    
    35
    + */
    
    36
    +public class ToggleShowReferentialNavigationConfigUIAction extends NavigationConfigUIActionSupport {
    
    37
    +
    
    38
    +    public static final String ACTION_NAME = ToggleShowReferentialNavigationConfigUIAction.class.getName();
    
    39
    +
    
    40
    +    public ToggleShowReferentialNavigationConfigUIAction(ObserveMainUI mainUI) {
    
    41
    +        super(mainUI, ACTION_NAME, n("observe.constant.ObserveModelType.REF"), n("observe.constant.ObserveModelType.REF.description"), UIHelper.getUIManagerIcon("navigation.referentiel-16"), ObserveKeyStrokes.KEY_STROKE_SHOW_REFERENTIAL);
    
    42
    +    }
    
    43
    +
    
    44
    +}

  • client/src/main/java/fr/ird/observe/client/ui/actions/content/tree/ToggleShowSeineNavigationConfigUIAction.java
    1
    +package fr.ird.observe.client.ui.actions.content.tree;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ui.ObserveKeyStrokes;
    
    26
    +import fr.ird.observe.client.ui.ObserveMainUI;
    
    27
    +import fr.ird.observe.client.ui.util.UIHelper;
    
    28
    +
    
    29
    +import static org.nuiton.i18n.I18n.n;
    
    30
    +
    
    31
    +/**
    
    32
    + * Created by tchemit on 03/10/2018.
    
    33
    + *
    
    34
    + * @author Tony Chemit - dev@tchemit.fr
    
    35
    + */
    
    36
    +public class ToggleShowSeineNavigationConfigUIAction extends NavigationConfigUIActionSupport {
    
    37
    +
    
    38
    +    public static final String ACTION_NAME = ToggleShowSeineNavigationConfigUIAction.class.getName();
    
    39
    +
    
    40
    +    public ToggleShowSeineNavigationConfigUIAction(ObserveMainUI mainUI) {
    
    41
    +        super(mainUI, ACTION_NAME, n("observe.constant.ObserveModelType.PS"), n("observe.constant.ObserveModelType.PS.description"), UIHelper.getUIManagerIcon("navigation.referential.Program-16"), ObserveKeyStrokes.KEY_STROKE_SHOW_SEINE);
    
    42
    +    }
    
    43
    +
    
    44
    +}

  • client/src/main/java/fr/ird/observe/client/ui/content/api/ContentUIModel.java
    ... ... @@ -79,7 +79,7 @@ public abstract class ContentUIModel extends AbstractSerializableBean {
    79 79
         private boolean addMessageOnOpen = true;
    
    80 80
     
    
    81 81
         protected ContentUIModel() {
    
    82
    -        prefix = "[" + getClass().getSimpleName() + "] ";
    
    82
    +        prefix = "[" + getClass().getSimpleName().replace("Model", "") + "] ";
    
    83 83
         }
    
    84 84
     
    
    85 85
         static <U extends ContentUI> ContentUIModel newModel(U ui) {
    

  • client/src/main/java/fr/ird/observe/client/ui/content/api/data/table/action/ContentTableUIEntryActionSupport.java
    1 1
     package fr.ird.observe.client.ui.content.api.data.table.action;
    
    2 2
     
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    3 25
     import fr.ird.observe.client.ui.ObserveMainUI;
    
    4 26
     import fr.ird.observe.client.ui.actions.UIActionSupport;
    
    5 27
     import fr.ird.observe.client.ui.content.api.data.table.ContentTableModel;
    
    ... ... @@ -45,8 +67,10 @@ public abstract class ContentTableUIEntryActionSupport extends UIActionSupport {
    45 67
         @Override
    
    46 68
         public final void actionPerformed(ActionEvent e) {
    
    47 69
             if (!isEnabled()) {
    
    70
    +            log.info(String.format("Reject action: %s :: %s", getActionCommandKey(), this));
    
    48 71
                 return;
    
    49 72
             }
    
    73
    +        log.info(String.format("Accept action: %s :: %s", getActionCommandKey(), this));
    
    50 74
             boolean focusOwner = ui.getTable().isFocusOwner();
    
    51 75
             log.debug("table has focus? " + focusOwner);
    
    52 76
             if (focusOwner) {
    

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUIHandler.java
    ... ... @@ -37,6 +37,8 @@ import org.nuiton.jaxx.runtime.spi.UIHandler;
    37 37
     
    
    38 38
     import java.awt.Component;
    
    39 39
     import java.awt.Container;
    
    40
    +import java.awt.GridBagConstraints;
    
    41
    +import java.awt.Insets;
    
    40 42
     import java.util.Optional;
    
    41 43
     
    
    42 44
     /**
    
    ... ... @@ -66,7 +68,13 @@ public class ActivityLonglineLogbookSampleUIHandler extends ContentSimpleUIHandl
    66 68
                 ui.getSamplePartLogbookPanel().remove(subUI);
    
    67 69
                 ui.getSamplePartLogbookPanel().add(subUI.getBody());
    
    68 70
                 ui.getSamplePartLogbookPanel().putClientProperty("contentUI", subUI);
    
    71
    +            ui.getTitleRightToolBar().add(subUI.getSelectToolbar(), 0);
    
    69 72
             }
    
    73
    +
    
    74
    +        ui.getActions().add(ui.getReset(), new GridBagConstraints(0, 0, 1, 1, 0.5, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));
    
    75
    +        ui.getActions().add(ui.getSave(), new GridBagConstraints(1, 0, 1, 1, 0.5, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));
    
    76
    +        ui.getActions().add(ui.getMove(), new GridBagConstraints(2, 0, 1, 1, 0.5, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));
    
    77
    +
    
    70 78
         }
    
    71 79
     
    
    72 80
         @Override
    

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/SamplePartLogbookUIHandler.java
    ... ... @@ -62,6 +62,7 @@ public class SamplePartLogbookUIHandler extends ContentTableUIHandler<SampleLogb
    62 62
     
    
    63 63
         private static final Logger log = LogManager.getLogger(SamplePartLogbookUIHandler.class);
    
    64 64
         private final PropertyChangeListener speciesChanged;
    
    65
    +    private boolean fromActivity;
    
    65 66
     
    
    66 67
         SamplePartLogbookUIHandler() {
    
    67 68
             speciesChanged = evt -> onSpeciesChanged((SpeciesReference) evt.getNewValue());
    
    ... ... @@ -70,7 +71,8 @@ public class SamplePartLogbookUIHandler extends ContentTableUIHandler<SampleLogb
    70 71
         @Override
    
    71 72
         public void beforeInit(SamplePartLogbookUI ui) {
    
    72 73
             super.beforeInit(ui);
    
    73
    -        if (ui.getContextValue(Boolean.class, "fromActivity") != null) {
    
    74
    +        fromActivity = ui.getContextValue(Boolean.class, "fromActivity") != null;
    
    75
    +        if (fromActivity) {
    
    74 76
                 ui.removeContextValue(Boolean.class, "fromActivity");
    
    75 77
                 ui.setContextValue(new SamplePartLogbookUIModel(ui, ObserveSwingApplicationContext.get().getNavigationSelect().getLongline().getActivityLogbook()));
    
    76 78
             } else {
    
    ... ... @@ -171,12 +173,17 @@ public class SamplePartLogbookUIHandler extends ContentTableUIHandler<SampleLogb
    171 173
         @Override
    
    172 174
         public void afterInit(SamplePartLogbookUI ui) {
    
    173 175
             addReferentialFilter(SamplePartLogbookDto.PROPERTY_SPECIES, incomingReferences -> {
    
    174
    -            String setId = ObserveSwingApplicationContext.get().getNavigationSelect().getLongline().getActivityLogbookSet().getId();
    
    175
    -            if (setId == null) {
    
    176
    -                return new LinkedList<>();
    
    176
    +            if (fromActivity) {
    
    177
    +//                FIXME We do not have the set selected here (since this is a brother of it)
    
    178
    +                String setId = ObserveSwingApplicationContext.get().getNavigationSelect().getLongline().getActivityLogbookSet().getId();
    
    179
    +                if (setId == null) {
    
    180
    +                    return incomingReferences;
    
    181
    +                }
    
    182
    +                ReferentialDtoReferenceSet<SpeciesReference> sampleSpecies = getSetLonglineLogbookCatchService().getSampleSpecies(setId);
    
    183
    +                return new LinkedList<>(sampleSpecies.toSet());
    
    184
    +            } else {
    
    185
    +                return incomingReferences;
    
    177 186
                 }
    
    178
    -            ReferentialDtoReferenceSet<SpeciesReference> sampleSpecies = getSetLonglineLogbookCatchService().getSampleSpecies(setId);
    
    179
    -            return new LinkedList<>(sampleSpecies.toSet());
    
    180 187
             });
    
    181 188
             super.afterInit(ui);
    
    182 189
         }
    

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/TripLonglineLandingLogbookUIHandler.java
    ... ... @@ -65,7 +65,12 @@ public class TripLonglineLandingLogbookUIHandler extends ContentOpenableUIHandle
    65 65
                 ui.getLandingPartPanel().remove(subUI);
    
    66 66
                 ui.getLandingPartPanel().add(subUI.getBody());
    
    67 67
                 ui.getLandingPartPanel().putClientProperty("contentUI", subUI);
    
    68
    +            ui.getTitleRightToolBar().add(subUI.getSelectToolbar(), 0);
    
    69
    +            subUI.getSelectToolbar().setVisible(false);
    
    68 70
             }
    
    71
    +        ui.getMainTabbedPane().addChangeListener(
    
    72
    +                l -> ui.getLandingPartLogbookUI().getSelectToolbar().setVisible(ui.getMainTabbedPane().getSelectedIndex() == 1)
    
    73
    +        );
    
    69 74
         }
    
    70 75
     
    
    71 76
         @Override
    

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/TripLonglineSampleLogbookUI.jaxx
    ... ... @@ -112,6 +112,7 @@
    112 112
       <JButton id='reopen'/>
    
    113 113
       <JButton id='close'/>
    
    114 114
       <JButton id='create'/>
    
    115
    +  <JButton id='save'/>
    
    115 116
     
    
    116 117
       <!-- actions -->
    
    117 118
       <Table id="extraActions" fill='both' weightx='1' insets='0'>
    

  • client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/TripLonglineSampleLogbookUIHandler.java
    ... ... @@ -58,10 +58,17 @@ class TripLonglineSampleLogbookUIHandler extends ContentOpenableUIHandler<Sample
    58 58
             {
    
    59 59
                 // init floatlinesComposition tab
    
    60 60
                 SamplePartLogbookUI subUI = ui.getSamplePartLogbookUI();
    
    61
    +            subUI.getModel().setStandalone(false);
    
    61 62
                 ui.getSamplePartLogbookPanel().remove(subUI);
    
    62 63
                 ui.getSamplePartLogbookPanel().add(subUI.getBody());
    
    63 64
                 ui.getSamplePartLogbookPanel().putClientProperty("contentUI", subUI);
    
    65
    +
    
    66
    +            ui.getTitleRightToolBar().add(subUI.getSelectToolbar(), 0);
    
    67
    +            subUI.getSelectToolbar().setVisible(false);
    
    64 68
             }
    
    69
    +        ui.getMainTabbedPane().addChangeListener(
    
    70
    +                l -> ui.getSamplePartLogbookUI().getSelectToolbar().setVisible(ui.getMainTabbedPane().getSelectedIndex() == 1)
    
    71
    +        );
    
    65 72
             getModel().addPropertyChangeListener(TripLonglineSampleLogbookUIModel.PROPERTY_MODE, evt -> showPartsTab(evt.getNewValue() != ContentMode.CREATE));
    
    66 73
         }
    
    67 74
     
    

  • client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jaxx
    ... ... @@ -23,6 +23,12 @@
    23 23
     
    
    24 24
       <import>
    
    25 25
         fr.ird.observe.client.configuration.NavigationTreeConfigBean
    
    26
    +    fr.ird.observe.client.ui.actions.content.tree.ToggleShowSeineNavigationConfigUIAction
    
    27
    +    fr.ird.observe.client.ui.actions.content.tree.ToggleShowLonglineNavigationConfigUIAction
    
    28
    +    fr.ird.observe.client.ui.actions.content.tree.ToggleShowReferentialNavigationConfigUIAction
    
    29
    +    fr.ird.observe.client.ui.actions.content.tree.ToggleShowEmptyNavigationConfigUIAction
    
    30
    +    fr.ird.observe.client.ui.actions.content.tree.ToggleConfigureNavigationConfigUIAction
    
    31
    +
    
    26 32
         static org.nuiton.i18n.I18n.t
    
    27 33
       </import>
    
    28 34
       <NavigationTree id='tree' />
    
    ... ... @@ -30,16 +36,16 @@
    30 36
       <NavigationTreeConfigBean id='navigationConfig' javaBean='treeModel.getConfig()'/>
    
    31 37
     
    
    32 38
       <JPopupMenu id='configurePopup'>
    
    33
    -    <JCheckBoxMenuItem id='showSeineTrip' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    34
    -    <JCheckBoxMenuItem id='showLonglineTrip' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    35
    -    <JCheckBoxMenuItem id='showReferential' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    36
    -    <JCheckBoxMenuItem id='showEmptyProgram' onActionPerformed="handler.tryToUpdateNavigationTree()"/>
    
    39
    +    <JCheckBoxMenuItem id='showSeineTrip'/>
    
    40
    +    <JCheckBoxMenuItem id='showLonglineTrip'/>
    
    41
    +    <JCheckBoxMenuItem id='showReferential'/>
    
    42
    +    <JCheckBoxMenuItem id='showEmptyProgram'/>
    
    37 43
       </JPopupMenu>
    
    38 44
     
    
    39 45
       <JToolBar id='toolbar'>
    
    40 46
         <JButton id='colapseAll' onActionPerformed='handler.collapseAll()'/>
    
    41 47
         <JButton id='expandAll' onActionPerformed='handler.expandAll()'/>
    
    42
    -    <JToggleButton id='configure' onActionPerformed='handler.configure()'/>
    
    48
    +    <JToggleButton id='configure'/>
    
    43 49
       </JToolBar>
    
    44 50
     
    
    45 51
     </JScrollPane>

  • client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUI.jcss
    ... ... @@ -22,23 +22,27 @@
    22 22
     
    
    23 23
     #showSeineTrip {
    
    24 24
       selected: {navigationConfig.isShowSeineTrip()};
    
    25
    -  text:"observe.constant.ObserveModelType.PS";
    
    26
    -  toolTipText:"observe.constant.ObserveModelType.PS.description";
    
    25
    +  _observeAction:{ToggleShowSeineNavigationConfigUIAction.ACTION_NAME};
    
    26
    +  /*text:"observe.constant.ObserveModelType.PS";
    
    27
    +  toolTipText:"observe.constant.ObserveModelType.PS.description";*/
    
    27 28
     }
    
    28 29
     #showLonglineTrip {
    
    29 30
       selected: {navigationConfig.isShowLonglineTrip()};
    
    30
    -  text:"observe.constant.ObserveModelType.LL";
    
    31
    -  toolTipText:"observe.constant.ObserveModelType.LL.description";
    
    31
    +  _observeAction:{ToggleShowLonglineNavigationConfigUIAction.ACTION_NAME};
    
    32
    +  /*text:"observe.constant.ObserveModelType.LL";
    
    33
    +  toolTipText:"observe.constant.ObserveModelType.LL.description";*/
    
    32 34
     }
    
    33 35
     #showReferential {
    
    34 36
       selected: {navigationConfig.isShowReferential()};
    
    35
    -  text:"observe.constant.ObserveModelType.REF";
    
    36
    -  toolTipText:"observe.constant.ObserveModelType.REF.description";
    
    37
    +  _observeAction:{ToggleShowReferentialNavigationConfigUIAction.ACTION_NAME};
    
    38
    +  /*text:"observe.constant.ObserveModelType.REF";
    
    39
    +  toolTipText:"observe.constant.ObserveModelType.REF.description";*/
    
    37 40
     }
    
    38 41
     #showEmptyProgram {
    
    39 42
       selected: {navigationConfig.isShowEmptyProgram()};
    
    40
    -  text:"observe.constant.ObserveModelType.EMPTY";
    
    41
    -  toolTipText:"observe.constant.ObserveModelType.EMPTY.description";
    
    43
    +  _observeAction:{ToggleShowEmptyNavigationConfigUIAction.ACTION_NAME};
    
    44
    +  /*text:"observe.constant.ObserveModelType.EMPTY";
    
    45
    +  toolTipText:"observe.constant.ObserveModelType.EMPTY.description";*/
    
    42 46
     }
    
    43 47
     
    
    44 48
     JToggleButton {
    
    ... ... @@ -62,8 +66,9 @@ JButton {
    62 66
     }
    
    63 67
     
    
    64 68
     #configure {
    
    65
    -  actionIcon:generate;
    
    66
    -  toolTipText:"observe.tree.action.configure.tip";
    
    69
    +  _observeAction:{ToggleConfigureNavigationConfigUIAction.ACTION_NAME};
    
    70
    +  /*actionIcon:generate;
    
    71
    +  toolTipText:"observe.tree.action.configure.tip";*/
    
    67 72
     }
    
    68 73
     
    
    69 74
     #tree {
    

  • client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationUIHandler.java
    ... ... @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.tree.navigation;
    10 10
      * it under the terms of the GNU General Public License as
    
    11 11
      * published by the Free Software Foundation, either version 3 of the
    
    12 12
      * License, or (at your option) any later version.
    
    13
    - * 
    
    13
    + *
    
    14 14
      * This program is distributed in the hope that it will be useful,
    
    15 15
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16 16
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17 17
      * GNU General Public License for more details.
    
    18
    - * 
    
    18
    + *
    
    19 19
      * You should have received a copy of the GNU General Public
    
    20 20
      * License along with this program.  If not, see
    
    21 21
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    ... ... @@ -25,19 +25,17 @@ package fr.ird.observe.client.ui.tree.navigation;
    25 25
     import fr.ird.observe.client.ObserveSwingApplicationContext;
    
    26 26
     import fr.ird.observe.client.configuration.ClientConfig;
    
    27 27
     import fr.ird.observe.client.configuration.NavigationTreeConfig;
    
    28
    -import fr.ird.observe.client.ui.ObserveKeyStrokes;
    
    28
    +import fr.ird.observe.client.ui.actions.UIActionSupport;
    
    29
    +import fr.ird.observe.client.ui.content.api.spi.ObserveActionMap;
    
    29 30
     import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
    
    30
    -import fr.ird.observe.client.ui.util.UIHelper;
    
    31
    -import org.apache.logging.log4j.Logger;
    
    32 31
     import org.apache.logging.log4j.LogManager;
    
    32
    +import org.apache.logging.log4j.Logger;
    
    33 33
     import org.jdesktop.swingx.decorator.ColorHighlighter;
    
    34 34
     import org.jdesktop.swingx.search.Searchable;
    
    35 35
     import org.jdesktop.swingx.search.TreeSearchable;
    
    36 36
     import org.nuiton.jaxx.runtime.spi.UIHandler;
    
    37 37
     
    
    38
    -import javax.swing.AbstractAction;
    
    39
    -import javax.swing.ActionMap;
    
    40
    -import javax.swing.InputMap;
    
    38
    +import javax.swing.AbstractButton;
    
    41 39
     import javax.swing.JComponent;
    
    42 40
     import javax.swing.JPopupMenu;
    
    43 41
     import javax.swing.SwingUtilities;
    
    ... ... @@ -45,7 +43,9 @@ import javax.swing.event.PopupMenuEvent;
    45 43
     import javax.swing.event.PopupMenuListener;
    
    46 44
     import java.awt.Color;
    
    47 45
     import java.awt.Dimension;
    
    48
    -import java.awt.event.ActionEvent;
    
    46
    +import java.util.Objects;
    
    47
    +
    
    48
    +import static fr.ird.observe.client.ui.content.api.ContentUIInitializer.OBSERVE_ACTION;
    
    49 49
     
    
    50 50
     /**
    
    51 51
      * Created by tchemit on 01/04/2018.
    
    ... ... @@ -54,7 +54,6 @@ import java.awt.event.ActionEvent;
    54 54
      */
    
    55 55
     public class NavigationUIHandler implements UIHandler<NavigationUI> {
    
    56 56
     
    
    57
    -    /** Logger */
    
    58 57
         private static final Logger log = LogManager.getLogger(NavigationUIHandler.class);
    
    59 58
     
    
    60 59
         private NavigationUI ui;
    
    ... ... @@ -72,80 +71,27 @@ public class NavigationUIHandler implements UIHandler<NavigationUI> {
    72 71
             this.ui = ui;
    
    73 72
         }
    
    74 73
     
    
    74
    +    public void init(ObserveActionMap actionMap) {
    
    75
    +        init(actionMap, ui.getShowSeineTrip());
    
    76
    +        init(actionMap, ui.getShowLonglineTrip());
    
    77
    +        init(actionMap, ui.getShowReferential());
    
    78
    +        init(actionMap, ui.getShowEmptyProgram());
    
    79
    +        init(actionMap, ui.getConfigure());
    
    80
    +    }
    
    81
    +
    
    75 82
         @Override
    
    76 83
         public void afterInit(NavigationUI ui) {
    
    77 84
     
    
    78
    -        ui.getShowSeineTrip().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
    
    79
    -        ui.getShowLonglineTrip().setIcon(UIHelper.getUIManagerIcon("navigation.referential.Program-16"));
    
    80
    -        ui.getShowReferential().setIcon(UIHelper.getUIManagerIcon("navigation.referentiel-16"));
    
    81
    -        ui.getShowEmptyProgram().setIcon(UIHelper.getUIManagerIcon("navigation.data.seine.TripSeine-16"));
    
    82
    -
    
    83 85
             NavigationTree tree = ui.getTree();
    
    84 86
             TreeSearchable searchable = new TreeSearchable(tree);
    
    85 87
             tree.setSearchable(searchable);
    
    86 88
             searchable.setMatchHighlighter(new ColorHighlighter(Color.YELLOW, Color.BLACK));
    
    87 89
     
    
    88
    -        ObserveKeyStrokes.addKeyStroke(ui.getShowSeineTrip(), ObserveKeyStrokes.KEY_STROKE_SHOW_SEINE);
    
    89
    -        ObserveKeyStrokes.addKeyStroke(ui.getShowLonglineTrip(), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE);
    
    90
    -        ObserveKeyStrokes.addKeyStroke(ui.getShowReferential(), ObserveKeyStrokes.KEY_STROKE_SHOW_REFERENTIAL);
    
    91
    -        ObserveKeyStrokes.addKeyStroke(ui.getShowEmptyProgram(), ObserveKeyStrokes.KEY_STROKE_SHOW_EMPTY_PROGRAM);
    
    92
    -        ObserveKeyStrokes.addKeyStroke(ui.getConfigure(), ObserveKeyStrokes.KEY_STROKE_NAVIGATION_CONFIGURE);
    
    93
    -        //FIXME (no text, so no text after...)
    
    94
    -        ui.getConfigure().setText(null);
    
    90
    +//        ui.getConfigure().setText(null);
    
    95 91
             ClientConfig config = ObserveSwingApplicationContext.get().getConfig();
    
    96 92
             NavigationTreeModel treeModel = (NavigationTreeModel) tree.getModel();
    
    97 93
             treeModel.load(config);
    
    98 94
     
    
    99
    -        InputMap inputMap = ui.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    
    100
    -        ActionMap actionMap = ui.getActionMap();
    
    101
    -        inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_SEINE, "showSeine");
    
    102
    -        actionMap.put("showSeine", new AbstractAction() {
    
    103
    -            @Override
    
    104
    -            public void actionPerformed(ActionEvent e) {
    
    105
    -                if (ui.getConfigurePopup().isVisible()) {
    
    106
    -                    ui.getShowSeineTrip().doClick();
    
    107
    -                }
    
    108
    -                ui.getConfigurePopup().setVisible(false);
    
    109
    -            }
    
    110
    -        });
    
    111
    -        inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE, "showLongline");
    
    112
    -        actionMap.put("showLongline", new AbstractAction() {
    
    113
    -            @Override
    
    114
    -            public void actionPerformed(ActionEvent e) {
    
    115
    -                if (ui.getConfigurePopup().isVisible()) {
    
    116
    -                    ui.getShowLonglineTrip().doClick();
    
    117
    -                }
    
    118
    -                ui.getConfigurePopup().setVisible(false);
    
    119
    -            }
    
    120
    -        });
    
    121
    -        inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_REFERENTIAL, "showReferential");
    
    122
    -        actionMap.put("showReferential", new AbstractAction() {
    
    123
    -            @Override
    
    124
    -            public void actionPerformed(ActionEvent e) {
    
    125
    -                if (ui.getConfigurePopup().isVisible()) {
    
    126
    -                    ui.getShowReferential().doClick();
    
    127
    -                }
    
    128
    -                ui.getConfigurePopup().setVisible(false);
    
    129
    -            }
    
    130
    -        });
    
    131
    -        inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_EMPTY_PROGRAM, "showEmptyProgram");
    
    132
    -        actionMap.put("showEmptyProgram", new AbstractAction() {
    
    133
    -            @Override
    
    134
    -            public void actionPerformed(ActionEvent e) {
    
    135
    -                if (ui.getConfigurePopup().isVisible()) {
    
    136
    -                    ui.getShowEmptyProgram().doClick();
    
    137
    -                }
    
    138
    -                ui.getConfigurePopup().setVisible(false);
    
    139
    -            }
    
    140
    -        });
    
    141
    -        inputMap.put(ObserveKeyStrokes.KEY_STROKE_NAVIGATION_CONFIGURE, "configure");
    
    142
    -        actionMap.put("configure", new AbstractAction() {
    
    143
    -            @Override
    
    144
    -            public void actionPerformed(ActionEvent e) {
    
    145
    -                ui.getConfigure().doClick();
    
    146
    -            }
    
    147
    -        });
    
    148
    -
    
    149 95
             ui.getConfigurePopup().addPopupMenuListener(new PopupMenuListener() {
    
    150 96
                 @Override
    
    151 97
                 public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
    
    ... ... @@ -164,7 +110,8 @@ public class NavigationUIHandler implements UIHandler<NavigationUI> {
    164 110
             });
    
    165 111
         }
    
    166 112
     
    
    167
    -    void configure() {
    
    113
    +    public void configure() {
    
    114
    +        ui.getConfigure().setSelected(true);
    
    168 115
             SwingUtilities.invokeLater(() -> {
    
    169 116
                 JComponent c = ui.getConfigure();
    
    170 117
                 JPopupMenu p = ui.getConfigurePopup();
    
    ... ... @@ -186,7 +133,26 @@ public class NavigationUIHandler implements UIHandler<NavigationUI> {
    186 133
     
    
    187 134
         }
    
    188 135
     
    
    189
    -    void tryToUpdateNavigationTree() {
    
    136
    +    protected void init(ObserveActionMap actionMap, AbstractButton editor) {
    
    137
    +        String actionId = (String) editor.getClientProperty(OBSERVE_ACTION);
    
    138
    +        if (actionId == null) {
    
    139
    +
    
    140
    +            return;
    
    141
    +        }
    
    142
    +
    
    143
    +        // on a trouve une action commune
    
    144
    +        UIActionSupport action = (UIActionSupport) actionMap.get(actionId);
    
    145
    +        Objects.requireNonNull(action, "action [" + actionId + "] not found for ui " + ui.getClass().getName());
    
    146
    +
    
    147
    +        if (log.isDebugEnabled()) {
    
    148
    +            log.debug("init common action " + actionId);
    
    149
    +        }
    
    150
    +
    
    151
    +        action.initForMainUi(editor);
    
    152
    +
    
    153
    +    }
    
    154
    +
    
    155
    +    public void tryToUpdateNavigationTree() {
    
    190 156
     
    
    191 157
             boolean canContinue = ObserveSwingApplicationContext.get().getContentUIManager().closeSelectedContentUI();
    
    192 158
     
    
    ... ... @@ -223,19 +189,14 @@ public class NavigationUIHandler implements UIHandler<NavigationUI> {
    223 189
         }
    
    224 190
     
    
    225 191
         public void collapseAll() {
    
    226
    -
    
    227 192
             NavigationTree tree = getTree();
    
    228 193
             tree.clearSelection();
    
    229 194
             tree.collapseAll();
    
    230 195
             tree.setSelectionRow(0);
    
    231
    -
    
    232 196
         }
    
    233 197
     
    
    234 198
         public void expandAll() {
    
    235
    -
    
    236 199
             NavigationTree tree = getTree();
    
    237 200
             tree.expandAll();
    
    238
    -
    
    239 201
         }
    
    240
    -
    
    241 202
     }

  • client/src/main/java/fr/ird/observe/client/ui/util/UIHelper.java
    ... ... @@ -598,9 +598,10 @@ public class UIHelper extends SwingUtil {
    598 598
                 SwingUtilities.invokeLater(component::requestFocus);
    
    599 599
             } else if (ObserveSwingApplicationContext.get().getMainUI().getModel().canAcquireFocus()) {
    
    600 600
                 SwingUtilities.invokeLater(() -> {
    
    601
    -                log.info("ask focus for component: " + component.getName());
    
    602
    -                boolean b = component.requestFocusInWindow();
    
    603
    -                log.info(String.format("Will request focus %s ? %s", component.getName(), b));
    
    601
    +                log.debug("ask focus for component: " + component.getName());
    
    602
    +                /*boolean b =*/
    
    603
    +                component.requestFocusInWindow();
    
    604
    +//                log.debug(String.format("Will request focus %s ? %s", component.getName(), b));
    
    604 605
                 });
    
    605 606
             }
    
    606 607
         }