spcp7.imagegallery.view.managedbean
Class EditBean

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

public class EditBean
extends java.lang.Object
implements ContentFolderActionListenerFace

Backing Bean which handles the whole administration of content folders. The ICEFaces counterpart is called "Edit.jspx". This class might be big but in my opinion it is important to keep the functions handling administration together. Administration of content folders in a whole is quite complex and that is why this class is on this scale.

Author:
Phillip Merensky

Constructor Summary
EditBean()
          Contstructor which initializes the tree, determines the resource bundle and so on.
 
Method Summary
 void addContentFolder(javax.faces.event.ActionEvent ae)
          JSF callable method fo adding a content folder.
 void cancelConfirmationDialog(javax.faces.event.ActionEvent ae)
          JSF callable method for disabling the confirmation dialog.
 void closeBrowsingPanel(javax.faces.event.ActionEvent e)
          JSF callable method for disabling the brwosing panel.
 void deleteContentFolder(javax.faces.event.ActionEvent ae)
          JSF callable method for deleting a content folder
 void deleteProperties(javax.faces.event.ActionEvent ae)
          JSF callable method for deleting properties of the currently selected content provider.
 void deleteSelectedNode(javax.faces.event.ActionEvent event)
          Deletes the selected tree node.
 java.lang.String getAddFolder_name()
           
 java.util.List<javax.faces.model.SelectItem> getAllContentProviders()
           
 java.util.ResourceBundle getBundle()
           
 ContentProviderRegistryFace getCpr()
           
 ContentFace getCurrenContentParent()
           
 java.util.List<EditContentWrapper> getCurrentBrowsedContent()
           
 boolean getCurrentBrowsedContentEmpty()
           
 java.lang.String getCurrentBrowsedPath()
           
 java.util.List<PropertyWrapper> getCurrentProperties()
           
 javax.faces.context.FacesContext getFacesContext()
           
 javax.swing.tree.DefaultTreeModel getModel()
          Gets the tree model
 java.lang.String getSelectedContentProvider()
           
 DynamicNodeUserObject getSelectedNodeObject()
          Gets the currently selected node, which contains a content folder object.
 java.lang.String getSpcp7_start_retrieval_path()
          For JSF accessibility.
 boolean isShowBrowsingPanel()
           
 boolean isShowConfirmDeletionPanel()
           
 boolean isShowFolderDetails()
           
 void makeConfirmDeletionPanelVisible(javax.faces.event.ActionEvent ae)
          Show the confirm deletion panel
 void retrieveCurrentBrowsedContent(ContentFace content, PropertyWrapper appropriateProperty)
          Retrieves the current browsed content for the browsing view.
 void retrieveCurrentParentContent(PropertyWrapper appropriateProperty)
          Retrieves the content of the current and sets currentBrowsedContent using selectedNodeObject, cpr and bundle for error messages.
 void retrieveInitialBrowsedContent(java.lang.String startRetrievalPath, PropertyWrapper appropriateProperty)
          Should be called when starting to browse content from a property.
 void setAddFolder_name(java.lang.String addFolder_name)
           
 void setAllContentProviders(java.util.List<javax.faces.model.SelectItem> allContentProviders)
           
 void setCurrentBrowsedContent(java.util.List<EditContentWrapper> currentBrowsedContent)
           
 void setCurrentProperties(java.util.List<PropertyWrapper> currentProperties)
           
 void setSelectedContentProvider(java.lang.String selectedContentProvider)
           
 void setSelectedNodeObject(DynamicNodeUserObject selectedNodeObject)
          Sets the node which is currently selected.
 void setShowConfirmDeletionPanel(boolean showConfirmDeletionPanel)
           
 void setShowModalPanel(boolean showModalPanel)
           
 void stateChanged(ContentFolderModelFace source, java.lang.String contentFolderEventType)
           If the event is insert the content folder is added to the current tree.
 void unlockSpcp7_start_retrieval_path(javax.faces.event.ActionEvent ae)
           
 void updateContentFolder(javax.faces.event.ActionEvent ae)
          Updates a content folder with content from selectedNodeObject.
 void updateContentPath(EditContentWrapper cw)
          If a the content of a property has changed via the browsing view this method updates the view and inserts the path of the EditContentWrapper.getContent() into the property in the view.
 void updateContentUrl(EditContentWrapper cw)
          If a the content of a property has changed via the browsing view this method updates the view and inserts the url of the EditContentWrapper.getContent() into the property in the view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditBean

public EditBean()
Contstructor which initializes the tree, determines the resource bundle and so on.

Method Detail

addContentFolder

public void addContentFolder(javax.faces.event.ActionEvent ae)
JSF callable method fo adding a content folder. It uses cpr,addFolder_name and bundle.

Parameters:
ae -

cancelConfirmationDialog

public void cancelConfirmationDialog(javax.faces.event.ActionEvent ae)
JSF callable method for disabling the confirmation dialog.

Parameters:
ae -
See Also:
showConfirmDeletionPanel

closeBrowsingPanel

public void closeBrowsingPanel(javax.faces.event.ActionEvent e)
JSF callable method for disabling the brwosing panel.

Parameters:
ae -
See Also:
showBrowsingPanel

deleteContentFolder

public void deleteContentFolder(javax.faces.event.ActionEvent ae)
JSF callable method for deleting a content folder

Parameters:
ae -

deleteProperties

public void deleteProperties(javax.faces.event.ActionEvent ae)
JSF callable method for deleting properties of the currently selected content provider. Currently not used because normally it should not be necessary to delete properties. Changing them should completely suffice.

Parameters:
ae -

deleteSelectedNode

public void deleteSelectedNode(javax.faces.event.ActionEvent event)
Deletes the selected tree node. The node object reference is set to null so that the delete and copy buttons will be disabled.

Parameters:
event - that fired this method
See Also:
#isDeleteDisabled(), isCopyDisabled()

getAddFolder_name

public java.lang.String getAddFolder_name()
Returns:

getAllContentProviders

public java.util.List<javax.faces.model.SelectItem> getAllContentProviders()
Returns:

getCurrenContentParent

public ContentFace getCurrenContentParent()
Returns:

getCurrentBrowsedContent

public java.util.List<EditContentWrapper> getCurrentBrowsedContent()
Returns:

getCurrentProperties

public java.util.List<PropertyWrapper> getCurrentProperties()
Returns:

getModel

public javax.swing.tree.DefaultTreeModel getModel()
Gets the tree model

Returns:
tree model.

getSelectedContentProvider

public java.lang.String getSelectedContentProvider()
Returns:

getSelectedNodeObject

public DynamicNodeUserObject getSelectedNodeObject()
Gets the currently selected node, which contains a content folder object.

Returns:
the currently selected node.

isShowConfirmDeletionPanel

public boolean isShowConfirmDeletionPanel()
Returns:

isShowFolderDetails

public boolean isShowFolderDetails()
Returns:
True if the user selected a normal node and false if the root node is selected.

isShowBrowsingPanel

public boolean isShowBrowsingPanel()
Returns:

retrieveCurrentBrowsedContent

public void retrieveCurrentBrowsedContent(ContentFace content,
                                          PropertyWrapper appropriateProperty)
                                   throws NoContentFoundException
Retrieves the current browsed content for the browsing view. Uses selectedNodeObject, currentBrowsedContent, bundle,currentContentParent.

Parameters:
content - The sub elements of ContentFace.getPath() will be set as currentBrowsedContent.
appropriateProperty - the property which initiated the browsing
Throws:
NoContentFoundException - if an empty result set was returned. All other Exceptions are already handled within this method.

retrieveCurrentParentContent

public void retrieveCurrentParentContent(PropertyWrapper appropriateProperty)
Retrieves the content of the current and sets currentBrowsedContent using selectedNodeObject, cpr and bundle for error messages.

Parameters:
appropriateProperty - the initiating property

retrieveInitialBrowsedContent

public void retrieveInitialBrowsedContent(java.lang.String startRetrievalPath,
                                          PropertyWrapper appropriateProperty)
Should be called when starting to browse content from a property. If a property with image selection or url selection is the initiator we use DefaultProperties.SPCP7_START_RETRIEVAL_PATH as starting point. Uses selectedNodeObject, bundle, cpr.

Parameters:
startRetrievalPath -
appropriateProperty -

setAddFolder_name

public void setAddFolder_name(java.lang.String addFolder_name)
Parameters:
addFolder_name -

setAllContentProviders

public void setAllContentProviders(java.util.List<javax.faces.model.SelectItem> allContentProviders)
Parameters:
allContentProviders -

setCurrentBrowsedContent

public void setCurrentBrowsedContent(java.util.List<EditContentWrapper> currentBrowsedContent)
Parameters:
currentBrowsedContent -

setCurrentProperties

public void setCurrentProperties(java.util.List<PropertyWrapper> currentProperties)
Parameters:
currentProperties -

setSelectedContentProvider

public void setSelectedContentProvider(java.lang.String selectedContentProvider)
Parameters:
selectedContentProvider -

setSelectedNodeObject

public void setSelectedNodeObject(DynamicNodeUserObject selectedNodeObject)
Sets the node which is currently selected.

Parameters:
selectedNodeObject - the new tree node

setShowConfirmDeletionPanel

public void setShowConfirmDeletionPanel(boolean showConfirmDeletionPanel)
Parameters:
showConfirmDeletionPanel -

makeConfirmDeletionPanelVisible

public void makeConfirmDeletionPanelVisible(javax.faces.event.ActionEvent ae)
Show the confirm deletion panel

Parameters:
ae -

setShowModalPanel

public void setShowModalPanel(boolean showModalPanel)
Parameters:
showModalPanel -

stateChanged

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

If the event is insert the content folder is added to the current tree. Actions executed might seem hard but normally only one user at a time should edit, delete or update the same content folder. That is why we focus on presenting and saving a consistent state if more than one user changes the same content folder.

If the event is update the content folders of the current tree are reinserted overwriting properties which are not yet saved on user side. This is intended because properties are not costly to edit. Furthermore it is more important to not allow the user to save an inconsistent state which could lead to lost update problems etc.

If the event is delete the content folder no matter if another is editing it will be deleted to always work on a consistent state.

Uses rootTreeNode and selectedNodeObject.

Specified by:
stateChanged in interface ContentFolderActionListenerFace
Parameters:
source - The content folder which changed.
contentFolderEventType - 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)

updateContentPath

public void updateContentPath(EditContentWrapper cw)
If a the content of a property has changed via the browsing view this method updates the view and inserts the path of the EditContentWrapper.getContent() into the property in the view. To save the changes updateContentFolder(ActionEvent) must be called from a JSF page. Uses currentProperties, selectedNodeObject.

Parameters:
cw - The content wrapper with the path for the view value of the property of the selectedNodeObject.

updateContentUrl

public void updateContentUrl(EditContentWrapper cw)
If a the content of a property has changed via the browsing view this method updates the view and inserts the url of the EditContentWrapper.getContent() into the property in the view. To save the changes updateContentFolder(ActionEvent) must be called from a JSF page. Uses currentProperties, selectedNodeObject.

Parameters:
cw - The content wrapper with the url for the view value of the property of the selectedNodeObject.

updateContentFolder

public void updateContentFolder(javax.faces.event.ActionEvent ae)
Updates a content folder with content from selectedNodeObject. Uses currentProperties, selectedNodeObject, cpr, bundle.

Parameters:
ae -

getCurrentBrowsedContentEmpty

public boolean getCurrentBrowsedContentEmpty()
Returns:
true if currentBrowsedContent is empty or null, false otherwise.

getSpcp7_start_retrieval_path

public java.lang.String getSpcp7_start_retrieval_path()
For JSF accessibility. Needed for error messages.

Returns:
DefaultProperties.SPCP7_START_RETRIEVAL_PATH

unlockSpcp7_start_retrieval_path

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

getCurrentBrowsedPath

public java.lang.String getCurrentBrowsedPath()
Returns:

getCpr

public ContentProviderRegistryFace getCpr()
Returns:
the content provider registry

getFacesContext

public javax.faces.context.FacesContext getFacesContext()
Returns:

getBundle

public java.util.ResourceBundle getBundle()
Returns:
the resource bundle determined from the users's request.


Copyright © 2008. All Rights Reserved.