Search in sources :

Example 36 with RootModel

use of artisynth.core.workspace.RootModel in project artisynth_core by artisynth.

the class RigidBodyAgent method getPrototypeMap.

protected HashMap<Class, ModelComponent> getPrototypeMap() {
    RootModel root = myMain.getRootModel();
    if (root != null && root != myLastRootModel) {
        myPrototypeMap = new HashMap<Class, ModelComponent>();
        myLastRootModel = root;
    }
    return myPrototypeMap;
}
Also used : RootModel(artisynth.core.workspace.RootModel) ModelComponent(artisynth.core.modelbase.ModelComponent)

Example 37 with RootModel

use of artisynth.core.workspace.RootModel in project artisynth_core by artisynth.

the class RigidBodyConnectorList method getPrototypeMap.

protected HashMap<Class, ModelComponent> getPrototypeMap() {
    RootModel root = myMain.getRootModel();
    if (root != null && root != myLastRootModel) {
        myPrototypeMap = new HashMap<Class, ModelComponent>();
        myLastRootModel = root;
    }
    return myPrototypeMap;
}
Also used : RootModel(artisynth.core.workspace.RootModel) ModelComponent(artisynth.core.modelbase.ModelComponent)

Example 38 with RootModel

use of artisynth.core.workspace.RootModel in project artisynth_core by artisynth.

the class TracingProbePanel method getPrototypeProbe.

protected TracingProbe getPrototypeProbe(String traceableName) {
    TracingProbe tmpProbe = TracingProbe.create(myTraceable, traceableName);
    Class<?> type = tmpProbe.getClass();
    TracingProbe comp = myPrototypeMap.get(type);
    if (comp == null) {
        // look for prototype as the last instance in the
        // container
        RootModel root = myMain.getRootModel();
        for (Probe probe : root.getOutputProbes()) {
            if (type.isAssignableFrom(probe.getClass())) {
                comp = (TracingProbe) probe;
            }
        }
        if (comp == null || !(comp instanceof CopyableComponent)) {
            comp = tmpProbe;
            // try {
            // comp = (TracingProbe)type.newInstance();
            // }
            // catch (Exception e) {
            // throw new InternalErrorException (
            // "cannot create no-args instance of " + type);
            // }
            initializePrototype(comp);
        } else {
            comp = (TracingProbe) ((CopyableComponent) comp).copy(0, null);
        }
        myPrototypeMap.put(type, comp);
    }
    return comp;
}
Also used : RootModel(artisynth.core.workspace.RootModel) CopyableComponent(artisynth.core.modelbase.CopyableComponent) TracingProbe(artisynth.core.probes.TracingProbe) TracingProbe(artisynth.core.probes.TracingProbe) Probe(artisynth.core.probes.Probe)

Example 39 with RootModel

use of artisynth.core.workspace.RootModel in project artisynth_core by artisynth.

the class AxialSpringListWidget method getPrototypeMap.

protected HashMap<Class, ModelComponent> getPrototypeMap() {
    RootModel root = myMain.getRootModel();
    if (root != null && root != myLastRootModel) {
        myPrototypeMap = new HashMap<Class, ModelComponent>();
        myLastRootModel = root;
    }
    return myPrototypeMap;
}
Also used : RootModel(artisynth.core.workspace.RootModel)

Example 40 with RootModel

use of artisynth.core.workspace.RootModel in project artisynth_core by artisynth.

the class ControlPanel method connectToHierarchy.

public void connectToHierarchy() {
    RootModel rootModel = RootModel.getRoot(this);
    if (rootModel != null) {
        setSynchronizeObject(rootModel);
        setFocusableWindowState(rootModel.isFocusable());
    }
    addGlobalValueChangeListener(myRerenderListener);
    pack();
    setVisible(true);
    super.connectToHierarchy();
}
Also used : RootModel(artisynth.core.workspace.RootModel)

Aggregations

RootModel (artisynth.core.workspace.RootModel)44 ModelComponent (artisynth.core.modelbase.ModelComponent)10 InternalErrorException (maspack.util.InternalErrorException)7 IOException (java.io.IOException)6 WayPoint (artisynth.core.probes.WayPoint)4 FileNotFoundException (java.io.FileNotFoundException)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 Probe (artisynth.core.probes.Probe)3 WayPointProbe (artisynth.core.probes.WayPointProbe)3 File (java.io.File)3 Property (maspack.properties.Property)3 ControlPanel (artisynth.core.gui.ControlPanel)2 CompositeComponent (artisynth.core.modelbase.CompositeComponent)2 TracingProbe (artisynth.core.probes.TracingProbe)2 Point (java.awt.Point)2 JFileChooser (javax.swing.JFileChooser)2 JMenuItem (javax.swing.JMenuItem)2 JSeparator (javax.swing.JSeparator)2 CompositeProperty (maspack.properties.CompositeProperty)2 ArgParser (argparser.ArgParser)1