use of org.apache.cayenne.map.EmbeddableAttribute in project cayenne by apache.
the class RemoveAttributeAction method removeEmbeddableAttributes.
public void removeEmbeddableAttributes(Embeddable embeddable, EmbeddableAttribute[] attrs) {
ProjectController mediator = getProjectController();
for (EmbeddableAttribute attrib : attrs) {
embeddable.removeAttribute(attrib.getName());
EmbeddableAttributeEvent e = new EmbeddableAttributeEvent(Application.getFrame(), attrib, embeddable, MapEvent.REMOVE);
mediator.fireEmbeddableAttributeEvent(e);
}
}
use of org.apache.cayenne.map.EmbeddableAttribute in project cayenne by apache.
the class EmbeddableAttributeDisplayEventType method saveLastDisplayEvent.
@Override
public void saveLastDisplayEvent() {
preferences.setEvent(EmbeddableAttributeDisplayEvent.class.getSimpleName());
preferences.setDomain(controller.getCurrentDataChanel().getName());
preferences.setDataMap(controller.getCurrentDataMap().getName());
preferences.setEmbeddable(controller.getCurrentEmbeddable().getClassName());
EmbeddableAttribute[] currentEmbAttributes = controller.getCurrentEmbAttributes();
if (currentEmbAttributes == null) {
preferences.setEmbAttrs("");
} else {
StringBuilder sb = new StringBuilder();
for (EmbeddableAttribute embeddableAttribute : currentEmbAttributes) {
sb.append(embeddableAttribute.getName()).append(",");
}
preferences.setEmbAttrs(sb.toString());
}
}
use of org.apache.cayenne.map.EmbeddableAttribute in project cayenne by apache.
the class EmbeddableAttributeDisplayEventType method fireLastDisplayEvent.
@Override
public void fireLastDisplayEvent() {
DataChannelDescriptor dataChannel = (DataChannelDescriptor) controller.getProject().getRootNode();
if (!dataChannel.getName().equals(preferences.getDomain())) {
return;
}
DataMap dataMap = dataChannel.getDataMap(preferences.getDataMap());
if (dataMap == null) {
return;
}
Embeddable embeddable = dataMap.getEmbeddable(preferences.getEmbeddable());
if (embeddable == null) {
return;
}
EmbeddableDisplayEvent embeddableDisplayEvent = new EmbeddableDisplayEvent(this, embeddable, dataMap, dataChannel);
controller.fireEmbeddableDisplayEvent(embeddableDisplayEvent);
EmbeddableAttribute[] embeddableAttributes = getLastEmbeddableAttributes(embeddable);
EmbeddableAttributeDisplayEvent attributeDisplayEvent = new EmbeddableAttributeDisplayEvent(this, embeddable, embeddableAttributes, dataMap, dataChannel);
controller.fireEmbeddableAttributeDisplayEvent(attributeDisplayEvent);
}
Aggregations