コード例 #1
0
 /**
  * Sets current object of Student in this listblock line. After chaning the data you need to in
  * this listblock line you would probably want to refresh the UI using the refresh() method.
  *
  * @param pStudent The object to set. Attributes are copied.
  */
 public void setStudent(Student pStudent) {
   if (pStudent == null && newStudent != null) {
     domainProxy.removeProxy(domainProxy.getProxy(newStudent, "Student"));
     newStudent = null;
   } else if (pStudent != null) {
     newStudent = pStudent;
     domainProxy.getNewProxy(newStudent, "Student");
   }
   roleNameToObject.put("Student", newStudent);
 }
コード例 #2
0
 /**
  * Internal use.
  *
  * @param column Internal use.
  */
 void fromCellToListblockLine(int column) {
   DomainObjectProxy objectProxy = domainProxy.getProxy(newStudent, "Student");
   /** Column Match ? */
   if (controller.view.chooseStudentsListBloack_indexes.indexOf(new Integer(0)) == column) {
     Object workValue = null;
     // Object convert = TypeTool.convert(newStudent.getAge());
     if (cellValueColumn0 instanceof JComboBox) {
       workValue = ((JComboBox) cellValueColumn0).getSelectedItem();
     } else if (cellValueColumn0 instanceof JCheckBox) {
       workValue = new Boolean(((JCheckBox) cellValueColumn0).isSelected());
     } else {
       workValue = cellValueColumn0;
     }
     /* Convert the Genova enumerator from a text string to the
      * int value as a string */
     if (TypeTool.isEnumeratorMethod(newStudent, "age")) {
       String enumName = TypeTool.getAttributeClassNameMethod(newStudent, "age");
       if (enumName == null) {
         System.out.println("Failed to name class for Student.getAge().");
         workValue = "";
       } else {
         if (workValue != null) {
           int intVal = controller.applicationEnums.toValue(enumName, (String) workValue);
           workValue = "" + intVal;
         }
       }
     }
     if (workValue != null) {
       objectProxy = domainProxy.getProxy(newStudent, "Student");
       objectProxy.setAttribute("age", workValue.toString());
     }
     fromListblockLineToCell(column, false);
   }
   /** Column Match ? */
   if (controller.view.chooseStudentsListBloack_indexes.indexOf(new Integer(1)) == column) {
     Object workValue = null;
     // Object convert = TypeTool.convert(newStudent.getName());
     if (cellValueColumn1 instanceof JComboBox) {
       workValue = ((JComboBox) cellValueColumn1).getSelectedItem();
     } else if (cellValueColumn1 instanceof JCheckBox) {
       workValue = new Boolean(((JCheckBox) cellValueColumn1).isSelected());
     } else {
       workValue = cellValueColumn1;
     }
     /* Convert the Genova enumerator from a text string to the
      * int value as a string */
     if (TypeTool.isEnumeratorMethod(newStudent, "name")) {
       String enumName = TypeTool.getAttributeClassNameMethod(newStudent, "name");
       if (enumName == null) {
         System.out.println("Failed to name class for Student.getName().");
         workValue = "";
       } else {
         if (workValue != null) {
           int intVal = controller.applicationEnums.toValue(enumName, (String) workValue);
           workValue = "" + intVal;
         }
       }
     }
     if (workValue != null) {
       objectProxy = domainProxy.getProxy(newStudent, "Student");
       objectProxy.setAttribute("name", workValue.toString());
     }
     fromListblockLineToCell(column, false);
   }
   /** Column Match ? */
   if (controller.view.chooseStudentsListBloack_indexes.indexOf(new Integer(2)) == column) {
     Object workValue = null;
     // Object convert = TypeTool.convert(newStudent.getStudentNr());
     if (cellValueColumn2 instanceof JComboBox) {
       workValue = ((JComboBox) cellValueColumn2).getSelectedItem();
     } else if (cellValueColumn2 instanceof JCheckBox) {
       workValue = new Boolean(((JCheckBox) cellValueColumn2).isSelected());
     } else {
       workValue = cellValueColumn2;
     }
     /* Convert the Genova enumerator from a text string to the
      * int value as a string */
     if (TypeTool.isEnumeratorMethod(newStudent, "studentNr")) {
       String enumName = TypeTool.getAttributeClassNameMethod(newStudent, "studentNr");
       if (enumName == null) {
         System.out.println("Failed to name class for Student.getStudentNr().");
         workValue = "";
       } else {
         if (workValue != null) {
           int intVal = controller.applicationEnums.toValue(enumName, (String) workValue);
           workValue = "" + intVal;
         }
       }
     }
     if (workValue != null) {
       objectProxy = domainProxy.getProxy(newStudent, "Student");
       objectProxy.setAttribute("studentNr", workValue.toString());
     }
     fromListblockLineToCell(column, false);
   }
   /** Column Match ? */
   if (controller.view.chooseStudentsListBloack_indexes.indexOf(new Integer(3)) == column) {
     Object workValue = null;
     // Object convert = TypeTool.convert(newStudent.getId());
     if (cellValueColumn3 instanceof JComboBox) {
       workValue = ((JComboBox) cellValueColumn3).getSelectedItem();
     } else if (cellValueColumn3 instanceof JCheckBox) {
       workValue = new Boolean(((JCheckBox) cellValueColumn3).isSelected());
     } else {
       workValue = cellValueColumn3;
     }
     /* Convert the Genova enumerator from a text string to the
      * int value as a string */
     if (TypeTool.isEnumeratorMethod(newStudent, "id")) {
       String enumName = TypeTool.getAttributeClassNameMethod(newStudent, "id");
       if (enumName == null) {
         System.out.println("Failed to name class for Student.getId().");
         workValue = "";
       } else {
         if (workValue != null) {
           int intVal = controller.applicationEnums.toValue(enumName, (String) workValue);
           workValue = "" + intVal;
         }
       }
     }
     if (workValue != null) {
       objectProxy = domainProxy.getProxy(newStudent, "Student");
       objectProxy.setAttribute("id", workValue.toString());
     }
     fromListblockLineToCell(column, false);
   }
 }
コード例 #3
0
 /**
  * Returns the Student registered as marked with latest reset() call
  *
  * @return The 'old' object.
  */
 public Student getOldStudent() {
   return (Student) domainProxy.getProxy(newStudent, "Student").getCleanVersionOfObject();
 }