Author: jflesch
Date: 2007-06-23 02:22:52 +0000 (Sat, 23 Jun 2007)
New Revision: 13726
Added:
trunk/apps/Thaw/images/min-green.png
trunk/apps/Thaw/images/min-orange.png
trunk/apps/Thaw/images/min-red.png
Modified:
trunk/apps/Thaw/src/thaw/gui/IconBox.java
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DragAndDropManager.java
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
Log:
Change the way that downloads/insertions are displayed in Thaw : Will require
some testing and some feedbacks
Added: trunk/apps/Thaw/images/min-green.png
===================================================================
(Binary files differ)
Property changes on: trunk/apps/Thaw/images/min-green.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/apps/Thaw/images/min-orange.png
===================================================================
(Binary files differ)
Property changes on: trunk/apps/Thaw/images/min-orange.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/apps/Thaw/images/min-red.png
===================================================================
(Binary files differ)
Property changes on: trunk/apps/Thaw/images/min-red.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/apps/Thaw/src/thaw/gui/IconBox.java
===================================================================
--- trunk/apps/Thaw/src/thaw/gui/IconBox.java 2007-06-23 01:26:21 UTC (rev
13725)
+++ trunk/apps/Thaw/src/thaw/gui/IconBox.java 2007-06-23 02:22:52 UTC (rev
13726)
@@ -128,6 +128,11 @@
public static ImageIcon readComments;
public static ImageIcon minReadComments;
+ public static ImageIcon minRed;
+ public static ImageIcon minOrange;
+ public static ImageIcon minGreen;
+
+
/**
* Not really used
*/
@@ -239,6 +244,9 @@
IconBox.minAddComment =
IconBox.loadIcon("min-newComment.png");
IconBox.readComments =
IconBox.loadIcon("readComments.png");
IconBox.minReadComments =
IconBox.loadIcon("min-readComments.png");
+ IconBox.minRed = IconBox.loadIcon("min-red.png");
+ IconBox.minOrange =
IconBox.loadIcon("min-orange.png");
+ IconBox.minGreen = IconBox.loadIcon("min-green.png");
}
}
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DragAndDropManager.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DragAndDropManager.java
2007-06-23 01:26:21 UTC (rev 13725)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DragAndDropManager.java
2007-06-23 02:22:52 UTC (rev 13726)
@@ -36,16 +36,16 @@
dragSource = DragSource.getDefaultDragSource();
- for(int i = 0 ; i < queuePanels.length ; i++) {
-
dragSource.createDefaultDragGestureRecognizer(queuePanels[i].getTable(),
-
DnDConstants.ACTION_COPY_OR_MOVE,
-
this);
+ //for(int i = 0 ; i < queuePanels.length ; i++) {
+
//dragSource.createDefaultDragGestureRecognizer(queuePanels[i].getTable(),
+ //
DnDConstants.ACTION_COPY_OR_MOVE,
+ //
this);
/* TODO: Finish DnD support */
//queuePanels[i].getTable().setTransferHandler(new
FileTransferHandler());
//queuePanels[i].getTable().setDragEnabled(true);
- }
+ //}
}
private class FileTransferHandler extends TransferHandler {
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
2007-06-23 01:26:21 UTC (rev 13725)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
2007-06-23 02:22:52 UTC (rev 13726)
@@ -57,6 +57,8 @@
public final static int ACTION_COPY_KEYS_SELECTED = 6;
public final static int ACTION_CHANGE_PRIORITY_SELECTED = 7;
+ public final static int FIRST_COLUMN_SIZE = 20;
+
private Core core;
private JButton button;
@@ -107,7 +109,8 @@
isForInsertionQueue ? "table_insertions" :
"table_downloads",
tableModel);
- table.setShowGrid(true);
+ table.setShowGrid(false);
+ table.setIntercellSpacing(new java.awt.Dimension(0, 0));
final JTableHeader header = table.getTableHeader();
header.setUpdateTableInRealTime(true);
@@ -197,6 +200,13 @@
table.addMouseListener(this);
table.addKeyListener(this);
+ /* we really really want a column 0 with a size of
FIRST_COLUMN_SIZE ! */
+
table.getColumnModel().getColumn(0).setPreferredWidth(FIRST_COLUMN_SIZE);
+ table.getColumnModel().getColumn(0).setResizable(false);
+
table.getColumnModel().getColumn(0).setPreferredWidth(FIRST_COLUMN_SIZE);
+
table.getColumnModel().getColumn(0).setMinWidth(FIRST_COLUMN_SIZE);
+
table.getColumnModel().getColumn(0).setMaxWidth(FIRST_COLUMN_SIZE);
+
/* If a queue is already existing, we need to add it */
if(core.getQueueManager() != null) {
this.addToTable(core.getQueueManager().getRunningQueue());
@@ -224,6 +234,7 @@
private final Color FAILURE = Color.RED;
private final Color RUNNING = Color.ORANGE;
private final Color PENDING = Color.WHITE;
+ private Color softGray;
private QueueTableModel model = null;
private JTable tabl = null;
@@ -233,6 +244,7 @@
this.model = model;
tabl = table;
insertionQueue = isForInsertion;
+ softGray = new Color(240,240,240);
}
public Component getTableCellRendererComponent(final JTable
table, Object value,
@@ -270,11 +282,42 @@
return bar;
}
+ Component cell = null;
- final Component cell =
super.getTableCellRendererComponent(table, value,
-
isSelected, hasFocus,
-
row, column);
+ if (column == 0) {
+ if(query == null)
+ return null;
+ if(!query.isRunning() && !query.isFinished())
+ cell = new JLabel("");
+
+ if(query.isFinished() && query.isSuccessful() &&
+ ( (!(query instanceof FCPClientGet)) ||
((FCPClientGet)query).isWritingSuccessful()))
+ cell = new JLabel(IconBox.minGreen);
+
+ if(query.isFinished() && (!query.isSuccessful()
||
+ ((query instanceof
FCPClientGet) && !((FCPClientGet)query).isWritingSuccessful()) ) )
+ cell = new JLabel(IconBox.minRed);
+
+ if(query.isRunning() && !query.isFinished())
+ cell = new JLabel(IconBox.minOrange);
+
+ } else {
+
+ cell =
super.getTableCellRendererComponent(table, value,
+
isSelected, hasFocus,
+ row,
column);
+
+ }
+
+ if (!isSelected) {
+ if (row % 2 == 0)
+ cell.setBackground(Color.WHITE);
+ else
+ cell.setBackground(softGray);
+ }
+
+ /*
if(!isSelected) {
if(query == null)
@@ -294,8 +337,8 @@
if(query.isRunning() && !query.isFinished())
cell.setBackground(RUNNING);
}
+ */
-
return cell;
}
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
2007-06-23 01:26:21 UTC (rev 13725)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
2007-06-23 02:22:52 UTC (rev 13726)
@@ -43,6 +43,7 @@
columnNames = new Vector();
+ columnNames.add(" ");
columnNames.add(I18n.getMessage("thaw.common.file"));
columnNames.add(I18n.getMessage("thaw.common.size"));
@@ -90,10 +91,18 @@
}
- public Object getValueAt(final int row, final int column) {
+ public Object getValueAt(final int row, int column) {
if(row >= queries.size())
return null;
+ /* we don't return any value for the first column,
+ * the renderer will deduce itself what must be put in this
column
+ */
+ if (column == 0)
+ return null;
+ else
+ column--;
+
final FCPTransferQuery query =
(FCPTransferQuery)queries.get(row);
if(column == 0) {
@@ -345,7 +354,7 @@
final int columnsCount = table.getColumnCount();
- if (modelIndex < 0)
+ if (modelIndex < 0 || columnModelIndex < 1)
return;
if (sortedColumn == modelIndex)
@@ -376,7 +385,7 @@
public QueryComparator(final boolean sortedAsc, final int
column,
final boolean isForInsertionTable) {
isSortedAsc = sortedAsc;
- this.column = column;
+ this.column = column - 1; /* can't sort on the first
column */
this.isForInsertionTable = isForInsertionTable;
}