[ 1909902 ] Attachment upload dialog should support multi selection
This commit is contained in:
parent
9a021a1340
commit
b64464040c
|
@ -398,36 +398,42 @@ public final class Attachment extends CDialog
|
||||||
JFileChooser chooser = new JFileChooser();
|
JFileChooser chooser = new JFileChooser();
|
||||||
chooser.setDialogType(JFileChooser.OPEN_DIALOG);
|
chooser.setDialogType(JFileChooser.OPEN_DIALOG);
|
||||||
chooser.setDialogTitle(Msg.getMsg(Env.getCtx(), "AttachmentNew"));
|
chooser.setDialogTitle(Msg.getMsg(Env.getCtx(), "AttachmentNew"));
|
||||||
|
chooser.setMultiSelectionEnabled(true);
|
||||||
int returnVal = chooser.showOpenDialog(this);
|
int returnVal = chooser.showOpenDialog(this);
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION)
|
if (returnVal != JFileChooser.APPROVE_OPTION)
|
||||||
return;
|
return;
|
||||||
//
|
//
|
||||||
String fileName = chooser.getSelectedFile().getName();
|
File[] files = chooser.getSelectedFiles();
|
||||||
log.config(fileName);
|
for (File file : files) {
|
||||||
File file = chooser.getSelectedFile();
|
int cnt = m_attachment.getEntryCount();
|
||||||
int cnt = m_attachment.getEntryCount();
|
|
||||||
|
//update
|
||||||
//update
|
boolean add = true;
|
||||||
for (int i = 0; i < cnt; i++)
|
for (int i = 0; i < cnt; i++)
|
||||||
{
|
|
||||||
if (m_attachment.getEntryName(i).equals(fileName))
|
|
||||||
{
|
{
|
||||||
if (m_attachment.updateEntry(i, file))
|
if (m_attachment.getEntryName(i).equals(file.getName()))
|
||||||
{
|
{
|
||||||
cbContent.setSelectedItem(fileName);
|
if (m_attachment.updateEntry(i, file))
|
||||||
|
{
|
||||||
|
cbContent.setSelectedItem(file.getName());
|
||||||
|
m_change = true;
|
||||||
|
}
|
||||||
|
add = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (add)
|
||||||
|
{
|
||||||
|
//new
|
||||||
|
if (m_attachment.addEntry(file))
|
||||||
|
{
|
||||||
|
cbContent.addItem(file.getName());
|
||||||
|
cbContent.setSelectedIndex(cbContent.getItemCount()-1);
|
||||||
m_change = true;
|
m_change = true;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//new
|
|
||||||
if (m_attachment.addEntry(file))
|
|
||||||
{
|
|
||||||
cbContent.addItem(fileName);
|
|
||||||
cbContent.setSelectedIndex(cbContent.getItemCount()-1);
|
|
||||||
m_change = true;
|
|
||||||
}
|
|
||||||
} // getFileName
|
} // getFileName
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue