use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class LinkDataMapsUndoableEdit method redo.
@Override
public void redo() throws CannotRedoException {
for (DataMap dataMap : ((DataChannelDescriptor) mediator.getProject().getRootNode()).getDataMaps()) {
if (!linkedDataMaps.contains(dataMap.getName())) {
dataNodeDescriptor.getDataMapNames().add(dataMap.getName());
mediator.fireDataNodeEvent(new DataNodeEvent(this, dataNodeDescriptor));
}
}
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class PasteUndoableEdit method undo.
@Override
public void undo() throws CannotUndoException {
RemoveAttributeAction rAttributeAction = actionManager.getAction(RemoveAttributeAction.class);
RemoveAction rAction = actionManager.getAction(RemoveAction.class);
RemoveRelationshipAction rRelationShipAction = actionManager.getAction(RemoveRelationshipAction.class);
RemoveCallbackMethodAction rCallbackMethodAction = actionManager.getAction(RemoveCallbackMethodAction.class);
RemoveProcedureParameterAction rProcedureParamAction = actionManager.getAction(RemoveProcedureParameterAction.class);
if (content instanceof DataMap) {
if (where instanceof DataChannelDescriptor) {
rAction.removeDataMap((DataMap) content);
} else if (where instanceof DataNodeDescriptor) {
rAction.removeDataMapFromDataNode((DataNodeDescriptor) where, (DataMap) content);
}
} else if (where instanceof DataMap) {
if (content instanceof DbEntity) {
rAction.removeDbEntity(map, (DbEntity) content);
} else if (content instanceof ObjEntity) {
rAction.removeObjEntity(map, (ObjEntity) content);
} else if (content instanceof Embeddable) {
rAction.removeEmbeddable(map, (Embeddable) content);
} else if (content instanceof QueryDescriptor) {
rAction.removeQuery(map, (QueryDescriptor) content);
} else if (content instanceof Procedure) {
rAction.removeProcedure(map, (Procedure) content);
}
} else if (where instanceof DbEntity) {
if (content instanceof DbEntity) {
rAction.removeDbEntity(map, (DbEntity) content);
} else if (content instanceof DbAttribute) {
rAttributeAction.removeDbAttributes(map, (DbEntity) where, new DbAttribute[] { (DbAttribute) content });
} else if (content instanceof DbRelationship) {
rRelationShipAction.removeDbRelationships((DbEntity) where, new DbRelationship[] { (DbRelationship) content });
}
} else if (where instanceof ObjEntity) {
if (content instanceof ObjEntity) {
rAction.removeObjEntity(map, (ObjEntity) content);
} else if (content instanceof ObjAttribute) {
rAttributeAction.removeObjAttributes((ObjEntity) where, new ObjAttribute[] { (ObjAttribute) content });
} else if (content instanceof ObjRelationship) {
rRelationShipAction.removeObjRelationships((ObjEntity) where, new ObjRelationship[] { (ObjRelationship) content });
} else if (content instanceof ObjCallbackMethod) {
ObjCallbackMethod[] methods = new ObjCallbackMethod[] { (ObjCallbackMethod) content };
for (ObjCallbackMethod callbackMethod : methods) {
rCallbackMethodAction.removeCallbackMethod(methods[0].getCallbackType(), callbackMethod.getName());
}
}
} else if (where instanceof Procedure) {
final Procedure procedure = (Procedure) where;
if (content instanceof ProcedureParameter) {
rProcedureParamAction.removeProcedureParameters(procedure, new ProcedureParameter[] { (ProcedureParameter) content });
}
} else if (where instanceof Embeddable) {
if (content instanceof Embeddable) {
rAction.removeEmbeddable(map, (Embeddable) content);
} else if (content instanceof EmbeddableAttribute) {
rAttributeAction.removeEmbeddableAttributes((Embeddable) where, new EmbeddableAttribute[] { (EmbeddableAttribute) content });
}
}
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class ProcedureErrorMsg method displayField.
public void displayField(ProjectController mediator, JFrame frame) {
Object object = super.validationFailure.getSource();
DataChannelDescriptor domain = (DataChannelDescriptor) mediator.getProject().getRootNode();
Procedure procedure = (Procedure) object;
DataMap map = procedure.getDataMap();
ProcedureDisplayEvent event = new ProcedureDisplayEvent(frame, procedure, map, domain);
event.setTabReset(true);
mediator.fireProcedureDisplayEvent(event);
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class DataDomainView method currentDomainChanged.
/**
* Invoked on domain selection event. Updates view with the values from the currently
* selected domain.
*/
public void currentDomainChanged(DomainDisplayEvent e) {
DataChannelDescriptor domain = e.getDomain();
if (null == domain) {
return;
}
// extract values from the new domain object
name.setText(domain.getName());
objectValidation.setSelected(getDomainBooleanProperty(DataDomain.VALIDATING_OBJECTS_ON_COMMIT_PROPERTY, Boolean.toString(DataDomain.VALIDATING_OBJECTS_ON_COMMIT_DEFAULT)));
sharedCache.setSelected(getDomainBooleanProperty(DataDomain.SHARED_CACHE_ENABLED_PROPERTY, Boolean.toString(DataDomain.SHARED_CACHE_ENABLED_DEFAULT)));
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class DataDomainView method getDomainProperty.
public String getDomainProperty(String property, String defaultValue) {
DataChannelDescriptor domain = (DataChannelDescriptor) projectController.getProject().getRootNode();
if (domain == null) {
return null;
}
String value = (String) domain.getProperties().get(property);
return value != null ? value : defaultValue;
}
Aggregations