Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1249 → Rev 1250

/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,8 → 23,7
import ak.photoalbum.images.Thumbnailer;
import ak.photoalbum.images.ThumbnailPosition;
import ak.photoalbum.util.FileUtils;
import ak.photoalbum.util.FileNameComparator;
import ak.photoalbum.util.ImagesFilter;
import ak.photoalbum.util.ResourceFactory;
import ak.photoalbum.config.ConfigRoot;
import ak.photoalbum.config.ConfigBranch;
import ak.photoalbum.config.ConfigDirThumbnail;
116,9 → 115,9
logger.info("starting");
config = (ConfigRoot)configDigester.parse(resourceFactory.getAsStream(configPath));
 
for(Iterator i = config.getBranches(); i.hasNext(); ) {
Branch branch = new Branch((ConfigBranch)i.next());
brnaches.put(branch.getUri(), branch);
for(Iterator i = config.getBranches().iterator(); i.hasNext(); ) {
Branch branch = new Branch(resourceFactory, (ConfigBranch)i.next());
branches.put(branch.getUri(), branch);
}
 
logger.info("started");
160,11 → 159,11
+ "] not found in [" + dir.getCanonicalPath() + "]");
 
branch.getMetaInfos().clear(); // FIXME make this more intelligent
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);
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);
}
 
protected void setEntryInfo(Branch branch, IndexEntry entry, File file, boolean small)
172,7 → 171,7
{
String title = file.getName();
int[] size;
String path = getPath(file);
String path = getPath(branch, file);
 
if(file.isDirectory()) {
size = branch.getThumbnailer().getDirSize(file);
193,7 → 192,7
entry.setWidth(size[0]);
entry.setHeight(size[1]);
 
MetaInfoItem meta = findMetaInfo(branch.getImagesRoot(), file);
MetaInfoItem meta = findMetaInfo(branch, branch.getImagesRoot(), file);
if(meta != null) {
if(meta.getTitle() != null) {
entry.setTitle(meta.getTitle());
290,7 → 289,7
return meta;
}
 
protected MetaInfoItem findMetaInfo(File rootDir, File file)
protected MetaInfoItem findMetaInfo(Branch branch, File rootDir, File file)
throws IOException, SAXException
{
file = file.getCanonicalFile();
304,7 → 303,7
for(; metaItem == null; dir = dir.getParentFile()) {
if(dir == null) break;
 
MetaInfo meta = getMetaInfo(dir);
MetaInfo meta = getMetaInfo(branch, dir);
if(meta != null) {
metaItem = meta.findItem(file);
}
344,7 → 343,7
table.add(row);
 
while(rowPos < branch.getColumns() && pos < children.length) {
String path = getPath(children[pos]);
String path = getPath(branch, children[pos]);
String title = children[pos].getName();
int[] size;
 
360,7 → 359,7
URLEncoder.encode(path, URL_ENCODING),
title, children[pos].isDirectory(), size[0], size[1]);
 
MetaInfoItem meta = findMetaInfo(branch.getImagesRoot(), children[pos]);
MetaInfoItem meta = findMetaInfo(branch, branch.getImagesRoot(), children[pos]);
if(meta != null) {
if(meta.getTitle() != null) {
entry.setTitle(meta.getTitle());