org.jasig.portal.channels.UserPreferences
Class TabColumnPrefsState

java.lang.Object
  extended by org.jasig.portal.channels.UserPreferences.BaseState
      extended by org.jasig.portal.channels.UserPreferences.TabColumnPrefsState
All Implemented Interfaces:
IChannel, IPrivileged, IPrivilegedChannel

public class TabColumnPrefsState
extends BaseState

This user preferences component is for use with layouts based on the tab-column structure.

Version:
$Revision: 1.80 $
Author:
Ken Weiner, kweiner@unicon.net

Nested Class Summary
protected  class TabColumnPrefsState.DefaultState
          A sub-state of TabColumnPrefsState for visualizing the user layout in tab-column form.
protected  class TabColumnPrefsState.NewChannelState
          A sub-state of TabColumnPrefsState for choosing a new channel (formerly subscribe)
protected  class TabColumnPrefsState.ParametersState
          A sub-state of TabColumnPrefsState for setting channel parameters
protected  class TabColumnPrefsState.ResetLayoutState
          A sub-state of TabColumnPrefsState for resetting layout
protected  class TabColumnPrefsState.SelectSkinsState
          A sub-state of TabColumnPrefsState for selecting skins
 
Field Summary
private  java.lang.String action
           
private  java.lang.String activeTab
           
protected static java.lang.String BLANK_TAB_NAME
           
private  UserProfile editedUserProfile
           
private  java.lang.String elementID
           
private  java.lang.String errorMessage
           
private static java.lang.String errorMessageAddTab
           
private static java.lang.String errorMessageChangeColumnWidths
           
private static java.lang.String errorMessageDeleteChannel
           
private static java.lang.String errorMessageDeleteColumn
           
private static java.lang.String errorMessageDeleteTab
           
private static java.lang.String errorMessageLockTab
           
private static java.lang.String errorMessageModChannelParams
           
private static java.lang.String errorMessageMoveChannel
           
private static java.lang.String errorMessageMoveColumn
           
private static java.lang.String errorMessageMoveTab
           
private static java.lang.String errorMessageNewChannel
           
private static java.lang.String errorMessageNewColumn
           
private static java.lang.String errorMessageRenameTab
           
private static java.lang.String errorMessageSetActiveTab
           
private static java.lang.String errorMessageUnlockTab
           
private static org.apache.commons.logging.Log log
           
private  java.lang.String newColumnId
           
private  PortalControlStructures pcs
           
protected  ChannelRuntimeData runtimeData
           
private  StylesheetSet set
           
protected static java.lang.String SKINS_PATH
           
private static java.lang.String sslLocation
           
protected  ChannelStaticData staticData
           
private  IUserLayoutManager ulm
           
private static IUserLayoutStore ulStore
           
private  UserPreferences userPrefs
           
 
Fields inherited from class org.jasig.portal.channels.UserPreferences.BaseState
context, internalState
 
Constructor Summary
TabColumnPrefsState()
           
TabColumnPrefsState(CUserPreferences context)
           
 
Method Summary
private  void addChannel(org.w3c.dom.Element newChannel, java.lang.String position, java.lang.String destinationElementId)
          Adds a channel to the layout.
private  void addChannel(java.lang.String selectedChannelSubscribeId, java.lang.String position, java.lang.String destinationElementId)
          Adds a channel to the layout.
private  void addColumn(java.lang.String method, java.lang.String destinationElementId)
          Adds a new column into the layout.
private  void addTab(java.lang.String tabName, java.lang.String method, java.lang.String destinationTabId)
          Adds a new tab to the layout.
private  void changeColumnWidths(java.util.HashMap columnWidths)
           
private  IUserLayoutFolderDescription createFolder(java.lang.String name)
          Creates a folder element with default attributes.
private  void deleteChannel(java.lang.String channelSubscribeId)
          Removes a channel element from the layout
private  void deleteElement(java.lang.String elementId)
          Removes a tab or column element from the layout.
private  java.lang.String getActiveTab()
           
private  java.util.List getOverridableChannelParams(java.lang.String channelPublishId)
          Finds any parameters in a channel that are determined to be overridable by a user.
private  IUserLayoutManager getUserLayoutManager()
           
private  boolean isColumn(java.lang.String folderId)
          A folder is a column if its parent is a tab element
private  boolean isTab(java.lang.String folderId)
          A folder is a tab if its parent element is the layout element
private  boolean modifyingCurrentUserLayout()
           
private  void moveChannel(java.lang.String sourceChannelSubscribeId, java.lang.String method, java.lang.String destinationElementId)
          Moves a channel from one position in the layout to another.
private  void moveColumn(java.lang.String sourceId, java.lang.String method, java.lang.String destinationId)
          Moves a column from one position in the layout to another.
private  void moveTab(java.lang.String sourceTabId, java.lang.String method, java.lang.String destinationTabId)
           
private  void removeNewColumn()
          This method will remove a column from the user's layout.
private  void renameTab(java.lang.String tabId, java.lang.String tabName)
           
 void renderXML(org.xml.sax.ContentHandler out)
          Ask channel to render its content.
private  void saveUserPreferences()
           
private  void setActiveTab(java.lang.String activeTab)
           
private  void setEvenlyAssignedColumnWidths(org.w3c.dom.NodeList list)
           
 void setPortalControlStructures(PortalControlStructures pcs)
          Passes portal control structure to the channel.
 void setRuntimeData(ChannelRuntimeData rd)
          Passes ChannelRuntimeData to the channel.
 void setStaticData(ChannelStaticData sd)
          Passes ChannelStaticData to the channel.
private  void updateTabLock(java.lang.String elementId, boolean locked)
           
 
Methods inherited from class org.jasig.portal.channels.UserPreferences.BaseState
getRuntimeProperties, receiveEvent, setContext, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

staticData

protected ChannelStaticData staticData

runtimeData

protected ChannelRuntimeData runtimeData

sslLocation

private static final java.lang.String sslLocation
See Also:
Constant Field Values

ulm

private IUserLayoutManager ulm

pcs

private PortalControlStructures pcs

userPrefs

private UserPreferences userPrefs

editedUserProfile

private UserProfile editedUserProfile

ulStore

private static IUserLayoutStore ulStore

set

private StylesheetSet set

action

private java.lang.String action

activeTab

private java.lang.String activeTab

elementID

private java.lang.String elementID

newColumnId

private java.lang.String newColumnId

BLANK_TAB_NAME

protected static java.lang.String BLANK_TAB_NAME

SKINS_PATH

protected static java.lang.String SKINS_PATH

errorMessage

private java.lang.String errorMessage

errorMessageSetActiveTab

private static final java.lang.String errorMessageSetActiveTab
See Also:
Constant Field Values

errorMessageRenameTab

private static final java.lang.String errorMessageRenameTab
See Also:
Constant Field Values

errorMessageMoveTab

private static final java.lang.String errorMessageMoveTab
See Also:
Constant Field Values

errorMessageAddTab

private static final java.lang.String errorMessageAddTab
See Also:
Constant Field Values

errorMessageDeleteTab

private static final java.lang.String errorMessageDeleteTab
See Also:
Constant Field Values

errorMessageLockTab

private static final java.lang.String errorMessageLockTab
See Also:
Constant Field Values

errorMessageUnlockTab

private static final java.lang.String errorMessageUnlockTab
See Also:
Constant Field Values

errorMessageChangeColumnWidths

private static final java.lang.String errorMessageChangeColumnWidths
See Also:
Constant Field Values

errorMessageMoveColumn

private static final java.lang.String errorMessageMoveColumn
See Also:
Constant Field Values

errorMessageNewColumn

private static final java.lang.String errorMessageNewColumn
See Also:
Constant Field Values

errorMessageDeleteColumn

private static final java.lang.String errorMessageDeleteColumn
See Also:
Constant Field Values

errorMessageNewChannel

private static final java.lang.String errorMessageNewChannel
See Also:
Constant Field Values

errorMessageModChannelParams

private static final java.lang.String errorMessageModChannelParams
See Also:
Constant Field Values

errorMessageMoveChannel

private static final java.lang.String errorMessageMoveChannel
See Also:
Constant Field Values

errorMessageDeleteChannel

private static final java.lang.String errorMessageDeleteChannel
See Also:
Constant Field Values
Constructor Detail

TabColumnPrefsState

public TabColumnPrefsState()
                    throws PortalException
Throws:
PortalException

TabColumnPrefsState

public TabColumnPrefsState(CUserPreferences context)
                    throws PortalException
Throws:
PortalException
Method Detail

setStaticData

public void setStaticData(ChannelStaticData sd)
                   throws PortalException
Description copied from interface: IChannel
Passes ChannelStaticData to the channel. This is done during channel instantiation time. see org.jasig.portal.ChannelStaticData

Specified by:
setStaticData in interface IChannel
Overrides:
setStaticData in class BaseState
Parameters:
sd - channel static data
Throws:
PortalException
See Also:
ChannelStaticData

setRuntimeData

public void setRuntimeData(ChannelRuntimeData rd)
                    throws PortalException
Description copied from interface: IChannel
Passes ChannelRuntimeData to the channel. This function is called prior to the renderXML() call.

Specified by:
setRuntimeData in interface IChannel
Overrides:
setRuntimeData in class BaseState
Parameters:
rd - channel runtime data
Throws:
PortalException
See Also:
ChannelRuntimeData

setPortalControlStructures

public void setPortalControlStructures(PortalControlStructures pcs)
                                throws PortalException
Description copied from interface: IPrivileged
Passes portal control structure to the channel.

Specified by:
setPortalControlStructures in interface IPrivileged
Overrides:
setPortalControlStructures in class BaseState
Throws:
PortalException
See Also:
PortalControlStructures

renderXML

public void renderXML(org.xml.sax.ContentHandler out)
               throws PortalException
Description copied from interface: IChannel
Ask channel to render its content.

Specified by:
renderXML in interface IChannel
Overrides:
renderXML in class BaseState
Parameters:
out - the SAX ContentHandler to output content to
Throws:
PortalException

getUserLayoutManager

private final IUserLayoutManager getUserLayoutManager()
                                               throws java.lang.Exception
Throws:
java.lang.Exception

getActiveTab

private final java.lang.String getActiveTab()

setActiveTab

private final void setActiveTab(java.lang.String activeTab)
                         throws java.lang.Exception
Throws:
java.lang.Exception

renameTab

private final void renameTab(java.lang.String tabId,
                             java.lang.String tabName)
                      throws PortalException
Throws:
PortalException

moveTab

private final void moveTab(java.lang.String sourceTabId,
                           java.lang.String method,
                           java.lang.String destinationTabId)
                    throws PortalException
Throws:
PortalException

addTab

private final void addTab(java.lang.String tabName,
                          java.lang.String method,
                          java.lang.String destinationTabId)
                   throws PortalException
Adds a new tab to the layout.

Parameters:
tabName - the name of the tab
method - either insertBefore or appendAfter
destinationTabId - the column to insert the new column before or append after (may actually be a tab)
Throws:
PortalException

removeNewColumn

private final void removeNewColumn()
This method will remove a column from the user's layout. The column will be added into the layout via the "add new column" link within the preferences channel. Clicking on cancel after choosing to add a new column will not remove the column hence the introduction of this method.


addColumn

private final void addColumn(java.lang.String method,
                             java.lang.String destinationElementId)
                      throws java.lang.Exception
Adds a new column into the layout. Before the column is added, a check is done to see whether the destination element is a tab. If it is, a new column is inserted first.

Parameters:
method - either insertBefore or appendAfter
destinationElementId - the column to insert the new column before or append after (may actually be a tab)
Throws:
java.lang.Exception

changeColumnWidths

private final void changeColumnWidths(java.util.HashMap columnWidths)
                               throws java.lang.Exception
Throws:
java.lang.Exception

moveColumn

private final void moveColumn(java.lang.String sourceId,
                              java.lang.String method,
                              java.lang.String destinationId)
                       throws PortalException
Moves a column from one position in the layout to another. Before the move is performed, a check is done to see whether the source and/or destination elements are tabs. If either is a tab, a new column is inserted between it and the channels that it contains before the move is carried out.

Parameters:
sourceId - the column to move (may actually be a tab)
method - either insertBefore or appendAfter
destinationId - the column to insert the new column before or append after (may actually be a tab)
Throws:
PortalException

moveChannel

private final void moveChannel(java.lang.String sourceChannelSubscribeId,
                               java.lang.String method,
                               java.lang.String destinationElementId)
                        throws PortalException
Moves a channel from one position in the layout to another.

Parameters:
sourceChannelSubscribeId - the channel to move
method - either insertBefore or appendAfter
destinationElementId - the ID of the channel to insert the new channel before or append after
Throws:
PortalException

addChannel

private final void addChannel(org.w3c.dom.Element newChannel,
                              java.lang.String position,
                              java.lang.String destinationElementId)
                       throws PortalException
Adds a channel to the layout.

Parameters:
newChannel - the channel to add
position - either before or after
destinationElementId - the ID of the channel to insert the new channel before or append after
Throws:
PortalException

addChannel

private final void addChannel(java.lang.String selectedChannelSubscribeId,
                              java.lang.String position,
                              java.lang.String destinationElementId)
                       throws java.lang.Exception
Adds a channel to the layout.

Parameters:
selectedChannelSubscribeId - the channel to add
position - either before or after
destinationElementId - the ID of the channel to insert the new channel before or append after
Throws:
java.lang.Exception

deleteChannel

private final void deleteChannel(java.lang.String channelSubscribeId)
                          throws java.lang.Exception
Removes a channel element from the layout

Parameters:
channelSubscribeId - the ID attribute of the channel to remove
Throws:
java.lang.Exception

deleteElement

private final void deleteElement(java.lang.String elementId)
                          throws java.lang.Exception
Removes a tab or column element from the layout. To remove a channel element, call deleteChannel().

Parameters:
elementId - the ID attribute of the element to remove
Throws:
java.lang.Exception

setEvenlyAssignedColumnWidths

private void setEvenlyAssignedColumnWidths(org.w3c.dom.NodeList list)
Parameters:
list - as a NodeList that contains all columns in current tab

updateTabLock

private final void updateTabLock(java.lang.String elementId,
                                 boolean locked)
                          throws java.lang.Exception
Throws:
java.lang.Exception

isTab

private final boolean isTab(java.lang.String folderId)
                     throws PortalException
A folder is a tab if its parent element is the layout element

Parameters:
folderId - the id of the folder in question
Returns:
true if the folder is a tab, otherwise false
Throws:
PortalException

isColumn

private final boolean isColumn(java.lang.String folderId)
                        throws PortalException
A folder is a column if its parent is a tab element

Parameters:
folderId - the id of the folder in question
Returns:
true if the folder is a column, otherwise false
Throws:
PortalException

createFolder

private final IUserLayoutFolderDescription createFolder(java.lang.String name)
Creates a folder element with default attributes. This method can be used to create a tab or a column. For tabs, pass the tab name. For column, pass an empty String since column names aren't meaningful

Parameters:
name - the tab name for tabs and an empty string for columns
Returns:
the newly created tab or column

getOverridableChannelParams

private final java.util.List getOverridableChannelParams(java.lang.String channelPublishId)
                                                  throws PortalException
Finds any parameters in a channel that are determined to be overridable by a user.

Parameters:
channelPublishId - an identifier to find the selected channel within the channel registry
Returns:
a list of elements whose override attribute is set to true
Throws:
PortalException

saveUserPreferences

private void saveUserPreferences()
                          throws PortalException
Throws:
PortalException

modifyingCurrentUserLayout

private boolean modifyingCurrentUserLayout()
                                    throws PortalException
Throws:
PortalException