better error handling
[meviz.git] / src / main / java / eu / svjatoslav / meviz / htmlindexer / Layout.java
1 /*
2  * Meviz - Various tools collection to work with multimedia.
3  * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU General Public License
7  * as published by the Free Software Foundation.
8  */
9
10 package eu.svjatoslav.meviz.htmlindexer;
11
12 import java.io.UnsupportedEncodingException;
13 import java.util.List;
14
15 import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.AbstractFile;
16 import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.Picture;
17
18 /**
19  * In order to have possibility of several different layouts per directory.
20  * Universal interface is defined.
21  *
22  * Layout implementation is responsible for actual HTML generation.
23  */
24
25 public interface Layout {
26
27         /**
28          * Enlist directory.
29          */
30         public void enlistDirectory(AbstractFile directory);
31
32         /**
33          * Enlist simple file.
34          */
35         public void enlistFile(AbstractFile file);
36
37         /**
38          * Enlist image file.
39          */
40         public void enlistImage(Picture picture);
41
42         /**
43          * Enlist video in OGV format.
44          *
45          * @throws UnsupportedEncodingException
46          */
47         public void enlistOgv(AbstractFile file)
48                         throws UnsupportedEncodingException;
49
50         /**
51          * Return layout specific suffix that will be appended between
52          * index(suffix).html of generated file. This way multiple layouts can
53          * coexist in the same directory, each residing in its own HTML file.
54          */
55         public String getFileNameSuffix();
56
57         /**
58          * After necessary files have been enlisted for particular directory, use
59          * this method to retrieve generated HTML result.
60          */
61         public String getHtml(final boolean showTitle,
62                         final boolean doHtmlHeaderAndFooter);
63
64         /**
65          * Initialize layout for particular directory.
66          */
67         public void init(String galleryTitle, List<String> path,
68                         final AbstractIndexer indexer, IndexingContext context);
69 }