summaryrefslogtreecommitdiffstats
path: root/idrop-lite
diff options
context:
space:
mode:
authorLISA STILLWELL <lisa@simon.(none)>2011-12-13 15:29:21 (GMT)
committer LISA STILLWELL <lisa@simon.(none)>2011-12-13 15:29:21 (GMT)
commit8c92abc179f3b1eb4cda876441d051311a7a91b6 (patch)
tree48a841845ec07274b2359e0e8eb102b054926918 /idrop-lite
parentece3a6b29f37a82dba9734613339ed652ebc9769 (diff)
downloadQCG-Data-8c92abc179f3b1eb4cda876441d051311a7a91b6.zip
QCG-Data-8c92abc179f3b1eb4cda876441d051311a7a91b6.tar.gz
QCG-Data-8c92abc179f3b1eb4cda876441d051311a7a91b6.tar.bz2
[#427] start adding support for overall cancel
Diffstat (limited to 'idrop-lite')
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/PutTransferRunner.java9
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/iDropLiteApplet.java53
-rw-r--r--idrop-lite/src/main/resources/org/irods/jargon/idrop/lite/Bundle.properties1
3 files changed, 58 insertions, 5 deletions
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/PutTransferRunner.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/PutTransferRunner.java
index 3d17f3a..142161b 100644
--- a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/PutTransferRunner.java
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/PutTransferRunner.java
@@ -49,7 +49,14 @@ public class PutTransferRunner implements Runnable {
public void run() {
for (File transferFile : sourceFiles) {
log.info("process a put from source: {}", transferFile.getAbsolutePath());
-
+
+ // handle overall cancel if requested by client
+ if(idropGui.isTransferCancelled()) {
+ log.info("put transfer cancelled by client");
+ idropGui.setTransferCancelled(false);
+ break;
+ }
+
String localSourceAbsolutePath = transferFile.getAbsolutePath();
String sourceResource = idropGui.getIrodsAccount().getDefaultStorageResource();
log.info("initiating put transfer");
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/iDropLiteApplet.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/iDropLiteApplet.java
index f635d3b..8252fc4 100644
--- a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/iDropLiteApplet.java
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/iDropLiteApplet.java
@@ -78,6 +78,7 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
private LocalFileSystemModel localUploadFileModel = null;
private final JFileChooser dlgLocalFileChooser = new JFileChooser();
private Boolean transferInProgress = false;
+ private Boolean transferCancelled = false;
private String currentUploadFile = null;
private ImageIcon cancelIcon;
@@ -863,6 +864,14 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
public Boolean isTransferInProgress() {
return this.transferInProgress;
}
+
+ public void setTransferCancelled(Boolean state) {
+ this.transferCancelled = state;
+ }
+
+ public Boolean isTransferCancelled() {
+ return this.transferCancelled;
+ }
public void cancelTransfer() {
java.awt.EventQueue.invokeLater(new Runnable() {
@@ -1113,6 +1122,7 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
lblUploadTotalFiles = new javax.swing.JLabel();
lblUploadTotalSize = new javax.swing.JLabel();
btnUploadBeginImport = new javax.swing.JButton();
+ btnOverallUploadCancel = new javax.swing.JButton();
pnlOperationMode3 = new javax.swing.JPanel();
pnlDownloadModeTarget = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
@@ -1522,6 +1532,11 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
btnUploadUrl.setFont(new java.awt.Font("Lucida Grande", 0, 12));
btnUploadUrl.setText(org.openide.util.NbBundle.getMessage(iDropLiteApplet.class, "iDropLiteApplet.btnUploadUrl.text")); // NOI18N
+ btnUploadUrl.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnUploadUrlActionPerformed(evt);
+ }
+ });
pnlUploadRefreshButton.add(btnUploadUrl, java.awt.BorderLayout.WEST);
btnUploadLocalRefresh.setFont(new java.awt.Font("Lucida Grande", 0, 12));
@@ -1780,7 +1795,7 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0);
pnlUploadToolbar.add(pnlUploadToolStatus, gridBagConstraints);
- btnUploadBeginImport.setFont(new java.awt.Font("Lucida Grande", 0, 12));
+ btnUploadBeginImport.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
btnUploadBeginImport.setText(org.openide.util.NbBundle.getMessage(iDropLiteApplet.class, "iDropLiteApplet.btnUploadBeginImport.text")); // NOI18N
btnUploadBeginImport.setEnabled(false);
btnUploadBeginImport.setMaximumSize(new java.awt.Dimension(115, 29));
@@ -1798,6 +1813,18 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
gridBagConstraints.weightx = 0.5;
pnlUploadToolbar.add(btnUploadBeginImport, gridBagConstraints);
+ btnOverallUploadCancel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
+ btnOverallUploadCancel.setText(org.openide.util.NbBundle.getMessage(iDropLiteApplet.class, "iDropLiteApplet.btnOverallUploadCancel.text")); // NOI18N
+ btnOverallUploadCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnOverallUploadCancelActionPerformed(evt);
+ }
+ });
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.gridy = 0;
+ pnlUploadToolbar.add(btnOverallUploadCancel, gridBagConstraints);
+
pnlOperationMode2.add(pnlUploadToolbar, java.awt.BorderLayout.SOUTH);
testCardPanel.add(pnlOperationMode2, "card3");
@@ -1816,7 +1843,7 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
txtDownloadTarget.setPreferredSize(new java.awt.Dimension(300, 28));
jPanel1.add(txtDownloadTarget);
- jButton1.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
+ jButton1.setFont(new java.awt.Font("Lucida Grande", 0, 12));
jButton1.setText(org.openide.util.NbBundle.getMessage(iDropLiteApplet.class, "iDropLiteApplet.jButton1.text")); // NOI18N
jButton1.setPreferredSize(new java.awt.Dimension(80, 29));
jButton1.addActionListener(new java.awt.event.ActionListener() {
@@ -1871,7 +1898,7 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
jPanel4.setPreferredSize(new java.awt.Dimension(300, 40));
- bntBeginDownload.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
+ bntBeginDownload.setFont(new java.awt.Font("Lucida Grande", 0, 12));
bntBeginDownload.setText(org.openide.util.NbBundle.getMessage(iDropLiteApplet.class, "iDropLiteApplet.bntBeginDownload.text")); // NOI18N
bntBeginDownload.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -1880,7 +1907,7 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
});
jPanel4.add(bntBeginDownload);
- btnCancelDownload.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
+ btnCancelDownload.setFont(new java.awt.Font("Lucida Grande", 0, 12));
btnCancelDownload.setText(org.openide.util.NbBundle.getMessage(iDropLiteApplet.class, "iDropLiteApplet.btnCancelDownload.text")); // NOI18N
btnCancelDownload.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -2031,12 +2058,30 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
// TODO add your handling code here:
}//GEN-LAST:event_btnCancelDownloadActionPerformed
+ private void btnOverallUploadCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOverallUploadCancelActionPerformed
+ java.awt.EventQueue.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ if(isTransferInProgress()) {
+ setTransferCancelled(true);
+ }
+ }
+
+ });
+ }//GEN-LAST:event_btnOverallUploadCancelActionPerformed
+
+ private void btnUploadUrlActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUploadUrlActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_btnUploadUrlActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bntBeginDownload;
private javax.swing.JButton btnBrowseIRODSUploadDest;
private javax.swing.JButton btnCancelDownload;
private javax.swing.JButton btnIrodsTreeRefresh;
private javax.swing.JButton btnLocalRefresh;
+ private javax.swing.JButton btnOverallUploadCancel;
private javax.swing.JToggleButton btnToggleLocalView;
private javax.swing.JButton btnUploadBeginImport;
private javax.swing.JButton btnUploadCancel;
diff --git a/idrop-lite/src/main/resources/org/irods/jargon/idrop/lite/Bundle.properties b/idrop-lite/src/main/resources/org/irods/jargon/idrop/lite/Bundle.properties
index e1e497a..3e49459 100644
--- a/idrop-lite/src/main/resources/org/irods/jargon/idrop/lite/Bundle.properties
+++ b/idrop-lite/src/main/resources/org/irods/jargon/idrop/lite/Bundle.properties
@@ -33,3 +33,4 @@ iDropLiteApplet.jButton1.text=Browse
iDropLiteApplet.txtDownloadTarget.text=
iDropLiteApplet.bntBeginDownload.text=Begin Download
iDropLiteApplet.btnCancelDownload.text=Cancel
+iDropLiteApplet.btnOverallUploadCancel.text=Cancel