Search in sources :

Example 6 with MProductBOM

use of org.compiere.model.MProductBOM in project adempiere by adempiere.

the class myJTree method action_reloadBOM.

//	action_fillTree
private void action_reloadBOM() {
    //m_frame.setBusy(true);
    m_frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    reload = true;
    //int M_Product_ID = getM_Product_ID();
    int M_Product_ID = m_selected_id;
    if (M_Product_ID == 0)
        return;
    MProduct M_Product = MProduct.get(getCtx(), M_Product_ID);
    treeInfo.setText("    Current Selection: " + M_Product.getValue());
    Vector<Object> line = new Vector<Object>(17);
    //  0 Select
    line.add(new Boolean(false));
    //  1 IsActive
    line.add(new Boolean(M_Product.isActive()));
    // 2 Line
    line.add(new Integer(0));
    KeyNamePair pp = new KeyNamePair(M_Product.getM_Product_ID(), M_Product.getValue().concat("_").concat(M_Product.getName()));
    //  3 M_Product_ID
    line.add(pp);
    MUOM u = new MUOM(M_Product.getCtx(), M_Product.getC_UOM_ID(), M_Product.get_TrxName());
    KeyNamePair uom = new KeyNamePair(M_Product.getC_UOM_ID(), u.getUOMSymbol());
    //  4 C_UOM_ID
    line.add(uom);
    //  5 QtyBOM
    line.add(Env.ONE);
    DefaultMutableTreeNode parent = new DefaultMutableTreeNode(line);
    dataBOM.clear();
    if (isImplosion()) {
        for (MProductBOM bomline : getParentBOMs(M_Product_ID)) {
            addParent(bomline, parent);
        }
    //m_tree = new myJTree(parent);
    } else {
        /*			m_childEn = m_selectedNode.children();
			Vector<Object> line = new Vector<Object>(17);
			while (m_childEn != null && m_childEn.hasMoreElements())
			{
				DefaultMutableTreeNode nd = (DefaultMutableTreeNode)m_childEn.nextElement();
				//String[] uo = (String[])nd.getUserObject();
				line.add(nd.getUserObject());
				dataBOM.add( line);
			}
*/
        for (MProductBOM bom : getChildBOMs(M_Product_ID, true)) {
            addChild(bom, parent);
        }
    //m_tree = new myJTree(parent);
    }
    //m_tree.addTreeSelectionListener(this);
    //treePane.getViewport().add (m_tree, null);
    loadTableBOM();
    //m_frame.setBusy(false);
    m_frame.setCursor(Cursor.getDefaultCursor());
}
Also used : MProduct(org.compiere.model.MProduct) MUOM(org.compiere.model.MUOM) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) MProductBOM(org.compiere.model.MProductBOM) KeyNamePair(org.compiere.util.KeyNamePair) Vector(java.util.Vector)

Aggregations

MProductBOM (org.compiere.model.MProductBOM)6 MProduct (org.compiere.model.MProduct)5 Vector (java.util.Vector)4 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)4 MUOM (org.compiere.model.MUOM)4 KeyNamePair (org.compiere.util.KeyNamePair)4 BigDecimal (java.math.BigDecimal)2 MBOMProduct (org.compiere.model.MBOMProduct)1 Separator (org.zkoss.zul.Separator)1