You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2006/01/20 16:22:53 UTC
svn commit: r370847 -
/incubator/roller/trunk/src/org/roller/presentation/website/actions/UploadFileFormAction.java
Author: snoopdave
Date: Fri Jan 20 07:22:50 2006
New Revision: 370847
URL: http://svn.apache.org/viewcvs?rev=370847&view=rev
Log:
Alphabetical ordering for uploaded files
Modified:
incubator/roller/trunk/src/org/roller/presentation/website/actions/UploadFileFormAction.java
Modified: incubator/roller/trunk/src/org/roller/presentation/website/actions/UploadFileFormAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/website/actions/UploadFileFormAction.java?rev=370847&r1=370846&r2=370847&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/website/actions/UploadFileFormAction.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/website/actions/UploadFileFormAction.java Fri Jan 20 07:22:50 2006
@@ -4,6 +4,8 @@
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
@@ -295,6 +297,7 @@
files.add(new FileBean(rawFiles[i]));
totalSize += rawFiles[i].length();
}
+ Collections.sort(files, new FileBeanNameComparator());
}
public boolean isUploadEnabled() {
return uploadEnabled;
@@ -333,6 +336,19 @@
}
public String getName() { return file.getName(); }
public long getLength() { return file.length(); }
+ }
+
+ public class FileBeanNameComparator implements Comparator {
+ public int compare(Object o1, Object o2) {
+ FileBean fb1 = (FileBean)o1;
+ FileBean fb2 = (FileBean)o2;
+ return fb1.getName().compareTo(fb2.getName());
+ }
+ public boolean equals(Object o1, Object o2) {
+ FileBean fb1 = (FileBean)o1;
+ FileBean fb2 = (FileBean)o2;
+ return fb1.getName().equals(fb2.getName());
+ }
}
}