本文整理汇总了Java中com.day.cq.wcm.api.Page.getTitle方法的典型用法代码示例。如果您正苦于以下问题:Java Page.getTitle方法的具体用法?Java Page.getTitle怎么用?Java Page.getTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.day.cq.wcm.api.Page
的用法示例。
在下文中一共展示了Page.getTitle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getItems
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
private List<NavigationItem> getItems(Page root) {
List<NavigationItem> pages = new ArrayList<>();
if (root.getDepth() < structureDepth) {
Iterator<Page> it = root.listChildren(new PageFilter());
while (it.hasNext()) {
Page page = it.next();
boolean active = currentPage.getPath().equals(page.getPath()) || currentPage.getPath().startsWith(page.getPath() + "/");
String title = page.getNavigationTitle();
if (title == null) {
title = page.getTitle();
}
List<NavigationItem> children = getItems(page);
int level = page.getDepth() - startLevel;
Page localizedPage = getLocalizedPage(currentPage, page);
if (localizedPage != null) {
page = localizedPage;
}
pages.add(new LanguageNavigationItemImpl(page, active, request, level, children, title));
}
}
return pages;
}
示例2: activate
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
@Override
public void activate() throws Exception {
Resource resource = getResource();
ValueMap properties = getProperties();
ResourceResolver resolver = getResourceResolver();
buttonLinkTo = properties.get(PROP_BUTTON_LINK_TO, "");
buttonLabel = properties.get(PROP_BUTTON_LABEL, "");
if (StringUtils.isNotEmpty(buttonLinkTo)) {
// if button label is not set, try to get it from target page's title
if (StringUtils.isEmpty(buttonLabel)) {
Resource linkResource = resolver.getResource(buttonLinkTo);
if (linkResource != null) {
Page targetPage = linkResource.adaptTo(Page.class);
if (targetPage != null) {
buttonLabel = targetPage.getTitle();
}
}
}
buttonLinkTo = buttonLinkTo + ".html";
}
log.debug("resource: {}", resource.getPath());
log.debug("buttonLinkTo: {}", buttonLinkTo);
log.debug("buttonLabel: {}", buttonLabel);
}
示例3: getNavigationTitle
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
/**
*
* @param page This is a Page
* @return navigationTitle This is the page title
*/
public static String getNavigationTitle(Page page) {
String navigationTitle = null;
if (null != page) {
navigationTitle = page.getNavigationTitle();
if (null == navigationTitle) {
navigationTitle = page.getPageTitle() == null ? page.getTitle() : page.getPageTitle();
}
}
return navigationTitle;
}
示例4: getTitle
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
/**
* Returns the title of the given page. If the title is empty it will fallback to the name of the page.
* @param page The page.
* @return The best suited title found (or <code>null</code> if page is <code>null</code>).
*/
public static String getTitle(final Page page) {
if (page != null) {
final String title = page.getTitle();
if (StringUtils.isBlank(title)) {
return page.getName();
}
return title;
} else {
LOGGER.debug("Provided page argument is null");
return null;
}
}
示例5: getName
import com.day.cq.wcm.api.Page; //导入方法依赖的package包/类
public String getName() {
Page currentPage = WCMUtils.getComponentContext(request).getPage();
return currentPage.getTitle();
}