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


Java Layout类代码示例

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


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

示例1: init

import com.liferay.portal.model.Layout; //导入依赖的package包/类
public static void init() {
	if (!isWizardAvailable()) {
		m_objLog.warn("Setup wizard was already initialized before. Delete portlet painit to remove this message for future server restarts.");
		return;
	}
	
	try {
		// init static globals
		if (globalCompanyId == -1)
			initGlobals();

		// add setup
		Layout layout = initLayout(globalCompanyId, globalAdminId, globalGroupId, E_ContextPath.HOME);
		
		if (layout != null) {
			String portletId = addPortletToPage(layout, "painit_WAR_painitportlet", E_ContextPath.HOME, globalAdminId);			
			m_objLog.debug("Created welcome with portlet id "+portletId);
		} else {
			m_objLog.debug("No home found under "+E_ContextPath.HOME.getPath());
		}
		
	} catch (Throwable t) {
		m_objLog.error(t);
	}
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:26,代码来源:ParticityInitializer.java

示例2: clearLayouts

import com.liferay.portal.model.Layout; //导入依赖的package包/类
public static Map<E_ContextPath, Layout> clearLayouts(long groupId, long adminId, long companyId, Map<E_ContextPath, String> pathMap) {
	Map<E_ContextPath, Layout> result = new HashMap<E_ContextPath, Layout>();
	
	for (E_ContextPath pth: E_ContextPath.values()) {
		String actualPath = pathMap.get(pth);
		if (actualPath == null)
			actualPath = pth.getPath();
		Layout layout = getLayout(groupId, actualPath);
		// if no layout at new path, try the original path setting
		if (layout == null && !pth.getPath().equals(actualPath))
			layout = getLayout(groupId, pth.getPath());
		if (layout == null) {
			layout = createLayout(adminId, companyId, groupId, pth, actualPath);
			m_objLog.debug("Created layout for URL "+actualPath);
		} else {
			m_objLog.debug("Found layout for URL "+actualPath);
			clearPage(layout, pth, actualPath);
		}
		result.put(pth, layout);
	}
	return result;
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:23,代码来源:ParticityInitializer.java

示例3: addPortletToPage

import com.liferay.portal.model.Layout; //导入依赖的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

示例4: setPortletArticle

import com.liferay.portal.model.Layout; //导入依赖的package包/类
public static void setPortletArticle(String portletId, String articleId, Layout layout, long userId, long groupId, long companyId) {
	try {

		long ownerId = PortletKeys.PREFS_OWNER_ID_DEFAULT;
		int ownerType = PortletKeys.PREFS_OWNER_TYPE_LAYOUT;

		//Retrieve the portlet preferences for the journal portlet instance just created
		PortletPreferences prefs = PortletPreferencesLocalServiceUtil.getPreferences(companyId,
                ownerId,
                ownerType,
                layout.getPlid(),
				portletId);

		// set desired article id for content display portlet
		prefs.setValue("articleId", articleId);
		prefs.setValue("groupId", String.valueOf(groupId));

		//update the portlet preferences
		PortletPreferencesLocalServiceUtil.updatePreferences(ownerId, ownerType, layout
		                .getPlid(), portletId, prefs);
	} catch (Throwable t) {
		m_objLog.warn(t);
	}
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:25,代码来源:ParticityInitializer.java

示例5: makeElementoComunidade

import com.liferay.portal.model.Layout; //导入依赖的package包/类
private ElementoComunidade makeElementoComunidade(Group grp,
		ThemeDisplay td)
		throws SystemException, PortalException {
	long plid;
	long grpId = grp.getGroupId();
	if (grp.getPrivateLayoutsPageCount() > 0)
		plid = LayoutLocalServiceUtil.getDefaultPlid(grpId, true);
	else
		plid = LayoutLocalServiceUtil.getDefaultPlid(grpId, false);
	Layout layout = LayoutLocalServiceUtil.getLayout(plid);
	
	String grpUrl = PortalUtil.getLayoutURL(layout, td, true);
	String grpName = grp.getName();
	String grpImgUrl = CommunityIconFinder.findUrl(td, grpId);
	return new ElementoComunidade(grpUrl, grpName, grpImgUrl);

}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:18,代码来源:ListaComunidadesPortlet.java

示例6: getGruposFilhos

import com.liferay.portal.model.Layout; //导入依赖的package包/类
/**
 * @param group
 * 
 * @return
 * @throws SystemException
 */
private List<Long> getGruposFilhos(Group group) throws SystemException {
	List<Long> grupos = new ArrayList<Long>();

	long layoutClassNameId = ClassNameLocalServiceUtil
			.getClassNameId(Layout.class);
	DynamicQuery query = DynamicQueryFactoryUtil.forClass(Group.class);
	query.add(RestrictionsFactoryUtil.eq("companyId", group.getCompanyId()));
	query.add(RestrictionsFactoryUtil.eq("classNameId", layoutClassNameId));
	query.add(RestrictionsFactoryUtil.eq("parentGroupId",
			group.getGroupId()));
	query.add(RestrictionsFactoryUtil.eq("active", true));
	@SuppressWarnings("unchecked")
	List<Group> filhos = GroupLocalServiceUtil.dynamicQuery(query);
	for (Group filho : filhos)
		grupos.add(filho.getGroupId());
	return grupos;
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:24,代码来源:ContadorAcessoLocalServiceImpl.java

示例7: addLayoutColumn

import com.liferay.portal.model.Layout; //导入依赖的package包/类
protected void addLayoutColumn(
		Layout layout, String columnId, JSONArray columnJSONArray)
	throws Exception {

	if (columnJSONArray == null) {
		return;
	}

	for (int i = 0; i < columnJSONArray.length(); i++) {
		JSONObject portletJSONObject = columnJSONArray.getJSONObject(i);

		if (portletJSONObject == null) {
			String journalArticleId = getJournalId(
				columnJSONArray.getString(i));

			portletJSONObject = getDefaultPortletJSONObject(
				journalArticleId);
		}

		addLayoutColumnPortlet(layout, columnId, portletJSONObject);
	}
}
 
开发者ID:rivetlogic,项目名称:liferay-evernote,代码行数:23,代码来源:FileSystemImporter.java

示例8: getAncestors

import com.liferay.portal.model.Layout; //导入依赖的package包/类
@Override
public List<Layout> getAncestors() throws PortalException, SystemException {

    HttpServletRequest request = ServiceContextThreadLocal.getServiceContext().getRequest();
    // alle übergeordneten Seiten einschließlich der aktuellen Seite holen
    List<Layout> junctionedAncestors = JunctionPointUtil.getJunctionedAncestors(getWrappedModel(), request);
    // Eine neue Menge aufbauen ohne die aktuelle Seite sowie die per Junction Point verknüpften Seiten
    List<Layout> layouts = new ArrayList<Layout>();
    for (int i = 1; i < junctionedAncestors.size(); i++) {
        Layout layout = junctionedAncestors.get(i);
        if (JunctionPointUtil.getConfiguredJunctionPointLayout(layout) != null) {
            continue;
        }

        layouts.add(layout);
    }

    wrapLayouts(layouts);

    return layouts;
}
 
开发者ID:frickeo,项目名称:liferay-junction-point-hook,代码行数:22,代码来源:JunctionPointLayoutWrapper.java

示例9: getChildren

import com.liferay.portal.model.Layout; //导入依赖的package包/类
@Override
public List<Layout> getChildren(PermissionChecker permissionChecker) throws SystemException, PortalException {

    HttpServletRequest request = ServiceContextThreadLocal.getServiceContext().getRequest();
    List<Layout> children;

    Layout junctionTarget = JunctionPointUtil.getJunctionTarget(this, request, false);
    if (junctionTarget == this) {
        children = super.getChildren(permissionChecker);
    } else {
        children = junctionTarget.getChildren(permissionChecker);
    }

    wrapLayouts(children);

    return children;
}
 
开发者ID:frickeo,项目名称:liferay-junction-point-hook,代码行数:18,代码来源:JunctionPointLayoutWrapper.java

示例10: getParentLayoutId

import com.liferay.portal.model.Layout; //导入依赖的package包/类
@Override
public long getParentLayoutId() {

    long parentLayoutId = super.getParentLayoutId();
    if (parentLayoutId == LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) {
        Layout junctionPointLayout = JunctionPointUtil.getConfiguredJunctionPointLayout(getWrappedModel());
        if (junctionPointLayout != null && junctionPointLayout.getParentLayoutId() != LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) {
        	// HACK! Das Breadcrumb-Portlet fragt erst die ParentLayoutId ab und ruft danach getParentLayout, falls die ID != 0 ist.
        	// andere Klassen machen dies aber leider ganz anders.
        	StackTraceElement stackTraceElement = new Exception().getStackTrace()[1];
        	if ("com.liferay.taglib.ui.BreadcrumbTag".equals(stackTraceElement.getClassName())) {
        		return -1;
        	}
        }
    }

    return parentLayoutId;
}
 
开发者ID:frickeo,项目名称:liferay-junction-point-hook,代码行数:19,代码来源:JunctionPointLayoutWrapper.java

示例11: getUsableJunctionPoints

import com.liferay.portal.model.Layout; //导入依赖的package包/类
@Override
public List<Layout> getUsableJunctionPoints(Layout layout) throws SystemException, PortalException {
    long companyId = CompanyThreadLocal.getCompanyId();
    long classNameId = ClassNameLocalServiceUtil.getClassNameId(Layout.class);
    // Ermittle die Menge aller erlaubten GroupIds
    Set<Long> usableGroupIds = getHierarchicalGroupIds(layout);

    List<Layout> layouts = new ArrayList<Layout>();
    List<ExpandoValue> values = ExpandoValueLocalServiceUtil.getColumnValues(companyId, classNameId,
            ExpandoTableConstants.DEFAULT_TABLE_NAME, JUNCTION_POINT_LAYOUT, Boolean.TRUE.toString(), -1, -1);
    for (ExpandoValue expandoValue : values) {
        long classPK = expandoValue.getClassPK();
        Layout jpLayout = LayoutLocalServiceUtil.fetchLayout(classPK);
        if (jpLayout != null && usableGroupIds.contains(jpLayout.getGroupId())) {
            layouts.add(jpLayout);
        }
    }

    sortLayouts(layouts);
    return layouts;
}
 
开发者ID:frickeo,项目名称:liferay-junction-point-hook,代码行数:22,代码来源:JunctionPointImpl.java

示例12: getHierarchicalGroupIds

import com.liferay.portal.model.Layout; //导入依赖的package包/类
/**
 * Ermittelt eine Menge mit den GroupIds der Layout-Site sowie aller übnergeordneter Sites.
 * 
 * @param layout Das Einstiegslayout
 * @return Eine Menge von GroupIds
 * @throws SystemException
 */
protected Set<Long> getHierarchicalGroupIds(Layout layout) throws SystemException {
    // Ermittle die Menge aller erlaubten GroupIds
    Set<Long> usableGroupIds;
    try {
        Group group = layout.getGroup();
        usableGroupIds = new HashSet<Long>();
        while (group != null) {
            usableGroupIds.add(group.getGroupId());
            group = group.getParentGroup();
        }
    }
    catch (PortalException e) {
        // Behandlung einer PortalException
        throw new RuntimeException(e);
    }
    return usableGroupIds;
}
 
开发者ID:frickeo,项目名称:liferay-junction-point-hook,代码行数:25,代码来源:JunctionPointImpl.java

示例13: getAllowedConnectedLayouts

import com.liferay.portal.model.Layout; //导入依赖的package包/类
protected List<Layout> getAllowedConnectedLayouts(Layout layout) throws SystemException {
    // Ermittle alle verbundenen JunctionPoints
    List<Layout> layouts = getConnectedLayouts(layout);

    // nicht erlaubte Layouts entfernen
    Iterator<Layout> layoutIterator = layouts.iterator();
    while (layoutIterator.hasNext()) {
        Layout connectedLayout = layoutIterator.next();
        // Ermittle die Menge aller erlaubten GroupIds
        Set<Long> usableGroupIds = getHierarchicalGroupIds(connectedLayout);
        if (!usableGroupIds.contains(layout.getGroupId())) {
            layoutIterator.remove();
        }
    }

    return layouts;
}
 
开发者ID:frickeo,项目名称:liferay-junction-point-hook,代码行数:18,代码来源:JunctionPointImpl.java

示例14: setupPage

import com.liferay.portal.model.Layout; //导入依赖的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 + "]");
}
 
开发者ID:ngriffin7a,项目名称:portletbox,代码行数:25,代码来源:TestSetupAction.java

示例15: getPortalPageLayout

import com.liferay.portal.model.Layout; //导入依赖的package包/类
protected Layout getPortalPageLayout(long userId, long groupId, String portalPageName, boolean privateLayout)
	throws Exception {
	Layout portalPageLayout = null;

	List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(groupId, privateLayout);

	for (Layout layout : layouts) {

		if (layout.getName(Locale.US).equals(portalPageName)) {
			portalPageLayout = layout;
		}
	}

	if (portalPageLayout == null) {
		long parentLayoutId = LayoutConstants.DEFAULT_PARENT_LAYOUT_ID;
		String type = LayoutConstants.TYPE_PORTLET;
		boolean hidden = false;
		String friendlyURL = "/" + portalPageName.toLowerCase();
		portalPageLayout = ServiceUtil.addLayout(userId, groupId, privateLayout, parentLayoutId, portalPageName,
				portalPageName, portalPageName, type, hidden, friendlyURL);
	}

	return portalPageLayout;
}
 
开发者ID:ngriffin7a,项目名称:portletbox,代码行数:25,代码来源:TestSetupAction.java


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