This topic provides an example of how to work with the VWAttachmentPanel bean to access attachments stored in Content Engine object stores from Java-based Step Processors or Launch Step Processors.
This method of instantiating the VWAttachmentPanel is useful for developers who are not using an IDE (such as IntelliJ IDEA, JBuilder, etc.) capable of supporting the RAD drag-and-drop components packaged in the vwpanel.jar file, or for anyone interested in understanding how to retrieve attachments apart from the VWTabbedPane control. If you are using the drag-and-drop components in an IDE, the code for instantiating the VWAttachmentPanel component is added automatically when you drag the component onto a form.
The VWTabbedPane component includes the VWAttachmentPanel, and the component supplies other menu items automatically. The following procedure demonstrates how to use the VWattachmentPanel control separately from the VWTabbedPane component.
1. To initialize the bean properly pass the following information:
2. The following sample code 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;
3. Next, 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);
}
}