svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / gui / panels / PanelLinkProperties.java @ 40558
History | View | Annotate | Download (6.56 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 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.app.gui.panels; |
25 |
|
26 |
import javax.swing.DefaultComboBoxModel; |
27 |
import javax.swing.JComboBox; |
28 |
import javax.swing.JLabel; |
29 |
import javax.swing.JPanel; |
30 |
import javax.swing.JTextField; |
31 |
|
32 |
import org.gvsig.andami.PluginServices; |
33 |
import org.gvsig.app.project.documents.view.ViewDocument; |
34 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
35 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
36 |
|
37 |
|
38 |
//TODO comentado para que compile
|
39 |
public class PanelLinkProperties extends JPanel { |
40 |
|
41 |
FLayer layer=null;
|
42 |
private JPanel jPanel1 = null; |
43 |
private JLabel jLabelCampo1 = null; |
44 |
private JComboBox jComboBoxCampo1 = null; |
45 |
private JLabel jLabelExtension1 = null; |
46 |
private JTextField jTextFieldExtension1 = null; |
47 |
private JLabel jLabelAccion1 = null; |
48 |
private JComboBox jComboBoxAccion1 = null; |
49 |
private ViewDocument view;
|
50 |
|
51 |
/**
|
52 |
* This is the default constructor
|
53 |
*/
|
54 |
public PanelLinkProperties(FLayer flayer, ViewDocument vista) {
|
55 |
super();
|
56 |
// this.setLayout(new GridBagLayout());
|
57 |
this.layer=flayer;
|
58 |
view=vista; |
59 |
initialize(); |
60 |
} |
61 |
|
62 |
/**
|
63 |
* This method initializes this
|
64 |
*
|
65 |
* @return void
|
66 |
*/
|
67 |
private void initialize() { |
68 |
this.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED), PluginServices.getText(this, "Hiperenlace"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
69 |
this.setBounds(315, 195, 313, 154); |
70 |
this.add(getJPanel1(), null); |
71 |
} |
72 |
|
73 |
/**
|
74 |
* This method initializes jPanel1
|
75 |
*
|
76 |
* @return javax.swing.JPanel
|
77 |
*/
|
78 |
private JPanel getJPanel1() { |
79 |
if (jPanel1 == null) { |
80 |
jLabelAccion1 = new JLabel(); |
81 |
jLabelAccion1.setText(PluginServices.getText(this, "Accion_Predefinida") + " "); |
82 |
jLabelExtension1 = new JLabel(); |
83 |
jLabelExtension1.setText(PluginServices.getText(this,"extension")); |
84 |
jLabelCampo1 = new JLabel(); |
85 |
jLabelCampo1.setText(PluginServices.getText(this, "Campo") + " "); |
86 |
jPanel1 = new JPanel(); |
87 |
} |
88 |
jPanel1.setBounds(315, 195, 313, 154); |
89 |
jPanel1.setPreferredSize(new java.awt.Dimension(300,120)); |
90 |
//jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
|
91 |
jPanel1.add(jLabelCampo1, null);
|
92 |
jPanel1.add(getJComboBoxCampo1(), null);
|
93 |
jPanel1.add(jLabelExtension1, null);
|
94 |
jPanel1.add(getJTextFieldExtension1(), null);
|
95 |
jPanel1.add(jLabelAccion1, null);
|
96 |
jPanel1.add(getJComboBoxAccion1(), null);
|
97 |
return jPanel1;
|
98 |
} |
99 |
|
100 |
/**
|
101 |
* This method initializes jComboBoxCampo1
|
102 |
*
|
103 |
* @return javax.swing.JComboBox
|
104 |
*/
|
105 |
private JComboBox getJComboBoxCampo1() { |
106 |
if (jComboBoxCampo1 == null) { |
107 |
jComboBoxCampo1 = new JComboBox(); |
108 |
jComboBoxCampo1.setPreferredSize(new java.awt.Dimension(80,25)); |
109 |
|
110 |
if (PluginServices.getMainFrame() != null) { |
111 |
if (PluginServices.getMDIManager().getActiveWindow() instanceof AbstractViewPanel ){ |
112 |
AbstractViewPanel theView = (AbstractViewPanel)PluginServices.getMDIManager().getActiveWindow(); |
113 |
view = theView.getModel(); |
114 |
// try {
|
115 |
// if (layer instanceof FLyrVect) {
|
116 |
// FLyrVect ad = (FLyrVect) layer;
|
117 |
// DataSource ds;
|
118 |
// ds = ad.getRecordset();
|
119 |
// String[] names = new String[ds.getFieldCount()];
|
120 |
// for (int i = 0; i < ds.getFieldCount(); i++) {
|
121 |
// names[i] = ds.getFieldName(i);
|
122 |
// }
|
123 |
// //jComboBox = new javax.swing.JComboBox(names);
|
124 |
// DefaultComboBoxModel defaultModel = new DefaultComboBoxModel(names);
|
125 |
// jComboBoxCampo1.setModel(defaultModel);
|
126 |
// if (view.getSelectedField() != null) {
|
127 |
// jComboBoxCampo1.setSelectedItem(view.getSelectedField());
|
128 |
// //layer.setField(view.getSelectedField());
|
129 |
// }
|
130 |
// }else{
|
131 |
// jComboBoxCampo1 = new javax.swing.JComboBox();
|
132 |
// }
|
133 |
// } catch (ReadException e) {
|
134 |
// NotificationManager.addError("No se pudo obtener la tabla", e);
|
135 |
// }
|
136 |
} |
137 |
} |
138 |
} |
139 |
return jComboBoxCampo1;
|
140 |
} |
141 |
|
142 |
/**
|
143 |
* This method initializes jTextFieldExtension1
|
144 |
*
|
145 |
* @return javax.swing.JTextField
|
146 |
*/
|
147 |
private JTextField getJTextFieldExtension1() { |
148 |
if (jTextFieldExtension1 == null) { |
149 |
jTextFieldExtension1 = new JTextField(); |
150 |
jTextFieldExtension1.setPreferredSize(new java.awt.Dimension(40,25)); |
151 |
} |
152 |
return jTextFieldExtension1;
|
153 |
} |
154 |
|
155 |
/**
|
156 |
* This method initializes jComboBoxAccion1
|
157 |
*
|
158 |
* @return javax.swing.JComboBox
|
159 |
*/
|
160 |
private JComboBox getJComboBoxAccion1() { |
161 |
if (jComboBoxAccion1 == null) { |
162 |
jComboBoxAccion1 = new JComboBox(); |
163 |
jComboBoxAccion1.setPreferredSize(new java.awt.Dimension(120,25)); |
164 |
ComboActionModel t=new ComboActionModel();
|
165 |
DefaultComboBoxModel defaultModel1 = new DefaultComboBoxModel(t.getModel()); |
166 |
jComboBoxAccion1.setModel(defaultModel1); |
167 |
|
168 |
} |
169 |
return jComboBoxAccion1;
|
170 |
} |
171 |
} |
172 |
|
173 |
class ComboActionModel{ |
174 |
private String types[] = null; |
175 |
|
176 |
ComboActionModel(){ |
177 |
types[0]="Enlazar a ficheros de im?gen"; |
178 |
types[1]="Enlazar a ficheros de texto"; |
179 |
} |
180 |
String toString(int ind){ |
181 |
return types[ind];
|
182 |
} |
183 |
public String[] getModel(){ |
184 |
return types;
|
185 |
} |
186 |
|
187 |
public int getOrder(String field){ |
188 |
if (field.compareTo(types[0])==0){ |
189 |
return 0; |
190 |
} |
191 |
else if (field.compareTo(types[1])==0) { |
192 |
return 1; |
193 |
} |
194 |
return 1; |
195 |
} |
196 |
|
197 |
|
198 |
} |
199 |
|
200 |
class ComboActionItem { |
201 |
private String text=null; |
202 |
private int cont; |
203 |
|
204 |
public ComboActionItem(String texto, int contador){ |
205 |
text = texto; |
206 |
cont = contador; |
207 |
} |
208 |
|
209 |
public String toString() { |
210 |
return this.text; |
211 |
} |
212 |
} |