svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.editing.app / org.gvsig.editing.app.mainplugin / src / main / java / org / gvsig / editing / project / documents / view / legend / edition / gui / BlockedCellEditor.java @ 40557
History | View | Annotate | Download (2.58 KB)
1 | 40557 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40557 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
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 | 40557 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * 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 | 40557 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | 40435 | jjdelcerro | *
|
21 | 40557 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | package org.gvsig.editing.project.documents.view.legend.edition.gui; |
||
25 | |||
26 | import java.awt.Component; |
||
27 | import java.awt.event.MouseEvent; |
||
28 | import java.awt.event.MouseListener; |
||
29 | |||
30 | import javax.swing.ImageIcon; |
||
31 | import javax.swing.JTable; |
||
32 | import javax.swing.table.TableCellEditor; |
||
33 | |||
34 | import org.gvsig.editing.fmap.rendering.EditionManagerLegend; |
||
35 | |||
36 | |||
37 | |||
38 | |||
39 | /**
|
||
40 | * Cell Editor de iconos. Controla los eventos de edici?n que se realicen
|
||
41 | * sobre la columna de iconos.
|
||
42 | *
|
||
43 | * @author Vicente Caballero Navarro
|
||
44 | */
|
||
45 | public class BlockedCellEditor extends IconOptionCellEditor implements TableCellEditor { |
||
46 | public BlockedCellEditor(EditionManagerLegend el,JTable tab,ImageIcon sel, ImageIcon notSel) { |
||
47 | super(el,tab,sel,notSel);
|
||
48 | addMouseListener(new MouseListener(){ |
||
49 | |||
50 | public void mouseClicked(MouseEvent e) { |
||
51 | // if (e.getClickCount()==2){
|
||
52 | int index=table.getSelectedRow();
|
||
53 | if (eml.isBlocked(index)) {
|
||
54 | setIcon(getNotSel()); |
||
55 | eml.setBlocked(index,false);
|
||
56 | |||
57 | }else {
|
||
58 | eml.setBlocked(index,true);
|
||
59 | setIcon(getSel()); |
||
60 | } |
||
61 | stopCellEditing(); |
||
62 | // }
|
||
63 | table.repaint(); |
||
64 | } |
||
65 | |||
66 | public void mouseEntered(MouseEvent e) { |
||
67 | } |
||
68 | |||
69 | public void mouseExited(MouseEvent e) { |
||
70 | } |
||
71 | |||
72 | public void mousePressed(MouseEvent e) { |
||
73 | } |
||
74 | |||
75 | public void mouseReleased(MouseEvent e) { |
||
76 | } |
||
77 | |||
78 | }); |
||
79 | } |
||
80 | |||
81 | //Implement the one method defined by TableCellEditor.
|
||
82 | public Component getTableCellEditorComponent(JTable table, Object value, |
||
83 | boolean isSelected, int row, int column) { |
||
84 | // if (table.getSelectedRow()==row)
|
||
85 | // setSelected(true);
|
||
86 | // else
|
||
87 | setSelected(isSelected); |
||
88 | if (eml.isBlocked(row)) {
|
||
89 | setIcon(getSel()); |
||
90 | }else {
|
||
91 | setIcon(getNotSel()); |
||
92 | } |
||
93 | return this; |
||
94 | } |
||
95 | } |