X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=e574450b23297e947ebe9ee016b3ced2b20651f8;hb=d587f1aa61946dc14f6f089cf1dc2a3116cfb773;hp=3adc7259afa11e219bd2fca04cd48281ca9bacbd;hpb=ecf2b981352e4d5d798e39e8c4597757cd629514;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 3adc725..e574450 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -64,7 +64,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener String fileName = null; - private int treeCount = 0; /** * Creates a new AlignFrame object. @@ -619,7 +618,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener public void save_actionPerformed(ActionEvent e) { - if(fileName==null || currentFileFormat==null) + if(fileName==null + || currentFileFormat==null + || fileName.startsWith("http") + ) saveAs_actionPerformed(null); else saveAlignment(fileName, currentFileFormat); @@ -975,10 +977,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener command.undoCommand(); AlignViewport originalSource = getOriginatingSource(command); - - originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null; updateEditMenuBar(); - originalSource.firePropertyChange("alignment", null,viewport.getAlignment().getSequences()); + + if(originalSource!=null) + { + originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null; + originalSource.firePropertyChange("alignment", null,null); + } } /** @@ -988,29 +993,37 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener */ protected void redoMenuItem_actionPerformed(ActionEvent e) { + if(viewport.redoList.size()<1) + return; + CommandI command = (CommandI) viewport.redoList.pop(); viewport.historyList.push(command); command.doCommand(); AlignViewport originalSource = getOriginatingSource(command); - originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns()!=null; - updateEditMenuBar(); - originalSource.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); + + if(originalSource!=null) + { + originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null; + originalSource.firePropertyChange("alignment", null,null); + } } AlignViewport getOriginatingSource(CommandI command) { - AlignViewport originalSource = viewport; + AlignViewport originalSource = null; //For sequence removal and addition, we need to fire //the property change event FROM the viewport where the //original alignment was altered + AlignmentI al=null; if (command instanceof EditCommand) { EditCommand editCommand = (EditCommand) command; - AlignmentI al = editCommand.getAlignment(); + al = editCommand.getAlignment(); Vector comps = (Vector) PaintRefresher.components .get(viewport.getSequenceSetId()); + for (int i = 0; i < comps.size(); i++) { if (comps.elementAt(i) instanceof AlignmentPanel) @@ -1023,6 +1036,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener } } } + + if (originalSource == null) + { + //The original view is closed, we must validate + //the current view against the closed view first + if (al != null) + PaintRefresher.validateSequences(al, viewport.alignment); + + originalSource = viewport; + } + return originalSource; } @@ -1456,7 +1480,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener protected void deleteGroups_actionPerformed(ActionEvent e) { viewport.alignment.deleteAllGroups(); - viewport.sequenceColours.clear(); + viewport.sequenceColours = null; viewport.setSelectionGroup(null); PaintRefresher.Refresh(this, viewport.getSequenceSetId()); alignPanel.repaint(); @@ -2516,7 +2540,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener return; } - new PCAPanel(viewport); + new PCAPanel(alignPanel); } @@ -2636,9 +2660,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener tp = new TreePanel(alignPanel, type, pwType); } - addTreeMenuItem(tp, title); + title += " from "; + + if(viewport.viewName!=null) + title+= viewport.viewName+" of "; - Desktop.addInternalFrame(tp, title + " from " + this.title, 600, 500); + title += this.title; + + Desktop.addInternalFrame(tp, title, 600, 500); } /** @@ -2676,51 +2705,53 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener * @param treePanel Displayed tree window. * @param title SortBy menu item title. */ - void addTreeMenuItem(final TreePanel treePanel, String title) + public void buildTreeMenu() { - final JMenuItem item = new JMenuItem(title); - - treeCount++; - - if (treeCount == 1) - { - sort.add(sortByTreeMenu); - } + sortByTreeMenu.removeAll(); - sortByTreeMenu.add(item); - item.addActionListener(new java.awt.event.ActionListener() + Vector comps = (Vector)PaintRefresher.components.get(viewport.getSequenceSetId()); + Vector treePanels = new Vector(); + int i, iSize = comps.size(); + for(i=0; i