*/
public JaspiraEventHandlerCode popup(InteractionEvent ie)
{
if (ie.isDataFlavorSupported(ClientFlavors.PROCESS_ITEM))
{
final ProcessItem process = (ProcessItem) ie.getSafeTransferData(ClientFlavors.PROCESS_ITEM);
JaspiraAction action = new JaspiraAction(ImageExportPlugin.this, "export")
{
public void actionPerformed(ActionEvent ae)
{
int type = OptionMgr.getInstance().getIntegerOption("imageexporter.imagetype", SupportedImageTypes.DEFAULT);
final String typeName = (String) SupportedImageTypes.NAME_BY_IMAGE_TYPE.get(new Integer(type));
final String ext = "." + typeName;
JFileChooser jfc = new JFileChooser();
jfc.setFileFilter(new FileFilter()
{
/**
* @see javax.swing.filechooser.FileFilter#accept(java.io.File)
*/
public boolean accept(File f)
{
String fileName = f.getName();
if (fileName.endsWith(ext))
return true;
return false;
}
/**
* @see javax.swing.filechooser.FileFilter#getDescription()
*/
public String getDescription()
{
return typeName.toUpperCase() + " Files";
}
});
String fileName = process.getName() + ext;
jfc.setSelectedFile(new File(fileName));
int result = jfc.showSaveDialog(null);
if (result == JFileChooser.APPROVE_OPTION)
{