public boolean parseFeaturesFile(String file, String protocol,
boolean relaxedIdMatching);
+ /**
+ * mark columns containing highlighted regions (e.g. from search, structure
+ * highlight, or a mouse over event in another viewer)
+ *
+ * @param invert
+ * @param extendCurrent
+ * @param toggle
+ * @return
+ */
+ boolean markHighlightedColumns(boolean invert, boolean extendCurrent,
+ boolean toggle);
+
}
return featuresFile;
}
+
+ @Override
+ public boolean markHighlightedColumns(boolean invert,
+ boolean extendCurrent, boolean toggle)
+ {
+ if (!viewport.hasSearchResults())
+ {
+ // do nothing if no selection exists
+ return false;
+ }
+ // JBPNote this routine could also mark rows, not just columns.
+ BitSet bs = new BitSet();
+ SequenceCollectionI sqcol = (viewport.getSelectionGroup() == null || extendCurrent) ? viewport
+ .getAlignment() : viewport.getSelectionGroup();
+
+ // this could be a lambda... - the remains of the method is boilerplate,
+ // except for the different messages for reporting selection.
+ int nseq = viewport.getSearchResults().markColumns(sqcol, bs);
+
+ ColumnSelection cs = viewport.getColumnSelection();
+ if (cs == null)
+ {
+ cs = new ColumnSelection();
+ }
+
+ if (bs.cardinality() > 0 || invert)
+ {
+ boolean changed = cs.markColumns(bs, sqcol.getStartRes(),
+ sqcol.getEndRes(), invert, extendCurrent, toggle);
+ if (changed)
+ {
+ viewport.setColumnSelection(cs);
+ alignPanel.paintAlignment(true);
+ int columnCount = invert ? (sqcol.getEndRes() - sqcol.getStartRes() + 1)
+ - bs.cardinality()
+ : bs.cardinality();
+ avcg.setStatus(MessageManager.formatMessage(
+ "label.view_controller_toggled_marked",
+ new String[] {
+ toggle ? MessageManager.getString("label.toggled")
+ : MessageManager.getString("label.marked"),
+ String.valueOf(columnCount),
+ invert ? MessageManager
+ .getString("label.not_containing")
+ : MessageManager.getString("label.containing"),
+ "Highlight", Integer.valueOf(nseq).toString() }));
+ return true;
+ }
+ }
+ else
+ {
+ avcg.setStatus(MessageManager
+ .formatMessage("No highlighted regions marked"));
+ if (!extendCurrent)
+ {
+ cs.clear();
+ alignPanel.paintAlignment(true);
+ }
+ }
+ return false;
+ }
+
}