{
Object o = event.getObject();
if (event instanceof OpenEvent)
{
JaspiraEventHandlerCode ret = doOpen(null, false, event);
if (ret != EventModule.EVENT_IGNORED)
return ret;
}
else if (o instanceof Transferable)
{
Transferable transferable = (Transferable) o;
if (transferable.isDataFlavorSupported(ClientFlavors.MODEL_OBJECT))
{
ModelObject mo = null;
try
{
mo = (ModelObject) transferable.getTransferData(ClientFlavors.MODEL_OBJECT);
}
catch (IOException e)
{
return EVENT_IGNORED;
}
catch (UnsupportedFlavorException e)
{
// Does not happen
return EVENT_IGNORED;
}
if (mo != null)
{
List associations = mo.getAssociations();
if (associations != null)
{
int n = associations.size();
for (int i = 0; i < n; ++i)
{
Association assoc = (Association) associations.get(i);
if (assoc.getAssociationPriority() == priority)
{
JaspiraEventHandlerCode ret = doOpen(assoc, !mo.isModifiable(), event);
if (ret != EventModule.EVENT_IGNORED)
return ret;
}
}
}
else
{
// No associations defined for this model object;
// Assume this is ok and prevent an error message
// TODONOW return EVENT_CONSUMED;
}
}
}
}
else if (o instanceof Association)
{
Association assoc = (Association) o;
if (assoc.getAssociationPriority() == Association.PRIMARY)
{
JaspiraEventHandlerCode ret = doOpen(assoc, false, event);
if (ret != EventModule.EVENT_IGNORED)
return ret;
}
}