use of org.zkoss.image.AImage in project adempiere by adempiere.
the class WPerformanceIndicator method init.
/**
* Init Graph Display
* Kinamo (pelgrim)
*/
private void init() {
JFreeChart chart = createChart();
chart.setBackgroundPaint(null);
chart.setBorderVisible(true);
chart.setBorderPaint(Color.LIGHT_GRAY);
chart.setAntiAlias(true);
BufferedImage bi = chart.createBufferedImage(200, 120, BufferedImage.TRANSLUCENT, null);
try {
byte[] bytes = EncoderUtil.encode(bi, ImageFormat.PNG, true);
AImage image = new AImage("", bytes);
Image myImage = new Image();
myImage.setContent(image);
appendChild(myImage);
} catch (Exception e) {
// TODO: handle exception
}
invalidate();
}
use of org.zkoss.image.AImage in project adempiere by adempiere.
the class WCRP method renderChart.
private void renderChart(JFreeChart jchart) {
BufferedImage bi = jchart.createBufferedImage(700, 500, Transparency.TRANSLUCENT, null);
try {
byte[] bytes = EncoderUtil.encode(bi, ImageFormat.PNG, true);
AImage image = new AImage("", bytes);
chartPanel.removeChild(chart);
chart = new Image();
chart.setContent(image);
chartPanel.appendChild(chart);
chartPanel.setVisible(true);
} catch (Exception e) {
}
}
use of org.zkoss.image.AImage in project adempiere by adempiere.
the class WCRPDetail method renderChart.
private void renderChart(JFreeChart jchart) {
BufferedImage bi = jchart.createBufferedImage(700, 500, Transparency.TRANSLUCENT, null);
try {
byte[] bytes = EncoderUtil.encode(bi, ImageFormat.PNG, true);
AImage image = new AImage("", bytes);
mainLayout.removeChild(west);
chartPanel = new Hbox();
chart = new Image();
chart.setContent(image);
chartPanel.appendChild(chart);
west = new West();
west.appendChild(chartPanel);
west.setSplittable(true);
west.setSize("70%");
west.setAutoscroll(true);
west.setOpen(true);
mainLayout.appendChild(west);
} catch (Exception e) {
log.log(Level.SEVERE, "WCRP.init", e.getMessage());
}
}
use of org.zkoss.image.AImage in project adempiere by adempiere.
the class WWFPanelManufacturing method load.
private void load(int workflowId) {
// Get Workflow
MWorkflow wf = new MWorkflow(Env.getCtx(), workflowId, null);
WFNodeContainer nodeContainer = new WFNodeContainer();
nodeContainer.setWorkflow(wf);
// Add Nodes for Paint
MWFNode[] nodes = wf.getNodes(true, Env.getAD_Client_ID(Env.getCtx()));
for (int i = 0; i < nodes.length; i++) {
WFNode wfn = new WFNode(nodes[i]);
nodeContainer.add(wfn);
// Add Lines
MWFNodeNext[] nexts = nodes[i].getTransitions(Env.getAD_Client_ID(Env.getCtx()));
for (int j = 0; j < nexts.length; j++) nodeContainer.add(new WFLine(nexts[j]));
}
Dimension dimension = nodeContainer.getDimension();
BufferedImage bi = new BufferedImage(dimension.width + 2, dimension.height + 2, BufferedImage.TYPE_INT_ARGB);
nodeContainer.paint(bi.createGraphics());
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
ImageIO.write(bi, "png", os);
AImage imageContent = new AImage("workflow.png", os.toByteArray());
imageMap.setWidth(dimension.width + "px");
imageMap.setHeight(dimension.height + "px");
imageMap.setContent(imageContent);
} catch (Exception e) {
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
}
use of org.zkoss.image.AImage 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