JAL-715 - conditional to hide the RSBS service editing pane until system fully implem...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 30 Aug 2011 13:03:11 +0000 (14:03 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 30 Aug 2011 13:03:11 +0000 (14:03 +0100)
src/jalview/jbgui/GWsPreferences.java

index da9322c..3ca169b 100644 (file)
@@ -35,6 +35,7 @@ import javax.swing.JList;
 import javax.swing.JPanel;
 import javax.swing.JProgressBar;
 import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
 import javax.swing.ListSelectionModel;
 import javax.swing.SwingConstants;
 import javax.swing.border.TitledBorder;
@@ -46,6 +47,17 @@ import javax.swing.border.TitledBorder;
  */
 public class GWsPreferences extends JPanel
 {
+  protected JList sbrsList = new JList();
+
+  protected TitledBorder sbrsListTitleBorder = new TitledBorder(
+          "Simple Bioinformatics Rest Services");
+
+  protected JButton newSbrsUrl = new JButton();
+
+  protected JButton editSbrsUrl = new JButton();
+
+  protected JButton deleteSbrsUrl = new JButton();
+
   protected JList wsList = new JList();
 
   protected TitledBorder wsListTitleBorder = new TitledBorder(
@@ -89,14 +101,28 @@ public class GWsPreferences extends JPanel
 
   JPanel wsListNavButs = new JPanel();
 
+  JScrollPane srbsListPane = new JScrollPane();
+
+  JPanel srbsListUrlPanel = new JPanel();
+
+  JPanel srbsListPanel = new JPanel();
+
+  JPanel srbsListButtons = new JPanel();
+
+  JPanel srbsListNavButs = new JPanel();
+
   BorderLayout myBorderlayout = new BorderLayout();
 
   BorderLayout wsListBorderlayout = new BorderLayout();
+  
+  BorderLayout srbsListBorderlayout = new BorderLayout();
 
   GridBagLayout wsPrefLayout = new GridBagLayout();
 
   GridBagLayout wsListLayout = new GridBagLayout();
 
+  GridBagLayout srbsListLayout = new GridBagLayout();
+
   GridBagLayout wsMenuLayout = new GridBagLayout();
 
   JPanel wsMenuButtons = new JPanel();
@@ -239,6 +265,34 @@ public class GWsPreferences extends JPanel
         moveWsUrlDown_actionPerformed(e);
       }
     });
+    newSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+    newSbrsUrl.setText("Add a SBRS definition");
+    newSbrsUrl.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        newSbrsUrl_actionPerformed(e);
+      }
+    });
+    editSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+    editSbrsUrl.setText("Edit SBRS definition");
+    editSbrsUrl.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        editSbrsUrl_actionPerformed(e);
+      }
+    });
+
+    deleteSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+    deleteSbrsUrl.setText("Delete SBRS definition");
+    deleteSbrsUrl.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        deleteSbrsUrl_actionPerformed(e);
+      }
+    });
 
     setLayout(myBorderlayout);
     setPreferredSize(new Dimension(500, 400));
@@ -249,7 +303,7 @@ public class GWsPreferences extends JPanel
     // wsListUrlPanel.setPreferredSize(new Dimension(482,202));
     wsListPane.setBorder(BorderFactory.createEtchedBorder());
     wsListPane.getViewport().add(wsList);
-    wsListPane.setPreferredSize(new Dimension(380, 200));
+    // wsListPane.setPreferredSize(new Dimension(380, 80));
     wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
     wsList.addMouseListener(new MouseListener()
     {
@@ -295,12 +349,61 @@ public class GWsPreferences extends JPanel
     wsListNavButs.setLayout(new FlowLayout());
     wsListNavButs.add(moveWsUrlUp);
     wsListNavButs.add(moveWsUrlDown);
-    wsListUrlPanel.add(wsListPane, BorderLayout.EAST);
+    wsListUrlPanel.add(wsListPane, BorderLayout.CENTER);
     wsListUrlPanel.add(wsListNavButs, BorderLayout.WEST);
     wsListPanel.setBorder(wsListTitleBorder);
     wsListPanel.setLayout(new BorderLayout());
     wsListPanel.add(wsListUrlPanel, BorderLayout.NORTH);
     wsListPanel.add(wsListButtons, BorderLayout.SOUTH);
+
+    srbsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
+    srbsListUrlPanel.setLayout(new BorderLayout());
+    srbsListPane.setBorder(BorderFactory.createEtchedBorder());
+    srbsListPane.getViewport().add(sbrsList);
+    //srbsListPane.setMinimumSize(new Dimension(380, 80));
+    sbrsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+    sbrsList.addMouseListener(new MouseListener()
+    {
+
+      public void mouseClicked(MouseEvent e)
+      {
+        if (e.getClickCount() > 1)
+        {
+          editSbrsUrl_actionPerformed(null);
+        }
+
+      }
+
+      public void mouseEntered(MouseEvent e)
+      {
+
+      }
+
+      public void mouseExited(MouseEvent e)
+      {
+      }
+
+      public void mousePressed(MouseEvent e)
+      {
+
+      }
+
+      public void mouseReleased(MouseEvent e)
+      {
+
+      }
+
+    });
+    srbsListButtons.setLayout(new FlowLayout());
+    srbsListButtons.add(newSbrsUrl);
+    srbsListButtons.add(editSbrsUrl);
+    srbsListButtons.add(deleteSbrsUrl);
+    srbsListUrlPanel.add(srbsListPane, BorderLayout.CENTER);
+    srbsListPanel.setBorder(sbrsListTitleBorder);
+    srbsListPanel.setLayout(new BorderLayout());
+    srbsListPanel.add(srbsListUrlPanel, BorderLayout.NORTH);
+    srbsListPanel.add(srbsListButtons, BorderLayout.CENTER);
+
     wsMenuButtons.setLayout(new GridLayout(2, 3));
     wsMenuButtons.add(indexByHost);
     wsMenuButtons.add(indexByType);
@@ -315,11 +418,36 @@ public class GWsPreferences extends JPanel
     wsMenuRefreshButs.add(resetWs, null);
     wsMenuRefreshButs.add(progressBar, null);
     myBorderlayout.setHgap(3);
-    add(wsListPanel, BorderLayout.NORTH);
+    if (false) {
+       JTabbedPane listPanels=new JTabbedPane();
+       listPanels.addTab("JABAWS Servers",wsListPanel);
+       listPanels.addTab("RSB Services", srbsListPanel);
+       add(listPanels,  BorderLayout.NORTH);
+    } else {
+       add(wsListPanel, BorderLayout.NORTH);
+    }
     add(wsMenuButtons, BorderLayout.CENTER);
     add(wsMenuRefreshButs, BorderLayout.SOUTH);
   }
 
+  protected void deleteSbrsUrl_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
+  protected void editSbrsUrl_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
+  protected void newSbrsUrl_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
   protected void displayWsWarning_actionPerformed(ActionEvent e)
   {
     // TODO Auto-generated method stub