1 | /**
|
---|
2 | * PdfFrameset.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.agents;
|
---|
20 |
|
---|
21 | import java.io.IOException;
|
---|
22 |
|
---|
23 | import org.expeditee.gui.Frame;
|
---|
24 | import org.expeditee.gui.MessageBay;
|
---|
25 | import org.expeditee.io.PdfFramesetWriter;
|
---|
26 |
|
---|
27 |
|
---|
28 | public class PdfFrameset extends DefaultAgent {
|
---|
29 | private PdfFramesetWriter _pdfWriter;
|
---|
30 |
|
---|
31 | private int _firstFrame = 1;
|
---|
32 |
|
---|
33 | private int _maxFrame = Integer.MAX_VALUE;
|
---|
34 |
|
---|
35 | private boolean _showFrameNames = false;
|
---|
36 |
|
---|
37 | public PdfFrameset(int firstFrame, int maxFrame, boolean showFrameNames) {
|
---|
38 | super();
|
---|
39 | _firstFrame = firstFrame;
|
---|
40 | _maxFrame = maxFrame;
|
---|
41 | _showFrameNames = showFrameNames;
|
---|
42 | }
|
---|
43 |
|
---|
44 | public PdfFrameset(int firstFrame, int maxFrame) {
|
---|
45 | this(firstFrame, maxFrame, false);
|
---|
46 | }
|
---|
47 |
|
---|
48 | public PdfFrameset( boolean showFrameNames) {
|
---|
49 | this(1,Integer.MAX_VALUE, showFrameNames);
|
---|
50 | }
|
---|
51 |
|
---|
52 | public PdfFrameset() {
|
---|
53 | this(false);
|
---|
54 | }
|
---|
55 |
|
---|
56 | @Override
|
---|
57 | protected Frame process(Frame frame) {
|
---|
58 | _pdfWriter = new PdfFramesetWriter(_firstFrame, _maxFrame, _showFrameNames);
|
---|
59 |
|
---|
60 | try {
|
---|
61 | _pdfWriter.writeFrame(frame);
|
---|
62 | } catch (IOException e) {
|
---|
63 | MessageBay.errorMessage("PdfFrameset error: " + e.getMessage());
|
---|
64 | //e.printStackTrace();
|
---|
65 | }
|
---|
66 |
|
---|
67 | return null;
|
---|
68 | }
|
---|
69 |
|
---|
70 | @Override
|
---|
71 | public void stop(){
|
---|
72 | _pdfWriter.stop();
|
---|
73 | }
|
---|
74 | }
|
---|