package com.vci.client.workflow.task; import java.awt.BorderLayout; import java.awt.Color; import java.awt.FlowLayout; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import com.vci.client.workflow.delegate.ProcessCustomClientDelegate; import com.vci.corba.common.VCIError; public class ViewExecutionImagePanel extends JPanel { private String taskName; private String executionId; public ViewExecutionImagePanel(String processDefinitionId) { this(processDefinitionId, null); } public ViewExecutionImagePanel(String executionId, String taskName) { this.executionId = executionId; this.taskName = taskName; initUI(); initData(); } private void initData() { ProcessCustomClientDelegate processCustomClientDelegate = new ProcessCustomClientDelegate(); try { byte[] processChart = processCustomClientDelegate.getExecutionImageByExecutionId(executionId, taskName); InputStream buffin = new ByteArrayInputStream(processChart, 0, processChart.length); BufferedImage bi = ImageIO.read(buffin); ImageIcon icon = new ImageIcon(bi); flowChartLabel.setIcon(icon); } catch (IOException e) { e.printStackTrace(); } catch (VCIError e) { e.printStackTrace(); } } private void initUI() { setBackground(Color.WHITE); setLayout(new BorderLayout(0, 0)); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBackground(Color.WHITE); add(scrollPane); JPanel panel = new JPanel(); panel.setBackground(Color.WHITE); scrollPane.setViewportView(panel); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); flowChartLabel = new JLabel(); panel.add(flowChartLabel); flowChartLabel.setBackground(Color.WHITE); } /** * */ private static final long serialVersionUID = 1L; private JLabel flowChartLabel; }