Working with VWAttachmentPanel
About this task
An example is provided here of how to work with the VWAttachmentPanel bean to access attachments. These attachments are stored in object stores by Java™ Step Processors or Launch Step Processors.
This method of instantiating VWAttachmentPanel is useful for the following people:
- Developers who are not using an IDE
- Anyone who is interested in understanding how to retrieve attachments without using the VWTabbedPane control
Note: The code for instantiating the VWAttachmentPanel component is added
automatically in the following circumstances:
- When you drag the component onto a form
- You use an IDE and added
vwpanel.jarto the classpath for your project
- Initialize the bean properly by passing in the following information:
- A VWStepElement object
- A Frame object (the containing parent frame)
- A valid VWSession object
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; - Instantiate the VWAttachmentPanel bean after
testing for the VWStepElement field type:
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);