svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / view / toolListeners / snapping / gui / PropertySnapCellRenderer.java @ 40558
History | View | Annotate | Download (2.04 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.app.project.documents.view.toolListeners.snapping.gui; |
25 |
|
26 |
import java.awt.Color; |
27 |
import java.awt.Component; |
28 |
import java.util.ArrayList; |
29 |
|
30 |
import javax.swing.JButton; |
31 |
import javax.swing.JPanel; |
32 |
import javax.swing.JTable; |
33 |
import javax.swing.table.TableCellRenderer; |
34 |
|
35 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
36 |
import org.gvsig.fmap.mapcontrol.MapControlManager; |
37 |
import org.gvsig.fmap.mapcontrol.tools.snapping.snappers.ISnapper; |
38 |
|
39 |
|
40 |
public class PropertySnapCellRenderer extends JButton implements TableCellRenderer{ |
41 |
private JPanel panel; |
42 |
private static MapControlManager mapControlManager = MapControlLocator.getMapControlManager(); |
43 |
|
44 |
public PropertySnapCellRenderer() {
|
45 |
this.setText("..."); |
46 |
} |
47 |
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
48 |
panel=(JPanel)(mapControlManager.getSnapperAt(row)).getConfigurator();
|
49 |
if (panel!=null) { |
50 |
this.setEnabled(true); |
51 |
}else {
|
52 |
this.setEnabled(false); |
53 |
this.setBackground(Color.white); |
54 |
} |
55 |
return this; |
56 |
} |
57 |
|
58 |
} |