Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.swing / org.gvsig.fmap.dal.swing.api / src / main / java / org / gvsig / fmap / dal / swing / DALSwingLocator.java @ 43208

History | View | Annotate | Download (4.63 KB)

1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2014 gvSIG Association
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., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.fmap.dal.swing;
24

    
25
import org.gvsig.fmap.dal.EditingNotificationManager;
26
import org.gvsig.fmap.dal.swing.dataStoreParameters.DataStoreParametersPanelManager;
27
import org.gvsig.tools.locator.BaseLocator;
28

    
29
/**
30
 * @author fdiaz
31
 *
32
 */
33
public class DALSwingLocator extends BaseLocator {
34

    
35
    /**
36
     * AttributeEditor swing manager name.
37
     */
38
    public static final String SWING_MANAGER_NAME = "dal.swing.manager";
39

    
40
    /**
41
     * AttributeEditor swing manager description.
42
     */
43
    public static final String SWING_MANAGER_DESCRIPTION = "DAL Swing Manager";
44

    
45
    private static final String EDITINGNOTIFICATION_MANAGER_NAME = "dal.editingnotification.manager";
46
    private static final String EDITINGNOTIFICATION_MANAGER_DESCRIPTION = "DAL editing notification manager";
47
    
48
    private static final String DATASTOREPARAMETERSPANEL_MANAGER_NAME = "dal.DataStoreParametersPanel.manager";
49
    private static final String DATASTOREPARAMETERSPANEL_MANAGER_DESCRIPTION = "DAL DataStoreParametersPanel manager";
50
    
51
    private static final String LOCATOR_NAME = "dal.swing.locator";
52

    
53
    /**
54
     * Unique instance.
55
     */
56
    private static final DALSwingLocator INSTANCE
57
            = new DALSwingLocator();
58

    
59
    /**
60
     * Return the singleton instance.
61
     *
62
     * @return the singleton instance
63
     */
64
    public static DALSwingLocator getInstance() {
65
        return INSTANCE;
66
    }
67

    
68
    /**
69
     * Return the Locator's name
70
     *
71
     * @return a String with the Locator's name
72
     */
73
    public final String getLocatorName() {
74
        return LOCATOR_NAME;
75
    }
76

    
77
    /**
78
     * Registers the Class implementing the PersistenceManager interface.
79
     *
80
     * @param clazz implementing the SwingManager interface
81
     */
82
    public static void registerSwingManager(Class clazz) {
83
        getInstance().register(SWING_MANAGER_NAME, SWING_MANAGER_DESCRIPTION,
84
                clazz);
85
    }
86

    
87
    /**
88
     * Gets the instance of the {@link DataSwingManager} registered.
89
     *
90
     * @return {@link DataSwingManager}
91
     */
92
    public static DataSwingManager getSwingManager() {
93
        return (DataSwingManager) getInstance()
94
                .get(SWING_MANAGER_NAME);
95
    }
96

    
97
    /**
98
     * Registers the Class implementing the EditingNotificationManager interface.
99
     *
100
     * @param clazz implementing the EditingNotificationManager interface
101
     */
102
    public static void registerEditingNotificationManager(Class clazz) {
103
        getInstance().register(EDITINGNOTIFICATION_MANAGER_NAME, EDITINGNOTIFICATION_MANAGER_DESCRIPTION,
104
                clazz);
105
    }
106

    
107
    /**
108
     * Gets the instance of the {@link EditingNotificationManager} registered.
109
     *
110
     * @return {@link EditingNotificationManager}
111
     */
112
    public static EditingNotificationManager getEditingNotificationManager() {
113
        return (EditingNotificationManager) getInstance()
114
                .get(EDITINGNOTIFICATION_MANAGER_NAME);
115
    }    
116
    
117
    /**
118
     * Registers the Class implementing the DataStoreParametersPanelManager interface.
119
     *
120
     * @param clazz implementing the DataStoreParametersPanelManager interface
121
     */
122
    public static void registerDataStoreParametersPanelManager(Class clazz) {
123
        getInstance().register(
124
                DATASTOREPARAMETERSPANEL_MANAGER_NAME, 
125
                DATASTOREPARAMETERSPANEL_MANAGER_DESCRIPTION,
126
                clazz);
127
    }
128

    
129
    /**
130
     * Gets the instance of the {@link DataStoreParametersPanelManager} registered.
131
     *
132
     * @return {@link DataStoreParametersPanelManager}
133
     */
134
    public static DataStoreParametersPanelManager getDataStoreParametersPanelManager() {
135
        return (DataStoreParametersPanelManager) getInstance()
136
                .get(DATASTOREPARAMETERSPANEL_MANAGER_NAME);
137
    }    
138
    
139
}