root / branches / v2_0_0_prep / extensions / extGeocoding / src / org / gvsig / geocoding / gui / relation / RelatePanel.java @ 27730
History | View | Annotate | Download (4.96 KB)
1 |
package org.gvsig.geocoding.gui.relation; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
|
5 |
import javax.swing.ImageIcon; |
6 |
import javax.swing.JButton; |
7 |
import javax.swing.JComboBox; |
8 |
import javax.swing.JPanel; |
9 |
|
10 |
import org.gvsig.geocoding.utils.GeocoUtils; |
11 |
|
12 |
import com.iver.andami.PluginServices; |
13 |
import com.iver.andami.ui.mdiManager.IWindow; |
14 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
15 |
|
16 |
public class RelatePanel extends JPanel implements IWindow { |
17 |
|
18 |
|
19 |
private static final long serialVersionUID = 1L; |
20 |
|
21 |
private JButton jButRelate; |
22 |
private JButton jButCancel; |
23 |
private JComboBox jComboResultTable; |
24 |
private JPanel jPanButtons; |
25 |
private JPanel jPanResultTable; |
26 |
|
27 |
/**
|
28 |
* Contructor
|
29 |
*/
|
30 |
public RelatePanel() {
|
31 |
initComponents(); |
32 |
|
33 |
setImages(); |
34 |
setMesages(); |
35 |
} |
36 |
|
37 |
/**
|
38 |
* initialize panel components
|
39 |
*/
|
40 |
private void initComponents() { |
41 |
java.awt.GridBagConstraints gridBagConstraints; |
42 |
|
43 |
jPanResultTable = new javax.swing.JPanel();
|
44 |
jComboResultTable = new javax.swing.JComboBox();
|
45 |
jPanButtons = new javax.swing.JPanel();
|
46 |
jButRelate = new javax.swing.JButton();
|
47 |
jButCancel = new javax.swing.JButton();
|
48 |
|
49 |
setLayout(new java.awt.GridBagLayout());
|
50 |
|
51 |
jPanResultTable.setBorder(javax.swing.BorderFactory |
52 |
.createTitledBorder("DBF Table All Results"));
|
53 |
jPanResultTable.setLayout(new java.awt.GridBagLayout());
|
54 |
|
55 |
jComboResultTable.setModel(new javax.swing.DefaultComboBoxModel(
|
56 |
new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); |
57 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
58 |
gridBagConstraints.gridx = 0;
|
59 |
gridBagConstraints.gridy = 0;
|
60 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
61 |
gridBagConstraints.weightx = 1.0;
|
62 |
gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10); |
63 |
jPanResultTable.add(jComboResultTable, gridBagConstraints); |
64 |
|
65 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
66 |
gridBagConstraints.gridx = 0;
|
67 |
gridBagConstraints.gridy = 0;
|
68 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
69 |
gridBagConstraints.weightx = 1.0;
|
70 |
gridBagConstraints.weighty = 1.0;
|
71 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); |
72 |
add(jPanResultTable, gridBagConstraints); |
73 |
|
74 |
jPanButtons.setLayout(new java.awt.GridBagLayout());
|
75 |
|
76 |
jButRelate.setText("Relate");
|
77 |
jButRelate.addActionListener(new java.awt.event.ActionListener() {
|
78 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
79 |
evRelate(evt); |
80 |
} |
81 |
}); |
82 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
83 |
gridBagConstraints.gridx = 0;
|
84 |
gridBagConstraints.gridy = 0;
|
85 |
jPanButtons.add(jButRelate, gridBagConstraints); |
86 |
|
87 |
jButCancel.setText("Cancel");
|
88 |
jButCancel.addActionListener(new java.awt.event.ActionListener() {
|
89 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
90 |
evCancel(evt); |
91 |
} |
92 |
}); |
93 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
94 |
gridBagConstraints.gridx = 1;
|
95 |
gridBagConstraints.gridy = 0;
|
96 |
gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); |
97 |
jPanButtons.add(jButCancel, gridBagConstraints); |
98 |
|
99 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
100 |
gridBagConstraints.gridx = 0;
|
101 |
gridBagConstraints.gridy = 1;
|
102 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
103 |
gridBagConstraints.weightx = 1.0;
|
104 |
gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5); |
105 |
add(jPanButtons, gridBagConstraints); |
106 |
} |
107 |
|
108 |
/**
|
109 |
*
|
110 |
* @param evt
|
111 |
*/
|
112 |
private void evRelate(java.awt.event.ActionEvent evt) { |
113 |
|
114 |
} |
115 |
|
116 |
private void evCancel(java.awt.event.ActionEvent evt) { |
117 |
IWindow[] iws = PluginServices.getMDIManager().getAllWindows();
|
118 |
for (int i = 0; i < iws.length; i++) { |
119 |
if (iws[i] instanceof RelatePanel) { |
120 |
PluginServices.getMDIManager().closeWindow(iws[i]); |
121 |
} |
122 |
} |
123 |
} |
124 |
|
125 |
/**
|
126 |
*
|
127 |
*/
|
128 |
private void setImages() { |
129 |
PluginServices ps = PluginServices.getPluginServices(this);
|
130 |
if (ps != null) { |
131 |
String baseDir = ps.getClassLoader().getBaseDir();
|
132 |
jButRelate.setIcon(new ImageIcon(baseDir + File.separator |
133 |
+ "images" + File.separator + "icons16" + File.separator |
134 |
+ "open.png"));
|
135 |
jButCancel.setIcon(new ImageIcon(baseDir + File.separator |
136 |
+ "images" + File.separator + "icons16" + File.separator |
137 |
+ "out.png"));
|
138 |
} |
139 |
} |
140 |
|
141 |
/**
|
142 |
*
|
143 |
*/
|
144 |
private void setMesages() { |
145 |
PluginServices ps = PluginServices.getPluginServices(this);
|
146 |
if (ps != null) { |
147 |
|
148 |
jPanResultTable.setBorder(GeocoUtils.getTitledBorder(ps |
149 |
.getText("pattern")));
|
150 |
this.jButRelate.setToolTipText(ps.getText("butloadpattern")); |
151 |
this.jButCancel.setText(ps.getText("exit")); |
152 |
} |
153 |
} |
154 |
|
155 |
/**
|
156 |
* get window info
|
157 |
*/
|
158 |
public WindowInfo getWindowInfo() {
|
159 |
WindowInfo info = new WindowInfo(WindowInfo.MODALDIALOG + WindowInfo.RESIZABLE);
|
160 |
info.setMinimumSize(this.getMinimumSize());
|
161 |
info.setWidth(250);
|
162 |
info.setHeight(150);
|
163 |
info.setTitle(PluginServices.getText(this, "relate_table")); |
164 |
return info;
|
165 |
} |
166 |
|
167 |
public Object getWindowProfile() { |
168 |
|
169 |
return null; |
170 |
} |
171 |
|
172 |
} |