@Override public void applyTo(JstdRunSettings.Builder runSettingsBuilder) { TestType selectedTestType = getSelectedTestType(); selectTestType(selectedTestType); runSettingsBuilder.setTestType(selectedTestType); myTestTypeContentRunSettingsSection.applyTo(runSettingsBuilder); myServerConfigurationForm.applyTo(runSettingsBuilder); }
private void selectTestType(TestType testType) { TestTypeListItem testTypeListItem = myListItemByTestTypeMap.get(testType); ComboBoxModel comboBoxModel = myTestTypeComboBox.getModel(); if (comboBoxModel.getSelectedItem() != testTypeListItem) { comboBoxModel.setSelectedItem(testTypeListItem); } myTestTypeContentRunSettingsSection.select(testTypeListItem); }
@NotNull @Override protected JComponent createComponent(@NotNull CreationContext creationContext) { JPanel panel = new JPanel(new GridBagLayout()); { GridBagConstraints c = new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0); panel.add(new JLabel("Test:"), c); } TestTypeListItem[] testTypeListItems = createTestTypeListItems(); { GridBagConstraints c = new GridBagConstraints( 1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0); myTestTypeComboBox = createTestTypeComboBox(testTypeListItems); panel.add(myTestTypeComboBox, c); myListItemByTestTypeMap = createListItemByTestTypeMap(testTypeListItems); } { GridBagConstraints c = new GridBagConstraints( 0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0); myTestTypeContentRunSettingsSection = new OneOfRunSettingsSection<TestTypeListItem>(Arrays.asList(testTypeListItems)); panel.add(myTestTypeContentRunSettingsSection.getComponent(creationContext), c); } { GridBagConstraints c = new GridBagConstraints( 0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0); panel.add(myServerConfigurationForm.getComponent(creationContext), c); } return panel; }
@Override public void resetFrom(JstdRunSettings runSettings) { selectTestType(runSettings.getTestType()); myTestTypeContentRunSettingsSection.resetFrom(runSettings); myServerConfigurationForm.resetFrom(runSettings); }