From: <die...@us...> - 2010-07-02 07:51:37
|
Revision: 2788 http://openutils.svn.sourceforge.net/openutils/?rev=2788&view=rev Author: diego_schivo Date: 2010-07-02 07:51:31 +0000 (Fri, 02 Jul 2010) Log Message: ----------- MEDIA-145 refactoring Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaAdvancedSearchPage.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaFolderViewPage.java trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/css/folderView.css Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaAdvancedSearchPage.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaAdvancedSearchPage.java 2010-07-02 07:35:37 UTC (rev 2787) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaAdvancedSearchPage.java 2010-07-02 07:51:31 UTC (rev 2788) @@ -71,7 +71,7 @@ * {@inheritDoc} */ @Override - protected int countMediaItems(MediaTypeConfiguration mtc) + protected int countMediaItems(MediaTypeConfiguration type) { if ("xml".equals(format)) { @@ -81,7 +81,7 @@ return MediaEl .module() .getSearch() - .search(request, mtc.getName(), "/", true, SORT_BY_SCORE, 0, 1) + .search(request, type.getName(), "/", true, SORT_BY_SCORE, 0, 1) .getTotalSize(); } Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaFolderViewPage.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaFolderViewPage.java 2010-07-02 07:35:37 UTC (rev 2787) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaFolderViewPage.java 2010-07-02 07:51:31 UTC (rev 2788) @@ -78,12 +78,12 @@ public static final String SORT_BY_CREATIONDATE = "creationdate"; /** - * + * */ public static final String SORT_BY_FILENAME = "filename"; /** - * + * */ public static final String SORT_BY_MODIFICATIONDATE = "modificationdate"; @@ -98,7 +98,7 @@ public static final String SORT_BY_TITLE = "title"; /** - * + * */ public static final String SORT_BY_USAGE = "usage"; @@ -158,7 +158,7 @@ { super.init(); - // left side of navigation bar + // left side of navigation bar: media type selectors if (!StringUtils.isEmpty(mediaType)) { // subset of types specified by selectMedia control @@ -179,7 +179,7 @@ types = MediaConfigurationManager.getInstance().getTypes().values(); } - // right side of navigation bar + // right side of navigation bar: sorting and background selectors bgSelector = null; sorting = null; for (Cookie cookie : request.getCookies()) @@ -202,10 +202,10 @@ /** * Counts media items for the specified type. - * @param mtc + * @param type * @return */ - protected int countMediaItems(MediaTypeConfiguration mtc) + protected int countMediaItems(MediaTypeConfiguration type) { if (StringUtils.isEmpty(path) && StringUtils.isBlank(search)) { @@ -214,7 +214,7 @@ // sorting must be specified for total-size to work (-1 otherwise) AdvancedResult typeResult = MediaEl.module().getSearch().search( request, - mtc.getName(), + type.getName(), path, false, getDefaultSorting(), @@ -256,14 +256,13 @@ @Override public String show() { + // counts media items group by type numberOfMedia = new HashMap<String, Integer>(); - for (MediaTypeConfiguration mtc : types) + for (MediaTypeConfiguration type : types) { - numberOfMedia.put(mtc.getName(), countMediaItems(mtc)); + numberOfMedia.put(type.getName(), countMediaItems(type)); } - medias = Iterators.emptyIterator(); - pages = Collections.emptyList(); contentMediaDetails = findMediaItems(); if (contentMediaDetails != null) { @@ -273,6 +272,14 @@ medias = Iterators.transform(contentIterator, new MediaBeanBuilder(mtc)); pages = MgnlPagingElFunctions.pageList(contentMediaDetails.getNumberOfPages(), 5, "page"); } + if (medias == null) + { + medias = Iterators.emptyIterator(); + } + if (pages == null) + { + pages = Collections.emptyList(); + } return super.show(); } Modified: trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/css/folderView.css =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/css/folderView.css 2010-07-02 07:35:37 UTC (rev 2787) +++ trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/css/folderView.css 2010-07-02 07:51:31 UTC (rev 2788) @@ -118,6 +118,13 @@ padding: 0 2px; } +.paging td a { + float: left; + line-height: 24px; + text-decoration: none; + width: 24px; +} + .paging .page-current-true a { background-color: #006699; font-weight: bold; @@ -137,13 +144,6 @@ color: #CCCCCC; } -.paging td a { - float: left; - line-height: 24px; - text-decoration: none; - width: 24px; -} - .mediaList { list-style: none; margin: 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |