/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
import jalview.analysis.AlignmentSorter;
import jalview.api.AlignViewControllerGuiI;
import jalview.api.AlignViewControllerI;
+import jalview.api.AlignViewportI;
import jalview.api.FeatureRenderer;
import jalview.api.SequenceStructureBinding;
import jalview.bin.JalviewLite;
import jalview.schemes.ZappoColourScheme;
import jalview.structure.StructureSelectionManager;
import jalview.structures.models.AAStructureBindingModel;
+import jalview.util.MappingUtils;
import jalview.util.MessageManager;
import java.awt.BorderLayout;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Arrays;
+import java.util.Deque;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
Frame frame = new Frame();
frame.add(cap);
jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage(
- "label.alignment_output_command", new String[]
+ "label.alignment_output_command", new Object[]
{ e.getActionCommand() }), 600, 500);
cap.setText(new AppletFormatAdapter().formatSequences(
e.getActionCommand(), viewport.getAlignment(),
{
StringBuffer url = new StringBuffer(jalviewServletURL);
- url.append("?open="
+ // allow servlet parameters to be passed in applet parameter
+ String firstSep = url.lastIndexOf("?") > url.lastIndexOf("/") ? "&"
+ : "?";
+ url.append(firstSep);
+
+ url.append("open="
+ appendProtocol(viewport.applet.getParameter("file")));
if (viewport.applet.getParameter("features") != null)
void updateEditMenuBar()
{
- if (viewport.historyList.size() > 0)
+ if (viewport.getHistoryList().size() > 0)
{
undoMenuItem.setEnabled(true);
- CommandI command = (CommandI) viewport.historyList.peek();
+ CommandI command = viewport.getHistoryList().peek();
undoMenuItem.setLabel(MessageManager.formatMessage(
- "label.undo_command", new String[]
+ "label.undo_command", new Object[]
{ command.getDescription() }));
}
else
undoMenuItem.setLabel(MessageManager.getString("action.undo"));
}
- if (viewport.redoList.size() > 0)
+ if (viewport.getRedoList().size() > 0)
{
redoMenuItem.setEnabled(true);
- CommandI command = (CommandI) viewport.redoList.peek();
+ CommandI command = viewport.getRedoList().peek();
redoMenuItem.setLabel(MessageManager.formatMessage(
- "label.redo_command", new String[]
+ "label.redo_command", new Object[]
{ command.getDescription() }));
}
else
{
if (command.getSize() > 0)
{
- viewport.historyList.push(command);
- viewport.redoList.removeAllElements();
+ viewport.addToHistoryList(command);
+ viewport.clearRedoList();
updateEditMenuBar();
viewport.updateHiddenColumns();
}
*/
protected void undoMenuItem_actionPerformed()
{
- if (viewport.historyList.size() < 1)
+ if (viewport.getHistoryList().isEmpty())
{
return;
}
- CommandI command = (CommandI) viewport.historyList.pop();
- viewport.redoList.push(command);
+ CommandI command = viewport.getHistoryList().pop();
+ viewport.addToRedoList(command);
command.undoCommand(null);
AlignViewport originalSource = getOriginatingSource(command);
*/
protected void redoMenuItem_actionPerformed()
{
- if (viewport.redoList.size() < 1)
+ if (viewport.getRedoList().isEmpty())
{
return;
}
- CommandI command = (CommandI) viewport.redoList.pop();
- viewport.historyList.push(command);
+ CommandI command = viewport.getRedoList().pop();
+ viewport.addToHistoryList(command);
command.doCommand(null);
AlignViewport originalSource = getOriginatingSource(command);
return originalSource;
}
+ /**
+ * Move the currently selected sequences up or down one position in the
+ * alignment
+ *
+ * @param up
+ */
public void moveSelectedSequences(boolean up)
{
SequenceGroup sg = viewport.getSelectionGroup();
viewport.getAlignment().moveSelectedSequencesByOne(sg,
up ? null : viewport.getHiddenRepSequences(), up);
alignPanel.paintAlignment(true);
+
+ /*
+ * Also move cDNA/protein complement sequences
+ */
+ AlignViewportI complement = viewport.getCodingComplement();
+ if (complement != null)
+ {
+ SequenceGroup mappedSelection = MappingUtils.mapSequenceGroup(sg,
+ viewport, complement);
+ complement.getAlignment().moveSelectedSequencesByOne(mappedSelection,
+ up ? null : complement.getHiddenRepSequences(), up);
+ // TODO need to trigger a repaint of the complementary panel - how?
+ // would prefer to handle in SplitFrame but it is not overriding key
+ // listener chiz
+ }
}
synchronized void slideSequences(boolean right, int size)
}
boolean appendHistoryItem = false;
- if (viewport.historyList != null && viewport.historyList.size() > 0
- && viewport.historyList.peek() instanceof SlideSequencesCommand)
+ Deque<CommandI> historyList = viewport.getHistoryList();
+ if (historyList != null && historyList.size() > 0
+ && historyList.peek() instanceof SlideSequencesCommand)
{
appendHistoryItem = ssc
- .appendSlideCommand((SlideSequencesCommand) viewport.historyList
+ .appendSlideCommand((SlideSequencesCommand) historyList
.peek());
}
newaf.setTitle(title.toString());
- newaf.viewport.historyList = viewport.historyList;
- newaf.viewport.redoList = viewport.redoList;
+ newaf.viewport.setHistoryList(viewport.getHistoryList());
+ newaf.viewport.setRedoList(viewport.getRedoList());
return newaf;
}
// view cannot be closed if its actually on the page
fileMenu.remove(closeMenuItem);
fileMenu.remove(3); // Remove Separator
- embeddedMenu = makeEmbeddedPopupMenu(alignFrameMenuBar,
- FONT_ARIAL_PLAIN_11, false, false); // use our own fonts.
+ // construct embedded menu, using default font
+ embeddedMenu = makeEmbeddedPopupMenu(alignFrameMenuBar, false, false);
// and actually add the components to the applet area
theApplet.setLayout(new BorderLayout());
theApplet.add(embeddedMenu, BorderLayout.NORTH);