/** Refreshes the user interface in response to display changes such as Language. */
 protected void refreshGUI() {
   super.refreshGUI();
   resetToolTipText = ControlsRes.ANIMATION_RESET_TIP;
   initToolTipText = ControlsRes.ANIMATION_INIT_TIP;
   startToolTipText = ControlsRes.ANIMATION_START_TIP;
   stopToolTipText = ControlsRes.ANIMATION_STOP_TIP;
   newToolTipText = ControlsRes.ANIMATION_NEW_TIP;
   stepToolTipText = ControlsRes.ANIMATION_STEP_TIP;
   stepBtn.setText(ControlsRes.ANIMATION_STEP);
   stepBtn.setToolTipText(stepToolTipText);
   if (startBtn.getText().equals(startText)) {
     startBtn.setText(ControlsRes.ANIMATION_START);
     startBtn.setToolTipText(startToolTipText);
   } else if (startBtn.getText().equals(stopText)) {
     startBtn.setText(ControlsRes.ANIMATION_STOP);
     startBtn.setToolTipText(stopToolTipText);
   } else {
     startBtn.setText(ControlsRes.ANIMATION_INIT);
     startBtn.setToolTipText(initToolTipText);
   }
   if (resetBtn.getText().equals(newText)) {
     resetBtn.setText(ControlsRes.ANIMATION_NEW);
     resetBtn.setToolTipText(newToolTipText);
   } else {
     resetBtn.setText(ControlsRes.ANIMATION_RESET);
     resetBtn.setToolTipText(resetToolTipText);
   }
   initText = ControlsRes.ANIMATION_INIT;
   startText = ControlsRes.ANIMATION_START;
   resetText = ControlsRes.ANIMATION_RESET;
   stopText = ControlsRes.ANIMATION_STOP;
   newText = ControlsRes.ANIMATION_NEW;
 }
 /** Disposes all resources. */
 public void dispose() {
   if (model instanceof AbstractAnimation) {
     // stops the animation
     ((AbstractAnimation) model).animationThread = null;
   }
   super.dispose();
 }
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
0
 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());
   }
 }
Exemplo n.º 5
0
 /**
  * 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;
 }