use of org.apache.cayenne.map.Attribute in project cayenne by apache.
the class SQLTemplatePrefetchTab method createBrowserModel.
protected TreeModel createBrowserModel(Entity entity) {
EntityTreeModel treeModel = new EntityTreeModel(entity);
treeModel.setFilter(new EntityTreeFilter() {
public boolean attributeMatch(Object node, Attribute attr) {
return false;
}
public boolean relationshipMatch(Object node, Relationship rel) {
return true;
}
});
return treeModel;
}
use of org.apache.cayenne.map.Attribute in project cayenne by apache.
the class SelectQueryPrefetchTab method createBrowserModel.
protected TreeModel createBrowserModel(Entity entity) {
EntityTreeModel treeModel = new EntityTreeModel(entity);
treeModel.setFilter(new EntityTreeFilter() {
public boolean attributeMatch(Object node, Attribute attr) {
return false;
}
public boolean relationshipMatch(Object node, Relationship rel) {
return true;
}
});
return treeModel;
}
use of org.apache.cayenne.map.Attribute in project cayenne by apache.
the class EntityCellMetadata method createLabel.
/**
* Creates label for this cell
*/
String createLabel() {
Entity entity = fetchEntity();
StringBuilder label = new StringBuilder("<html><center><u><b>").append(entity.getName()).append("</b></u></center>");
for (Attribute attr : entity.getAttributes()) {
if (isPrimary(attr)) {
label.append("<br><i>").append(attr.getName()).append("</i>");
}
}
for (Attribute attr : entity.getAttributes()) {
if (!isPrimary(attr)) {
label.append("<br>").append(attr.getName());
}
}
return label.toString();
}
use of org.apache.cayenne.map.Attribute in project cayenne by apache.
the class FindAction method jumpToResult.
/**
* Navigate to search result
* Used also in {@link org.apache.cayenne.modeler.graph.action.EntityDisplayAction}
*/
public static void jumpToResult(FindAction.SearchResultEntry searchResultEntry) {
EditorView editor = ((CayenneModelerFrame) Application.getInstance().getFrameController().getView()).getView();
DataChannelDescriptor domain = (DataChannelDescriptor) Application.getInstance().getProject().getRootNode();
if (searchResultEntry.getObject() instanceof Entity) {
jumpToEntityResult((Entity) searchResultEntry.getObject(), editor, domain);
} else if (searchResultEntry.getObject() instanceof QueryDescriptor) {
jumpToQueryResult((QueryDescriptor) searchResultEntry.getObject(), editor, domain);
} else if (searchResultEntry.getObject() instanceof Embeddable) {
jumpToEmbeddableResult((Embeddable) searchResultEntry.getObject(), editor, domain);
} else if (searchResultEntry.getObject() instanceof EmbeddableAttribute) {
jumpToEmbeddableAttributeResult((EmbeddableAttribute) searchResultEntry.getObject(), editor, domain);
} else if (searchResultEntry.getObject() instanceof Attribute || searchResultEntry.getObject() instanceof Relationship) {
jumpToAttributeResult(searchResultEntry, editor, domain);
}
}
use of org.apache.cayenne.map.Attribute in project cayenne by apache.
the class FindAction method jumpToAttributeResult.
private static void jumpToAttributeResult(SearchResultEntry searchResultEntry, EditorView editor, DataChannelDescriptor domain) {
DataMap map;
Entity entity;
if (searchResultEntry.getObject() instanceof Attribute) {
map = ((Attribute) searchResultEntry.getObject()).getEntity().getDataMap();
entity = ((Attribute) searchResultEntry.getObject()).getEntity();
} else {
map = ((Relationship) searchResultEntry.getObject()).getSourceEntity().getDataMap();
entity = ((Relationship) searchResultEntry.getObject()).getSourceEntity();
}
buildAndSelectTreePath(map, entity, editor);
if (searchResultEntry.getObject() instanceof Attribute) {
AttributeDisplayEvent event = new AttributeDisplayEvent(editor.getProjectTreeView(), (Attribute) searchResultEntry.getObject(), entity, map, domain);
event.setMainTabFocus(true);
if (searchResultEntry.getObject() instanceof DbAttribute) {
editor.getDbDetailView().currentDbAttributeChanged(event);
} else {
editor.getObjDetailView().currentObjAttributeChanged(event);
}
} else if (searchResultEntry.getObject() instanceof Relationship) {
RelationshipDisplayEvent event = new RelationshipDisplayEvent(editor.getProjectTreeView(), (Relationship) searchResultEntry.getObject(), entity, map, domain);
event.setMainTabFocus(true);
if (searchResultEntry.getObject() instanceof DbRelationship) {
editor.getDbDetailView().currentDbRelationshipChanged(event);
} else {
editor.getObjDetailView().currentObjRelationshipChanged(event);
}
}
}
Aggregations