summaryrefslogtreecommitdiffstats
path: root/idrop-swing
diff options
context:
space:
mode:
authorMike Conway <michael.c.conway@gmail.com>2011-11-07 15:27:29 (GMT)
committer Mike Conway <michael.c.conway@gmail.com>2011-11-07 15:27:29 (GMT)
commit55545904ef9f8475b6babc3e8da0bf376a2af6f6 (patch)
tree2445d9a0845ed8719212bd32a50349c60321eaef /idrop-swing
parent6e0a89d637b3ca029c5ee65afd412b90ff7bd6a1 (diff)
downloadQCG-Data-55545904ef9f8475b6babc3e8da0bf376a2af6f6.zip
QCG-Data-55545904ef9f8475b6babc3e8da0bf376a2af6f6.tar.gz
QCG-Data-55545904ef9f8475b6babc3e8da0bf376a2af6f6.tar.bz2
[#318] drag/select feedback missing on some platforms - fix finder too
Diffstat (limited to 'idrop-swing')
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java16
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/finder/FinderOutlineRenderProvider.java55
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.java58
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderTree.java6
-rw-r--r--idrop-swing/src/main/resources/log4j.properties2
5 files changed, 93 insertions, 44 deletions
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java
index f58772e..0e79c20 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java
@@ -255,13 +255,13 @@ public class iDrop extends javax.swing.JFrame implements ActionListener,
lblTransferByteCounts.setText("Current File (kb):"
+ (ts.getBytesTransfered() / 1024) + " / "
+ (ts.getTotalSize() / 1024));
-
+
log.debug("transferred so far:{}", ts.getBytesTransfered());
log.debug("total bytes:{}", ts.getTotalSize());
float rawPct = (float) ts.getBytesTransfered() / ts.getTotalSize();
- int percentDone = (int) (rawPct * 100F);
+ int percentDone = (int) (rawPct * 100F);
log.info("pct done:{}", percentDone);
-
+
progressIntraFile.setValue(percentDone);
} else if (ts.getTransferState() == TransferStatus.TransferState.IN_PROGRESS_START_FILE) {
@@ -274,13 +274,13 @@ public class iDrop extends javax.swing.JFrame implements ActionListener,
progressIntraFile.setMaximum(100);
progressIntraFile.setValue(0);
lblCurrentFile.setText(IDropUtils.abbreviateFileName(ts.getSourceFileAbsolutePath()));
- lblTransferFilesCounts.setText("Files: "
+ lblTransferFilesCounts.setText("Files: "
+ ts.getTotalFilesTransferredSoFar() + " / "
+ ts.getTotalFilesToTransfer());
} else if (ts.getTransferState() == TransferStatus.TransferState.IN_PROGRESS_COMPLETE_FILE) {
-
+
progressIntraFile.setValue(100);
lblTransferByteCounts.setText("Current File (kb):"
+ (ts.getTotalSize() / 1024) + " / "
@@ -302,7 +302,7 @@ public class iDrop extends javax.swing.JFrame implements ActionListener,
+ (ts.getBytesTransfered() / 1024) + " / "
+ (ts.getTotalSize() / 1024));
-
+
lblCurrentFile.setText(IDropUtils.abbreviateFileName(ts.getSourceFileAbsolutePath()));
}
}
@@ -957,7 +957,7 @@ public class iDrop extends javax.swing.JFrame implements ActionListener,
} else {
log.info("using root path, no login preset");
root.setPathOrName("/");
- root.setObjectType(CollectionAndDataObjectListingEntry.ObjectType.COLLECTION);
+ root.setObjectType(CollectionAndDataObjectListingEntry.ObjectType.COLLECTION);
}
IRODSOutlineModel mdl = null;
log.info("building new iRODS tree");
@@ -1127,7 +1127,7 @@ public class iDrop extends javax.swing.JFrame implements ActionListener,
txtComment.setText(tagValue.getTagData());
}
- pnlInfoIcon.removeAll();
+ pnlInfoIcon.removeAll();
pnlInfoIcon.add(IconHelper.getFileIcon());
pnlInfoIcon.validate();
lblInfoCreatedAtValue.setText(df.format(dataObject.getCreatedAt()));
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/FinderOutlineRenderProvider.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/FinderOutlineRenderProvider.java
new file mode 100644
index 0000000..b232eee
--- /dev/null
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/FinderOutlineRenderProvider.java
@@ -0,0 +1,55 @@
+
+package org.irods.jargon.idrop.finder;
+
+import org.irods.jargon.idrop.desktop.systraygui.viscomponents.*;
+import java.text.DateFormat;
+import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import org.netbeans.swing.outline.RenderDataProvider;
+
+/**
+ * @author Mike Conway - DICE (www.irods.org)
+ */
+public class FinderOutlineRenderProvider implements RenderDataProvider {
+ private final IRODSFinderTree tree;
+ private final DateFormat dateFormat = DateFormat.getDateTimeInstance();
+
+ public FinderOutlineRenderProvider(final IRODSFinderTree tree) {
+ this.tree = tree;
+ }
+
+ public java.awt.Color getBackground(Object o) {
+ return null;
+ }
+
+ public String getDisplayName(Object o) {
+ return o.toString();
+ }
+
+ public java.awt.Color getForeground(Object o) {
+ return null;
+ }
+
+ public javax.swing.Icon getIcon(Object o) {
+ return null;
+ }
+
+ public String getTooltipText(Object o) {
+ IRODSNode node = (IRODSNode) o;
+ CollectionAndDataObjectListingEntry entry = (CollectionAndDataObjectListingEntry) node.getUserObject();
+ StringBuilder sb = new StringBuilder();
+ sb.append("<html>");
+ sb.append("<h3>");
+ sb.append(entry.getFormattedAbsolutePath());
+ sb.append("</h3>");
+ sb.append("<b>size:</b>");
+ sb.append(entry.getDataSize());
+ sb.append("<br/><b>last mod:</b>");
+ sb.append(dateFormat.format(entry.getModifiedAt()));
+ sb.append("</html>");
+ return sb.toString();
+ }
+
+ public boolean isHtmlDisplayName(Object o) {
+ return false;
+ }
+ } \ No newline at end of file
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.java
index 0b6366a..07ae44b 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.java
@@ -10,18 +10,14 @@
*/
package org.irods.jargon.idrop.finder;
-import java.util.logging.Level;
import javax.swing.ListSelectionModel;
import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
import org.irods.jargon.idrop.desktop.systraygui.IDROPCore;
-import org.irods.jargon.idrop.desktop.systraygui.IRODSTreeContainingComponent;
import org.irods.jargon.idrop.desktop.systraygui.MessageManager;
import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSFileSystemModel;
import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSNode;
-import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSOutlineModel;
import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSRowModel;
import org.irods.jargon.idrop.exceptions.IdropRuntimeException;
-import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
@@ -29,9 +25,9 @@ import org.slf4j.LoggerFactory;
* @author mikeconway
*/
public class IRODSFinderDialog extends javax.swing.JDialog {
-
+
private final IDROPCore idropCore;
- private String selectedAbsolutePath = null;
+ private String selectedAbsolutePath = null;
public String getSelectedAbsolutePath() {
return selectedAbsolutePath;
@@ -44,23 +40,23 @@ public class IRODSFinderDialog extends javax.swing.JDialog {
public IRODSFinderTree getIrodsTree() {
return irodsTree;
}
- private static final org.slf4j.Logger log = LoggerFactory.getLogger(IRODSFinderDialog.class);
- private IRODSFinderTree irodsTree = null;
+ private static final org.slf4j.Logger log = LoggerFactory.getLogger(IRODSFinderDialog.class);
+ private IRODSFinderTree irodsTree = null;
/** Creates new form IRODSFinderDialog */
public IRODSFinderDialog(java.awt.Frame parent, boolean modal, IDROPCore idropCore) {
super(parent, modal);
-
+
if (idropCore == null) {
throw new IllegalArgumentException("null idropCore");
}
-
+
this.idropCore = idropCore;
initComponents();
buildTargetTree();
}
-
- /**
+
+ /**
* build the JTree that will depict the iRODS resource
*/
public void buildTargetTree() {
@@ -72,7 +68,7 @@ public class IRODSFinderDialog extends javax.swing.JDialog {
@Override
public void run() {
-
+
CollectionAndDataObjectListingEntry root = new CollectionAndDataObjectListingEntry();
if (idropCore.getIdropConfig().isLoginPreset()) {
@@ -90,7 +86,7 @@ public class IRODSFinderDialog extends javax.swing.JDialog {
}
root.setObjectType(CollectionAndDataObjectListingEntry.ObjectType.COLLECTION);
-
+
log.info("building new iRODS tree");
try {
if (irodsTree == null) {
@@ -98,7 +94,6 @@ public class IRODSFinderDialog extends javax.swing.JDialog {
IRODSNode rootNode = new IRODSNode(root,
idropCore.getIrodsAccount(), idropCore.getIrodsFileSystem(), irodsTree);
irodsTree.setRefreshingTree(true);
- // irodsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
}
IRODSNode rootNode = new IRODSNode(root, idropCore.getIrodsAccount(),
idropCore.getIrodsFileSystem(), irodsTree);
@@ -110,26 +105,25 @@ public class IRODSFinderDialog extends javax.swing.JDialog {
"File System");
irodsTree.setModel(mdl);
-
+
} catch (Exception ex) {
- log.error("exception building finder tree", ex);
+ log.error("exception building finder tree", ex);
throw new IdropRuntimeException(ex);
} finally {
- idropCore.getIrodsFileSystem().closeAndEatExceptions(
- idropCore.getIrodsAccount());
+ idropCore.getIrodsFileSystem().closeAndEatExceptions(
+ idropCore.getIrodsAccount());
}
scrollIrodsTree.setViewportView(irodsTree);
scrollIrodsTree.validate();
gui.validate();
-
+
irodsTree.setRefreshingTree(false);
}
});
}
-
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -216,7 +210,7 @@ public class IRODSFinderDialog extends javax.swing.JDialog {
}// </editor-fold>//GEN-END:initComponents
private void btnRefreshTargetTreeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshTargetTreeActionPerformed
- buildTargetTree();
+ buildTargetTree();
}//GEN-LAST:event_btnRefreshTargetTreeActionPerformed
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
@@ -225,18 +219,18 @@ public class IRODSFinderDialog extends javax.swing.JDialog {
}//GEN-LAST:event_btnCancelActionPerformed
private void btnSelectFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectFolderActionPerformed
-
+
IRODSFinderOutlineModel irodsFileSystemModel = (IRODSFinderOutlineModel) irodsTree.getModel();
-
+
ListSelectionModel selectionModel = irodsTree.getSelectionModel();
int idx = selectionModel.getLeadSelectionIndex();
-
+
if (idx == -1) {
MessageManager.showWarning(this, "Please select a directory", MessageManager.TITLE_MESSAGE);
return;
-}
+ }
// use first selection for info
IRODSNode selectedNode = (IRODSNode) irodsFileSystemModel.getValueAt(
@@ -244,15 +238,14 @@ public class IRODSFinderDialog extends javax.swing.JDialog {
log.info("selected node:{}", selectedNode);
CollectionAndDataObjectListingEntry entry = (CollectionAndDataObjectListingEntry) selectedNode.getUserObject();
if (entry.getObjectType() == CollectionAndDataObjectListingEntry.ObjectType.DATA_OBJECT) {
- MessageManager.showWarning(this, "Please select a directory", MessageManager.TITLE_MESSAGE);
+ MessageManager.showWarning(this, "Please select a directory", MessageManager.TITLE_MESSAGE);
return;
}
-
- this.selectedAbsolutePath = entry.getFormattedAbsolutePath();
- this.setVisible(false);
-
- }//GEN-LAST:event_btnSelectFolderActionPerformed
+ this.selectedAbsolutePath = entry.getFormattedAbsolutePath();
+ this.setVisible(false);
+
+ }//GEN-LAST:event_btnSelectFolderActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel bottomPanel;
private javax.swing.JButton btnCancel;
@@ -264,5 +257,4 @@ public class IRODSFinderDialog extends javax.swing.JDialog {
private javax.swing.JPanel topPanel;
private javax.swing.JPanel treePanel;
// End of variables declaration//GEN-END:variables
-
}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderTree.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderTree.java
index cb693c1..bf6fb93 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderTree.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderTree.java
@@ -29,6 +29,7 @@ import org.irods.jargon.idrop.desktop.systraygui.RenameIRODSDirectoryDialog;
import org.irods.jargon.idrop.desktop.systraygui.iDrop;
import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSNode;
import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSRowModel;
+import org.irods.jargon.idrop.desktop.systraygui.viscomponents.OutlineRenderProvider;
import org.irods.jargon.idrop.exceptions.IdropException;
import org.irods.jargon.idrop.exceptions.IdropRuntimeException;
import org.netbeans.swing.outline.DefaultOutlineModel;
@@ -90,9 +91,10 @@ public class IRODSFinderTree extends Outline implements TreeWillExpandListener,
}
private void initializeMenusAndListeners() {
- setDragEnabled(false);
+ setDragEnabled(true);
setUpTreeMenu();
- setDropMode(javax.swing.DropMode.USE_SELECTION);
+ setDropMode(javax.swing.DropMode.USE_SELECTION);
+ this.setRenderDataProvider(new FinderOutlineRenderProvider(this));
}
/**
diff --git a/idrop-swing/src/main/resources/log4j.properties b/idrop-swing/src/main/resources/log4j.properties
index 6760c3c..75748d5 100644
--- a/idrop-swing/src/main/resources/log4j.properties
+++ b/idrop-swing/src/main/resources/log4j.properties
@@ -1,6 +1,6 @@
# Set root logger level to DEBUG and its only appender to A1.
#log4j.rootCategory=WARN, A1
-log4j.category.org.irods.jargon.idrop=WARN, A1
+log4j.category.org.irods.jargon.idrop=DEBUG, A1
log4j.category.org.irods.jargon.core= DEBUG, A1
log4j.categor.org.irods.jargon.usertagging=ERROR,A1
log4j.category.org.irods.jargon.transfer=INFO, A1