Statistics
| Revision:

gvsig-projects-pool / org.gvsig.vcsgis / trunk / org.gvsig.vcsgis / org.gvsig.vcsgis.app / org.gvsig.vcsgis.app.server / src / main / java / org / gvsig / vcsgis / app / server / VCSGisServerExtension.java @ 8713

History | View | Annotate | Download (3.29 KB)

1
/*
2
 * gvSIG. Desktop Geographic Information System.
3
 * 
4
 * Copyright (C) 2007-2020 gvSIG Association.
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 3
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, see <https://www.gnu.org/licenses/>. 
18
 * 
19
 * For any additional information, do not hesitate to contact us
20
 * at info AT gvsig.com, or visit our website www.gvsig.com.
21
 */
22
package org.gvsig.vcsgis.app.server;
23

    
24
import java.io.File;
25
import org.gvsig.andami.IconThemeHelper;
26
import org.gvsig.andami.plugins.Extension;
27
import org.gvsig.tools.ToolsLocator;
28
import org.gvsig.tools.i18n.I18nManager;
29
import org.gvsig.tools.swing.api.ToolsSwingLocator;
30
import org.gvsig.tools.swing.api.ToolsSwingUtils;
31
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
32
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2;
33

    
34
/**
35
 *
36
 * @author gvSIG Team
37
 */
38
public class VCSGisServerExtension extends Extension {
39

    
40
    private VCSGisServerPanel serverPanel = null;
41
    
42
    @Override
43
    public void initialize() {
44
        ToolsSwingUtils.registerIcons(
45
                this.getClass(), 
46
                "/images/action",
47
                "vcsgis",
48
                new String[] { "action", "tools-vcsgis-show-server","vcsgis" }
49
        ); 
50
//        ToolsSwingUtils.registerIcons(
51
//                this.getClass(), 
52
//                "/images/vcsgis",
53
//                "vcsgis",
54
//                new String[] { "vcsgis", "tools-vcsgis-server-restart","vcsgis-server" },
55
//                new String[] { "vcsgis", "tools-vcsgis-server-stop","vcsgis-server" }
56
//        ); 
57
//        ToolsSwingUtils.registerSubgroupIconScreenshot(
58
//                this.getClass(), 
59
//                "vcsgis", 
60
//                "vcsgis-server", 
61
//                "/images/screenshots/vcsgis-server.png"
62
//        );  
63
    }
64

    
65
    @Override
66
    public void postInitialize() {
67
        super.postInitialize();
68
    }
69

    
70
    
71
    @Override
72
    public boolean isEnabled() {
73
        return true;
74
    }
75

    
76
    @Override
77
    public boolean isVisible() {
78
        return true;
79
    }
80

    
81
    @Override
82
    public void execute(String actionCommand) {
83

    
84
        switch (actionCommand) {
85
            case "tools-vcsgis-show-server":
86
                this.showServer();
87
                break;
88
        }
89
    }
90

    
91
    private void showServer() {
92
        I18nManager i18n = ToolsLocator.getI18nManager();
93
        WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager();
94

    
95
        File rootFolder = new File(this.getPlugin().getPluginDirectory(),"static");
96
        if( this.serverPanel == null ) {
97
            this.serverPanel = new VCSGisServerPanel(rootFolder);
98
        }
99
        winManager.showWindow(
100
                serverPanel.asJComponent(), 
101
                i18n.getTranslation("_VCSGis_Server"), 
102
                WindowManager.MODE.WINDOW
103
        );
104
    }
105
}