import jalview.analysis.AlignmentSorter;
import jalview.analysis.Conservation;
+import jalview.api.AlignViewControllerI;
import jalview.api.SequenceStructureBinding;
import jalview.bin.JalviewLite;
import jalview.commands.CommandI;
public class AlignFrame extends EmbmenuFrame implements ActionListener,
ItemListener, KeyListener
{
+ public AlignViewControllerI avc;
public AlignmentPanel alignPanel;
public AlignViewport viewport;
viewport = new AlignViewport(al, applet);
alignPanel = new AlignmentPanel(this, viewport);
-
+ avc = new jalview.controller.AlignViewController(viewport, alignPanel);
viewport.updateConservation(alignPanel);
viewport.updateConsensus(alignPanel);
protected void makeGrpsFromSelection_actionPerformed()
{
- if (viewport.getSelectionGroup() != null)
- {
- SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
- viewport.getSequenceSelection(),
- viewport.getAlignmentView(true).getSequenceStrings(
- viewport.getGapCharacter()), viewport.getAlignment()
- .getGroups());
- viewport.getAlignment().deleteAllGroups();
- viewport.sequenceColours = null;
- viewport.setSelectionGroup(null);
- // set view properties for each group
- for (int g = 0; g < gps.length; g++)
- {
- // gps[g].setShowunconserved(viewport.getShowUnconserved());
- gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
- viewport.getAlignment().addGroup(gps[g]);
- Color col = new Color((int) (Math.random() * 255),
- (int) (Math.random() * 255), (int) (Math.random() * 255));
- col = col.brighter();
- for (SequenceI sq : gps[g].getSequences(null))
- viewport.setSequenceColour(sq, col);
- }
+ if (avc.makeGroupsFromSelection()) {
PaintRefresher.Refresh(this, viewport.getSequenceSetId());
alignPanel.updateAnnotation();
alignPanel.paintAlignment(true);
protected void deleteGroups_actionPerformed()
{
- viewport.getAlignment().deleteAllGroups();
- viewport.sequenceColours = null;
- viewport.setSelectionGroup(null);
-
- alignPanel.paintAlignment(true);
+ if (avc.deleteGroups())
+ {
+ alignPanel.alignmentChanged();
+ }
}
public void selectAllSequenceMenuItem_actionPerformed()
import jalview.analysis.NJTree;
import jalview.analysis.ParseProperties;
import jalview.analysis.SequenceIdMatcher;
+import jalview.api.AlignViewControllerI;
import jalview.bin.Cache;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
public AlignmentPanel alignPanel;
AlignViewport viewport;
+
+ public AlignViewControllerI avc;
+
Vector alignPanels = new Vector();
*/
void init()
{
+ avc = new jalview.controller.AlignViewController(viewport, alignPanel);
if (viewport.getAlignmentConservationAnnotation() == null)
{
BLOSUM62Colour.setEnabled(false);
}
addKeyListener();
-
+
}
/**
public void addAlignmentPanel(final AlignmentPanel ap, boolean newPanel)
{
ap.alignFrame = this;
+ avc = new jalview.controller.AlignViewController(viewport, alignPanel);
alignPanels.addElement(ap);
rnahelicesColour
.setSelected(av.getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
setShowProductsEnabled();
-
updateEditMenuBar();
}
@Override
protected void deleteGroups_actionPerformed(ActionEvent e)
{
- viewport.getAlignment().deleteAllGroups();
- viewport.sequenceColours = null;
- viewport.setSelectionGroup(null);
- PaintRefresher.Refresh(this, viewport.getSequenceSetId());
- alignPanel.updateAnnotation();
- alignPanel.paintAlignment(true);
+ if (avc.deleteGroups()) {
+ PaintRefresher.Refresh(this, viewport.getSequenceSetId());
+ alignPanel.updateAnnotation();
+ alignPanel.paintAlignment(true);
+ }
}
/**
{
alignPanel = (AlignmentPanel) alignPanels.elementAt(index);
viewport = alignPanel.av;
+ avc.setViewportAndAlignmentPanel(viewport, alignPanel);
setMenusFromViewport(viewport);
}
}
@Override
protected void makeGrpsFromSelection_actionPerformed(ActionEvent e)
{
- if (viewport.getSelectionGroup() != null)
- {
- SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
- viewport.getSequenceSelection(),
- viewport.getAlignmentView(true).getSequenceStrings(
- viewport.getGapCharacter()), viewport.getAlignment()
- .getGroups());
- viewport.getAlignment().deleteAllGroups();
- viewport.sequenceColours = null;
- viewport.setSelectionGroup(null);
- // set view properties for each group
- for (int g = 0; g < gps.length; g++)
- {
- gps[g].setShowNonconserved(viewport.getShowUnconserved());
- gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
- viewport.getAlignment().addGroup(gps[g]);
- Color col = new Color((int) (Math.random() * 255),
- (int) (Math.random() * 255), (int) (Math.random() * 255));
- col = col.brighter();
- for (SequenceI s : gps[g].getSequences())
- viewport.setSequenceColour(s, col);
- }
+ if (avc.makeGroupsFromSelection()) {
PaintRefresher.Refresh(this, viewport.getSequenceSetId());
alignPanel.updateAnnotation();
alignPanel.paintAlignment(true);