int row = position == -1 ? addRow() : position;
int field;
int col;
Picture picture;
Object value;
DcImageIcon old_image;
Picture p;
for (int i = 0; i < fields.length; i++) {
field = fields[i];
col = getColumnIndexForField(field);
value = dco.getValue(fields[i]);
if (view != null && view.getType() == View._TYPE_INSERT && value instanceof Picture) {
// TODO: test this, worked with bytes..
// keep images save
picture = (Picture) value;
old_image = (DcImageIcon) picture.getValue(Picture._D_IMAGE);;
if (old_image != null) {
p = (Picture) DcModules.get(DcModules._PICTURE).getItem();
p.setValue(Picture._A_OBJECTID, picture.getValue(Picture._A_OBJECTID));
p.setValue(Picture._B_FIELD, picture.getValue(Picture._B_FIELD));
p.setValue(Picture._C_FILENAME, picture.getValue(Picture._C_FILENAME));
p.setValue(Picture._E_HEIGHT, picture.getValue(Picture._E_HEIGHT));
p.setValue(Picture._F_WIDTH, picture.getValue(Picture._F_WIDTH));
p.setValue(Picture._D_IMAGE, new DcImageIcon(old_image.getImage()));
picture = p;
}
model.setValueAt(picture, row, col);
} else {
model.setValueAt(value, row, col);