use of org.apache.cayenne.map.DataMap 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.map.DataMap in project cayenne by apache.
the class ProjectController method getDataMapPreferences.
/**
* Returns preferences object for the current DataMap. If no preferences
* exist for the current DataMap, a new Preferences object is created. If no
* DataMap is currently selected, an exception is thrown. An optional
* nameSuffix allows to address more than one defaults instance for a single
* DataMap.
*/
public DataMapDefaults getDataMapPreferences(String nameSuffix) {
DataMap map = getCurrentDataMap();
if (map == null) {
throw new CayenneRuntimeException("No DataMap selected");
}
Preferences pref;
if (nameSuffix == null || nameSuffix.length() == 0) {
pref = getPreferenceForDataDomain().node("DataMap").node(map.getName());
} else {
pref = getPreferenceForDataDomain().node("DataMap").node(map.getName()).node(nameSuffix);
}
return (DataMapDefaults) application.getCayenneProjectPreferences().getProjectDetailObject(DataMapDefaults.class, pref);
}
use of org.apache.cayenne.map.DataMap 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.map.DataMap in project cayenne by apache.
the class ProjectFileChangeTracker method reconfigure.
/**
* Reloads files to watch from the project. Useful when project's structure
* has changed
*/
public void reconfigure() {
pauseWatching();
removeAllFiles();
Project project = mediator.getProject();
// check if project exists and has been saved at least once.
if (project != null && project.getConfigurationResource() != null) {
String projectPath = project.getConfigurationResource().getURL().getPath() + File.separator;
addFile(projectPath);
Iterator<DataMap> it = ((DataChannelDescriptor) project.getRootNode()).getDataMaps().iterator();
while (it.hasNext()) {
DataMap dm = it.next();
if (dm.getConfigurationSource() != null) {
// if DataMap is in separate file, monitor it
addFile(dm.getConfigurationSource().getURL().getPath());
}
}
}
resumeWatching();
}
use of org.apache.cayenne.map.DataMap in project cayenne by apache.
the class TreeDragSource method dragOver.
public void dragOver(DragSourceDragEvent dsde) {
TreePath sourcePath = sourceTree.getSelectionPath();
DefaultMutableTreeNode sourceParent = (DefaultMutableTreeNode) sourcePath.getLastPathComponent();
TreePath path = dt.getPath();
if (path == null) {
dsde.getDragSourceContext().setCursor(DragSource.DefaultLinkNoDrop);
return;
}
DefaultMutableTreeNode parent = (DefaultMutableTreeNode) path.getLastPathComponent();
if (sourceParent.getUserObject() instanceof DataMap && parent.getUserObject() instanceof DataNodeDescriptor) {
dsde.getDragSourceContext().setCursor(DragSource.DefaultLinkDrop);
} else {
dsde.getDragSourceContext().setCursor(DragSource.DefaultLinkNoDrop);
}
}
Aggregations