Package org.ofbiz.product.config.ProductConfigWrapper

Examples of org.ofbiz.product.config.ProductConfigWrapper.ConfigOption


        result.put("productionRunId", productionRunId);

        Iterator options = config.getSelectedOptions().iterator();
        HashMap components = new HashMap();
        while (options.hasNext()) {
            ConfigOption co = (ConfigOption)options.next();
            //components.addAll(co.getComponents());
            Iterator selComponents = co.getComponents().iterator();
            while (selComponents.hasNext()) {
                BigDecimal componentQuantity = null;
                GenericValue selComponent = (GenericValue)selComponents.next();
                if (selComponent.get("quantity") != null) {
                    componentQuantity = selComponent.getBigDecimal("quantity");
                }
                if (componentQuantity == null) {
                    componentQuantity = BigDecimal.ONE;
                }
                String componentProductId = selComponent.getString("productId");
                if (co.isVirtualComponent(selComponent)) {
                    Map componentOptions = co.getComponentOptions();
                    if (UtilValidate.isNotEmpty(componentOptions) && UtilValidate.isNotEmpty(componentOptions.get(componentProductId))) {
                        componentProductId = (String)componentOptions.get(componentProductId);
                    }
                }
                componentQuantity = quantity.multiply(componentQuantity);
                if (components.containsKey(componentProductId)) {
                    BigDecimal totalQuantity = (BigDecimal)components.get(componentProductId);
                    componentQuantity = totalQuantity.add(componentQuantity);
                }
                components.put(componentProductId, componentQuantity);

                //  create production run notes from comments
                String comments = co.getComments();
                if (UtilValidate.isNotEmpty(comments)) {
                    resultService.clear();
                    serviceContext.clear();
                    serviceContext.put("workEffortId", productionRunId);
                    serviceContext.put("internalNote", "Y");
                    serviceContext.put("noteInfo", comments);
                    serviceContext.put("noteName", co.getDescription());
                    serviceContext.put("userLogin", userLogin);
                    serviceContext.put("noteParty", userLogin.getString("partyId"));
                    try {
                        resultService = dispatcher.runSync("createWorkEffortNote", serviceContext);
                    } catch (GenericServiceException e) {
View Full Code Here


        public void setupButton(XButton button) {
            this.button = button;
            List options = question.getOptions();
            if (question.isSelected()) {
                ConfigOption selectedOption = question.getSelected();
                showOption = options.indexOf(selectedOption);
            }
            ConfigOption configoption = (ConfigOption)options.get(showOption);
            button.setText(configoption.getDescription());
            return;
        }
View Full Code Here

        } */

        public void buttonClicked() {
            //only two choices, if the button is clicked, toggle
            List options = question.getOptions();
            ConfigOption unselectedoption = (ConfigOption)options.get(showOption);
            unselectedoption.setSelected(false);
            showOption = (showOption+1)%2;
            ConfigOption selectedoption = (ConfigOption)options.get(showOption);
            selectedoption.setSelected(true);
            button.setText(selectedoption.getDescription());
            return;
        }
View Full Code Here

        public void reset() {
            showOption = 0;
            List options = question.getOptions();
            if (question.isSelected()) {
                ConfigOption selectedOption = question.getSelected();
                showOption = options.indexOf(selectedOption);
            }
            ConfigOption configoption = (ConfigOption)options.get(showOption);
            button.setText(configoption.getDescription());
            return;
        }
View Full Code Here

            Iterator options = question.getOptions().iterator();

            DefaultListModel listModel = new DefaultListModel();

            while (options.hasNext()) {
                ConfigOption configoption = (ConfigOption)options.next();
                listModel.addElement(configoption.getDescription());
                //Debug.logInfo("Found option " + configoption.getDescription(), module);
                //Debug.logInfo("IsAvailable: "+configoption.isAvailable()+
                //    ", IsSelected: "+configoption.isSelected(), module);
            }
View Full Code Here

                    List<ConfigOption> options = (List<ConfigOption>)question.getOptions();
                    for (ConfigOption option: options) {
                        option.setSelected(false);
                    }
                    for(int i: selected) {
                        ConfigOption option = options.get(i);
                        option.setSelected(true);
                    }
                    m_configureItem.listPressed();
                }
            }
            catch (Exception ex) {
View Full Code Here

                    // pcw = new ProductConfigWrapper(delegator, session.getDispatcher(), productId, null, null, null, null, null, null);
                    pcw = item.getConfigWrapper();
                    List selected = pcw.getSelectedOptions();
                    Iterator iter = selected.iterator();
                    while (iter.hasNext()) {
                        ConfigOption configoption = (ConfigOption)iter.next();
                        if (configoption.isSelected()) {
                            XModel option = Journal.appendNode(model, "tr", ""+cart.getItemIndex(item), "");
                            Journal.appendNode(option, "td", "sku", "");
                            Journal.appendNode(option, "td", "desc", configoption.getDescription());
                            Journal.appendNode(option, "td", "qty", "");
                            Journal.appendNode(option, "td", "price", UtilFormatOut.formatPrice(configoption.getPrice()));
                            Journal.appendNode(option, "td", "index", Integer.toString(cart.getItemIndex(item)));
                        }
                    }
                }
View Full Code Here

            while (iter.hasNext()) {
                ConfigItem question = (ConfigItem)iter.next();
                List options = question.getOptions();
                Iterator itero = options.iterator();
                while (itero.hasNext()) {
                    ConfigOption configoption = (ConfigOption)itero.next();
                    if (configoption.isSelected()) {
                        listModel.addElement("  "+configoption.getDescription());
                    }
                }
            }
        }
        m_configList.setModel(listModel);
View Full Code Here

            List options = question.getOptions();
            Iterator itero = options.iterator();

            while (itero.hasNext()) {
                ConfigOption configoption = (ConfigOption)itero.next();
                /*Debug.logInfo("Found option " + configoption.getDescription(), module);
                Debug.logInfo("IsAvailable: "+configoption.isAvailable()+
                    ", IsSelected: "+configoption.isSelected(), module);*/
                //configoption.getComponents()
            }
View Full Code Here

                    // pcw = new ProductConfigWrapper(delegator, session.getDispatcher(), productId, null, null, null, null, null, null);
                    pcw = item.getConfigWrapper();
                    List selected = pcw.getSelectedOptions();
                    Iterator iter = selected.iterator();
                    while (iter.hasNext()) {
                        ConfigOption configoption = (ConfigOption)iter.next();
                        if (configoption.isSelected()) {
                            XModel option = Journal.appendNode(model, "tr", ""+cart.getItemIndex(item), "");
                            Journal.appendNode(option, "td", "sku", "");
                            Journal.appendNode(option, "td", "desc", configoption.getDescription());
                            Journal.appendNode(option, "td", "qty", "");
                            Journal.appendNode(option, "td", "price", UtilFormatOut.formatPrice(configoption.getPrice()));
                            Journal.appendNode(option, "td", "index", Integer.toString(cart.getItemIndex(item)));
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.ofbiz.product.config.ProductConfigWrapper.ConfigOption

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.