Пример #1
0
    /**
     * Set the projection from the dialog properties
     *
     * @param projClass projection class
     * @param proj projection
     */
    private void setProjFromDialog(ProjectionClass projClass, ProjectionImpl proj) {
      proj.setName(nameTF.getText().trim());

      for (int i = 0; i < projClass.paramList.size(); i++) {
        ProjectionParam pp = (ProjectionParam) projClass.paramList.get(i);
        // fetch the value from the projection object
        try {
          String valstr = pp.getTextField().getText();
          Double valdub = new Double(valstr);
          Object[] args = {valdub};
          if (debugBeans) {
            System.out.println("Projection setProjFromDialog invoke writer on " + pp);
          }
          pp.writer.invoke(proj, args);
        } catch (Exception ee) {
          System.err.println(
              "ProjectionManager: setProjParams failed "
                  + " invoking write "
                  + pp.name
                  + " class "
                  + projClass);
          continue;
        }
      }
    }
Пример #2
0
    /**
     * Put a projection in the dialog for editing
     *
     * @param projClass projection class
     * @param proj projection
     */
    private void putProjInDialog(ProjectionClass projClass, Projection proj) {
      //      nameTF.setText (proj.getName().trim());

      for (int i = 0; i < projClass.paramList.size(); i++) {
        ProjectionParam pp = (ProjectionParam) projClass.paramList.get(i);
        // fetch the value from the projection object
        Double value;
        try {
          if (debugBeans) {
            System.out.println("Projection putProjInDialog invoke reader on " + pp);
          }
          value = (Double) pp.reader.invoke(proj, VOIDOBJECTARG);
          if (debugBeans) {
            System.out.println("Projection putProjInDialog value " + value);
          }
        } catch (Exception ee) {
          System.err.println(
              "ProjectionManager: putProjInDialog failed "
                  + " invoking read "
                  + pp.name
                  + " class "
                  + projClass);
          continue;
        }
        String valstr = Format.d(value.doubleValue(), 5);
        pp.getTextField().setText(valstr);
      }
    }