gvsig-geoprocess / org.gvsig.geoprocess / trunk / org.gvsig.geoprocess / org.gvsig.geoprocess.app / org.gvsig.geoprocess.app.mainplugin / src / main / java / org / gvsig / geoprocess / sextante / gui / core / GUIFactory.java @ 245
History | View | Annotate | Download (4.06 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.geoprocess.sextante.gui.core; |
25 |
|
26 |
import java.util.List; |
27 |
|
28 |
import es.unex.sextante.dataObjects.IDataObject; |
29 |
import es.unex.sextante.gui.core.DefaultGUIFactory; |
30 |
import es.unex.sextante.gui.exceptions.WrongViewNameException; |
31 |
import es.unex.sextante.gui.toolbox.ToolboxPanel; |
32 |
|
33 |
import org.gvsig.andami.ui.mdiManager.MDIManager; |
34 |
import org.gvsig.app.ApplicationLocator; |
35 |
import org.gvsig.app.project.Project; |
36 |
import org.gvsig.app.project.documents.Document; |
37 |
import org.gvsig.app.project.documents.view.ViewDocument; |
38 |
import org.gvsig.app.project.documents.view.ViewManager; |
39 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
40 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
41 |
import org.gvsig.geoprocess.sextante.gui.cmd.BSHWindow; |
42 |
import org.gvsig.geoprocess.sextante.gui.dataExplorer.DataExplorerWindow; |
43 |
import org.gvsig.geoprocess.sextante.gui.history.HistoryWindow; |
44 |
import org.gvsig.geoprocess.sextante.gui.modeler.ModelerWindow; |
45 |
import org.gvsig.geoprocess.sextante.gui.toolbox.ToolboxWindow; |
46 |
|
47 |
/**
|
48 |
* Geoprocess UI factory.
|
49 |
*
|
50 |
* @author gvSIG Team
|
51 |
* @version $Id$
|
52 |
*/
|
53 |
public class GUIFactory extends DefaultGUIFactory { |
54 |
|
55 |
private ToolboxWindow toolbox;
|
56 |
private MDIManager uiManager = ApplicationLocator.getManager()
|
57 |
.getUIManager(); |
58 |
|
59 |
public void showToolBoxDialog() { |
60 |
uiManager.addWindow(getToolBoxWindow()); |
61 |
} |
62 |
|
63 |
private ToolboxWindow getToolBoxWindow() {
|
64 |
if (toolbox == null) { |
65 |
toolbox = new ToolboxWindow();
|
66 |
m_Toolbox = toolbox.getToolboxPanel(); |
67 |
} |
68 |
return toolbox;
|
69 |
} |
70 |
|
71 |
public ToolboxPanel getToolboxPanel() {
|
72 |
// return getToolBoxWindow().getToolboxPanel();
|
73 |
return m_Toolbox;
|
74 |
} |
75 |
|
76 |
public void showModelerDialog() { |
77 |
ModelerWindow modeler = new ModelerWindow(getToolboxPanel());
|
78 |
uiManager.addWindow(modeler); |
79 |
} |
80 |
|
81 |
public void showHistoryDialog() { |
82 |
HistoryWindow history = new HistoryWindow(getToolboxPanel());
|
83 |
uiManager.addWindow(history); |
84 |
} |
85 |
|
86 |
public void showCommandLineDialog() { |
87 |
BSHWindow bsh = new BSHWindow(getToolboxPanel());
|
88 |
uiManager.addWindow(bsh); |
89 |
} |
90 |
|
91 |
public void showDataExplorer() { |
92 |
DataExplorerWindow dataExplorer = |
93 |
new DataExplorerWindow(getToolboxPanel());
|
94 |
uiManager.addWindow(dataExplorer); |
95 |
} |
96 |
|
97 |
public void addToView(IDataObject obj, String viewName) |
98 |
throws WrongViewNameException {
|
99 |
|
100 |
Project project = ApplicationLocator.getManager().getCurrentProject(); |
101 |
List<Document> views = project.getDocuments(ViewManager.TYPENAME); |
102 |
for (int i = 0; i < views.size(); i++) { |
103 |
ViewDocument view = (ViewDocument) views.get(i); |
104 |
if (view.getName().equals(viewName)) {
|
105 |
FLayers layers = view.getMapContext().getLayers(); |
106 |
Object layer = obj.getBaseDataObject();
|
107 |
if (layer instanceof FLayer) { |
108 |
layers.addLayer((FLayer) layer); |
109 |
} |
110 |
return;
|
111 |
} |
112 |
} |
113 |
|
114 |
throw new WrongViewNameException(); |
115 |
} |
116 |
|
117 |
// public Class getDefaultParametersPanel() {
|
118 |
//
|
119 |
// return ParametersPanel.class;
|
120 |
//
|
121 |
// }
|
122 |
} |