From portal-commits at lists.jboss.org Mon Mar 31 13:28:29 2008 Content-Type: multipart/mixed; boundary="===============3456821220354204598==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r10436 - branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/content. Date: Mon, 31 Mar 2008 13:28:29 -0400 Message-ID: --===============3456821220354204598== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: chris.laprun(a)jboss.com Date: 2008-03-31 13:28:28 -0400 (Mon, 31 Mar 2008) New Revision: 10436 Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-= INF/jsp/content/portlet_editor.jsp Log: - JBPORTAL-1967: Avoid NPEs, use proper locales. - Minor improvements (in particular avoid querying for a value when a local= variable can be used). Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-w= ar/WEB-INF/jsp/content/portlet_editor.jsp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB= -INF/jsp/content/portlet_editor.jsp 2008-03-31 17:27:40 UTC (rev 10435) +++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB= -INF/jsp/content/portlet_editor.jsp 2008-03-31 17:28:28 UTC (rev 10436) @@ -1,6 +1,6 @@ +<%@ page import=3D"org.jboss.portal.common.i18n.LocalizedString" %> <%@ page import=3D"org.jboss.portal.common.util.IteratorStatus" %> <%@ page import=3D"org.jboss.portal.core.model.instance.Instance" %> -<%@ page import=3D"org.jboss.portal.core.portlet.info.CorePortletInfo" %> <%@ page import=3D"org.jboss.portal.core.portlet.info.PortletIconInfo" %> <%@ page import=3D"org.jboss.portal.core.portlet.info.PortletInfoInfo" %> <%@ page import=3D"org.jboss.portal.core.ui.content.portlet.PortletContent= EditorPortlet" %> @@ -8,167 +8,172 @@ <%@ taglib uri=3D"http://java.sun.com/portlet" prefix=3D"portlet" %> = <% - Collection instances =3D (Collection)request.getAttribute("INSTANCES"); - Instance selectedInstance =3D (Instance)request.getAttribute("SELECTED_= INSTANCE"); + Collection instances =3D (Collection)request.getAttribute("INSTANCES"); + Instance selectedInstance =3D (Instance)request.getAttribute("SELECTED_I= NSTANCE"); %> <%@page import=3D"org.jboss.portal.portlet.Portlet" %> <%@page import=3D"org.jboss.portal.portlet.PortletInvokerException" %> <%@page import=3D"org.jboss.portal.portlet.info.MetaInfo" %> <%@page import=3D"org.jboss.portal.portlet.info.PortletInfo" %> <%@page import=3D"java.util.Collection" %> +<%@ page import=3D"java.util.Locale" %> = - + <% - if (selectedInstance !=3D null) - { - String displayName =3D selectedInstance.getDisplayName().getString(r= enderRequest.getLocale(), true); - if (displayName =3D=3D null) - { - displayName =3D selectedInstance.getId(); - } + Locale locale =3D renderRequest.getLocale(); + if (selectedInstance !=3D null) + { + String displayName =3D selectedInstance.getDisplayName().getString(loc= ale, true); + if (displayName =3D=3D null) + { + displayName =3D selectedInstance.getId(); + } %> = = <% - Portlet portlet =3D null; - try - { - portlet =3D selectedInstance.getPortlet(); - } - catch (PortletInvokerException e) - { - e.printStackTrace(); - } - if (portlet !=3D null) - { - MetaInfo metaInfo =3D portlet.getInfo().getMeta(); + Portlet portlet =3D null; + try + { + portlet =3D selectedInstance.getPortlet(); + } + catch (PortletInvokerException e) + { + e.printStackTrace(); + } + if (portlet !=3D null) + { + PortletInfo info =3D portlet.getInfo(); + MetaInfo metaInfo =3D info.getMeta(); = - PortletInfo info =3D portlet.getInfo(); + LocalizedString localizedDesc =3D metaInfo.getMetaValue(MetaInfo.DESCR= IPTION); + String desc =3D ""; + if (localizedDesc !=3D null) + { + desc =3D localizedDesc.getString(locale, true); + } = - String iconLocation =3D getIcon(info); - + String iconLocation =3D getIcon(info); %> - + <% - } - } + } + } = %> = = - + "> + + + <% + } + %> +

Portlet instance associ= ated to this window:

Portlet instance associa= ted to this window:

- " align=3D"middle" style=3D"margin:= 0 4px 0 0"/> - <%=3D displayName %> + + " align=3D"middle" style=3D"margin:0 = 4px 0 0" alt=3D"icon"/> + <%=3D displayName %> = -
- Portlet name:<%=3D m= etaInfo.getMetaValue(MetaInfo.DISPLAY_NAME).getDefaultString() %> -
-
- Portlet description:= <%=3D metaInfo.getMetaValue(MetaInfo.DESCRIPTION).getDefaultString() %> -
+
+ Portlet name:<%=3D d= isplayName %> +
+
+ Portlet description:= <%=3D desc %> +
= -
+ = -
- - <% - for (IteratorStatus i =3D new IteratorStatus(instances); i.= hasNext();) - { - Instance instance =3D (Instance)i.next(); - String rowClass =3D instance =3D=3D selectedInstance ? "= portlet-section-selected" : (i.getIndex() % 2 =3D=3D 0 ? "portlet-section-b= ody" : "portlet-section-alternate"); - String displayName =3D instance.getDisplayName().getStri= ng(renderRequest.getLocale(), true); - MetaInfo portletMetaInfo =3D instance.getPortlet().getIn= fo().getMeta(); +
+
+ <% + for (IteratorStatus i =3D new IteratorStatus(instances); i.hasNe= xt();) + { + Instance instance =3D (Instance)i.next(); + String rowClass =3D instance =3D=3D selectedInstance ? "portle= t-section-selected" : (i.getIndex() % 2 =3D=3D 0 ? "portlet-section-body" := "portlet-section-alternate"); + String displayName =3D instance.getDisplayName().getString(loc= ale, true); + PortletInfo info =3D instance.getPortlet().getInfo(); + MetaInfo portletMetaInfo =3D info.getMeta(); = - if (displayName =3D=3D null) - { - displayName =3D instance.getId(); - } + if (displayName =3D=3D null) + { + displayName =3D instance.getId(); + } = - PortletInfo info =3D instance.getPortlet().getInfo(); + String iconLocation =3D getIcon(info); = - String iconLocation =3D getIcon(info); + LocalizedString localizedDesc =3D portletMetaInfo.getMetaValue= (MetaInfo.DESCRIPTION); + String desc =3D ""; + if (localizedDesc !=3D null) + { + desc =3D localizedDesc.getString(locale, true); + } + %> + + + "/> + = - %> - - - "/> - +
+
= "> +
+
<%=3D portletMetaInfo.getMetaValue(Meta= Info.TITLE).getDefaultString() %> +
+
+
= -
-
"> -
-
<%=3D portletMetaInfo.getMetaVal= ue(MetaInfo.TITLE).getDefaultString() %> -
-
-
+
+ Portlet name:<%=3D displayName %> +
+
+ Portlet descripti= on:<%=3D desc %> +
+
+
= -
- Portlet name= :<%=3D portletMetaInfo.getMetaValue(MetaInfo.DISPLAY_NAME).getDefaul= tString() %> -
-
- Portlet desc= ription:<%=3D portletMetaInfo.getMetaValue(MetaInfo.DESCRIPTION).get= DefaultString() %> -
-
-
+
= -
- - "> - - - <% - } - %> -
- " align=3D"middle" styl= e=3D"margin:0 4px 0 0"/> - '),'delay', 0,= 'trail', false, 'fade', 'both', 'fadeMax', 95, 'styleClass', 'none');">" id=3D"portlet-instance-link"><%= =3D displayName %> -
-
-
+ " align=3D"middle" style=3D"m= argin:0 4px 0 0" alt=3D"icon"/> + '),'delay', 0, 't= rail', false, 'fade', 'both', 'fadeMax', 95, 'styleClass', 'none');">" id=3D"portlet-instance-link"><%= =3D displayName %> +
+ + = <%! - private String getIcon(PortletInfo info) - { - String iconLocation =3D null; - CorePortletInfo cInfo =3D info.getAttachment(CorePortletInfo.class); - if (cInfo !=3D null) + private String getIcon(PortletInfo info) + { + String iconLocation =3D PortletContentEditorPortlet.DEFAULT_PORTLET_IC= ON; + PortletInfoInfo portletInfo =3D info.getAttachment(PortletInfoInfo.cla= ss); + + if (portletInfo !=3D null) + { + PortletIconInfo iconInfo =3D portletInfo.getPortletIconInfo(); + if (iconInfo !=3D null && iconInfo.getIconLocation(PortletIconInfo.S= MALL) !=3D null) { - PortletInfoInfo portletInfo =3D cInfo.getPortletInfo(); - if (portletInfo !=3D null && portletInfo.getPortletIconInfo() != =3D null && portletInfo.getPortletIconInfo().getIconLocation(PortletIconInf= o.SMALL) !=3D null) - { - iconLocation =3D portletInfo.getPortletIconInfo().getIconLocat= ion(PortletIconInfo.SMALL); - } + iconLocation =3D iconInfo.getIconLocation(PortletIconInfo.SMALL); } - if (iconLocation =3D=3D null) - { - iconLocation =3D PortletContentEditorPortlet.DEFAULT_PORTLET_ICON; - } - return iconLocation; - } + } + + return iconLocation; + } %> \ No newline at end of file --===============3456821220354204598==--