private void cmdRemoveActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_cmdRemoveActionPerformed if (theBean.getSelectedBean() != null) { theBean.getBeanList().remove((SurveyPointBean) theBean.getSelectedBean()); theBean.setSelectedBean(null); } } // GEN-LAST:event_cmdRemoveActionPerformed
private void cmdAddActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_cmdAddActionPerformed try { Double x = Double.valueOf(this.txtX.getText()); Double y = Double.valueOf(this.txtY.getText()); SurveyPointBean bean = new SurveyPointBean(); bean.setX(x); bean.setY(y); // Ticket 98 - Set the id for the manually entered coordinate bean.setId(Integer.toString(theBean.getBeanList().size() + 1)); this.theBean.getBeanList().add(bean); } catch (NumberFormatException ex) { Messaging.getInstance().show(GisMessage.CADASTRE_SURVEY_ADD_POINT); } } // GEN-LAST:event_cmdAddActionPerformed
/** * This constructor must be used to initialize the bean. * * @param listBean */ public SurveyPointListPanel(SurveyPointListBean listBean) { this.theBean = listBean; initComponents(); this.txtAcceptableShift.setText( optionRural.isSelected() ? this.getAcceptanceShift(true).toString() : this.getAcceptanceShift(false).toString()); // Add a listner to the bean property of selected bean theBean.addPropertyChangeListener( new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(AbstractListSpatialBean.SELECTED_BEAN_PROPERTY)) { customizeButtons((SpatialBean) evt.getNewValue()); } } }); }