Author: jflesch
Date: 2006-07-18 22:46:16 +0000 (Tue, 18 Jul 2006)
New Revision: 9658
Modified:
trunk/apps/Thaw/src/thaw/i18n/thaw.properties
trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java
Log:
Adding a paste button to the download tab
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2006-07-18 19:47:22 UTC
(rev 9657)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2006-07-18 22:46:16 UTC
(rev 9658)
@@ -113,6 +113,7 @@
thaw.plugin.fetch.loadKeyListFromFile=Load keys from file ...
thaw.plugin.fetch.destinationDirectory=Destination directory
thaw.plugin.fetch.chooseDestination=Choose destination ...
+thaw.plugin.fetch.pasteFromClipboard=Paste from clipboard
## Warnings
thaw.warning.title=Warning
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2006-07-18 19:47:22 UTC
(rev 9657)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2006-07-18 22:46:16 UTC
(rev 9658)
@@ -112,7 +112,9 @@
thaw.plugin.fetch.loadKeyListFromFile=Charger les cl?s d'un fichier ...
thaw.plugin.fetch.destinationDirectory=R?pertoire de destination
thaw.plugin.fetch.chooseDestination=Choisissez la destination ...
+thaw.plugin.fetch.pasteFromClipboard=Coller depuis le presse-papier
+
## Warnings
thaw.warning.title=Avertissement
thaw.warning.isWriting=Attention ! Thaw est entrain d'envoyer des informations
? la node. Il serait pr?f?rable de quitter une fois ces envois finis. Etes-vous
s?r de vouloir quitter ?
Modified: trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java
2006-07-18 19:47:22 UTC (rev 9657)
+++ trunk/apps/Thaw/src/thaw/plugins/fetchPlugin/FetchPanel.java
2006-07-18 22:46:16 UTC (rev 9658)
@@ -15,6 +15,13 @@
import java.awt.Dimension;
import javax.swing.JFileChooser;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.ClipboardOwner;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+
import java.io.File;
import java.util.Vector;
import java.util.Iterator;
@@ -32,6 +39,7 @@
private JPanel filePanel = null;
private JLabel fileLabel = null;
private JTextArea fileList = null;
+ private JButton pasteButton = null;
private JButton loadListButton = null;
@@ -42,13 +50,6 @@
private String[] priorities = null;
private JComboBox prioritySelecter = null;
- /*
- private JPanel persistencePanel = null;
- private JLabel persistenceLabel = null;
- private String[] persistences = null;
- private JComboBox persistenceSelecter = null;
- */
-
private JLabel destinationLabel = null;
private JPanel dstChoosePanel = null; /* 3 x 1 */
private JTextField destinationField = null;
@@ -88,10 +89,18 @@
loadListButton = new
JButton(I18n.getMessage("thaw.plugin.fetch.loadKeyListFromFile"));
loadListButton.addActionListener(this);
+
+ pasteButton = new
JButton(I18n.getMessage("thaw.plugin.fetch.pasteFromClipboard"));
+ pasteButton.addActionListener(this);
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new GridLayout(1,2));
+ buttonPanel.add(pasteButton);
+ buttonPanel.add(loadListButton);
+
filePanel.add(fileLabel, BorderLayout.NORTH);
filePanel.add(new JScrollPane(fileList), BorderLayout.CENTER);
- filePanel.add(loadListButton, BorderLayout.SOUTH);
+ filePanel.add(buttonPanel, BorderLayout.SOUTH);
belowPanel = new JPanel();
@@ -119,23 +128,7 @@
priorityPanel.add(priorityLabel);
priorityPanel.add(prioritySelecter);
- /* PERSISTENCE */ /* set always to "forever" */
- /*
- persistencePanel = new JPanel();
- persistencePanel.setLayout(new GridLayout(2, 1, 5, 5));
- persistenceLabel = new
JLabel(I18n.getMessage("thaw.common.persistence"));
- persistences = new String[] {
- I18n.getMessage("thaw.common.persistenceReboot"),
- I18n.getMessage("thaw.common.persistenceForever"),
- I18n.getMessage("thaw.common.persistenceConnection")
- };
- persistenceSelecter = new JComboBox(persistences);
-
- persistencePanel.add(persistenceLabel);
- persistencePanel.add(persistenceSelecter);
- */
-
/* QUEUE */
queuePanel = new JPanel();
queuePanel.setLayout(new GridLayout(2, 1, 5, 5));
@@ -190,17 +183,8 @@
public void actionPerformed(java.awt.event.ActionEvent e) {
if(e.getSource() == validationButton) {
int priority = 6;
- //int persistence = 0;
boolean globalQueue = true;
- /*
-
if(((String)persistenceSelecter.getSelectedItem()).equals(I18n.getMessage("thaw.common.persistenceForever")))
- persistence = 0;
-
if(((String)persistenceSelecter.getSelectedItem()).equals(I18n.getMessage("thaw.common.persistenceReboot")))
- persistence = 1;
-
if(((String)persistenceSelecter.getSelectedItem()).equals(I18n.getMessage("thaw.common.persistenceConnection")))
- persistence = 2;
- */
if(((String)queueSelecter.getSelectedItem()).equals(I18n.getMessage("thaw.common.false")))
globalQueue = false;
@@ -218,13 +202,7 @@
- /*
fetchPlugin.fetchFiles(fileList.getText().split("\n"),
- priority, persistence,
globalQueue,
- destinationField.getText());
- */
-
- fetchPlugin.fetchFiles(fileList.getText().split("\n"),
priority, 0, globalQueue,
destinationField.getText());
@@ -259,6 +237,28 @@
}
+ if(e.getSource() == pasteButton) {
+ Toolkit tk = Toolkit.getDefaultToolkit();
+ Clipboard cp = tk.getSystemClipboard();
+
+ try {
+ String result;
+ Transferable contents = cp.getContents(null);
+
+ boolean hasTransferableText = ((contents !=
null) &&
+
contents.isDataFlavorSupported(DataFlavor.stringFlavor));
+
+ if ( hasTransferableText ) {
+ result =
(String)contents.getTransferData(DataFlavor.stringFlavor);
+ fileList.setText(fileList.getText() +
"\n" + result);
+ } else {
+ Logger.info(this, "Nothing to get from
clipboard");
+ }
+ } catch(Exception exception) {
+ Logger.notice(this, "Exception while pasting:
"+exception.toString());
+ }
+ }
+
if(e.getSource() == loadListButton) {
FileChooser fileChooser = new FileChooser();
File toParse = null;