rwlogo

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

List of all members | Public Member Functions
IlvChangeValueCommand Class Reference

A command class for storing simple attribute changes made to an object of the class IlvValueInterface. More...

#include <ilviews/base/command.h>

Inheritance diagram for IlvChangeValueCommand:
IlvCommand IlvAction

Public Member Functions

 IlvChangeValueCommand (IlvActionHistory *h=0, IlUInt n=0, const IlvValue *af=0, IlvValueInterface *o=0, const IlvValue *bf=0)
 Constructor. More...
 
virtual void executeIt ()
 Executes the action (internal interface). More...
 
IlvValueInterface * getObject () const
 Returns the object to which the command applies. More...
 
const IlvValuegetValue (IlBoolean b, IlUInt i) const
 Returns the ith value stored in the command. More...
 
virtual void snapshot (IlvValueInterface *o, const IlSymbol *s, IlBoolean before=IlTrue)
 Queries the specified value and records it. More...
 
virtual void undoIt ()
 Implements the undo behavior. More...
 
IlString userName () const
 Returns the name of the action in a readable form. More...
 
- Public Member Functions inherited from IlvCommand
 IlvCommand (IlvActionHistory *h=0, IlvUndoabilityReason u=notImplemented, IlBoolean ps=IlFalse, IlBoolean r=IlTrue, IlBoolean p=IlFalse)
 Constructor. More...
 
IlBoolean isPseudoCommand () const
 Is set to IlTrue if the command is a pseudocommand. More...
 
IlvUndoabilityReason isUndoable () const
 Indicates whether the command can be undone, and tells why if it cannot. More...
 
virtual void redo ()
 Redoes a command that was previously undone. More...
 
virtual void undo ()
 Undoes a command. More...
 
- Public Member Functions inherited from IlvAction
 IlvAction (IlvActionHistory *h=0, IlBoolean r=IlTrue, IlBoolean p=IlFalse)
 Constructor. More...
 
 IlvAction (const IlvAction &a)
 Copy constructor used to repeat actions. More...
 
virtual IlvActionduplicate () const
 Must be implemented in subclasses for the action to be repeatable. More...
 
virtual IlString errorMessage (IlUInt &severity) const
 Returns an error message. More...
 
virtual void execute ()
 Executes the action (external interface). More...
 
IlvActionHistorygetContext () const
 Returns the action history of the action or command. More...
 
IlBoolean isCommand () const
 Indicates whether an action is an IlvCommand object. More...
 
IlBoolean isDone () const
 Indicates whether the execute method has already been called for this action. More...
 
IlBoolean isRepeatable () const
 Indicates whether an action can be repeated. More...
 
virtual void setContext (IlvActionHistory *history)
 Sets the execution context and the history of an action. More...
 
void setDone (IlBoolean d=IlTrue)
 Specifies whether a command or action should be considered as being executed. More...
 

Additional Inherited Members

- Public Attributes inherited from IlvAction
IlvActionFlags _flags
 Action flags. Can be set directly by subclasses to change the status of the action.
 

Detailed Description

A command class for storing simple attribute changes made to an object of the class IlvValueInterface.

Library: views

Instances of IlvChangeValueCommand are used internally by IlvValueInterface::beforeChangeValues and IlvValueInterface::afterChangeValues to keep track of any value changes and store them in the current command history attached to a given value interface. If the flag recordValueChanges is IlTrue, all change value calls produce a change value object that will be added to the stack of executed commands. This process works by storing the value before and after it is modified.

See Also
IlvActionHistory, IlvCommand, IlvCommandHistory

Constructor & Destructor Documentation

IlvChangeValueCommand::IlvChangeValueCommand ( IlvActionHistory h = 0,
IlUInt  n = 0,
const IlvValue af = 0,
IlvValueInterface *  o = 0,
const IlvValue bf = 0 
)

Constructor.

All these parameters are optional.

Parameters
hThe context to which the command applies.
nThe number of changed values.
afThe values after the command has been executed
oThe object to which the change of values is applied.
bfThe values before the command has been executed.

Member Function Documentation

virtual void IlvChangeValueCommand::executeIt ( )
virtual

Executes the action (internal interface).

This method must be implemented in subclasses to execute the action.

Implements IlvAction.

IlvValueInterface* IlvChangeValueCommand::getObject ( ) const

Returns the object to which the command applies.

Returns
The object that the command applies to.
const IlvValue& IlvChangeValueCommand::getValue ( IlBoolean  b,
IlUInt  i 
) const

Returns the ith value stored in the command.

Parameters
bIf set to IlTrue, the returned value is that of the object before the command is executed. Otherwise, it is the value of the object after the command is executed.
iThe index of the value in the array of stored values.
virtual void IlvChangeValueCommand::snapshot ( IlvValueInterface *  o,
const IlSymbol s,
IlBoolean  before = IlTrue 
)
virtual

Queries the specified value and records it.

Parameters
oThe object to which the command applies.
sThe name of the value that is to be recorded.
beforeIf set to IlTrue, the command is considered as not executed. In this case, the snapshot is the state to which the undo method will revert the object. If set to IlFalse, the snapshot is the state to which the execute and redo methods should set the object.
virtual void IlvChangeValueCommand::undoIt ( )
virtual

Implements the undo behavior.

This method should be redefined in subclasses to cancel the executeIt method.

Reimplemented from IlvCommand.

IlString IlvChangeValueCommand::userName ( ) const
virtual

Returns the name of the action in a readable form.

By default, the method userName searches the default message database of the display for an entry of the form '&<ActionClass>', and returns the string found.

Reimplemented from IlvAction.


© Copyright 2014, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.