jsalvata    2004/01/05 08:57:17

  Modified:    src/core/org/apache/jmeter/testbeans/gui Tag:
                        testbeans_experimental_branch TestBeanGUI.java
  Log:
  Improved GUI layout.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.7   +40 -18    
jakarta-jmeter/src/core/org/apache/jmeter/testbeans/gui/Attic/TestBeanGUI.java
  
  Index: TestBeanGUI.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/testbeans/gui/Attic/TestBeanGUI.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- TestBeanGUI.java  4 Jan 2004 20:51:27 -0000       1.1.2.6
  +++ TestBeanGUI.java  5 Jan 2004 16:57:16 -0000       1.1.2.7
  @@ -59,6 +59,9 @@
   
   import java.awt.BorderLayout;
   import java.awt.Component;
  +import java.awt.GridBagConstraints;
  +import java.awt.GridBagLayout;
  +import java.awt.Insets;
   
   import java.beans.BeanInfo;
   import java.beans.IntrospectionException;
  @@ -82,7 +85,6 @@
   import org.apache.jmeter.control.Controller;
   import org.apache.jmeter.gui.AbstractJMeterGuiComponent;
   import org.apache.jmeter.gui.util.MenuFactory;
  -import org.apache.jmeter.gui.util.VerticalPanel;
   import org.apache.jmeter.processor.PostProcessor;
   import org.apache.jmeter.processor.PreProcessor;
   import org.apache.jmeter.samplers.Sampler;
  @@ -112,6 +114,8 @@
    * <dd>Order in which the property will be shown in its group. A smaller
    * integer means higher up in the GUI. The default order is 0. Properties
    * of equal order are sorted alphabetically.</dd>
  + * <dt>tags: String[]</dt>
  + * <dd>List of values to be offered for the property.</dd>
    * </dl>
    * <p>
    * The following BeanDescriptor attributes are also understood:
  @@ -402,30 +406,48 @@
           add(makeTitlePanel(), BorderLayout.NORTH);
           // TODO: add support for beanInfo.getBeanDescriptor().getCustomizerClass()
           // via a tabbed pannel -- e.g. "Properties" vs. "Custom"
  -        // TODO: use a table instead of this bunch of panels
  -        VerticalPanel mainPanel = new VerticalPanel();
  +        // TODO: make property grouping visible, probably using etched titled 
borders:
  +             /*groupPanel.setBorder(
  +                     BorderFactory.createTitledBorder(
  +                             BorderFactory.createEtchedBorder(),
  +                             group_name));*/
   
  +        JPanel mainPanel = new JPanel(new GridBagLayout());
  +        
  +        GridBagConstraints cl= new GridBagConstraints(); // for labels
  +             cl.gridx= 0;
  +             cl.anchor= GridBagConstraints.LINE_END;
  +             cl.insets= new Insets(0, 1, 0, 1);
  +
  +             GridBagConstraints ce= new GridBagConstraints(); // for editors
  +             ce.fill= GridBagConstraints.BOTH;
  +             ce.gridx= 1;
  +             ce.weightx= 1.0;
  +             ce.insets= new Insets(0, 1, 0, 1);
  +             
           for (int i=0; i<editors.length; i++)
           {
               if (editors[i] == null) continue;
  -            mainPanel.add(
  -                createPropertyPanel(
  -                    descriptors[i].getName(),
  -                    editors[i].getCustomEditor()));            
  +
  +                     JLabel label = new JLabel(descriptors[i].getName());
  +                     Component customEditor= editors[i].getCustomEditor();
  +                     label.setHorizontalAlignment(JLabel.TRAILING);
  +                     label.setLabelFor(customEditor);
  +
  +                     cl.gridy= i;
  +            mainPanel.add(label, cl);
  +
  +                     ce.gridy= i;
  +            ce.weighty= customEditor.getMaximumSize().height;
  +                     // TODO: the above works in the current situation, but it's
  +                     // just a hack. How to get each editor to report whether it
  +                     // wants to grow bigger? Whether the property label should
  +                     // be at the left or at the top of the editor? ...?
  +            mainPanel.add(customEditor, ce);
           }
           add(mainPanel, BorderLayout.CENTER);
       }
   
  -    private JPanel createPropertyPanel(String name, Component customEditor)
  -    {
  -        JPanel panel = new JPanel(new BorderLayout(5, 0));
  -        JLabel label = new JLabel(name);
  -        label.setLabelFor(customEditor);
  -        panel.add(label, BorderLayout.WEST);
  -        panel.add(customEditor, BorderLayout.CENTER);
  -        return panel;
  -    }
  -    
       /**
        * Comparator used to sort properties for presentation in the GUI.
        */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to