Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / org.gvsig.mkmvnproject / templates / SPI+UIAPI / org.gvsig.fortunecookies / org.gvsig.fortunecookies.swing / org.gvsig.fortunecookies.swing.impl / src / main / java / org / gvsig / fortunecookies / swing / impl / DefaultFortuneCookieUIManager.java @ 32378

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

    
23
package org.gvsig.fortunecookies.swing.impl;
24

    
25
import org.gvsig.fortunecookies.FortuneCookieLocator;
26
import org.gvsig.fortunecookies.FortuneCookieManager;
27
import org.gvsig.fortunecookies.FortuneCookieService;
28
import org.gvsig.fortunecookies.swing.FortuneCookieUIManager;
29
import org.gvsig.fortunecookies.swing.FortuneCookieWindowManager;
30
import org.gvsig.fortunecookies.swing.JFortuneCookieServicePanel;
31
import org.gvsig.tools.ToolsLocator;
32
import org.gvsig.tools.i18n.I18nManager;
33
import org.gvsig.tools.service.Service;
34

    
35
public class DefaultFortuneCookieUIManager implements FortuneCookieUIManager/*, ComponentListener*/{
36

    
37
        private FortuneCookieManager manager;
38
        private I18nManager i18nmanager = null;
39
        private FortuneCookieWindowManager windowManager;
40
        
41
        
42
        public DefaultFortuneCookieUIManager(){
43
                this.manager =  FortuneCookieLocator.getManager();
44
                this.i18nmanager = ToolsLocator.getI18nManager();
45
                this.windowManager =  new DefaultFortuneCookieWindowManager(); 
46
        }
47
        
48
        public JFortuneCookieServicePanel createFortuneCookie(FortuneCookieService cookie) {
49
                JFortuneCookieServicePanel panel = new DefaultJFortuneCookieServicePanel(this, cookie);
50
                return panel;
51
        }
52

    
53
        public FortuneCookieManager getManager() {
54
                return this.manager;
55
        }
56

    
57
        public JFortuneCookieServicePanel createFortuneCookie(Service cookie) {
58
                return createFortuneCookie((FortuneCookieService)cookie);
59
        }
60

    
61
        public String getTranslation(String string) {
62
                if(this.i18nmanager==null){
63
                        return string;
64
                }
65
                return this.i18nmanager.getTranslation(string);
66
        }
67
        
68

    
69
        public void registerWindowManager(FortuneCookieWindowManager manager) {
70
                this.windowManager = manager;
71
        }
72
        
73
        public FortuneCookieWindowManager getWindowManager() {
74
                return this.windowManager;
75
        }
76
}