private void assignProduct(ProductInfoExt prod) { if (jproduct.isEnabled()) { if (prod == null) { productid = null; productref = null; productcode = null; productname = null; attsetid = null; attsetinstid = null; attsetinstdesc = null; jproduct.setText(null); m_jcodebar.setText(null); m_jreference.setText(null); jattributes.setText(null); } else { productid = prod.getID(); productref = prod.getReference(); productcode = prod.getCode(); productname = prod.toString(); attsetid = prod.getAttributeSetID(); attsetinstid = null; attsetinstdesc = null; jproduct.setText(productname); m_jcodebar.setText(productcode); m_jreference.setText(productref); jattributes.setText(null); // calculo el precio sugerido para la entrada. MovementReason reason = (MovementReason) m_ReasonModel.getSelectedItem(); Double dPrice = reason.getPrice(prod.getPriceBuy(), prod.getPriceSell()); m_jprice.setText(Formats.CURRENCY.formatValue(dPrice)); } } }
/** @param prod */ protected void fireSelectedProduct(ProductInfoExt prod) { EventListener[] l = listeners.getListeners(ActionListener.class); ActionEvent e = null; for (EventListener l1 : l) { if (e == null) { e = new ActionEvent(prod, ActionEvent.ACTION_PERFORMED, prod.getID()); } ((ActionListener) l1).actionPerformed(e); } }