强制AEM经典UI&;触摸UI设计对话框共享相同的全局设计路径
我们按照本教程->创建了一个全局设计路径解决方案,用于多个组件共享设计,非常适合经典的UI设计对话框强制AEM经典UI&;触摸UI设计对话框共享相同的全局设计路径,aem,tld,aem-6,aem-touch-ui,Aem,Tld,Aem 6,Aem Touch Ui,我们按照本教程->创建了一个全局设计路径解决方案,用于多个组件共享设计,非常适合经典的UI设计对话框 public class GlobalDesignDialogTag extends BaseTag { /** * Global design properties attribute name. */ public static final String GLOBAL_DESIGN_PROPERTIES_ATTRIBUTE_NAME = "globalD
public class GlobalDesignDialogTag extends BaseTag
{
/**
* Global design properties attribute name.
*/
public static final String GLOBAL_DESIGN_PROPERTIES_ATTRIBUTE_NAME = "globalDesignProperties";
private static final long serialVersionUID = 1L;
@Override public final int doEndTag()
{
final String
globalDesignPath =
getCurrentDesign().getPath() + "/" + JCR_CONTENT + "/" + getCurrentResource().getName();
EditContext editContext = getEditContext();
String currentDesignPath = getCurrentDesign().getPath() + "/jcr:content/default-page/par-main/secondary-nav";
if (WCMMode.fromRequest(getSlingRequest()) == WCMMode.DESIGN)
{
// Set the design dialog content path to be global design level instead of template
editContext.setContentPath(globalDesignPath);
}
if (AuthoringUIMode.fromRequest(getSlingRequest()).equals(AuthoringUIMode.TOUCH)) {
editContext.setContentPath(globalDesignPath);
}
final Resource globalDesignResource = getResourceResolver().getResource(globalDesignPath);
if (globalDesignResource != null)
{
// Set an attribute containing global design properties as ${currentStyle.propertyName} will still
// point to the default design dialog path under the template.
pageContext.setAttribute(GLOBAL_DESIGN_PROPERTIES_ATTRIBUTE_NAME,
globalDesignResource.adaptTo(ValueMap.class));
}
return EVAL_PAGE;
}
/**
* Gets the EditContext from the pageContext.
*
* @return The EditContext from the pageContext.
*/
private EditContext getEditContext()
{
return (EditContext) pageContext.getAttribute(DefineObjectsTag.DEFAULT_EDIT_CONTEXT_NAME);
}
/**
* Gets the current design from the pageContext.
*
* @return The current design from the pageContent.
*/
private Design getCurrentDesign()
{
if (pageContext.getAttribute(DefineObjectsTag.DEFAULT_CURRENT_DESIGN_NAME) != null)
{
return (Design) pageContext.getAttribute(DefineObjectsTag.DEFAULT_CURRENT_DESIGN_NAME);
}
return getCurrentResource().adaptTo(Design.class);
}
}
现在我们需要将经典UI升级到TouchUI,这涉及到很多组件的升级,但我们仍然希望保持大多数核心java代码不变或尽可能少的更改。
但是上面的教程方法editContext.setContentPath(globalDesignPath)代码>
似乎无法使用触摸屏UI设计对话框。。。
请参见下图插图
因此,在经典的UI设计对话框中,粉红色的线条是预期的行为,使用editContext.setContentPath(globel)
它将设计对话框的辅助导航节点保存在设计模板级别
但在绿线中,使用上面相同的代码示例,从触摸屏界面触发设计对话框save,editContext.setContentPath(globel)
它看起来没有做任何事情。。。它将节点保存在演示站点/jcr:content/default page/par main/secondary nav
下,这是设计的页面模板级别。。。不同页面设计模板中的其他辅助导航组件将无法访问属性。
理想情况下,触摸界面设计对话框应该像蓝色线条一样。。。通过保存对话框,它应该更新演示站点/jcr:content/secondary nav
节点属性
经过调查,我认为最可疑的一行是editContext.setContentPath(globel)
,它是否在触摸界面中,它有一种新的(editContext)
对象或API将触摸界面设计对话框保存到自定义路径中?
如果可能,请提供代码示例。
谢谢检查您的页面指向的ini侧/内容
节点是否正确cq:designpath检查您的页面指向的ini侧/内容
节点是否正确cq:designpath