Search in sources :

Example 1 with ProductInfo

use of org.adempiere.pos.service.ProductInfo in project adempiere by adempiere.

the class POSInfoProduct method setValuesFromProduct.

/**
	 * Set Values from product
	 * @param productId
	 * @param imageId
	 * @return void
	 */
private void setValuesFromProduct(int productId, BigDecimal quantity, int imageId, int priceListId, int partnerId) {
    if (productId <= 0)
        return;
    //	Refresh Values
    labelPriceName.setText(Msg.parseTranslation(ctx, "@PriceStd@ , @PriceList@ ") + posPanel.getCurSymbol());
    ProductInfo productInfo = new ProductInfo(productId, quantity, imageId, priceListId, partnerId);
    labelValue.setText(productInfo.value);
    //labelPriceLimit.setText(posPanel.getNumberFormat().format(warehousePrice.getPriceLimit()));
    labelPrice.setText(posPanel.getNumberFormat().format(productInfo.priceStd));
    labelPriceList.setText(posPanel.getNumberFormat().format(productInfo.priceList));
    labelName.setText(productInfo.name);
    labelUOMSymbol.setText(productInfo.uomSymbol);
    labelProductCategory.setText(productInfo.productCategoryName);
    labelProductTax.setText(productInfo.productTaxCategory);
    posPanel.updateProductPlaceholder(productInfo.name);
    String description = productInfo.description;
    if (description == null)
        description = "-";
    labelDescription.setText(description.trim());
    //	Set Image
    if (productInfo.imageData != null) {
        try {
            BufferedImage image = ImageIO.read(new ByteArrayInputStream(productInfo.imageData));
            Image imgResized = image.getScaledInstance(BUTTON_SIZE, BUTTON_SIZE, Image.SCALE_SMOOTH);
            buttonImage.setIcon(new ImageIcon(imgResized));
        } catch (IOException e) {
        }
    } else {
        buttonImage.setIcon(null);
        buttonImage.invalidate();
    }
}
Also used : ProductInfo(org.adempiere.pos.service.ProductInfo) ImageIcon(javax.swing.ImageIcon) ByteArrayInputStream(java.io.ByteArrayInputStream) IOException(java.io.IOException) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) BufferedImage(java.awt.image.BufferedImage)

Example 2 with ProductInfo

use of org.adempiere.pos.service.ProductInfo in project adempiere by adempiere.

the class WPOSInfoProduct method setValuesFromProduct.

/**
	 * setValuesFromProduct
	 * @param productId
	 * @param imageId
     */
public void setValuesFromProduct(int productId, BigDecimal quantity, int imageId, int priceListId, int partnerId) {
    if (productId <= 0) {
        initialValue();
        return;
    }
    //	Refresh Values
    ProductInfo productInfo = new ProductInfo(productId, quantity, imageId, priceListId, partnerId);
    labelPriceName.setText(Msg.parseTranslation(ctx, "@PriceStd@ , @PriceList@ ") + posPanel.getCurSymbol());
    labelValue.setText(productInfo.value);
    labelPrice.setText(posPanel.getNumberFormat().format(productInfo.priceStd));
    labelPriceList.setText(posPanel.getNumberFormat().format(productInfo.priceList));
    labelName.setText(productInfo.name);
    labelUOMSymbol.setText(productInfo.uomSymbol);
    labelProductCategory.setText(productInfo.productCategoryName);
    labelProductTax.setText(productInfo.productTaxCategory);
    labelDescription.setText(productInfo.description);
    posPanel.updateProductPlaceholder(productInfo.name);
    if (productInfo.imageData != null) {
        North nt = new North();
        Borderlayout mainLayout = new Borderlayout();
        AImage img = null;
        byte[] data = productInfo.imageData;
        if (data != null && data.length > 0) {
            try {
                img = new AImage(null, data);
            } catch (Exception e) {
            }
        }
        Image bImg = new Image();
        bImg.setContent(img);
        bImg.setWidth("100%");
        bImg.setHeight("100px");
        nt.appendChild(bImg);
        buttonImage.setClass("z-button");
        mainLayout.appendChild(nt);
        mainLayout.setStyle("background-color: transparent");
        nt.setStyle("background-color: transparent");
        buttonImage.getChildren().clear();
        buttonImage.appendChild(mainLayout);
        buttonImage.invalidate();
        infoProductLayout.invalidate();
        labelLayout.invalidate();
        buttonPanel.invalidate();
    } else {
        buttonImage.getChildren().clear();
        buttonImage.invalidate();
    }
}
Also used : ProductInfo(org.adempiere.pos.service.ProductInfo) AImage(org.zkoss.image.AImage) North(org.zkoss.zkex.zul.North) Borderlayout(org.adempiere.webui.component.Borderlayout) AImage(org.zkoss.image.AImage) Image(org.zkoss.zul.Image)

Aggregations

ProductInfo (org.adempiere.pos.service.ProductInfo)2 Image (java.awt.Image)1 BufferedImage (java.awt.image.BufferedImage)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 ImageIcon (javax.swing.ImageIcon)1 Borderlayout (org.adempiere.webui.component.Borderlayout)1 AImage (org.zkoss.image.AImage)1 North (org.zkoss.zkex.zul.North)1 Image (org.zkoss.zul.Image)1