ColumnSelection moved to datamodel
authoramwaterhouse <Andrew Waterhouse>
Tue, 25 Jul 2006 15:51:25 +0000 (15:51 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 25 Jul 2006 15:51:25 +0000 (15:51 +0000)
src/jalview/appletgui/ScalePanel.java
src/jalview/datamodel/HiddenSequences.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/IdCanvas.java
src/jalview/gui/ScalePanel.java

index f8706ae..8688486 100755 (executable)
@@ -71,6 +71,7 @@ public class ScalePanel
     int res = x / av.getCharWidth() + av.getStartRes();\r
     SequenceGroup sg = null;\r
 \r
+\r
     if (av.getColumnSelection().contains(res))\r
     {\r
       av.getColumnSelection().removeElement(res);\r
index ca52083..36c6498 100755 (executable)
@@ -36,6 +36,19 @@ public class HiddenSequences
     return hiddenSequences == null ? 0 : hiddenSequences.size();\r
   }\r
 \r
+  public int getWidth()\r
+  {\r
+    Enumeration en = hiddenSequences.elements();\r
+    int width = 0;\r
+    while(en.hasMoreElements())\r
+    {\r
+      SequenceI seq = (SequenceI)en.nextElement();\r
+      if(seq.getLength()>width)\r
+        width = seq.getLength();\r
+    }\r
+    return width;\r
+  }\r
+\r
   public void hideSequence(SequenceI sequence)\r
   {\r
     if(hiddenSequences==null)\r
index a52481d..f7fc105 100755 (executable)
@@ -1415,7 +1415,7 @@ public class AlignFrame
 \r
   public void showAllColumns_actionPerformed(ActionEvent e)\r
   {\r
-    viewport.getColumnSelection().revealAllHiddenColumns(viewport);\r
+    viewport.showAllHiddenColumns();\r
   }\r
 \r
   public void hideSelSequences_actionPerformed(ActionEvent e)\r
index 3742259..1970181 100755 (executable)
@@ -1123,12 +1123,12 @@ public class AlignViewport
 \r
     public void hideSelectedColumns()\r
     {\r
-      if (colSel.selected.size() < 1)\r
+      if (colSel.size() < 1)\r
         return;\r
 \r
-      while (colSel.selected.size() > 0)\r
+      while (colSel.size() > 0)\r
       {\r
-        int column = ( (Integer) colSel.selected.firstElement()).intValue();\r
+        int column = ( (Integer) colSel.getSelected().firstElement()).intValue();\r
         colSel.hideColumns(column);\r
       }\r
       setSelectionGroup(null);\r
@@ -1168,6 +1168,19 @@ public class AlignViewport
         hasHiddenRows = false;\r
     }\r
 \r
+    public void showColumn(int col)\r
+    {\r
+      colSel.revealHiddenColumns(col);\r
+      if(colSel.size()<1)\r
+        hasHiddenColumns = false;\r
+    }\r
+\r
+    public void showAllHiddenColumns()\r
+    {\r
+      colSel.revealAllHiddenColumns();\r
+      hasHiddenColumns = false;\r
+    }\r
+\r
     public void showAllHiddenSeqs()\r
     {\r
       if(alignment.getHiddenSequences().getSize()>0)\r
index d35a0f4..7734f9a 100755 (executable)
@@ -187,9 +187,9 @@ public class IdCanvas extends JPanel
         {\r
           image = new BufferedImage(getWidth(), imgHeight,\r
                                     BufferedImage.TYPE_INT_RGB);\r
-          gg = (Graphics2D) image.getGraphics();\r
         }\r
 \r
+        gg = (Graphics2D) image.getGraphics();\r
         //Fill in the background\r
         gg.setColor(Color.white);\r
         gg.fillRect(0, 0, getWidth(), imgHeight);\r
index 29e338c..3a19916 100755 (executable)
@@ -81,7 +81,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList
             {\r
               public void actionPerformed(ActionEvent e)\r
               {\r
-                av.getColumnSelection().revealHiddenColumns(reveal[0], av);\r
+                av.showColumn(reveal[0]);\r
                 reveal = null;\r
                 ap.repaint();\r
                 if(ap.overviewPanel != null)\r
@@ -90,14 +90,14 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList
             });\r
             pop.add(item);\r
 \r
-            if(av.getColumnSelection().hiddenColumns.size()>1)\r
+            if(av.getColumnSelection().size()>1)\r
             {\r
               item = new JMenuItem("Reveal All");\r
               item.addActionListener(new ActionListener()\r
               {\r
                 public void actionPerformed(ActionEvent e)\r
                 {\r
-                  av.getColumnSelection().revealAllHiddenColumns(av);\r
+                  av.showAllHiddenColumns();\r
                   reveal = null;\r
                   ap.repaint();\r
                   if(ap.overviewPanel != null)\r