/**
  * 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;
 }
 protected void saveControlProperites(XMLControl xmlControl, OSPControl ospControl) {
   // save the parameters
   Iterator it = ospControl.getPropertyNames().iterator();
   while (it.hasNext()) {
     String name = (String) it.next();
     Object val = ospControl.getObject(name);
     if (val.getClass() == DoubleArray.class) {
       xmlControl.setValue(name, ((DoubleArray) val).getArray());
     } else if (val.getClass() == IntegerArray.class) {
       xmlControl.setValue(name, ((IntegerArray) val).getArray());
     } else if (val.getClass() == Boolean.class) {
       xmlControl.setValue(name, ((Boolean) val).booleanValue());
     } else if (val.getClass() == Double.class) {
       xmlControl.setValue(name, ((Double) val).doubleValue());
     } else if (val.getClass() == Integer.class) {
       xmlControl.setValue(name, ((Integer) val).intValue());
     } else if (val.getClass().isArray()) {
       xmlControl.setValue(name, val);
     } else {
       xmlControl.setValue(name, val);
     }
     // xmlControl.setValue(name, val.toString());
   }
 }
 /**
  * Creates an OSP control and establishes communication between the control and the model.
  *
  * <p>Custom buttons are usually added to this control to invoke actions in the model.
  *
  * @param model Object
  * @return AnimationControl
  */
 public static OSPControl createApp(Object model) {
   OSPControl control = new OSPControl(model);
   control.setSize(300, 300);
   control.setVisible(true);
   return control;
 }