Statistics
| Revision:

root / trunk / libraries / libUIComponent / src / org / gvsig / gui / beans / panelGroup / exceptions / PanelWithNoPreferredSizeDefinedException.java @ 17027

History | View | Annotate | Download (3.04 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.exceptions;
21

    
22
import java.util.HashMap;
23
import java.util.Map;
24

    
25
import org.gvsig.exceptions.BaseException;
26

    
27
/**
28
 * <p>If an object of type {@link IPanelGroup IPanelGroup} tries to load a panel that its preferred sized
29
 *  hasn't been initialized, (not the default preferred size), then an exception of this kind will be
30
 *  launched.</p>
31
 * 
32
 * @version 28/11/2007
33
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) 
34
 */
35
public class PanelWithNoPreferredSizeDefinedException extends BaseException {
36
        private static final long serialVersionUID = -7563554514021076720L;
37
        private HashMap<String, String> values;
38
        public static final String PANEL_LABEL = "PANEL_LABEL";
39

    
40
        /**
41
         * <p>Creates an initializes a new instance of <code>PanelWithNoPreferredSizedDefinedException</code>.</p>
42
         */
43
        public PanelWithNoPreferredSizeDefinedException() {
44
                super();
45

    
46
                // Identifier of this kind of exception
47
                this.code = serialVersionUID;
48
                
49
                // Default text that explains this kind of exception. If there is no translation associated to the
50
                // "messageKey" of this exception, then the value shown will be the value of "formatString".
51
                this.formatString = "\nPanel %(panelName) with no preferred size defined.";
52

    
53
                 // Key to the sentence that explains this exception. That key will be use for multilingual purposes.
54
                this.messageKey = "\npanel_with_no_preferred_size_defined_exception";
55
                
56
                // Map with the label of the panel
57
                values = new HashMap<String, String>();
58
        }
59

    
60
        /*
61
         * (non-Javadoc)
62
         * @see org.gvsig.exceptions.BaseException#values()
63
         */
64
        protected Map values() {
65
                return values;
66
        }
67

    
68
        /**
69
         * <p>Gets the label of the panel which is the source of this exception, or
70
         *  <code>null</code> if hasn't been defined.</p>
71
         * 
72
         * @return label of the panel which is the source of this exception
73
         */
74
        public String getPanelLabel() {
75
                return values.get(PANEL_LABEL);
76
        }
77

    
78
        /**
79
         * <p>Sets the label of the panel which is the source of this exception.</p>
80
         * 
81
         * @param panelLabel label of the panel which is the source of this exception
82
         */
83
        public void setPanelLabel(String panelLabel) {
84
                if (panelLabel == null)
85
                        values.put(PANEL_LABEL, "");
86
                else
87
                        values.put(PANEL_LABEL, panelLabel);
88
        }
89
}