root / trunk / libraries / libUIComponent / src / org / gvsig / gui / beans / panelGroup / exceptions / PanelWithNoPreferredSizeDefinedException.java @ 17327
History | View | Annotate | Download (3.09 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 |
import org.gvsig.gui.beans.panelGroup.IPanelGroup; |
27 |
|
28 |
/**
|
29 |
* <p>If an object of type {@link IPanelGroup IPanelGroup} tries to load a panel that its preferred sized
|
30 |
* hasn't been initialized, (not the default preferred size), then an exception of this kind will be
|
31 |
* launched.</p>
|
32 |
*
|
33 |
* @version 28/11/2007
|
34 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
|
35 |
*/
|
36 |
public class PanelWithNoPreferredSizeDefinedException extends BaseException { |
37 |
private static final long serialVersionUID = -7563554514021076720L; |
38 |
private HashMap<String, String> values; |
39 |
public static final String PANEL_LABEL = "PANEL_LABEL"; |
40 |
|
41 |
/**
|
42 |
* <p>Creates an initializes a new instance of <code>PanelWithNoPreferredSizedDefinedException</code>.</p>
|
43 |
*/
|
44 |
public PanelWithNoPreferredSizeDefinedException() {
|
45 |
super();
|
46 |
|
47 |
// Identifier of this kind of exception
|
48 |
this.code = serialVersionUID;
|
49 |
|
50 |
// Default text that explains this kind of exception. If there is no translation associated to the
|
51 |
// "messageKey" of this exception, then the value shown will be the value of "formatString".
|
52 |
this.formatString = "\nPanel %(panelName) with no preferred size defined."; |
53 |
|
54 |
// Key to the sentence that explains this exception. That key will be use for multilingual purposes.
|
55 |
this.messageKey = "\npanel_with_no_preferred_size_defined_exception"; |
56 |
|
57 |
// Map with the label of the panel
|
58 |
values = new HashMap<String, String>(); |
59 |
} |
60 |
|
61 |
/*
|
62 |
* (non-Javadoc)
|
63 |
* @see org.gvsig.exceptions.BaseException#values()
|
64 |
*/
|
65 |
protected Map values() { |
66 |
return values;
|
67 |
} |
68 |
|
69 |
/**
|
70 |
* <p>Gets the label of the panel which is the source of this exception, or
|
71 |
* <code>null</code> if hasn't been defined.</p>
|
72 |
*
|
73 |
* @return label of the panel which is the source of this exception
|
74 |
*/
|
75 |
public String getPanelLabel() { |
76 |
return values.get(PANEL_LABEL);
|
77 |
} |
78 |
|
79 |
/**
|
80 |
* <p>Sets the label of the panel which is the source of this exception.</p>
|
81 |
*
|
82 |
* @param panelLabel label of the panel which is the source of this exception
|
83 |
*/
|
84 |
public void setPanelLabel(String panelLabel) { |
85 |
if (panelLabel == null) |
86 |
values.put(PANEL_LABEL, "");
|
87 |
else
|
88 |
values.put(PANEL_LABEL, panelLabel); |
89 |
} |
90 |
} |