/** * Loads an object with data from an XMLControl. * * @param control the control * @param obj the object * @return the loaded object */ public Object loadObject(XMLControl control, Object obj) { OSPControl cf = (OSPControl) obj; // iterate over properties and add them to table model Iterator it = control.getPropertyNames().iterator(); cf.table.setLockValues(true); while (it.hasNext()) { String name = (String) it.next(); // skip "model" object properties if (name.equals("model") && control.getPropertyType(name).equals("object")) { XMLControl child = control.getChildControl("model"); // $NON-NLS-1$ cf.model = child.loadObject(cf.model); continue; } if (control.getPropertyType(name).equals("string")) { // $NON-NLS-1$ cf.setValue(name, control.getString(name)); } else if (control.getPropertyType(name).equals("int")) { // $NON-NLS-1$ cf.setValue(name, control.getInt(name)); } else if (control.getPropertyType(name).equals("double")) { // $NON-NLS-1$ cf.setValue(name, control.getDouble(name)); } else if (control.getPropertyType(name).equals("boolean")) { // $NON-NLS-1$ cf.setValue(name, control.getBoolean(name)); } else { cf.setValue(name, control.getObject(name)); } } cf.table.setLockValues(false); // XMLControl child = control.getChildControl("model"); //$NON-NLS-1$ // if(child!=null) { // cf.model = child.loadObject(cf.model); // } return obj; }