Ejemplo n.º 1
0
 @Override
 public void dispose() {
   wkGwPanOne1.dispose();
   wkGwPanTwo1.dispose();
   wkGwPanThree1.dispose();
   wkGwPanFour1.dispose();
   wkGwPanFive1.dispose();
   wkGwPanSix1.dispose();
   bindingGroup.unbind();
 }
Ejemplo n.º 2
0
  @Override
  public void setCidsBean(final CidsBean cidsBean) {
    bindingGroup.unbind();
    this.cidsBean = cidsBean;
    if (cidsBean != null) {
      wkGwPanOne1.setCidsBean(cidsBean);
      wkGwPanTwo1.setCidsBean(cidsBean);
      wkGwPanThree1.setCidsBean(cidsBean);
      wkGwPanFour1.setCidsBean(cidsBean);
      wkGwPanFive1.setCidsBean(cidsBean);
      wkGwPanSix1.setCidsBean(cidsBean);
      bindingGroup.bind();

      cidsBean.addPropertyChangeListener(
          new PropertyChangeListener() {

            @Override
            public void propertyChange(final PropertyChangeEvent pce) {
              if (pce.getPropertyName().equals("name")) {
                try {
                  cidsBean.setProperty("ms_cd_gb", "DEMV_" + (String) pce.getNewValue());
                } catch (Exception ex) {
                  if (LOG.isDebugEnabled()) {
                    LOG.debug("autosetting ms_cd_gb failed", ex);
                  }
                }
              }
            }
          });

      cidsBean.addPropertyChangeListener(
          new PropertyChangeListener() {

            @Override
            public void propertyChange(final PropertyChangeEvent pce) {
              if (pce.getPropertyName().equals("ms_cd_gb")) {
                try {
                  cidsBean.setProperty("eu_cd_gb", "DE_GB_" + (String) pce.getNewValue());
                } catch (Exception ex) {
                  if (LOG.isDebugEnabled()) {
                    LOG.debug("autosetting eu_cd_gb failed", ex);
                  }
                }
              }
            }
          });

      cidsBean.addPropertyChangeListener(
          new PropertyChangeListener() {

            @Override
            public void propertyChange(final PropertyChangeEvent pce) {
              if (pce.getPropertyName().equals("nitrat")
                  || pce.getPropertyName().equals("pesticides")
                  || pce.getPropertyName().equals("actsubpest")
                  || pce.getPropertyName().equals("annex_ii")
                  || pce.getPropertyName().equals("othpl")) {
                try {
                  int worstCaseValue = 0;
                  final String[] props = {
                    "nitrat", "pesticides", "actsubpest", "annex_ii", "othpl"
                  };
                  int worstCasePropIndex = 0;
                  for (int propIndex = 0; propIndex < props.length; propIndex++) {
                    final String prop = props[propIndex];
                    final String baseValue =
                        (String) ((CidsBean) cidsBean.getProperty(prop)).getProperty("value");
                    int propValue = 0;
                    try {
                      propValue = Integer.valueOf(baseValue);
                    } catch (Exception ex) {
                      if (LOG.isDebugEnabled()) {
                        LOG.debug("baseValInt cast", ex);
                      }
                    }

                    if (propValue >= worstCaseValue) {
                      worstCasePropIndex = propIndex;
                      worstCaseValue = propValue;
                    }
                  }
                  cidsBean.setProperty(
                      "chem_stat", (CidsBean) cidsBean.getProperty(props[worstCasePropIndex]));
                } catch (Exception ex) {
                  if (LOG.isDebugEnabled()) {
                    LOG.debug("autosetting chem_stat failed", ex);
                  }
                }
              }
            }
          });
    }
  }