Пример #1
0
  private void customizeForm(RrrBean.RRR_ACTION rrrAction) {
    if (rrrAction == RrrBean.RRR_ACTION.NEW) {
      btnSave.setText(
          MessageUtility.getLocalizedMessage(ClientMessage.GENERAL_LABELS_CREATE_AND_CLOSE)
              .getMessage());
      txtNominator.setEditable(true);
      txtDenominator.setEditable(true);
      btnClose.setEnabled(false);
      btnClose.setVisible(false);

    } else if (rrrAction == RrrBean.RRR_ACTION.VIEW) {
      btnSave.setEnabled(false);
      btnSave.setVisible(false);
      btnClose.setEnabled(true);
      btnClose.setVisible(true);
      txtNominator.setEditable(false);
      txtDenominator.setEditable(false);
      btnAddOwner.setEnabled(false);
      btnRemoveOwner.setEnabled(false);
    }
    rrrShareBean.addPropertyChangeListener(
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(RrrShareBean.SELECTED_RIGHTHOLDER_PROPERTY)) {
              customizeOwnersButtons((PartySummaryBean) evt.getNewValue());
            }
          }
        });
  }
 /**
  * Constructor of the map action that is used to show the component where the new survey points
  * are shown.
  *
  * @param mapObj The map control that will be interacting with the map action
  * @param pointSurveyListForm The component to show
  */
 public CadastreChangePointSurveyListFormShow(Map mapObj, Component pointSurveyListForm) {
   super(
       mapObj,
       pointSurveyListForm,
       MAPACTION_NAME,
       MessageUtility.getLocalizedMessage(GisMessage.CADASTRE_CHANGE_POINTS_SHOW).getMessage(),
       "resources/point-show.png");
 }
Пример #3
0
  private void customizePanel() {
    if (refDataBean != null) {
      headerPanel.setTitleText(
          MessageFormat.format("{0} - {1}", headerTitle, refDataBean.getTranslatedDisplayValue()));
    } else {
      headerPanel.setTitleText(
          MessageFormat.format(
              "{0} - {1}",
              headerTitle, resourceBundle.getString("ReferenceDataManagementPanel.NewItem.text")));
    }

    if (closeOnSave) {
      btnSave.setText(
          MessageUtility.getLocalizedMessage(ClientMessage.GENERAL_LABELS_SAVE_AND_CLOSE)
              .getMessage());
    } else {
      btnSave.setText(
          MessageUtility.getLocalizedMessage(ClientMessage.GENERAL_LABELS_SAVE).getMessage());
    }
  }
/**
 * Tool that is used to draw new cadastre objects during the cadastre change.
 *
 * @author rizzom
 */
public class CadastreChangeNewCadastreObjectTool extends CadastreChangeEditAbstractTool
    implements TargetCadastreObjectTool {

  public static final String NAME = "new-parcel";
  private String toolTip =
      MessageUtility.getLocalizedMessage(GisMessage.CADASTRE_CHANGE_TOOLTIP_NEW_PARCEL)
          .getMessage();
  private String cadastreObjectType;

  /**
   * Constructor
   *
   * @param newCadastreObjectLayer The layer where the new cadastre objects are maintained
   */
  public CadastreChangeNewCadastreObjectTool(
      CadastreChangeNewCadastreObjectLayer newCadastreObjectLayer) {
    this.setToolName(NAME);
    this.setIconImage("resources/new-parcel.png");
    this.setToolTip(toolTip);
    this.setGeometryType(Geometries.POLYGON);
    this.layer = newCadastreObjectLayer;
  }

  @Override
  public void setCadastreObjectType(String cadastreObjectType) {
    this.cadastreObjectType = cadastreObjectType;
  }

  /**
   * If a new click is done while creating a cadastre object, it has to snap to a point. Because the
   * only layer used as snaptarget is the NewSurveyPointLayer the only points are the survey points.
   *
   * @param ev
   */
  @Override
  public void onMouseClicked(MapMouseEvent ev) {
    if (ev.getButton() == java.awt.event.MouseEvent.BUTTON1
        && this.getSnappedTarget() != SNAPPED_TARGET_TYPE.Vertex) {
      Messaging.getInstance().show(GisMessage.CADASTRE_CHANGE_NEW_CO_MUST_SNAP);
      return;
    }
    super.onMouseClicked(ev);
  }

  /**
   * It means a vertex of a cadastre object cannot be changed from this tool. It must be changed by
   * changing the vertices in the NewSurveyPointLayer.
   *
   * @param mousePositionInMap
   * @return
   */
  @Override
  protected SimpleFeature treatChangeVertex(DirectPosition2D mousePositionInMap) {
    return null;
  }

  @Override
  public SimpleFeature addFeature(Geometry geometry) {
    org.sola.clients.beans.cadastre.CadastreObjectBean formBean =
        new org.sola.clients.beans.cadastre.CadastreObjectBean();
    formBean.setNameFirstpart(getLayer().getLastPart());
    formBean.setNameLastpart(getLayer().getNameFirstPart());
    if (geometry != null) {
      formBean.setOfficialAreaSize(new BigDecimal(geometry.getArea()));
      formBean.setCalculatedArea(new BigDecimal(geometry.getArea()));
    }
    ParcelDialog form = new ParcelDialog(formBean, false, null, true);

    final CadastreObjectBean[] beans = new CadastreObjectBean[1];

    // AM - Multi-SRID change
    // Need to explicitly set the SRID of the map on the geometry.
    final Geometry geom = this.layer.setSridOnGeometry(geometry);

    form.addPropertyChangeListener(
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(ParcelDialog.SELECTED_PARCEL)) {
              // Convert between CadastreObject in the GIS project and CadastreObject in the Clients
              // Beans
              org.sola.clients.beans.cadastre.CadastreObjectBean bean =
                  (org.sola.clients.beans.cadastre.CadastreObjectBean) evt.getNewValue();
              CadastreObjectBean bean2 =
                  MappingManager.getMapper().map(bean, CadastreObjectBean.class);
              // Fix problem with list area list duplications
              bean2.getSpatialValueAreaList().clear();
              bean2.getSpatialValueAreaList().addAll(bean.getSpatialValueAreaList());

              bean2.setFeatureGeom(geom);
              getLayer().getBeanList().add(bean2);
              beans[0] = bean2;
            }
          }
        });

    form.setVisible(true);
    if (beans[0] != null) {
      return getLayer().getFeatureByCadastreObjectId(beans[0].getId());
    }
    return null;
  }

  /**
   * Gets the layer where the new cadastre objects are added.
   *
   * @return
   */
  private CadastreChangeNewCadastreObjectLayer getLayer() {
    return (CadastreChangeNewCadastreObjectLayer) this.layer;
  }
}