tags:

views:

11

answers:

0

//Create a factory class that will create a new BeanNode for each customer in your database:

import demo.Customer;
import java.beans.IntrospectionException;
import java.util.List;
import org.openide.nodes.BeanNode;
import org.openide.nodes.ChildFactory;
import org.openide.nodes.Node;
import org.openide.util.Exceptions;

public class CustomerChildFactory extends ChildFactory<Customer> {

    private List<Customer> resultList;

    public CustomerChildFactory(List<Customer> resultList) {
        this.resultList = resultList;
    }

    @Override
    protected boolean createKeys(List<Customer> list) {
        for (Customer Customer : resultList) {
            list.add(Customer);
        }
        return true;
    }

    @Override
    protected Node createNodeForKey(Customer c) {
        try {
            return new BeanNode(c);
        } catch (IntrospectionException ex) {
            Exceptions.printStackTrace(ex);
            return null;
        }
    }

}

above is the step 5(of integrating crud funtionality part) mentioned in the tutorial for crud application in netbeans on the website --- http://platform.netbeans.org/tutorials/nbm-crud.html i m not able to make out where we have to create this factory class ? Is it have to inside CustomerTopComponent.java file or a seperate file CustomerChildFactory.java? also what package name is to be given if a seperate file named CustomerChildFactory.java is to be created? plz guide me.....