1 package autotest.afe; 2 3 public class ControlTypeSelect { 4 public static interface Display { getClient()5 public IRadioButton getClient(); getServer()6 public IRadioButton getServer(); 7 } 8 9 private Display display; 10 bindDisplay(Display display)11 public void bindDisplay(Display display) { 12 this.display = display; 13 display.getClient().setText(TestSelector.CLIENT_TYPE); 14 display.getServer().setText(TestSelector.SERVER_TYPE); 15 } 16 getControlType()17 public String getControlType() { 18 if (display.getClient().getValue()) { 19 return display.getClient().getText(); 20 } 21 return display.getServer().getText(); 22 } 23 setControlType(String type)24 public void setControlType(String type) { 25 if (display.getClient().getText().equals(type)) { 26 display.getClient().setValue(true); 27 } else if (display.getServer().getText().equals(type)) { 28 display.getServer().setValue(true); 29 } else { 30 throw new IllegalArgumentException("Invalid control type"); 31 } 32 } 33 setEnabled(boolean enabled)34 public void setEnabled(boolean enabled) { 35 display.getClient().setEnabled(enabled); 36 display.getServer().setEnabled(enabled); 37 } 38 } 39