if (!(source instanceof JMenuItem))
return;
JMenuItem mi = (JMenuItem) source;
String name = mi.getText();
Layer targetLayer = (Layer) layers.get(name);
if (targetLayer == null) {
System.out.println("ERROR> BBDnDC::actionPerformed: "
+ "no layer found with name " + name);
return;
}
BeanBox targetBeanBox = ((BeanBoxHandler) targetLayer).getBeanBox();
Object bean = transferData.get(0);
BeanInfo beanInfo = (BeanInfo) transferData.get(1);
Boolean wasBeanMoved = (Boolean) transferData.get(2);
if (wasBeanMoved.booleanValue()) {
String sourceLayerName = (String) transferData.get(3);
if (sourceLayerName.equals(targetLayer.getName())) {
targetBeanBox.relocateBean(bean, beanInfo, dropLocation);
} else {
Layer sourceLayer = (Layer) layers.get(sourceLayerName);
BeanBox sourceBeanBox = ((BeanBoxHandler) sourceLayer).getBeanBox();
sourceBeanBox.removeBean(bean);
Vector object = new Vector();
object.add(bean);
object.add(beanInfo);