use of com.haulmont.cuba.core.global.ViewProperty in project cuba by cuba-platform.
the class ViewRepositoryInfo method dump.
protected void dump(View view, StringBuilder content) {
content.append("\n");
content.append("+ ").append(metadata.getSession().getClass(view.getEntityClass()).getName()).append("/").append(view.getName());
for (ViewProperty viewProperty : view.getProperties()) {
dump(viewProperty, content, " ");
}
content.append("\n");
}
use of com.haulmont.cuba.core.global.ViewProperty in project cuba by cuba-platform.
the class ViewRepositoryInfo method dumpHtml.
protected void dumpHtml(ViewProperty viewProperty, StringBuilder content, String indent) {
content.append("<br/>").append("\n");
content.append(indent);
content.append("- ").append(viewProperty.getName());
View innerView = viewProperty.getView();
if (innerView != null) {
if (StringUtils.isNotEmpty(innerView.getName())) {
String metaClassName = metadata.getSession().getClass(innerView.getEntityClass()).getName();
content.append(" -> <a href=\"#").append(metaClassName).append("__").append(innerView.getName()).append("\">").append(metaClassName).append("/").append(innerView.getName()).append("</a>");
} else {
for (ViewProperty innerProperty : innerView.getProperties()) {
dumpHtml(innerProperty, content, " " + indent);
}
}
}
}
use of com.haulmont.cuba.core.global.ViewProperty in project cuba by cuba-platform.
the class PropertyDatasourceImpl method getView.
@Override
public View getView() {
if (view == null) {
MetaClass metaMetaClass = masterDs.getMetaClass();
if (metadata.getTools().isPersistent(metaMetaClass) || metadata.getTools().isEmbeddable(metaMetaClass)) {
View masterView = masterDs.getView();
if (masterView == null) {
throw new DevelopmentException("No view for datasource " + masterDs.getId(), ParamsMap.of("masterDs", masterDs.getId(), "propertyDs", getId()));
}
ViewProperty property = masterView.getProperty(metaProperty.getName());
if (property == null) {
return null;
}
if (property.getView() == null) {
throw new DevelopmentException(String.format("Invalid view definition: %s. Property '%s' must have a view", masterView, property), ParamsMap.of("masterDs", masterDs.getId(), "propertyDs", getId(), "masterView", masterView, "property", property));
}
view = metadata.getViewRepository().findView(getMetaClass(), property.getView().getName());
// anonymous (nameless) view
if (view == null)
view = property.getView();
}
}
return view;
}
use of com.haulmont.cuba.core.global.ViewProperty in project cuba by cuba-platform.
the class ViewRepositoryInfo method dump.
protected void dump(ViewProperty viewProperty, StringBuilder content, String indent) {
content.append("\n");
content.append(indent);
content.append("- ").append(viewProperty.getName());
View innerView = viewProperty.getView();
if (innerView != null) {
if (StringUtils.isNotEmpty(innerView.getName())) {
content.append(" -> ").append(metadata.getSession().getClass(innerView.getEntityClass()).getName()).append("/").append(innerView.getName());
} else {
for (ViewProperty innerProperty : innerView.getProperties()) {
dump(innerProperty, content, " " + indent);
}
}
}
}
use of com.haulmont.cuba.core.global.ViewProperty in project cuba by cuba-platform.
the class ViewRepositoryInfo method dumpHtml.
protected void dumpHtml(View view, StringBuilder content) {
content.append("<br/>").append("\n");
String metaClassName = metadata.getSession().getClass(view.getEntityClass()).getName();
String viewHtmlId = metaClassName + "__" + view.getName();
content.append("+ <a href=\"#").append(viewHtmlId).append("\"><span id=\"").append(viewHtmlId).append("\">").append(metaClassName).append("/").append(view.getName()).append("</span></a>");
for (ViewProperty viewProperty : view.getProperties()) {
dumpHtml(viewProperty, content, " ");
}
content.append("<br/>").append("\n");
}
Aggregations