Lines 65-70
Link Here
|
65 |
import javax.swing.KeyStroke; |
65 |
import javax.swing.KeyStroke; |
66 |
import javax.swing.SwingUtilities; |
66 |
import javax.swing.SwingUtilities; |
67 |
import javax.swing.table.TableCellEditor; |
67 |
import javax.swing.table.TableCellEditor; |
|
|
68 |
import javax.swing.table.TableModel; |
68 |
import org.jdesktop.swingx.JXButton; |
69 |
import org.jdesktop.swingx.JXButton; |
69 |
import org.jdesktop.swingx.JXPanel; |
70 |
import org.jdesktop.swingx.JXPanel; |
70 |
import org.netbeans.modules.db.dataview.table.ResultSetTableCellEditor; |
71 |
import org.netbeans.modules.db.dataview.table.ResultSetTableCellEditor; |
Lines 89-96
Link Here
|
89 |
@Override |
90 |
@Override |
90 |
public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, int row, int column) { |
91 |
public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, int row, int column) { |
91 |
this.table = table; |
92 |
this.table = table; |
|
|
93 |
|
92 |
final JComponent c = (JComponent) super.getTableCellEditorComponent(table, value, isSelected, row, column); |
94 |
final JComponent c = (JComponent) super.getTableCellEditorComponent(table, value, isSelected, row, column); |
93 |
setEditable(column, c, table.isCellEditable(row, column)); |
|
|
94 |
|
95 |
|
95 |
JXPanel panel = new JXPanel(new BorderLayout()) { |
96 |
JXPanel panel = new JXPanel(new BorderLayout()) { |
96 |
|
97 |
|
Lines 138-144
Link Here
|
138 |
|
139 |
|
139 |
protected void editCell(JTable table, int row, int column) { |
140 |
protected void editCell(JTable table, int row, int column) { |
140 |
JTextArea textArea = new JTextArea(20, 80); |
141 |
JTextArea textArea = new JTextArea(20, 80); |
141 |
Object value = table.getValueAt(row, column); |
142 |
TableModel tm = table.getModel(); |
|
|
143 |
int modelRow = table.convertRowIndexToModel(row); |
144 |
int modelColumn = table.convertColumnIndexToModel(column); |
145 |
boolean editable = tm.isCellEditable(modelRow, modelColumn); |
146 |
Object value = tm.getValueAt(modelRow, modelColumn); |
142 |
if (value != null) { |
147 |
if (value != null) { |
143 |
textArea.setText(value.toString()); |
148 |
textArea.setText(value.toString()); |
144 |
textArea.setCaretPosition(0); |
149 |
textArea.setCaretPosition(0); |
Lines 151-157
Link Here
|
151 |
if (editable) { |
156 |
if (editable) { |
152 |
int result = JOptionPane.showOptionDialog(parent, pane, table.getColumnName(column), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null); |
157 |
int result = JOptionPane.showOptionDialog(parent, pane, table.getColumnName(column), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null); |
153 |
if (result == JOptionPane.OK_OPTION) { |
158 |
if (result == JOptionPane.OK_OPTION) { |
154 |
table.setValueAt(textArea.getText(), row, column); |
159 |
tm.setValueAt(textArea.getText(), modelRow, modelColumn); |
155 |
} |
160 |
} |
156 |
} else { |
161 |
} else { |
157 |
JOptionPane.showMessageDialog(parent, pane, table.getColumnName(column), JOptionPane.PLAIN_MESSAGE, null); |
162 |
JOptionPane.showMessageDialog(parent, pane, table.getColumnName(column), JOptionPane.PLAIN_MESSAGE, null); |