本文整理汇总了Java中com.liferay.portal.model.LayoutTypePortlet.setLayoutTemplateId方法的典型用法代码示例。如果您正苦于以下问题:Java LayoutTypePortlet.setLayoutTemplateId方法的具体用法?Java LayoutTypePortlet.setLayoutTemplateId怎么用?Java LayoutTypePortlet.setLayoutTemplateId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.model.LayoutTypePortlet
的用法示例。
在下文中一共展示了LayoutTypePortlet.setLayoutTemplateId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupPage
import com.liferay.portal.model.LayoutTypePortlet; //导入方法依赖的package包/类
protected void setupPage(long userId, long groupId, PortalPage portalPage, boolean privateLayout) throws Exception {
String portalPageName = portalPage.getName();
String[] portletIds = portalPage.getPortletIds();
Layout portalPageLayout = getPortalPageLayout(userId, groupId, portalPageName, privateLayout);
LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) portalPageLayout.getLayoutType();
layoutTypePortlet.setLayoutTemplateId(userId, "2_columns_i", false);
int columnNumber = 1;
for (String portletId : portletIds) {
if (portletId.endsWith("_INSTANCE_")) {
portletId = portletId + "ABCD";
}
addPortlet(layoutTypePortlet, userId, columnNumber, portletId);
columnNumber++;
}
LayoutLocalServiceUtil.updateLayout(portalPageLayout);
logger.info("Setting up page name=[" + portalPageName + "]");
}
示例2: initLayout
import com.liferay.portal.model.LayoutTypePortlet; //导入方法依赖的package包/类
public static Layout initLayout(long companyId, long adminId, long groupId, E_ContextPath path) {
Layout site = getLayout(groupId, path.getPath());
try {
if (site == null) {
site = createLayout(adminId, companyId, groupId, path, null);
} else {
// clear portlets
clearPage(site, path, null);
}
Theme theme = getTheme(companyId, path.getThemeId());
if (theme != null) {
site.setThemeId(path.getThemeId());
site = LayoutLocalServiceUtil.updateLookAndFeel(site.getGroupId(),
false, site.getLayoutId(), path.getThemeId(), "01", "", false);
} else
m_objLog.warn("Did not find theme "+path.getThemeId()+"!");
LayoutTemplate template = getLayoutTemplate(path.getTemplateId());
LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) site.getLayoutType();
if (template != null) {
layoutTypePortlet.setLayoutTemplateId(0, path.getTemplateId(), false);
} else
m_objLog.warn("Did not find layout template "+path.getTemplateId()+"!");
updatePermissions(site, path);
} catch (Throwable t) {
m_objLog.error(t);
}
return site;
}
示例3: createLayout
import com.liferay.portal.model.LayoutTypePortlet; //导入方法依赖的package包/类
public static Layout createLayout(long adminId, long companyId, long groupId, E_ContextPath path, String actualPath) {
Layout result = null;
boolean privateLayout = false;
String description = null;
String type = path.getType();
long parentLayoutId = path.isHidden() ? homeLayoutId : LayoutConstants.DEFAULT_PARENT_LAYOUT_ID;
ServiceContext ctx = new ServiceContext();
if (actualPath == null)
actualPath = path.getPath();
try {
result = LayoutLocalServiceUtil.addLayout(adminId, groupId,
privateLayout, parentLayoutId, path.getName(), path.getTitle(), description,
type, path.isHidden(), actualPath, ctx);
// layout.setLayoutPrototypeLinkEnabled(false);
if (!type.equals(LayoutConstants.TYPE_URL)) {
Theme theme = getTheme(companyId, path.getThemeId());
if (theme != null) {
result.setThemeId(path.getThemeId());
result = LayoutLocalServiceUtil.updateLookAndFeel(groupId,
false, result.getLayoutId(), path.getThemeId(), "01", "", false);
} else
m_objLog.warn("Did not find theme: " + path.getThemeId() + " for url "
+ path.getPath());
LayoutTemplate template = getLayoutTemplate(path.getTemplateId());
LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) result
.getLayoutType();
if (template != null) {
layoutTypePortlet.setLayoutTemplateId(0, path.getTemplateId(), false);
m_objLog.debug("Set layout template: "
+ template.getLayoutTemplateId() + " for url "
+ path.getPath());
} else
m_objLog.warn("Did not find layout template: " + path.getTemplateId()
+ " for url " + path.getPath());
} else {
// set the value of the "link to page"
UnicodeProperties props = result.getTypeSettingsProperties();
props.put( "url", path.getTitle() );
result.setTypeSettingsProperties( props );
LayoutLocalServiceUtil.updateLayout( result ); //
}
m_objLog.debug("Added layout for url " + actualPath + ", group: "
+ groupId + ", company: " + companyId + ", user: "
+ adminId);
updatePermissions(result, path);
} catch (Throwable t) {
m_objLog.error(t);
}
return result;
}