Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes

QmitkDataStorageComboBox Class Reference
[Widgets]

Displays all or a subset (defined by a predicate) of nodes of the Data Storage. More...

#include <QmitkDataStorageComboBox.h>

Collaboration diagram for QmitkDataStorageComboBox:
Collaboration graph
[legend]

List of all members.

Public Slots

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

Signals

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

Public Member Functions

 QmitkDataStorageComboBox (QWidget *parent=0, bool _AutoSelectNewNodes=false)
 Ctor for an empty combobox. Use setDataStorage and setPredicate afterwards.
 QmitkDataStorageComboBox (mitk::DataStorage *_DataStorage, const mitk::NodePredicateBase *_Predicate, QWidget *parent=0, bool _AutoSelectNewNodes=false)
 Ctor for constructing QmitkDataStorageComboBox with given DataStorageComboBox and given _Predicate.
 ~QmitkDataStorageComboBox ()
 Standard Dtor. Nothing to do here.
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.
mitk::DataStorage::Pointer GetDataStorage () const
 Get the DataStorage this ComboBox listens to.
const
mitk::NodePredicateBase::ConstPointer 
GetPredicate () const
 Return the predicate (may be NULL) that is responsible for the _DataNode selection of this ComboBox.
mitk::DataNode::Pointer GetNode (int index) const
 Returns the _DataNode at Index index or 0 if the index is out of bounds.
mitk::DataNode::Pointer GetSelectedNode () const
 Returns the selected _DataNode or 0 if there is none.
mitk::DataStorage::SetOfObjects::ConstPointer GetNodes () const
 Returns all nodes that are stored in this combobox.
virtual bool GetAutoSelectNewItems ()
void SetDataStorage (mitk::DataStorage *dataStorage)
 Set the DataStorage this ComboBox should listen to.
void SetPredicate (const mitk::NodePredicateBase *_Predicate)
 Set the predicate for this ComboBox. (QmitkDataStorageComboBox is now owner of the predicate)
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.

Protected Slots

void OnCurrentIndexChanged (int)
 Slot for signal when the user selects another item.

Protected Member Functions

bool HasIndex (unsigned int index) const
 Checks if the given index is within the range of the m_Nodes vector.
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.
void Init ()
 Init-function this class with the given dataStorage and _Predicate. This function is called by all ctors.
void Reset ()
 Reset function whenever datastorage or predicate changes.

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.
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)
std::vector< long > m_NodesDeleteObserverTags
 Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes)
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.
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.
bool m_AutoSelectNewNodes
 If set to "true" new Nodes will be automatically selected.

Detailed Description

Displays all or a subset (defined by a predicate) of nodes of the Data Storage.

Author:
Michael Mueller
Version:
4.0
Date:
2009-02-09

Dont forget that this class inherits from QComboBox and you can therefore use the whole API of QComboBox.

Definition at line 43 of file QmitkDataStorageComboBox.h.


Constructor & Destructor Documentation

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

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

Definition at line 24 of file QmitkDataStorageComboBox.cpp.

References Init().

: QComboBox(parent)
, m_DataStorage(0)
, m_Predicate(0)
, m_BlockEvents(false)
, m_AutoSelectNewNodes(_AutoSelectNewNodes)
{
  this->Init();
}
QmitkDataStorageComboBox::QmitkDataStorageComboBox ( mitk::DataStorage _DataStorage,
const mitk::NodePredicateBase _Predicate,
QWidget *  parent = 0,
bool  _AutoSelectNewNodes = false 
)

Ctor for constructing QmitkDataStorageComboBox with given DataStorageComboBox and given _Predicate.

Definition at line 34 of file QmitkDataStorageComboBox.cpp.

References Init(), and SetDataStorage().

: QComboBox(parent)
, m_DataStorage(0)
, m_Predicate(_Predicate)
, m_BlockEvents(false)
, m_AutoSelectNewNodes(_AutoSelectNewNodes)
{
  // make connections, fill combobox
  this->Init();
  this->SetDataStorage(_DataStorage);
}
QmitkDataStorageComboBox::~QmitkDataStorageComboBox (  )

Standard Dtor. Nothing to do here.

Definition at line 47 of file QmitkDataStorageComboBox.cpp.

References AddNode(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_DataStorage, m_Nodes, and RemoveNode().

{
  // if there was an old storage, remove listeners
  if(m_DataStorage.IsNotNull())
  {
    this->m_DataStorage->AddNodeEvent.RemoveListener( mitk::MessageDelegate1<QmitkDataStorageComboBox
      , const mitk::DataNode*>( this, &QmitkDataStorageComboBox::AddNode ) );

    this->m_DataStorage->RemoveNodeEvent.RemoveListener( mitk::MessageDelegate1<QmitkDataStorageComboBox
      , const mitk::DataNode*>( this, &QmitkDataStorageComboBox::RemoveNode ) );
  }
  //we have lots of observers to nodes and their name properties, this get's ugly if nodes live longer than the box
  while(m_Nodes.size() > 0)
    RemoveNode(0);
}

Member Function Documentation

void QmitkDataStorageComboBox::AddNode ( const mitk::DataNode _DataNode ) [virtual]

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

Definition at line 144 of file QmitkDataStorageComboBox.cpp.

References InsertNode(), and m_BlockEvents.

Referenced by QmitkInfoDialog::QmitkInfoDialog(), Reset(), SetDataStorage(), and ~QmitkDataStorageComboBox().

{  
  // this is an event function, make sure that we didnt call ourself
  if(!m_BlockEvents)
  {
    m_BlockEvents = true;
    // pass a -1 to the InsertNode function in order to append the datatreenode to the end
    this->InsertNode(-1, _DataNode);
    m_BlockEvents = false;
  }
}
int QmitkDataStorageComboBox::Find ( const mitk::DataNode _DataNode ) const

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

Definition at line 273 of file QmitkDataStorageComboBox.cpp.

References QuadProgPP::distance(), and m_Nodes.

Referenced by InsertNode(), QmitkSegmentationView::OnSelectionChanged(), RemoveNode(), SetNode(), and SetSelectedNode().

{
  int index = -1;

  std::vector<mitk::DataNode*>::const_iterator nodeIt = 
    std::find(m_Nodes.begin(), m_Nodes.end(), _DataNode);

  if(nodeIt != m_Nodes.end())
    index = std::distance(m_Nodes.begin(), nodeIt);

  return index;
}
bool QmitkDataStorageComboBox::GetAutoSelectNewItems (  ) [virtual]

Returns the AutoSelectNewItems.

See also:
SetAutoSelectNewItems

Definition at line 97 of file QmitkDataStorageComboBox.cpp.

References m_AutoSelectNewNodes.

mitk::DataStorage::Pointer QmitkDataStorageComboBox::GetDataStorage (  ) const

Get the DataStorage this ComboBox listens to.

Definition at line 64 of file QmitkDataStorageComboBox.cpp.

References mitk::WeakPointer< TObjectType >::GetPointer(), and m_DataStorage.

{
  return m_DataStorage.GetPointer();
}
mitk::DataNode::Pointer QmitkDataStorageComboBox::GetNode ( int  index ) const

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

Definition at line 74 of file QmitkDataStorageComboBox.cpp.

References HasIndex(), and m_Nodes.

Referenced by GetSelectedNode().

{
  return (this->HasIndex(index))? m_Nodes.at(index): 0;
}
mitk::DataStorage::SetOfObjects::ConstPointer QmitkDataStorageComboBox::GetNodes (  ) const

Returns all nodes that are stored in this combobox.

Definition at line 85 of file QmitkDataStorageComboBox.cpp.

References m_Nodes.

{
  mitk::DataStorage::SetOfObjects::Pointer _SetOfObjects = mitk::DataStorage::SetOfObjects::New();

  for (std::vector<mitk::DataNode*>::const_iterator it = m_Nodes.begin(); it != m_Nodes.end(); ++it)
  {
    _SetOfObjects->push_back(*it);
  }

  return _SetOfObjects.GetPointer();
}
const mitk::NodePredicateBase::ConstPointer QmitkDataStorageComboBox::GetPredicate (  ) const

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

Definition at line 69 of file QmitkDataStorageComboBox.cpp.

References m_Predicate.

{
  return m_Predicate.GetPointer();
}
mitk::DataNode::Pointer QmitkDataStorageComboBox::GetSelectedNode (  ) const
bool QmitkDataStorageComboBox::HasIndex ( unsigned int  index ) const [protected]

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

Definition at line 268 of file QmitkDataStorageComboBox.cpp.

References m_Nodes.

Referenced by GetNode(), InsertNode(), RemoveNode(), and SetNode().

{
  return (m_Nodes.size() > 0 && index < m_Nodes.size());
}
void QmitkDataStorageComboBox::Init (  ) [protected]

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

Definition at line 381 of file QmitkDataStorageComboBox.cpp.

References OnCurrentIndexChanged().

Referenced by QmitkDataStorageComboBox().

{
  connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(OnCurrentIndexChanged(int)));
}
void QmitkDataStorageComboBox::InsertNode ( int  index,
const mitk::DataNode _DataNode 
) [protected, virtual]

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 !!!!!

Definition at line 295 of file QmitkDataStorageComboBox.cpp.

References Find(), mitk::DataNode::GetProperty(), mitk::BaseProperty::GetValueAsString(), HasIndex(), m_AutoSelectNewNodes, m_Nodes, m_NodesDeleteObserverTags, m_NodesModifiedObserverTags, m_Predicate, m_PropertyToNode, OnDataNodeDeleteOrModified(), and RemoveNode().

Referenced by AddNode(), and SetNode().

{
  // check new or updated node first
  if(m_Predicate.IsNotNull() && !m_Predicate->CheckNode(_DataNode))
    return;

  bool addNewNode = false;
  bool insertNewNode = false;
  bool changedNode = false;

  // if this->HasIndex(index), then a node shall be updated
  if(this->HasIndex(index))
  {
    // if we really have another node at this position then ...
    if(_DataNode != m_Nodes.at(index))
    {
      // ... remove node, then proceed as usual
      this->RemoveNode(index);
      insertNewNode = true;
    }
    else
      changedNode = true;
  }  
  // otherwise a new node shall be added, let index point to the element after the last element
  else
  {
    index = m_Nodes.size();
    addNewNode = true;
  }

  // const cast because we need non const nodes
  mitk::DataNode* _NonConstDataNode = const_cast<mitk::DataNode*>(_DataNode);
  mitk::BaseProperty* nameProperty = _NonConstDataNode->GetProperty("name");

  if(!changedNode)
  {
    // break on duplicated nodes (that doesnt make sense to have duplicates in the combobox)
    if(this->Find(_DataNode) != -1)
      return;

    // add modified observer
    itk::MemberCommand<QmitkDataStorageComboBox>::Pointer modifiedCommand = itk::MemberCommand<QmitkDataStorageComboBox>::New();
    modifiedCommand->SetCallbackFunction(this, &QmitkDataStorageComboBox::OnDataNodeDeleteOrModified);
    // !!!! add modified observer for the name 
    if(nameProperty)
    {
      m_NodesModifiedObserverTags.push_back( nameProperty->AddObserver(itk::ModifiedEvent(), modifiedCommand) );
      m_PropertyToNode[_NonConstDataNode] = nameProperty;
    }
    // if there is no name node save an invalid value for the observer tag (-1)
    else
      m_NodesModifiedObserverTags.push_back( -1 );
    
    // add delete observer
    itk::MemberCommand<QmitkDataStorageComboBox>::Pointer deleteCommand = itk::MemberCommand<QmitkDataStorageComboBox>::New();
    deleteCommand->SetCallbackFunction(this, &QmitkDataStorageComboBox::OnDataNodeDeleteOrModified);
    m_NodesDeleteObserverTags.push_back( _NonConstDataNode->AddObserver(itk::DeleteEvent(), modifiedCommand) );
  }

  // add node to the vector
  if(addNewNode)
    m_Nodes.push_back( _NonConstDataNode );
  else if(insertNewNode)
    m_Nodes.insert( m_Nodes.begin()+index, _NonConstDataNode );

  // ... and to the combobox
  std::string _NonConstDataNodeName = "unnamed node";
  // _NonConstDataNodeName is "unnamed node" so far, change it if there is a name property in the node
  if(nameProperty)
    _NonConstDataNodeName = nameProperty->GetValueAsString();

  if(addNewNode)
  {
    this->addItem(QString::fromStdString(_NonConstDataNodeName));
    // select new node if m_AutoSelectNewNodes is true or if we have just added the first node
    if(m_AutoSelectNewNodes || m_Nodes.size() == 1)
      this->setCurrentIndex(index);
  }
  else
  {
    // update text in combobox
    this->setItemText( index, QString::fromStdString(_NonConstDataNodeName));
  }  
}
void QmitkDataStorageComboBox::OnCurrentIndexChanged ( int  index ) [protected, slot]

Slot for signal when the user selects another item.

Definition at line 287 of file QmitkDataStorageComboBox.cpp.

References GetSelectedNode(), and OnSelectionChanged().

Referenced by Init().

{
  if(index >= 0 && index < this->count())
    emit OnSelectionChanged(this->GetSelectedNode());
  if(index == -1)
    emit OnSelectionChanged(NULL);
}
void QmitkDataStorageComboBox::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.

Definition at line 212 of file QmitkDataStorageComboBox.cpp.

References m_BlockEvents, m_PropertyToNode, RemoveNode(), and SetNode().

Referenced by InsertNode().

{  
  if(!m_BlockEvents)
  {
    m_BlockEvents = true;

    // check if we have a modified event (if not it is a delete event)
    const itk::ModifiedEvent* modifiedEvent = dynamic_cast<const itk::ModifiedEvent*>(&event);

    // when node was modified reset text
    if(modifiedEvent)
    {
      const mitk::BaseProperty* _NameProperty = dynamic_cast<const mitk::BaseProperty*>(caller);

      // node name changed, set it
      // but first of all find associated node
      for(std::map<mitk::DataNode*, const mitk::BaseProperty*>::iterator it=m_PropertyToNode.begin()
        ; it!=m_PropertyToNode.end()
        ; ++it)
      {
        // property is found take node
        if(it->second == _NameProperty)
        {
          // looks strange but when calling setnode with the same node, that means the node gets updated
          this->SetNode(it->first, it->first);
          break;
        }
      }              
    }
    else
    {
      const mitk::DataNode* _ConstDataNode = dynamic_cast<const mitk::DataNode*>(caller);
      if(_ConstDataNode)
        // node will be deleted, remove it
        this->RemoveNode(_ConstDataNode);
    }

    m_BlockEvents = false;
  }
}
void QmitkDataStorageComboBox::OnSelectionChanged ( const mitk::DataNode  ) [signal]

Throw a signal when the _DataNode selection changed.

Referenced by OnCurrentIndexChanged().

void QmitkDataStorageComboBox::RemoveNode ( const mitk::DataNode _DataNode ) [virtual]

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

Definition at line 183 of file QmitkDataStorageComboBox.cpp.

References Find(), m_BlockEvents, and RemoveNode().

{
  // this is an event function, make sure that we didnt call ourself
  if(!m_BlockEvents)
  {
    m_BlockEvents = true;
    this->RemoveNode( this->Find(_DataNode) );
    m_BlockEvents = false;
  }
}
void QmitkDataStorageComboBox::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.

Definition at line 156 of file QmitkDataStorageComboBox.cpp.

References mitk::DataNode::GetProperty(), HasIndex(), m_Nodes, m_NodesDeleteObserverTags, m_NodesModifiedObserverTags, and m_PropertyToNode.

Referenced by InsertNode(), OnDataNodeDeleteOrModified(), RemoveNode(), Reset(), SetDataStorage(), and ~QmitkDataStorageComboBox().

{
  if(this->HasIndex(index))
  {
    //# remove itk::Event observer
    mitk::DataNode* _DataNode = m_Nodes.at(index);
    // get name property first
    mitk::BaseProperty* nameProperty = _DataNode->GetProperty("name");
    // if prop exists remove modified listener
    if(nameProperty)
    {
      nameProperty->RemoveObserver(m_NodesModifiedObserverTags[index]);
      // remove name property map
      m_PropertyToNode.erase(_DataNode);
    }
    // then remove delete listener on the node itself
    _DataNode->RemoveObserver(m_NodesDeleteObserverTags[index]);
    // remove observer tags from lists
    m_NodesModifiedObserverTags.erase(m_NodesModifiedObserverTags.begin()+index);
    m_NodesDeleteObserverTags.erase(m_NodesDeleteObserverTags.begin()+index);
    // remove node name from combobox
    this->removeItem(index);
    // remove node from node vector
    m_Nodes.erase(m_Nodes.begin()+index);  
  }
}
void QmitkDataStorageComboBox::Reset (  ) [protected]

Reset function whenever datastorage or predicate changes.

Definition at line 386 of file QmitkDataStorageComboBox.cpp.

References AddNode(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_DataStorage, m_Nodes, m_Predicate, and RemoveNode().

Referenced by SetDataStorage(), and SetPredicate().

{
  // remove all nodes first
  while( !m_Nodes.empty() )
  {
    // remove last node
    this->RemoveNode( m_Nodes.size() - 1 );
  }

  // clear combobox
  this->clear();

  if(m_DataStorage.IsNotNull())
  {
    mitk::DataStorage::SetOfObjects::ConstPointer setOfObjects;

    // select all if predicate == NULL
    if (m_Predicate.IsNotNull())
      setOfObjects = m_DataStorage->GetSubset(m_Predicate);
    else
      setOfObjects = m_DataStorage->GetAll();

    // add all found nodes
    for (mitk::DataStorage::SetOfObjects::ConstIterator nodeIt = setOfObjects->Begin()
      ; nodeIt != setOfObjects->End(); ++nodeIt)  // for each _DataNode
    {
      // add node to the node vector and to the combobox
      this->AddNode( nodeIt.Value().GetPointer() );
    }
  }
}
void QmitkDataStorageComboBox::SetAutoSelectNewItems ( bool  _AutoSelectNewItems ) [virtual]

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

Definition at line 207 of file QmitkDataStorageComboBox.cpp.

References m_AutoSelectNewNodes.

Referenced by QmitkNavigationToolManagementWidget::QmitkNavigationToolManagementWidget().

{
  m_AutoSelectNewNodes = _AutoSelectNewItems;
}
void QmitkDataStorageComboBox::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.

Definition at line 103 of file QmitkDataStorageComboBox.cpp.

References AddNode(), mitk::WeakPointer< TObjectType >::GetPointer(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_DataStorage, RemoveNode(), and Reset().

Referenced by QmitkThresholdComponent::CreateQtPartControl(), QmitkSegmentationView::CreateQtPartControl(), QmitkIsoSurface::CreateQtPartControl(), QmitkImageCropper::CreateQtPartControl(), QmitkFunctionalityComponentContainer::CreateQtPartControl(), QmitkBasicImageProcessing::CreateQtPartControl(), QmitkThresholdComponent::DataStorageChanged(), QmitkToolReferenceDataSelectionBox::Initialize(), QmitkNavigationToolManagementWidget::OnAddTool(), QmitkNavigationToolManagementWidget::OnEditTool(), and QmitkDataStorageComboBox().

{
  // reset only if datastorage really changed
  if(m_DataStorage.GetPointer() != _DataStorage)
  {
    // if there was an old storage, remove listeners
    if(m_DataStorage.IsNotNull())
    {
      this->m_DataStorage->AddNodeEvent.RemoveListener( mitk::MessageDelegate1<QmitkDataStorageComboBox
        , const mitk::DataNode*>( this, &QmitkDataStorageComboBox::AddNode ) );

      this->m_DataStorage->RemoveNodeEvent.RemoveListener( mitk::MessageDelegate1<QmitkDataStorageComboBox
        , const mitk::DataNode*>( this, &QmitkDataStorageComboBox::RemoveNode ) );
    }
    // set new storage
    m_DataStorage = _DataStorage;

    // if there is a new storage, add listeners
    if(m_DataStorage.IsNotNull())
    {
      this->m_DataStorage->AddNodeEvent.AddListener( mitk::MessageDelegate1<QmitkDataStorageComboBox
        , const mitk::DataNode*>( this, &QmitkDataStorageComboBox::AddNode ) );

      this->m_DataStorage->RemoveNodeEvent.AddListener( mitk::MessageDelegate1<QmitkDataStorageComboBox
        , const mitk::DataNode*>( this, &QmitkDataStorageComboBox::RemoveNode ) );
    }

    // reset predicate to reset the combobox
    this->Reset();
  }
}
void QmitkDataStorageComboBox::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*)

Definition at line 202 of file QmitkDataStorageComboBox.cpp.

References Find(), and SetNode().

{
  this->SetNode( this->Find(_DataNode), _OtherDataNode);
}
void QmitkDataStorageComboBox::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)

Definition at line 194 of file QmitkDataStorageComboBox.cpp.

References HasIndex(), and InsertNode().

Referenced by OnDataNodeDeleteOrModified(), and SetNode().

{
  if(this->HasIndex(index))
  {
    this->InsertNode(index, _DataNode);
  }
}
void QmitkDataStorageComboBox::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.

Definition at line 135 of file QmitkDataStorageComboBox.cpp.

References m_Predicate, and Reset().

Referenced by QmitkThresholdComponent::CreateQtPartControl(), QmitkSegmentationView::CreateQtPartControl(), QmitkIsoSurface::CreateQtPartControl(), QmitkImageCropper::CreateQtPartControl(), QmitkFunctionalityComponentContainer::CreateQtPartControl(), QmitkBasicImageProcessing::CreateQtPartControl(), and QmitkToolReferenceDataSelectionBox::UpdateDataDisplay().

{
  if(m_Predicate != _Predicate)
  {
    m_Predicate = _Predicate;
    this->Reset();
  }  
}
void QmitkDataStorageComboBox::SetSelectedNode ( mitk::DataNode::Pointer  item ) [slot]

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

Definition at line 253 of file QmitkDataStorageComboBox.cpp.

References Find(), and MITK_INFO.

Referenced by QmitkThresholdComponent::ImageSelected(), QmitkFunctionalityComponentContainer::ImageSelected(), and QmitkNavigationToolManagementWidget::OnEditTool().

{
  int index = this->Find(item);
  if (index == -1)
  {
    MITK_INFO << "QmitkDataStorageComboBox: item not available";
  }
  else
  {
    this->setCurrentIndex(index);
  }
  
}

Member Data Documentation

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

Definition at line 235 of file QmitkDataStorageComboBox.h.

Referenced by GetAutoSelectNewItems(), InsertNode(), and SetAutoSelectNewItems().

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

Definition at line 231 of file QmitkDataStorageComboBox.h.

Referenced by AddNode(), OnDataNodeDeleteOrModified(), and RemoveNode().

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

Definition at line 199 of file QmitkDataStorageComboBox.h.

Referenced by GetDataStorage(), Reset(), SetDataStorage(), and ~QmitkDataStorageComboBox().

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

Definition at line 210 of file QmitkDataStorageComboBox.h.

Referenced by Find(), GetNode(), GetNodes(), HasIndex(), InsertNode(), RemoveNode(), Reset(), and ~QmitkDataStorageComboBox().

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

Definition at line 220 of file QmitkDataStorageComboBox.h.

Referenced by InsertNode(), and RemoveNode().

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

Definition at line 215 of file QmitkDataStorageComboBox.h.

Referenced by InsertNode(), and RemoveNode().

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

Definition at line 205 of file QmitkDataStorageComboBox.h.

Referenced by GetPredicate(), InsertNode(), Reset(), and SetPredicate().

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.

Definition at line 226 of file QmitkDataStorageComboBox.h.

Referenced by InsertNode(), OnDataNodeDeleteOrModified(), and RemoveNode().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines