/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package mars.auvtree.nodes;

import java.util.HashMap;
import java.util.List;
import mars.auv.AUV_Manager;
import mars.auv.BasicAUV;
import mars.core.CentralLookup;
import org.openide.nodes.ChildFactory;
import org.openide.nodes.Node;

/**
 *
 * @author Christian Friedrich
 * @author Thomas Tosik
 */
public class ParamChildNodeFactory extends ChildFactory<String> {

    private HashMap params;

    /**
     *
     */
    public static final int ACCUMULATORS = 0;

    /**
     *
     */
    public static final int ACTUATORS = 1;

    /**
     *
     */
    public static final int SENSORS = 2;

    /**
     *
     */
    public static final int PARAMETER = 3;
    private BasicAUV auv;

    /**
     * Constructor for the main categories accumulator, actuator and sensor
     *
     * @param name
     */
    public ParamChildNodeFactory(String name) {
        CentralLookup cl = CentralLookup.getDefault();
        AUV_Manager auv_manager = cl.lookup(AUV_Manager.class);
        auv = (BasicAUV) auv_manager.getAUV(name);
    }

    /**
     *
     * @param toPopulate
     * @return
     */
    @Override
    protected boolean createKeys(List toPopulate) {
        toPopulate.add("" + PARAMETER);
        toPopulate.add("" + ACCUMULATORS);
        toPopulate.add("" + ACTUATORS);
        toPopulate.add("" + SENSORS);
        return true;
    }

    /**
     *
     * @param key
     * @return
     */
    @Override
    protected Node createNodeForKey(String key) {
        Node n = null;
        // create node for every category
        int ikey = Integer.parseInt(key);
        switch (Integer.parseInt(key)) {
            case ACCUMULATORS:
                n = new ParamNode(ikey, auv.getAccumulators());
                break;
            case ACTUATORS:
                n = new ParamNode(ikey, auv.getActuators());
                break;
            case SENSORS:
                n = new ParamNode(ikey, auv.getSensors());
                break;
            case PARAMETER:
                HashMap hasher = new HashMap();
                hasher.put("Parameter", auv.getAuv_param());
                n = new ParamNode(ikey, hasher);
                break;
        }
        return n;
    }
}

@@ -2186,147 +2186,69 @@
     
-HashMap hasher = new HashMap();%0A                hasher.put(%22Parameter%22, auv.getAuv_param());%0A                n = new ParamNode(ikey, hash
+n = new PhysicalExchangerNode(auv.getAuv_param(), %22Paramet
 er
+%22
 );%0A 

Use PhysicalExchangerNode for the Parameters in the tree instead of ParamNode.