import org.argeo.entity.EntityNames;
import org.argeo.entity.EntityType;
import org.argeo.jcr.Jcr;
+import org.argeo.jcr.JcrException;
import org.argeo.suite.RankedObject;
import org.argeo.suite.SuiteUtils;
import org.argeo.util.LangUtils;
public final static String PUBLIC_BASE_PATH_PROPERTY = "publicBasePath";
public final static String DEFAULT_UI_NAME_PROPERTY = "defaultUiName";
public final static String DEFAULT_THEME_ID_PROPERTY = "defaultThemeId";
+ public final static String DEFAULT_LAYER_PROPERTY = "defaultLayer";
private final static String LOGIN = "login";
private String publicBasePath = null;
defaultUiName = LangUtils.get(properties, DEFAULT_UI_NAME_PROPERTY);
if (properties.containsKey(DEFAULT_THEME_ID_PROPERTY))
defaultThemeId = LangUtils.get(properties, DEFAULT_THEME_ID_PROPERTY);
+ if (properties.containsKey(DEFAULT_LAYER_PROPERTY))
+ defaultLayerPid = LangUtils.get(properties, DEFAULT_LAYER_PROPERTY);
publicBasePath = LangUtils.get(properties, PUBLIC_BASE_PATH_PROPERTY);
if (properties.containsKey(Constants.SERVICE_PID)) {
CmsView cmsView = CmsView.getCmsView(parent);
CmsUiProvider headerUiProvider = findUiProvider(headerPid);
CmsUiProvider footerUiProvider = findUiProvider(footerPid);
+ CmsUiProvider leadPaneUiProvider = findUiProvider(leadPanePid);
+
Localized appTitle = null;
if (headerUiProvider instanceof DefaultHeader) {
appTitle = ((DefaultHeader) headerUiProvider).getTitle();
CmsSession cmsSession = cmsView.getCmsSession();
if (ui.getUserDir() == null) {
// FIXME NPE on CMSSession when logging in from anonymous
- if (cmsSession==null || cmsView.isAnonymous()) {
+ if (cmsSession == null || cmsView.isAnonymous()) {
assert publicBasePath != null;
ui.initSessions(getRepository(), publicBasePath);
} else {
SuiteLayer layer = layersByPid.get(key).get();
ui.addLayer(key, layer);
}
- refreshPart(findUiProvider(leadPanePid), ui.getLeadPane(), context);
+
+ if (leadPaneUiProvider != null)
+ refreshPart(leadPaneUiProvider, ui.getLeadPane(), context);
if (footerUiProvider != null)
refreshPart(footerUiProvider, ui.getFooter(), context);
ui.layout(true, true);
try {
// mixins
Set<String> types = new TreeSet<>();
- for (NodeType nodeType : context.getMixinNodeTypes()) {
- String typeName = nodeType.getName();
- if (byType.containsKey(typeName)) {
- types.add(typeName);
+ for (NodeType mixinType : context.getMixinNodeTypes()) {
+ String mixinTypeName = mixinType.getName();
+ if (byType.containsKey(mixinTypeName)) {
+ types.add(mixinTypeName);
+ }
+ for (NodeType superType : mixinType.getDeclaredSupertypes()) {
+ if (byType.containsKey(superType.getName())) {
+ types.add(superType.getName());
+ }
}
}
// primary node type
- {
- NodeType nodeType = context.getPrimaryNodeType();
- String typeName = nodeType.getName();
- if (byType.containsKey(typeName)) {
- types.add(typeName);
- }
- for (NodeType mixin : nodeType.getDeclaredSupertypes()) {
- if (byType.containsKey(mixin.getName())) {
- types.add(mixin.getName());
- }
+ NodeType primaryType = context.getPrimaryNodeType();
+ String primaryTypeName = primaryType.getName();
+ if (byType.containsKey(primaryTypeName)) {
+ types.add(primaryTypeName);
+ }
+ for (NodeType superType : primaryType.getDeclaredSupertypes()) {
+ if (byType.containsKey(superType.getName())) {
+ types.add(superType.getName());
}
}
// entity type
if (context.isNodeType(EntityType.entity.get())) {
if (context.hasProperty(EntityNames.ENTITY_TYPE)) {
- String typeName = context.getProperty(EntityNames.ENTITY_TYPE).getString();
- if (byType.containsKey(typeName)) {
- types.add(typeName);
+ String entityTypeName = context.getProperty(EntityNames.ENTITY_TYPE).getString();
+ if (byType.containsKey(entityTypeName)) {
+ types.add(entityTypeName);
}
}
}
}
if (types.size() == 0)
- throw new IllegalArgumentException("No type found for " + context);
+ throw new IllegalArgumentException("No type found for " + context + " (" + listTypes(context) + ")");
String type = types.iterator().next();
if (!byType.containsKey(type))
throw new IllegalArgumentException("No component found for " + context + " with type " + type);
}
}
+ private static String listTypes(Node context) {
+ try {
+ StringBuilder sb = new StringBuilder();
+ sb.append(context.getPrimaryNodeType().getName());
+ for (NodeType superType : context.getPrimaryNodeType().getDeclaredSupertypes()) {
+ sb.append(' ');
+ sb.append(superType.getName());
+ }
+
+ for (NodeType nodeType : context.getMixinNodeTypes()) {
+ sb.append(' ');
+ sb.append(nodeType.getName());
+ if (nodeType.getName().equals(EntityType.local.get()))
+ sb.append('/').append(context.getProperty(EntityNames.ENTITY_TYPE).getString());
+ for (NodeType superType : nodeType.getDeclaredSupertypes()) {
+ sb.append(' ');
+ sb.append(superType.getName());
+ }
+ }
+ return sb.toString();
+ } catch (RepositoryException e) {
+ throw new JcrException(e);
+ }
+ }
+
@Override
public void setState(Composite parent, String state) {
if (state == null)