gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.swing / org.gvsig.raster.swing.impl / src / main / java / org / gvsig / raster / swing / impl / roi / ROIsTablePanel.java @ 2443
History | View | Annotate | Download (2.59 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
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 2
|
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 |
*/
|
22 |
package org.gvsig.raster.swing.impl.roi; |
23 |
|
24 |
import java.awt.BorderLayout; |
25 |
|
26 |
import javax.swing.JPanel; |
27 |
import javax.swing.border.EmptyBorder; |
28 |
import javax.swing.event.ListSelectionListener; |
29 |
import javax.swing.event.TableModelListener; |
30 |
|
31 |
import org.gvsig.andami.PluginServices; |
32 |
import org.gvsig.gui.beans.table.TableContainer; |
33 |
|
34 |
/**
|
35 |
* Panel for the table with the list of ROIs
|
36 |
*
|
37 |
* @author Nacho Brodin nachobrodin@gmail.com
|
38 |
*
|
39 |
*/
|
40 |
public class ROIsTablePanel extends JPanel { |
41 |
private static final long serialVersionUID = 1L; |
42 |
private TableContainer tableContainer = null; |
43 |
|
44 |
public ROIsTablePanel() {
|
45 |
super();
|
46 |
initialize(); |
47 |
} |
48 |
|
49 |
private void initialize() { |
50 |
setLayout(new BorderLayout()); |
51 |
add(getTable(), BorderLayout.CENTER);
|
52 |
} |
53 |
|
54 |
public void addListenerToTable( |
55 |
TableModelListener tableModelListener,
|
56 |
ListSelectionListener listSelectionListener) {
|
57 |
getTable().getTable().getJTable().getSelectionModel() |
58 |
.addListSelectionListener(listSelectionListener); |
59 |
getTable().getTable().getJTable().getModel() |
60 |
.addTableModelListener(tableModelListener); |
61 |
} |
62 |
|
63 |
public TableContainer getTable() {
|
64 |
if (tableContainer == null) { |
65 |
String[] columnNames = { PluginServices.getText(this, "nombre"), |
66 |
PluginServices.getText(this, "poligonos"), |
67 |
PluginServices.getText(this, "lineas"), |
68 |
PluginServices.getText(this, "puntos"), |
69 |
PluginServices.getText(this, "color")}; |
70 |
int[] columnWidths = { 70, 15, 15, 15, 20 }; |
71 |
tableContainer = new TableContainer(columnNames, columnWidths);
|
72 |
tableContainer.setModel("ROIsTableModel");
|
73 |
tableContainer.initialize(); |
74 |
tableContainer.setControlVisible(false);
|
75 |
tableContainer.setBorder(new EmptyBorder(5, 5, 0, 5)); |
76 |
} |
77 |
return tableContainer;
|
78 |
} |
79 |
|
80 |
} |