}
break;
}
else
{
final BinaryCellPanel pane = new BinaryCellPanel();
Schema schema = getInfo().getServerDescriptor().getSchema();
final boolean isImage = Utilities.hasImageSyntax(attrName, schema);
pane.setDisplayDelete(true);
final byte[] binaryValue = (byte[])o;
if (binaryValue.length > 0)
{
pane.setValue(binaryValue, isImage);
}
pane.addEditActionListener(new ActionListener()
{
private BinaryValue newValue;
/**
* {@inheritDoc}
*/
public void actionPerformed(ActionEvent ev)
{
if (editBinaryDlg == null)
{
editBinaryPanel = new BinaryAttributeEditorPanel();
editBinaryPanel.setInfo(getInfo());
editBinaryDlg = new GenericDialog(
Utilities.getFrame(SimplifiedViewEntryPanel.this),
editBinaryPanel);
editBinaryDlg.setModal(true);
Utilities.centerGoldenMean(editBinaryDlg,
Utilities.getParentDialog(SimplifiedViewEntryPanel.this));
}
if (newValue == null)
{
// We use an empty binary array to not breaking the logic:
// it means that there is no value for the attribute.
if ((binaryValue != null) && (binaryValue.length > 0))
{
newValue = BinaryValue.createBase64(binaryValue);
editBinaryPanel.setValue(attrName, newValue);
}
else
{
editBinaryPanel.setValue(attrName, null);
}
}
else
{
editBinaryPanel.setValue(attrName, newValue);
}
editBinaryDlg.setVisible(true);
if (editBinaryPanel.valueChanged())
{
newValue = editBinaryPanel.getBinaryValue();
pane.setValue(newValue, isImage);
notifyListeners();
}
}
});
pane.addDeleteActionListener(new ActionListener()
{
/**
* {@inheritDoc}
*/
public void actionPerformed(ActionEvent ev)
{
pane.setValue((byte[])null, false);
if (editBinaryPanel != null)
{
editBinaryPanel.setValue(attrName, null);
}
notifyListeners();