[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Wed Jul 11 15:06:57 UTC 2007


gordonp
Wed Jul 11 11:06:57 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv5425/src/main/ca/ucalgary/seahawk/gui

Modified Files:
	SeahawkOptionsGUI.java 
Log Message:
Improvements to UI layout implemented by dmitry.repchevski at bsc.es
moby-live/Java/src/main/ca/ucalgary/seahawk/gui SeahawkOptionsGUI.java,1.4,1.5
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java	2007/06/16 00:32:56	1.4
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java	2007/07/11 15:06:57	1.5
@@ -48,135 +48,151 @@
      * @param owner the frame that launches this dialog
      */
     public SeahawkOptionsGUI(Frame owner){
-	super(owner, DIALOG_TITLE, DIALOG_MODAL);
+        super(owner, DIALOG_TITLE, DIALOG_MODAL);
 
-	// Custom handling of window close operation
-	setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
-	addWindowListener(this);
-
-	// The dreaded GridBagLayout...
-	GridBagLayout gridbag = new GridBagLayout();
-	GridBagConstraints c = new GridBagConstraints();
-	c.fill = GridBagConstraints.BOTH;
-	setLayout(gridbag);
+        // Custom handling of window close operation
+        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+        addWindowListener(this);
+
+        // The dreaded GridBagLayout...
+        GridBagLayout gridbag = new GridBagLayout();
+        GridBagConstraints c = new GridBagConstraints();
+        c.fill = GridBagConstraints.BOTH;
+        setLayout(gridbag);
 	
-	registriesList = new RegistriesList();
-	Registry[] registries = registriesList.getAll();
-	registryNames = new String[registries.length+1];
-	int i = 0;
-	for(; i < registries.length; i++){
-	    registryNames[i] = registries[i].getSynonym();
-	}
-	registryNames[i] = CUSTOM_REGISTRY_SYNONYM;
-
-	JLabel label = new JLabel("Registry server:");
-	c.gridwidth = 1;
-	c.weightx = 0.0;
-	gridbag.setConstraints(label, c);
-	add(label);
-	registryComboBox = new JComboBox(registryNames);
-	registryComboBox.addActionListener(this);
-	c.gridwidth = GridBagConstraints.REMAINDER;
-	c.weightx = 1.0;
-	gridbag.setConstraints(registryComboBox, c);
-	add(registryComboBox);
-
-	label = new JLabel("Description:");
-	c.gridwidth = 1;
-	c.weightx = 0.0;
-	gridbag.setConstraints(label, c);
-	add(label);
-	registryDescTextArea = new JTextPane();
-	registryDescTextArea.setEditable(false);
-	c.gridwidth = GridBagConstraints.REMAINDER;
-	c.weightx = 0.0;   // 0 so long lines wrap in text area
-	c.weighty = 1.0;  // absorb all extra vertical space in the desc
-	gridbag.setConstraints(registryDescTextArea, c);
-	add(registryDescTextArea);
-	c.weighty = 0.0; //reset
-
-	label = new JLabel("Location:");
-	c.gridwidth = 1;
-	c.weightx = 0.0;
-	gridbag.setConstraints(label, c);
-	add(label);
-	registryEndpoint = new JTextField(50);
-	registryEndpoint.setEditable(false);
-	c.gridwidth = GridBagConstraints.REMAINDER;
-	c.weightx = 1.0;
-	gridbag.setConstraints(registryEndpoint, c);
-	add(registryEndpoint);
-
-	label = new JLabel("Namespace:");
-	c.gridwidth = 1;
-	c.weightx = 0.0;
-	gridbag.setConstraints(label, c);
-	add(label);
-	registryNamespace = new JTextField(50);
-	registryNamespace.setEditable(false);
-	c.gridwidth = GridBagConstraints.REMAINDER;
-	c.weightx = 1.0;
-	gridbag.setConstraints(registryNamespace, c);
-	add(registryNamespace);
-
-	JSeparator line = new JSeparator();
-	c.gridwidth = GridBagConstraints.REMAINDER; 
-	gridbag.setConstraints(line, c);
-	add(line);
-
-	sendReferrerCheckBox = new JCheckBox("Send referrer data to services");
-	c.gridwidth = GridBagConstraints.REMAINDER; 
-	gridbag.setConstraints(sendReferrerCheckBox, c);
-	add(sendReferrerCheckBox);
-
-	line = new JSeparator();
-	c.gridwidth = GridBagConstraints.REMAINDER; 
-	gridbag.setConstraints(line, c);
-	add(line);
-
-	JPanel expiryPanel = new JPanel(new GridLayout(1,0));
-	label = new JLabel("Cache expiry (in hours)");
-	expiryPanel.add(label);
-	cacheExpiryTextField = new JTextField(3);
-	expiryPanel.add(cacheExpiryTextField);
-	c.gridwidth = 1;
-	gridbag.setConstraints(expiryPanel, c);
-	add(expiryPanel);
-	deleteCacheButton = new JButton("Delete cached items");
-	deleteCacheButton.addActionListener(this);
-	c.gridwidth = 1;
-	gridbag.setConstraints(deleteCacheButton, c);
-	add(deleteCacheButton);
-
-	selectCacheDirButton = new JButton("Change cache directory");
-	selectCacheDirButton.addActionListener(this);
-	c.gridwidth = GridBagConstraints.REMAINDER;
-	gridbag.setConstraints(selectCacheDirButton, c);
-	add(selectCacheDirButton);
-	cacheDirFileChooser = new JFileChooser();
-	cacheDirFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
-
-	line = new JSeparator();
-	c.gridwidth = GridBagConstraints.REMAINDER; 
-	gridbag.setConstraints(line, c);
-	add(line);
-
-	resetButton = new JButton("Restore program defaults");
-	resetButton.addActionListener(this);
-	c.gridwidth = 1;
-	gridbag.setConstraints(resetButton, c);
-	add(resetButton);
-	cancelButton = new JButton("Cancel");
-	cancelButton.addActionListener(this);
-	c.gridwidth = 1;
-	gridbag.setConstraints(cancelButton, c);
-	add(cancelButton);
-	okButton = new JButton("Apply changes");
-	okButton.addActionListener(this);
-	c.gridwidth = GridBagConstraints.REMAINDER;
-	gridbag.setConstraints(okButton, c);
-	add(okButton);
+        registriesList = new RegistriesList();
+        Registry[] registries = registriesList.getAll();
+        registryNames = new String[registries.length+1];
+        int i = 0;
+        for(; i < registries.length; i++){
+            registryNames[i] = registries[i].getSynonym();
+        }
+        registryNames[i] = CUSTOM_REGISTRY_SYNONYM;
+
+        c.insets = new Insets(3,2,3,2);
+        //........................................
+        
+        c.gridwidth = 2;
+        c.fill = GridBagConstraints.HORIZONTAL;
+        JLabel label = new JLabel("Registry server:", JLabel.RIGHT);
+        add(label, c);
+        
+        registryComboBox = new JComboBox(registryNames);
+        registryComboBox.addActionListener(this);
+        add(registryComboBox, c);
+
+        c.gridheight = 4;
+        c.fill = GridBagConstraints.NONE;
+        JPanel bPanel = new JPanel(new GridLayout(3, 0, 3, 3));
+          resetButton = new JButton("Restore program defaults");
+	  resetButton.addActionListener(this);
+        
+          cancelButton = new JButton("Cancel");
+	  cancelButton.addActionListener(this);
+
+          okButton = new JButton("Apply changes");
+          okButton.addActionListener(this);
+
+          bPanel.add(resetButton);
+          bPanel.add(cancelButton);
+          bPanel.add(okButton);
+        
+        add(bPanel, c);
+
+        //........................................
+        c.gridx = 0;
+        c.gridy = 1;
+        c.gridheight = 1;
+        c.fill = GridBagConstraints.BOTH;
+        label = new JLabel("Description:", JLabel.RIGHT);
+        label.setVerticalAlignment(JLabel.TOP);
+        add(label, c);
+        
+        c.gridx = 2;
+        c.weightx = 1.0;
+        c.weighty = 1.0;
+        registryDescTextArea = new JTextPane();
+        registryDescTextArea.setEditable(false);
+        add(registryDescTextArea, c);
+        
+        //........................................
+        c.gridx = 0;
+        c.gridy = 2;
+        c.weightx = 0.0;
+        c.weighty = 0.0;
+        c.fill = GridBagConstraints.HORIZONTAL;
+        label = new JLabel("Location:", JLabel.RIGHT);
+        add(label, c);
+
+        c.gridx = 2;
+        registryEndpoint = new JTextField(50);
+        registryEndpoint.setEditable(false);
+        add(registryEndpoint, c);
+
+        //........................................
+        
+        c.gridx = 0;
+        c.gridy = 3;
+        label = new JLabel("Namespace:", JLabel.RIGHT);
+        add(label, c);
+
+        c.gridx = 2;
+        registryNamespace = new JTextField(50);
+        registryNamespace.setEditable(false);
+        add(registryNamespace, c);
+
+        //........................................
+        c.gridx = 0;
+        c.gridy = 4;
+        c.gridwidth = 6;
+        JSeparator line = new JSeparator();
+        add(line, c);
+
+        //........................................
+        c.gridx = 0;
+        c.gridy = 5;
+        c.gridwidth = 4;
+        c.gridheight = 1;
+        sendReferrerCheckBox = new JCheckBox("Send referrer data to services");
+        add(sendReferrerCheckBox, c);
+
+        //........................................
+        c.gridy = 6;
+        c.gridwidth = 6;
+        line = new JSeparator();
+        add(line, c);
+
+        //........................................
+        c.gridy = 7;
+        c.gridwidth = 2;
+        label = new JLabel("Cache expiry (in hours)", JLabel.RIGHT);
+        add(label, c);
+
+        c.gridx = 2;
+        c.gridwidth = 1;
+        cacheExpiryTextField = new JTextField(3);
+        cacheExpiryTextField.setMinimumSize(cacheExpiryTextField.getPreferredSize()); // prevents text collapsing
+        add(cacheExpiryTextField, c);
+
+        c.gridx = 3;
+        c.gridwidth = 3;
+        c.fill = GridBagConstraints.NONE;
+        JPanel cbPanel = new JPanel(new GridLayout(1,0,4,2));
+
+          deleteCacheButton = new JButton("Delete cached items");
+          deleteCacheButton.addActionListener(this);
+        
+          selectCacheDirButton = new JButton("Change cache directory");
+          selectCacheDirButton.addActionListener(this);
+
+	  cbPanel.add(deleteCacheButton);
+	  cbPanel.add(selectCacheDirButton);
+        
+	  cacheDirFileChooser = new JFileChooser();
+	  cacheDirFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
 
+	add(cbPanel, c);
+        
 	setCurrentValues();
 	pack();
     }
@@ -372,4 +388,17 @@
     public void windowDeiconified(WindowEvent e){}
     public void windowIconified(WindowEvent e){}
     public void windowOpened(WindowEvent e){}
+    
+    public static void main(String[] args)
+    {
+      JFrame frame = new JFrame("test");
+      frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+      
+      SeahawkOptionsGUI dialog = new SeahawkOptionsGUI(frame);
+      
+      frame.pack();
+      frame.setVisible(true);
+      
+      dialog.setVisible(true);
+    }
 }




More information about the MOBY-guts mailing list