(JAL-962) allow group visibility to be specified before features in those groups...
[jalview.git] / src / jalview / appletgui / FeatureSettings.java
index d664cad..ee0e23d 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -118,8 +118,10 @@ public class FeatureSettings extends Panel implements ItemListener,
 
     if (groupPanel != null)
     {
-      groupPanel.setLayout(new GridLayout(fr.featureGroups.size() / 4 + 1,
-              4));
+      groupPanel
+              .setLayout(new GridLayout(
+                      (fr.featureGroups.size() - fr.hiddenGroups.size()) / 4 + 1,
+                      4));
       groupPanel.validate();
 
       add(groupPanel, BorderLayout.NORTH);
@@ -261,7 +263,7 @@ public class FeatureSettings extends Panel implements ItemListener,
       rdrw = true;
       groupPanel.removeAll();
     }
-
+    // TODO: JAL-964 - smoothly incorporate new group entries if panel already displayed and new groups present
     Enumeration gps = fr.featureGroups.keys();
     while (gps.hasMoreElements())
     {
@@ -273,6 +275,7 @@ public class FeatureSettings extends Panel implements ItemListener,
       check.addMouseListener(this);
       check.setFont(new Font("Serif", Font.BOLD, 12));
       check.addItemListener(this);
+      check.setVisible(fr.hiddenGroups.contains(group));
       groupPanel.add(check);
     }
     if (rdrw)
@@ -445,8 +448,8 @@ public class FeatureSettings extends Panel implements ItemListener,
       Checkbox source = (Checkbox) evt.getSource();
       if (fr.featureGroups.containsKey(source.getLabel()))
       {
-        fr.featureGroups.put(source.getLabel(), new Boolean(source
-                .getState()));
+        fr.featureGroups.put(source.getLabel(),
+                new Boolean(source.getState()));
         ap.seqPanel.seqCanvas.repaint();
         if (ap.overviewPanel != null)
         {
@@ -608,8 +611,8 @@ public class FeatureSettings extends Panel implements ItemListener,
       {
         evt.consume();
         String link = fr.featureLinks.get(check.type).toString();
-        ap.alignFrame.showURL(link.substring(link.indexOf("|") + 1), link
-                .substring(0, link.indexOf("|")));
+        ap.alignFrame.showURL(link.substring(link.indexOf("|") + 1),
+                link.substring(0, link.indexOf("|")));
       }
     }