com.sas.commands.dataselectors
Class BaseSelectorCommand

com.sas.commands.dataselectors.BaseSelectorCommand
All Implemented Interfaces:
CancelInterface, ContentsChangedInterface, DataSelectorCommandInterface, DynamicAttributeCommandInterface, PendingCommandInterface, BaseEntityInterface, BaseEntityValueInterface, EntityKeyInterface, com.sas.lang.StringDataInterface, com.sas.PublicClonable, com.sas.util.Command, com.sas.util.SimpleCommand, java.lang.Cloneable, java.rmi.Remote
Direct Known Subclasses:
AdvancedFilterSelectorCommand, AdvancedFilterSelectorCommandFacade, DataItemSelectorCommand, ExceptionHighlightingChartCommand, ExceptionHighlightingCommand, ExportSelectorCommand, FilterAndRankSelectorCommand, FindSelectorCommand, FormatSelectorCommand, MapPropertyCommand, MemberPropertiesCommand, OLAPSortSelectorCommand, OLAPTimeBasedFilterCommand, PercentCalculationsCommand, RankingCommand, ShowDetailSelectorCommand, SimpleCalculatedItemSelectorCommand, SortCommand, SortSelectorCommand, TotalsCommand

public class BaseSelectorCommand
implements DataSelectorCommandInterface, PendingCommandInterface, ContentsChangedInterface

This class will provide the base functionality for all selector commands.


Field Summary
protected  java.lang.String actionClass
           
static java.lang.String CANCEL_MODE
          Cancel mode indicates the user has canceled his/her changes.
static java.lang.String COMMIT_MODE
          Commit mode indicates the user wants to commit his/her changes.
protected  boolean complete
           
protected  boolean contentsChanged
           
protected  java.util.HashMap eventInfo
           
protected  java.lang.Object eventSource
           
protected  boolean modal
           
protected  java.lang.String mode
          The current mode the command is executing in.
protected  java.lang.Object model
           
static java.lang.String PROCESS_MODE
          Process mode is used throughout the interaction with the user.
protected  DataSelectorInterface selector
          The selector associated with this command.
protected  java.lang.Object selectorModel
           
static java.lang.String SHOW_MODE
          The show mode indicates the selector is to be written to the page in full.
 
Fields inherited from interface com.sas.commands.DynamicAttributeCommandInterface
COMMAND_NAME_PREFIX
 
Constructor Summary
BaseSelectorCommand()
          Default constructor
BaseSelectorCommand(java.lang.String name)
          Constructor that accepts a command name.
BaseSelectorCommand(java.lang.String name, java.lang.String actionClass)
          Constructor that accepts a command name and an action class type.
 
Method Summary
 void cancel()
          Cancels the command.
 void cancel(java.lang.Object o)
           
protected  void closeSelector()
          Inform the selector that the a commit or cancel has occured.
protected  void commit(java.lang.Object o)
           
 void execute(java.lang.Object o)
          This method implements the execute method on the CommandInterface, which is not implemented by the abstract BaseCommand class.
 java.util.HashMap getEventInfo()
          Returns a HashMap with information about the pending ContentsChangedEvent or null if no event is pending.
 java.lang.Object getEventSource()
          Returns the source of a pending ContentsChangedEvent event.
 java.lang.String getMode()
          Gets the current mode of execution for this command.
 java.lang.Object getModel()
          Gets the data model being viewed or manipulated by the selector.
 DataSelectorInterface getSelector()
          Gets the parent selector for this command.
 java.lang.Object getSelectorModel()
          Gets the model used internally by the selector.
 boolean isComplete()
          Returns a boolean indicating whether the command has been explicitly committed or cancelled.
 boolean isContentsChanged()
          Returns true if a ContentsChangedEvent should be generated, false otherwise.
 boolean isModal()
           
protected  void process(java.lang.Object o)
           
 void setComplete(boolean complete)
          Set the boolean indicating whether the command has been explicitly committed or cancelled.
 void setModal(boolean modal)
           
 void setMode(java.lang.String value)
          Sets the mode of execution for this command.
 void setModel(java.lang.Object model)
          Sets the data model being viewed or manipulated by the selector.
 void setSelector(DataSelectorInterface value)
          Sets the command's reference to it's parent selector.
 void setSelectorModel(java.lang.Object value)
          Sets the model used internally by the selector.
protected  void show(java.lang.Object o)
           
 
Methods inherited from class com.sas.commands.BaseCommand
getLocale, getName, getNextCommandName, getText, isExecutable, isUndoable, setLocale, setName, setText, undo
 
Methods inherited from class com.sas.entities.BaseEntity
clone, containsAttributeNamed, equals, equals, getAttribute, getAttribute, getAttributeCount, getAttributes, getEntityKey, getPropertyDescriptors, getStringAttribute, listAttributeNames, removeAllAttributes, removeAttribute, reset, sameEntity, setAttribute, setAttributes, setEntityKey, toString
 
Methods inherited from interface com.sas.entities.BaseEntityValueInterface
getAttribute, setAttribute
 
Methods inherited from interface com.sas.util.Command
clone
 

Field Detail

model

protected java.lang.Object model

selectorModel

protected java.lang.Object selectorModel

eventInfo

protected java.util.HashMap eventInfo

contentsChanged

protected boolean contentsChanged

eventSource

protected java.lang.Object eventSource

complete

protected boolean complete

modal

protected boolean modal

SHOW_MODE

public static final java.lang.String SHOW_MODE
The show mode indicates the selector is to be written to the page in full.

See Also:
Constant Field Values

PROCESS_MODE

public static final java.lang.String PROCESS_MODE
Process mode is used throughout the interaction with the user.

See Also:
Constant Field Values

CANCEL_MODE

public static final java.lang.String CANCEL_MODE
Cancel mode indicates the user has canceled his/her changes.

See Also:
Constant Field Values

COMMIT_MODE

public static final java.lang.String COMMIT_MODE
Commit mode indicates the user wants to commit his/her changes.

See Also:
Constant Field Values

selector

protected DataSelectorInterface selector
The selector associated with this command.


mode

protected java.lang.String mode
The current mode the command is executing in.


actionClass

protected java.lang.String actionClass
Constructor Detail

BaseSelectorCommand

public BaseSelectorCommand()
Default constructor


BaseSelectorCommand

public BaseSelectorCommand(java.lang.String name)
Constructor that accepts a command name.

Parameters:
name - the name for this command

BaseSelectorCommand

public BaseSelectorCommand(java.lang.String name,
                           java.lang.String actionClass)
Constructor that accepts a command name and an action class type.

Parameters:
name - the name for this command
actionClass - the class name of the associated action
Method Detail

execute

public void execute(java.lang.Object o)
This method implements the execute method on the CommandInterface, which is not implemented by the abstract BaseCommand class.

Specified by:
execute in interface DataSelectorCommandInterface
Specified by:
execute in interface com.sas.util.SimpleCommand
Specified by:
execute in class BaseCommand
Parameters:
o - ignored by the default implementation

show

protected void show(java.lang.Object o)

process

protected void process(java.lang.Object o)

cancel

public void cancel(java.lang.Object o)

cancel

public void cancel()
Description copied from interface: CancelInterface
Cancels the command.

Common things done in this method:

Specified by:
cancel in interface CancelInterface

commit

protected void commit(java.lang.Object o)
               throws java.io.IOException
Throws:
java.io.IOException

setModel

public void setModel(java.lang.Object model)
Sets the data model being viewed or manipulated by the selector.

Specified by:
setModel in interface DataSelectorCommandInterface
Parameters:
model - the model

getModel

public java.lang.Object getModel()
Gets the data model being viewed or manipulated by the selector.

Specified by:
getModel in interface DataSelectorCommandInterface
Returns:
the data model

setSelectorModel

public void setSelectorModel(java.lang.Object value)
Sets the model used internally by the selector.

Parameters:
value - the selector's model

getSelectorModel

public java.lang.Object getSelectorModel()
Gets the model used internally by the selector.

Returns:
the selector's model

setSelector

public void setSelector(DataSelectorInterface value)
Sets the command's reference to it's parent selector.

Specified by:
setSelector in interface DataSelectorCommandInterface
Parameters:
value - the selector associated with this command

getSelector

public DataSelectorInterface getSelector()
Gets the parent selector for this command.

Specified by:
getSelector in interface DataSelectorCommandInterface
Returns:
the selector associated with this command

setMode

public void setMode(java.lang.String value)
Sets the mode of execution for this command. The mode is evaluated during the execute() method to determine what code in the command to process. Modes supported by this base implementation are defined as the constants SHOW_MODE, PROCESS_MODE, COMMIT_MODE, and CANCEL_MODE.

Parameters:
value - the mode for this command

getMode

public java.lang.String getMode()
Gets the current mode of execution for this command.

Returns:
the current mode

isContentsChanged

public boolean isContentsChanged()
Returns true if a ContentsChangedEvent should be generated, false otherwise.

Specified by:
isContentsChanged in interface ContentsChangedInterface
Returns:
true if a ContentsChangedEvent should be generated, false otherwise.

getEventInfo

public java.util.HashMap getEventInfo()
Returns a HashMap with information about the pending ContentsChangedEvent or null if no event is pending.

Specified by:
getEventInfo in interface ContentsChangedInterface
Returns:
event information

getEventSource

public java.lang.Object getEventSource()
Returns the source of a pending ContentsChangedEvent event. The source will be null if no event is pending.

Specified by:
getEventSource in interface ContentsChangedInterface
Returns:
the source of the event

isComplete

public boolean isComplete()
Returns a boolean indicating whether the command has been explicitly committed or cancelled.

Specified by:
isComplete in interface PendingCommandInterface
Returns:
a boolean indicating whether the command has been explicitly committed or cancelled.

setComplete

public void setComplete(boolean complete)
Set the boolean indicating whether the command has been explicitly committed or cancelled.

Parameters:
complete - the boolean indicating whether the command has been explicitly committed or cancelled.

isModal

public boolean isModal()

setModal

public void setModal(boolean modal)

closeSelector

protected void closeSelector()
Inform the selector that the a commit or cancel has occured.

If getSelector method returns an instanceof the SelectorCloseInterface, this method will call its close method.




Copyright © 2009 SAS Institute Inc. All Rights Reserved.