possibility to include header HTML
[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.IOException;
13 import java.io.UnsupportedEncodingException;
14 import java.util.List;
15
16 import eu.svjatoslav.meviz.htmlindexer.metadata.DirectoryMetadata;
17 import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.AbstractFile;
18 import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.Picture;
19
20 /**
21  * In order to have possibility of several different layouts per directory.
22  * Universal interface is defined.
23  *
24  * Layout implementation is responsible for actual HTML generation.
25  */
26
27 public interface Layout {
28
29         /**
30          * Enlist directory.
31          */
32         public void enlistDirectory(AbstractFile directory,
33                         DirectoryMetadata parentDirectoryMetadata);
34
35         /**
36          * Enlist simple file.
37          */
38         public void enlistFile(AbstractFile file,
39                         DirectoryMetadata parentDirectoryMetadata);
40
41         /**
42          * Enlist image file.
43          */
44         public void enlistImage(Picture picture,
45                         DirectoryMetadata parentDirectoryMetadata);
46
47         /**
48          * Enlist video in OGV format.
49          *
50          * @throws UnsupportedEncodingException
51          */
52         public void enlistOgv(AbstractFile file,
53                         DirectoryMetadata parentDirectoryMetadata)
54                         throws UnsupportedEncodingException;
55
56         /**
57          * Return layout specific suffix that will be appended between
58          * index(suffix).html of generated file. This way multiple layouts can
59          * coexist in the same directory, each residing in its own HTML file.
60          */
61         public String getFileNameSuffix();
62
63         /**
64          * After necessary files have been enlisted for particular directory, use
65          * this method to retrieve generated HTML result.
66          *
67          * @param metadata
68          * @throws IOException
69          */
70         public String getHtml(final boolean showTitle,
71                         final boolean doHtmlHeaderAndFooter, DirectoryMetadata metadata)
72                         throws IOException;
73
74         /**
75          * Initialize layout for particular directory.
76          */
77         public void init(String galleryTitle, List<String> path,
78                         final AbstractIndexer indexer, IndexingContext context);
79 }