Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / main / java / org / gvsig / gui / beans / panelGroup / IPanelGroup.java @ 40561

History | View | Annotate | Download (6.56 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program 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
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.gui.beans.panelGroup;
25

    
26
import java.util.Hashtable;
27

    
28
import org.gvsig.tools.exception.BaseException;
29
import org.gvsig.gui.beans.panelGroup.exceptions.EmptyPanelGroupException;
30
import org.gvsig.gui.beans.panelGroup.exceptions.EmptyPanelGroupGUIException;
31
import org.gvsig.gui.beans.panelGroup.exceptions.ListCouldntAddPanelException;
32
import org.gvsig.gui.beans.panelGroup.loaders.IPanelGroupLoader;
33
import org.gvsig.gui.beans.panelGroup.panels.IPanel;
34

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

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

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

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

    
91
        /**
92
         * <p>Gets the properties associated to this group of panels.</p>
93
         * 
94
         * @return properties associated to this group of panels
95
         */
96
        public abstract Hashtable getProperties();
97

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

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

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

    
134
        /**
135
         * <p>Returns the number of panels registered in this group.</p>
136
         * 
137
         * @return number of panels registered in this group
138
         */
139
        public abstract int getPanelCount();
140

    
141
        /**
142
         * <p>Returns the number of panels registered in this group that are in GUI.</p>
143
         * 
144
         * @return number of panels registered in this group that are in GUI
145
         */
146
        public abstract int getPanelInGUICount();
147

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

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

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

    
167
        /**
168
         * <p>Notifies this panel of an <i>apply</i> action.</p>
169
         */
170
        public abstract void apply();
171

    
172
        /**
173
         * <p>Notifies this panel of a <i>cancel</i> action.</p>
174
         */
175
        public abstract void cancel();
176
}