This topic provides an example of how to work with the VWAttachmentPanel bean to access attachments stored in Content Engine object stores from Java™ Step Processors or Launch Step Processors.
This method of instantiating VWAttachmentPanel is useful for developers who are not using an IDE, or for anyone interested in understanding how to retrieve attachments without using the VWTabbedPane control. VWTabbedPane includes the VWAttachmentPanel, and supplies other menu items automatically. The following procedure demonstrates how to use VWattachmentPanel separately from VWTabbedPane.
Note: If you use an IDE and have added vwpanel.jar to the classpath for your project, the code for instantiating the VWAttachmentPanel component is added automatically when you drag the component onto a form.
The following example assumes that you declare and initialize these three variables near the top of the class definition:
VWStepElement vwStepElement = null; Frame parentFrame = null; VWSession vwSession = null;
JComponent newJComponent = null; if (vwStepElement.getParameters(VWFieldType.FIELD_TYPE_ATTACHMENT, VWStepElement.FIELD_USER_DEFINED) != null) newJComponent = (JComponent)Beans.instantiate(getClass().getClassLoader(), "filenet.vw.toolkit.runtime.step.beans.VWAttachmentPanel"); if (newJComponent != null) \\While it is not shown here, you should include code to add the JComponent to the \\containing VWPanel to expose the attachment list to the end user. if (newJComponent instanceof IVWStepProcessorComponent) ((IVWStepProcessorComponent)newJComponent).init(vwStepElement, parentFrame, vwSession);