Package stripbandunk.tutorial.treetabledemo.entity

Examples of stripbandunk.tutorial.treetabledemo.entity.Category


        session.beginTransaction();

        Random random = new Random();

        for (int i = 0; i < 10; i++) {
            Category category = new Category("Category " + i);
            session.save(category);
            for (int j = 0; j < 100; j++) {
                Product product = new Product("product" + i + "" + j, "Product " + j + " in Category " + i, random.nextLong(), category);
                session.save(product);
            }
View Full Code Here


        }
    }

    public Object getValueAt(Object node, int column) {
        if (node instanceof Category) {
            Category category = (Category) node;
            return getValueAt(category, column);
        } else if (node instanceof Product) {
            Product product = (Product) node;
            return getValueAt(product, column);
        } else {
View Full Code Here

        return category.getProducts().get(index);
    }

    public Object getChild(Object parent, int index) {
        if (parent instanceof Category) {
            Category category = (Category) parent;
            return getChild(category, index);
        } else if (parent == getRoot()) {
            return categories.get(index);
        } else {
            return null;
View Full Code Here

    public int getChildCount(Object parent) {
        if (parent == getRoot()) {
            return categories.size();
        } else if (parent instanceof Category) {
            Category category = (Category) parent;
            return category.getProducts().size();
        } else {
            return 0;
        }
    }
View Full Code Here

    public int getIndexOfChild(Object parent, Object child) {
        if (parent == getRoot()) {
            return categories.indexOf(child);
        } else if (parent instanceof Category) {
            Category category = (Category) parent;
            return category.getProducts().indexOf(child);
        } else {
            return 0;
        }
    }
View Full Code Here

TOP

Related Classes of stripbandunk.tutorial.treetabledemo.entity.Category

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.