org.riotfamily.riot.list.command
Interface Command

All Known Subinterfaces:
BatchCommand
All Known Implementing Classes:
AbstractCommand, AddCommand, ChooseCommand, CopyCommand, CutCommand, CutPageCommand, DeleteCommand, DeletePageCommand, DescendCommand, DialogCommand, DiscardPageCommand, EditCommand, EditPageCommand, ExportCommand, GotoPageCommand, GotoSiteCommand, LinkCommand, PasteCommand, PastePageCommand, PopupCommand, PreviewCommand, PublishPageCommand, RefreshCommand, ShowChildPagesCommand, StepIntoCommand, SwapCommand, SwapPageCommand, TranslatePageCommand, UnpublishPageCommand, ViewCommand

public interface Command

Interface to be implemented by classes that perform operations on lists or list items. NOTE: Implementations must be thread-safe.


Method Summary
 CommandResult execute(CommandContext context)
          Executes the command.
 String getAction()
           
 String getConfirmationMessage(CommandContext context)
          Returns a localized message that is displayed to the user asking for a confirmation.
 String getId()
          Returns a unique identifier used to reference the command.
 String getItemStyleClass(CommandContext context)
          Returns a CSS class that is added to the list of class names of the whole item/row.
 String getLabel(MessageResolver messageResolver)
           
 String getStyleClass()
          Returns the CSS class that is assigned to command's HTML element and therefore defines which icon is displayed.
 boolean isEnabled(CommandContext context)
          Implementors may inspect the given context to decide whether the command should be enabled.
 boolean isShowOnForm()
          Returns whether the command should be shown beside the form.
 void setId(String id)
          Sets a unique identifier used to reference the command.
 

Method Detail

getId

String getId()
Returns a unique identifier used to reference the command.


setId

void setId(String id)
Sets a unique identifier used to reference the command.


getAction

String getAction()

execute

CommandResult execute(CommandContext context)
Executes the command.


getConfirmationMessage

String getConfirmationMessage(CommandContext context)
Returns a localized message that is displayed to the user asking for a confirmation. Implementors may return null if no confirmation is needed. Otherwise a dialog containing an Ok and a Cancel button is displayed. If the user clicks Ok the command is executed otherwise no action takes place.


isEnabled

boolean isEnabled(CommandContext context)
Implementors may inspect the given context to decide whether the command should be enabled. Commands don't need to check the policy since commands will be automatically disabled if the action returned by getAction() is denied.


isShowOnForm

boolean isShowOnForm()
Returns whether the command should be shown beside the form.


getLabel

String getLabel(MessageResolver messageResolver)

getStyleClass

String getStyleClass()
Returns the CSS class that is assigned to command's HTML element and therefore defines which icon is displayed. If no class is set, the default implementation will return the action instead.


getItemStyleClass

String getItemStyleClass(CommandContext context)
Returns a CSS class that is added to the list of class names of the whole item/row. The default implementation always returns null. Subclasses may override this method to highlight a list item depending on the context.