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