Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libUIComponent / src / org / gvsig / gui / beans / panelGroup / IPanelGroup.java @ 28501

History | View | Annotate | Download (6.45 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (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, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19

    
20
package org.gvsig.gui.beans.panelGroup;
21

    
22
import java.util.Hashtable;
23

    
24
import org.gvsig.exceptions.BaseException;
25
import org.gvsig.gui.beans.panelGroup.exceptions.EmptyPanelGroupException;
26
import org.gvsig.gui.beans.panelGroup.exceptions.EmptyPanelGroupGUIException;
27
import org.gvsig.gui.beans.panelGroup.exceptions.ListCouldntAddPanelException;
28
import org.gvsig.gui.beans.panelGroup.loaders.IPanelGroupLoader;
29
import org.gvsig.gui.beans.panelGroup.panels.IPanel;
30

    
31
/**
32
 * <p>All kind of panels which support a group of {@link IPanel IPanel} must
33
 *  implement this interface.</p>
34
 * 
35
 * @version 15/10/2007
36
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) 
37
 */
38
public interface IPanelGroup {
39
        /**
40
         * <p>Adds another {@link IPanel IPanel} to this group.</p>
41
         * 
42
         * @param panel the <code>IPanel</code> to add
43
         * 
44
         * @throws EmptyPanelGroupException if there was no panel loaded and tries to add a new one, launches this exception
45
         *  if the panel to add hasn't been registered to this component and then, no remains without panels
46
         * @throws EmptyPanelGroupGUIException if there was no panel loaded and tries to add a new one, launches this exception
47
         *  if the panel to add hasn't been set to this component graphical interface and then, no remains without panels
48
         *  in its graphical interface
49
         * 
50
         * @see #loadPanels(IPanelGroupLoader)
51
         * @see #removePanel(IPanel)
52
         */
53
        public abstract void addPanel(IPanel panel) throws BaseException;
54

    
55
        /**
56
         * <p>Removes an {@link IPanel IPanel} from this group.</p>
57
         * 
58
         * @param panel the <code>IPanel</code> to remove
59
         * 
60
         * @see #addPanel(IPanel)
61
         * @see #loadPanels(IPanelGroupLoader)
62
         */
63
        public abstract void removePanel(IPanel panel);
64

    
65
        /**
66
         * <p>Tries to load as most as possible panels using an <code>IPanelGroupLoader</code>.</p>
67
         *  
68
         * @param loader used to load the panels into this group
69
         * 
70
         * @throws ListCouldntAddPanelException list with all exceptions produced loading and adding the panels
71
         * @throws EmptyPanelGroupException launched if there was no exception during the loading and adding processes
72
         *  but there is no panel registered finally in this component
73
         * @throws EmptyPanelGroupGUIException launched if there was no exception during the loading and adding processes
74
         * there is at least one panel registered, but finally none of them is in the graphical interface of this component
75
         * 
76
         * @see #addPanel(IPanel)
77
         */
78
        public abstract void loadPanels(IPanelGroupLoader loader) throws ListCouldntAddPanelException, EmptyPanelGroupException, EmptyPanelGroupGUIException;
79

    
80
        /**
81
         * <p>Gets a reference to the active panel in this group.</p>
82
         * 
83
         * @return a reference to the active panel, or <code>null</code> if there is no any active
84
         */
85
        public abstract IPanel getActivePanel();
86

    
87
        /**
88
         * <p>Gets the properties associated to this group of panels.</p>
89
         * 
90
         * @return properties associated to this group of panels
91
         */
92
        public abstract Hashtable getProperties();
93

    
94
        /**
95
         * <p>Gets the object that has a  a ''semantically'' or ''conceptually'' relation to this panel.</p>
96
         * 
97
         * @return type of object that has reference this panel, or <code>null</code> if there has reference
98
         *  to no object
99
         */
100
        public abstract Object getReference();
101
        
102
        /**
103
         * <p>Updates the reference of all elements of the group with the new one.</p>
104
         * 
105
         * @param reference type of object that has reference this panel, or <code>null</code> if there has reference
106
         *  to no object
107
         */
108
        public abstract void updateReference(Object reference);
109

    
110
        /**
111
         * <p>Changes the visibility of an existent panel of this group. If a panel changes to invisible, then that
112
         *  panel won't be accessible by the user interface. But if changes to visible and was invisible
113
         *  before, then will appear at the same position it was in the user interface. The position is
114
         *  according the order of the insertion at the group. Anyway, the group will have that panel.</p>
115
         * 
116
         * @param panel reference to the panel with visibility has changed.
117
         * @param b the new visibility for that panel.
118
         */
119
        public abstract void setPanelInGUI(IPanel panel, boolean b);
120

    
121
        /**
122
         * <p>Returns <code>true</code> if the panel as parameter belongs to a this group and it's loaded in the graphical user interface;
123
         *  otherwise returns <code>false</code>.</p>
124
         * 
125
         * @return <code>true</code> if the panel as parameter belongs to a this group and it's loaded in the graphical user interface;
126
         *  otherwise returns <code>false</code>
127
         */
128
        public abstract boolean isPanelInGUI(IPanel panel);
129

    
130
        /**
131
         * <p>Returns the number of panels registered in this group.</p>
132
         * 
133
         * @return number of panels registered in this group
134
         */
135
        public abstract int getPanelCount();
136

    
137
        /**
138
         * <p>Returns the number of panels registered in this group that are in GUI.</p>
139
         * 
140
         * @return number of panels registered in this group that are in GUI
141
         */
142
        public abstract int getPanelInGUICount();
143

    
144
        /**
145
         * <p>Determines if the last notification received has been {@linkplain IPanel#accept()}.</code> 
146
         * 
147
         * @return <code>true</code> if that has been the last notification received, <code>false</code> otherwise
148
         */
149
        public abstract boolean isAccepted();
150

    
151
        /**
152
         * <p>Sets the parent of this component. That object must be another {@link IPanelGroup IPanelGroup} component.</p>
153
         * 
154
         * @param parent parent of this component
155
         */
156
        public abstract void setParentPanelGroup(IPanelGroup parent);
157

    
158
        /**
159
         * <p>Notifies this panel of an <i>accept</i> action.</p>
160
         */
161
        public abstract void accept();
162

    
163
        /**
164
         * <p>Notifies this panel of an <i>apply</i> action.</p>
165
         */
166
        public abstract void apply();
167

    
168
        /**
169
         * <p>Notifies this panel of a <i>cancel</i> action.</p>
170
         */
171
        public abstract void cancel();
172
}