Search in sources :

Example 6 with Radio

use of org.zkoss.zul.Radio in project adempiere by adempiere.

the class WBOMDrop method addDisplay.

//	addBOMLine
/**
	 * 	Add Line to Display
	 *	@param parentM_Product_ID parent product
	 *	@param M_Product_ID product
	 *	@param bomType bom type
	 *	@param name name
	 *	@param lineQty qty
	 */
private void addDisplay(int parentM_Product_ID, int M_Product_ID, String bomType, String name, BigDecimal lineQty) {
    log.fine("M_Product_ID=" + M_Product_ID + ",Type=" + bomType + ",Name=" + name + ",Qty=" + lineQty);
    boolean selected = true;
    Hbox boxQty = new Hbox();
    boxQty.setWidth("100%");
    boxQty.setWidths("10%, 40%, 50%");
    if (MProductBOM.BOMTYPE_StandardPart.equals(bomType)) {
        String title = "";
        Checkbox cb = new Checkbox();
        cb.setLabel(title);
        cb.setChecked(true);
        cb.setEnabled(false);
        m_selectionList.add(cb);
        boxQty.appendChild(cb);
    } else if (MProductBOM.BOMTYPE_OptionalPart.equals(bomType)) {
        String title = Msg.getMsg(Env.getCtx(), "Optional");
        Checkbox cb = new Checkbox();
        cb.setLabel(title);
        cb.setChecked(false);
        selected = false;
        cb.addEventListener(Events.ON_CHECK, this);
        m_selectionList.add(cb);
        boxQty.appendChild(cb);
    } else //	Alternative
    {
        String title = Msg.getMsg(Env.getCtx(), "Alternative") + " " + bomType;
        Radio b = new Radio();
        b.setLabel(title);
        String groupName = String.valueOf(parentM_Product_ID) + "_" + bomType;
        Radiogroup group = m_buttonGroups.get(groupName);
        if (group == null) {
            log.fine("ButtonGroup=" + groupName);
            group = new Radiogroup();
            m_buttonGroups.put(groupName, group);
            group.appendChild(b);
            //	select first one
            b.setSelected(true);
        } else {
            group.appendChild(b);
            b.setSelected(false);
            selected = false;
        }
        b.addEventListener(Events.ON_CLICK, this);
        m_selectionList.add(b);
        boxQty.appendChild(b);
    }
    //	Add to List & display
    m_productList.add(new Integer(M_Product_ID));
    Decimalbox qty = new Decimalbox();
    qty.setValue(lineQty);
    qty.setReadonly(!selected);
    m_qtyList.add(qty);
    Label label = new Label(name);
    HtmlBasedComponent c = (HtmlBasedComponent) label.rightAlign();
    c.setStyle(c.getStyle() + ";margin-right: 5px");
    boxQty.appendChild(c);
    boxQty.appendChild(qty);
    grpSelectProd.appendChild(boxQty);
}
Also used : Hbox(org.zkoss.zul.Hbox) Decimalbox(org.zkoss.zul.Decimalbox) Checkbox(org.adempiere.webui.component.Checkbox) Radiogroup(org.zkoss.zul.Radiogroup) Label(org.adempiere.webui.component.Label) Radio(org.zkoss.zul.Radio) HtmlBasedComponent(org.zkoss.zk.ui.HtmlBasedComponent)

Aggregations

Radio (org.zkoss.zul.Radio)6 MapLayer (au.org.emii.portal.menu.MapLayer)3 Checkbox (org.adempiere.webui.component.Checkbox)2 Radiogroup (org.zkoss.zul.Radiogroup)2 MapComposer (au.org.emii.portal.composer.MapComposer)1 Enumeration (java.util.Enumeration)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Label (org.adempiere.webui.component.Label)1 ListItem (org.adempiere.webui.component.ListItem)1 KeyNamePair (org.compiere.util.KeyNamePair)1 HtmlBasedComponent (org.zkoss.zk.ui.HtmlBasedComponent)1 Decimalbox (org.zkoss.zul.Decimalbox)1 Hbox (org.zkoss.zul.Hbox)1