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.internal;
18:
19: import java.util.ArrayList;
20: import java.util.Iterator;
21: import java.util.List;
22:
23: import net.refractions.udig.printing.model.Box;
24: import net.refractions.udig.printing.ui.Template;
25:
26: /**
27: * An abstract implementation of a Template that provides basic functionality.
28: *
29: * Classes that extend this should typically create their own boxes and
30: * organize them according to their own desires.
31: *
32: * @author Richard Gould
33: */
34: public abstract class AbstractTemplate implements Template {
35:
36: protected List<Box> boxes;
37:
38: /**
39: * Create a basic AbstractTemplate. Initalizes the boxes list.
40: */
41: public AbstractTemplate() {
42: boxes = new ArrayList<Box>();
43: }
44:
45: /** (non-Javadoc)
46: * @see net.refractions.udig.printing.ui.Template#iterator()
47: */
48: public Iterator<Box> iterator() {
49: return boxes.iterator();
50: }
51:
52: public String toString() {
53: return getName();
54: }
55:
56: public Template clone() {
57: try {
58: return (Template) super .clone();
59: } catch (CloneNotSupportedException e) {
60: e.printStackTrace();
61: return null;
62: }
63: }
64: }
|