summaryrefslogtreecommitdiffstats
path: root/idrop-swing
diff options
context:
space:
mode:
authorMike Conway <michael.c.conway@gmail.com>2011-10-12 19:19:28 (GMT)
committer Mike Conway <michael.c.conway@gmail.com>2011-10-12 19:19:28 (GMT)
commitb9527120eaa81ca15a11b2e16778f3a3e237f710 (patch)
tree45a286ff07619e597f65c679f6c30db1f2b86edf /idrop-swing
parent9e16951807bd7f69f026e4b6c655db0462eff6a1 (diff)
downloadQCG-Data-b9527120eaa81ca15a11b2e16778f3a3e237f710.zip
QCG-Data-b9527120eaa81ca15a11b2e16778f3a3e237f710.tar.gz
QCG-Data-b9527120eaa81ca15a11b2e16778f3a3e237f710.tar.bz2
[#491] info view for local file system
Diffstat (limited to 'idrop-swing')
-rw-r--r--idrop-swing/release_notes.txt1
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPCore.java6
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/LocalFileTree.java38
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/OutlineRenderProvider.java14
-rw-r--r--idrop-swing/src/main/resources/log4j.properties6
5 files changed, 59 insertions, 6 deletions
diff --git a/idrop-swing/release_notes.txt b/idrop-swing/release_notes.txt
index 032fbd9..704964b 100644
--- a/idrop-swing/release_notes.txt
+++ b/idrop-swing/release_notes.txt
@@ -163,6 +163,7 @@ iRODS iDrop > drag and drop, desktop to irods file should use irods parent as ta
[#362] change Grids in preferences to Accounts
+ [#491] info view for local file system
==Outstanding Issues==
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPCore.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPCore.java
index 48bda69..38fd597 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPCore.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPCore.java
@@ -1,5 +1,6 @@
package org.irods.jargon.idrop.desktop.systraygui;
+import java.text.DateFormat;
import java.util.Timer;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -36,6 +37,11 @@ public class IDROPCore {
private IconManager iconManager = null;
private Timer queueTimer = new Timer();
private IdropConfigurationService idropConfigurationService = null;
+ private final DateFormat dateFormat = DateFormat.getDateTimeInstance();
+
+ public DateFormat getDateFormat() {
+ return dateFormat;
+ }
public IdropConfigurationService getIdropConfigurationService() {
return idropConfigurationService;
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/LocalFileTree.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/LocalFileTree.java
index 41291d8..24b0dd6 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/LocalFileTree.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/LocalFileTree.java
@@ -5,6 +5,7 @@
package org.irods.jargon.idrop.desktop.systraygui.viscomponents;
import java.awt.Color;
+import java.awt.Component;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
@@ -18,6 +19,7 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
+import javax.swing.ToolTipManager;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeWillExpandListener;
import javax.swing.tree.DefaultTreeCellRenderer;
@@ -26,6 +28,7 @@ import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import org.irods.jargon.idrop.desktop.systraygui.DeleteLocalFileDialog;
+import org.irods.jargon.idrop.desktop.systraygui.IDROPCore;
import org.irods.jargon.idrop.desktop.systraygui.NewLocalDirectoryDialog;
import org.irods.jargon.idrop.desktop.systraygui.RenameLocalDirectoryDialog;
import org.irods.jargon.idrop.desktop.systraygui.iDrop;
@@ -42,6 +45,7 @@ public class LocalFileTree extends JTree implements TreeWillExpandListener {
public static org.slf4j.Logger log = LoggerFactory.getLogger(LocalFileTree.class);
private iDrop idropParentGui = null;
+ private IDROPCore idropCore = null;
protected JPopupMenu m_popup = null;
protected Action m_action;
protected TreePath m_clickedPath;
@@ -78,11 +82,14 @@ public class LocalFileTree extends JTree implements TreeWillExpandListener {
public LocalFileTree(final TreeModel newModel, final iDrop idropParentGui) {
super(newModel);
this.idropParentGui = idropParentGui;
+ this.idropCore = idropParentGui.getiDropCore();
setDragEnabled(true);
this.setTransferHandler(new LocalTreeTransferHandler(idropParentGui));
- this.setCellRenderer(new DefaultTreeCellRenderer());
+ //this.setCellRenderer(new DefaultTreeCellRenderer());
setUpTreeMenu();
setDropMode(javax.swing.DropMode.ON);
+ setCellRenderer(new OwnRenderer());
+
}
@@ -229,7 +236,9 @@ public class LocalFileTree extends JTree implements TreeWillExpandListener {
}
- private void setUpTreeMenu() {
+ private void setUpTreeMenu()
+ {
+ ToolTipManager.sharedInstance().registerComponent(this);
this.thisTree = this;
m_popup = new JPopupMenu();
m_action = new AbstractAction() {
@@ -402,4 +411,29 @@ public class LocalFileTree extends JTree implements TreeWillExpandListener {
}
}
}
+
+ class OwnRenderer extends DefaultTreeCellRenderer {
+ @Override
+ public Component getTreeCellRendererComponent(JTree tree, Object value,
+ boolean sel, boolean expanded, boolean leaf, int row,
+ boolean hasFocus) {
+ LocalFileNode localFileNode = (LocalFileNode) value;
+ File file = (File) localFileNode.getUserObject();
+ StringBuilder sb = new StringBuilder();
+ sb.append("<html>");
+ sb.append("<h3>");
+ sb.append(file.getAbsolutePath());
+ sb.append("</h3>");
+ sb.append("<b>size:</b>");
+ sb.append(file.length());
+ sb.append("<br/><b>last mod:</b>");
+ sb.append(idropCore.getDateFormat().format(file.lastModified()));
+ sb.append("</html>");
+ this.setToolTipText(sb.toString());
+ return super.getTreeCellRendererComponent(tree, value, sel,
+ expanded, leaf, row, hasFocus);
+ }
+ }
+
+
}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/OutlineRenderProvider.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/OutlineRenderProvider.java
index 92c5950..1c77fdb 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/OutlineRenderProvider.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/OutlineRenderProvider.java
@@ -2,6 +2,7 @@
package org.irods.jargon.idrop.desktop.systraygui.viscomponents;
import java.awt.Color;
+import java.text.DateFormat;
import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
import org.netbeans.swing.outline.RenderDataProvider;
@@ -10,6 +11,7 @@ import org.netbeans.swing.outline.RenderDataProvider;
*/
public class OutlineRenderProvider implements RenderDataProvider {
private final IRODSTree tree;
+ private final DateFormat dateFormat = DateFormat.getDateTimeInstance();
public OutlineRenderProvider(final IRODSTree tree) {
this.tree = tree;
@@ -34,7 +36,17 @@ public class OutlineRenderProvider implements RenderDataProvider {
public String getTooltipText(Object o) {
IRODSNode node = (IRODSNode) o;
CollectionAndDataObjectListingEntry entry = (CollectionAndDataObjectListingEntry) node.getUserObject();
- return entry.getFormattedAbsolutePath();
+ 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) {
diff --git a/idrop-swing/src/main/resources/log4j.properties b/idrop-swing/src/main/resources/log4j.properties
index 565d9c9..06110dc 100644
--- a/idrop-swing/src/main/resources/log4j.properties
+++ b/idrop-swing/src/main/resources/log4j.properties
@@ -1,9 +1,9 @@
# Set root logger level to DEBUG and its only appender to A1.
#log4j.rootCategory=WARN, A1
-log4j.category.org.irods.jargon.idrop=INFO, A1
-log4j.category.org.irods.jargon.core= DEBUG, A1
+log4j.category.org.irods.jargon.idrop=WARN, A1
+log4j.category.org.irods.jargon.core= INFO, A1
log4j.categor.org.irods.jargon.usertagging=ERROR,A1
-log4j.category.org.irods.jargon.transfer=DEBUG, A1
+log4j.category.org.irods.jargon.transfer=INFO, A1
log4j.category.org.irods.jargon.datautils=WARN, A1
log4j.category.org.hibernate=ERROR, A1