@Override
  public boolean isModified() {
    ThreadPoolConfig threadPool =
        config.getProject().getExporter().getSystem().getThreadPool().getDefaultPool();
    GmlIdLookupServerConfig geometry =
        config.getProject().getExporter().getSystem().getGmlIdLookupServer().getGeometry();
    GmlIdLookupServerConfig feature =
        config.getProject().getExporter().getSystem().getGmlIdLookupServer().getFeature();

    try {
      expResMinThreadsText.commitEdit();
    } catch (ParseException e) {
    }
    try {
      expResMaxThreadsText.commitEdit();
    } catch (ParseException e) {
    }
    try {
      expResGeomCacheText.commitEdit();
    } catch (ParseException e) {
    }
    try {
      expResGeomDrainText.commitEdit();
    } catch (ParseException e) {
    }
    try {
      expResGeomPartText.commitEdit();
    } catch (ParseException e) {
    }
    try {
      expResFeatCacheText.commitEdit();
    } catch (ParseException e) {
    }
    try {
      expResFeatDrainText.commitEdit();
    } catch (ParseException e) {
    }
    try {
      expResFeatPartText.commitEdit();
    } catch (ParseException e) {
    }

    if (((Number) expResMinThreadsText.getValue()).intValue() != threadPool.getMinThreads())
      return true;
    if (((Number) expResMaxThreadsText.getValue()).intValue() != threadPool.getMaxThreads())
      return true;
    if (((Number) expResGeomCacheText.getValue()).intValue() != geometry.getCacheSize())
      return true;
    if (((Number) expResGeomDrainText.getValue()).intValue()
        != (int) (geometry.getPageFactor() * 100)) return true;
    if (((Number) expResGeomPartText.getValue()).intValue() != geometry.getPartitions())
      return true;
    if (((Number) expResFeatCacheText.getValue()).intValue() != feature.getCacheSize()) return true;
    if (((Number) expResFeatDrainText.getValue()).intValue()
        != (int) (feature.getPageFactor() * 100)) return true;
    if (((Number) expResFeatPartText.getValue()).intValue() != feature.getPartitions()) return true;

    return false;
  }
예제 #2
0
  @Override
  public Object getValue() {
    try {
      field.commitEdit();
    } catch (ParseException e) {
      logger.error(e.getMessage(), e);
      Utils.showError(e);
      e.printStackTrace();
    }

    if (value instanceof Number) {
      NumberConverter nc =
          new NumberConverter(true, field.getValue()) {

            @Override
            protected Class<?> getDefaultType() {
              return value.getClass();
            }
          };

      return value.getClass().cast(nc.convert(value.getClass(), field.getValue()));
    } else {
      return field.getValue();
    }
  }
예제 #3
0
 protected final String getValueString() {
   if (inputField.isEditValid())
     try {
       inputField.commitEdit();
     } catch (Exception e) {
     }
   return inputField.getText();
 }
예제 #4
0
  @Override
  public boolean isModified() {
    DatabaseSrs refSys = srsComboBox.getSelectedItem();

    try {
      sridText.commitEdit();
    } catch (ParseException e) {
    }
    if (((Number) sridText.getValue()).intValue() != refSys.getSrid()) return true;

    if (!gmlSrsNameText.getText().equals(refSys.getGMLSrsName())) return true;
    if (!descriptionText.getText().equals(refSys.getDescription())) return true;

    return false;
  }
예제 #5
0
파일: FoodEditor.java 프로젝트: kba/neon
 protected void save() {
   data.name = nameField.getText();
   try {
     costField.commitEdit();
     data.cost = ((Long) costField.getValue()).intValue();
   } catch (ParseException e) {
     data.cost = 0;
   }
   data.color = colorBox.getSelectedItem().toString();
   data.text = charField.getText();
   data.weight = Float.parseFloat(weightField.getText());
   if (spellBox.getSelectedItem() != null) {
     data.spell = spellBox.getSelectedItem().toString();
   }
   data.setPath(Editor.getStore().getActive().get("id"));
 }
예제 #6
0
  // Override to check whether the edit is valid,
  // setting the value if it is and complaining if
  // it isn't.  If it's OK for the editor to go
  // away, we need to invoke the superclass's version
  // of this method so that everything gets cleaned up.
  @Override
  public boolean stopCellEditing() {
    JFormattedTextField ftf1 = (JFormattedTextField) getComponent();
    if (ftf1.isEditValid()) {
      try {
        ftf1.commitEdit();
      } catch (java.text.ParseException exc) {
      }

    } else { // text is invalid
      if (!userSaysRevert()) { // user wants to edit
        return false; // don't let the editor go away
      }
    }
    return super.stopCellEditing();
  }
예제 #7
0
 @Override
 public boolean stopCellEditing() {
   JFormattedTextField ftf = (JFormattedTextField) getComponent();
   if (ftf.isEditValid()) {
     try {
       ftf.commitEdit();
     } catch (java.text.ParseException exc) {
       // nothing to do
     }
   } else {
     if (!askEditOrRevert(ftf, null)) {
       return false;
     } else {
       ftf.setValue(ftf.getValue());
     }
   }
   return super.stopCellEditing();
 }