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 @ 44340

History | View | Annotate | Download (4.84 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
    @Override
74
    public final String getLocatorName() {
75
        return LOCATOR_NAME;
76
    }
77

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

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

    
97
    public static DataSwingManager getSwingManager() {
98
        return getDataSwingManager();
99
    }
100

    
101
    public static DataSwingManager getDataSwingManager() {
102
        return (DataSwingManager) getInstance()
103
                .get(SWING_MANAGER_NAME);
104
    }
105

    
106
    /**
107
     * Registers the Class implementing the EditingNotificationManager interface.
108
     *
109
     * @param clazz implementing the EditingNotificationManager interface
110
     */
111
    public static void registerEditingNotificationManager(Class clazz) {
112
        getInstance().register(EDITINGNOTIFICATION_MANAGER_NAME, EDITINGNOTIFICATION_MANAGER_DESCRIPTION,
113
                clazz);
114
    }
115

    
116
    /**
117
     * Gets the instance of the {@link EditingNotificationManager} registered.
118
     *
119
     * @return {@link EditingNotificationManager}
120
     */
121
    public static EditingNotificationManager getEditingNotificationManager() {
122
        return (EditingNotificationManager) getInstance()
123
                .get(EDITINGNOTIFICATION_MANAGER_NAME);
124
    }    
125
    
126
    /**
127
     * Registers the Class implementing the DataStoreParametersPanelManager interface.
128
     *
129
     * @param clazz implementing the DataStoreParametersPanelManager interface
130
     */
131
    public static void registerDataStoreParametersPanelManager(Class clazz) {
132
        getInstance().register(
133
                DATASTOREPARAMETERSPANEL_MANAGER_NAME, 
134
                DATASTOREPARAMETERSPANEL_MANAGER_DESCRIPTION,
135
                clazz);
136
    }
137

    
138
    /**
139
     * Gets the instance of the {@link DataStoreParametersPanelManager} registered.
140
     *
141
     * @return {@link DataStoreParametersPanelManager}
142
     */
143
    public static DataStoreParametersPanelManager getDataStoreParametersPanelManager() {
144
        return (DataStoreParametersPanelManager) getInstance()
145
                .get(DATASTOREPARAMETERSPANEL_MANAGER_NAME);
146
    }    
147
    
148
}