Merge branch 'develop' into features/JAL-3010ontologyFeatureSettings
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Sat, 20 Apr 2019 07:40:22 +0000 (08:40 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Sat, 20 Apr 2019 07:40:22 +0000 (08:40 +0100)
Conflicts:
src/jalview/controller/AlignViewController.java

1  2 
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/controller/AlignViewController.java
src/jalview/gui/FeatureSettings.java

Simple merge
Simple merge
@@@ -166,11 -166,12 +166,12 @@@ public class AlignViewController implem
      // JBPNote this routine could also mark rows, not just columns.
      // need a decent query structure to allow all types of feature searches
      BitSet bs = new BitSet();
-     SequenceCollectionI sqcol = (viewport.getSelectionGroup() == null
-             || extendCurrent) ? viewport.getAlignment()
-                     : viewport.getSelectionGroup();
+     boolean searchSelection = viewport.getSelectionGroup() != null
+             && !extendCurrent;
+     SequenceCollectionI sqcol = searchSelection ? viewport
+             .getSelectionGroup() : viewport.getAlignment();
  
 -    int nseq = findColumnsWithFeature(featureType, sqcol, bs);
 +    int nseq = findColumnsWithFeature(sqcol, bs, featureType);
  
      ColumnSelection cs = viewport.getColumnSelection();
      if (cs == null)
        cs = new ColumnSelection();
      }
  
-     String featureTypeString = featureType.length == 1 ? featureType[0]
-             : featureType.toString();
++    String featureTypeString = featureType[0];
++    if (featureType.length > 1)
++    {
++      /*
++       * ellipsis if multiple feature types selected
++       * (from Summary View in Feature Settings)
++       */
++      featureTypeString += "...";
++    }
 +
      if (bs.cardinality() > 0 || invert)
      {
        boolean changed = cs.markColumns(bs, sqcol.getStartRes(),
      }
      else
      {
-       avcg.setStatus(MessageManager
-               .formatMessage("label.no_feature_of_type_found", new String[]
+       String key = searchSelection ? "label.no_feature_found_selection"
+               : "label.no_feature_of_type_found";
 -      avcg.setStatus(MessageManager.formatMessage(key,
 -              new String[] { featureType }));
++      avcg.setStatus(
++              MessageManager.formatMessage(key, new String[]
 +              { featureTypeString }));
        if (!extendCurrent)
        {
          cs.clear();
@@@ -399,45 -314,92 +399,46 @@@ public class FeatureSettings extends JP
        public void mouseDragged(MouseEvent evt)
        {
          int newRow = table.rowAtPoint(evt.getPoint());
 -        if (newRow != selectedRow && selectedRow != -1 && newRow != -1)
 -        {
 -          /*
 -           * reposition 'selectedRow' to 'newRow' (the dragged to location)
 -           * this could be more than one row away for a very fast drag action
 -           * so just swap it with adjacent rows until we get it there
 -           */
 -          Object[][] data = ((FeatureTableModel) table.getModel())
 -                  .getData();
 -          int direction = newRow < selectedRow ? -1 : 1;
 -          for (int i = selectedRow; i != newRow; i += direction)
 -          {
 -            Object[] temp = data[i];
 -            data[i] = data[i + direction];
 -            data[i + direction] = temp;
 -          }
 -          updateFeatureRenderer(data);
 -          table.repaint();
 -          selectedRow = newRow;
 -        }
 +        dragRow(newRow);
        }
      });
 -    // table.setToolTipText(JvSwingUtils.wrapTooltip(true,
 -    // MessageManager.getString("label.feature_settings_click_drag")));
 -    scrollPane.setViewportView(table);
 +  }
  
 -    if (af.getViewport().isShowSequenceFeatures() || !fr.hasRenderOrder())
 +  /**
 +   * Answers an array consisting of the given type, and also (if 'Summary View'
-    * is selected), any child terms in the sequence ontology
++   * is selected), any feature types which are child terms of it in the Sequence
++   * Ontology
 +   * 
 +   * @param type
 +   * @return
 +   */
 +  protected String[] getTermsInScope(String type)
 +  {
 +    if (!summaryView.isSelected())
      {
 -      fr.findAllFeatures(true); // display everything!
 +      return new String[] { type };
      }
  
 -    discoverAllFeatureData();
 -    final PropertyChangeListener change;
 -    final FeatureSettings fs = this;
 -    fr.addPropertyChangeListener(change = new PropertyChangeListener()
 -    {
 -      @Override
 -      public void propertyChange(PropertyChangeEvent evt)
 -      {
 -        if (!fs.resettingTable && !fs.handlingUpdate)
 -        {
 -          fs.handlingUpdate = true;
 -          fs.resetTable(null);
 -          // new groups may be added with new sequence feature types only
 -          fs.handlingUpdate = false;
 -        }
 -      }
 +    List<String> terms = new ArrayList<>();
 +    terms.add(type);
  
 -    });
 +    OntologyI so = SequenceOntologyFactory.getInstance();
  
 -    frame = new JInternalFrame();
 -    frame.setContentPane(this);
 -    if (Platform.isAMac())
 -    {
 -      Desktop.addInternalFrame(frame,
 -              MessageManager.getString("label.sequence_feature_settings"),
 -              600, 480);
 -    }
 -    else
 +    Object[][] data = ((FeatureTableModel) table.getModel()).getData();
 +    for (Object[] row : data)
      {
 -      Desktop.addInternalFrame(frame,
 -              MessageManager.getString("label.sequence_feature_settings"),
 -              600, 450);
 +      String type2 = (String) row[TYPE_COLUMN];
 +      if (!type2.equals(type) && so.isA(type2, type))
 +      {
 +        terms.add(type2);
 +      }
      }
 -    frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
 -
 -    frame.addInternalFrameListener(
 -            new javax.swing.event.InternalFrameAdapter()
 -            {
 -              @Override
 -              public void internalFrameClosed(
 -                      javax.swing.event.InternalFrameEvent evt)
 -              {
 -                fr.removePropertyChangeListener(change);
 -              };
 -            });
 -    frame.setLayer(JLayeredPane.PALETTE_LAYER);
 -    inConstruction = false;
 +    return terms.toArray(new String[terms.size()]);
    }
  
 -  protected void popupSort(final int rowSelected, final String type,
 -          final Object typeCol, final Map<String, float[][]> minmax, int x,
 +  protected void popupMenu(final int rowSelected, final String type, int x,
            int y)
    {
 -    final FeatureColourI featureColour = (FeatureColourI) typeCol;
 -
      JPopupMenu men = new JPopupMenu(MessageManager
              .formatMessage("label.settings_for_param", new String[]
              { type }));