}
public void setUpdatedValueAt(Object value, int row, int column) {
ObjAttribute attribute = getAttribute(row);
AttributeEvent event = new AttributeEvent(eventSource, attribute, entity);
String path = null;
Collection<String> nameAttr = null;
if (column == OBJ_ATTRIBUTE) {
event.setOldName(attribute.getName());
ProjectUtil.setAttributeName(attribute, value != null ? value
.toString()
.trim() : null);
fireTableCellUpdated(row, column);
}
else if (column == OBJ_ATTRIBUTE_TYPE) {
String oldType = attribute.getType();
attribute.setType(value != null ? value.toString() : null);
String newType = attribute.getType();
String[] registeredTypes = ModelerUtil.getRegisteredTypeNames();
Collection<String> registeredTypesList = Arrays.asList(registeredTypes);
if (oldType != null
&& newType != null
&& !(registeredTypesList.contains(oldType) == registeredTypesList
.contains(newType))) {
ObjAttribute attributeNew;
ArrayList<Embeddable> embs = mediator
.getEmbeddableNamesInCurRentDataDomain();
ArrayList<String> embNames = new ArrayList<String>();
Iterator<Embeddable> it = embs.iterator();
while (it.hasNext()) {
embNames.add(it.next().getClassName());
}
if (registeredTypesList.contains(newType) || !embNames.contains(newType)) {
attributeNew = new ObjAttribute();
}
else {
attributeNew = new EmbeddedAttribute();
attribute.setDbAttributePath(null);
}
attributeNew.setDbAttributePath(attribute.getDbAttributePath());
attributeNew.setName(attribute.getName());
attributeNew.setEntity(attribute.getEntity());
attributeNew.setParent(attribute.getParent());
attributeNew.setType(attribute.getType());
attributeNew.setUsedForLocking(attribute.isUsedForLocking());
Entity ent = attribute.getEntity();
ent.removeAttribute(attribute.getName());
ent.addAttribute(attributeNew);
mediator.fireObjEntityEvent(new EntityEvent(this, ent, MapEvent.CHANGE));
EntityDisplayEvent ev = new EntityDisplayEvent(
this,
mediator.getCurrentObjEntity(),
mediator.getCurrentDataMap(),
(DataChannelDescriptor) mediator.getProject().getRootNode());
mediator.fireObjEntityDisplayEvent(ev);
mediator.fireObjAttributeEvent(new AttributeEvent(
this,
attributeNew,
ent,
MapEvent.CHANGE));