org.opencms.workplace.list
Class A_CmsListTwoStatesAction

java.lang.Object
  extended byorg.opencms.workplace.tools.A_CmsHtmlIconButton
      extended byorg.opencms.workplace.list.A_CmsListAction
          extended byorg.opencms.workplace.list.CmsListDirectAction
              extended byorg.opencms.workplace.list.A_CmsListToggleAction
                  extended byorg.opencms.workplace.list.A_CmsListTwoStatesAction
All Implemented Interfaces:
I_CmsHtmlIconButton, I_CmsListAction, I_CmsListDirectAction

public abstract class A_CmsListTwoStatesAction
extends A_CmsListToggleAction

Abstract implementation of a two state action for a html list.

You have to extend this class and implement the A_CmsListToggleAction.selectAction() method, where you can use the getCms() to access the cms context.

Since:
6.0.0
Version:
$Revision: 1.8 $
Author:
Michael Moossen

Field Summary
 
Fields inherited from class org.opencms.workplace.tools.A_CmsHtmlIconButton
EMPTY_MESSAGE, m_id
 
Constructor Summary
protected A_CmsListTwoStatesAction(String id, CmsObject cms)
          Default Constructor.
 
Method Summary
 String confirmationTextHtml(CmsWorkplace wp)
          Generates a confirmation text div tag, to use in lists where all items use the same confirmation text.
 CmsObject getCms()
          Returns the cms context object.
 I_CmsListDirectAction getFirstAction()
          Returns the first Action.
 I_CmsListDirectAction getSecondAction()
          Returns the second Action.
 String helpTextHtml(CmsWorkplace wp)
          Generates a help text div tag, to use in lists where all items use the same help text.
 void setFirstAction(I_CmsListDirectAction firstAction)
          Sets the first Action.
 void setItem(CmsListItem item)
          Sets the current item, should be called before the CmsListDirectAction.buttonHtml(org.opencms.workplace.CmsWorkplace) method.
 void setSecondAction(I_CmsListDirectAction secondAction)
          Sets the second Action.
 
Methods inherited from class org.opencms.workplace.list.A_CmsListToggleAction
getColumn, getConfirmationMessage, getHelpText, getIconPath, getId, getName, isEnabled, selectAction
 
Methods inherited from class org.opencms.workplace.list.CmsListDirectAction
buttonHtml, getItem, setColumn
 
Methods inherited from class org.opencms.workplace.list.A_CmsListAction
defaultConfirmationHtml, getListId, setConfirmationMessage, setListId
 
Methods inherited from class org.opencms.workplace.tools.A_CmsHtmlIconButton
defaultButtonHtml, defaultButtonHtml, defaultHelpHtml, setEnabled, setHelpText, setIconPath, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opencms.workplace.list.I_CmsListAction
getListId, setConfirmationMessage, setListId
 
Methods inherited from interface org.opencms.workplace.tools.I_CmsHtmlIconButton
setEnabled, setHelpText, setIconPath, setName
 

Constructor Detail

A_CmsListTwoStatesAction

protected A_CmsListTwoStatesAction(String id,
                                   CmsObject cms)
Default Constructor.

Be careful while using the cms object to select the proper action, this cms object will be set only once the first time the action is needed, after that every user/session that may access to this action will be using the same cms object.

So use only methods that do not need role checks and those that do not are current user dependent.

Parameters:
id - the unique id
cms - the cms context
Method Detail

confirmationTextHtml

public String confirmationTextHtml(CmsWorkplace wp)
Description copied from interface: I_CmsListDirectAction
Generates a confirmation text div tag, to use in lists where all items use the same confirmation text.

Specified by:
confirmationTextHtml in interface I_CmsListDirectAction
Overrides:
confirmationTextHtml in class CmsListDirectAction
See Also:
CmsListDirectAction.confirmationTextHtml(org.opencms.workplace.CmsWorkplace)

getCms

public CmsObject getCms()
Returns the cms context object.

Returns:
the cms context

getFirstAction

public I_CmsListDirectAction getFirstAction()
Returns the first Action.

Returns:
the first Action

getSecondAction

public I_CmsListDirectAction getSecondAction()
Returns the second Action.

Returns:
the second Action

helpTextHtml

public String helpTextHtml(CmsWorkplace wp)
Description copied from interface: I_CmsListDirectAction
Generates a help text div tag, to use in lists where all items use the same help text.

Specified by:
helpTextHtml in interface I_CmsListDirectAction
Overrides:
helpTextHtml in class CmsListDirectAction
See Also:
CmsListDirectAction.helpTextHtml(org.opencms.workplace.CmsWorkplace)

setFirstAction

public void setFirstAction(I_CmsListDirectAction firstAction)
Sets the first Action.

Parameters:
firstAction - the activation Action to set

setItem

public void setItem(CmsListItem item)
Description copied from interface: I_CmsListDirectAction
Sets the current item, should be called before the I_CmsHtmlIconButton.buttonHtml(org.opencms.workplace.CmsWorkplace) method.

Specified by:
setItem in interface I_CmsListDirectAction
Overrides:
setItem in class CmsListDirectAction
See Also:
CmsListDirectAction.setItem(org.opencms.workplace.list.CmsListItem)

setSecondAction

public void setSecondAction(I_CmsListDirectAction secondAction)
Sets the second Action.

Parameters:
secondAction - the second Action to set