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.editor.parts;
18:
19: import java.util.List;
20:
21: import net.refractions.udig.printing.model.Page;
22: import net.refractions.udig.printing.model.PropertyListener;
23:
24: import org.eclipse.gef.editparts.AbstractTreeEditPart;
25:
26: /**
27: * Provides ...TODO summary sentence
28: * <p>
29: * TODO Description
30: * </p><p>
31: * Responsibilities:
32: * <ul>
33: * <li>
34: * <li>
35: * </ul>
36: * </p><p>
37: * Example Use:<pre><code>
38: * PageTreeEditPart x = new PageTreeEditPart( ... );
39: * TODO code example
40: * </code></pre>
41: * </p>
42: * @author Richard Gould
43: * @since 0.3
44: */
45: public class PageTreeEditPart extends AbstractTreeEditPart {
46: private InternalPropertyListener listener = new InternalPropertyListener();
47:
48: public PageTreeEditPart(Page page) {
49: super (page);
50: }
51:
52: public void activate() {
53: if (isActive()) {
54: return;
55: }
56: super .activate();
57: ((Page) getModel()).eAdapters().add(this .listener);
58: }
59:
60: public void deactivate() {
61: if (!isActive()) {
62: return;
63: }
64: super .deactivate();
65: ((Page) getModel()).eAdapters().remove(this .listener);
66: }
67:
68: protected List getModelChildren() {
69: return ((Page) getModel()).getBoxes();
70: }
71:
72: protected class InternalPropertyListener extends PropertyListener {
73:
74: /**
75: * TODO summary sentence for boxesChanged ...
76: *
77: * @see net.refractions.udig.printing.model.PropertyListener#boxesChanged()
78: *
79: */
80: protected void boxesChanged() {
81: refreshChildren();
82: }
83: }
84:
85: }
|