本文整理汇总了Java中com.liferay.portal.kernel.model.Layout类的典型用法代码示例。如果您正苦于以下问题:Java Layout类的具体用法?Java Layout怎么用?Java Layout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Layout类属于com.liferay.portal.kernel.model包,在下文中一共展示了Layout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSaveAndContinueRedirect
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
protected String getSaveAndContinueRedirect(
ActionRequest actionRequest, TaskRecord taskRecord, Layout layout, String redirect)
throws Exception {
PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(
JavaConstants.JAVAX_PORTLET_CONFIG);
LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletConfig.getPortletName(), layout, PortletRequest.RENDER_PHASE);
portletURL.setParameter("mvcRenderCommandName", "editTaskRecord");
portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
portletURL.setParameter("redirect", redirect, false);
portletURL.setParameter(
"groupId", String.valueOf(taskRecord.getGroupId()), false);
portletURL.setParameter(
"taskRecordId", String.valueOf(taskRecord.getTaskRecordId()), false);
portletURL.setWindowState(actionRequest.getWindowState());
return portletURL.toString();
}
示例2: run
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
@Override
public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
Layout currentLayout = themeDisplay.getLayout();
List<Layout> searchLayouts = this.getSearchLayouts(currentLayout);
Map<Layout, List<SearchUrl>> searchUrls;
searchUrls = searchLayouts.stream()
.collect(Collectors.toMap(
Function.identity(),
layout -> generateSearchUrl(request, themeDisplay, layout)
));
request.setAttribute(REQUEST_ATTR_FLASHLIGHT_URLS, new SearchUrlContainer(searchUrls));
}
示例3: getSearchLayouts
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
/**
* Returns a list of layouts that contains the search portlet. Only layouts with the same private/public status and
* groupId as the given layout are searched for.
*
* @param currentLayout The layout from which to start the search.
* @return The list of layouts that contains the search portlet
*/
private List<Layout> getSearchLayouts(Layout currentLayout) {
long groupId = currentLayout.getGroupId();
boolean privateLayout = currentLayout.isPrivateLayout();
List<Layout> siteLayouts = this.layoutService.getLayouts(groupId, privateLayout, LayoutConstants.TYPE_PORTLET);
List<Layout> searchLayouts = new ArrayList<>();
for(Layout layout : siteLayouts) {
// We can safely type cast because we specify the layout type in the query above
LayoutTypePortlet layoutType = (LayoutTypePortlet) layout.getLayoutType();
if(layoutType.hasPortletId(FlashlightSearchPortletKeys.PORTLET_NAME)) {
searchLayouts.add(layout);
}
}
return searchLayouts;
}
示例4: getSaveAndContinueRedirect
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
protected String getSaveAndContinueRedirect(
ActionRequest actionRequest, Contact contact, Layout layout, String redirect)
throws Exception {
_log.info("getSaveAndContinueRedirect()");
PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(
JavaConstants.JAVAX_PORTLET_CONFIG);
LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletConfig.getPortletName(), layout, PortletRequest.RENDER_PHASE);
portletURL.setParameter("mvcRenderCommandName", "editContact");
portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
portletURL.setParameter("redirect", redirect, false);
portletURL.setParameter(
"groupId", String.valueOf(contact.getGroupId()), false);
portletURL.setParameter(
"contactId", String.valueOf(contact.getContactId()), false);
portletURL.setWindowState(actionRequest.getWindowState());
return portletURL.toString();
}
示例5: findDefaultAssetPublisherInstanceId
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
/**
* Try to find an asset publisher instance id on a layout
*
* @param layout
* @return portlet instance id
* @throws PortalException
* @throws SystemException
*/
public static String findDefaultAssetPublisherInstanceId(Layout layout)
throws PortalException, SystemException {
LayoutTypePortlet layoutType =
(LayoutTypePortlet) layout.getLayoutType();
List<Portlet> portlets = layoutType.getAllPortlets();
for (Portlet p : portlets) {
if (AssetPublisherPortletKeys.ASSET_PUBLISHER.equals(
p.getRootPortletId())) {
return p.getInstanceId();
}
}
throw new PortalException(
"Couldn't find asset publisher on page " + layout.getFriendlyURL() +
". Please check configuration.");
}
示例6: getLayoutByFriendlyURL
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
/**
* Get layout by friendlyurl.
*
* @param resourceRequest
* @return layout
* @throws PortalException if layout is not found
*/
public static Layout getLayoutByFriendlyURL(
PortletRequest portletRequest, String layoutFriendlyURL)
throws PortalException {
ThemeDisplay themeDisplay =
(ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
if (layoutFriendlyURL != null) {
return LayoutLocalServiceUtil.getFriendlyURLLayout(
themeDisplay.getScopeGroupId(),
themeDisplay.getLayout().isPrivateLayout(), layoutFriendlyURL);
}
throw new PortalException(
"Couldn't find asset publisher layout for " + layoutFriendlyURL +
". Please check configuration.");
}
示例7: getPortletDataContext
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
protected PortletDataContext getPortletDataContext(ExportImportConfiguration exportImportConfiguration)
throws PortalException {
Map<String, Serializable> settingsMap = exportImportConfiguration.getSettingsMap();
// String fileName = MapUtil.getString(settingsMap, "fileName");
long sourcePlid = MapUtil.getLong(settingsMap, "sourcePlid");
long sourceGroupId = MapUtil.getLong(settingsMap, "sourceGroupId");
String portletId = MapUtil.getString(settingsMap, "portletId");
Map<String, String[]> parameterMap = (Map<String, String[]>) settingsMap.get("parameterMap");
DateRange dateRange = ExportImportDateUtil.getDateRange(exportImportConfiguration);
Layout layout = _layoutLocalService.getLayout(sourcePlid);
ZipWriter zipWriter = ExportImportHelperUtil.getPortletZipWriter(portletId);
PortletDataContext portletDataContext = PortletDataContextFactoryUtil.createExportPortletDataContext(
layout.getCompanyId(), sourceGroupId, parameterMap, dateRange.getStartDate(), dateRange.getEndDate(),
zipWriter);
portletDataContext.setOldPlid(sourcePlid);
portletDataContext.setPlid(sourcePlid);
portletDataContext.setPortletId(portletId);
return portletDataContext;
}
示例8: getSaveAndContinueRedirect
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
protected String getSaveAndContinueRedirect(
ActionRequest actionRequest, Measurement measurement, Layout layout, String redirect)
throws Exception {
PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(
JavaConstants.JAVAX_PORTLET_CONFIG);
LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletConfig.getPortletName(), layout, PortletRequest.RENDER_PHASE);
portletURL.setParameter("mvcRenderCommandName", "editMeasurement");
portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
portletURL.setParameter("redirect", redirect, false);
portletURL.setParameter(
"groupId", String.valueOf(measurement.getGroupId()), false);
portletURL.setParameter(
"measurementId", String.valueOf(measurement.getMeasurementId()), false);
portletURL.setWindowState(actionRequest.getWindowState());
return portletURL.toString();
}
示例9: removePortletAction
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
/**
* Remove portlet from the page
*
* @param request The request
* @param response The response
*/
@ProcessAction(name = "removePortlet")
public void removePortletAction(ActionRequest request, ActionResponse response) throws IOException {
Layout currentLayout = (Layout) request.getAttribute(WebKeys.LAYOUT);
String portletId = ParamUtil.getString(request, RQ_PARAM_PORTLET_ID, null);
if(portletId != null) {
Matcher m = PATTERN_PORTLET_ID.matcher(portletId);
if(m.matches()) {
try {
this.serviceRef.removePortlet(currentLayout, portletId);
} catch(PortalException e) {
LOG.error("Unable to remove portlet", e);
}
}
}
}
示例10: removePortlet
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
@Override
public boolean removePortlet(Layout layout, String portletRemoveId) throws PortalException {
boolean removed = false;
List<Portlet> portlets = this.getPortlets(layout);
for(Portlet p : portlets) {
LayoutTypePortlet layoutType = (LayoutTypePortlet) layout.getLayoutType();
String portletId = p.getPortletId();
Company company = this.companyService.getCompanyById(layout.getCompanyId());
User defaultUser = company.getDefaultUser();
if(portletId != null && portletId.equals(portletRemoveId)) {
layoutType.removePortletId(defaultUser.getUserId(), portletId);
this.layoutService.updateLayout(
layout.getGroupId(),
layout.isPrivateLayout(),
layout.getLayoutId(),
layout.getTypeSettings()
);
removed = true;
break;
}
}
return removed;
}
示例11: addEntry
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
@Override
public Object addEntry(RequestContext requestContext) throws Exception {
Layout layout = (Layout)super.addEntry(requestContext);
String layoutPrototypeId = (String) requestContext.get(
LAYOUT_TEMPLATE_SELECT_LIST);
if ((layoutPrototypeId != null) && (!layoutPrototypeId.equals(""))) {
LayoutPrototype layoutPrototype =
LayoutPrototypeLocalServiceUtil.getLayoutPrototype(
Long.valueOf(layoutPrototypeId));
if (layoutPrototype != null) {
layout.setLayoutPrototypeUuid(layoutPrototype.getUuid());
layout.setLayoutPrototypeLinkEnabled(true);
layout = LayoutLocalServiceUtil.updateLayout(layout);
}
}
return layout;
}
示例12: _getLayoutNameIdPairs
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
private List<KeyValuePair> _getLayoutNameIdPairs(
long groupId, boolean privateLayout) throws SystemException {
List<KeyValuePair> layoutNameIdPairs = new ArrayList<KeyValuePair>();
List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(
groupId, privateLayout);
for (Layout layout : layouts) {
if (layout.isHidden() || !layout.isRootLayout() ||
layout.isTypeControlPanel()|| layout.isTypeControlPanel() ||
layout.isTypeURL()) {
continue;
}
String layoutId = String.valueOf(layout.getLayoutId());
String layoutName = layout.getNameCurrentValue(); //getName();
layoutNameIdPairs.add(
new KeyValuePair(layoutName, layoutId));
}
return layoutNameIdPairs;
}
示例13: destroy
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
@Override
public void destroy() {
if (_layouts != null) {
for (Layout layout : _layouts) {
try {
_layoutLocalService.deleteLayout(
layout.getPlid(), new ServiceContext());
}
catch (PortalException pe) {
_logger.log(
Level.WARNING,
"Error trying to delete layout " + layout.getPlid(),
pe);
}
}
}
}
示例14: destroy
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
@Override
public void destroy() {
if (_layouts != null) {
for (Layout layout : _layouts) {
try {
_layoutLocalService.deleteLayout(
layout.getPlid(), new ServiceContext());
}
catch (PortalException e) {
_logger.log(
Level.WARNING,
"Error trying to delete layout " + layout.getPlid(), e);
}
}
}
}
示例15: run
import com.liferay.portal.kernel.model.Layout; //导入依赖的package包/类
@Override
public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException {
try {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
final long scopeGroupId = themeDisplay.getScopeGroupId();
long companyId = themeDisplay.getCompanyId();
Layout layout = themeDisplay.getLayout();
List<Layout> layouts = getLayouts(scopeGroupId, layout.isPublicLayout(), companyId);
if(! layouts.isEmpty()) {
themeDisplay.setLayouts(layouts);
}
} catch (SystemException e1) {
e1.printStackTrace();
} catch (Exception ignore) {
ignore.printStackTrace();
}
}