01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.printing.ui;
18:
19: import java.util.Iterator;
20:
21: import net.refractions.udig.printing.model.Box;
22: import net.refractions.udig.printing.model.Page;
23: import net.refractions.udig.project.internal.Map;
24:
25: /**
26: * A Template describes each element to be realized onto a Page. It is used to
27: * provide users with a performatted Page that can be used multiple times to
28: * easily print maps without having to worry about repositioning and resizing
29: * each Box every time they create a new page.
30: *
31: * <p>
32: * <em>Note:</em> All Box Printers used to initialize the page must also have
33: * a net.refractions.udig.printing.ui.boxprinter extension defined for it.
34: * </p>
35: *
36: * @author Richard Gould
37: */
38:
39: public interface Template extends Cloneable {
40:
41: /**
42: * This method initializes the template to the page according to its own
43: * interests. Some interests may include TODO fill me in ...
44: * <p>
45: * <em>Note:</em> All Box Printers used to initialize the page must also
46: * have a net.refractions.udig.printing.ui.boxprinter extension defined for
47: * it.
48: * </p>
49: *
50: * @param page
51: * the Page to initialize
52: * @param map
53: * the Map that this page is centered around
54: * @param width
55: * the desired width for the page, in pixels
56: * @param height
57: * the desired height for the page, in pixels
58: */
59: public void init(Page page, Map map, int width, int height);
60:
61: /**
62: * Returns an iterator that iterates over each Box contained in the
63: * template.
64: *
65: * This is used by the framework to access a Template's Boxes.
66: *
67: * @return an iterator where each element is of type Box
68: * @see Box
69: */
70: public Iterator<Box> iterator();
71:
72: /**
73: * @return A human-readable String that identifies this template
74: */
75: public String getName();
76:
77: /**
78: * Templates <b>must</b> clone themselves and their contents properly.
79: *
80: * @return a copy of this template
81: * @see Cloneable
82: * @see Object#clone
83: */
84: public Template clone();
85:
86: }
|