Revision 570 org.gvsig.chart/trunk/org.gvsig.chart/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/java/org/gvsig/project/documents/view/legend/gui/ChartLinkedLegendPanel.java
ChartLinkedLegendPanel.java | ||
---|---|---|
80 | 80 |
|
81 | 81 |
public class ChartLinkedLegendPanel extends JPanel implements ILegendPanel { |
82 | 82 |
|
83 |
/**
|
|
84 |
*
|
|
85 |
*/
|
|
86 |
private static final long serialVersionUID = -5009857246030623420L;
|
|
87 |
// private PreviewBarSymbol previewPanel = null;
|
|
88 |
private FLyrVect layer;
|
|
89 |
private int shapeType;
|
|
90 |
private IChartLegend auxLegend; // @jve:decl-index=0:
|
|
91 |
private IChartLegend theLegend;
|
|
92 |
private JPanel centerPanel = null; // @jve:decl-index=0:visual-constraint="10,10"
|
|
93 |
private JScrollPane jScrollPane = null;
|
|
94 |
private JList jFieldList = null;
|
|
95 |
private Random rand = new Random(System.currentTimeMillis());
|
|
96 |
private JPanel buttons = null;
|
|
97 |
private JButton addButton = null;
|
|
98 |
private JButton removeButton = null;
|
|
99 |
private JButton addAllButton = null;
|
|
100 |
private JButton removeAllButton = null;
|
|
101 |
private JPanel pCentral = null;
|
|
102 |
private FieldsTable fieldsTable = null; // @jve:decl-index=0:visual-constraint="746,10"
|
|
103 |
private JPanel northPanel = null;
|
|
104 |
private JPanel southPanel = null;
|
|
83 |
/**
|
|
84 |
*
|
|
85 |
*/
|
|
86 |
private static final long serialVersionUID = -5009857246030623420L;
|
|
87 |
// private PreviewBarSymbol previewPanel = null;
|
|
88 |
private FLyrVect layer;
|
|
89 |
private int shapeType;
|
|
90 |
private IChartLegend auxLegend; // @jve:decl-index=0:
|
|
91 |
private IChartLegend theLegend;
|
|
92 |
private JPanel centerPanel = null; // @jve:decl-index=0:visual-constraint="10,10"
|
|
93 |
private JScrollPane jScrollPane = null;
|
|
94 |
private JList jFieldList = null;
|
|
95 |
private Random rand = new Random(System.currentTimeMillis());
|
|
96 |
private JPanel buttons = null;
|
|
97 |
private JButton addButton = null;
|
|
98 |
private JButton removeButton = null;
|
|
99 |
private JButton addAllButton = null;
|
|
100 |
private JButton removeAllButton = null;
|
|
101 |
private JPanel pCentral = null;
|
|
102 |
private FieldsTable fieldsTable = null; // @jve:decl-index=0:visual-constraint="746,10"
|
|
103 |
private JPanel northPanel = null;
|
|
104 |
private JPanel southPanel = null;
|
|
105 | 105 |
|
106 |
private JButton bSize = null;
|
|
107 |
private JPanel symbolPanel = null;
|
|
108 |
private JLabel lBackgroundSymbol = null;
|
|
106 |
private JButton bSize = null;
|
|
107 |
private JPanel symbolPanel = null;
|
|
108 |
private JLabel lBackgroundSymbol = null;
|
|
109 | 109 |
|
110 |
private JSymbolPreviewButton bSymbolBackground = null;
|
|
111 |
private JComboBoxColorScheme colorCombo = null;
|
|
112 |
private JLabel lColorSchema = null;
|
|
110 |
private JSymbolPreviewButton bSymbolBackground = null;
|
|
111 |
private JComboBoxColorScheme colorCombo = null;
|
|
112 |
private JLabel lColorSchema = null;
|
|
113 | 113 |
|
114 |
private JCheckBox ckOnlySelection = null;
|
|
115 |
private JPanel eastPanel;
|
|
116 |
private JPanel outlinePanel;
|
|
117 |
private JLabel jLabel;
|
|
118 |
private JCheckBox jCheckBox;
|
|
119 |
private JCheckBox jShowAxis;
|
|
120 |
private JPanel jPanel;
|
|
121 |
private JLabel jLabel1;
|
|
122 |
private JPanel jPanel1;
|
|
123 |
private JNumberSpinner comboWidth;
|
|
124 |
private JPanel dimensionPanel;
|
|
125 |
private JCheckBox ck3D;
|
|
126 |
private ColorChooserPanel colorButton;
|
|
127 |
private JPanel jLinkedPane;
|
|
128 |
private JPanel jLinkedOriginPane;
|
|
129 |
private JPanel jLinkedDestinationPane;
|
|
130 |
private JTextField originTable;
|
|
131 |
private JComboBox originField;
|
|
132 |
private JCheckBox originSelection;
|
|
133 |
private JCheckBox destinationSelection;
|
|
134 |
private JComboBox destinationField;
|
|
135 |
private JComboBox destinationTable;
|
|
136 |
private JRadioButton PieCb;
|
|
137 |
private JRadioButton BarsCb;
|
|
138 |
private JPanel jChartTypePane;
|
|
139 |
private JPanel fieldsPanel;
|
|
140 |
private JComboBox timeField;
|
|
114 |
private JCheckBox ckOnlySelection = null;
|
|
115 |
private JPanel eastPanel;
|
|
116 |
private JPanel outlinePanel;
|
|
117 |
private JLabel jLabel;
|
|
118 |
private JCheckBox jCheckBox;
|
|
119 |
private JCheckBox jShowAxis;
|
|
120 |
private JPanel jPanel;
|
|
121 |
private JLabel jLabel1;
|
|
122 |
private JPanel jPanel1;
|
|
123 |
private JNumberSpinner comboWidth;
|
|
124 |
private JPanel dimensionPanel;
|
|
125 |
private JCheckBox ck3D;
|
|
126 |
private ColorChooserPanel colorButton;
|
|
127 |
private JPanel jLinkedPane;
|
|
128 |
private JPanel jLinkedOriginPane;
|
|
129 |
private JPanel jLinkedDestinationPane;
|
|
130 |
private JTextField originTable;
|
|
131 |
private JComboBox originField;
|
|
132 |
private JCheckBox originSelection;
|
|
133 |
private JCheckBox destinationSelection;
|
|
134 |
private JComboBox destinationField;
|
|
135 |
private JComboBox destinationTable;
|
|
136 |
private JRadioButton PieCb;
|
|
137 |
private JRadioButton BarsCb;
|
|
138 |
private JPanel jChartTypePane;
|
|
139 |
private JPanel fieldsPanel;
|
|
140 |
private JComboBox timeField;
|
|
141 | 141 |
|
142 |
/**
|
|
143 |
* This is the default constructor
|
|
144 |
*/
|
|
145 |
public ChartLinkedLegendPanel() {
|
|
146 |
super();
|
|
147 |
initialize();
|
|
148 |
}
|
|
142 |
/**
|
|
143 |
* This is the default constructor
|
|
144 |
*/
|
|
145 |
public ChartLinkedLegendPanel() {
|
|
146 |
super();
|
|
147 |
initialize();
|
|
148 |
}
|
|
149 | 149 |
|
150 |
/**
|
|
151 |
* This method initializes this
|
|
152 |
*
|
|
153 |
* @return void
|
|
154 |
*/
|
|
155 |
private void initialize() {
|
|
156 |
this.setSize(732, 354);
|
|
157 |
this.setLayout(new BorderLayout());
|
|
158 |
this.add(getLinkedPanel(), BorderLayout.NORTH);
|
|
159 |
this.add(getCenterPanel(), BorderLayout.CENTER);
|
|
160 |
this.add(getSouthPanel(), BorderLayout.SOUTH);
|
|
161 |
this.add(getEastPanel(), BorderLayout.EAST);
|
|
150 |
/**
|
|
151 |
* This method initializes this
|
|
152 |
*
|
|
153 |
* @return void
|
|
154 |
*/
|
|
155 |
private void initialize() {
|
|
156 |
this.setSize(732, 354);
|
|
157 |
this.setLayout(new BorderLayout());
|
|
158 |
this.add(getLinkedPanel(), BorderLayout.NORTH);
|
|
159 |
this.add(getCenterPanel(), BorderLayout.CENTER);
|
|
160 |
this.add(getSouthPanel(), BorderLayout.SOUTH);
|
|
161 |
this.add(getEastPanel(), BorderLayout.EAST);
|
|
162 | 162 |
|
163 | 163 |
// JButton btnTestLegend = new JButton("Crear leyenda de prueba!!"); |
164 | 164 |
// btnTestLegend.addActionListener(new ActionListener() { |
... | ... | |
166 | 166 |
// createTestLegend(); |
167 | 167 |
// } |
168 | 168 |
// }); |
169 |
// add(btnTestLegend, BorderLayout.SOUTH); |
|
170 |
|
|
169 |
// add(btnTestLegend, BorderLayout.SOUTH); |
|
171 | 170 |
// initializeTableDocuments(); |
171 |
//fillDestinationFieldNames((String) destinationTable.getSelectedItem()); |
|
172 |
} |
|
172 | 173 |
|
173 |
//fillDestinationFieldNames((String) destinationTable.getSelectedItem()); |
|
174 |
} |
|
174 |
private JPanel getEastPanel() { |
|
175 |
if (eastPanel == null) { |
|
176 |
eastPanel = new JPanel(); |
|
177 |
eastPanel.setLayout(new BorderLayout()); |
|
178 |
eastPanel.setPreferredSize(new Dimension(150, 52)); |
|
179 |
// eastPanel.add(getPreviewChart(), BorderLayout.NORTH); |
|
180 |
eastPanel.add(getDimensionPanel(), BorderLayout.NORTH); |
|
181 |
eastPanel.add(getOutlinePanel(), BorderLayout.CENTER); |
|
182 |
eastPanel.add(getBSize(), BorderLayout.SOUTH); |
|
183 |
} |
|
184 |
return eastPanel; |
|
185 |
} |
|
175 | 186 |
|
176 |
private JPanel getEastPanel() { |
|
177 |
if (eastPanel == null) { |
|
178 |
eastPanel = new JPanel(); |
|
179 |
eastPanel.setLayout(new BorderLayout()); |
|
180 |
eastPanel.setPreferredSize(new Dimension(150, 52)); |
|
181 |
// eastPanel.add(getPreviewChart(), BorderLayout.NORTH); |
|
182 |
eastPanel.add(getDimensionPanel(), BorderLayout.NORTH); |
|
183 |
eastPanel.add(getOutlinePanel(), BorderLayout.CENTER); |
|
184 |
eastPanel.add(getBSize(), BorderLayout.SOUTH); |
|
185 |
} |
|
186 |
return eastPanel; |
|
187 |
} |
|
187 |
private JPanel getDimensionPanel() { |
|
188 |
if (dimensionPanel == null) { |
|
189 |
dimensionPanel = new JPanel(); |
|
190 |
dimensionPanel.setLayout(new BorderLayout()); |
|
191 |
dimensionPanel.setBorder(BorderFactory.createTitledBorder(null, |
|
192 |
PluginServices.getText(this, "dimension"), |
|
193 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
194 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
|
195 |
Font.BOLD, 12), new Color(51, 51, 51))); |
|
196 |
dimensionPanel.setPreferredSize(new Dimension(150, 50)); |
|
197 |
dimensionPanel.add(getCk3D(), BorderLayout.NORTH); |
|
198 |
} |
|
199 |
return dimensionPanel; |
|
200 |
} |
|
188 | 201 |
|
189 |
private JPanel getDimensionPanel() { |
|
190 |
if (dimensionPanel == null) { |
|
191 |
dimensionPanel = new JPanel(); |
|
192 |
dimensionPanel.setLayout(new BorderLayout()); |
|
193 |
dimensionPanel.setBorder(BorderFactory.createTitledBorder(null, |
|
194 |
PluginServices.getText(this, "dimension"), |
|
195 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
196 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
|
197 |
Font.BOLD, 12), new Color(51, 51, 51))); |
|
198 |
dimensionPanel.setPreferredSize(new Dimension(150, 50)); |
|
199 |
dimensionPanel.add(getCk3D(), BorderLayout.NORTH); |
|
200 |
} |
|
201 |
return dimensionPanel; |
|
202 |
} |
|
202 |
private JCheckBox getCk3D() { |
|
203 |
if (ck3D == null) { |
|
204 |
ck3D = new JCheckBox(); |
|
205 |
ck3D.setEnabled(false); |
|
206 |
ck3D.setText(PluginServices.getText(this, "display_3d")); |
|
207 |
ck3D.addChangeListener(new ChangeListener() { |
|
208 |
public void stateChanged(ChangeEvent e) { |
|
209 |
// getPreviewChart().set3D(ck3D.isSelected()); |
|
210 |
// getPreviewChart().repaint(); |
|
211 |
// auxLegend.setIs3D(ck3D.isSelected()); |
|
212 |
} |
|
203 | 213 |
|
204 |
private JCheckBox getCk3D() { |
|
205 |
if (ck3D == null) { |
|
206 |
ck3D = new JCheckBox(); |
|
207 |
ck3D.setEnabled(false); |
|
208 |
ck3D.setText(PluginServices.getText(this, "display_3d")); |
|
209 |
ck3D.addChangeListener(new ChangeListener() { |
|
210 |
public void stateChanged(ChangeEvent e) { |
|
211 |
// getPreviewChart().set3D(ck3D.isSelected()); |
|
212 |
// getPreviewChart().repaint(); |
|
213 |
// auxLegend.setIs3D(ck3D.isSelected()); |
|
214 |
} |
|
214 |
}); |
|
215 |
} |
|
216 |
return ck3D; |
|
217 |
} |
|
215 | 218 |
|
216 |
}); |
|
217 |
} |
|
218 |
return ck3D; |
|
219 |
} |
|
219 |
private JPanel getOutlinePanel() { |
|
220 |
if (outlinePanel == null) { |
|
221 |
jLabel = new JLabel(); |
|
222 |
jLabel.setText(PluginServices.getText(this, "color")); |
|
223 |
outlinePanel = new JPanel(); |
|
224 |
outlinePanel.setLayout(new BorderLayout()); |
|
225 |
outlinePanel.setBorder(BorderFactory.createTitledBorder(null, |
|
226 |
PluginServices.getText(this, "background_color"), |
|
227 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
228 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
|
229 |
Font.BOLD, 12), new Color(51, 51, 51))); |
|
230 |
outlinePanel.setPreferredSize(new Dimension(150, 115)); |
|
231 |
outlinePanel.add(getJCheckBox(), BorderLayout.NORTH); |
|
232 |
outlinePanel.add(getJPanel(), BorderLayout.CENTER); |
|
233 |
//outlinePanel.add(getJPanel1(), BorderLayout.SOUTH); |
|
234 |
} |
|
235 |
return outlinePanel; |
|
236 |
} |
|
220 | 237 |
|
221 |
private JPanel getOutlinePanel() { |
|
222 |
if (outlinePanel == null) { |
|
223 |
jLabel = new JLabel(); |
|
224 |
jLabel.setText(PluginServices.getText(this, "color")); |
|
225 |
outlinePanel = new JPanel(); |
|
226 |
outlinePanel.setLayout(new BorderLayout()); |
|
227 |
outlinePanel.setBorder(BorderFactory.createTitledBorder(null, |
|
228 |
PluginServices.getText(this, "background_color"), |
|
229 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
230 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
|
231 |
Font.BOLD, 12), new Color(51, 51, 51))); |
|
232 |
outlinePanel.setPreferredSize(new Dimension(150, 115)); |
|
233 |
outlinePanel.add(getJCheckBox(), BorderLayout.NORTH); |
|
234 |
outlinePanel.add(getJPanel(), BorderLayout.CENTER); |
|
235 |
//outlinePanel.add(getJPanel1(), BorderLayout.SOUTH); |
|
236 |
} |
|
237 |
return outlinePanel; |
|
238 |
} |
|
238 |
private JPanel getJPanel() { |
|
239 |
if (jPanel == null) { |
|
240 |
jPanel = new JPanel(); |
|
241 |
jPanel.setLayout(new FlowLayout()); |
|
242 |
jPanel.add(jLabel, null); |
|
243 |
jPanel.add(getColorButton(), null); |
|
244 |
} |
|
245 |
return jPanel; |
|
246 |
} |
|
239 | 247 |
|
240 |
private JPanel getJPanel() { |
|
241 |
if (jPanel == null) { |
|
242 |
jPanel = new JPanel(); |
|
243 |
jPanel.setLayout(new FlowLayout()); |
|
244 |
jPanel.add(jLabel, null); |
|
245 |
jPanel.add(getColorButton(), null); |
|
246 |
} |
|
247 |
return jPanel; |
|
248 |
} |
|
249 |
|
|
250 |
private ColorChooserPanel getColorButton() { |
|
251 |
if (colorButton == null) { |
|
252 |
colorButton = new ColorChooserPanel(true); |
|
253 |
colorButton.setColor(Color.black); |
|
254 |
Dimension dim = colorButton.getPreferredSize(); |
|
255 |
colorButton.setPreferredSize(new Dimension(dim.width-10, dim.height)); |
|
248 |
private ColorChooserPanel getColorButton() { |
|
249 |
if (colorButton == null) { |
|
250 |
colorButton = new ColorChooserPanel(true); |
|
251 |
colorButton.setColor(Color.black); |
|
252 |
Dimension dim = colorButton.getPreferredSize(); |
|
253 |
colorButton.setPreferredSize(new Dimension(dim.width - 10, dim.height)); |
|
256 | 254 |
// colorButton.addActionListener(new ActionListener() { |
257 | 255 |
// public void actionPerformed(ActionEvent e) { |
258 | 256 |
// // getPreviewChart().setOutLineColor(colorButton.getColor()); |
... | ... | |
260 | 258 |
// auxLegend.setOutlineColor(colorButton.getColor()); |
261 | 259 |
// } |
262 | 260 |
// }); |
263 |
}
|
|
264 |
return colorButton;
|
|
265 |
}
|
|
261 |
}
|
|
262 |
return colorButton;
|
|
263 |
}
|
|
266 | 264 |
|
267 |
/**
|
|
268 |
* This method initializes jPanel1
|
|
269 |
*
|
|
270 |
* @return javax.swing.JPanel
|
|
271 |
*/
|
|
272 |
private JPanel getJPanel1() {
|
|
273 |
if (jPanel1 == null) {
|
|
274 |
jLabel1 = new JLabel();
|
|
275 |
jLabel1.setText(PluginServices.getText(this, "width"));
|
|
276 |
jPanel1 = new JPanel();
|
|
277 |
jPanel1.setLayout(new FlowLayout());
|
|
278 |
jPanel1.add(jLabel1, null);
|
|
279 |
jPanel1.add(getComboWidth(), null);
|
|
280 |
}
|
|
281 |
return jPanel1;
|
|
282 |
}
|
|
265 |
/**
|
|
266 |
* This method initializes jPanel1
|
|
267 |
*
|
|
268 |
* @return javax.swing.JPanel
|
|
269 |
*/
|
|
270 |
private JPanel getJPanel1() {
|
|
271 |
if (jPanel1 == null) {
|
|
272 |
jLabel1 = new JLabel();
|
|
273 |
jLabel1.setText(PluginServices.getText(this, "width"));
|
|
274 |
jPanel1 = new JPanel();
|
|
275 |
jPanel1.setLayout(new FlowLayout());
|
|
276 |
jPanel1.add(jLabel1, null);
|
|
277 |
jPanel1.add(getComboWidth(), null);
|
|
278 |
}
|
|
279 |
return jPanel1;
|
|
280 |
}
|
|
283 | 281 |
|
284 |
private JNumberSpinner getComboWidth() {
|
|
285 |
if (comboWidth == null) {
|
|
282 |
private JNumberSpinner getComboWidth() {
|
|
283 |
if (comboWidth == null) {
|
|
286 | 284 |
comboWidth = new JNumberSpinner(String.valueOf(1), 3, 0, Integer.MAX_VALUE, 1); |
287 | 285 |
// comboWidth.addActionListener(new ActionListener() { |
288 | 286 |
// public void actionPerformed(ActionEvent e) { |
... | ... | |
292 | 290 |
// } |
293 | 291 |
// |
294 | 292 |
// }); |
295 |
}
|
|
296 |
return comboWidth;
|
|
297 |
}
|
|
293 |
}
|
|
294 |
return comboWidth;
|
|
295 |
}
|
|
298 | 296 |
|
299 |
private JCheckBox getShowAxis() {
|
|
300 |
if (jShowAxis == null) {
|
|
301 |
jShowAxis = new JCheckBox();
|
|
302 |
jShowAxis.setEnabled(false);
|
|
303 |
jShowAxis.setText(PluginServices.getText(this, "show_axis"));
|
|
304 |
}
|
|
305 |
return jShowAxis;
|
|
306 |
}
|
|
297 |
private JCheckBox getShowAxis() {
|
|
298 |
if (jShowAxis == null) {
|
|
299 |
jShowAxis = new JCheckBox();
|
|
300 |
jShowAxis.setEnabled(false);
|
|
301 |
jShowAxis.setText(PluginServices.getText(this, "show_axis"));
|
|
302 |
}
|
|
303 |
return jShowAxis;
|
|
304 |
}
|
|
307 | 305 |
|
308 |
private JCheckBox getJCheckBox() {
|
|
309 |
if (jCheckBox == null) {
|
|
310 |
jCheckBox = new JCheckBox();
|
|
311 |
jCheckBox.setText(PluginServices.getText(this, "Show"));
|
|
306 |
private JCheckBox getJCheckBox() {
|
|
307 |
if (jCheckBox == null) {
|
|
308 |
jCheckBox = new JCheckBox();
|
|
309 |
jCheckBox.setText(PluginServices.getText(this, "Show"));
|
|
312 | 310 |
// jCheckBox.addChangeListener(new ChangeListener() { |
313 | 311 |
// public void stateChanged(ChangeEvent e) { |
314 | 312 |
// // getPreviewChart().setOutlineShow(jCheckBox.isSelected()); |
... | ... | |
317 | 315 |
// } |
318 | 316 |
// |
319 | 317 |
// }); |
320 |
}
|
|
321 |
return jCheckBox;
|
|
322 |
}
|
|
318 |
}
|
|
319 |
return jCheckBox;
|
|
320 |
}
|
|
323 | 321 |
|
324 |
private JPanel getSouthPanel() {
|
|
325 |
if (southPanel == null) {
|
|
326 |
southPanel = new JPanel();
|
|
327 |
southPanel.setLayout(new FlowLayout());
|
|
328 |
southPanel.setPreferredSize(new Dimension(170, 50));
|
|
329 |
southPanel.add(getSymbolPanel(), null);
|
|
330 |
southPanel.add(getNorthPanel(), null);
|
|
331 |
southPanel.add(getBSize(), null);
|
|
332 |
southPanel.add(getCkOnlySelection(), null);
|
|
333 |
}
|
|
334 |
return southPanel;
|
|
335 |
}
|
|
322 |
private JPanel getSouthPanel() {
|
|
323 |
if (southPanel == null) {
|
|
324 |
southPanel = new JPanel();
|
|
325 |
southPanel.setLayout(new FlowLayout());
|
|
326 |
southPanel.setPreferredSize(new Dimension(170, 50));
|
|
327 |
southPanel.add(getSymbolPanel(), null);
|
|
328 |
southPanel.add(getNorthPanel(), null);
|
|
329 |
southPanel.add(getBSize(), null);
|
|
330 |
southPanel.add(getCkOnlySelection(), null);
|
|
331 |
}
|
|
332 |
return southPanel;
|
|
333 |
}
|
|
336 | 334 |
|
337 |
private JPanel getSymbolPanel() {
|
|
338 |
if (symbolPanel == null) {
|
|
339 |
lBackgroundSymbol = new JLabel();
|
|
340 |
lBackgroundSymbol.setText(PluginServices.getText(this,
|
|
341 |
"background_symbol"));
|
|
342 |
lBackgroundSymbol.setText(PluginServices.getText(this,
|
|
343 |
"show_axis"));
|
|
344 |
symbolPanel = new JPanel();
|
|
345 |
symbolPanel.setLayout(new FlowLayout());
|
|
346 |
symbolPanel.setPreferredSize(new Dimension(241, 40));
|
|
335 |
private JPanel getSymbolPanel() {
|
|
336 |
if (symbolPanel == null) {
|
|
337 |
lBackgroundSymbol = new JLabel();
|
|
338 |
lBackgroundSymbol.setText(PluginServices.getText(this,
|
|
339 |
"background_symbol"));
|
|
340 |
lBackgroundSymbol.setText(PluginServices.getText(this,
|
|
341 |
"show_axis"));
|
|
342 |
symbolPanel = new JPanel();
|
|
343 |
symbolPanel.setLayout(new FlowLayout());
|
|
344 |
symbolPanel.setPreferredSize(new Dimension(241, 40));
|
|
347 | 345 |
// symbolPanel.add(lBackgroundSymbol, null); |
348 | 346 |
// symbolPanel.add(getBackgroundSymbol(), null); |
349 |
symbolPanel.add(getShowAxis(), null);
|
|
347 |
symbolPanel.add(getShowAxis(), null);
|
|
350 | 348 |
|
351 |
}
|
|
352 |
return symbolPanel;
|
|
353 |
}
|
|
349 |
}
|
|
350 |
return symbolPanel;
|
|
351 |
}
|
|
354 | 352 |
|
353 |
// ?? Este s?mbolo no deber?a ser independiente del typo de capa |
|
354 |
private JSymbolPreviewButton getBackgroundSymbol() { |
|
355 |
if (bSymbolBackground == null) { |
|
356 |
bSymbolBackground = new JSymbolPreviewButton(shapeType); |
|
357 |
bSymbolBackground.setPreferredSize(new Dimension(110, 20)); |
|
358 |
bSymbolBackground.addActionListener(new ActionListener() { |
|
359 |
public void actionPerformed(ActionEvent e) { |
|
360 |
// getPreviewChart().setBackgroundSymbol(bSymbolBackground.getSymbol()); |
|
361 |
// getPreviewChart().repaint(); |
|
362 |
} |
|
363 |
}); |
|
364 |
} |
|
365 |
return bSymbolBackground; |
|
366 |
} |
|
355 | 367 |
|
356 |
// ?? Este s?mbolo no deber?a ser independiente del typo de capa |
|
357 |
private JSymbolPreviewButton getBackgroundSymbol() { |
|
358 |
if (bSymbolBackground == null) { |
|
359 |
bSymbolBackground = new JSymbolPreviewButton(shapeType); |
|
360 |
bSymbolBackground.setPreferredSize(new Dimension(110, 20)); |
|
361 |
bSymbolBackground.addActionListener(new ActionListener() { |
|
362 |
public void actionPerformed(ActionEvent e) { |
|
363 |
// getPreviewChart().setBackgroundSymbol(bSymbolBackground.getSymbol()); |
|
364 |
// getPreviewChart().repaint(); |
|
365 |
} |
|
366 |
}); |
|
367 |
} |
|
368 |
return bSymbolBackground; |
|
369 |
} |
|
368 |
private JButton getBSize() { |
|
369 |
if (bSize == null) { |
|
370 |
bSize = new JButton(); |
|
371 |
bSize.setText(PluginServices.getText(this, "size")); |
|
372 |
bSize.setPreferredSize(new Dimension(100, 30)); |
|
373 |
bSize.setMaximumSize(new Dimension(100, 30)); |
|
374 |
bSize.addActionListener(new ActionListener() { |
|
375 |
public void actionPerformed(ActionEvent e) { |
|
376 |
PluginServices.getMDIManager().addCentredWindow( |
|
377 |
new SizePanel(layer, auxLegend)); |
|
378 |
} |
|
370 | 379 |
|
371 |
private JButton getBSize() { |
|
372 |
if (bSize == null) { |
|
373 |
bSize = new JButton(); |
|
374 |
bSize.setText(PluginServices.getText(this, "size")); |
|
375 |
bSize.setPreferredSize(new Dimension(100, 30)); |
|
376 |
bSize.setMaximumSize(new Dimension(100, 30)); |
|
377 |
bSize.addActionListener(new ActionListener() { |
|
378 |
public void actionPerformed(ActionEvent e) { |
|
379 |
PluginServices.getMDIManager().addCentredWindow( |
|
380 |
new SizePanel(layer, auxLegend)); |
|
381 |
} |
|
380 |
}); |
|
381 |
} |
|
382 |
return bSize; |
|
383 |
} |
|
382 | 384 |
|
383 |
}); |
|
384 |
} |
|
385 |
return bSize; |
|
386 |
} |
|
385 |
/** |
|
386 |
* This method initializes centerPanel |
|
387 |
* |
|
388 |
* @return javax.swing.JPanel |
|
389 |
*/ |
|
390 |
private JPanel getCenterPanel() { |
|
391 |
if (centerPanel == null) { |
|
392 |
centerPanel = new JPanel(); |
|
393 |
centerPanel.setLayout(new BorderLayout()); |
|
394 |
centerPanel.setPreferredSize(new Dimension(350, 150)); |
|
395 |
centerPanel.add(getChartTypePanel(), BorderLayout.NORTH); |
|
396 |
centerPanel.add(getJScrollPane(), BorderLayout.WEST); |
|
397 |
centerPanel.add(getButtons(), BorderLayout.CENTER); |
|
398 |
centerPanel.add(getFieldsPane(), java.awt.BorderLayout.EAST); |
|
399 |
} |
|
400 |
return centerPanel; |
|
401 |
} |
|
387 | 402 |
|
388 |
/** |
|
389 |
* This method initializes centerPanel |
|
390 |
* |
|
391 |
* @return javax.swing.JPanel |
|
392 |
*/ |
|
393 |
private JPanel getCenterPanel() { |
|
394 |
if (centerPanel == null) { |
|
395 |
centerPanel = new JPanel(); |
|
396 |
centerPanel.setLayout(new BorderLayout()); |
|
397 |
centerPanel.setPreferredSize(new Dimension(350, 150)); |
|
398 |
centerPanel.add(getChartTypePanel(),BorderLayout.NORTH); |
|
399 |
centerPanel.add(getJScrollPane(), BorderLayout.WEST); |
|
400 |
centerPanel.add(getButtons(), BorderLayout.CENTER); |
|
401 |
centerPanel.add(getFieldsPane(), java.awt.BorderLayout.EAST); |
|
402 |
} |
|
403 |
return centerPanel; |
|
404 |
} |
|
403 |
private JPanel getFieldsPane() { |
|
404 |
if (fieldsPanel == null) { |
|
405 |
fieldsPanel = new JPanel(); |
|
406 |
fieldsPanel.setLayout(new BorderLayout()); |
|
407 |
fieldsPanel.add(getFieldsTable(), BorderLayout.NORTH); |
|
408 |
JLabel label = new JLabel(); |
|
409 |
label.setPreferredSize(new Dimension(125, 20)); |
|
410 |
label.setText(PluginServices.getText(this, "time_field")); |
|
411 |
fieldsPanel.add(label, BorderLayout.WEST); |
|
412 |
timeField = new JComboBox(); |
|
413 |
timeField.setPreferredSize(new Dimension(75, 20)); |
|
414 |
fieldsPanel.add(timeField, BorderLayout.CENTER); |
|
415 |
} |
|
416 |
return fieldsPanel; |
|
417 |
} |
|
405 | 418 |
|
419 |
private JPanel getPCentral() { |
|
420 |
if (pCentral == null) { |
|
421 |
pCentral = new JPanel(); |
|
422 |
pCentral.setLayout(new FlowLayout()); |
|
423 |
pCentral.setPreferredSize(new Dimension(50, 185)); |
|
424 |
pCentral.add(getRemoveAllButton(), null); |
|
425 |
pCentral.add(getAddAllButton(), null); |
|
426 |
pCentral.add(getRemoveButton(), null); |
|
427 |
pCentral.add(getAddButton(), null); |
|
428 |
} |
|
429 |
return pCentral; |
|
430 |
} |
|
406 | 431 |
|
407 |
private JPanel getFieldsPane() { |
|
408 |
if(fieldsPanel == null){ |
|
409 |
fieldsPanel = new JPanel(); |
|
410 |
fieldsPanel.setLayout(new BorderLayout()); |
|
411 |
fieldsPanel.add(getFieldsTable(),BorderLayout.NORTH); |
|
412 |
JLabel label = new JLabel(); |
|
413 |
label.setPreferredSize(new Dimension(125,20)); |
|
414 |
label.setText(PluginServices.getText(this, "time_field")); |
|
415 |
fieldsPanel.add(label,BorderLayout.WEST); |
|
416 |
timeField = new JComboBox(); |
|
417 |
timeField.setPreferredSize(new Dimension(75,20)); |
|
418 |
fieldsPanel.add(timeField,BorderLayout.CENTER); |
|
419 |
} |
|
420 |
return fieldsPanel; |
|
421 |
} |
|
432 |
private JButton getAddButton() { |
|
433 |
if (addButton == null) { |
|
434 |
addButton = new JButton(); |
|
435 |
addButton.setText(">"); |
|
436 |
addButton.setPreferredSize(new Dimension(50, 40)); |
|
437 |
addButton.addActionListener(new java.awt.event.ActionListener() { |
|
438 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
439 |
Object[] fields = getJFieldList().getSelectedValues(); |
|
440 |
Color[] colorScheme = colorCombo.getSelectedColors(); |
|
422 | 441 |
|
442 |
Color[] colors = new Color[colorScheme.length]; |
|
443 |
for (int i = 0; i < colorScheme.length; i++) { |
|
444 |
colors[i] = colorScheme[i]; |
|
445 |
} |
|
446 |
for (int i = 0; i < fields.length; i++) { |
|
447 |
getFieldsTable().addTableRecord( |
|
448 |
colorScheme[rand.nextInt(colorScheme.length)], |
|
449 |
(String) fields[i], (String) fields[i]); |
|
450 |
((DefaultListModel) getJFieldList().getModel()) |
|
451 |
.removeElement(fields[i]); |
|
452 |
} |
|
453 |
actualizePreviewSymbol(); |
|
454 |
} |
|
455 |
}); |
|
456 |
} |
|
457 |
return addButton; |
|
458 |
} |
|
423 | 459 |
|
424 |
private JPanel getPCentral() { |
|
425 |
if (pCentral == null) { |
|
426 |
pCentral = new JPanel(); |
|
427 |
pCentral.setLayout(new FlowLayout()); |
|
428 |
pCentral.setPreferredSize(new Dimension(50, 185)); |
|
429 |
pCentral.add(getRemoveAllButton(), null); |
|
430 |
pCentral.add(getAddAllButton(), null); |
|
431 |
pCentral.add(getRemoveButton(), null); |
|
432 |
pCentral.add(getAddButton(), null); |
|
433 |
} |
|
434 |
return pCentral; |
|
435 |
} |
|
460 |
/** |
|
461 |
* This method initializes northPanel |
|
462 |
* |
|
463 |
* @return javax.swing.JPanel |
|
464 |
*/ |
|
465 |
private JPanel getNorthPanel() { |
|
466 |
if (northPanel == null) { |
|
467 |
lColorSchema = new JLabel(); |
|
468 |
lColorSchema.setText(PluginServices.getText(this, "color_schema")); |
|
469 |
northPanel = new JPanel(); |
|
470 |
northPanel.setLayout(new FlowLayout()); |
|
471 |
northPanel.add(lColorSchema, null); |
|
472 |
northPanel.add(getColorCombo()); |
|
473 |
} |
|
474 |
return northPanel; |
|
475 |
} |
|
436 | 476 |
|
437 |
private JButton getAddButton() { |
|
438 |
if (addButton == null) { |
|
439 |
addButton = new JButton(); |
|
440 |
addButton.setText(">"); |
|
441 |
addButton.setPreferredSize(new Dimension(50, 40)); |
|
442 |
addButton.addActionListener(new java.awt.event.ActionListener() { |
|
443 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
444 |
Object[] fields = getJFieldList().getSelectedValues(); |
|
445 |
Color[] colorScheme = colorCombo.getSelectedColors(); |
|
477 |
private JComboBoxColorScheme getColorCombo() { |
|
478 |
if (colorCombo == null) { |
|
479 |
colorCombo = new JComboBoxColorScheme(false); |
|
480 |
} |
|
481 |
return colorCombo; |
|
482 |
} |
|
446 | 483 |
|
447 |
Color[] colors = new Color[colorScheme.length]; |
|
448 |
for (int i = 0; i < colorScheme.length; i++) { |
|
449 |
colors[i] = colorScheme[i]; |
|
450 |
} |
|
451 |
for (int i = 0; i < fields.length; i++) { |
|
452 |
getFieldsTable().addTableRecord( |
|
453 |
colorScheme[rand.nextInt(colorScheme.length)], |
|
454 |
(String) fields[i], (String) fields[i]); |
|
455 |
((DefaultListModel) getJFieldList().getModel()) |
|
456 |
.removeElement(fields[i]); |
|
457 |
} |
|
458 |
actualizePreviewSymbol(); |
|
459 |
} |
|
460 |
}); |
|
461 |
} |
|
462 |
return addButton; |
|
463 |
} |
|
484 |
/** |
|
485 |
* This method initializes removeButton |
|
486 |
* |
|
487 |
* @return javax.swing.JButton |
|
488 |
*/ |
|
489 |
private JButton getRemoveButton() { |
|
490 |
if (removeButton == null) { |
|
491 |
removeButton = new JButton(); |
|
492 |
removeButton.setPreferredSize(new Dimension(50, 40)); |
|
493 |
removeButton.setText("<"); |
|
494 |
removeButton.addActionListener(new java.awt.event.ActionListener() { |
|
495 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
496 |
int[] index = getFieldsTable().getSelectedRows(); |
|
497 |
String[] fields = new String[index.length]; |
|
498 |
for (int i = 0; i < index.length; i++) { |
|
499 |
fields[i] = (String) getFieldsTable().getFieldValue( |
|
500 |
index[i], 1); |
|
501 |
} |
|
502 |
for (int i = 0; i < fields.length; i++) { |
|
503 |
((DefaultListModel) getJFieldList().getModel()) |
|
504 |
.addElement(fields[i]); |
|
505 |
} |
|
506 |
getFieldsTable().removeSelectedRows(); |
|
507 |
actualizePreviewSymbol(); |
|
464 | 508 |
|
465 |
/** |
|
466 |
* This method initializes northPanel |
|
467 |
* |
|
468 |
* @return javax.swing.JPanel |
|
469 |
*/ |
|
470 |
private JPanel getNorthPanel() { |
|
471 |
if (northPanel == null) { |
|
472 |
lColorSchema = new JLabel(); |
|
473 |
lColorSchema.setText(PluginServices.getText(this, "color_schema")); |
|
474 |
northPanel = new JPanel(); |
|
475 |
northPanel.setLayout(new FlowLayout()); |
|
476 |
northPanel.add(lColorSchema, null); |
|
477 |
northPanel.add(getColorCombo()); |
|
478 |
} |
|
479 |
return northPanel; |
|
480 |
} |
|
509 |
fillDestinationFieldNames((String) destinationTable.getSelectedItem()); |
|
510 |
} |
|
511 |
}); |
|
512 |
} |
|
513 |
return removeButton; |
|
514 |
} |
|
481 | 515 |
|
482 |
private JComboBoxColorScheme getColorCombo() { |
|
483 |
if (colorCombo == null) { |
|
484 |
colorCombo = new JComboBoxColorScheme(false); |
|
485 |
} |
|
486 |
return colorCombo; |
|
487 |
} |
|
516 |
/** |
|
517 |
* This method initializes addAllButton |
|
518 |
* |
|
519 |
* @return javax.swing.JButton |
|
520 |
*/ |
|
521 |
private JButton getAddAllButton() { |
|
522 |
if (addAllButton == null) { |
|
523 |
addAllButton = new JButton(); |
|
524 |
addAllButton.setPreferredSize(new Dimension(50, 40)); |
|
525 |
addAllButton.setText(">>"); |
|
526 |
addAllButton.addActionListener(new java.awt.event.ActionListener() { |
|
527 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
528 |
Object[] fields = ((DefaultListModel) getJFieldList() |
|
529 |
.getModel()).toArray(); |
|
488 | 530 |
|
489 |
/** |
|
490 |
* This method initializes removeButton |
|
491 |
* |
|
492 |
* @return javax.swing.JButton |
|
493 |
*/ |
|
494 |
private JButton getRemoveButton() { |
|
495 |
if (removeButton == null) { |
|
496 |
removeButton = new JButton(); |
|
497 |
removeButton.setPreferredSize(new Dimension(50, 40)); |
|
498 |
removeButton.setText("<"); |
|
499 |
removeButton.addActionListener(new java.awt.event.ActionListener() { |
|
500 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
501 |
int[] index = getFieldsTable().getSelectedRows(); |
|
502 |
String[] fields = new String[index.length]; |
|
503 |
for (int i = 0; i < index.length; i++) { |
|
504 |
fields[i] = (String) getFieldsTable().getFieldValue( |
|
505 |
index[i], 1); |
|
506 |
} |
|
507 |
for (int i = 0; i < fields.length; i++) { |
|
508 |
((DefaultListModel) getJFieldList().getModel()) |
|
509 |
.addElement(fields[i]); |
|
510 |
} |
|
511 |
getFieldsTable().removeSelectedRows(); |
|
512 |
actualizePreviewSymbol(); |
|
531 |
Color[] colorScheme = colorCombo.getSelectedColors(); |
|
513 | 532 |
|
514 |
fillDestinationFieldNames((String) destinationTable.getSelectedItem()); |
|
515 |
} |
|
516 |
}); |
|
517 |
} |
|
518 |
return removeButton; |
|
519 |
} |
|
533 |
Color[] colors = new Color[colorScheme.length]; |
|
534 |
for (int i = 0; i < colorScheme.length; i++) { |
|
535 |
colors[i] = colorScheme[i]; |
|
536 |
} |
|
537 |
for (int i = 0; i < fields.length; i++) { |
|
538 |
getFieldsTable().addTableRecord( |
|
539 |
colorScheme[rand.nextInt(colorScheme.length)], |
|
540 |
(String) fields[i], (String) fields[i]); |
|
541 |
((DefaultListModel) getJFieldList().getModel()) |
|
542 |
.removeElement(fields[i]); |
|
543 |
} |
|
544 |
actualizePreviewSymbol(); |
|
545 |
} |
|
546 |
}); |
|
547 |
} |
|
548 |
return addAllButton; |
|
549 |
} |
|
520 | 550 |
|
521 |
/** |
|
522 |
* This method initializes addAllButton |
|
523 |
* |
|
524 |
* @return javax.swing.JButton |
|
525 |
*/ |
|
526 |
private JButton getAddAllButton() { |
|
527 |
if (addAllButton == null) { |
|
528 |
addAllButton = new JButton(); |
|
529 |
addAllButton.setPreferredSize(new Dimension(50, 40)); |
|
530 |
addAllButton.setText(">>"); |
|
531 |
addAllButton.addActionListener(new java.awt.event.ActionListener() { |
|
532 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
533 |
Object[] fields = ((DefaultListModel) getJFieldList() |
|
534 |
.getModel()).toArray(); |
|
551 |
private void actualizePreviewSymbol() { |
|
552 |
int count = getFieldsTable().getRowCount(); |
|
553 |
String[] fieldsTable = new String[count]; |
|
554 |
for (int i = 0; i < count; i++) { |
|
555 |
fieldsTable[i] = (String) getFieldsTable().getFieldValue(i, 1); |
|
556 |
} |
|
557 |
String[] labelsTable = new String[count]; |
|
558 |
for (int i = 0; i < count; i++) { |
|
559 |
labelsTable[i] = (String) getFieldsTable().getFieldValue(i, 2); |
|
560 |
} |
|
561 |
Color[] colorsTable = new Color[count]; |
|
562 |
for (int i = 0; i < count; i++) { |
|
563 |
colorsTable[i] = ((JPanel) getFieldsTable().getFieldValue(i, 0)) |
|
564 |
.getBackground(); |
|
565 |
} |
|
566 |
// getPreviewChart().setSections(fieldsTable, colorsTable); |
|
567 |
// getPreviewChart().repaint(); |
|
568 |
// auxLegend.setFieldNames(fieldsTable); |
|
569 |
// auxLegend.setLabels(labelsTable); |
|
570 |
// auxLegend.setColors(colorsTable); |
|
535 | 571 |
|
536 |
Color[] colorScheme = colorCombo.getSelectedColors();
|
|
572 |
}
|
|
537 | 573 |
|
538 |
Color[] colors = new Color[colorScheme.length]; |
|
539 |
for (int i = 0; i < colorScheme.length; i++) { |
|
540 |
colors[i] = colorScheme[i]; |
|
541 |
} |
|
542 |
for (int i = 0; i < fields.length; i++) { |
|
543 |
getFieldsTable().addTableRecord( |
|
544 |
colorScheme[rand.nextInt(colorScheme.length)], |
|
545 |
(String) fields[i], (String) fields[i]); |
|
546 |
((DefaultListModel) getJFieldList().getModel()) |
|
547 |
.removeElement(fields[i]); |
|
548 |
} |
|
549 |
actualizePreviewSymbol(); |
|
550 |
} |
|
551 |
}); |
|
552 |
} |
|
553 |
return addAllButton; |
|
554 |
} |
|
574 |
/** |
|
575 |
* This method initializes removeAllButton |
|
576 |
* |
|
577 |
* @return javax.swing.JButton |
|
578 |
*/ |
|
579 |
private JButton getRemoveAllButton() { |
|
580 |
if (removeAllButton == null) { |
|
581 |
removeAllButton = new JButton(); |
|
582 |
removeAllButton.setPreferredSize(new Dimension(50, 40)); |
|
583 |
removeAllButton.setText("<<"); |
|
584 |
removeAllButton |
|
585 |
.addActionListener(new java.awt.event.ActionListener() { |
|
586 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
587 |
getFieldsTable().removeAllItems(); |
|
588 |
actualizePreviewSymbol(); |
|
589 |
fillDestinationFieldNames((String) destinationTable.getSelectedItem()); |
|
590 |
} |
|
591 |
}); |
|
592 |
} |
|
593 |
return removeAllButton; |
|
594 |
} |
|
555 | 595 |
|
556 |
private void actualizePreviewSymbol() { |
|
557 |
int count = getFieldsTable().getRowCount(); |
|
558 |
String[] fieldsTable = new String[count]; |
|
559 |
for (int i = 0; i < count; i++) { |
|
560 |
fieldsTable[i] = (String) getFieldsTable().getFieldValue(i, 1); |
|
561 |
} |
|
562 |
String[] labelsTable = new String[count]; |
|
563 |
for (int i = 0; i < count; i++) { |
|
564 |
labelsTable[i] = (String) getFieldsTable().getFieldValue(i, 2); |
|
565 |
} |
|
566 |
Color[] colorsTable = new Color[count]; |
|
567 |
for (int i = 0; i < count; i++) { |
|
568 |
colorsTable[i] = ((JPanel) getFieldsTable().getFieldValue(i, 0)) |
|
569 |
.getBackground(); |
|
570 |
} |
|
571 |
// getPreviewChart().setSections(fieldsTable, colorsTable); |
|
572 |
// getPreviewChart().repaint(); |
|
573 |
// auxLegend.setFieldNames(fieldsTable); |
|
574 |
// auxLegend.setLabels(labelsTable); |
|
575 |
// auxLegend.setColors(colorsTable); |
|
576 |
|
|
577 |
} |
|
578 |
|
|
579 |
/** |
|
580 |
* This method initializes removeAllButton |
|
581 |
* |
|
582 |
* @return javax.swing.JButton |
|
583 |
*/ |
|
584 |
private JButton getRemoveAllButton() { |
|
585 |
if (removeAllButton == null) { |
|
586 |
removeAllButton = new JButton(); |
|
587 |
removeAllButton.setPreferredSize(new Dimension(50, 40)); |
|
588 |
removeAllButton.setText("<<"); |
|
589 |
removeAllButton |
|
590 |
.addActionListener(new java.awt.event.ActionListener() { |
|
591 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
592 |
getFieldsTable().removeAllItems(); |
|
593 |
actualizePreviewSymbol(); |
|
594 |
fillDestinationFieldNames((String) destinationTable.getSelectedItem()); |
|
595 |
} |
|
596 |
}); |
|
597 |
} |
|
598 |
return removeAllButton; |
|
599 |
} |
|
600 |
|
|
601 |
private void fillFieldNames() { |
|
596 |
private void fillFieldNames() { |
|
602 | 597 |
// FeatureStore rs; |
603 | 598 |
// ((DefaultListModel) getJFieldList().getModel()).removeAllElements(); |
604 | 599 |
// try { |
... | ... | |
620 | 615 |
// PluginServices.getText(this, "recovering_recordset"), e); |
621 | 616 |
// } |
622 | 617 |
// |
623 |
fillOriginFieldNames();
|
|
624 |
}
|
|
618 |
fillOriginFieldNames();
|
|
619 |
}
|
|
625 | 620 |
|
626 |
private JPanel getButtons() {
|
|
627 |
if (buttons == null) {
|
|
628 |
FlowLayout flowLayout = new FlowLayout();
|
|
629 |
flowLayout.setHgap(5);
|
|
630 |
flowLayout.setAlignment(FlowLayout.CENTER);
|
|
631 |
flowLayout.setVgap(1);
|
|
632 |
buttons = new JPanel();
|
|
633 |
buttons.setPreferredSize(new Dimension(60, 50));
|
|
634 |
buttons.setLayout(flowLayout);
|
|
635 |
buttons.add(getPCentral(), null);
|
|
636 |
}
|
|
637 |
return buttons;
|
|
638 |
}
|
|
621 |
private JPanel getButtons() {
|
|
622 |
if (buttons == null) {
|
|
623 |
FlowLayout flowLayout = new FlowLayout();
|
|
624 |
flowLayout.setHgap(5);
|
|
625 |
flowLayout.setAlignment(FlowLayout.CENTER);
|
|
626 |
flowLayout.setVgap(1);
|
|
627 |
buttons = new JPanel();
|
|
628 |
buttons.setPreferredSize(new Dimension(60, 50));
|
|
629 |
buttons.setLayout(flowLayout);
|
|
630 |
buttons.add(getPCentral(), null);
|
|
631 |
}
|
|
632 |
return buttons;
|
|
633 |
}
|
|
639 | 634 |
|
640 |
private FieldsTable getFieldsTable() {
|
|
641 |
if (fieldsTable == null) {
|
|
642 |
fieldsTable = new FieldsTable();
|
|
643 |
fieldsTable.setPreferredSize(new Dimension(250, 175));
|
|
644 |
fieldsTable.addColorChange(new ColorChange() {
|
|
645 |
public void actionChange() {
|
|
646 |
// actualizePreviewSymbol();
|
|
647 |
}
|
|
635 |
private FieldsTable getFieldsTable() {
|
|
636 |
if (fieldsTable == null) {
|
|
637 |
fieldsTable = new FieldsTable();
|
|
638 |
fieldsTable.setPreferredSize(new Dimension(250, 175));
|
|
639 |
fieldsTable.addColorChange(new ColorChange() {
|
|
640 |
public void actionChange() {
|
|
641 |
// actualizePreviewSymbol();
|
|
642 |
}
|
|
648 | 643 |
|
649 |
});
|
|
650 |
}
|
|
651 |
return fieldsTable;
|
|
652 |
}
|
|
644 |
});
|
|
645 |
}
|
|
646 |
return fieldsTable;
|
|
647 |
}
|
|
653 | 648 |
|
654 |
private JPanel getLinkedPanel() {
|
|
655 |
if (jLinkedPane == null) {
|
|
656 |
jLinkedPane = new JPanel();
|
|
649 |
private JPanel getLinkedPanel() {
|
|
650 |
if (jLinkedPane == null) {
|
|
651 |
jLinkedPane = new JPanel();
|
|
657 | 652 |
// jLinkedPane.setBorder(BorderFactory.createTitledBorder(null, |
658 | 653 |
// PluginServices.getText(this, "linked_table_options"), |
659 | 654 |
// TitledBorder.DEFAULT_JUSTIFICATION, |
660 | 655 |
// TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
661 | 656 |
// Font.BOLD, 12), new Color(51, 51, 51))); |
662 |
jLinkedPane.setPreferredSize(new Dimension(350, 110));
|
|
657 |
jLinkedPane.setPreferredSize(new Dimension(350, 110));
|
|
663 | 658 |
|
664 |
jLinkedPane.add(getLinkedTablePanel(),BorderLayout.WEST);
|
|
665 |
jLinkedPane.add(getFieldToLinkPanel(),BorderLayout.EAST);
|
|
659 |
jLinkedPane.add(getLinkedTablePanel(), BorderLayout.WEST);
|
|
660 |
jLinkedPane.add(getFieldToLinkPanel(), BorderLayout.EAST);
|
|
666 | 661 |
|
667 |
}
|
|
668 |
return jLinkedPane;
|
|
669 |
}
|
|
662 |
}
|
|
663 |
return jLinkedPane;
|
|
664 |
}
|
|
670 | 665 |
|
671 |
private Component getChartTypePanel() {
|
|
672 |
if (jChartTypePane == null) {
|
|
673 |
jChartTypePane = new JPanel();
|
|
674 |
jChartTypePane.setBorder(BorderFactory.createTitledBorder(null,
|
|
675 |
PluginServices.getText(this, "choose_chart_type"),
|
|
676 |
TitledBorder.DEFAULT_JUSTIFICATION,
|
|
677 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog",
|
|
678 |
Font.BOLD, 12), new Color(51, 51, 51)));
|
|
679 |
jChartTypePane.setPreferredSize(new Dimension(604, 50));
|
|
666 |
private Component getChartTypePanel() {
|
|
667 |
if (jChartTypePane == null) {
|
|
668 |
jChartTypePane = new JPanel();
|
|
669 |
jChartTypePane.setBorder(BorderFactory.createTitledBorder(null,
|
|
670 |
PluginServices.getText(this, "choose_chart_type"),
|
|
671 |
TitledBorder.DEFAULT_JUSTIFICATION,
|
|
672 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog",
|
|
673 |
Font.BOLD, 12), new Color(51, 51, 51)));
|
|
674 |
jChartTypePane.setPreferredSize(new Dimension(604, 50));
|
|
680 | 675 |
|
681 |
jChartTypePane.setLayout(new FlowLayout());
|
|
676 |
jChartTypePane.setLayout(new FlowLayout());
|
|
682 | 677 |
|
678 |
PieCb = new JRadioButton(); |
|
679 |
PieCb.addActionListener(new ActionListener() { |
|
680 |
public void actionPerformed(ActionEvent arg0) { |
|
681 |
getCk3D().setEnabled(!PieCb.isSelected()); |
|
682 |
getShowAxis().setEnabled(!PieCb.isSelected()); |
|
683 |
} |
|
684 |
}); |
|
685 |
PieCb.setText(PluginServices.getText(this, "pie_chart")); |
|
686 |
PieCb.setPreferredSize(new Dimension(200, 20)); |
|
687 |
PieCb.setSelected(true); |
|
683 | 688 |
|
684 |
PieCb = new JRadioButton(); |
|
685 |
PieCb.addActionListener(new ActionListener() { |
|
686 |
public void actionPerformed(ActionEvent arg0) { |
|
687 |
getCk3D().setEnabled(!PieCb.isSelected()); |
|
688 |
getShowAxis().setEnabled(!PieCb.isSelected()); |
|
689 |
} |
|
690 |
}); |
|
691 |
PieCb.setText(PluginServices.getText(this, "pie_chart")); |
|
692 |
PieCb.setPreferredSize(new Dimension(200, 20)); |
|
693 |
PieCb.setSelected(true); |
|
689 |
jChartTypePane.add(PieCb); |
|
694 | 690 |
|
695 |
jChartTypePane.add(PieCb); |
|
691 |
BarsCb = new JRadioButton(); |
|
692 |
BarsCb.addActionListener(new ActionListener() { |
|
693 |
public void actionPerformed(ActionEvent arg0) { |
|
694 |
getCk3D().setEnabled(BarsCb.isSelected()); |
|
695 |
getShowAxis().setEnabled(BarsCb.isSelected()); |
|
696 |
} |
|
697 |
}); |
|
698 |
BarsCb.setText(PluginServices.getText(this, "bars_chart")); |
|
699 |
BarsCb.setPreferredSize(new Dimension(200, 20)); |
|
696 | 700 |
|
701 |
jChartTypePane.add(BarsCb); |
|
697 | 702 |
|
698 |
BarsCb = new JRadioButton(); |
|
699 |
BarsCb.addActionListener(new ActionListener() { |
|
700 |
public void actionPerformed(ActionEvent arg0) { |
|
701 |
getCk3D().setEnabled(BarsCb.isSelected()); |
|
702 |
getShowAxis().setEnabled(BarsCb.isSelected()); |
|
703 |
} |
|
704 |
}); |
|
705 |
BarsCb.setText(PluginServices.getText(this, "bars_chart")); |
|
706 |
BarsCb.setPreferredSize(new Dimension(200, 20)); |
|
703 |
ButtonGroup group = new ButtonGroup(); |
|
704 |
group.add(PieCb); |
|
705 |
group.add(BarsCb); |
|
707 | 706 |
|
708 |
jChartTypePane.add(BarsCb); |
|
707 |
} |
|
708 |
return jChartTypePane; |
|
709 |
} |
|
709 | 710 |
|
710 |
ButtonGroup group = new ButtonGroup(); |
|
711 |
group.add(PieCb); |
|
712 |
group.add(BarsCb); |
|
711 |
private void fillOriginFieldNames() { |
|
712 |
FeatureStore rs; |
|
713 |
((DefaultListModel) getJFieldList().getModel()).removeAllElements(); |
|
714 |
try { |
|
715 |
rs = ((FLyrVect) layer).getFeatureStore(); |
|
713 | 716 |
|
717 |
originTable.setText(rs.getName()); |
|
714 | 718 |
|
715 |
} |
|
716 |
return jChartTypePane; |
|
717 |
} |
|
719 |
ArrayList<String> names = new ArrayList<String>(); |
|
720 |
Iterator iterator = rs.getDefaultFeatureType().iterator(); |
|
721 |
DefaultComboBoxModel cM = new DefaultComboBoxModel(); |
|
722 |
while (iterator.hasNext()) { |
|
723 |
FeatureAttributeDescriptor descriptor = (FeatureAttributeDescriptor) iterator |
|
724 |
.next(); |
|
725 |
names.add(descriptor.getName()); |
|
726 |
cM.addElement(descriptor.getName()); |
|
727 |
} |
|
718 | 728 |
|
719 |
private void fillOriginFieldNames() { |
|
720 |
FeatureStore rs; |
|
721 |
((DefaultListModel) getJFieldList().getModel()).removeAllElements(); |
|
722 |
try { |
|
723 |
rs = ((FLyrVect) layer).getFeatureStore(); |
|
729 |
originField.setModel(cM); |
|
724 | 730 |
|
725 |
originTable.setText(rs.getName()); |
|
731 |
} catch (DataException e) { |
|
732 |
NotificationManager.addError( |
|
733 |
PluginServices.getText(this, "recovering_recordset"), e); |
|
734 |
} |
|
726 | 735 |
|
727 |
ArrayList<String> names = new ArrayList<String>(); |
|
728 |
Iterator iterator = rs.getDefaultFeatureType().iterator(); |
|
729 |
DefaultComboBoxModel cM = new DefaultComboBoxModel(); |
|
730 |
while (iterator.hasNext()) { |
|
731 |
FeatureAttributeDescriptor descriptor = (FeatureAttributeDescriptor) iterator |
|
732 |
.next(); |
|
733 |
names.add(descriptor.getName()); |
|
734 |
cM.addElement(descriptor.getName()); |
|
735 |
} |
|
736 |
} |
|
736 | 737 |
|
737 |
originField.setModel(cM); |
|
738 |
private JPanel getLinkedTablePanel() { |
|
739 |
if (jLinkedOriginPane == null) { |
|
740 |
jLinkedOriginPane = new JPanel(); |
|
741 |
jLinkedOriginPane.setBorder(BorderFactory.createTitledBorder(null, |
|
742 |
PluginServices.getText(this, "origin_linked_table"), |
|
743 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
744 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
|
745 |
Font.BOLD, 12), new Color(51, 51, 51))); |
|
746 |
jLinkedOriginPane.setPreferredSize(new Dimension(300, 100)); |
|
738 | 747 |
|
739 |
} catch (DataException e) { |
|
740 |
NotificationManager.addError( |
|
741 |
PluginServices.getText(this, "recovering_recordset"), e); |
|
742 |
} |
|
748 |
FLyrVect rs = ((FLyrVect) layer); |
|
743 | 749 |
|
744 |
} |
|
750 |
JLabel lorigin = new JLabel(); |
|
751 |
lorigin.setText(PluginServices.getText(this, "table_origin")); |
|
752 |
lorigin.setPreferredSize(new Dimension(100, 15)); |
|
753 |
lorigin.setAlignmentY(0.0f); |
|
745 | 754 |
|
746 |
private JPanel getLinkedTablePanel() { |
|
747 |
if (jLinkedOriginPane == null) { |
|
748 |
jLinkedOriginPane = new JPanel(); |
|
749 |
jLinkedOriginPane.setBorder(BorderFactory.createTitledBorder(null, |
|
750 |
PluginServices.getText(this, "origin_linked_table"), |
|
751 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
752 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
|
753 |
Font.BOLD, 12), new Color(51, 51, 51))); |
|
754 |
jLinkedOriginPane.setPreferredSize(new Dimension(300, 100)); |
|
755 |
originTable = new JTextField(); |
|
756 |
originTable.setEditable(false); |
|
757 |
originTable.setEnabled(false); |
|
758 |
originTable.setPreferredSize(new Dimension(170, 20)); |
|
755 | 759 |
|
756 |
FLyrVect rs = ((FLyrVect) layer); |
|
760 |
jLinkedOriginPane.add(lorigin); |
|
761 |
jLinkedOriginPane.add(originTable); |
|
757 | 762 |
|
758 |
JLabel lorigin = new JLabel();
|
|
759 |
lorigin.setText(PluginServices.getText(this, "table_origin"));
|
|
760 |
lorigin.setPreferredSize(new Dimension(100, 15));
|
|
761 |
lorigin.setAlignmentY(0.0f);
|
|
763 |
JLabel loriginField = new JLabel();
|
|
764 |
loriginField.setText(PluginServices.getText(this, "field_origin"));
|
|
765 |
loriginField.setPreferredSize(new Dimension(100, 15));
|
|
766 |
loriginField.setAlignmentY(0.0f);
|
|
762 | 767 |
|
763 |
originTable = new JTextField(); |
|
764 |
originTable.setEditable(false); |
|
765 |
originTable.setEnabled(false); |
|
766 |
originTable.setPreferredSize(new Dimension(170, 20)); |
|
768 |
originField = new JComboBox(); |
|
769 |
originField.setEditable(false); |
|
770 |
originField.setPreferredSize(new Dimension(170, 20)); |
|
767 | 771 |
|
768 |
jLinkedOriginPane.add(lorigin);
|
|
769 |
jLinkedOriginPane.add(originTable);
|
|
772 |
jLinkedOriginPane.add(loriginField);
|
|
773 |
jLinkedOriginPane.add(originField);
|
|
770 | 774 |
|
775 |
originSelection = new JCheckBox(); |
|
776 |
originSelection.setText(PluginServices.getText(this, "only_selected")); |
|
771 | 777 |
|
772 |
JLabel loriginField = new JLabel();
|
|
773 |
loriginField.setText(PluginServices.getText(this, "field_origin"));
|
|
774 |
loriginField.setPreferredSize(new Dimension(100, 15));
|
|
775 |
loriginField.setAlignmentY(0.0f);
|
|
778 |
jLinkedOriginPane.add(originSelection);
|
|
779 |
}
|
|
780 |
return jLinkedOriginPane;
|
|
781 |
}
|
|
776 | 782 |
|
777 |
originField = new JComboBox();
|
|
778 |
originField.setEditable(false);
|
|
779 |
originField.setPreferredSize(new Dimension(170, 20));
|
|
783 |
private void fillDestinationFieldNames(String tableName) {
|
|
784 |
ApplicationManager appManager = ApplicationLocator.getManager();
|
|
785 |
final Project project = appManager.getCurrentProject();
|
|
780 | 786 |
|
781 |
jLinkedOriginPane.add(loriginField); |
|
782 |
jLinkedOriginPane.add(originField); |
|
787 |
TableDocument selDoc = (TableDocument) project.getDocument(tableName, TableManager.TYPENAME); |
|
788 |
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
|
789 |
DefaultComboBoxModel model2 = new DefaultComboBoxModel(); |
|
790 |
DefaultListModel cM = new DefaultListModel(); |
|
791 |
if (selDoc != null) { |
|
792 |
try { |
|
793 |
FeatureType featType = selDoc.getStore().getDefaultFeatureType(); |
|
794 |
FeatureAttributeDescriptor[] atts = featType.getAttributeDescriptors(); |
|
783 | 795 |
|
784 |
originSelection = new JCheckBox();
|
|
785 |
originSelection.setText(PluginServices.getText(this, "only_selected"));
|
|
796 |
for (int i = 0; i < atts.length; i++) {
|
|
797 |
model.addElement(atts[i].getName());
|
|
786 | 798 |
|
787 |
jLinkedOriginPane.add(originSelection); |
|
788 |
} |
|
789 |
return jLinkedOriginPane; |
|
790 |
} |
|
799 |
if (atts[i].getDataType().isNumeric()) { |
|
800 |
cM.addElement(atts[i].getName()); |
|
801 |
model2.addElement(atts[i].getName()); |
|
802 |
} |
|
803 |
} |
|
791 | 804 |
|
792 |
private void fillDestinationFieldNames(String tableName) { |
|
793 |
ApplicationManager appManager = ApplicationLocator.getManager(); |
|
794 |
final Project project = appManager.getCurrentProject(); |
|
805 |
getJFieldList().setModel(cM); |
|
806 |
destinationField.setModel(model); |
|
807 |
timeField.setModel(model2); |
|
808 |
timeField.insertItemAt("", 0); |
|
809 |
timeField.setSelectedIndex(0); |
|
795 | 810 |
|
796 |
TableDocument selDoc = (TableDocument) project.getDocument(tableName, TableManager.TYPENAME); |
|
797 |
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
|
798 |
DefaultComboBoxModel model2 = new DefaultComboBoxModel(); |
|
799 |
DefaultListModel cM = new DefaultListModel(); |
|
800 |
if (selDoc != null) { |
|
801 |
try { |
|
802 |
FeatureType featType = selDoc.getStore().getDefaultFeatureType(); |
|
803 |
FeatureAttributeDescriptor[] atts = featType.getAttributeDescriptors(); |
|
811 |
} catch (DataException e) { |
|
812 |
// TODO Auto-generated catch block |
|
813 |
e.printStackTrace(); |
|
814 |
} |
|
815 |
} |
|
816 |
} |
|
804 | 817 |
|
805 |
for(int i=0; i<atts.length; i++){ |
|
806 |
model.addElement(atts[i].getName()); |
|
818 |
private void initializeTableDocuments() { |
|
819 |
ApplicationManager appManager = ApplicationLocator.getManager(); |
|
820 |
final Project project = appManager.getCurrentProject(); |
|
821 |
ProjectManager projectManager = appManager.getProjectManager(); |
|
807 | 822 |
|
808 |
if(atts[i].getDataType().isNumeric()){ |
|
809 |
cM.addElement(atts[i].getName()); |
|
810 |
model2.addElement(atts[i].getName()); |
|
811 |
} |
|
812 |
} |
|
823 |
List<Document> tableDocuments = project |
|
824 |
.getDocuments(TableManager.TYPENAME); |
|
825 |
TableDocument[] pts = tableDocuments |
|
826 |
.toArray(new TableDocument[tableDocuments.size()]); |
|
813 | 827 |
|
814 |
getJFieldList().setModel(cM); |
|
815 |
destinationField.setModel(model); |
|
816 |
timeField.setModel(model2); |
|
817 |
timeField.insertItemAt("", 0); |
|
818 |
timeField.setSelectedIndex(0); |
|
828 |
Properties extendedProps = new Properties(); |
|
829 |
//List<String> tableNames = new ArrayList<String>(); |
|
819 | 830 |
|
820 |
} catch (DataException e) { |
|
821 |
// TODO Auto-generated catch block |
|
822 |
e.printStackTrace(); |
|
823 |
} |
|
824 |
} |
|
825 |
} |
|
831 |
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
|
832 |
for (TableDocument t : pts) { |
|
833 |
model.addElement(t.getName()); |
|
834 |
} |
|
835 |
destinationTable.setModel(model); |
|
826 | 836 |
|
837 |
if (model.getSize() > 0) { |
|
838 |
fillDestinationFieldNames((String) model.getElementAt(0)); |
|
839 |
} |
|
840 |
} |
|
827 | 841 |
|
828 |
private void initializeTableDocuments(){ |
|
829 |
ApplicationManager appManager = ApplicationLocator.getManager(); |
|
830 |
final Project project = appManager.getCurrentProject(); |
|
831 |
ProjectManager projectManager = appManager.getProjectManager(); |
|
842 |
private JPanel getFieldToLinkPanel() { |
|
843 |
if (jLinkedDestinationPane == null) { |
|
844 |
jLinkedDestinationPane = new JPanel(); |
|
845 |
jLinkedDestinationPane.setBorder(BorderFactory.createTitledBorder(null, |
|
846 |
PluginServices.getText(this, "destination_linked_table"), |
|
847 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
848 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
|
849 |
Font.BOLD, 12), new Color(51, 51, 51))); |
|
850 |
jLinkedDestinationPane.setPreferredSize(new Dimension(300, 100)); |
|
832 | 851 |
|
833 |
List<Document> tableDocuments = project |
|
834 |
.getDocuments(TableManager.TYPENAME); |
|
835 |
TableDocument[] pts = tableDocuments |
|
836 |
.toArray(new TableDocument[tableDocuments.size()]); |
|
852 |
jLinkedDestinationPane.setLayout(new FlowLayout()); |
|
837 | 853 |
|
838 |
Properties extendedProps = new Properties(); |
|
839 |
//List<String> tableNames = new ArrayList<String>(); |
|
854 |
FLyrVect rs = ((FLyrVect) layer); |
|
840 | 855 |
|
841 |
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
|
842 |
for (TableDocument t : pts) { |
|
843 |
model.addElement(t.getName()); |
|
844 |
} |
|
845 |
destinationTable.setModel(model); |
|
856 |
JLabel lorigin = new JLabel(); |
|
857 |
lorigin.setText(PluginServices.getText(this, "table_destination")); |
|
858 |
lorigin.setPreferredSize(new Dimension(100, 15)); |
|
859 |
lorigin.setAlignmentY(0.0f); |
|
846 | 860 |
|
847 |
if(model.getSize()>0){ |
|
848 |
fillDestinationFieldNames((String) model.getElementAt(0)); |
|
849 |
} |
|
850 |
} |
|
861 |
destinationTable = new JComboBox(); |
|
862 |
//destinationTable.setEnabled(false); |
|
863 |
//destinationTable.setText(((FLyrVect) layer).getName()); |
|
864 |
destinationTable.setPreferredSize(new Dimension(170, 20)); |
|
865 |
destinationTable.addActionListener(new ActionListener() { |
|
866 |
public void actionPerformed(ActionEvent arg0) { |
|
867 |
String selected = (String) destinationTable.getSelectedItem(); |
|
868 |
if (StringUtils.isEmpty(selected)) { |
|
869 |
destinationTable.setModel(new DefaultComboBoxModel()); |
|
870 |
destinationTable.setEnabled(false); |
|
871 |
} else { |
|
872 |
fillDestinationFieldNames(selected); |
|
873 |
destinationTable.setEnabled(true); |
|
874 |
} |
|
875 |
} |
|
876 |
}); |
|
851 | 877 |
|
878 |
jLinkedDestinationPane.add(lorigin, null); |
|
879 |
jLinkedDestinationPane.add(destinationTable, null); |
|
852 | 880 |
|
853 |
private JPanel getFieldToLinkPanel() { |
|
854 |
if (jLinkedDestinationPane == null) { |
|
855 |
jLinkedDestinationPane = new JPanel(); |
|
856 |
jLinkedDestinationPane.setBorder(BorderFactory.createTitledBorder(null, |
|
857 |
PluginServices.getText(this, "destination_linked_table"), |
|
858 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
859 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
|
860 |
Font.BOLD, 12), new Color(51, 51, 51))); |
|
861 |
jLinkedDestinationPane.setPreferredSize(new Dimension(300, 100)); |
|
881 |
JLabel loriginField = new JLabel(); |
|
882 |
loriginField.setText(PluginServices.getText(this, "field_destination")); |
|
883 |
loriginField.setPreferredSize(new Dimension(100, 15)); |
|
884 |
loriginField.setAlignmentY(0.0f); |
|
862 | 885 |
|
863 |
jLinkedDestinationPane.setLayout(new FlowLayout());
|
|
886 |
destinationField = new JComboBox();
|
|
864 | 887 |
|
865 |
FLyrVect rs = ((FLyrVect) layer); |
|
888 |
destinationField.setEditable(false); |
|
889 |
destinationField.setPreferredSize(new Dimension(170, 20)); |
|
866 | 890 |
|
867 |
JLabel lorigin = new JLabel(); |
|
868 |
lorigin.setText(PluginServices.getText(this, "table_destination")); |
|
869 |
lorigin.setPreferredSize(new Dimension(100, 15)); |
|
870 |
lorigin.setAlignmentY(0.0f); |
|
891 |
jLinkedDestinationPane.add(loriginField, null); |
|
892 |
jLinkedDestinationPane.add(destinationField, null); |
|
871 | 893 |
|
872 |
destinationTable = new JComboBox(); |
|
873 |
//destinationTable.setEnabled(false); |
|
874 |
//destinationTable.setText(((FLyrVect) layer).getName()); |
|
875 |
destinationTable.setPreferredSize(new Dimension(170, 20)); |
|
876 |
destinationTable.addActionListener(new ActionListener() { |
|
877 |
public void actionPerformed(ActionEvent arg0) { |
|
878 |
String selected = (String) destinationTable.getSelectedItem(); |
|
879 |
if(StringUtils.isEmpty(selected)){ |
|
880 |
destinationTable.setModel(new DefaultComboBoxModel()); |
|
881 |
destinationTable.setEnabled(false); |
|
882 |
}else{ |
|
883 |
fillDestinationFieldNames(selected); |
|
884 |
destinationTable.setEnabled(true); |
|
885 |
} |
|
886 |
} |
|
887 |
}); |
|
894 |
destinationSelection = new JCheckBox(); |
|
895 |
destinationSelection.setText(PluginServices.getText(this, "only_selected")); |
|
888 | 896 |
|
889 |
jLinkedDestinationPane.add(lorigin, null); |
|
890 |
jLinkedDestinationPane.add(destinationTable, null); |
|
897 |
jLinkedDestinationPane.add(destinationSelection, null); |
|
898 |
} |
|
899 |
return jLinkedDestinationPane; |
|
900 |
} |
|
891 | 901 |
|
892 |
JLabel loriginField = new JLabel(); |
|
893 |
loriginField.setText(PluginServices.getText(this, "field_destination")); |
|
894 |
loriginField.setPreferredSize(new Dimension(100, 15)); |
|
895 |
loriginField.setAlignmentY(0.0f); |
|
902 |
private JScrollPane getJScrollPane() { |
|
903 |
if (jScrollPane == null) { |
|
904 |
jScrollPane = new JScrollPane(); |
|
905 |
jScrollPane.setBorder(BorderFactory.createTitledBorder(null, |
|
906 |
PluginServices.getText(this, "fields"), |
|
907 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
908 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
|
909 |
Font.BOLD, 12), new Color(51, 51, 51))); |
|
910 |
jScrollPane.setPreferredSize(new Dimension(150, 150)); |
|
911 |
jScrollPane.setViewportView(getJFieldList()); |
|
912 |
} |
|
913 |
return jScrollPane; |
|
914 |
} |
|
896 | 915 |
|
897 |
destinationField = new JComboBox(); |
|
916 |
/** |
|
917 |
* This method initializes jFieldList |
|
918 |
* |
|
919 |
* @return javax.swing.JList |
|
920 |
*/ |
|
921 |
private JList getJFieldList() { |
|
922 |
if (jFieldList == null) { |
|
923 |
DefaultListModel dlm = new DefaultListModel(); |
|
924 |
jFieldList = new JList(); |
|
925 |
jFieldList.setSize(new Dimension(150, 150)); |
|
926 |
jFieldList.setModel(dlm); |
|
927 |
} |
|
928 |
return jFieldList; |
|
929 |
} |
|
898 | 930 |
|
Also available in: Unified diff