public static final String encoding = "UTF-8";
- int currentColumn = 0;
-
- int horizontalColumnsLimit = 2;
-
private AbstractIndexer indexer;
private IndexingContext indexingContext;
- public void columnAdded() {
- currentColumn++;
- if (currentColumn > horizontalColumnsLimit) {
-
- currentColumn = 0;
-
- filesHtml.append("</TR>\n");
- }
- }
-
@Override
public void enlistDirectory(final AbstractFile directory) {
dirHtml.append("<TR>");
@Override
public void enlistFile(final AbstractFile file) {
- finishRow();
final String fullFileName = file.fileName;
- filesHtml.append("<TR>\n");
- filesHtml.append(" <TD colspan=\""
- + String.valueOf(horizontalColumnsLimit)
- + "\"><a href=\""
+ filesHtml.append("<div style=\"clear: both;\"><a href=\""
+ indexingContext.getGlobalUrl()
+ UrlParamEncoder.encode(indexingContext.getLocalUrl() + "/"
+ fullFileName) + "\">" + fullFileName + "</a>\n");
filesHtml.append(" ("
+ FilePathParser.getFileSizeDescription(file.getFileLength())
- + ")</TD>\n");
- filesHtml.append("</TR>\n");
+ + ")</div><br/>\n");
}
final List<Dimension> recommendedDimensions = Picture
.getThumbnailDimensions(imageSize);
- Dimension listingDimension = new Dimension(500, 500);
+ Dimension listingDimension = new Dimension(1500, 450);
if (listingDimension.width > imageSize.width)
if (listingDimension.height > imageSize.height)
final String listingThumbnailUrl = indexer.getThumbnailUrl(picture,
listingDimension, indexingContext);
- startcolumn();
-
- filesHtml.append("<TD><center><a href=\""
+ filesHtml.append("<div style=\"float:left; margin: 10px;\">");
+ filesHtml.append("<a href=\""
+ indexingContext.getGlobalUrl()
+ UrlParamEncoder.encode(indexingContext.getLocalUrl()
+ "/" + picture.fileName) + "\">\n");
filesHtml.append("</a>");
}
- filesHtml.append(")</TD>\n");
-
- columnAdded();
+ filesHtml.append(")\n");
+ filesHtml.append("</div>");
} catch (final Exception e) {
logger.error(
final GeneralFile file = (GeneralFile) abstractFile;
- finishRow();
-
filesHtml
- .append("<TR style=\"background-color: #404040; text-align: center\">\n");
- filesHtml.append("<TD style=\"text-align: center\" colspan=\""
- + String.valueOf(horizontalColumnsLimit) + "\">\n");
-
- filesHtml.append("<video controls=\"controls\" tabindex=\"0\">\n");
+ .append("<div style=\"margin: 30px; clear: both;\"><video controls=\"controls\" tabindex=\"0\">\n");
filesHtml
.append("<source type=\"video/ogg\" codecs=\"theora, vorbis\" src=\""
+ indexingContext.getGlobalUrl()
filesHtml.append("<a href=\""
+ indexingContext.getGlobalUrl()
+ UrlParamEncoder.encode(indexingContext.getLocalUrl() + "/"
- + file.fileName) + "\">download as OGV</a>\n");
-
- filesHtml.append("</TD></TR>\n");
-
- }
-
- public void finishRow() {
+ + file.fileName) + "\">download as OGV</a></div>\n");
- if (currentColumn == 0)
- return;
+ filesHtml.append("\n");
- while (currentColumn <= horizontalColumnsLimit) {
- filesHtml.append("<TD></TD>");
- currentColumn++;
- }
- filesHtml.append("</TR>\n");
- currentColumn = 0;
}
/** {@inheritDoc} */
finalHtml
.append("<CENTER><H1>" + galleryTitle + "</H1></CENTER>\n");
- finalHtml.append("<CENTER><H2>");
- for (final String p : path)
- finalHtml.append(" / " + p);
- finalHtml.append("</H2></CENTER>\n");
-
- // append directory listing
- finalHtml.append("<TABLE>\n");
-
- if (path.size() > 0) {
- finalHtml.append("<TR>");
- finalHtml.append("<TD><b><a href=\""
- + indexer.getParentDirectoryUrl(indexingContext)
- + "\"><h2> <== parent directory</h2></a></b></TD>");
- finalHtml.append("</TR>\n");
- }
-
- finalHtml.append(dirHtml.toString());
- finalHtml.append("\n<TR><TD><br></TD></TR>\n");
- finalHtml.append("</TABLE>\n");
+ showCurrentPath(finalHtml);
- // append file listing
+ listDirectories(finalHtml);
- finishRow();
- finalHtml.append("<TABLE width=\"1100\">\n");
finalHtml.append(filesHtml.toString());
- finalHtml.append("\n</TABLE>\n");
if (doHtmlHeaderAndFooter)
finalHtml.append("</font></BODY></HTML>\n");
filesHtml = new StringBuffer();
}
- public void startcolumn() {
- if (currentColumn == 0) {
- filesHtml.append("<TR>");
- currentColumn = 1;
+ private void listDirectories(final StringBuffer finalHtml) {
+ finalHtml.append("<TABLE>\n");
+
+ if (path.size() > 0) {
+ finalHtml.append("<TR>");
+ finalHtml.append("<TD><b><a href=\""
+ + indexer.getParentDirectoryUrl(indexingContext)
+ + "\"><h2> <== parent directory</h2></a></b></TD>");
+ finalHtml.append("</TR>\n");
}
+
+ finalHtml.append(dirHtml.toString());
+ finalHtml.append("\n<TR><TD><br></TD></TR>\n");
+ finalHtml.append("</TABLE>\n");
+ }
+
+ private void showCurrentPath(final StringBuffer finalHtml) {
+ finalHtml.append("<CENTER><H2>");
+ for (final String p : path)
+ finalHtml.append(" / " + p);
+ finalHtml.append("</H2></CENTER>\n");
}
}