Package org.zkoss.zul

Examples of org.zkoss.zul.Tree


   
    public void add() {

        // insert into database
        Bom obj = (Bom) viewToObj(null);
        Tree objTree = (Tree) getFellow("objTree");

        if (objTree.getSelectedItem() != null) {
            SimpleTreeNode node = (SimpleTreeNode) objTree.getSelectedItem().getValue();
            BomForm parentBomForm = (BomForm) node.getData();
            Bom parentBom = new Bom();
            try {
                BeanUtils.copyProperties(parentBom, parentBomForm);
            } catch (Exception iae) {
View Full Code Here


    }

    public void update() {

        // get original data
        Tree objTree = (Tree) getFellow("objTree");
        Treeitem selectedtem = objTree.getSelectedItem();
        SimpleTreeNode selectedNode = (SimpleTreeNode) selectedtem.getValue();
        BomForm form = (BomForm) selectedNode.getData();

        if (form.getParentBomId() != null) {
            Collection items = objTree.getItems();
            Iterator it = items.iterator();
            while (it.hasNext()) {
                Treeitem item = (Treeitem) it.next();
                SimpleTreeNode node = (SimpleTreeNode) item.getValue();
                BomForm var = (BomForm) node.getData();

                if (var.getBomId().equals(form.getParentBomId())) {
                    form.setParentBom(var);
                }
            }
        }

        // get new value from the view, then update to the database
        Bom obj = (Bom) viewToObj(form);
        BomDao dao = new BomDao();
        dao.update(obj);

        // refresh bom by building
        selectBomByBuilding();

        // set selected
        Collection items = objTree.getItems();
        Iterator it = items.iterator();
        while (it.hasNext()) {
            Treeitem item = (Treeitem) it.next();
            SimpleTreeNode node = (SimpleTreeNode) item.getValue();
            BomForm var = (BomForm) node.getData();

            if (var.getBomId().equals(obj.getBomId())) {
                objTree.setSelectedItem(item);
            }
        }


    }
View Full Code Here

    }

    public void delete() {
        // get original data
        Tree objTree = (Tree) getFellow("objTree");
        Treeitem selectedtem = objTree.getSelectedItem();
        SimpleTreeNode selectedNode = (SimpleTreeNode) selectedtem.getValue();
        BomForm form = (BomForm) selectedNode.getData();


        int childCount = 0;
        Collection items = objTree.getItems();
        Iterator it = items.iterator();
        while (it.hasNext()) {
            Treeitem item = (Treeitem) it.next();
            SimpleTreeNode node = (SimpleTreeNode) item.getValue();
            BomForm var = (BomForm) node.getData();
View Full Code Here

    public void query() {

        Combobox equipmentCB = (Combobox) getFellow("equipment");
        EquipmentForm ef = (EquipmentForm) equipmentCB.getSelectedItem().getValue();

        Tree objTree = (Tree) getFellow("objTree");

        Collection items = objTree.getItems();

        if (queryMatched == null) {
            queryMatched = new ArrayList();
            Iterator it = items.iterator();
            while (it.hasNext()) {
                Treeitem item = (Treeitem) it.next();
                SimpleTreeNode node = (SimpleTreeNode) item.getValue();
                BomForm var = (BomForm) node.getData();
                if (var.getEquipmentName().equals(ef.getEquipmentName())) {
                    queryMatched.add(item);
                }
            }
        }
        if (queryMatched.size() == 0) {
            showMsg("找不到相符的資料", "無效的操作");
            selectBomByBuilding();
        } else {
            objTree.setSelectedItem((Treeitem) queryMatched.get(queryCount));
            select();
            queryCount++;
            if (queryCount == queryMatched.size()) {
                queryCount = 0;
            }
View Full Code Here

        return subList;
    }

    public void select() {
        Tree objTree = (Tree) getFellow("objTree");
        Treeitem item = objTree.getSelectedItem();
        SimpleTreeNode node = (SimpleTreeNode) item.getValue();
        BomForm form = (BomForm) node.getData();

        objToView(form);
       
View Full Code Here

    public void dataAuth() {
        objListbox = (Listbox) getFellow("objListbox");
        AuthForm authForm = (AuthForm) objListbox.getSelectedItem().getValue();

        Tree orgObjTree = (Tree) getFellow("orgObjTree");
        Set selectedOrgs = orgObjTree.getSelectedItems();

        DataAuthDao daDao = new DataAuthDao();

        Iterator selectedOrgsItr = selectedOrgs.iterator();
        while (selectedOrgsItr.hasNext()) {
View Full Code Here

    }

    public void deDataAuth() {

        Tree dataAuthObjTree = (Tree) getFellow("dataAuthObjTree");
        Set selectedDataAuths = dataAuthObjTree.getSelectedItems();

        DataAuthDao daDao = new DataAuthDao();

        Iterator selectedDataAuthItr = selectedDataAuths.iterator();
        while (selectedDataAuthItr.hasNext()) {
View Full Code Here

    public void funAuth() {
        objListbox = (Listbox) getFellow("objListbox");
        AuthForm authForm = (AuthForm) objListbox.getSelectedItem().getValue();

        Tree funObjTree = (Tree) getFellow("funObjTree");
        Set selectedFuns = funObjTree.getSelectedItems();

        FunAuthDao faDao = new FunAuthDao();

        Iterator selectedFunsItr = selectedFuns.iterator();
        while (selectedFunsItr.hasNext()) {
View Full Code Here

        refresheFunAuth(authForm);
    }

    public void deFunAuth() {

        Tree funAuthObjTree = (Tree) getFellow("funAuthObjTree");
        Set selectedFunAuths = funAuthObjTree.getSelectedItems();

        FunAuthDao faDao = new FunAuthDao();

        Iterator selectedFunAuthItr = selectedFunAuths.iterator();
        while (selectedFunAuthItr.hasNext()) {
View Full Code Here

            }
        }



        Tree orgObjTree = (Tree) getFellow("orgObjTree");

        SimpleTreeModel treeModel = new SimpleTreeModel(
                prepareOrgRootNode(orgObjList));

        orgObjTree.setModel(treeModel);
        orgObjTree.setTreeitemRenderer(orgObjTreeRenderer);
        orgObjTree.addEventListener(Events.ON_SELECT, new MyTreeSelectionListener(orgObjTree));


        Tree dataAuthObjTree = (Tree) getFellow("dataAuthObjTree");

        SimpleTreeModel dataAuthTreeModel = new SimpleTreeModel(
                prepareDataAuthRootNode(dataAuthObjList));

        dataAuthObjTree.setModel(dataAuthTreeModel);
        dataAuthObjTree.setTreeitemRenderer(dataAuthObjTreeRenderer);
        dataAuthObjTree.addEventListener(Events.ON_SELECT, new MyTreeSelectionListener(orgObjTree));


    }
View Full Code Here

TOP

Related Classes of org.zkoss.zul.Tree

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.