Author: jflesch
Date: 2007-07-29 20:51:34 +0000 (Sun, 29 Jul 2007)
New Revision: 14431
Modified:
trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
trunk/apps/Thaw/src/thaw/plugins/miniFrost/BoardTree.java
trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostPanel.java
trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java
trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Draft.java
Log:
Display at the bottom of the screen the number of messages waiting to be sent
and the number currently being sent
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-07-29 20:22:20 UTC
(rev 14430)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-07-29 20:51:34 UTC
(rev 14431)
@@ -391,6 +391,8 @@
thaw.plugin.index.numberOfLinks=Nombre de liens :
thaw.plugin.index.insertionDate=Inser\u00e9 le :
+thaw.plugin.index.newRev=Index 'X' mis \u00e0 jour \u00e0 la r\u00e9vision 'Y'
+
# Peer monitor
thaw.plugin.peerMonitor.peerMonitor=Connexion
@@ -573,3 +575,7 @@
thaw.plugin.miniFrost.seeUnsigned=Voir les messages non-sign\u00e9s
thaw.plugin.miniFrost.DUP=(DUP)
+
+thaw.plugin.miniFrost.newMsgAnnounce=X nouveaux messages sur la board 'Y'
+thaw.plugin.miniFrost.messageSent=Message sur la board 'X' envoy\u00e9
+
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/BoardTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/BoardTree.java 2007-07-29
20:22:20 UTC (rev 14430)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/BoardTree.java 2007-07-29
20:51:34 UTC (rev 14431)
@@ -43,6 +43,8 @@
implements javax.swing.event.ListSelectionListener,
MouseListener {
+ /* X and Y are replaced */
+ public final static String DRAFTS_STR = "W: X / U : Y";
private JPanel panel;
@@ -58,7 +60,9 @@
public final static Color LOADING_COLOR = new Color(230, 230,
230);
public final static Color LOADING_SELECTION_COLOR = new Color(150, 150,
150);
+ private JLabel draftsState;
+
public BoardTree(MiniFrostPanel mainPanel) {
this.mainPanel = mainPanel;
@@ -137,8 +141,14 @@
actions.add(new BoardManagementHelper.BoardRefresher(mainPanel,
button));
buttonPanel.add(button);
+ /* drafts state */
+
+ draftsState = new JLabel("");
+ updateDraftValues(0, 0);
+
southPanel.add(new JLabel(""), BorderLayout.CENTER);
southPanel.add(buttonPanel, BorderLayout.WEST);
+ southPanel.add(draftsState, BorderLayout.SOUTH);
panel.add(southPanel, BorderLayout.SOUTH);
}
@@ -290,6 +300,15 @@
return panel;
}
+ public void updateDraftValues(int waitings, int postings) {
+ String str;
+
+ str = DRAFTS_STR.replaceAll("X", Integer.toString(waitings));
+ str = str.replaceAll( "Y", Integer.toString(postings));
+
+ draftsState.setText(str);
+ }
+
public void valueChanged(javax.swing.event.ListSelectionEvent e) {
Board b = ((Board)list.getSelectedValue());
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostPanel.java
2007-07-29 20:22:20 UTC (rev 14430)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostPanel.java
2007-07-29 20:51:34 UTC (rev 14431)
@@ -6,11 +6,16 @@
import java.util.Observer;
import java.util.Observable;
+import java.util.Vector;
+import java.util.Iterator;
+
+
import thaw.core.Config;
import thaw.plugins.Hsqldb;
import thaw.plugins.MiniFrost;
import thaw.plugins.miniFrost.interfaces.Board;
+import thaw.plugins.miniFrost.interfaces.Draft;
/**
@@ -187,4 +192,29 @@
}
}
+
+ private Vector drafts = null;
+
+ public void update(Draft draft) {
+ if (drafts == null)
+ drafts = new Vector();
+
+ if (!draft.isPosting() && !draft.isWaiting())
+ drafts.remove(draft);
+ else if (drafts.indexOf(draft) < 0)
+ drafts.add(draft);
+
+ int waitings = 0;
+ int postings = 0;
+
+ for (Iterator it = drafts.iterator();
+ it.hasNext();) {
+ Draft draftIt = (Draft)it.next();
+
+ if (draftIt.isPosting()) postings++;
+ if (draftIt.isWaiting()) waitings++;
+ }
+
+ boardTree.updateDraftValues(waitings, postings);
+ }
}
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java
2007-07-29 20:22:20 UTC (rev 14430)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java
2007-07-29 20:51:34 UTC (rev 14431)
@@ -106,10 +106,28 @@
private FCPQueueManager queueManager;
private int revUsed;
+ private boolean waiting;
+ private boolean posting;
+ public void notifyPlugin() {
+ board.getFactory().getPlugin().getPanel().update(this);
+ }
+
+ public boolean isWaiting() {
+ return waiting;
+ }
+
+ public boolean isPosting() {
+ return posting;
+ }
+
public void post(FCPQueueManager queueManager) {
this.queueManager = queueManager;
+ waiting = true;
+ posting = false;
+ notifyPlugin();
+
/* we start immediatly a board refresh (we will need it) */
synchronized(board) {
board.addObserver(this);
@@ -151,6 +169,10 @@
}
private void startInsertion() {
+ waiting = false;
+ posting = true;
+ notifyPlugin();
+
String key = getKey(date, revUsed);
Logger.info(this, "Inserting : KSK@"+key);
@@ -193,6 +215,10 @@
FCPClientPut put = (FCPClientPut)o;
if (put.isFinished() && put.isSuccessful()) {
+ posting = false;
+ waiting = false;
+ notifyPlugin();
+
put.deleteObserver(this);
put.stop(queueManager);
queueManager.remove(put);
@@ -213,6 +239,9 @@
if (put.getPutFailedCode() != 9) { /*
!Collision */
Logger.error(this, "Can't insert the
message on the board '"+
board.toString()+"' ;
Code: "+Integer.toString(put.getPutFailedCode()));
+ waiting = false;
+ posting = false;
+ notifyPlugin();
return;
}
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Draft.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Draft.java
2007-07-29 20:22:20 UTC (rev 14430)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Draft.java
2007-07-29 20:51:34 UTC (rev 14431)
@@ -34,5 +34,11 @@
public boolean removeAttachment(java.io.File file);
public boolean removeAttachment(Board board);
+ /**
+ * must notify thaw.plugins.MiniFrostPanel at each change
+ */
public void post(thaw.fcp.FCPQueueManager queueManager);
+
+ public boolean isWaiting();
+ public boolean isPosting();
}