2columns layout list unsorted
esmith1 May 21, 2008 7:12 PMAfter adding a 2columns layout (details below), I see in the Configure Dashboard the layouts are not sorted and display in this order: generic, 1column, 3columns, 2columns, default. (Notice 2 follows 3.) This seems random: not alphabetical and does not match the order in the portal-layouts.xml.
As best I can tell this will require a java code change to sort (by layout name?), unless someone knows another way to sort the layout list?
dashboard.xhtml is using #{applicationScope.LayoutService.layoutItems}
which is coming from AdminPropertyResolver.java using Collection layouts = layoutService.getLayouts();
which is coming from LayoutServiceImpl.java which is using return Collections.unmodifiableCollection(layouts.values());.
Here's how to create the 2columns layout:
1) Create a new directory, jboss-portal.sar\portal-core.war\layouts\2columns
2) Copy jboss-portal.sar\portal-core.war\layouts\generic\index.jsp to
jboss-portal.sar\portal-core.war\layouts\2columns\index.jsp
3) Replace this block of code in the new 2columns\index.jsp file
<div id="content-container"> <!-- insert the content of the 'left' region of the page, and assign the css selector id 'regionA' --> <p:region regionName='left' regionID='regionA'/> <!-- insert the content of the 'center' region of the page, and assign the css selector id 'regionB' --> <p:region regionName='center' regionID='regionB'/> <hr class="cleaner"/> </div>
with this
<div id="content-container"> <!-- insert the content of the 'left' region of the page, and assign the css selector id 'region50Percent' --> <p:region regionName='left' regionID='region50Percent'/> <!-- insert the content of the 'right' region of the page, and assign the css selector id 'region50Percent' --> <p:region regionName='right' regionID='region50Percent'/> <hr class="cleaner"/> </div>
4) Insert this block of code into jboss-portal.sar\portal-core.war\WEB-INF\portal-layouts.xml between 1column and 3columns
<layout> <name>2columns</name> <uri>/layouts/2columns/index.jsp</uri> <uri state="maximized">/layouts/generic/maximized.jsp</uri> <regions> <region name="left"/> <region name="right"/> </regions> </layout>
5) For each theme you want to have support this, for instance renaissance, add these lines to
jboss-portal.sar\portal-core.war\themes\renaissance\portal_style.css, below the #regionC definition:
#region50Percent { width: 50%; float: left; margin: 0px; padding: 0px; min-width: 250px; }
6) Restart the server. You should see the "2columns" in the Dashboard layout select list.