Updated copyright message.
[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 -- 2018, 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 eu.svjatoslav.meviz.htmlindexer.metadata.DirectoryMetadata;
13 import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.AbstractFile;
14 import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.Picture;
15
16 import java.io.IOException;
17 import java.io.UnsupportedEncodingException;
18 import java.util.List;
19
20 /**
21  * In order to have possibility of several different layouts per directory.
22  * Universal interface is defined.
23  * <p>
24  * Layout implementation is responsible for actual HTML generation.
25  */
26
27 public interface Layout {
28
29     /**
30      * Enlist directory.
31      */
32     void enlistDirectory(AbstractFile directory,
33                          DirectoryMetadata parentDirectoryMetadata);
34
35     /**
36      * Enlist simple file.
37      */
38     void enlistFile(AbstractFile file,
39                     DirectoryMetadata parentDirectoryMetadata);
40
41     /**
42      * Enlist image file.
43      */
44     void enlistImage(Picture picture,
45                      DirectoryMetadata parentDirectoryMetadata);
46
47     /**
48      * Enlist video in OGV format.
49      *
50      * @throws UnsupportedEncodingException
51      */
52     void enlistOgv(AbstractFile file,
53                    DirectoryMetadata parentDirectoryMetadata)
54     ;
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     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      * @throws IOException
68      */
69     String getHtml(final boolean showTitle,
70                    final boolean doHtmlHeaderAndFooter, DirectoryMetadata metadata)
71     ;
72
73     /**
74      * Initialize layout for particular directory.
75      */
76     void init(String galleryTitle, List<String> path,
77               final AbstractIndexer indexer, IndexingContext context);
78
79     void enlistWebm(AbstractFile file, DirectoryMetadata directory);
80 }