portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinsuke SUGAYA <shins...@yahoo.co.jp>
Subject Re: cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/title DynamicTitleServiceImpl.java
Date Fri, 13 May 2005 21:43:52 GMT
Thanks! I could build it :)

Thanks,
  shinsuke

Scott T Weaver wrote:
> Sorry about that, I thought I had committed that ;)
> 
> Regards,
> Scott
> 
> 
>>-----Original Message-----
>>From: Shinsuke SUGAYA [mailto:shinsuke@yahoo.co.jp]
>>Sent: Thursday, May 12, 2005 7:06 PM
>>To: Jetspeed Developers List
>>Subject: Re: cvs commit: jakarta-jetspeed-
>>2/portal/src/java/org/apache/jetspeed/services/title
>>DynamicTitleServiceImpl.java
>>
>>Hi Scott,
>>
>>Could you update org.apache.jetspeed.PortalReservedParameters?
>>It seems not to have OVERRIDE_PORTLET_TITLE_ATTR.
>>
>>Thanks,
>> shinsuke
>>
>>weaver@apache.org wrote:
>>
>>>weaver      2005/05/12 14:03:22
>>>
>>>  Modified:    portal/src/webapp/WEB-INF/assembly pluto-factories.xml
>>>  Added:       portal/src/java/org/apache/jetspeed/services/title
>>>                        DynamicTitleServiceImpl.java
>>>  Log:
>>>  Finally implemented the DynamicTitleService.
>>>
>>>  Revision  Changes    Path
>>>  1.5       +5 -0      jakarta-jetspeed-2/portal/src/webapp/WEB-
>>
>>INF/assembly/pluto-factories.xml
>>
>>>  Index: pluto-factories.xml
>>>  ===================================================================
>>>  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-
>>
>>INF/assembly/pluto-factories.xml,v
>>
>>>  retrieving revision 1.4
>>>  retrieving revision 1.5
>>>  diff -u -r1.4 -r1.5
>>>  --- pluto-factories.xml	23 Mar 2005 23:05:48 -0000	1.4
>>>  +++ pluto-factories.xml	12 May 2005 21:03:22 -0000	1.5
>>>  @@ -193,5 +193,10 @@
>>>     <bean id="org.apache.pluto.services.log.LogService"
>>>
>>
>>class="org.apache.jetspeed.container.services.log.PlutoLogService"
>>
>>>     />
>>>  +
>>>  +  <bean id="org.apache.pluto.services.title.DynamicTitleService"
>>>  +	    name="DynamicTitleService"
>>>  +
>>
>>class="org.apache.jetspeed.services.title.DynamicTitleServiceImpl" />
>>
>>>  +
>>>
>>>   </beans>
>>>
>>>
>>>
>>>  1.1                  jakarta-jetspeed-
>>
>>2/portal/src/java/org/apache/jetspeed/services/title/DynamicTitleServiceIm
>>pl.java
>>
>>>  Index: DynamicTitleServiceImpl.java
>>>  ===================================================================
>>>  /*
>>>   * Copyright 2000-2001,2004 The Apache Software Foundation.
>>>   *
>>>   * Licensed under the Apache License, Version 2.0 (the "License");
>>>   * you may not use this file except in compliance with the License.
>>>   * You may obtain a copy of the License at
>>>   *
>>>   *      http://www.apache.org/licenses/LICENSE-2.0
>>>   *
>>>   * Unless required by applicable law or agreed to in writing, software
>>>   * distributed under the License is distributed on an "AS IS" BASIS,
>>>   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>
>>implied.
>>
>>>   * See the License for the specific language governing permissions and
>>>   * limitations under the License.
>>>   */
>>>  package org.apache.jetspeed.services.title;
>>>
>>>  import java.util.Iterator;
>>>  import java.util.Locale;
>>>
>>>  import javax.servlet.http.HttpServletRequest;
>>>
>>>  import org.apache.jetspeed.PortalReservedParameters;
>>>  import org.apache.jetspeed.request.RequestContext;
>>>  import org.apache.pluto.om.common.Preference;
>>>  import org.apache.pluto.om.entity.PortletEntity;
>>>  import org.apache.pluto.om.window.PortletWindow;
>>>  import org.apache.pluto.services.title.DynamicTitleService;
>>>
>>>  public class DynamicTitleServiceImpl implements DynamicTitleService
>>>  {
>>>
>>>      public void setDynamicTitle(PortletWindow window,
>>>              HttpServletRequest request, String titleArg)
>>>      {
>>>          String title = getTitleFromPreference(window, request);
>>>
>>>          if (title == null || title.length() < 0)
>>>          {
>>>              if (titleArg == null || titleArg.length() == 0)
>>>              {
>>>                  title = getTitleFromPortletDefinition(window,
>>
>>request);
>>
>>>              }
>>>              else
>>>              {
>>>                  title = titleArg;
>>>              }
>>>
>>>          }
>>>
>>>          request.setAttribute(
>>>                  PortalReservedParameters.OVERRIDE_PORTLET_TITLE_ATTR
>>>                          + "::window.id::" + window.getId(), title);
>>>
>>>      }
>>>
>>>      protected final String getTitleFromPortletDefinition(PortletWindow
>>
>>window,
>>
>>>              HttpServletRequest request)
>>>      {
>>>          String title = null;
>>>          RequestContext requestContext = (RequestContext) request
>>>
>>
>>.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
>>
>>>          PortletEntity entity = window.getPortletEntity();
>>>          if (entity != null && entity.getPortletDefinition() != null)
>>>          {
>>>              title = requestContext.getPreferedLanguage(
>>>                      entity.getPortletDefinition()).getTitle();
>>>          }
>>>
>>>          if (title == null && entity.getPortletDefinition() != null)
>>>          {
>>>              title = entity.getPortletDefinition().getName();
>>>          }
>>>          else if (title == null)
>>>          {
>>>              title = "Invalid portlet entity " + entity.getId();
>>>          }
>>>
>>>          return title;
>>>      }
>>>
>>>      protected final String getTitleFromPreference(PortletWindow
>>
>>window,
>>
>>>              HttpServletRequest request)
>>>      {
>>>          Locale locale = request.getLocale();
>>>          String titleKey = createTitleKey(locale, false);
>>>
>>>          Preference titlePref =
>>
>>window.getPortletEntity().getPreferenceSet()
>>
>>>                  .get(titleKey);
>>>          if (titlePref == null)
>>>          {
>>>              titleKey = createTitleKey(locale, true);
>>>              titlePref =
>>
>>window.getPortletEntity().getPreferenceSet().get(
>>
>>>                      titleKey);
>>>          }
>>>
>>>          if (titlePref != null)
>>>          {
>>>              Iterator values = titlePref.getValues();
>>>              if (values.hasNext())
>>>              {
>>>                  return (String) titlePref.getValues().next();
>>>              }
>>>          }
>>>
>>>          return null;
>>>      }
>>>
>>>      public static String createTitleKey(Locale locale, boolean
>>
>>languageOnly)
>>
>>>      {
>>>          if(languageOnly)
>>>          {
>>>              return "jetspeed.title."+locale.getLanguage();
>>>          }
>>>          else
>>>          {
>>>              return "jetspeed.title."+locale.toString();
>>>          }
>>>      }
>>>
>>>  }
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
>>>For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
>>>
>>
>>__________________________________
>>Do You Yahoo!?
>>Upgrade Your Life
>>http://bb.yahoo.co.jp/
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
>>For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
> 

__________________________________
Do You Yahoo!?
Upgrade Your Life
http://bb.yahoo.co.jp/


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message