1 18 19 package org.apache.jmeter.control.gui; 20 21 import javax.swing.JCheckBox ; 22 23 import org.apache.jmeter.control.InterleaveControl; 24 import org.apache.jmeter.control.RandomController; 25 import org.apache.jmeter.testelement.TestElement; 26 import org.apache.jmeter.util.JMeterUtils; 27 import org.apache.jorphan.gui.layout.VerticalLayout; 28 29 32 public class RandomControlGui extends AbstractControllerGui 33 { 34 private JCheckBox style; 35 36 public RandomControlGui() 37 { 38 init(); 39 } 40 41 public TestElement createTestElement() 42 { 43 RandomController ic = new RandomController(); 44 modifyTestElement(ic); 45 return ic; 46 } 47 48 52 public void modifyTestElement(TestElement ic) 53 { 54 configureTestElement(ic); 55 if (style.isSelected()) 56 { 57 ((RandomController) ic).setStyle( 58 InterleaveControl.IGNORE_SUB_CONTROLLERS); 59 } 60 else 61 { 62 ((RandomController) ic).setStyle( 63 InterleaveControl.USE_SUB_CONTROLLERS); 64 } 65 } 66 67 public void configure(TestElement el) 68 { 69 super.configure(el); 70 if (((RandomController) el).getStyle() 71 == InterleaveControl.IGNORE_SUB_CONTROLLERS) 72 { 73 style.setSelected(true); 74 } 75 else 76 { 77 style.setSelected(false); 78 } 79 } 80 81 public String getLabelResource() 82 { 83 return "random_control_title"; 84 } 85 86 private void init() 87 { 88 setLayout( 89 new VerticalLayout(5, VerticalLayout.LEFT, VerticalLayout.TOP)); 90 setBorder(makeBorder()); 91 add(makeTitlePanel()); 92 93 style = 94 new JCheckBox (JMeterUtils.getResString("ignore_subcontrollers")); 95 add(style); 96 } 97 } 98 | Popular Tags |