root / branches / v10 / extensions / extPublish / src / org / gvsig / publish / gui / addResource / AddResourcePanel.java @ 17788
History | View | Annotate | Download (4.02 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.addResource; |
42 |
|
43 |
import java.awt.event.ActionListener; |
44 |
import java.util.EventListener; |
45 |
|
46 |
import javax.swing.JPanel; |
47 |
import javax.swing.event.TreeSelectionListener; |
48 |
|
49 |
import org.gvsig.gui.beans.swing.JButton; |
50 |
import org.gvsig.publish.PublishLogger; |
51 |
import org.gvsig.publish.infoproject.IProjectInfo; |
52 |
|
53 |
import com.iver.andami.PluginServices; |
54 |
|
55 |
|
56 |
public class AddResourcePanel extends JPanel { |
57 |
|
58 |
public AddResourcePanel(){
|
59 |
super();
|
60 |
initComponents(); |
61 |
initLabels(); |
62 |
} |
63 |
private void initLabels(){ |
64 |
treePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(PluginServices.getText(this, "resources"))); |
65 |
} |
66 |
private void initComponents() { |
67 |
java.awt.GridBagConstraints gridBagConstraints; |
68 |
|
69 |
treePanel = new javax.swing.JPanel();
|
70 |
jScrollPane1 = new javax.swing.JScrollPane();
|
71 |
tree = new javax.swing.JTree();
|
72 |
buttonsPanel = new javax.swing.JPanel();
|
73 |
addButton = new JButton(); |
74 |
cancelButton = new JButton(); |
75 |
|
76 |
setLayout(new java.awt.BorderLayout());
|
77 |
|
78 |
treePanel.setLayout(new java.awt.GridBagLayout());
|
79 |
|
80 |
|
81 |
jScrollPane1.setViewportView(tree); |
82 |
|
83 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
84 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
85 |
gridBagConstraints.weightx = 1.0;
|
86 |
gridBagConstraints.weighty = 1.0;
|
87 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); |
88 |
treePanel.add(jScrollPane1, gridBagConstraints); |
89 |
|
90 |
add(treePanel, java.awt.BorderLayout.CENTER); |
91 |
|
92 |
buttonsPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
|
93 |
|
94 |
addButton.setText("add");
|
95 |
buttonsPanel.add(addButton); |
96 |
|
97 |
cancelButton.setText("cancel");
|
98 |
buttonsPanel.add(cancelButton); |
99 |
|
100 |
add(buttonsPanel, java.awt.BorderLayout.SOUTH); |
101 |
|
102 |
}// </editor-fold>
|
103 |
|
104 |
|
105 |
// Variables declaration - do not modify
|
106 |
private JButton addButton; |
107 |
private javax.swing.JPanel buttonsPanel;
|
108 |
private JButton cancelButton; |
109 |
private javax.swing.JScrollPane jScrollPane1;
|
110 |
private javax.swing.JTree tree;
|
111 |
private javax.swing.JPanel treePanel;
|
112 |
// End of variables declaration
|
113 |
|
114 |
public void setListener(EventListener listener) { |
115 |
//Sets tree listener
|
116 |
tree.addTreeSelectionListener((TreeSelectionListener) listener);
|
117 |
//Sets buttons listener
|
118 |
addButton.addActionListener((ActionListener)listener);
|
119 |
addButton.setActionCommand(AddResourceController.ADDRESOURCE_EVENT_ACCEPT); |
120 |
cancelButton.addActionListener((ActionListener)listener);
|
121 |
cancelButton.setActionCommand(AddResourceController.ADDRESOURCE_EVENT_CANCEL); |
122 |
} |
123 |
|
124 |
|
125 |
public void setModel(IProjectInfo project){ |
126 |
if (project == null){ |
127 |
PublishLogger.getLog().error("ERROR AddResourcePanel: the project can't be null");
|
128 |
}else{
|
129 |
tree.setModel(new ProjectInfoTreeModel(project));
|
130 |
} |
131 |
} |
132 |
} |