Lines 76-81
Link Here
|
76 |
protected JButton button; |
76 |
protected JButton button; |
77 |
protected JPopupMenu popup; |
77 |
protected JPopupMenu popup; |
78 |
protected JTable table; |
78 |
protected JTable table; |
|
|
79 |
protected JMenuItem saveContentMenuItem; |
79 |
|
80 |
|
80 |
public BlobFieldTableCellEditor() { |
81 |
public BlobFieldTableCellEditor() { |
81 |
button = new JButton(); |
82 |
button = new JButton(); |
Lines 99-104
Link Here
|
99 |
fireEditingCanceled(); |
100 |
fireEditingCanceled(); |
100 |
} |
101 |
} |
101 |
}); |
102 |
}); |
|
|
103 |
saveContentMenuItem = miLobSaveAction; |
102 |
popup.add(miLobSaveAction); |
104 |
popup.add(miLobSaveAction); |
103 |
final JMenuItem miLobLoadAction = new JMenuItem(NbBundle.getMessage(BlobFieldTableCellEditor.class, "loadLob.title")); |
105 |
final JMenuItem miLobLoadAction = new JMenuItem(NbBundle.getMessage(BlobFieldTableCellEditor.class, "loadLob.title")); |
104 |
miLobLoadAction.addActionListener(new ActionListener() { |
106 |
miLobLoadAction.addActionListener(new ActionListener() { |
Lines 136-141
Link Here
|
136 |
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
138 |
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
137 |
currentValue = (java.sql.Blob) value; |
139 |
currentValue = (java.sql.Blob) value; |
138 |
if (currentValue != null) { |
140 |
if (currentValue != null) { |
|
|
141 |
saveContentMenuItem.setEnabled(true); |
139 |
try { |
142 |
try { |
140 |
long size = currentValue.length(); |
143 |
long size = currentValue.length(); |
141 |
StringBuilder stringValue = new StringBuilder(); |
144 |
StringBuilder stringValue = new StringBuilder(); |
Lines 153-158
Link Here
|
153 |
button.setText("<BLOB of unknown size>"); |
156 |
button.setText("<BLOB of unknown size>"); |
154 |
} |
157 |
} |
155 |
} else { |
158 |
} else { |
|
|
159 |
saveContentMenuItem.setEnabled(false); |
156 |
button.setText("<NULL>"); |
160 |
button.setText("<NULL>"); |
157 |
} |
161 |
} |
158 |
this.table = table; |
162 |
this.table = table; |
Lines 173-178
Link Here
|
173 |
} |
177 |
} |
174 |
|
178 |
|
175 |
private void saveLobToFile(Blob b) { |
179 |
private void saveLobToFile(Blob b) { |
|
|
180 |
if(b == null) { |
181 |
return; |
182 |
} |
176 |
JFileChooser c = new JFileChooser(); |
183 |
JFileChooser c = new JFileChooser(); |
177 |
int fileDialogState = c.showSaveDialog(table); |
184 |
int fileDialogState = c.showSaveDialog(table); |
178 |
if (fileDialogState == JFileChooser.APPROVE_OPTION) { |
185 |
if (fileDialogState == JFileChooser.APPROVE_OPTION) { |