spcp7.imagegallery.view.managedbean
Class GalleryViewBean

java.lang.Object
  extended by spcp7.imagegallery.view.managedbean.GalleryViewBean
All Implemented Interfaces:
java.util.EventListener, ContentFolderActionListenerFace

public class GalleryViewBean
extends java.lang.Object
implements ContentFolderActionListenerFace

This is the backing Bean of the ICEfaces file "GalleryView.jspx". It handles everything which is needed to retrieve the content for display.

Author:
Phillip Merensky

Constructor Summary
GalleryViewBean()
          Determines the resource bundle, initially retrieves the content folders (retrieveContentFolders(Page)) and registers itself as a ContentFolderActionListener.
 
Method Summary
 java.util.List<Page> getPages()
           
 ViewWrapper getParent()
           
 java.util.List<ViewWrapper> getViewWrapperList()
           
 void goToPage(Page page)
          If a user clicks on a new page in the pagination list, this method should be called.
 boolean isParentAvailable()
          Uses parent.
 boolean isShowNextLink()
          Does a next page exist?
 boolean isShowPagination()
          Do we have more than one page?
 boolean isShowPreviousLink()
          Does a previous page exist?
 void nextPage(javax.faces.event.ActionEvent ae)
           
 void previousPage(javax.faces.event.ActionEvent ae)
          JSF callable method: Gets the previous page.
 void retrieveContentFolders(Page page)
          Retrieve content folder of the given page
 void setViewWrapperList(java.util.List<ViewWrapper> viewWrapperList)
           
 void showParentElements(javax.faces.event.ActionEvent ae)
          JSF callable method for getting the parent elements of parent.
 void showSubElements(ViewWrapper vw, Page page)
          Retrieves the thumbnails of the current content folder using DefaultProperties.SPCP7_THUMBNAIL_STORAGE_PATH, bundle and cpr.
 void stateChanged(ContentFolderModelFace source, java.lang.String eventType)
           If a content folder is inserted, nothing will be done, because the list is refreshed automatically when getParent is called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GalleryViewBean

public GalleryViewBean()
Determines the resource bundle, initially retrieves the content folders (retrieveContentFolders(Page)) and registers itself as a ContentFolderActionListener.

Method Detail

retrieveContentFolders

public void retrieveContentFolders(Page page)
Retrieve content folder of the given page

Parameters:
page - The page to get content folders from or null if the call is initial and no paging information has been calculated yet.

showSubElements

public void showSubElements(ViewWrapper vw,
                            Page page)
Retrieves the thumbnails of the current content folder using DefaultProperties.SPCP7_THUMBNAIL_STORAGE_PATH, bundle and cpr. It updates pages, currentPage, parent and viewWrapperList.

Parameters:
vw - the viewrapper of which the subelements should be shown.
page - the page marking the upper and lower limit of the elements which should be retrieved. If page is null all sub elements will be retrieved.

getParent

public ViewWrapper getParent()
Returns:

showParentElements

public void showParentElements(javax.faces.event.ActionEvent ae)
JSF callable method for getting the parent elements of parent. Uses parent, currentPage.

Parameters:
ae -

goToPage

public void goToPage(Page page)
If a user clicks on a new page in the pagination list, this method should be called. It uses/updates parent and viewWrapperList.

Parameters:
page - The page which should be shown.

nextPage

public void nextPage(javax.faces.event.ActionEvent ae)

previousPage

public void previousPage(javax.faces.event.ActionEvent ae)
JSF callable method: Gets the previous page. Uses currentPage and pages.

Parameters:
ae -

isShowPreviousLink

public boolean isShowPreviousLink()
Does a previous page exist? Uses currentPage and pages.

Returns:
true if a previous page exists, false otherwise.

isShowNextLink

public boolean isShowNextLink()
Does a next page exist? Uses currentPage and pages.

Returns:
true if a next page exists, false otherwise.

isShowPagination

public boolean isShowPagination()
Do we have more than one page?

Returns:
true if there is more than one page, false otherwise. Uses pages.

isParentAvailable

public boolean isParentAvailable()
Uses parent.

Returns:
true of parent is not null.

getPages

public java.util.List<Page> getPages()
Returns:

getViewWrapperList

public java.util.List<ViewWrapper> getViewWrapperList()
Returns:

setViewWrapperList

public void setViewWrapperList(java.util.List<ViewWrapper> viewWrapperList)
Parameters:
viewWrapperList -

stateChanged

public void stateChanged(ContentFolderModelFace source,
                         java.lang.String eventType)

If a content folder is inserted, nothing will be done, because the list is refreshed automatically when getParent is called.

If a content folder is updated we must guarantee, that the user only sees data which actually exists. That is why viewWrapperList and parent will be updated.

If a content folder is deleted we must guarantee, that the user only sees data which actually exists. That is why the suitable element viewWrapperList and in parent will be removed.

Uses viewWrapperList and parent.

Specified by:
stateChanged in interface ContentFolderActionListenerFace
Parameters:
source - The content folder which changed.
eventType - The event type of the content folder. The different event types are defined within ContentFolderEventTypes.
See Also:
ContentFolderActionListenerFace.stateChanged(spcp7.imagegallery.abstractionlayer.face.persistence.ContentFolderModelFace, java.lang.String)


Copyright © 2008. All Rights Reserved.