本文整理汇总了Java中com.liferay.portal.service.ThemeLocalServiceUtil类的典型用法代码示例。如果您正苦于以下问题:Java ThemeLocalServiceUtil类的具体用法?Java ThemeLocalServiceUtil怎么用?Java ThemeLocalServiceUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ThemeLocalServiceUtil类属于com.liferay.portal.service包,在下文中一共展示了ThemeLocalServiceUtil类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: serveResource
import com.liferay.portal.service.ThemeLocalServiceUtil; //导入依赖的package包/类
@Override
public void serveResource(ResourceRequest request, ResourceResponse response)
throws PortletException, IOException {
response.setContentType("text/html");
JSONArray array = JSONFactoryUtil.createJSONArray();
String themeId = request.getParameter(PARAM_SELECTED_THEME_ID);
ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
Theme themeObject = ThemeLocalServiceUtil.fetchTheme(
themeDisplay.getCompanyId(), themeId);
if (Validator.isNotNull(themeObject)) {
Map<String, ColorScheme> colorSchemeMap = themeObject
.getColorSchemesMap();
for (String colorSchemeId : colorSchemeMap.keySet()) {
JSONObject colorScheme = JSONFactoryUtil.createJSONObject();
colorScheme.put("colorSchemeId", colorSchemeId);
colorScheme.put("colorSchemeName",
colorSchemeMap.get(colorSchemeId).getName());
array.put(colorScheme);
}
}
PrintWriter writer = response.getWriter();
writer.write(array.toString());
}
开发者ID:knowarth-technologies,项目名称:theme-personalizer,代码行数:26,代码来源:ThemePersonalizerPortlet.java
示例2: run
import com.liferay.portal.service.ThemeLocalServiceUtil; //导入依赖的package包/类
@Override
public void run(HttpServletRequest request, HttpServletResponse response)
throws ActionException {
ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
try {
Theme theme = ThemeLocalServiceUtil.getTheme(themeDisplay.getCompanyId(), "demotheme_WAR_demotheme", false);
themeDisplay.setLookAndFeel(theme, themeDisplay.getColorScheme());
request.setAttribute(WebKeys.THEME_DISPLAY, themeDisplay);
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:mimacom,项目名称:maven-liferay-plugin,代码行数:19,代码来源:PostRequestAction.java
示例3: getTheme
import com.liferay.portal.service.ThemeLocalServiceUtil; //导入依赖的package包/类
public static Theme getTheme(long companyId, String themeId) {
Theme result = null;
List<Theme> themes = ThemeLocalServiceUtil.getThemes(companyId);
for (Theme thm : themes) {
if (thm.getThemeId().equals(themeId)) {
result = thm;
break;
} else
m_objLog.debug("Found theme: "+thm.getThemeId());
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:15,代码来源:ParticityInitializer.java
示例4: retrieveAvailableThemesMap
import com.liferay.portal.service.ThemeLocalServiceUtil; //导入依赖的package包/类
private Map<String, String> retrieveAvailableThemesMap(long companyId)
throws SystemException {
Map<String, String> availableThemesMap = new HashMap<String, String>();
List<AvailablePersonalizedTheme> availablePersonalizedThemes = AvailablePersonalizedThemeLocalServiceUtil
.findAllByCompanyId(companyId);
for (AvailablePersonalizedTheme availablePersonalizedTheme : availablePersonalizedThemes) {
Theme themeObject = ThemeLocalServiceUtil.fetchTheme(companyId,
availablePersonalizedTheme.getThemeId());
if (Validator.isNotNull(themeObject)) {
availableThemesMap.put(themeObject.getThemeId(),
themeObject.getName());
}
}
return availableThemesMap;
}
开发者ID:knowarth-technologies,项目名称:theme-personalizer,代码行数:16,代码来源:ThemePersonalizerPortlet.java
示例5: setDefaults
import com.liferay.portal.service.ThemeLocalServiceUtil; //导入依赖的package包/类
private void setDefaults(PortletRequest portletRequest, long companyId,
Map<String, String> availableThemes) {
String selectedThemeId = "";
String selectedColorSchemeId = "";
boolean applyForAllPages = false;
if (Validator.isNotNull(availableThemes) && !availableThemes.isEmpty()) {
selectedThemeId = availableThemes.keySet().iterator().next();
Theme themeObject = ThemeLocalServiceUtil.fetchTheme(companyId,
selectedThemeId);
portletRequest.setAttribute(PARAM_AVAILABLE_THEMES,
availableThemes);
if (Validator.isNotNull(themeObject)) {
if (themeObject.getColorSchemesMap().keySet().size() > 0) {
selectedColorSchemeId = themeObject.getColorSchemesMap()
.keySet().iterator().next();
portletRequest.setAttribute(
PARAM_SELECTED_COLOR_SCHEME_ID,
selectedColorSchemeId);
}
portletRequest.setAttribute(PARAM_SELECTED_THEME_ID,
themeObject.getThemeId());
portletRequest.setAttribute(PARAM_APPLY_FOR_ALL_PAGES,
String.valueOf(applyForAllPages));
portletRequest.setAttribute(PARAM_AVAILABLE_COLOR_SCHEMES,
themeObject.getColorSchemesMap());
}
}
}
开发者ID:knowarth-technologies,项目名称:theme-personalizer,代码行数:31,代码来源:ThemePersonalizerPortlet.java
示例6: setPersonalizedThemeParams
import com.liferay.portal.service.ThemeLocalServiceUtil; //导入依赖的package包/类
private void setPersonalizedThemeParams(PortletRequest portletRequest,
long companyId, Map<String, String> availableThemes,
UserPersonalizedTheme userPersonalTheme) {
String selectedThemeId = userPersonalTheme.getThemeId();
String selectedColorSchemeId = userPersonalTheme.getColorSchemeId();
boolean applyForAllPages = userPersonalTheme.getApplyForAllPages();
Theme themeObject = ThemeLocalServiceUtil.fetchTheme(companyId,
selectedThemeId);
portletRequest
.setAttribute(PARAM_AVAILABLE_THEMES, availableThemes);
if (Validator.isNotNull(themeObject)) {
portletRequest.setAttribute(PARAM_SELECTED_THEME_ID,
themeObject.getThemeId());
if (themeObject.getColorSchemesMap().containsKey(
selectedColorSchemeId)) {
portletRequest.setAttribute(
PARAM_SELECTED_COLOR_SCHEME_ID,
selectedColorSchemeId);
}
portletRequest.setAttribute(PARAM_APPLY_FOR_ALL_PAGES,
String.valueOf(applyForAllPages));
portletRequest.setAttribute(PARAM_AVAILABLE_COLOR_SCHEMES,
themeObject.getColorSchemesMap());
}
}
开发者ID:knowarth-technologies,项目名称:theme-personalizer,代码行数:28,代码来源:ThemePersonalizerPortlet.java
示例7: setPersonalizedThemeParams
import com.liferay.portal.service.ThemeLocalServiceUtil; //导入依赖的package包/类
private void setPersonalizedThemeParams(PortletRequest portletRequest,
long companyId, Map<String, String> availableThemes,
UserPersonalizedTheme userPersonalTheme) {
String selectedThemeId = userPersonalTheme.getThemeId();
String selectedColorSchemeId = userPersonalTheme.getColorSchemeId();
boolean applyForAllPages = userPersonalTheme.getApplyForAllPages();
Theme themeObject = ThemeLocalServiceUtil.fetchTheme(companyId,
selectedThemeId);
portletRequest
.setAttribute(PARAM_AVAILABLE_THEMES, availableThemes);
if (Validator.isNotNull(themeObject)) {
portletRequest.setAttribute(PARAM_SELECTED_THEME_ID,
themeObject.getThemeId());
if (themeObject.getColorSchemesMap().containsKey(
selectedColorSchemeId)) {
portletRequest.setAttribute(
PARAM_SELECTED_COLOR_SCHEME_ID,
selectedColorSchemeId);
}
portletRequest.setAttribute(PARAM_APPLY_FOR_ALL_PAGES,
String.valueOf(applyForAllPages));
portletRequest.setAttribute(PARAM_AVAILABLE_COLOR_SCHEMES,
themeObject.getColorSchemesMap());
}
}
开发者ID:knowarth-technologies,项目名称:theme-personalizer,代码行数:28,代码来源:ThemePersonalizerPortlet.java
示例8: run
import com.liferay.portal.service.ThemeLocalServiceUtil; //导入依赖的package包/类
public void run(HttpServletRequest request, HttpServletResponse response)
throws ActionException {
ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
if (themeDisplay.isSignedIn()) {
Layout layout = themeDisplay.getLayout();
try {
boolean wapTheme = BrowserSnifferUtil.isWap(request);
if (layout != null && !layout.isTypeControlPanel() && !wapTheme) {
long userId = themeDisplay.getUserId();
Theme theme = themeDisplay.getTheme();
ColorScheme colorScheme = themeDisplay.getColorScheme();
UserPersonalizedTheme userPersonalTheme;
userPersonalTheme = UserPersonalizedThemeLocalServiceUtil
.findByUserIDAndLayoutId(
themeDisplay.getCompanyId(), userId,
layout.getLayoutId());
if (Validator.isNotNull(userPersonalTheme)) {
theme = ThemeLocalServiceUtil.fetchTheme(
themeDisplay.getCompanyId(),
userPersonalTheme.getThemeId());
if (Validator.isNotNull(theme)) {
colorScheme = ThemeLocalServiceUtil.getColorScheme(
themeDisplay.getCompanyId(),
theme.getThemeId(),
userPersonalTheme.getColorSchemeId(),
wapTheme);
request.setAttribute(WebKeys.THEME, theme);
request.setAttribute("COLOR_SCHEME", colorScheme);
themeDisplay.setLookAndFeel(theme, colorScheme);
}
}
}
} catch (SystemException e) {
_log.error("Error setting personalized theme information", e);
}
}
}
开发者ID:knowarth-technologies,项目名称:theme-personalizer,代码行数:49,代码来源:ThemePersonalizerServicePreAction.java
示例9: switchThemeForRequest
import com.liferay.portal.service.ThemeLocalServiceUtil; //导入依赖的package包/类
private void switchThemeForRequest(String themeId, String colorSchemeId,
ThemeDisplay themeDisplay) throws SystemException {
HttpServletRequest request = themeDisplay.getRequest();
boolean wapTheme = BrowserSnifferUtil.isWap(request);
long companyId = themeDisplay.getCompanyId();
Theme theme = ThemeLocalServiceUtil.getTheme(companyId, themeId, wapTheme);
ColorScheme colorScheme = null;
if(colorSchemeId != null) {
colorScheme = ThemeLocalServiceUtil.getColorScheme(companyId, themeId, colorSchemeId, wapTheme);
} else if(theme.hasColorSchemes()) {
Iterator<ColorScheme> it = theme.getColorSchemes().iterator();
do {
colorScheme = it.next();
} while(!colorScheme.isDefaultCs() && it.hasNext());
}
// Override current theme
request.setAttribute(WebKeys.THEME, theme);
request.setAttribute("COLOR_SCHEME", colorScheme); // Can't use constant located un portal-impl.jar
themeDisplay.setLookAndFeel(theme, colorScheme);
// Add warning message
Locale locale = themeDisplay.getLocale();
String message = LanguageUtil.format(locale, "this-page-is-displayed-with-x-theme-just-for-your-session", theme.getName())
+ " <a id=\"clearThemeSwitchLink\" href=\"#\">"
+ LanguageUtil.get(locale, "display-the-page-with-original-theme") + "</a>";
PortalMessages.add(request, PortalMessages.KEY_ANIMATION, false);
PortalMessages.add(request, PortalMessages.KEY_MESSAGE, message);
PortalMessages.add(request, PortalMessages.KEY_TIMEOUT, -1);
PortalMessages.add(request, PortalMessages.KEY_CSS_CLASS, "alert-warn");
// Inject Javascript into page bottom
String javascriptSrc = themeDisplay.getPortalURL() + _JAVASCRIPT_PATH + "?t=" + _getJavascriptTimestamp(request);
StringBundler sb = new StringBundler();
sb.append("<script src=\"" + javascriptSrc + "\" type=\"text/javascript\"></script>");
OutputData outputData = _getOutputData(request);
String outputKey = this.getClass().getName();
outputData.addData(outputKey, WebKeys.PAGE_BODY_BOTTOM, sb);
}
开发者ID:slemarchand,项目名称:page-composer-hook,代码行数:56,代码来源:ThemeSwitchServicePreAction.java
注:本文中的com.liferay.portal.service.ThemeLocalServiceUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论