From: amwaterhouse Date: Wed, 16 Aug 2006 08:05:35 +0000 (+0000) Subject: Fire alignment changed if seqs hidden / revealed X-Git-Tag: Release_2_1~50 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6bfaf3d3a82e4eece77dc1c2d83aede7c4dbb690;p=jalview.git Fire alignment changed if seqs hidden / revealed --- diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 449b83a..afa6c7e 100755 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -226,7 +226,6 @@ public class APopupMenu else if(source == revealAll) { ap.av.showAllHiddenSeqs(); - ap.repaint(); } else if(source==copy) @@ -619,8 +618,6 @@ public class APopupMenu } ap.av.setSelectionGroup(null); - ap.repaint(); - refresh(); } } diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 08cbb9a..64423b0 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -332,21 +332,20 @@ public class AlignFrame extends Frame implements ActionListener, case KeyEvent.VK_H: { SequenceGroup sg = viewport.getSelectionGroup(); + boolean hide = false; if (sg != null && sg.getSize(false) != viewport.alignment.getHeight()) { - hideSelectedSeqs(); + hide = true; + viewport.hideAllSelectedSeqs(); } - else + else if (viewport.colSel.getSelected().size() < 1) viewport.showAllHiddenSeqs(); if (viewport.colSel.getSelected().size() > 0) - { viewport.hideSelectedColumns(); - } - else - { - viewport.showAllHiddenColumns(); - } + else if (!hide) + viewport.showAllHiddenColumns(); + alignPanel.repaint(); break; } @@ -458,7 +457,7 @@ public void itemStateChanged(ItemEvent evt) } else if(source==showSeqs) { - viewport.showAllHiddenSeqs(); alignPanel.repaint(); + viewport.showAllHiddenSeqs(); } else if(source == hideColumns) { @@ -466,7 +465,7 @@ public void itemStateChanged(ItemEvent evt) } else if(source == hideSequences && viewport.getSelectionGroup()!=null) { - hideSelectedSeqs(); + viewport.hideAllSelectedSeqs(); } else if(source==featureSettings) featureSettings_actionPerformed(); @@ -1272,19 +1271,6 @@ public void itemStateChanged(ItemEvent evt) alignPanel.repaint(); } - void hideSelectedSeqs() - { - SequenceI[] seqs = viewport.getSelectionGroup().getSequencesInOrder( - viewport.alignment - ); - - for (int i = 0; i < seqs.length; i++) - { - viewport.hideSequence(seqs[i]); - } - - alignPanel.repaint(); - } protected void scaleAbove_actionPerformed() { diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 7c46cd9..3944b89 100755 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -770,29 +770,24 @@ public class AlignViewport { alignment.getHiddenSequences().hideSequence(seq); hasHiddenRows = true; + firePropertyChange("alignment", null, alignment.getSequences()); } } - public void showSequence(int index) + public void hideAllSelectedSeqs() { - Vector tmp = alignment.getHiddenSequences().showSequence(index); - if (tmp.size() > 0) - { - if (selectionGroup == null) - { - selectionGroup = new SequenceGroup(); - selectionGroup.setEndRes(alignment.getWidth() - 1); - } + if (selectionGroup == null) + return; - for (int t = 0; t < tmp.size(); t++) - { - selectionGroup.addSequence( - (SequenceI) tmp.elementAt(t), false - ); - } + SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment); + + for (int i = 0; i < seqs.length; i++) + { + alignment.getHiddenSequences().hideSequence(seqs[i]); } - if (alignment.getHiddenSequences().getSize() < 1) - hasHiddenRows = false; + firePropertyChange("alignment", null, alignment.getSequences()); + hasHiddenRows = true; + setSelectionGroup(null); } public void showColumn(int col) @@ -824,8 +819,9 @@ public class AlignViewport (SequenceI)tmp.elementAt(t), false ); } + firePropertyChange("alignment", null, alignment.getSequences()); hasHiddenRows = false; - } + } } public int adjustForHiddenSeqs(int alignmentIndex) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 2b15ed9..7ec1f26 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1284,12 +1284,16 @@ public class AlignFrame viewport.updateConsensus(); viewport.updateConservation(); } + resetAllColourSchemes(); if(alignPanel.overviewPanel!=null) alignPanel.overviewPanel.updateOverviewImage(); viewport.alignment.adjustSequenceAnnotations(); + if(alignPanel.overviewPanel!=null) + alignPanel.overviewPanel.updateOverviewImage(); + alignPanel.repaint(); } @@ -1423,31 +1427,17 @@ public class AlignFrame public void showAllSeqs_actionPerformed(ActionEvent e) { viewport.showAllHiddenSeqs(); - repaint(); } public void showAllColumns_actionPerformed(ActionEvent e) { viewport.showAllHiddenColumns(); + repaint(); } public void hideSelSequences_actionPerformed(ActionEvent e) { - if(viewport.getSelectionGroup()==null) - return; - - SequenceI [] seqs = viewport.getSelectionGroup().getSequencesInOrder( - viewport.alignment - ); - - for(int i=0; i0) alignFrame.hideSelColumns_actionPerformed(null); - else + else if(!hide) alignFrame.showAllColumns_actionPerformed(null); break; diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index e89eb28..4be63e4 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -206,7 +206,6 @@ public class PopupMenu extends JPopupMenu public void actionPerformed(ActionEvent e) { ap.av.showSequence(index); - ap.repaint(); if (ap.overviewPanel != null) ap.overviewPanel.updateOverviewImage(); } @@ -220,10 +219,9 @@ public class PopupMenu extends JPopupMenu public void actionPerformed(ActionEvent e) { ap.av.showAllHiddenSeqs(); - ap.repaint(); if (ap.overviewPanel != null) ap.overviewPanel.updateOverviewImage(); - } + } }); add(menuItem); @@ -1148,8 +1146,6 @@ public class PopupMenu extends JPopupMenu } ap.av.setSelectionGroup(null); - ap.repaint(); - refresh(); } public void copy_actionPerformed(ActionEvent e)