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.tool.info;
18:
19: import org.eclipse.swt.widgets.Composite;
20: import org.eclipse.swt.widgets.Control;
21:
22: /**
23: * An InfoPanel is used to display a specific LayerPointInfo.
24: * <p>
25: * This interface is used by the net.refractions.udig.info.infoPanel
26: * extention point to teach the InfoTool new tricks. The extention point
27: * defines what MIME type this InfoPanel can respond to.
28: * </p><p>
29: * Responsibility is based on MIME type.
30: * <ul>
31: * <li>text/plain
32: * <li>text/html
33: * </ul>
34: * </p><p>
35: * I am a bit concerned that we will need to have LayerPointInfo remember the
36: * http request. That is; as much as WMS wants to make requests on its
37: * own - this is not what we need.
38: * </p>
39: * @author Jody Garnett
40: * @since 0.6
41: */
42: public abstract class InfoDisplay {
43:
44: /**
45: * Some displays, like a browser, requre a url to function.
46: *
47: * @return true if LayerPointInfo is required to have a request URL
48: */
49: public boolean isUrlRequired() {
50: return false;
51: }
52:
53: /**
54: * Access control created by createDisplay.
55: *
56: * @return Control used to display LayerPointInfo
57: */
58: public abstract Control getControl();
59:
60: /**
61: * Creates the SWT controls for this InfoDisplay.
62: * <p>
63: * For implementors this is a multi-step process:
64: * <ol>
65: * <li>Create one or more controls within the parent.</li>
66: * </ol>
67: * </p>
68: * @param parent the parent control
69: */
70: abstract public void createDisplay(Composite parent);
71:
72: /**
73: * Called by the InfoView to request display.
74: * <p>
75: * This method is called just before getControl().setVisiable().
76: * </p>
77: * @param info LayerPointInfo to display, or null to disable.
78: */
79: abstract public void setInfo(LayerPointInfo info);
80:
81: /**
82: * Clean up any used resources
83: */
84: public void dispose() {
85: getControl().dispose();
86: }
87:
88: }
|