当前位置: 首页>>代码示例>>Java>>正文


Java LayoutTypePortlet.addPortletId方法代码示例

本文整理汇总了Java中com.liferay.portal.model.LayoutTypePortlet.addPortletId方法的典型用法代码示例。如果您正苦于以下问题:Java LayoutTypePortlet.addPortletId方法的具体用法?Java LayoutTypePortlet.addPortletId怎么用?Java LayoutTypePortlet.addPortletId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.model.LayoutTypePortlet的用法示例。


在下文中一共展示了LayoutTypePortlet.addPortletId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addPortletToPage

import com.liferay.portal.model.LayoutTypePortlet; //导入方法依赖的package包/类
public static String addPortletToPage(Layout layout, String portletId, E_ContextPath path, long userId) {
	String result = null;
	try {
		LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout.getLayoutType();
		
		// count all portlets currently registered for this column
		List<Portlet> portlets = layoutTypePortlet.getAllPortlets(path.getColumnId());
		int colSize = portlets != null ? portlets.size() : 0;
		// add new portlet at the very end
		result = layoutTypePortlet.addPortletId(userId, portletId, path.getColumnId(), colSize, false);
		
		// update the layout
		LayoutLocalServiceUtil.updateLayout(layout.getGroupId(),
                   layout.isPrivateLayout(),
                   layout.getLayoutId(),
                   layout.getTypeSettings());
		
	} catch (Throwable t) {
		m_objLog.warn(t);
	}
	return result;
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:23,代码来源:ParticityInitializer.java

示例2: addLayoutColumnPortlet

import com.liferay.portal.model.LayoutTypePortlet; //导入方法依赖的package包/类
protected void addLayoutColumnPortlet(
		Layout layout, String columnId, JSONObject portletJSONObject)
	throws Exception {

	LayoutTypePortlet layoutTypePortlet =
		(LayoutTypePortlet)layout.getLayoutType();

	String rootPortletId = portletJSONObject.getString("portletId");

	if (Validator.isNull(rootPortletId)) {
		throw new ImporterException("portletId is not specified");
	}

	String portletId = layoutTypePortlet.addPortletId(
		userId, rootPortletId, columnId, -1, false);

	JSONObject portletPreferencesJSONObject =
		portletJSONObject.getJSONObject("portletPreferences");

	if ((portletPreferencesJSONObject == null) ||
		(portletPreferencesJSONObject.length() == 0)) {

		return;
	}

	PortletPreferences portletSetup =
		PortletPreferencesFactoryUtil.getLayoutPortletSetup(
			layout, portletId);

	Iterator<String> iterator = portletPreferencesJSONObject.keys();

	while (iterator.hasNext()) {
		String key = iterator.next();

		String value = portletPreferencesJSONObject.getString(key);

		if (rootPortletId.equals(PortletKeys.JOURNAL_CONTENT) &&
			key.equals("articleId")) {

			value = getJournalId(value);
		}

		portletSetup.setValue(key, value);
	}

	portletSetup.store();

	if (rootPortletId.equals(PortletKeys.NESTED_PORTLETS)) {
		JSONArray columnsJSONArray =
			portletPreferencesJSONObject.getJSONArray("columns");

		StringBundler sb = new StringBundler(4);

		sb.append(StringPool.UNDERLINE);
		sb.append(portletId);
		sb.append(StringPool.DOUBLE_UNDERLINE);
		sb.append(LayoutTypePortletConstants.COLUMN_PREFIX);

		addLayoutColumns(layout, sb.toString(), columnsJSONArray);
	}
}
 
开发者ID:rivetlogic,项目名称:liferay-evernote,代码行数:62,代码来源:FileSystemImporter.java


注:本文中的com.liferay.portal.model.LayoutTypePortlet.addPortletId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。