Exemplo n.º 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;
        }
      }
    }
Exemplo n.º 2
0
  /**
   * Store this Projection in the data table
   *
   * @param proj the Projection to store
   */
  public void saveProjection(ProjectionImpl proj) {
    // setVisible(true);  how to make this work? seperate Thread ?

    // force new name
    ProjectionImpl newProj = (ProjectionImpl) proj.constructCopy();
    newProj.setName("");
    setWorkingProjection(newProj);

    // start up edit Dialog
    getEditor().setProjection(current);
    getEditor().setVisible(true);
  }
Exemplo n.º 3
0
 /**
  * Make the default projections from the internal list of classes.
  *
  * @return list of default projections
  */
 public static List makeDefaultProjections() {
   List defaults = new ArrayList();
   List classNames = getDefaultProjections();
   for (int i = 0; i < classNames.size(); i++) {
     String className = (String) classNames.get(i);
     try {
       Class projClass = Misc.findClass(className);
       ProjectionImpl pi = (ProjectionImpl) projClass.newInstance();
       pi.setName("Default " + pi.getProjectionTypeLabel());
       defaults.add(pi);
     } catch (Exception ee) {
       System.err.println("Error creating default projection: " + className);
       ee.printStackTrace();
     }
   }
   return defaults;
 }