Package net.caece.fmII.hibernate.vo

Examples of net.caece.fmII.hibernate.vo.BomForm


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

        objToView(form);
       
        focusOn(form);
    }
View Full Code Here


        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) {
                iae.printStackTrace();
View Full Code Here

        // 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();

            if (var.getParentBomId() != null && var.getParentBomId().equals(form.getBomId())) {
                childCount++;
            }
        }
        if (childCount > 0) {
            showMsg("要刪除的設備及耗材, 還有附屬的設備或耗材", "錯誤的操作");
View Full Code Here

    }

    public void objToView(Object obj) {

        BomForm form = (BomForm) obj;

        Listbox buildingListbox = (Listbox) getFellow("buildingListbox");
        Textbox floorTB = (Textbox) getFellow("floor");
        Textbox regionTB = (Textbox) getFellow("region");
        Combobox systemCB = (Combobox) getFellow("system");
        Combobox equipmentCB = (Combobox) getFellow("equipment");

        floorTB.setText(form.getFloor());
        regionTB.setText(form.getRegion());
        Iterator systemCBItr = systemCB.getItems().iterator();
        while (systemCBItr.hasNext()) {
            Comboitem item = (Comboitem) systemCBItr.next();
            if (item.getValue().toString().equals(form.getSystemType())) {
                systemCB.setSelectedItem(item);
            }
        }
        initEquipmentBySystem();

        Iterator equipmentCBItr = equipmentCB.getItems().iterator();
        while (equipmentCBItr.hasNext()) {
            Comboitem item = (Comboitem) equipmentCBItr.next();
            Equipment equ = (Equipment) item.getValue();
            if (equ.getEquipmentId().equals(form.getEquipmentId())) {
                equipmentCB.setSelectedItem(item);
            }
        }

        Textbox supplierNameTB = (Textbox) getFellow("supplierName");
        Combobox priorityCB = (Combobox) getFellow("priority");
        Textbox propertyCodeTB = (Textbox) getFellow("propertyCode");
        Textbox descriptionTB = (Textbox) getFellow("description");


        supplierNameTB.setText(form.getSupplierShortName());
        Iterator priorityCBItr = priorityCB.getItems().iterator();
        while (priorityCBItr.hasNext()) {
            Comboitem item = (Comboitem) priorityCBItr.next();
            if (item.getValue().toString().equals(form.getPriority())) {
                priorityCB.setSelectedItem(item);
            }
        }
        propertyCodeTB.setText(form.getPropertyCode());
        descriptionTB.setText(form.getDescription());




View Full Code Here

            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) {
View Full Code Here

    public void refreshObjEntities() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    private SimpleTreeNode prepareRootNode(List data) {
        BomForm root = new BomForm();
        root.setEquipmentName("");

        ArrayList mother = new ArrayList();
        Iterator it = data.iterator();
        while (it.hasNext()) {
            BomForm form = (BomForm) it.next();
            if (form.getParentBomId() == null) {

                ArrayList subList = getSubList(form, data);
                SimpleTreeNode stn = new SimpleTreeNode(form, subList);
                mother.add(stn);
            }
View Full Code Here

    private ArrayList getSubList(BomForm form, List data) {
        ArrayList subList = new ArrayList();
        Iterator it = data.iterator();

        while (it.hasNext()) {
            BomForm var = (BomForm) it.next();
            if ((var.getBomId() != form.getBomId())
                    && var.getParentBomId() != null
                    && form.getBomId().toString().equals(var.getParentBomId().toString())) {

                SimpleTreeNode stn = new SimpleTreeNode(var, getSubList(
                        var, data));
                subList.add(stn);
            }
View Full Code Here

TOP

Related Classes of net.caece.fmII.hibernate.vo.BomForm

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.