Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1250 → Rev 1249

//PhotoAlbum/trunk/src/ak/photoalbum/logic/Branch.java
File deleted
//PhotoAlbum/trunk/src/ak/photoalbum/logic/Logic.java
3,10 → 3,10
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.Hashtable;
import java.util.Iterator;
import java.io.File;
import java.io.IOException;
import java.io.FileInputStream;
23,7 → 23,8
import ak.photoalbum.images.Thumbnailer;
import ak.photoalbum.images.ThumbnailPosition;
import ak.photoalbum.util.FileUtils;
import ak.photoalbum.util.ResourceFactory;
import ak.photoalbum.util.FileNameComparator;
import ak.photoalbum.util.ImagesFilter;
import ak.photoalbum.config.ConfigRoot;
import ak.photoalbum.config.ConfigBranch;
import ak.photoalbum.config.ConfigDirThumbnail;
115,9 → 116,9
logger.info("starting");
config = (ConfigRoot)configDigester.parse(resourceFactory.getAsStream(configPath));
 
for(Iterator i = config.getBranches().iterator(); i.hasNext(); ) {
Branch branch = new Branch(resourceFactory, (ConfigBranch)i.next());
branches.put(branch.getUri(), branch);
for(Iterator i = config.getBranches(); i.hasNext(); ) {
Branch branch = new Branch((ConfigBranch)i.next());
brnaches.put(branch.getUri(), branch);
}
 
logger.info("started");
159,11 → 160,11
+ "] not found in [" + dir.getCanonicalPath() + "]");
 
branch.getMetaInfos().clear(); // FIXME make this more intelligent
setEntryInfo(branch, page, file, false);
setEntryInfo(branch, current, file, true);
setEntryInfo(branch, index, dir, true);
if(pos > 0) setEntryInfo(branch, prev, children[pos-1], true);
if(pos < children.length-1) setEntryInfo(branch, next, children[pos+1], true);
setEntryInfo(page, file, false);
setEntryInfo(current, file, true);
setEntryInfo(index, dir, true);
if(pos > 0) setEntryInfo(prev, children[pos-1], true);
if(pos < children.length-1) setEntryInfo(next, children[pos+1], true);
}
 
protected void setEntryInfo(Branch branch, IndexEntry entry, File file, boolean small)
171,7 → 172,7
{
String title = file.getName();
int[] size;
String path = getPath(branch, file);
String path = getPath(file);
 
if(file.isDirectory()) {
size = branch.getThumbnailer().getDirSize(file);
192,7 → 193,7
entry.setWidth(size[0]);
entry.setHeight(size[1]);
 
MetaInfoItem meta = findMetaInfo(branch, branch.getImagesRoot(), file);
MetaInfoItem meta = findMetaInfo(branch.getImagesRoot(), file);
if(meta != null) {
if(meta.getTitle() != null) {
entry.setTitle(meta.getTitle());
289,7 → 290,7
return meta;
}
 
protected MetaInfoItem findMetaInfo(Branch branch, File rootDir, File file)
protected MetaInfoItem findMetaInfo(File rootDir, File file)
throws IOException, SAXException
{
file = file.getCanonicalFile();
303,7 → 304,7
for(; metaItem == null; dir = dir.getParentFile()) {
if(dir == null) break;
 
MetaInfo meta = getMetaInfo(branch, dir);
MetaInfo meta = getMetaInfo(dir);
if(meta != null) {
metaItem = meta.findItem(file);
}
343,7 → 344,7
table.add(row);
 
while(rowPos < branch.getColumns() && pos < children.length) {
String path = getPath(branch, children[pos]);
String path = getPath(children[pos]);
String title = children[pos].getName();
int[] size;
 
359,7 → 360,7
URLEncoder.encode(path, URL_ENCODING),
title, children[pos].isDirectory(), size[0], size[1]);
 
MetaInfoItem meta = findMetaInfo(branch, branch.getImagesRoot(), children[pos]);
MetaInfoItem meta = findMetaInfo(branch.getImagesRoot(), children[pos]);
if(meta != null) {
if(meta.getTitle() != null) {
entry.setTitle(meta.getTitle());
//PhotoAlbum/trunk/src/ak/photoalbum/logic/ResourceFactory.java
0,0 → 1,9
package ak.photoalbum.logic;
 
import java.io.InputStream;
 
public interface ResourceFactory
{
public InputStream getAsStream(String path);
}
 
//PhotoAlbum/trunk/src/ak/photoalbum/util/ResourceFactory.java
File deleted
//PhotoAlbum/trunk/src/ak/photoalbum/webapp/BranchForm.java
File deleted
//PhotoAlbum/trunk/src/ak/photoalbum/webapp/PathForm.java
3,13 → 3,25
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
 
public class PathForm
extends BranchForm
extends ActionForm
{
protected String branch;
protected String path;
 
public String getBranch()
{
return branch;
}
 
public void setBranch(String branch)
{
this.branch = branch;
}
 
public String getPath()
{
return path;
//PhotoAlbum/trunk/src/ak/photoalbum/webapp/BuildCacheAction.java
19,11 → 19,8
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
PathForm theForm = (PathForm)form;
String branch = theForm.getBranch();
 
// FIXME: show progress bar
Logic.getLogic().buildCache(branch);
Logic.getLogic().buildCache();
 
return mapping.findForward("success");
}
//PhotoAlbum/trunk/src/ak/photoalbum/webapp/ServletResourceFactory.java
2,7 → 2,7
 
import java.io.InputStream;
import javax.servlet.ServletContext;
import ak.photoalbum.util.ResourceFactory;
import ak.photoalbum.logic.ResourceFactory;
 
public class ServletResourceFactory
implements ResourceFactory