diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index d3b53defa4..015e2815fb 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -176,6 +176,7 @@ link_to=Link to icon=Icon lock=Lock unlock=Unlock +items_per_page=Items Per Page # Properties username=User Name diff --git a/source/java/org/alfresco/web/bean/BrowseBean.java b/source/java/org/alfresco/web/bean/BrowseBean.java index 346689fca2..9df7f30315 100644 --- a/source/java/org/alfresco/web/bean/BrowseBean.java +++ b/source/java/org/alfresco/web/bean/BrowseBean.java @@ -186,10 +186,6 @@ public class BrowseBean implements IContextListener FacesContext fc = FacesContext.getCurrentInstance(); fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dashboard"); } - else - { - navigateBrowseScreen(); - } } /** @@ -206,8 +202,25 @@ public class BrowseBean implements IContextListener public void setBrowsePageSize(int browsePageSize) { this.browsePageSize = browsePageSize; + this.browsePageSizeString = Integer.toString(browsePageSize); } + /** + * @return browsePageSizeString + */ + public String getBrowsePageSizeString() + { + return this.browsePageSizeString; + } + + /** + * @param browsePageSizeString to set + */ + public void setBrowsePageSizeString(String browsePageSizeString) + { + this.browsePageSizeString = browsePageSizeString; + } + /** * @return Returns the minimum length of a valid search string. */ @@ -489,14 +502,12 @@ public class BrowseBean implements IContextListener if (logger.isDebugEnabled()) logger.debug("Browse view page size set to: " + getBrowsePageSize()); - // in case we left for dashboard - if (isDashboardView() == true) - { - setDashboardView(false); - } + setDashboardView(false); // push the view mode into the lists setBrowseViewMode(viewMode); + + navigateBrowseScreen(); } else { @@ -1001,6 +1012,31 @@ public class BrowseBean implements IContextListener this.navigator.setCurrentNodeId( this.navigator.getCurrentNodeId() ); } + /** + * Update page size based on user selection + */ + public void updatePageSize(ActionEvent event) + { + try + { + int size = Integer.parseInt(this.browsePageSizeString); + if (size >= 0) + { + this.browsePageSize = size; + } + else + { + // reset to known value if this occurs + this.browsePageSizeString = Integer.toString(this.browsePageSize); + } + } + catch (NumberFormatException err) + { + // reset to known value if this occurs + this.browsePageSizeString = Integer.toString(this.browsePageSize); + } + } + /** * Action called when a folder space is clicked. * Navigate into the space. @@ -1417,8 +1453,7 @@ public class BrowseBean implements IContextListener getConfigElement(ViewsConfigElement.CONFIG_ELEMENT_ID); this.browseViewMode = this.viewsConfig.getDefaultView(PAGE_NAME_BROWSE); - this.browsePageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, - this.browseViewMode); + setBrowsePageSize(this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, this.browseViewMode)); } /** @@ -1706,6 +1741,7 @@ public class BrowseBean implements IContextListener /** The current browse view page size */ private int browsePageSize; + private String browsePageSizeString; /** True if current space has a dashboard (template) view available */ private boolean dashboardView; diff --git a/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java b/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java index e75c924781..cfe42bbd9d 100644 --- a/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java +++ b/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java @@ -409,7 +409,7 @@ public class UIRichList extends UIComponentBase implements IDataContainer int rowCount = getDataModel().size(); // if a page size is specified, then we use that int pageSize = getPageSize(); - if (pageSize != -1) + if (pageSize != -1 && pageSize != 0) { // calc start row index based on current page index this.rowIndex = (this.currentPage * pageSize) - 1; diff --git a/source/web/jsp/browse/browse.jsp b/source/web/jsp/browse/browse.jsp index 3d0b6e7859..af768df5d7 100644 --- a/source/web/jsp/browse/browse.jsp +++ b/source/web/jsp/browse/browse.jsp @@ -182,7 +182,18 @@