boolean markHighlightedColumns(boolean invert, boolean extendCurrent,
boolean toggle);
- boolean justify_Region(boolean left);
+ /**
+ * copies each distinct highlighted region on the current view as a new
+ * sequence on the clipboard
+ *
+ * @return
+ */
+ boolean copyHighlightedRegionsToClipboard();
++ /**
++ * Justify alignment or currently selected region left or right
++ * @param left - true - means justify left
++ * @return
++ */
++ boolean justify_Region(boolean left);
}
* @return
*/
Iterator<int[]> getViewAsVisibleContigs(boolean selectedRegionOnly);
-
+ /**
+ * notify all concerned that the alignment data has changed and derived data
+ * needs to be recalculated
+ */
+ public void notifyAlignmentChanged();
+
++ /**
++ * retrieve a matrix associated with the view's alignment's annotation
++ * @param alignmentAnnotation
++ * @return contact matrix or NULL
++ */
+ ContactMatrixI getContactMatrix(AlignmentAnnotation alignmentAnnotation);
}
}
@Override
+ public boolean copyHighlightedRegionsToClipboard()
+ {
+ if (!viewport.hasSearchResults())
+ {
+ // do nothing if no selection exists
+ return false;
+ }
+
+ SearchResultsI searchResults = viewport.getSearchResults();
+ if (searchResults.isEmpty())
+ {
+ return false; // shouldn't happen
+ }
+ List<SequenceI> seqs = searchResults.getMatchingSubSequences();
+
+ // TODO: pass in hiddenColumns according to intersection of searchResults
+ // and visible columns. Currently this isn't done, since each contig becomes
+ // a single subsequence
+ Desktop.jalviewClipboard = new Object[] {
+ seqs.toArray(new SequenceI[0]),
+ alignPanel.getAlignment().getDataset(), null };
+ avcg.setStatus(MessageManager.formatMessage(
+ "label.copied_sequences_to_clipboard", seqs.size()));
+ // Technically we should return false, since view has not changed
+ return false;
+ }
++
++ @Override
+ public boolean justify_Region(boolean left)
+ {
+ AlignmentI al = viewport.getAlignment();
+ SequenceGroup reg = viewport.getSelectionGroup();
+ int from, to;
+ List<SequenceI> seqs;
+
+ from = 0;
+ to = al.getWidth() - 1;
+ seqs = al.getSequences();
+ if (reg != null)
+ {
+ seqs = reg.getSequences();
+ from = reg.getStartRes();
+ to = reg.getEndRes();
+ }
+
+ if ((to - from) < 1)
+ {
+ return false;
+ }
+
+ al.padGaps();
+ jalview.commands.JustifyLeftOrRightCommand finalEdit = new jalview.commands.JustifyLeftOrRightCommand(
+ "Justify " + (left ? "Left" : "Right"), left, seqs, from, to,
+ al);
+ avcg.addHistoryItem(finalEdit);
+ viewport.notifyAlignmentChanged();
+ return true;
+ }
}