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


Java Layout类代码示例

本文整理汇总了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();
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:22,代码来源:EditTaskRecordMVCActionCommand.java

示例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));
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:18,代码来源:SearchUrlAction.java

示例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;
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:24,代码来源:SearchUrlAction.java

示例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();
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:24,代码来源:EditContactMVCActionCommand.java

示例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.");
}
 
开发者ID:peerkar,项目名称:liferay-gsearch,代码行数:28,代码来源:GSearchUtil.java

示例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.");
}
 
开发者ID:peerkar,项目名称:liferay-gsearch,代码行数:25,代码来源:GSearchUtil.java

示例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;
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:27,代码来源:MeasurementExportController.java

示例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();
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:22,代码来源:EditMeasurementMVCActionCommand.java

示例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);
            }
        }
    }

}
 
开发者ID:njuneau,项目名称:lr7-test-project,代码行数:25,代码来源:PortletRemover.java

示例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;
}
 
开发者ID:njuneau,项目名称:lr7-test-project,代码行数:24,代码来源:PortletRemoverServiceImpl.java

示例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;
}
 
开发者ID:sorin-pop,项目名称:data-manipulator,代码行数:23,代码来源:LayoutHandler.java

示例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;
}
 
开发者ID:sorin-pop,项目名称:data-manipulator,代码行数:26,代码来源:LayoutHandler.java

示例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);
			}
		}
	}
}
 
开发者ID:liferay-labs,项目名称:arquillian-liferay,代码行数:18,代码来源:PortalURLServlet.java

示例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);
			}
		}
	}
}
 
开发者ID:arquillian,项目名称:arquillian-extension-liferay,代码行数:17,代码来源:PortalURLServlet.java

示例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();
	}		
}
 
开发者ID:olafk,项目名称:liferay-custom-navigation,代码行数:18,代码来源:CustomNavigationPreAction.java


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