public final JRadioButton getRadioButton(){ if(radioButton == null) { radioButton = createRadioButton(); } return radioButton; }
public final JComponent getCrsUI() { if(crsComponent == null) { crsComponent = createCrsComponent(); } return crsComponent; }
public CoordinateReferenceSystem getCrs(GeoPos referencePos) throws FactoryException { for (CrsForm crsForm : crsForms) { if (crsForm.getRadioButton().isSelected()) { return crsForm.getCRS(referencePos); } } return null; }
public void prepareHide() { for (CrsForm crsForm : crsForms) { crsForm.prepareHide(); crsForm.removeCrsChangeListener(crsChangeListener); } }
for (int i = 0, crsFormsLength = crsForms.length; i < crsFormsLength; i++) { CrsForm crsForm = crsForms[i]; JRadioButton crsRadioButton = crsForm.getRadioButton(); crsRadioButton.setSelected(i == 0); crsRadioButton.addActionListener(updateStateListener); JComponent crsComponent = crsForm.getCrsUI(); crsComponent.setEnabled(i == 0); buttonGroup.add(crsRadioButton); if (crsForm.wrapAfterButton()) { tableLayout.setCellColspan(rowCount, 0, 2); rowCount++;
private void updateUIState() { for (CrsForm crsForm : crsForms) { crsForm.getCrsUI().setEnabled(crsForm.getRadioButton().isSelected()); } }
public void prepareShow() { for (CrsForm crsForm : crsForms) { crsForm.prepareShow(); crsForm.addCrsChangeListener(crsChangeListener); } updateUIState(); }
protected JRadioButton createRadioButton() { return new JRadioButton(getLabelText()); }
@Override public void propertyChange(PropertyChangeEvent evt) { final Boolean enabled = (Boolean) evt.getNewValue(); for (CrsForm crsForm : crsForms) { final JRadioButton button = crsForm.getRadioButton(); button.setEnabled(enabled); final boolean selected = button.isSelected(); crsForm.getCrsUI().setEnabled(selected && enabled); } } }
@Override protected JRadioButton createRadioButton() { final JRadioButton button = super.createRadioButton(); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final boolean collocate = button.isSelected(); getCrsUI().firePropertyChange("collocate", !collocate, collocate); } }); return button; }