Revision 10679 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/edition/gui/SymbolCellEditor.java

View differences:

SymbolCellEditor.java
55 55
import javax.swing.table.TableCellEditor;
56 56

  
57 57
import com.iver.andami.PluginServices;
58
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
58
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
59 59

  
60 60

  
61

  
61 62
/**
62
 * Cell Editor de FSymbols. Controla los eventos de edici?n que se realicen
63
 * Cell Editor de ISymbols. Controla los eventos de edici?n que se realicen
63 64
 * sobre la columna de s?mbolos.
64 65
 *
65 66
 * @author Vicente Caballero Navarro
66 67
 */
67 68
public class SymbolCellEditor extends JButton implements TableCellEditor {
68 69
	private ArrayList listeners = new ArrayList();
69
	private FSymbol symbol;
70
	private ISymbol symbol;
71
	private int shapeType;
70 72
	private PanelEditSymbol symbolPanel;
71 73

  
72
	/**
73
	 * Crea un nuevo FCellEditor.
74
	 */
75
	public SymbolCellEditor() {
74
	public SymbolCellEditor(int shapeType) {
75
		this.shapeType = shapeType;
76 76
		addMouseListener(new MouseListener(){
77 77

  
78 78
			public void mouseClicked(MouseEvent e) {
79 79
				if (e.getClickCount()==2){
80 80
					symbolPanel.setSymbol(symbol);
81
					symbolPanel.setShapeType(SymbolCellEditor.this.shapeType);
81 82
					PluginServices.getMDIManager().addWindow(symbolPanel);
82 83
					if (symbolPanel.isOK()){
83
					symbol = symbolPanel.getFSymbol();
84
					setBackground(symbol.getColor());
84
				    // FIXME: AQU? PETA SEGURO; PORQUE AHORA ES UN ISYMBOL LO QUE LLEGA
85
					symbol = (ISymbol) symbolPanel.getSymbol();
86
//					setBackground(symbol.getColor());
85 87
					stopCellEditing();
86 88
					}
87 89
				}
......
98 100

  
99 101
			public void mouseReleased(MouseEvent e) {
100 102
			}
101
			
103

  
102 104
		});
103 105
		addKeyListener(new KeyAdapter() {
104 106
				public void keyReleased(KeyEvent e) {
......
113 115

  
114 116
	}
115 117

  
116
	
118

  
117 119
	//Implement the one CellEditor method that AbstractCellEditor doesn't.
118 120
	public Object getCellEditorValue() {
119 121
		return symbol;
......
122 124
	//Implement the one method defined by TableCellEditor.
123 125
	public Component getTableCellEditorComponent(JTable table, Object value,
124 126
		boolean isSelected, int row, int column) {
125
		System.out.println(value.toString());
126
		symbol = (FSymbol) value;
127
		setBackground(symbol.getColor());
127
		symbol = (ISymbol) value;
128
//		setBackground(symbol.getColor());
128 129

  
129 130
		return this;
130 131
	}
......
134 135
	 */
135 136
	public void cancelCellEditing() {
136 137
		if (symbol != null) {
137
			setBackground(symbol.getColor());
138
//			setBackground(symbol.getColor());
138 139
		}
139 140

  
140 141
		for (int i = 0; i < listeners.size(); i++) {

Also available in: Unified diff