Author: jflesch
Date: 2006-12-01 19:25:19 +0000 (Fri, 01 Dec 2006)
New Revision: 11178
Modified:
trunk/apps/Thaw/src/thaw/plugins/index/FileTable.java
trunk/apps/Thaw/src/thaw/plugins/index/Index.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexCategory.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexTreeNode.java
trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java
Log:
Put the updated indexes in bold in the tree
Modified: trunk/apps/Thaw/src/thaw/plugins/index/FileTable.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/FileTable.java 2006-12-01
19:16:33 UTC (rev 11177)
+++ trunk/apps/Thaw/src/thaw/plugins/index/FileTable.java 2006-12-01
19:25:19 UTC (rev 11178)
@@ -167,6 +167,9 @@
public void mouseClicked(MouseEvent e) {
+ if (fileList instanceof Index)
+ ((Index)fileList).setChanged(false);
+
if(e.getButton() == MouseEvent.BUTTON3
&& fileList != null) {
selectedRows = table.getSelectedRows();
Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java 2006-12-01 19:16:33 UTC
(rev 11177)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java 2006-12-01 19:25:19 UTC
(rev 11178)
@@ -60,8 +60,8 @@
private String author = null;
private boolean rewriteKey = true;
-
private boolean xmlParserReady = false;
+ private boolean changed = false;
private FCPClientPut publicKeyRecalculation = null;
@@ -312,8 +312,8 @@
Logger.warning(this, "Index not generated !");
}
- this.setChanged();
- this.notifyObservers();
+ setChanged();
+ notifyObservers();
} else {
this.updateFromFreenet(-1);
}
@@ -575,13 +575,17 @@
if (this.transfer instanceof FCPClientGet) {
((FCPClientGet)this.transfer).deleteObserver(this);
+ int oldRevision = revision;
+
if (rewriteKey)
publicKey =
transfer.getFileKey();
- else
- revision =
FreenetURIHelper.getUSKRevision(transfer.getFileKey());
+ revision =
FreenetURIHelper.getUSKRevision(transfer.getFileKey());
+
Logger.info(this, "Most up-to-date key
found: " + getPublicKey());
+ if (oldRevision < revision)
+ changed = true;
/* Reminder: These requests are
non-peristent */
//if
(this.transfer.stop(this.queueManager))
@@ -625,6 +629,16 @@
}
+ public boolean hasChanged() {
+ return changed;
+ }
+
+
+ public void setChanged(boolean val) {
+ changed = val;
+ }
+
+
public boolean isEmpty() {
if (this.fileList == null)
this.loadFiles(null, true);
@@ -673,8 +687,9 @@
Logger.error(this, "Unable to get the file list for
index: '"+this.toString()+"' because: "+e.toString());
}
- this.setChanged();
- this.notifyObservers();
+ setChanged(false); /* java.util.Index */
+ setChanged(); /* java.util.Observer */
+ notifyObservers();
}
/**
@@ -868,7 +883,8 @@
Logger.error(this, "Unable to get the link list for
index: '"+this.toString()+"' because: "+e.toString());
}
- setChanged();
+ setChanged(false); /* Index */
+ setChanged(); /* java.util.Observable */
notifyObservers();
}
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexCategory.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexCategory.java 2006-12-01
19:16:33 UTC (rev 11177)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexCategory.java 2006-12-01
19:25:19 UTC (rev 11178)
@@ -420,8 +420,7 @@
/**
* Returns true only if all its child are modifiable
*/
- public boolean isModifiable()
- {
+ public boolean isModifiable() {
if(children == null)
children = loadChildren();
@@ -436,6 +435,21 @@
}
+ public boolean hasChanged() {
+ if(children == null)
+ children = loadChildren();
+
+ for(Iterator it = children.iterator();
+ it.hasNext();) {
+ IndexTreeNode node =
(IndexTreeNode)((DefaultMutableTreeNode)it.next()).getUserObject();
+ if (node.hasChanged())
+ return true;
+ }
+
+ return false;
+ }
+
+
public boolean isLeaf() {
return false;
}
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java 2006-12-01
19:16:33 UTC (rev 11177)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java 2006-12-01
19:25:19 UTC (rev 11178)
@@ -12,6 +12,8 @@
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.DefaultTreeCellRenderer;
+import java.awt.Font;
+
import javax.swing.JPopupMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
@@ -394,8 +396,9 @@
boolean
leaf,
int row,
boolean
hasFocus) {
- this.setBackgroundNonSelectionColor(Color.WHITE);
- this.setBackgroundSelectionColor(SELECTION_COLOR);
+ setBackgroundNonSelectionColor(Color.WHITE);
+ setBackgroundSelectionColor(SELECTION_COLOR);
+ setFont(new Font("Dialog", Font.PLAIN, 12));
if(value instanceof DefaultMutableTreeNode) {
Object o =
((DefaultMutableTreeNode)value).getUserObject();
@@ -403,11 +406,15 @@
if(o instanceof Index) {
Index index = (Index)o;
- if(index.isUpdating()) {
-
this.setBackgroundNonSelectionColor(LOADING_COLOR);
-
this.setBackgroundSelectionColor(LOADING_SELECTION_COLOR);
+ if (index.isUpdating()) {
+
setBackgroundNonSelectionColor(LOADING_COLOR);
+
setBackgroundSelectionColor(LOADING_SELECTION_COLOR);
}
}
+
+ if (((IndexTreeNode)o).hasChanged()) {
+ setFont(new Font("Dialog", Font.BOLD,
12));
+ }
}
return super.getTreeCellRendererComponent(tree,
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTreeNode.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTreeNode.java 2006-12-01
19:16:33 UTC (rev 11177)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTreeNode.java 2006-12-01
19:25:19 UTC (rev 11178)
@@ -62,4 +62,5 @@
public void addObserver(java.util.Observer o);
public boolean isModifiable();
+ public boolean hasChanged();
}
Modified: trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java 2006-12-01
19:16:33 UTC (rev 11177)
+++ trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java 2006-12-01
19:25:19 UTC (rev 11178)
@@ -138,6 +138,9 @@
}
public void mouseClicked(MouseEvent e) {
+ if (linkList instanceof Index)
+ ((Index)linkList).setChanged(false);
+
if(e.getButton() == MouseEvent.BUTTON3
&& this.linkList != null) {
selectedRows = table.getSelectedRows();