MeVisLabToolboxReference
ml::ListContainerBase Class Reference

Abstract module class ListContainerBase implementing basic functionality for a list container module. More...

#include <mlListContainer.h>

Inheritance diagram for ml::ListContainerBase:
ml::Module ml::FieldContainer ml::Base ml::ListContainerTemplate< StringList > ml::ListContainerTemplate< XMarkerList > ml::ListContainerTemplate< T > ml::StringListContainer ml::XMarkerListContainer

List of all members.

Public Types

enum  OverflowModes {
  OvwNone = 0, OvwRemoveFirst, OvwRemoveLast, OvwRemoveAll,
  OvwRemoveNew, OvwNumModes
}
 Mode constants for cases of list size overflow. More...

Public Member Functions

 ListContainerBase ()
 Constructor.
 ListContainerBase (ListBase *listBasePtr, int inputNum, int outputNum)
 Constructor In listBasePtr pass a pointer to the list object, which has to be a member of the derived class.
void setHandleNotificationCB (ListContainerHandleNotificationCB *cb=NULL, void *userData=NULL)
 Set the callback for handleNotification.
BaseFieldgetOutputField ()
 Returns a pointer to the output field.
MLint maxNumItems () const
int overflowMode () const
 Returns the overflow mode.
Host communication
virtual void handleNotification (Field *field)
 Handle field notifications.
virtual void activateAttachments ()
 Update fields after an initialization without handleNotification() called.
virtual void beginSaveFields ()
 Prepare for persistence.
virtual void endSaveFields ()
 Clean up after persistence.
Execute list operations

These methods are called to perform an operation on the list object, e.g.

as a consequence of one of the action fields being pressed. They handle the necessary field updates as well as touching the output list and call deleteItems(), insertItem() and modifyItem() in order to carry out the list modifications themselves. A derived editor module may call these methods in order to perform a list operation.

virtual void doDeleteAll ()
 Delete all list items.
virtual void doDeleteItem (MLssize_t index)
 Delete single item at position index.
virtual void doInsertItem (MLssize_t index, bool fromCurrentItem)
 Insert an item at position index.
virtual void doModifyItem (MLssize_t index, Field *field, bool fromCurrentItem)
 Modify item at position index.
virtual void doCopyItemToTemplate (MLssize_t index)
 Copy values from item at position index to the template fields.
virtual void doClearItem (MLssize_t index)
 Init item at position index.
virtual void doSelectItem (MLssize_t index)
 Select item at position index, or deselect if item == -1.
virtual void doUpdate ()
 Update all fields and touch output list field.

Protected Member Functions

List object access

Most of these methods are overloaded by ListContainerTemplate, but do not have to be overloaded by further derived classes.

virtual ListBasegetInternalList ()=0
 Return address of internal list object.
virtual bool setActiveList (Base *basePtr)=0
 Set the active list (i.e.
virtual bool ownsList ()
 Return true if the active list is the internal list.
virtual MLssize_t getId (MLssize_t index)=0
 Return the item id of the item index.
Handle item property fields

Overload these methods for derived container modules with additional list item property fields.

virtual bool isPropertyField (Field *field)
 Return true if field points to an item property field.
virtual void resetPropertyFields ()
 Reset all property fields.
virtual void updatePropertyFields ()=0
 Update property fields from the current list item.
List modifications

These methods are called when a list operation is performed.

They are overloaded in ListContainerTemplate. The modifyItem() method has to be further overloaded for derived container modules with additional list item properties.

virtual void deleteItems (MLssize_t index, MLssize_t num)=0
 Remove num items, starting at item index.
virtual void insertItem (MLssize_t index, bool fromCurrentItem)=0
 Insert an item at position index.
virtual bool modifyItem (MLssize_t index, Field *field, bool fromCurrentItem)=0
 Modify item at position index.
virtual void copyItemToTemplate (MLssize_t index)=0
 Copy values from item at position index to the template fields.
virtual void copyTemplateToCurrent ()=0
 Copy the values of the templates fields to _currentItem.
virtual void initItem (MLssize_t index)=0
 Initialize the list item at position index.
Handle field updates
virtual void updateListString (bool forceEnable=false)
 Update the list string representing the list content.
virtual void updateDisplay ()
 Update display of list size, current item index and item properties.
virtual void updateActionFields ()
 Update last action fields.
virtual void touchList (ListBase::ActionClass actionClass, MLssize_t id, MLssize_t index)
 Set last list action and touch output list field.

Protected Attributes

int _lockNotification
 Suppress handleNotification() if non-zero.
Field members
BaseField_fldOutputList
 Output list field, initialized by derived class.
BaseField_fldInputList
 Input list field, initialized by derived class.
StringField_fldListString
 String representation of list.
IntField_fldNumItems
 List size.
IntField_fldIndex
 Current list index.
BoolField_fldPersistent
 Activate internal list persistence.
BoolField_fldListStringEnable
 Enable list string field.
BoolField_fldOwnsList
 Reflect owner state (true if internal list is active)
BoolField_fldApplySelect
 Perform a Select-action when index is changed.
IntField_fldId
 List item id.
StringField_fldName
 List item name.
StringField_fldNewName
 List item name.
StringField_fldActionClass
 Action class of last action on list.
IntField_fldActionIndex
 Index of last action on list.
IntField_fldActionId
 Item id of last action on list.
IntField_fldCurrentIndex
 Index of currently selected item.
EnumField_fldOverflowMode
 Overflow mode, specifies which item(s) to delete on overflow.
IntField_fldMaxSize
 Maximum list size.
NotifyField_fldDelete
 Delete button.
NotifyField_fldDeleteAll
 Delete All button.
NotifyField_fldInsert
 Insert button.
NotifyField_fldAdd
 Add (= Append) button.
NotifyField_fldUpdate
 Update button.
BoolField_fldUseInsertTemplate
 If true the container should use the template fields for initializing the inserted item.
NotifyField_fldCopyItemToTemplate
 Copy values from current item to template fields.
NotifyField_fldCopyTemplateToItem
 Copy values from template fields to current item.
NotifyField_fldClearItem
 Clear the current item (i.e. init it again).
BoolField_fldUpToDate
 Indicates that the property values are up to date.

Detailed Description

Abstract module class ListContainerBase implementing basic functionality for a list container module.

Abstract ML module class implementing basic functionality for a list container module. List container modules for a specific list class are derived from this class using the class template ListContainerTemplate. This construct can only be used for list classes derived from BaseListTemplate.

ListContainerBase supports the following functionality:

  • Common list property fields for the number of items, string representation, persistence enable/disable and last action performed on list
  • Common list item property fields for current item index, item id and item name
  • Action fields (buttons) for deleting and inserting items
  • Fields to control the maximum list size (items are deleted on overflow)
  • An output base field pointing to the list controlled by the container module
  • An input base field which allows to attach the container module to an external list object (e.g. to the output base field of a second container). In this case, control is directed to the external list, the internal list is hidden.
  • An internal method interface which allows other viewer or editor modules to be derived (e.g. graphical editor modules)

Definition at line 76 of file mlListContainer.h.


Member Enumeration Documentation

Mode constants for cases of list size overflow.

Enumerator:
OvwNone 
OvwRemoveFirst 

Overflow ignored.

OvwRemoveLast 

First item(s) deleted.

OvwRemoveAll 

Last item(s) deleted.

OvwRemoveNew 

All item(s) deleted.

OvwNumModes 

New item is deleted (not inserted)

Number of mode constants

Definition at line 159 of file mlListContainer.h.


Constructor & Destructor Documentation

ml::ListContainerBase::ListContainerBase ( ) [inline]

Constructor.

Definition at line 82 of file mlListContainer.h.

ml::ListContainerBase::ListContainerBase ( ListBase listBasePtr,
int  inputNum,
int  outputNum 
)

Constructor In listBasePtr pass a pointer to the list object, which has to be a member of the derived class.

The values inputNum and outputNum specify the number of input and output image fields, resp.


Member Function Documentation

virtual void ml::ListContainerBase::activateAttachments ( ) [virtual]

Update fields after an initialization without handleNotification() called.

Reimplemented from ml::FieldContainer.

virtual void ml::ListContainerBase::beginSaveFields ( ) [virtual]

Prepare for persistence.

Reimplemented from ml::Module.

virtual void ml::ListContainerBase::copyItemToTemplate ( MLssize_t  index) [protected, pure virtual]

Copy values from item at position index to the template fields.

Implemented in ml::ListContainerTemplate< T >, ml::XMarkerListContainer, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.

virtual void ml::ListContainerBase::copyTemplateToCurrent ( ) [protected, pure virtual]
virtual void ml::ListContainerBase::deleteItems ( MLssize_t  index,
MLssize_t  num 
) [protected, pure virtual]
virtual void ml::ListContainerBase::doClearItem ( MLssize_t  index) [virtual]

Init item at position index.

virtual void ml::ListContainerBase::doCopyItemToTemplate ( MLssize_t  index) [virtual]

Copy values from item at position index to the template fields.

virtual void ml::ListContainerBase::doDeleteAll ( ) [virtual]

Delete all list items.

virtual void ml::ListContainerBase::doDeleteItem ( MLssize_t  index) [virtual]

Delete single item at position index.

virtual void ml::ListContainerBase::doInsertItem ( MLssize_t  index,
bool  fromCurrentItem 
) [virtual]

Insert an item at position index.

If fromCurrentItem is true, the new item is initialized from the _currentItem member of the derived ListContainerTemplate class.

virtual void ml::ListContainerBase::doModifyItem ( MLssize_t  index,
Field field,
bool  fromCurrentItem 
) [virtual]

Modify item at position index.

If fromCurrentItem is true, the item is copied from the _currentItem member of the derived ListContainerTemplate class, otherwise the item property corresponding to the property field field is modified.

virtual void ml::ListContainerBase::doSelectItem ( MLssize_t  index) [virtual]

Select item at position index, or deselect if item == -1.

virtual void ml::ListContainerBase::doUpdate ( ) [virtual]

Update all fields and touch output list field.

virtual void ml::ListContainerBase::endSaveFields ( ) [virtual]

Clean up after persistence.

Reimplemented from ml::Module.

virtual MLssize_t ml::ListContainerBase::getId ( MLssize_t  index) [protected, pure virtual]
virtual ListBase* ml::ListContainerBase::getInternalList ( ) [protected, pure virtual]
BaseField* ml::ListContainerBase::getOutputField ( ) [inline]

Returns a pointer to the output field.

Definition at line 153 of file mlListContainer.h.

virtual void ml::ListContainerBase::handleNotification ( Field field) [virtual]

Handle field notifications.

Reimplemented from ml::Module.

virtual void ml::ListContainerBase::initItem ( MLssize_t  index) [protected, pure virtual]

Initialize the list item at position index.

This method is called by insertItem() if the fromCurrentItem argument is false.

Implemented in ml::ListContainerTemplate< T >, ml::XMarkerListContainer, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.

virtual void ml::ListContainerBase::insertItem ( MLssize_t  index,
bool  fromCurrentItem 
) [protected, pure virtual]

Insert an item at position index.

If fromCurrentItem is true, the new item is initialized from the _currentItem member of the derived ListContainerTemplate class.

Implemented in ml::ListContainerTemplate< T >, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.

virtual bool ml::ListContainerBase::isPropertyField ( Field field) [protected, virtual]

Return true if field points to an item property field.

Reimplemented in ml::XMarkerListContainer.

MLint ml::ListContainerBase::maxNumItems ( ) const [inline]

Definition at line 156 of file mlListContainer.h.

virtual bool ml::ListContainerBase::modifyItem ( MLssize_t  index,
Field field,
bool  fromCurrentItem 
) [protected, pure virtual]

Modify item at position index.

If fromCurrentItem is true, the item is copied from the _currentItem member of the derived ListContainerTemplate class, otherwise the item property corresponding to the property field field is modified. Return true if item has been modified.

Implemented in ml::ListContainerTemplate< T >, ml::XMarkerListContainer, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.

int ml::ListContainerBase::overflowMode ( ) const [inline]

Returns the overflow mode.

Definition at line 170 of file mlListContainer.h.

virtual bool ml::ListContainerBase::ownsList ( ) [inline, protected, virtual]

Return true if the active list is the internal list.

Definition at line 190 of file mlListContainer.h.

virtual void ml::ListContainerBase::resetPropertyFields ( ) [protected, virtual]

Reset all property fields.

Reimplemented in ml::XMarkerListContainer.

virtual bool ml::ListContainerBase::setActiveList ( Base basePtr) [protected, pure virtual]

Set the active list (i.e.

the list controlled by the container) to the object *basePtr, provided that it is of the correct type. If not, the active list pointer should be set to zero, which disables the container. Returns true if object is of correct type.

Implemented in ml::ListContainerTemplate< T >, ml::ListContainerTemplate< XMarkerList >, and ml::ListContainerTemplate< StringList >.

void ml::ListContainerBase::setHandleNotificationCB ( ListContainerHandleNotificationCB cb = NULL,
void *  userData = NULL 
)

Set the callback for handleNotification.

virtual void ml::ListContainerBase::touchList ( ListBase::ActionClass  actionClass,
MLssize_t  id,
MLssize_t  index 
) [protected, virtual]

Set last list action and touch output list field.

Arguments id and index are ignored for all actions except those inducing a delete (ActDelete and ActInsertOvw). A derived viewer or editor module may overload this method in order to be notified of changes to the active list. In the overloaded method, first call ListContainerBase::touchList() and then use the list's getAction() method to obtain details on the action performed.

virtual void ml::ListContainerBase::updateActionFields ( ) [protected, virtual]

Update last action fields.

virtual void ml::ListContainerBase::updateDisplay ( ) [protected, virtual]

Update display of list size, current item index and item properties.

virtual void ml::ListContainerBase::updateListString ( bool  forceEnable = false) [protected, virtual]

Update the list string representing the list content.

If forceEnable is true, the string is generated regardless of the _fldListStringEnable field.

virtual void ml::ListContainerBase::updatePropertyFields ( ) [protected, pure virtual]

Member Data Documentation

Action class of last action on list.

Definition at line 293 of file mlListContainer.h.

Item id of last action on list.

Definition at line 295 of file mlListContainer.h.

Index of last action on list.

Definition at line 294 of file mlListContainer.h.

Add (= Append) button.

Definition at line 304 of file mlListContainer.h.

Perform a Select-action when index is changed.

Definition at line 287 of file mlListContainer.h.

Clear the current item (i.e. init it again).

Definition at line 310 of file mlListContainer.h.

Copy values from current item to template fields.

Definition at line 308 of file mlListContainer.h.

Copy values from template fields to current item.

Definition at line 309 of file mlListContainer.h.

Index of currently selected item.

Definition at line 296 of file mlListContainer.h.

Delete button.

Definition at line 301 of file mlListContainer.h.

Delete All button.

Definition at line 302 of file mlListContainer.h.

List item id.

Definition at line 289 of file mlListContainer.h.

Current list index.

Definition at line 282 of file mlListContainer.h.

Input list field, initialized by derived class.

Definition at line 278 of file mlListContainer.h.

Referenced by ml::ListContainerTemplate< T >::ListContainerTemplate().

Insert button.

Definition at line 303 of file mlListContainer.h.

String representation of list.

Definition at line 280 of file mlListContainer.h.

Enable list string field.

Definition at line 285 of file mlListContainer.h.

Maximum list size.

Definition at line 299 of file mlListContainer.h.

List item name.

Definition at line 290 of file mlListContainer.h.

List item name.

Definition at line 291 of file mlListContainer.h.

List size.

Definition at line 281 of file mlListContainer.h.

Output list field, initialized by derived class.

Definition at line 277 of file mlListContainer.h.

Referenced by ml::ListContainerTemplate< T >::ListContainerTemplate().

Overflow mode, specifies which item(s) to delete on overflow.

Definition at line 298 of file mlListContainer.h.

Reflect owner state (true if internal list is active)

Definition at line 286 of file mlListContainer.h.

Activate internal list persistence.

Definition at line 284 of file mlListContainer.h.

Update button.

Definition at line 305 of file mlListContainer.h.

Indicates that the property values are up to date.

Definition at line 312 of file mlListContainer.h.

If true the container should use the template fields for initializing the inserted item.

Definition at line 307 of file mlListContainer.h.


The documentation for this class was generated from the following file: