buildGroupURLMenu(sg, groupLinks);
}
// Add a 'show all structures' for the current selection
- Hashtable<String, PDBEntry> pdbe = new Hashtable<String, PDBEntry>(), reppdb = new Hashtable<String, PDBEntry>();
+ Hashtable<String, PDBEntry> pdbe = new Hashtable<>(), reppdb = new Hashtable<>();
SequenceI sqass = null;
for (SequenceI sq : ap.av.getSequenceSelection())
{
void addFeatureLinks(final SequenceI seq, List<String> links)
{
JMenu linkMenu = new JMenu(MessageManager.getString("action.link"));
- Map<String, List<String>> linkset = new LinkedHashMap<String, List<String>>();
+ Map<String, List<String>> linkset = new LinkedHashMap<>();
for (String link : links)
{
* the insertion order, which is the order of the annotations on the
* alignment.
*/
- Map<String, List<List<String>>> shownTypes = new LinkedHashMap<String, List<List<String>>>();
- Map<String, List<List<String>>> hiddenTypes = new LinkedHashMap<String, List<List<String>>>();
+ Map<String, List<List<String>>> shownTypes = new LinkedHashMap<>();
+ Map<String, List<List<String>>> hiddenTypes = new LinkedHashMap<>();
AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes,
AlignmentAnnotationUtils.asList(annotations), forSequences);
SequenceI[] seqs = ap.av.getSelectionAsNewSequence();
String[][] idandseqs = GroupUrlLink.formStrings(seqs);
- Hashtable<String, Object[]> commonDbrefs = new Hashtable<String, Object[]>();
+ Hashtable<String, Object[]> commonDbrefs = new Hashtable<>();
for (int sq = 0; sq < seqs.length; sq++)
{
* Temporary store to hold distinct calcId / type pairs for the tooltip.
* Using TreeMap means calcIds are shown in alphabetical order.
*/
- SortedMap<String, String> tipEntries = new TreeMap<String, String>();
- final Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<SequenceI, List<AlignmentAnnotation>>();
+ SortedMap<String, String> tipEntries = new TreeMap<>();
+ final Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<>();
AlignmentI al = this.ap.av.getAlignment();
AlignmentUtils.findAddableReferenceAnnotations(forSequences,
tipEntries, candidates, al);
protected void hideInsertions_actionPerformed(ActionEvent actionEvent)
{
+
HiddenColumns hidden = new HiddenColumns();
- BitSet inserts = new BitSet();
- inserts.set(0, ap.av.getAlignment().getWidth());
+ BitSet inserts = new BitSet(), mask = new BitSet();
+
+ // set mask to preserve existing hidden columns outside selected group
+ if (ap.av.hasHiddenColumns())
+ {
+ ap.av.getAlignment().getHiddenColumns().markHiddenRegions(mask);
+ }
boolean markedPopup = false;
// mark inserts in current selection
if (ap.av.getSelectionGroup() != null)
{
+ // mark just the columns in the selection group to be hidden
+ inserts.set(ap.av.getSelectionGroup().getStartRes(), ap.av
+ .getSelectionGroup().getEndRes() + 1);
+
+ // and clear that part of the mask
+ mask.andNot(inserts);
+
+ // now clear columns without gaps
for (SequenceI sq : ap.av.getSelectionGroup().getSequences())
{
if (sq == sequence)
inserts.and(sq.getInsertionsAsBits());
}
}
+ else
+ {
+ // initially, mark all columns to be hidden
+ inserts.set(0, ap.av.getAlignment().getWidth());
+
+ // and clear out old hidden regions completely
+ mask.clear();
+ }
// now mark for sequence under popup if we haven't already done it
if (!markedPopup && sequence != null)
inserts.and(sequence.getInsertionsAsBits());
}
- // finally, hide and set hidden columns
+ // finally, preserve hidden regions outside selection
+ inserts.or(mask);
+
+ // and set hidden columns accordingly
hidden.hideMarkedBits(inserts);
+
ap.av.getAlignment().setHiddenColumns(hidden);
refresh();
}
void refresh()
{
ap.updateAnnotation();
- ap.paintAlignment(true);
+ // removed paintAlignment(true) here:
+ // updateAnnotation calls paintAlignment already, so don't need to call
+ // again
PaintRefresher.Refresh(this, ap.av.getSequenceSetId());
}
return;
}
- List<SequenceI> seqs = new ArrayList<SequenceI>();
- List<SequenceFeature> features = new ArrayList<SequenceFeature>();
+ List<SequenceI> seqs = new ArrayList<>();
+ List<SequenceFeature> features = new ArrayList<>();
/*
* assemble dataset sequences, and template new sequence features,
}
}
- if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(seqs,
- features, true, ap))
+ /*
+ * an entirely gapped region will generate empty lists of sequence / features
+ */
+ if (!seqs.isEmpty())
{
- ap.alignFrame.setShowSeqFeatures(true);
- ap.highlightSearchResults(null);
+ if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(
+ seqs, features, true, ap))
+ {
+ ap.alignFrame.setShowSeqFeatures(true);
+ ap.highlightSearchResults(null);
+ }
}
}