Author: jflesch
Date: 2008-01-15 20:01:33 +0000 (Tue, 15 Jan 2008)
New Revision: 17061
Modified:
trunk/apps/Thaw/src/thaw/core/Main.java
trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java
trunk/apps/Thaw/src/thaw/gui/TransferProgressBar.java
trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
trunk/apps/Thaw/src/thaw/i18n/thaw.properties
trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
trunk/apps/Thaw/src/thaw/plugins/miniFrost/KnownBoardListProvider.java
trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
Log:
Reduce the number of useless calls to I18n.getMessage() + fix non-persistent
file downloading
Modified: trunk/apps/Thaw/src/thaw/core/Main.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/Main.java 2008-01-15 16:49:45 UTC (rev
17060)
+++ trunk/apps/Thaw/src/thaw/core/Main.java 2008-01-15 20:01:33 UTC (rev
17061)
@@ -185,8 +185,8 @@
e.printStackTrace();
}
- //Logger.warning(this, "Will try to continue anyway");
- System.exit(1);
+ Logger.warning(this, "Will try to continue anyway");
+ //System.exit(1);
}
Modified: trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java 2008-01-15 16:49:45 UTC
(rev 17060)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java 2008-01-15 20:01:33 UTC
(rev 17061)
@@ -334,12 +334,17 @@
status =
"Available";
setStatus(false, true, true);
writingSuccessful = true;
-
Logger.info(this, "File already existing. Not rewrited");
+
Logger.notice(this, "Download finished => File already existing. Not rewrited");
}
} else {
- Logger.info(this,
"Don't know where to put file, so file not asked to the node");
+ setStatus(false, true,
true);
+ status = "Available but
not downloaded";
+ writingSuccessful =
true;
+ Logger.notice(this,
"Download finished => Don't know where to put file, so file not asked to the
node");
}
+ } else {
+ /* we do nothing : the request
is not persistent, so we should get a AllData */
}
}
@@ -454,7 +459,7 @@
status = "Redirected ...";
if
(queueManager.isOur(message.getValue("Identifier"))) {
restartIfFailed = true;
- stop(queueManager);
+ stop(queueManager, false);
} else {
Logger.debug(this, "Not our transfer ;
we don't touch");
}
@@ -900,8 +905,12 @@
return true;
}
+
+ public boolean stop(final FCPQueueManager queueManager) {
+ return stop(queueManager, true);
+ }
- public boolean stop(final FCPQueueManager queryManager) {
+ public boolean stop(final FCPQueueManager queryManager, boolean notify)
{
Logger.info(this, "Stop fetching of the key : "+getFileKey());
if(isPersistent() && !removeRequest())
@@ -909,12 +918,12 @@
boolean wasFinished = isFinished();
- setStatus(false, true, isSuccessful());
+ setStatus(false, true, wasFinished && isSuccessful());
fatal = true;
status = "Stopped";
- if (!restartIfFailed && !wasFinished) {
+ if (!restartIfFailed && !wasFinished && notify) {
notifyChange();
}
Modified: trunk/apps/Thaw/src/thaw/gui/TransferProgressBar.java
===================================================================
--- trunk/apps/Thaw/src/thaw/gui/TransferProgressBar.java 2008-01-15
16:49:45 UTC (rev 17060)
+++ trunk/apps/Thaw/src/thaw/gui/TransferProgressBar.java 2008-01-15
20:01:33 UTC (rev 17061)
@@ -9,20 +9,21 @@
import thaw.core.I18n;
public class TransferProgressBar extends JProgressBar {
- /**
- *
- */
private static final long serialVersionUID = -4726613087699822787L;
private FCPTransferQuery query;
private boolean statusInProgressBar;
private boolean withBorder;
+
+ private final static String failedStr =
I18n.getMessage("thaw.common.failed");
+ private final static String finishedStr =
I18n.getMessage("thaw.common.finished");
+
public TransferProgressBar(FCPTransferQuery q) {
this(q, true);
}
public TransferProgressBar(FCPTransferQuery query, boolean
statusInProgressBar,
- boolean withBorder) {
+ boolean
withBorder) {
super(0, 100);
this.query = query;
this.statusInProgressBar = statusInProgressBar;
@@ -58,9 +59,9 @@
setValue(progress);
if(query.isFinished() && !query.isSuccessful())
- setString(I18n.getMessage("thaw.common.failed"));
+ setString(failedStr);
else if(query.isFinished() && query.isSuccessful())
- setString(I18n.getMessage("thaw.common.finished"));
+ setString(finishedStr);
else if(!query.isFinished()) {
String txt= "";
Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-01-15
16:49:45 UTC (rev 17060)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2008-01-15
20:01:33 UTC (rev 17061)
@@ -686,6 +686,7 @@
thaw.plugin.miniFrost.knownBoard=Board connue
thaw.plugin.miniFrost.knownBoard.select=Veuillez s?lectionner une board:
+thaw.plugin.miniFrost.knownBoard.none=Aucune autre board connue pour le moment
## Index web grapher
thaw.plugin.indexWebGrapher=Une tentative de repr?sentation de la toile des
indexes
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-01-15 16:49:45 UTC
(rev 17060)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2008-01-15 20:01:33 UTC
(rev 17061)
@@ -693,6 +693,7 @@
thaw.plugin.miniFrost.knownBoard=Known board
thaw.plugin.miniFrost.knownBoard.select=Please select a board:
+thaw.plugin.miniFrost.knownBoard.none=No new known boards at the moment
## index web grapher
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-01-15 16:49:45 UTC
(rev 17060)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2008-01-15 20:01:33 UTC
(rev 17061)
@@ -686,6 +686,7 @@
thaw.plugin.miniFrost.knownBoard=Board connue
thaw.plugin.miniFrost.knownBoard.select=Veuillez s\u00e9lectionner une board:
+thaw.plugin.miniFrost.knownBoard.none=Aucune autre board connue pour le moment
## Index web grapher
thaw.plugin.indexWebGrapher=Une tentative de repr\u00e9sentation de la toile
des indexes
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/KnownBoardListProvider.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/KnownBoardListProvider.java
2008-01-15 16:49:45 UTC (rev 17060)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/KnownBoardListProvider.java
2008-01-15 20:01:33 UTC (rev 17061)
@@ -47,6 +47,11 @@
Object[] boardListAr = boardList.toArray();
+ if (boardListAr.length <= 0) {
+ new thaw.gui.WarningWindow(mainWindow,
I18n.getMessage("thaw.plugin.miniFrost.knownBoard.none"));
+ return;
+ }
+
BoardAttachment selection =
(BoardAttachment)JOptionPane.showInputDialog(mainWindow.getMainFrame(),
I18n.getMessage("thaw.plugin.miniFrost.knownBoard.select"),
I18n.getMessage("thaw.plugin.miniFrost.knownBoard.select"),
Modified:
trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java
2008-01-15 16:49:45 UTC (rev 17060)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardFactory.java
2008-01-15 20:01:33 UTC (rev 17061)
@@ -30,7 +30,6 @@
"freenet-refs",
"thaw",
"frost",
- "fuqid",
"jsite",
"successful",
"unsuccessful",
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java
2008-01-15 16:49:45 UTC (rev 17060)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java
2008-01-15 20:01:33 UTC (rev 17061)
@@ -36,11 +36,20 @@
private final JTextField globalQueue = new JTextField();
private FCPTransferQuery query = null;
+
+ private final static Dimension dim = new
Dimension(thaw.plugins.QueueWatcher.DIVIDER_LOCATION-10, 400);
+ private final static String unknownStr =
I18n.getMessage("thaw.common.unknown");
+ private final static String failedStr =
I18n.getMessage("thaw.common.failed");
+ private final static String estimationStr =
I18n.getMessage("thaw.common.estimation");
+
+ private final static String[] prioritiesStr = new
String[QueuePanel.MIN_PRIORITY+1];
+ static {
+ for (int i = 0 ; i < prioritiesStr.length ; i++)
+ prioritiesStr[i] =
I18n.getMessage("thaw.plugin.priority.p"+Integer.toString(i));
+ };
- private final static Dimension dim = new
Dimension(thaw.plugins.QueueWatcher.DIVIDER_LOCATION-10, 400);
-
public DetailPanel() {
panel = new JPanel();
subPanel = new JPanel();
@@ -133,19 +142,19 @@
String progression =
Integer.toString(query.getProgression()) + "%";
if(!query.isProgressionReliable())
- progression = progression + "
("+I18n.getMessage("thaw.common.estimation")+")";
+ progression = progression + "
("+estimationStr+")";
progress.setString(progression);
} else
-
progress.setString(I18n.getMessage("thaw.common.failed"));
+ progress.setString(failedStr);
if(query.getFileKey() != null)
key.setText(query.getFileKey());
else
-
key.setText(I18n.getMessage("thaw.common.unknown"));
+ key.setText(unknownStr);
if(query.getFileSize() == 0)
-
size.setText(I18n.getMessage("thaw.common.unknown"));
+ size.setText(unknownStr);
else
size.setText((new
Long(query.getFileSize())).toString()+" B");
@@ -156,9 +165,9 @@
identifier.setText("N/A");
if(query.getThawPriority() != -1)
-
priority.setText(I18n.getMessage("thaw.plugin.priority.p"+Integer.toString(query.getThawPriority())));
+
priority.setText(prioritiesStr[query.getThawPriority()]);
else
-
priority.setText(I18n.getMessage("thaw.common.unknown"));
+ priority.setText(unknownStr);
} else {
withTheNodeProgress.setValue(0);
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
2008-01-15 16:49:45 UTC (rev 17060)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
2008-01-15 20:01:33 UTC (rev 17061)
@@ -77,7 +77,7 @@
private JRadioButtonMenuItem[] priorityRadioButton;
private JRadioButtonMenuItem unknowPriority;
private ButtonGroup priorityGroup;
- private final int MIN_PRIORITY = 6;
+ public final static int MIN_PRIORITY = 6;
private int[] selectedRows;
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
2008-01-15 16:49:45 UTC (rev 17060)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
2008-01-15 20:01:33 UTC (rev 17061)
@@ -27,11 +27,17 @@
public class QueueTableModel extends javax.swing.table.AbstractTableModel
implements Observer {
- private static final long serialVersionUID = 20060708;
+ private static final long serialVersionUID = 20060709;
+ private final static String totalTimeStr =
I18n.getMessage("thaw.plugin.queueWatcher.totalTime");
+ private final static String downloadSuccessfulStr =
I18n.getMessage("thaw.plugin.queueWatcher.downloadSuccessful");
+ private final static String downloadFailedStr =
I18n.getMessage("thaw.plugin.queueWatcher.downloadFailed");
+ private final static String insertionSuccessfulStr =
I18n.getMessage("thaw.plugin.queueWatcher.insertionSuccessful");
+ private final static String insertionFailedStr =
I18n.getMessage("thaw.plugin.queueWatcher.insertionFailed");
+ private final static String unspecifiedStr =
I18n.getMessage("thaw.common.unspecified");
private final Vector columnNames;
- private Vector queries = null;
+ private Vector queries = null;
private boolean isForInsertions = false;
@@ -147,7 +153,7 @@
if(query.getPath() != null)
return query.getPath();
else
- return
I18n.getMessage("thaw.common.unspecified");
+ return unspecifiedStr;
} else if( (isForInsertions && (column == 3))
|| (!isForInsertions && (column == 4)) ) {
@@ -186,7 +192,7 @@
if (!query.isFinished())
return GUIHelper.getPrintableTime(remaining);
else
- return
I18n.getMessage("thaw.plugin.queueWatcher.totalTime") + "
"+GUIHelper.getPrintableTime(remaining);
+ return totalTimeStr + "
"+GUIHelper.getPrintableTime(remaining);
}
return null;
@@ -368,12 +374,12 @@
if (o instanceof FCPClientGet) {
str = (success ?
-
I18n.getMessage("thaw.plugin.queueWatcher.downloadSuccessful") :
-
I18n.getMessage("thaw.plugin.queueWatcher.downloadFailed"));
+ downloadSuccessfulStr :
+ downloadFailedStr);
} else if (o instanceof FCPClientPut) {
str = (success ?
-
I18n.getMessage("thaw.plugin.queueWatcher.insertionSuccessful") :
-
I18n.getMessage("thaw.plugin.queueWatcher.insertionFailed"));
+ insertionSuccessfulStr :
+ insertionFailedStr);
}
if (str != null) {