Author: jflesch
Date: 2006-11-02 22:02:57 +0000 (Thu, 02 Nov 2006)
New Revision: 10798
Modified:
trunk/apps/Thaw/src/thaw/core/Logger.java
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/LinkTable.java
Log:
Fix index refreshing
Modified: trunk/apps/Thaw/src/thaw/core/Logger.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/Logger.java 2006-11-02 18:50:28 UTC (rev
10797)
+++ trunk/apps/Thaw/src/thaw/core/Logger.java 2006-11-02 22:02:57 UTC (rev
10798)
@@ -20,7 +20,7 @@
*
* 2 or more is recommanded.
*/
- public final static int LOG_LEVEL = 2;
+ public final static int LOG_LEVEL = 3;
private static Vector logListeners = null;
Modified: trunk/apps/Thaw/src/thaw/plugins/index/FileTable.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/FileTable.java 2006-11-02
18:50:28 UTC (rev 10797)
+++ trunk/apps/Thaw/src/thaw/plugins/index/FileTable.java 2006-11-02
22:02:57 UTC (rev 10798)
@@ -339,14 +339,6 @@
this.files = this.fileList.getFileList();
}
- if(this.files != null) {
- for(Iterator it = this.files.iterator();
- it.hasNext(); ) {
- thaw.plugins.index.File file =
(thaw.plugins.index.File)it.next();
- }
-
- }
-
this.refresh();
}
@@ -366,6 +358,9 @@
}
public Object getValueAt(int row, int column) {
+ if (row >= this.files.size())
+ return null;
+
thaw.plugins.index.File file =
(thaw.plugins.index.File)this.files.get(row);
if(column == 0)
Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java 2006-11-02 18:50:28 UTC
(rev 10797)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java 2006-11-02 22:02:57 UTC
(rev 10798)
@@ -364,6 +364,9 @@
clientGet.start(queueManager);
loadXML(clientGet.getInputStream());
save();
+
+ setChanged();
+ notifyObservers();
}
}
@@ -430,6 +433,7 @@
public void purgeLinkList() {
+ unloadLinks();
try {
Connection c = this.db.getConnection();
PreparedStatement st = c.prepareStatement("DELETE FROM
links WHERE indexParent = ?");
@@ -442,6 +446,7 @@
}
public void purgeFileList() {
+ unloadFiles();
try {
Connection c = this.db.getConnection();
PreparedStatement st = c.prepareStatement("DELETE FROM
files WHERE indexParent = ?");
@@ -611,10 +616,6 @@
////// FILE LIST ////////
public void loadFiles(String columnToSort, boolean asc) {
- if(this.fileList != null) {
- Logger.notice(this, "Files already loaded, won't reload
them");
- return;
- }
this.fileList = new Vector();
@@ -695,17 +696,6 @@
public void unloadFiles() {
- /*
- for(Iterator it = fileList.iterator();
- it.hasNext(); ) {
- thaw.plugins.index.File file =
(thaw.plugins.index.File)it.next();
- if(file.getTransfer() != null &&
!file.getTransfer().isFinished()) {
- Logger.info(this, "Transfer still runinng. No
unloading");
- return;
- }
- }
- */
-
if (this.fileList != null) {
for (Iterator it = this.fileList.iterator();
it.hasNext();)
@@ -780,8 +770,9 @@
link.insert();
this.addLinkToList(link);
- this.setChanged();
- this.notifyObservers(link);
+
+ setChanged();
+ notifyObservers(link);
}
else
Logger.notice(this, "Link already in the database for
this index");
@@ -818,11 +809,6 @@
public void loadLinks(String columnToSort, boolean asc)
{
- if(this.linkList != null) {
- Logger.notice(this, "Links aleady loaded, won't reload
...");
- return;
- }
-
this.linkList = new Vector();
try {
@@ -857,6 +843,9 @@
Logger.error(this, "Unable to get the link list for
index: '"+this.toString()+"' because: "+e.toString());
}
+ setChanged();
+ notifyObservers();
+
}
/* Returns a copy ! */
@@ -1085,6 +1074,8 @@
}
}
+ setChanged();
+ notifyObservers();
}
public void loadFileList(Element rootEl) {
Modified: trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java 2006-11-02
18:50:28 UTC (rev 10797)
+++ trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java 2006-11-02
22:02:57 UTC (rev 10798)
@@ -218,14 +218,6 @@
this.links = this.linkList.getLinkList();
}
- if(this.links != null) {
- for(Iterator it = this.links.iterator();
- it.hasNext(); ) {
- thaw.plugins.index.Link link =
(thaw.plugins.index.Link)it.next();
- //link.addObserver(this);
- }
- }
-
this.refresh();
}