/** * Gets the Student instance from this listblock line. The instance is updated with the displayed * cell values before returning. * * @return the displayed object */ protected Student getDisplayedStudent() { Student singleStudent = (Student) roleNameToObject.get("Student"); if (singleStudent == null) { return null; } DomainObjectProxy proxy = controller.getProxy(singleStudent, "Student"); int rowNumber = getLineNumber(); int colNumber; Object value; colNumber = controller.listblockMethodschooseStudentsListBloack.getColumnIndex("Student.age"); value = controller.view.chooseStudentsListBloack_table.getValueAt(rowNumber, colNumber); proxy.setAttribute("age", value); colNumber = controller.listblockMethodschooseStudentsListBloack.getColumnIndex("Student.name"); value = controller.view.chooseStudentsListBloack_table.getValueAt(rowNumber, colNumber); proxy.setAttribute("name", value); colNumber = controller.listblockMethodschooseStudentsListBloack.getColumnIndex("Student.studentNr"); value = controller.view.chooseStudentsListBloack_table.getValueAt(rowNumber, colNumber); proxy.setAttribute("studentNr", value); colNumber = controller.listblockMethodschooseStudentsListBloack.getColumnIndex("Student.id"); value = controller.view.chooseStudentsListBloack_table.getValueAt(rowNumber, colNumber); proxy.setAttribute("id", value); return (Student) proxy.getObject(); }
/** * Inserts element into ComboxField. Note that this method is generated for all attributes, * regardless if it is a Combobox. Though if their owner isn't a combobox, it has no effect * * @param theStudent the name of the class */ void comboboxStudentstudentNrAddItem(Student theStudent) { ((JComboBox) cellValueColumn2) .addItem( controller.convertToString( theStudent.getStudentNr(), TypeTool.getAttributeClassNameMethod(theStudent, "studentNr"))); }
public void displayInEditField() { new ClearTool(controller.roleObjects).clearMembers("Student"); Iterator it = roleNameToObject.keySet().iterator(); while (it.hasNext()) { String roleName = (String) it.next(); ObjectSelectionNode node = controller.getObjectSelectionNode(roleName); Object clean = roleNameToObject.get(roleName); if (clean != null) { node.display(getDisplayedObject(roleName)); } } }
public Object getObject(String roleName, boolean createIfNull) { if ("Student".equals(roleName)) { return getStudent(createIfNull); } Object o = roleNameToObject.get(roleName); if (o == null && createIfNull) { AbstractNode node = (AbstractNode) controller.getObjectSelectionNode(roleName); if (node != null) { o = node.getEmptyDomainObject(); roleNameToObject.put(roleName, o); } } return o; }
/** * Internal use. * * @param column Internal use. * @param defaultInsert Internal use. */ void fromListblockLineToCell(int column, boolean defaultInsert) { // int correctedCol = // ((Integer)controller.view.chooseStudentsListBloack_indexes.elementAt(column)).intValue(); // Column match if (controller.view.chooseStudentsListBloack_indexes.indexOf(new Integer(0)) == column) { if (newStudent == null) { cellValueColumn0 = null; } else { Object convert = TypeTool.toObject(newStudent.getAge()); Object assignValue = null; if (TypeTool.isEnumeratorMethod(newStudent, "age")) { assignValue = controller.convertToString( newStudent.getAge(), TypeTool.getAttributeClassNameMethod(newStudent, "age")); } else { assignValue = convert; } cellValueColumn0 = assignValue; } return; } // Column match if (controller.view.chooseStudentsListBloack_indexes.indexOf(new Integer(1)) == column) { if (newStudent == null) { cellValueColumn1 = null; } else { Object convert = TypeTool.toObject(newStudent.getName()); Object assignValue = null; if (TypeTool.isEnumeratorMethod(newStudent, "name")) { assignValue = controller.convertToString( newStudent.getName(), TypeTool.getAttributeClassNameMethod(newStudent, "name")); } else { assignValue = convert; } cellValueColumn1 = assignValue; } return; } // Column match if (controller.view.chooseStudentsListBloack_indexes.indexOf(new Integer(2)) == column) { if (newStudent == null) { cellValueColumn2 = null; } else { Object convert = TypeTool.toObject(newStudent.getStudentNr()); Object assignValue = null; if (TypeTool.isEnumeratorMethod(newStudent, "studentNr")) { assignValue = controller.convertToString( newStudent.getStudentNr(), TypeTool.getAttributeClassNameMethod(newStudent, "studentNr")); } else { assignValue = convert; } cellValueColumn2 = assignValue; } return; } // Column match if (controller.view.chooseStudentsListBloack_indexes.indexOf(new Integer(3)) == column) { if (newStudent == null) { cellValueColumn3 = null; } else { Object convert = TypeTool.toObject(newStudent.getId()); Object assignValue = null; if (TypeTool.isEnumeratorMethod(newStudent, "id")) { assignValue = controller.convertToString( newStudent.getId(), TypeTool.getAttributeClassNameMethod(newStudent, "id")); } else { assignValue = convert; } cellValueColumn3 = assignValue; } return; } }
/** * Inserts element into ComboxField. Note that this method is generated for all attributes, * regardless if it is a Combobox. Though if their owner isn't a combobox, it has no effect * * @param theStudent the name of the class */ void comboboxStudentnameAddItem(Student theStudent) { ((JComboBox) cellValueColumn1) .addItem( controller.convertToString( theStudent.getName(), TypeTool.getAttributeClassNameMethod(theStudent, "name"))); }