NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
niftk::DataStorageCheckableComboBox Class Reference
Inheritance diagram for niftk::DataStorageCheckableComboBox:
Inheritance graph
[legend]
Collaboration diagram for niftk::DataStorageCheckableComboBox:
Collaboration graph
[legend]

Public Slots

void SetSelectedNode (mitk::DataNode::Pointer item)
 Slot for signal when user wants to set a node as current selected node. More...
 

Signals

void OnSelectionChanged (const mitk::DataNode *)
 Throw a signal when the _DataNode selection changed. More...
 

Public Member Functions

 DataStorageCheckableComboBox (QWidget *parent=0, bool _AutoSelectNewNodes=false)
 Ctor for an empty combobox. Use setDataStorage and setPredicate afterwards. More...
 
 DataStorageCheckableComboBox (mitk::DataStorage *_DataStorage, const mitk::NodePredicateBase *_Predicate, QWidget *parent=0, bool _AutoSelectNewNodes=false)
 Ctor for constructing QmitkDataStorageComboBox with given DataStorageComboBox and given _Predicate. More...
 
 ~DataStorageCheckableComboBox ()
 Standard Dtor. Nothing to do here. More...
 
virtual int Find (const mitk::DataNode *_DataNode) const
 Seaches for a given node and returns a valid index or -1 if the node was not found. More...
 
mitk::DataStorage::Pointer GetDataStorage () const
 Get the DataStorage this ComboBox listens to. More...
 
const
mitk::NodePredicateBase::ConstPointer 
GetPredicate () const
 Return the predicate (may be NULL) that is responsible for the _DataNode selection of this ComboBox. More...
 
virtual mitk::DataNode::Pointer GetNode (int index) const
 Returns the _DataNode at Index index or 0 if the index is out of bounds. More...
 
virtual std::vector
< mitk::DataNode * > 
GetSelectedNodes () const
 Returns all selected nodes, or empty list if there are none. More...
 
mitk::DataStorage::SetOfObjects::ConstPointer GetNodes () const
 Returns all nodes that are stored in this combobox. More...
 
virtual bool GetAutoSelectNewItems ()
 
void SetDataStorage (mitk::DataStorage *dataStorage)
 Set the DataStorage this ComboBox should listen to. More...
 
void SetPredicate (const mitk::NodePredicateBase *_Predicate)
 Set the predicate for this ComboBox. (QmitkDataStorageComboBox is now owner of the predicate) More...
 
virtual void AddNode (const mitk::DataNode *_DataNode)
 
virtual void RemoveNode (int index)
 
virtual void RemoveNode (const mitk::DataNode *_DataNode)
 
virtual void SetNode (int index, const mitk::DataNode *_DataNode)
 
virtual void SetNode (const mitk::DataNode *_DataNode, const mitk::DataNode *_OtherDataNode)
 
virtual void SetAutoSelectNewItems (bool _AutoSelectNewItems)
 
virtual void OnDataNodeDeleteOrModified (const itk::Object *caller, const itk::EventObject &event)
 Called when a node is deleted or the name property of the node was modified. Calls RemoveNode or SetNode then. More...
 

Protected Member Functions

bool HasIndex (unsigned int index) const
 Checks if the given index is within the range of the m_Nodes vector. More...
 
virtual void InsertNode (int index, const mitk::DataNode *_DataNode)
 Inserts a new node at the given index. If the index does not exist, the _DataNode is simply appended to the combobox. More...
 
void Init ()
 Init-function this class with the given dataStorage and _Predicate. This function is called by all ctors. More...
 
virtual void Reset ()
 Reset function whenever datastorage or predicate changes. More...
 

Protected Attributes

mitk::WeakPointer
< mitk::DataStorage > 
m_DataStorage
 
mitk::NodePredicateBase::ConstPointer m_Predicate
 Holds the predicate that is responsible for the _DataNode selection of this ComboBox. If the predicate is 0, every _DataNode will be selected. More...
 
std::vector< mitk::DataNode * > m_Nodes
 
std::vector< long > m_NodesModifiedObserverTags
 Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes) More...
 
std::vector< long > m_NodesDeleteObserverTags
 Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes) More...
 
std::map< mitk::DataNode
*, const mitk::BaseProperty * > 
m_PropertyToNode
 Maps a a specific node to (Name-)property. This is needed because we have to find the assiociated node whenever the name property of a node changed. More...
 
bool m_BlockEvents
 Event function guard. Each function which is called by an event mechanism first checks if this is true in order to avoid endless loops. More...
 
bool m_AutoSelectNewNodes
 If set to "true" new Nodes will be automatically selected. More...
 

Constructor & Destructor Documentation

niftk::DataStorageCheckableComboBox::DataStorageCheckableComboBox ( QWidget *  parent = 0,
bool  _AutoSelectNewNodes = false 
)

Ctor for an empty combobox. Use setDataStorage and setPredicate afterwards.

niftk::DataStorageCheckableComboBox::DataStorageCheckableComboBox ( mitk::DataStorage *  _DataStorage,
const mitk::NodePredicateBase *  _Predicate,
QWidget *  parent = 0,
bool  _AutoSelectNewNodes = false 
)

Ctor for constructing QmitkDataStorageComboBox with given DataStorageComboBox and given _Predicate.

niftk::DataStorageCheckableComboBox::~DataStorageCheckableComboBox ( )

Standard Dtor. Nothing to do here.

Member Function Documentation

void niftk::DataStorageCheckableComboBox::AddNode ( const mitk::DataNode *  _DataNode)
virtual

Adds a node to the ComboBox. Gets called everytime a DataStorage Add Event was thrown.

int niftk::DataStorageCheckableComboBox::Find ( const mitk::DataNode *  _DataNode) const
virtual

Seaches for a given node and returns a valid index or -1 if the node was not found.

bool niftk::DataStorageCheckableComboBox::GetAutoSelectNewItems ( )
virtual

Returns the AutoSelectNewItems.

See also
SetAutoSelectNewItems
mitk::DataStorage::Pointer niftk::DataStorageCheckableComboBox::GetDataStorage ( ) const

Get the DataStorage this ComboBox listens to.

mitk::DataNode::Pointer niftk::DataStorageCheckableComboBox::GetNode ( int  index) const
virtual

Returns the _DataNode at Index index or 0 if the index is out of bounds.

mitk::DataStorage::SetOfObjects::ConstPointer niftk::DataStorageCheckableComboBox::GetNodes ( ) const

Returns all nodes that are stored in this combobox.

const mitk::NodePredicateBase::ConstPointer niftk::DataStorageCheckableComboBox::GetPredicate ( ) const

Return the predicate (may be NULL) that is responsible for the _DataNode selection of this ComboBox.

std::vector< mitk::DataNode * > niftk::DataStorageCheckableComboBox::GetSelectedNodes ( ) const
virtual

Returns all selected nodes, or empty list if there are none.

bool niftk::DataStorageCheckableComboBox::HasIndex ( unsigned int  index) const
protected

Checks if the given index is within the range of the m_Nodes vector.

void niftk::DataStorageCheckableComboBox::Init ( )
protected

Init-function this class with the given dataStorage and _Predicate. This function is called by all ctors.

void niftk::DataStorageCheckableComboBox::InsertNode ( int  index,
const mitk::DataNode *  _DataNode 
)
protectedvirtual

Inserts a new node at the given index. If the index does not exist, the _DataNode is simply appended to the combobox.

This function is used by AddNode() and SetNode() because they just to the same:

  1. If node is replaced (that is when index exists), the itk::Event observer will be removed
  2. Check Node against Predicate
  3. Register for itk::Events on the node
  4. Insert Node and show in combobox

property of the node because this is the only thing we are interested in !!!!!

void niftk::DataStorageCheckableComboBox::OnDataNodeDeleteOrModified ( const itk::Object *  caller,
const itk::EventObject &  event 
)
virtual

Called when a node is deleted or the name property of the node was modified. Calls RemoveNode or SetNode then.

void niftk::DataStorageCheckableComboBox::OnSelectionChanged ( const mitk::DataNode *  )
signal

Throw a signal when the _DataNode selection changed.

void niftk::DataStorageCheckableComboBox::RemoveNode ( int  index)
virtual

Removes a node from the ComboBox at a specified index (if the index exists). Gets called when a DataStorage Remove Event was thrown.

void niftk::DataStorageCheckableComboBox::RemoveNode ( const mitk::DataNode *  _DataNode)
virtual

Removes a node from the ComboBox. Gets called when a DataStorage Remove Event was thrown.

void niftk::DataStorageCheckableComboBox::Reset ( void  )
protectedvirtual

Reset function whenever datastorage or predicate changes.

void niftk::DataStorageCheckableComboBox::SetAutoSelectNewItems ( bool  _AutoSelectNewItems)
virtual

Sets AutoSelectNewItems flag. If set to true new Nodes will be automatically selected. Default is false.

void niftk::DataStorageCheckableComboBox::SetDataStorage ( mitk::DataStorage *  dataStorage)

Set the DataStorage this ComboBox should listen to.

If DataStorage is 0 nothing will be shown. If DataStorage is re-set the combobox will be resetted.

void niftk::DataStorageCheckableComboBox::SetNode ( int  index,
const mitk::DataNode *  _DataNode 
)
virtual

Set a _DataNode in the ComboBox at the specified index (if the index exists). Internally the method just calls RemoveNode(unsigned int)

void niftk::DataStorageCheckableComboBox::SetNode ( const mitk::DataNode *  _DataNode,
const mitk::DataNode *  _OtherDataNode 
)
virtual

Replaces a _DataNode in the combobox by an _OtherDataNode. Internally the method just calls SetNode(unsigned int, mitk::DataNode*)

void niftk::DataStorageCheckableComboBox::SetPredicate ( const mitk::NodePredicateBase *  _Predicate)

Set the predicate for this ComboBox. (QmitkDataStorageComboBox is now owner of the predicate)

If predicate is NULL all nodes will be selected. If predicate changes the whole combobox will be resetted.

void niftk::DataStorageCheckableComboBox::SetSelectedNode ( mitk::DataNode::Pointer  item)
slot

Slot for signal when user wants to set a node as current selected node.

Member Data Documentation

bool niftk::DataStorageCheckableComboBox::m_AutoSelectNewNodes
protected

If set to "true" new Nodes will be automatically selected.

bool niftk::DataStorageCheckableComboBox::m_BlockEvents
protected

Event function guard. Each function which is called by an event mechanism first checks if this is true in order to avoid endless loops.

mitk::WeakPointer<mitk::DataStorage> niftk::DataStorageCheckableComboBox::m_DataStorage
protected

Pointer to the DataStorage from which the nodes are selected (remember: in BlueBerry there might be more than one DataStorage).

std::vector<mitk::DataNode*> niftk::DataStorageCheckableComboBox::m_Nodes
protected

Holds all selected Nodes. Dont hold smart pointer as we are in a GUI class.

std::vector<long> niftk::DataStorageCheckableComboBox::m_NodesDeleteObserverTags
protected

Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes)

std::vector<long> niftk::DataStorageCheckableComboBox::m_NodesModifiedObserverTags
protected

Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes)

mitk::NodePredicateBase::ConstPointer niftk::DataStorageCheckableComboBox::m_Predicate
protected

Holds the predicate that is responsible for the _DataNode selection of this ComboBox. If the predicate is 0, every _DataNode will be selected.

std::map<mitk::DataNode*, const mitk::BaseProperty*> niftk::DataStorageCheckableComboBox::m_PropertyToNode
protected

Maps a a specific node to (Name-)property. This is needed because we have to find the assiociated node whenever the name property of a node changed.


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