Statistics
| Revision:

gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.swing / org.gvsig.tools.swing.api / src / main / java / org / gvsig / tools / swing / api / ToolsSwingLibrary.java @ 606

History | View | Annotate | Download (2.59 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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 2
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
 */
22
package org.gvsig.tools.swing.api;
23

    
24
import org.gvsig.tools.ToolsLibrary;
25
import org.gvsig.tools.library.AbstractLibrary;
26
import org.gvsig.tools.library.LibraryException;
27
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
28
import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager;
29
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
30

    
31
/**
32
 * Initialization of the Tools swing library.
33
 * 
34
 * @author 2010- C?sar Ordi?ana - gvSIG team
35
 */
36
public class ToolsSwingLibrary extends AbstractLibrary {
37
        
38
        @Override
39
        public void doRegistration() {
40
                super.doRegistration();
41
                registerAsAPI(ToolsSwingLibrary.class);
42
        require(ToolsLibrary.class);
43
        }
44
        
45
    @Override
46
    protected void doInitialize() throws LibraryException {
47
        // Do nothing
48
    }
49

    
50
    @Override
51
    protected void doPostInitialize() throws LibraryException {
52
        // Validates if there is any DynObjectSwingManager implementation
53
        // registered.
54
        DynObjectSwingManager dynObjectSwingManager =
55
            ToolsSwingLocator.getDynObjectSwingManager();
56

    
57
        if (dynObjectSwingManager == null) {
58
            throw new ReferenceNotRegisteredException(
59
                ToolsSwingLocator.DYNOBJECT_SWING_MANAGER_NAME,
60
                ToolsSwingLocator.getInstance());
61
        }
62

    
63
        // Validates if there is any UsabilitySwingManager implementation
64
        // registered.
65
        UsabilitySwingManager usabilitySwingManager =
66
            ToolsSwingLocator.getUsabilitySwingManager();
67

    
68
        if (usabilitySwingManager == null) {
69
            throw new ReferenceNotRegisteredException(
70
                ToolsSwingLocator.USABILITY_SWING_MANAGER_NAME,
71
                ToolsSwingLocator.getInstance());
72
        }
73
    }
74
}