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