/** * Used by the render method to get the title. * <p> * The default implementation gets the title from the ResourceBundle of the * PortletConfig of the portlet. The title is retrieved using the * 'javax.portlet.title' resource name. * <p> * Portlets can overwrite this method to provide dynamic titles (e.g. based * on locale, client, and session information). Examples are: * <UL> * <LI>language-dependent titles for multi-lingual portals</li> * <LI>shorter titles for WAP phones</li> * <LI>the number of messages in a mailbox portlet</li> * </UL> * * @return the portlet title for this window * @throws java.lang.IllegalStateException * if no portlet config object is available */ protected java.lang.String getTitle(RenderRequest request) { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getResourceBundle(request.getLocale()).getString("javax.portlet.title"); }
public java.util.Locale getLocale() { return _req.getLocale(); }
/** * Used by the render method to get the title. * <p> * The default implementation gets the title from the ResourceBundle of the * PortletConfig of the portlet. The title is retrieved using the * 'javax.portlet.title' resource name. * <p> * Portlets can overwrite this method to provide dynamic titles (e.g. based * on locale, client, and session information). Examples are: * <UL> * <LI>language-dependent titles for multi-lingual portals</li> * <LI>shorter titles for WAP phones</li> * <LI>the number of messages in a mailbox portlet</li> * </UL> * * @return the portlet title for this window * @throws java.lang.IllegalStateException * if no portlet config object is available */ protected java.lang.String getTitle(RenderRequest request) { if (config == null) throw new java.lang.IllegalStateException( "Config is null, please ensure that your init(config) method calls super.init(config)"); return config.getResourceBundle(request.getLocale()).getString("javax.portlet.title"); }
/** * Used by the render method to get the title. * <p> * The default implementation gets the title from the ResourceBundle * of the PortletConfig of the portlet. The title is retrieved * using the 'javax.portlet.title' resource name. * <p> * Portlets can overwrite this method to provide dynamic * titles (e.g. based on locale, client, and session information). * Examples are: * <UL> * <LI>language-dependant titles for multi-lingual portals * <LI>shorter titles for WAP phones * <LI>the number of messages in a mailbox portlet * </UL> * * @return the portlet title for this window */ protected java.lang.String getTitle(RenderRequest request) { return config.getResourceBundle(request.getLocale()).getString("javax.portlet.title"); }
private String getPortletSpecificMessage(RenderRequest request, String portletName, String portletID) { String html = disabledPortletMessages.get(portletID); if (html == null || html.isEmpty()) { String portletDisplayName = getModuleRegistry().getDisplayName(portletName, request.getLocale()); html = mergeDisabledContent(getModuleRegistry(), getDisablerMessage(), portletDisplayName, portletName, portletID); disabledPortletMessages.put(portletID, html); } return html; }
@RenderMapping public ModelAndView view(RenderRequest request) { List<LocaleBean> locales = userLocaleHelper.getLocales(request.getLocale()); return new ModelAndView("/jsp/Translator/translator", "locales", locales); } }
@Override public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException { @SuppressWarnings("unchecked") SoftReference<List<CommonMessage>> msgRef = (SoftReference<List<CommonMessage>>) request.getPortletSession().getAttribute(COMMON_MESSAGES); if (null != msgRef && null != msgRef.get()) { request.setAttribute(COMMON_MESSAGES, msgRef.get()); } request.getPortletSession().removeAttribute(COMMON_MESSAGES); request.setAttribute(FMT_LOCALE, request.getLocale()); super.render(request, response); }
@Override protected void writeAjaxPageHtmlVaadinScripts(RenderRequest request, RenderResponse response, BufferedWriter writer, Application application, String themeName) throws IOException, PortletException { response.createResourceURL().setParameter("img", "loader"); this.application = application; I18NSource i18NSource = I18NSourceFactory.createI18NSource(request.getLocale()); writer.write(String.format("<div name='%s'>%s</div>", getLoaderTagId(request.getWindowID(), getPortletConfig()), i18NSource.getMessage("loader.message"))); super.writeAjaxPageHtmlVaadinScripts(request, response, writer, application, themeName); } @Override
Locale currentLocale = request.getLocale(); request.setAttribute("LOCALE", currentLocale); request.setAttribute("LOCALE_NAME", currentLocale.getDisplayName(currentLocale));
List paths = fallback(path, request.getLocale().getLanguage()); renderFile(response, paths);
List paths = fallback(path, request.getLocale().getLanguage(), appName); renderFile(response, paths, appName);
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { InitParameterState state = new InitParameterState(this.getPortletConfig()); String fileName = (String)request.getAttribute(state.portalParam); if (fileName == null) fileName = request.getPreferences().getValue("file", null); if (fileName == null) { response.setContentType("text/html"); response.getWriter().println("<p>A source document was not provided.</p>"); // TODO: localize return; } String path = this.concatenatePaths(state.folder, fileName); setContentType(path, response); List<String> paths = fallback(path, request.getLocale().getLanguage(), state); renderFile(response, paths, state); }
descString = description.getString(req.getLocale(), true);
String title = genericPortlet.getPortletConfig().getResourceBundle(request.getLocale()).getString("javax.portlet.title"); response.setTitle(title);