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();
}
}
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();
}
}
Aggregations