sebb        2003/10/23 17:55:49

  Modified:    src/core/org/apache/jmeter/threads/gui ThreadGroupGui.java
               src/core/org/apache/jmeter/threads ThreadGroup.java
  Log:
  Added duration field to ThreadGroup
  
  Revision  Changes    Path
  1.22      +20 -1     
jakarta-jmeter/src/core/org/apache/jmeter/threads/gui/ThreadGroupGui.java
  
  Index: ThreadGroupGui.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/threads/gui/ThreadGroupGui.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ThreadGroupGui.java       20 Oct 2003 23:57:24 -0000      1.21
  +++ ThreadGroupGui.java       24 Oct 2003 00:55:49 -0000      1.22
  @@ -110,6 +110,7 @@
       private JDateField start;
       private JDateField end;
       private JCheckBox scheduler;
  +    private JTextField duration;
       
       // Sampler error action buttons
        private JRadioButton continueBox;
  @@ -162,6 +163,7 @@
           tg.setProperty(
               new StringProperty(
                   ThreadGroup.ON_SAMPLE_ERROR,onSampleError()));
  +             tg.setProperty(ThreadGroup.DURATION, duration.getText());
       }
       
       private void setSampleErrorBoxes(ThreadGroup te){
  @@ -200,6 +202,7 @@
   
           start.setDate(new Date(tg.getPropertyAsLong(ThreadGroup.START_TIME)));
           end.setDate(new Date(tg.getPropertyAsLong(ThreadGroup.END_TIME)));
  +             duration.setText(tg.getPropertyAsString(ThreadGroup.DURATION));
           
           setSampleErrorBoxes((ThreadGroup) tg);
       }
  @@ -281,6 +284,21 @@
           return panel;
       }
   
  +     /**
  +      * Create a panel containing the Duration field and corresponding label.
  +      * 
  +      * @return a GUI panel containing the Duration field
  +      */
  +     private JPanel createDurationPanel()
  +     {
  +             JPanel panel = new JPanel(new BorderLayout(5, 0));
  +             JLabel label = new JLabel(JMeterUtils.getResString("duration"));
  +             panel.add(label, BorderLayout.WEST);
  +             duration = new JTextField();
  +             panel.add(duration, BorderLayout.CENTER);
  +             return panel;
  +     }
  +
       public String getStaticLabel()
       {
           return JMeterUtils.getResString("threadgroup");
  @@ -378,6 +396,7 @@
                   JMeterUtils.getResString("scheduler_configuration")));
           mainPanel.add(createStartTimePanel());
           mainPanel.add(createEndTimePanel());
  +             mainPanel.add(createDurationPanel());
           mainPanel.setVisible(false);
           VerticalPanel intgrationPanel = new VerticalPanel();
           intgrationPanel.add(threadPropsPanel);        
  
  
  
  1.20      +23 -2     
jakarta-jmeter/src/core/org/apache/jmeter/threads/ThreadGroup.java
  
  Index: ThreadGroup.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/threads/ThreadGroup.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ThreadGroup.java  19 Oct 2003 22:33:57 -0000      1.19
  +++ ThreadGroup.java  24 Oct 2003 00:55:49 -0000      1.20
  @@ -96,6 +96,7 @@
       public final static String SCHEDULER = "ThreadGroup.scheduler";
       public final static String START_TIME= "ThreadGroup.start_time";
       public final static String END_TIME= "ThreadGroup.end_time";
  +     public final static String DURATION = "ThreadGroup.duration";
   
   
       /* Action to be taken when a Sampler error occurs*/
  @@ -178,6 +179,26 @@
       {
           return getPropertyAsLong(START_TIME);
       }
  +
  +     /**
  +      * Get the duration
  +      *
  +      * @return the duration (in secs)
  +      */
  +     public long getDuration()
  +     {
  +             return getPropertyAsLong(DURATION);
  +     }
  +
  +     /**
  +      * Set the duration
  +      *
  +      * @param duration in seconds
  +      */
  +     public void setDuration(long duration)
  +     {
  +             setProperty(new LongProperty(DURATION,duration));
  +     }
   
       /**
        * Set the EndTime value.
  
  
  

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

Reply via email to