Examples of MaterialCategory


Examples of org.libreplan.business.materials.entities.MaterialCategory

    }

    public final static MaterialCategory toEntity(
            MaterialCategoryDTO materialCategoryDTO) {
        MaterialCategory materialCategory = toEntityCategory(materialCategoryDTO);

        // find the parent
        if (materialCategoryDTO.parent != null) {
            try {
                MaterialCategory parentCategory = Registry
                        .getMaterialCategoryDAO().findByCode(
                                materialCategoryDTO.parent);
                materialCategory.setParent(parentCategory);
            } catch (InstanceNotFoundException e) {
                throw new ValidationException(
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    }

    public final static MaterialCategory toEntityCategory(
            MaterialCategoryDTO materialCategoryDTO) {

        MaterialCategory materialCategory = MaterialCategory.createUnvalidated(
                StringUtils.trim(materialCategoryDTO.code), StringUtils
                        .trim(materialCategoryDTO.name));

        // Create and add the materials
        if (materialCategoryDTO.materials != null) {
            for (MaterialDTO materialDTO : materialCategoryDTO.materials) {
                materialCategory.addMaterial(toEntity(materialDTO));
            }
        }

        // Create and add the subcategories
        if (materialCategoryDTO.subcategories != null) {
            for (MaterialCategoryDTO subCategoryDTO : materialCategoryDTO.subcategories.materialCategoryDTOs) {
                materialCategory.addSubcategory(toEntitySubCategories(
                        subCategoryDTO, materialCategory));
            }
        }

        return materialCategory;
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    }

    public final static MaterialCategory toEntitySubCategories(
            MaterialCategoryDTO materialCategoryDTO, MaterialCategory parent) {

        MaterialCategory materialCategory = toEntityCategory(materialCategoryDTO);

        // find the parent
        if (materialCategoryDTO.parent != null) {
            if (!materialCategoryDTO.parent.equalsIgnoreCase(parent.getCode())) {
                throw new ValidationException("inconsistent parent code.");
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

                    throw new ValidationException(
                            "missing code in a subcategory");
                }

                try {
                    MaterialCategory subcategory = materialCategory
                        .getSubcategoryByCode(subcategoryDTO.code);
                    updateMaterialCategory(subcategory, subcategoryDTO);
                } catch (InstanceNotFoundException e) {
                        materialCategory
                                .addSubcategory(toEntity(subcategoryDTO));
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

        final Treeitem treeitem = categoriesTree.getSelectedItem();
        return getAssignedMaterials(treeitem);
    }

    private List<A> getAssignedMaterials(Treeitem treeitem) {
        final MaterialCategory materialCategory = (treeitem != null) ? (MaterialCategory) treeitem.getValue() : null;
        return getAssignedMaterials(materialCategory);
    }
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    }

    private Treeitem findMaterialCategoryInTree(MaterialCategory category, Tree tree) {
        for (Iterator i = tree.getItems().iterator(); i.hasNext();) {
            Treeitem treeitem = (Treeitem) i.next();
            final MaterialCategory materialCategory = (MaterialCategory) treeitem
                    .getValue();
            if (category.equals(materialCategory)) {
                return treeitem;
            }
        }
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    /**
     * Search materials on pressing search button
     */
    public void searchMaterials() {
        final String text = txtSearchMaterial.getValue();
        final MaterialCategory materialCategory = getSelectedCategory(allCategoriesTree);
        getModel().searchMaterials(text, materialCategory);
        Util.reloadBindings(lbFoundMaterials);
    }
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    private void reloadTree(Tree tree) {
        final Treeitem treeitem = tree.getSelectedItem();

        if (treeitem != null) {
            final MaterialCategory materialCategory = (MaterialCategory) treeitem.getValue();
            tree.setModel(getMaterialCategories());
            locateAndSelectMaterialCategory(tree, materialCategory);
        } else {
            tree.setModel(getMaterialCategories());
            reloadGridMaterials();
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    @SuppressWarnings("unchecked")
    private Treeitem findTreeItemByMaterialCategory(Component node, MaterialCategory materialCategory) {
        if (node instanceof Treeitem) {
            final Treeitem treeitem = (Treeitem) node;
            final MaterialCategory _materialCategory = (MaterialCategory) treeitem.getValue();
            if (_materialCategory.getId().equals(materialCategory.getId())) {
                return treeitem;
            }
        }
        for (Iterator i = node.getChildren().iterator(); i.hasNext(); ) {
            Object obj = i.next();
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

        /**
         * Copied verbatim from org.zkoss.zul.Tree;
         */
        @Override
        public void render(Treeitem ti, Object node) {
            final MaterialCategory materialCategory = (MaterialCategory) node;

            Label lblName = new Label(materialCategory.getName());

            Treerow tr = null;
            ti.setValue(node);
            if (ti.getTreerow() == null) {
                tr = new Treerow();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.