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

Commits:

15 changed files:

Changes:

  • client-core/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
    ... ... @@ -61,6 +61,7 @@ public abstract class ObserveKeyStrokes {
    61 61
         public static final KeyStroke KEY_STROKE_RELOAD_DEFAULT_CONFIGURATION = KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
    
    62 62
         public static final KeyStroke KEY_STROKE_ESCAPE = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    
    63 63
         public static final KeyStroke KEY_STROKE_ENTER = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
    
    64
    +    public static final KeyStroke KEY_STROKE_SPACE = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0);
    
    64 65
         public static final KeyStroke KEY_STROKE_NAVIGATION_CONFIGURE = KeyStroke.getKeyStroke("ctrl pressed F1");
    
    65 66
         public static final KeyStroke KEY_STROKE_SHOW_SEINE = KeyStroke.getKeyStroke("ctrl pressed F2");
    
    66 67
         public static final KeyStroke KEY_STROKE_SHOW_LONGLINE = KeyStroke.getKeyStroke("ctrl pressed F3");
    

  • client-core/src/main/java/fr/ird/observe/client/ui/tree/selection/SelectionTree.java
    ... ... @@ -56,9 +56,11 @@ public class SelectionTree extends JXTree {
    56 56
     
    
    57 57
         public void installUI() {
    
    58 58
     
    
    59
    +        getInputMap().put(ObserveKeyStrokes.KEY_STROKE_SPACE,"none");
    
    59 60
             InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW);
    
    60 61
             ActionMap actionMap = getActionMap();
    
    61 62
             inputMap.put(ObserveKeyStrokes.KEY_STROKE_ENTER, "select/unselect");
    
    63
    +        inputMap.put(ObserveKeyStrokes.KEY_STROKE_SPACE, "select/unselect");
    
    62 64
             actionMap.put("select/unselect", new AbstractAction() {
    
    63 65
                 @Override
    
    64 66
                 public void actionPerformed(ActionEvent e) {
    
    ... ... @@ -80,8 +82,11 @@ public class SelectionTree extends JXTree {
    80 82
     
    
    81 83
             InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW);
    
    82 84
             ActionMap actionMap = getActionMap();
    
    85
    +        getInputMap().put(ObserveKeyStrokes.KEY_STROKE_SPACE,"none");
    
    86
    +        oppositeTree.getInputMap().put(ObserveKeyStrokes.KEY_STROKE_SPACE,"none");
    
    83 87
     
    
    84 88
             inputMap.put(ObserveKeyStrokes.KEY_STROKE_ENTER, "select/unselect");
    
    89
    +        inputMap.put(ObserveKeyStrokes.KEY_STROKE_SPACE, "select/unselect");
    
    85 90
             actionMap.put("select/unselect", new AbstractAction() {
    
    86 91
     
    
    87 92
                 @Override
    

  • client-core/src/main/java/fr/ird/observe/client/ui/tree/selection/SelectionTreeCellRenderer.java
    ... ... @@ -31,9 +31,11 @@ import javax.swing.Icon;
    31 31
     import javax.swing.JCheckBox;
    
    32 32
     import javax.swing.JPanel;
    
    33 33
     import javax.swing.JTree;
    
    34
    +import javax.swing.UIManager;
    
    34 35
     import java.awt.BorderLayout;
    
    35 36
     import java.awt.Component;
    
    36 37
     import java.awt.Dimension;
    
    38
    +import java.util.Objects;
    
    37 39
     
    
    38 40
     /**
    
    39 41
      * Created on 14/11/16.
    
    ... ... @@ -45,6 +47,8 @@ public class SelectionTreeCellRenderer extends DefaultXTreeCellRenderer {
    45 47
     
    
    46 48
         private final JPanel panel;
    
    47 49
         private final JCheckBox selected;
    
    50
    +    private final Icon unselectedIcon;
    
    51
    +    private Icon partialIcon;
    
    48 52
     
    
    49 53
         protected SelectionTreeCellRenderer() {
    
    50 54
             selected = new JCheckBox();
    
    ... ... @@ -52,6 +56,11 @@ public class SelectionTreeCellRenderer extends DefaultXTreeCellRenderer {
    52 56
             panel.setOpaque(false);
    
    53 57
             panel.add(selected, BorderLayout.WEST);
    
    54 58
             panel.add(this, BorderLayout.CENTER);
    
    59
    +        partialIcon = Objects.requireNonNull(UIManager.getIcon("checkbox.partial"));
    
    60
    +        unselectedIcon = Objects.requireNonNull(UIManager.getIcon("checkbox.empty"));
    
    61
    +        selected.setIcon(unselectedIcon);
    
    62
    +        Icon selectedIcon = Objects.requireNonNull(UIManager.getIcon("checkbox.selected"));
    
    63
    +        selected.setSelectedIcon(selectedIcon);
    
    55 64
         }
    
    56 65
     
    
    57 66
         public Icon getIcon(SelectionTreeNodeSupport node) {
    
    ... ... @@ -69,7 +78,9 @@ public class SelectionTreeCellRenderer extends DefaultXTreeCellRenderer {
    69 78
             } else if (node instanceof TripLonglineSelectionTreeNode) {
    
    70 79
                 setToolTipText(((TripLonglineSelectionTreeNode) node).getToolTipText());
    
    71 80
             }
    
    72
    -        selected.setSelected(node.isSelected());
    
    81
    +        boolean selected = node.isSelected();
    
    82
    +        this.selected.setSelected(selected);
    
    83
    +        this.selected.setIcon(selected || !node.isPartialSelected() ? unselectedIcon : partialIcon);
    
    73 84
             panel.setPreferredSize(new Dimension(getPreferredSize().width + 20, getPreferredSize().height + 2));
    
    74 85
             return panel;
    
    75 86
         }
    

  • client-core/src/main/java/fr/ird/observe/client/ui/tree/selection/nodes/ProgramSelectionTreeNode.java
    ... ... @@ -29,6 +29,7 @@ import fr.ird.observe.dto.data.ps.common.TripSeineReference;
    29 29
     import fr.ird.observe.dto.reference.DataDtoReference;
    
    30 30
     import fr.ird.observe.dto.referential.common.ProgramDto;
    
    31 31
     import fr.ird.observe.dto.referential.common.ProgramReference;
    
    32
    +import fr.ird.observe.navigation.model.edit.ObserveEditModel;
    
    32 33
     import org.apache.commons.collections4.EnumerationUtils;
    
    33 34
     
    
    34 35
     import java.util.Collection;
    
    ... ... @@ -65,10 +66,12 @@ public class ProgramSelectionTreeNode extends ReferenceSelectionTreeNodeSupport<
    65 66
     
    
    66 67
         @Override
    
    67 68
         public boolean isOpen() {
    
    68
    -        return Objects.equals(ObserveSwingApplicationContext.get().getNavigationEdit().getLongline().getProgram().getId(),toString())
    
    69
    -                || Objects.equals(ObserveSwingApplicationContext.get().getNavigationEdit().getSeine().getProgram().getId(),toString());
    
    69
    +        ObserveEditModel navigationEdit = getNavigationEditModel();
    
    70
    +        return Objects.equals(navigationEdit.getLongline().getProgram().getId(), toString())
    
    71
    +                || Objects.equals(navigationEdit.getSeine().getProgram().getId(), toString());
    
    70 72
         }
    
    71 73
     
    
    74
    +
    
    72 75
         @Override
    
    73 76
         public Iterator<TripSelectionTreeNodeSupport<?, ?>> iterator() {
    
    74 77
             return (Iterator) EnumerationUtils.toList(super.children()).iterator();
    

  • client-core/src/main/java/fr/ird/observe/client/ui/tree/selection/nodes/ReferenceSelectionTreeNodeSupport.java
    ... ... @@ -26,8 +26,11 @@ import fr.ird.observe.client.ObserveSwingApplicationContext;
    26 26
     import fr.ird.observe.dto.IdDto;
    
    27 27
     import fr.ird.observe.dto.IdHelper;
    
    28 28
     import fr.ird.observe.dto.reference.DtoReference;
    
    29
    +import fr.ird.observe.navigation.model.edit.ObserveEditModel;
    
    29 30
     import org.nuiton.decorator.Decorator;
    
    30 31
     
    
    32
    +import java.util.Enumeration;
    
    33
    +
    
    31 34
     /**
    
    32 35
      * Created on 18/11/16.
    
    33 36
      *
    
    ... ... @@ -69,4 +72,26 @@ public abstract class ReferenceSelectionTreeNodeSupport<D extends IdDto, R exten
    69 72
         public void setSelected(boolean selected) {
    
    70 73
             this.selected = selected;
    
    71 74
         }
    
    75
    +
    
    76
    +    @Override
    
    77
    +    public boolean isPartialSelected() {
    
    78
    +        if (isSelected()) {
    
    79
    +            return false;
    
    80
    +        }
    
    81
    +        if (isLeaf()) {
    
    82
    +            return false;
    
    83
    +        }
    
    84
    +        Enumeration<SelectionTreeNodeSupport> children = children();
    
    85
    +        while (children.hasMoreElements()) {
    
    86
    +            SelectionTreeNodeSupport nodeSupport = children.nextElement();
    
    87
    +            if (nodeSupport.isSelected()) {
    
    88
    +                return true;
    
    89
    +            }
    
    90
    +        }
    
    91
    +        return false;
    
    92
    +    }
    
    93
    +
    
    94
    +    ObserveEditModel getNavigationEditModel() {
    
    95
    +        return ObserveSwingApplicationContext.get().getNavigationEdit();
    
    96
    +    }
    
    72 97
     }

  • client-core/src/main/java/fr/ird/observe/client/ui/tree/selection/nodes/ReferentialSelectionTreeNode.java
    ... ... @@ -66,6 +66,11 @@ public class ReferentialSelectionTreeNode<D extends ReferentialDto> extends Sele
    66 66
             return selected;
    
    67 67
         }
    
    68 68
     
    
    69
    +    @Override
    
    70
    +    public boolean isPartialSelected() {
    
    71
    +        return false;
    
    72
    +    }
    
    73
    +
    
    69 74
         @Override
    
    70 75
         public void setSelected(boolean selected) {
    
    71 76
             this.selected = selected;
    

  • client-core/src/main/java/fr/ird/observe/client/ui/tree/selection/nodes/ReferentialsSelectionTreeNode.java
    ... ... @@ -100,6 +100,19 @@ public class ReferentialsSelectionTreeNode extends SelectionTreeNodeSupport<Stri
    100 100
             return true;
    
    101 101
         }
    
    102 102
     
    
    103
    +    @Override
    
    104
    +    public boolean isPartialSelected() {
    
    105
    +        if (isSelected()) {
    
    106
    +            return false;
    
    107
    +        }
    
    108
    +        for (ReferentialSelectionTreeNode<?> nodeSupport : this) {
    
    109
    +            if (nodeSupport.isSelected()) {
    
    110
    +                return true;
    
    111
    +            }
    
    112
    +        }
    
    113
    +        return false;
    
    114
    +    }
    
    115
    +
    
    103 116
         public ImmutableList<Class<? extends ReferentialDto>> getSelected() {
    
    104 117
             ImmutableList.Builder<Class<? extends ReferentialDto>> builder = ImmutableList.builder();
    
    105 118
             for (ReferentialSelectionTreeNode<?> nodeSupport : this) {
    

  • client-core/src/main/java/fr/ird/observe/client/ui/tree/selection/nodes/RootSelectionTreeNode.java
    ... ... @@ -74,6 +74,11 @@ public class RootSelectionTreeNode extends SelectionTreeNodeSupport<Void> implem
    74 74
             // rien a faire
    
    75 75
         }
    
    76 76
     
    
    77
    +    @Override
    
    78
    +    public boolean isPartialSelected() {
    
    79
    +        return false;
    
    80
    +    }
    
    81
    +
    
    77 82
         public ReferentialsSelectionTreeNode[] getReferentialsNodes() {
    
    78 83
             ReferentialsSelectionTreeNode[] result = new ReferentialsSelectionTreeNode[3];
    
    79 84
             result[0] = (ReferentialsSelectionTreeNode) getChildAt(getChildCount() - 3);
    

  • client-core/src/main/java/fr/ird/observe/client/ui/tree/selection/nodes/SelectionTreeNodeSupport.java
    ... ... @@ -42,6 +42,8 @@ public abstract class SelectionTreeNodeSupport<O> extends DefaultMutableTreeNode
    42 42
     
    
    43 43
         public abstract boolean isOpen();
    
    44 44
     
    
    45
    +    public abstract boolean isPartialSelected();
    
    46
    +
    
    45 47
         public abstract String getId();
    
    46 48
     
    
    47 49
         public abstract String getText();
    

  • client-core/src/main/java/fr/ird/observe/client/ui/tree/selection/nodes/TripLonglineSelectionTreeNode.java
    ... ... @@ -44,7 +44,7 @@ public class TripLonglineSelectionTreeNode extends TripSelectionTreeNodeSupport<
    44 44
     
    
    45 45
         @Override
    
    46 46
         public boolean isOpen() {
    
    47
    -        return Objects.equals(ObserveSwingApplicationContext.get().getNavigationEdit().getLongline().getTrip().getId(), getId());
    
    47
    +        return Objects.equals(getNavigationEditModel().getLongline().getTrip().getId(), getId());
    
    48 48
         }
    
    49 49
     
    
    50 50
         @Override
    

  • client-core/src/main/java/fr/ird/observe/client/ui/tree/selection/nodes/TripSeineSelectionTreeNode.java
    ... ... @@ -44,7 +44,7 @@ public class TripSeineSelectionTreeNode extends TripSelectionTreeNodeSupport<Tri
    44 44
     
    
    45 45
         @Override
    
    46 46
         public boolean isOpen() {
    
    47
    -        return Objects.equals(ObserveSwingApplicationContext.get().getNavigationEdit().getSeine().getTrip().getId(), getId());
    
    47
    +        return Objects.equals(getNavigationEditModel().getSeine().getTrip().getId(), getId());
    
    48 48
         }
    
    49 49
     
    
    50 50
         @Override
    

  • client-core/src/main/resources/icons/checkBox.png
    No preview for this file type
  • client-core/src/main/resources/icons/checkBoxIndeterminateSelected.png
    No preview for this file type
  • client-core/src/main/resources/icons/checkBoxSelected.png
    No preview for this file type
  • client-core/src/main/resources/observe-ui.properties
    ... ... @@ -65,6 +65,11 @@ icon.navigation.data.ll.observation.ActivityLonglineObs-16=navigation/ird/route1
    65 65
     icon.navigation.data.ll.observation.SetLonglineObs-16=navigation/ird/set16.png
    
    66 66
     icon.navigation.data.ll.observation.CatchLonglineObs-16=navigation/ird/floatingObject16.png
    
    67 67
     icon.navigation.data.ll.observation.TdrObs-16=navigation/ird/floatingObject16.png
    
    68
    +
    
    69
    +icon.checkbox.empty=checkBox.png
    
    70
    +icon.checkbox.partial=checkBoxIndeterminateSelected.png
    
    71
    +icon.checkbox.selected=checkBoxSelected.png
    
    72
    +
    
    68 73
     # icones d'action sur les editeurs numeriques
    
    69 74
     #icon.action.numbereditor-showpopup=action-numbereditor-showpopup.png
    
    70 75
     #icon.action.numbereditor-reset=action-numbereditor-reset.png