root / branches / v10 / extensions / extPublish / src / org / gvsig / publish / gui / plugins / DefaultPublishController.java @ 13962
History | View | Annotate | Download (3.52 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004-2006 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Iba?ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package org.gvsig.publish.gui.plugins; |
42 |
|
43 |
import java.awt.event.ActionEvent; |
44 |
import java.awt.event.ActionListener; |
45 |
|
46 |
import javax.swing.JPanel; |
47 |
import javax.swing.event.TreeSelectionEvent; |
48 |
import javax.swing.event.TreeSelectionListener; |
49 |
import javax.swing.tree.DefaultMutableTreeNode; |
50 |
|
51 |
import org.gvsig.publish.ProjectPublication; |
52 |
import org.gvsig.publish.serversModel.Server; |
53 |
import org.gvsig.publish.serversModel.Service; |
54 |
|
55 |
|
56 |
public abstract class DefaultPublishController implements IPublishPluginController,TreeSelectionListener{ |
57 |
/*
|
58 |
* Events
|
59 |
*/
|
60 |
// public static String DEFAULTPUBLISHCONTROLLER_EVENT_SELECTITEM="defaultpublishcontroller_event_selectitem";
|
61 |
/*
|
62 |
* Dependences
|
63 |
*/
|
64 |
DefaultPublicationPanel publicationPanel=null;
|
65 |
|
66 |
/**
|
67 |
* Constructor
|
68 |
*
|
69 |
* Creates its view and set the controller like itself
|
70 |
*/
|
71 |
public DefaultPublishController(){
|
72 |
publicationPanel = new DefaultPublicationPanel();
|
73 |
publicationPanel.setListener(this);
|
74 |
} |
75 |
/**
|
76 |
* Sets the publication into the controller in order to update panels
|
77 |
* @param pub
|
78 |
*/
|
79 |
|
80 |
/**
|
81 |
* Gets the publication updated by the user
|
82 |
* @return
|
83 |
*/
|
84 |
|
85 |
/**
|
86 |
* Gets the JPanel to show the tree and params publication
|
87 |
*/
|
88 |
|
89 |
/**
|
90 |
* Each server must provide its own panel for servers
|
91 |
* @return
|
92 |
*/
|
93 |
public abstract IPublishPluginPanel getServerPanel(); |
94 |
public abstract IPublishPluginPanel getServicePanel(String service); |
95 |
public abstract IPublishPluginPanel getRemoteResourcePanel(String service); |
96 |
|
97 |
public Object getModel() { |
98 |
return publicationPanel.getModel();
|
99 |
} |
100 |
|
101 |
public IPublishPluginPanel getPanel() {
|
102 |
return publicationPanel;
|
103 |
} |
104 |
|
105 |
public void setModel(Object entityModel) { |
106 |
publicationPanel.setModel(entityModel); |
107 |
//If I set the model I'll show the server params
|
108 |
publicationPanel.setParamsPanel(getServerPanel()); |
109 |
} |
110 |
public void valueChanged(TreeSelectionEvent e) { |
111 |
|
112 |
//sets the correspondent panel
|
113 |
//obtengo el panel seleccionado, averiguo el tipo y obtengo su panel
|
114 |
//finalmente paso el panel a la vista de publicacion setParamsPanel
|
115 |
Object source = e.getNewLeadSelectionPath().getLastPathComponent();
|
116 |
if (source instanceof Server){ |
117 |
publicationPanel.setParamsPanel(getServerPanel()); |
118 |
} |
119 |
if (source instanceof Service){ |
120 |
Service current = (Service) source; |
121 |
publicationPanel.setParamsPanel(getServicePanel(current.getType())); |
122 |
} |
123 |
} |
124 |
|
125 |
} |