1 | /**
|
---|
2 | * PNGWriter.java
|
---|
3 | * Copyright (C) 2010 New Zealand Digital Library, http://expeditee.org
|
---|
4 | *
|
---|
5 | * This program is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | package org.expeditee.io;
|
---|
20 |
|
---|
21 | import java.io.IOException;
|
---|
22 |
|
---|
23 | import org.expeditee.actions.Misc;
|
---|
24 | import org.expeditee.agents.DefaultAgent;
|
---|
25 | import org.expeditee.gui.Frame;
|
---|
26 | import org.expeditee.gui.FrameIO;
|
---|
27 | import org.expeditee.gui.MessageBay;
|
---|
28 | import org.expeditee.items.Item;
|
---|
29 |
|
---|
30 | public class PNGWriter extends AbstractHTMLWriter {
|
---|
31 | @Override
|
---|
32 | protected void writeStartFrame(Frame starting) throws IOException {
|
---|
33 | if (_filename.equalsIgnoreCase(DefaultAgent.CLIPBOARD))
|
---|
34 | return;
|
---|
35 |
|
---|
36 | indent();
|
---|
37 | String filesFolder = getFilesFolder();
|
---|
38 | String imageDirectory = FrameIO.EXPORTS_PATH + filesFolder;
|
---|
39 | String fileName = Misc.ImageFrame(starting, "PNG", imageDirectory);
|
---|
40 | if (fileName != null) {
|
---|
41 | String imageRelativeFullPath = filesFolder + fileName;
|
---|
42 | _writer.write("<p><img src = '" + imageRelativeFullPath
|
---|
43 | + "' border=1></p>");
|
---|
44 | _writer.write(ItemWriter.NEW_LINE);
|
---|
45 | } else {
|
---|
46 | MessageBay.errorMessage("Could not create image for "
|
---|
47 | + starting.getName());
|
---|
48 | }
|
---|
49 | }
|
---|
50 |
|
---|
51 | @Override
|
---|
52 | protected void writeItem(Item item) {
|
---|
53 | }
|
---|
54 | }
|
---|
55 |
|
---|
56 | // Get the inheritance right
|
---|
57 | // Make sure the outline is output correctly and to the correct file
|
---|
58 | // Output all the images into a correctly named folder xxx_files
|
---|
59 | // Add the image links to the HTML file
|
---|
60 | // Without annotations- option to do it with
|
---|