@Test public void testHardAndSoftReset() { for (Object[] choices : new Object[][]{STRING_CHOICES, INTEGER_CHOICES}) { for (int i = 0; i < 3; i++) { @SuppressWarnings({ "rawtypes", "unchecked" }) Tester<?> t = new Tester(choices, choices[i].getClass()); if (choices[i] instanceof Integer) { settings.setMinTime((Integer) choices[i]); } else if (choices[i] instanceof String) { settings.setTimeSystemSetting((String) choices[i]); } t.reset(settings, true); Assert.assertEquals(t.getSelection(), choices[i]); if (choices[i] instanceof Integer) { settings.setMinTime((Integer) choices[(i+1)%3]); } else if (choices[i] instanceof String) { settings.setTimeSystemSetting((String) choices[(i+1)%3]); } t.reset(settings, false); Assert.assertEquals(t.getSelection(), choices[i]); if (choices[i] instanceof Integer) { settings.setMinTime((Integer) choices[(i+2)%3]); } else if (choices[i] instanceof String) { settings.setTimeSystemSetting((String) choices[(i+2)%3]); } t.reset(settings, true); Assert.assertEquals(t.getSelection(), choices[(i+2)%3]); } } }
public T getSelection() { for (Entry<T, JRadioButton> button : buttons.entrySet()) { if (button.getValue().isSelected()) { return button.getKey(); } } return null; }
PlotSettingsRadioButtonGroup extends PlotSettingsSubPanel { public T getSelection() { for (Entry<T, JRadioButton> button : buttons.entrySet()) { if (button.getValue().isSelected()) { return button.getKey(); } } return null; } }
PlotSettingsRadioButtonGroup extends PlotSettingsSubPanel { public T getSelection() { for (Entry<T, JRadioButton> button : buttons.entrySet()) { if (button.getValue().isSelected()) { return button.getKey(); } } return null; } PlotSettingsRadioButtonGroup(T... options); }
PlotSettingsRadioButtonGroup extends PlotSettingsSubPanel { public T getSelection() { for (Entry<T, JRadioButton> button : buttons.entrySet()) { if (button.getValue().isSelected()) { return button.getKey(); } } return null; } PlotSettingsRadioButtonGroup(T... options); JRadioButton getButton(T object); void setSelection(T object); T getSelection(); void setText(T object, String text); @Override boolean isDirty(); @Override boolean isValidated(); }
PlotSettingsRadioButtonGroup extends PlotSettingsSubPanel { public T getSelection() { for (Entry<T, JRadioButton> button : buttons.entrySet()) { if (button.getValue().isSelected()) { return button.getKey(); } } return null; } PlotSettingsRadioButtonGroup(T... options); JRadioButton getButton(T object); void setSelection(T object); T getSelection(); void setText(T object, String text); @Override boolean isDirty(); @Override boolean isValidated();  }