gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.swing / org.gvsig.raster.swing.impl / src / main / java / org / gvsig / raster / swing / impl / DefaultRasterSwingManager.java @ 1836
History | View | Annotate | Download (6.5 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2012 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 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 |
* 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.raster.swing.impl; |
25 |
|
26 |
import java.awt.Color; |
27 |
import java.util.ArrayList; |
28 |
import java.util.HashMap; |
29 |
|
30 |
import javax.swing.ImageIcon; |
31 |
import javax.swing.JComponent; |
32 |
import javax.swing.JPanel; |
33 |
import javax.swing.table.DefaultTableModel; |
34 |
|
35 |
import org.gvsig.raster.swing.BasePanel; |
36 |
import org.gvsig.raster.swing.RasterSwingManager; |
37 |
import org.gvsig.raster.swing.RasterWindowManager; |
38 |
import org.gvsig.raster.swing.basepanel.IButtonsPanel; |
39 |
import org.gvsig.raster.swing.buttonbar.ButtonBar; |
40 |
import org.gvsig.raster.swing.gcanvas.GCanvas; |
41 |
import org.gvsig.raster.swing.impl.basepanel.ButtonsPanel; |
42 |
import org.gvsig.raster.swing.impl.buttonbar.ButtonBarContainerImpl; |
43 |
import org.gvsig.raster.swing.impl.canvas.DefaultGCanvas; |
44 |
import org.gvsig.raster.swing.impl.newlayer.CreateNewLayerPanelImpl; |
45 |
import org.gvsig.raster.swing.impl.openfile.OpenFileContainerImpl; |
46 |
import org.gvsig.raster.swing.impl.pagedtable.ModelLoaderImpl; |
47 |
import org.gvsig.raster.swing.impl.pagedtable.PagedTableImpl; |
48 |
import org.gvsig.raster.swing.impl.preview.PreviewBasePanel; |
49 |
import org.gvsig.raster.swing.impl.preview.SinglePreviewPanel; |
50 |
import org.gvsig.raster.swing.impl.roi.DefaultROIPanel; |
51 |
import org.gvsig.raster.swing.impl.tool.infobypoint.MainInfoByPointPanelImpl; |
52 |
import org.gvsig.raster.swing.infobypoint.MainInfoByPointPanel; |
53 |
import org.gvsig.raster.swing.newlayer.CreateNewLayerPanel; |
54 |
import org.gvsig.raster.swing.newlayer.FileNameManagement; |
55 |
import org.gvsig.raster.swing.openfile.OpenFileContainer; |
56 |
import org.gvsig.raster.swing.pagedtable.ModelLoader; |
57 |
import org.gvsig.raster.swing.pagedtable.PagedTable; |
58 |
import org.gvsig.raster.swing.pagedtable.TableModel; |
59 |
import org.gvsig.raster.swing.preview.DataSourcePreview; |
60 |
import org.gvsig.raster.swing.preview.PreviewPanel; |
61 |
import org.gvsig.raster.swing.preview.PreviewRenderProcess; |
62 |
import org.gvsig.raster.swing.roi.ROIPanel; |
63 |
import org.gvsig.tools.ToolsLocator; |
64 |
import org.gvsig.tools.i18n.I18nManager; |
65 |
import org.slf4j.Logger; |
66 |
import org.slf4j.LoggerFactory; |
67 |
|
68 |
/**
|
69 |
* Default implementation of the {@link CartociudadSwingManager}.
|
70 |
*
|
71 |
* @author gvSIG Team
|
72 |
* @version $Id$
|
73 |
*/
|
74 |
public class DefaultRasterSwingManager implements RasterSwingManager { |
75 |
private static final Logger logger = LoggerFactory.getLogger(DefaultRasterSwingManager.class); |
76 |
private RasterWindowManager rasterWindowManager;
|
77 |
private I18nManager i18nmanager = null; |
78 |
|
79 |
public DefaultRasterSwingManager() {
|
80 |
this.i18nmanager = ToolsLocator.getI18nManager();
|
81 |
} |
82 |
|
83 |
public String getTranslation(String key) { |
84 |
return this.i18nmanager.getTranslation(key); |
85 |
} |
86 |
|
87 |
public RasterWindowManager getWindowManager() {
|
88 |
return rasterWindowManager;
|
89 |
} |
90 |
|
91 |
public void registerWindowManager(RasterWindowManager windowManager) { |
92 |
this.rasterWindowManager = windowManager;
|
93 |
} |
94 |
|
95 |
/**
|
96 |
* Obtiene la traducci?n de la cadena de texto
|
97 |
* @param parent Ventana padre
|
98 |
* @param text Cadena a traducir
|
99 |
* @return Cadena de texto traducida
|
100 |
*/
|
101 |
public static String getText(Object parent, String key) { |
102 |
if (key == null) |
103 |
return null; |
104 |
String translation = org.gvsig.i18n.Messages.getText(key, false); |
105 |
if (translation != null) |
106 |
return translation;
|
107 |
else {
|
108 |
logger.debug("Can't find translation for ''{1}''.", key);
|
109 |
return key;
|
110 |
} |
111 |
} |
112 |
|
113 |
public BasePanel createGenericBasePanel() {
|
114 |
return new GenericBasePanel(); |
115 |
} |
116 |
|
117 |
public GCanvas createGraphicCanvas(Color backgroundColor) { |
118 |
return new DefaultGCanvas(backgroundColor); |
119 |
} |
120 |
|
121 |
@SuppressWarnings("unchecked") |
122 |
public PreviewPanel createPreviewPanel(int buttons, |
123 |
ArrayList list,
|
124 |
JPanel generalPanel,
|
125 |
JPanel downPreviewPanel,
|
126 |
PreviewRenderProcess renderProcess, |
127 |
DataSourcePreview dataSource) { |
128 |
return new PreviewBasePanel( |
129 |
buttons, |
130 |
list, |
131 |
generalPanel, |
132 |
downPreviewPanel, |
133 |
renderProcess, |
134 |
dataSource); |
135 |
} |
136 |
|
137 |
public PreviewPanel createSinglePreviewPanel(
|
138 |
PreviewRenderProcess renderProcess, DataSourcePreview dataSource) { |
139 |
return new SinglePreviewPanel( |
140 |
renderProcess, |
141 |
dataSource); |
142 |
} |
143 |
|
144 |
public PreviewPanel createSinglePreviewPanel(
|
145 |
PreviewRenderProcess renderProcess) { |
146 |
return new SinglePreviewPanel( |
147 |
renderProcess); |
148 |
} |
149 |
|
150 |
public MainInfoByPointPanel createInfoByPointPanel(
|
151 |
HashMap<String, String> translations, |
152 |
HashMap<String, ImageIcon> icons, |
153 |
JPanel extended) {
|
154 |
return new MainInfoByPointPanelImpl(translations, icons, extended); |
155 |
} |
156 |
|
157 |
public ButtonBar createButtonBar() {
|
158 |
return new ButtonBarContainerImpl(); |
159 |
} |
160 |
|
161 |
public CreateNewLayerPanel createNewLayerPanel(
|
162 |
FileNameManagement fileNameManagement, |
163 |
String tittle) {
|
164 |
return new CreateNewLayerPanelImpl(fileNameManagement, tittle); |
165 |
} |
166 |
|
167 |
public CreateNewLayerPanel createNewLayerPanel(
|
168 |
FileNameManagement fileNameManagement) { |
169 |
return new CreateNewLayerPanelImpl(fileNameManagement); |
170 |
} |
171 |
|
172 |
public OpenFileContainer createOpenFileContainer(boolean showBorder, String[] fileFilter, String defaultPath) { |
173 |
return new OpenFileContainerImpl(showBorder, fileFilter, defaultPath); |
174 |
} |
175 |
|
176 |
public ROIPanel createROIPanel() {
|
177 |
return new DefaultROIPanel(); |
178 |
} |
179 |
|
180 |
public PagedTable createPagedTable(ModelLoader modelLoader) {
|
181 |
return new PagedTableImpl(modelLoader); |
182 |
} |
183 |
|
184 |
public ModelLoader createModelLoader(TableModel tableModel) { |
185 |
return new ModelLoaderImpl((DefaultTableModel)tableModel); |
186 |
} |
187 |
|
188 |
public IButtonsPanel createButtonsPanel(int buttons, JComponent parent) { |
189 |
return new ButtonsPanel(buttons, parent); |
190 |
} |
191 |
} |