gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.swing / org.gvsig.tools.swing.impl / src / main / java / org / gvsig / tools / swing / impl / webbrowsersimple / JWebBrowserSimpleFactory.java @ 2080
History | View | Annotate | Download (2.84 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, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.tools.swing.impl.webbrowsersimple; |
25 |
|
26 |
import java.net.URL; |
27 |
import javax.swing.ImageIcon; |
28 |
import org.gvsig.tools.swing.api.JWebBrowser; |
29 |
import org.gvsig.tools.swing.api.JWebBrowserFactory; |
30 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
31 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
32 |
import org.gvsig.tools.swing.icontheme.IconThemeManager; |
33 |
import org.gvsig.tools.swing.impl.DefaultToolsSwingManager; |
34 |
import org.gvsig.tools.swing.impl.pickercontroller.BytearrayPickerControllerImpl; |
35 |
|
36 |
/**
|
37 |
*
|
38 |
* @author jjdelcerro
|
39 |
*/
|
40 |
public class JWebBrowserSimpleFactory implements JWebBrowserFactory { |
41 |
|
42 |
@Override
|
43 |
public JWebBrowser create(Object... parameters) { |
44 |
JWebBrowserSimple wb = new JWebBrowserSimple();
|
45 |
return wb;
|
46 |
} |
47 |
|
48 |
@Override
|
49 |
public String getName() { |
50 |
return JWebBrowserSimple.class.getSimpleName();
|
51 |
} |
52 |
|
53 |
public static void selfRegister() { |
54 |
DefaultToolsSwingManager manager = (DefaultToolsSwingManager) ToolsSwingLocator.getToolsSwingManager(); |
55 |
if( manager.getJWebBrowserFactory()==null ) { |
56 |
manager.registerJWebBrowserFactory(new JWebBrowserSimpleFactory());
|
57 |
} |
58 |
String[] iconNames = new String[] { |
59 |
"webbrowser-config",
|
60 |
"webbrowser-go-backward",
|
61 |
"webbrowser-go-forward",
|
62 |
"webbrowser-refresh",
|
63 |
"webbrowser-search-backward",
|
64 |
"webbrowser-search-forward",
|
65 |
"webbrowser-search"
|
66 |
}; |
67 |
for (String iconName : iconNames) { |
68 |
URL imageResource = BytearrayPickerControllerImpl.class.getClassLoader().getResource("org/gvsig/tools/swing/impl/webbrowsersimple/images/"+iconName+".png"); |
69 |
if (imageResource != null) { |
70 |
IconThemeManager iconThemeManager = ToolsSwingLocator.getIconThemeManager(); |
71 |
IconTheme theme = iconThemeManager.getCurrent(); |
72 |
ImageIcon icon = new ImageIcon(imageResource); |
73 |
theme.registerDefault("tools", "webbrowser", iconName, icon, imageResource); |
74 |
} |
75 |
} |
76 |
|
77 |
} |
78 |
} |