use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class ProjectController method updateEntityResolver.
public void updateEntityResolver() {
Collection<DataMap> dataMaps = ((DataChannelDescriptor) project.getRootNode()).getDataMaps();
entityResolver.setDataMaps(dataMaps);
for (DataMap dataMap : dataMaps) {
dataMap.setNamespace(entityResolver);
}
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class ProjectController method setProject.
public void setProject(Project currentProject) {
if (this.project != currentProject) {
this.project = currentProject;
this.projectControllerPreferences = null;
if (project == null) {
this.entityResolver = null;
if (fileChangeTracker != null) {
fileChangeTracker.interrupt();
fileChangeTracker = null;
}
} else {
if (fileChangeTracker == null) {
fileChangeTracker = new ProjectFileChangeTracker(this);
fileChangeTracker.setDaemon(true);
fileChangeTracker.start();
}
fileChangeTracker.reconfigure();
entityResolver = new EntityResolver(((DataChannelDescriptor) currentProject.getRootNode()).getDataMaps());
updateEntityResolver();
}
}
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class ProjectController method getEmbeddablesInCurrentDataDomain.
public ArrayList<Embeddable> getEmbeddablesInCurrentDataDomain() {
DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor) getProject().getRootNode();
Collection<DataMap> maps = dataChannelDescriptor.getDataMaps();
Iterator<DataMap> it = maps.iterator();
ArrayList<Embeddable> embs = new ArrayList<>();
while (it.hasNext()) {
embs.addAll(it.next().getEmbeddables());
}
return embs;
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class ProjectTreeView method dataMapAdded.
public void dataMapAdded(DataMapEvent e) {
DefaultMutableTreeNode domainNode = getProjectModel().getNodeForObjectPath(new Object[] { e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor) mediator.getProject().getRootNode() });
DefaultMutableTreeNode newMapNode = ProjectTreeFactory.wrapProjectNode(e.getDataMap());
mediator.getEntityResolver().addDataMap(e.getDataMap());
positionNode(domainNode, newMapNode, Comparators.getDataDomainChildrenComparator());
showNode(newMapNode);
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class ProjectTreeView method dataNodeAdded.
public void dataNodeAdded(DataNodeEvent e) {
if (e.getSource() == this) {
return;
}
DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(new Object[] { e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor) mediator.getProject().getRootNode() });
if (node == null) {
return;
}
DataNodeDescriptor dataNode = e.getDataNode();
DefaultMutableTreeNode currentNode = ProjectTreeFactory.wrapProjectNode(dataNode);
positionNode(node, currentNode, Comparators.getDataDomainChildrenComparator());
showNode(currentNode);
}
Aggregations