Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkAbstractView Class Reference

A convenient base class for MITK related BlueBerry Views. More...

#include <QmitkAbstractView.h>

Inheritance diagram for QmitkAbstractView:
Collaboration diagram for QmitkAbstractView:

Public Types

enum  IRenderWindowPartStrategy { NONE, BRING_TO_FRONT, ACTIVATE, OPEN }
 
- Public Types inherited from berry::Object
typedef Object Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 

Public Member Functions

 berryObjectMacro (QmitkAbstractView)
 
 QmitkAbstractView ()
 
virtual ~QmitkAbstractView ()
 
- Public Member Functions inherited from berry::QtViewPart
 berryObjectMacro (QtViewPart) void CreatePartControl(QWidget *parent) override
 
- Public Member Functions inherited from berry::ViewPart
IViewSite::Pointer GetViewSite () override
 
- Public Member Functions inherited from berry::WorkbenchPart
 berryObjectMacro (WorkbenchPart, QObject, IWorkbenchPart, IExecutableExtension)~WorkbenchPart()
 
void AddPropertyListener (IPropertyChangeListener *l) override
 
void RemovePropertyListener (IPropertyChangeListener *l) override
 
void SetPartProperty (const QString &key, const QString &value) override
 
QString GetPartProperty (const QString &key) const override
 
const QHash< QString, QString > & GetPartProperties () const override
 
void SetInitializationData (const IConfigurationElement::Pointer &cfig, const QString &propertyName, const Object::Pointer &data) override
 
virtual void SetFocus () override=0
 
IWorkbenchPartSite::Pointer GetSite () const override
 
QString GetPartName () const override
 
QString GetContentDescription () const override
 
QIcon GetTitleImage () const override
 
QString GetTitleToolTip () const override
 
- Public Member Functions inherited from berry::IWorkbenchPart
 berryObjectMacro (berry::IWorkbenchPart, Object) virtual ~IWorkbenchPart()
 
- Public Member Functions inherited from berry::Object
virtual QString GetClassName () const
 
virtual Reflection::TypeInfo GetTypeInfo () const
 
virtual QList< Reflection::TypeInfoGetSuperclasses () const
 
virtual void Delete ()
 
QDebug Print (QDebug os, Indent Indent=0) const
 
virtual QString ToString () const
 
virtual uint HashCode () const
 
virtual bool operator< (const Object *) const
 
void Register () const
 
void UnRegister (bool del=true) const
 
int GetReferenceCount () const
 
void SetReferenceCount (int)
 
void AddDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
void RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
virtual bool operator== (const Object *) const
 
- Public Member Functions inherited from berry::IExecutableExtension
virtual ~IExecutableExtension ()
 
virtual void SetInitializationData (const SmartPointer< IConfigurationElement > &config, const QString &propertyName, const Object::Pointer &data)=0
 
- Public Member Functions inherited from berry::IViewPart
 berryObjectMacro (berry::IViewPart, IWorkbenchPart) virtual ~IViewPart()
 
virtual void Init (IViewSite::Pointer site, IMemento::Pointer memento=IMemento::Pointer(nullptr))=0
 
virtual void SaveState (IMemento::Pointer memento)=0
 

Protected Member Functions

void FireNodeSelected (mitk::DataNode::Pointer node)
 
virtual void FireNodesSelected (const QList< mitk::DataNode::Pointer > &nodes)
 
QList< mitk::DataNode::PointerGetCurrentSelection () const
 
bool IsCurrentSelectionValid () const
 
QList< mitk::DataNode::PointerGetDataManagerSelection () const
 
bool IsDataManagerSelectionValid () const
 
void SetDataManagerSelection (const berry::ISelection::ConstPointer &selection, QItemSelectionModel::SelectionFlags flags=QItemSelectionModel::ClearAndSelect) const
 
void SynchronizeDataManagerSelection () const
 
berry::IPreferences::Pointer GetPreferences () const
 
mitk::IDataStorageReference::Pointer GetDataStorageReference () const
 
mitk::DataStorage::Pointer GetDataStorage () const
 
mitk::IRenderWindowPartGetRenderWindowPart (IRenderWindowPartStrategies strategies=NONE) const
 
void RequestRenderWindowUpdate (mitk::RenderingManager::RequestType requestType=mitk::RenderingManager::REQUEST_UPDATE_ALL)
 
void HandleException (std::exception &e, QWidget *parent=nullptr, bool showDialog=true) const
 
void HandleException (const char *str, QWidget *parent=nullptr, bool showDialog=true) const
 
void WaitCursorOn ()
 
void WaitCursorOff ()
 
void BusyCursorOn ()
 
void BusyCursorOff ()
 
void RestoreOverrideCursor ()
 
- Protected Member Functions inherited from berry::QtViewPart
virtual void CreateQtPartControl (QWidget *parent)=0
 
- Protected Member Functions inherited from berry::ViewPart
 ViewPart ()
 
void CheckSite (IWorkbenchPartSite::Pointer site) override
 
- Protected Member Functions inherited from berry::WorkbenchPart
 WorkbenchPart ()
 
IConfigurationElement::Pointer GetConfigurationElement () const
 
void SetSite (IWorkbenchPartSite::Pointer site)
 
virtual void SetTitleImage (const QIcon &titleImage)
 
virtual void SetTitleToolTip (const QString &toolTip)
 
virtual void SetPartName (const QString &partName)
 
virtual void SetContentDescription (const QString &description)
 
void FirePropertyChanged (const QString &key, const QString &oldValue, const QString &newValue)
 
void FirePropertyChange (int propertyId)
 
- Protected Member Functions inherited from berry::Object
 Object ()
 
virtual ~Object ()
 
virtual QDebug PrintSelf (QDebug os, Indent indent) const
 
virtual QDebug PrintHeader (QDebug os, Indent indent) const
 
virtual QDebug PrintTrailer (QDebug os, Indent indent) const
 

Additional Inherited Members

- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

A convenient base class for MITK related BlueBerry Views.

QmitkAbstractView provides several convenience methods that ease the introduction of a new view:

  1. Access to the DataStorage (~ the shared data repository)
  2. Access to the active IRenderWindowPart
  3. Access to and update notification for the view's preferences
  4. Access to and update notification for the current DataNode selection / to DataNode selection events send through the SelectionService
  5. Access to and update notification for DataNode events (added/removed/modified)
  6. Methods to send DataNode selections through the SelectionService
  7. Some minor important convenience methods (like changing the mouse cursor/exception handling)

Usually all MITK Views inherit from QmitkAbstractView to achieve a consistent Workbench behavior.

When inheriting from QmitkAbstractView, you must implement the following methods:

You may reimplement the following private virtual methods to customize your View's behavior:

  • void SetSelectionProvider()
  • QItemSelectionModel* GetDataNodeSelectionModel() const

You may reimplement the following private virtual methods to be notified about certain changes:

  • void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList<mitk::DataNode::Pointer> &nodes)
  • void OnNullSelection(berry::IWorkbenchPart::Pointer part)
  • void OnPreferencesChanged(const berry::IBerryPreferences*)
  • void NodeAdded(const mitk::DataNode* node)
  • void NodeChanged(const mitk::DataNode* node)
  • void NodeRemoved(const mitk::DataNode* node)
  • void DataStorageModified()
  • void DataStorageChanged(mitk::IDataStorageReference::Pointer dsRef)
See also
mitk::ILifecycleAwarePart
mitk::IZombieViewPart
mitk::IRenderWindowPartListener

Definition at line 104 of file QmitkAbstractView.h.

Constructor & Destructor Documentation

QmitkAbstractView::QmitkAbstractView ( )

Nothing to do in the standard ctor. Initiliaze your GUI in CreateQtPartControl(QWidget*)

See also
berry::QtViewPart::CreateQtPartControl(QWidget*)

Definition at line 189 of file QmitkAbstractView.cpp.

Member Function Documentation

QmitkAbstractView::berryObjectMacro ( QmitkAbstractView  )

Creates smartpointer typedefs

void QmitkAbstractView::BusyCursorOff ( )
protected

Convenient method to restore the standard cursor

Definition at line 451 of file QmitkAbstractView.cpp.

References RestoreOverrideCursor().

void QmitkAbstractView::BusyCursorOn ( )
protected

Convenient method to set and reset a busy cursor

Definition at line 441 of file QmitkAbstractView.cpp.

void QmitkAbstractView::FireNodeSelected ( mitk::DataNode::Pointer  node)
protected

Informs other parts of the workbench that node is selected via the blueberry selection service.

Note
This method should not be used if you have set your own selection provider via SetSelectionProvider() or your own QItemSelectionModel via GetDataNodeSelectionModel().

Definition at line 562 of file QmitkAbstractView.cpp.

References FireNodesSelected().

void QmitkAbstractView::FireNodesSelected ( const QList< mitk::DataNode::Pointer > &  nodes)
protectedvirtual

Informs other parts of the workbench that the nodes are selected via the blueberry selection service.

Note
This method should not be used if you have set your own selection provider via SetSelectionProvider() or your own QItemSelectionModel via GetDataNodeSelectionModel().

Definition at line 569 of file QmitkAbstractView.cpp.

References MITK_WARN.

Referenced by FireNodeSelected().

QList< mitk::DataNode::Pointer > QmitkAbstractView::GetDataManagerSelection ( ) const
protected

Returns the current selection made in the datamanager bundle or an empty list if there is no selection or if it is empty.

See also
IsDataManagerSelectionValid

Definition at line 506 of file QmitkAbstractView.cpp.

References berry::SmartPointer< TObjectType >::Cast(), and berry::WorkbenchPart::GetSite().

mitk::IDataStorageReference::Pointer QmitkAbstractView::GetDataStorageReference ( ) const
protected

Returns a reference to the currently active DataStorage.

Definition at line 482 of file QmitkAbstractView.cpp.

References mitk::IDataStorageService::GetDataStorage().

Referenced by GetRenderWindowPart(), and QmitkDataManagerView::ShowIn().

berry::IPreferences::Pointer QmitkAbstractView::GetPreferences ( ) const
protected

Returns the Preferences object for this View. Important: When refering to this preferences, e.g. in a PreferencePage: The ID for this preferences object is "/<VIEW-ID>", e.g. "/org.mitk.views.datamanager"

Definition at line 461 of file QmitkAbstractView.cpp.

References berry::IPreferencesService::GetSystemPreferences().

Referenced by ~QmitkAbstractView().

mitk::IRenderWindowPart * QmitkAbstractView::GetRenderWindowPart ( IRenderWindowPartStrategies  strategies = NONE) const
protected
void QmitkAbstractView::HandleException ( std::exception &  e,
QWidget *  parent = nullptr,
bool  showDialog = true 
) const
protected

Outputs an error message to the console and displays a message box containing the exception description.

Parameters
ethe exception which should be handled
showDialogcontrols, whether additionally a message box should be displayed to inform the user that something went wrong

Definition at line 431 of file QmitkAbstractView.cpp.

void QmitkAbstractView::HandleException ( const char *  str,
QWidget *  parent = nullptr,
bool  showDialog = true 
) const
protected

Calls HandleException ( std::exception&, QWidget*, bool ) internally

See also
HandleException ( std::exception&, QWidget*, bool )

Definition at line 421 of file QmitkAbstractView.cpp.

References MITK_ERROR.

bool QmitkAbstractView::IsCurrentSelectionValid ( ) const
protected

Queries the state of the current selection.

Returns
If the current selection is NULL, this method returns false and true otherwise.

Definition at line 501 of file QmitkAbstractView.cpp.

References berry::WorkbenchPart::GetSite().

bool QmitkAbstractView::IsDataManagerSelectionValid ( ) const
protected

Queries the state of the current selection of the data manager view.

Returns
If the current data manager selection is NULL, this method returns false and true otherwise.

Definition at line 513 of file QmitkAbstractView.cpp.

References berry::WorkbenchPart::GetSite().

void QmitkAbstractView::RequestRenderWindowUpdate ( mitk::RenderingManager::RequestType  requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL)
protected

Request an update of all render windows of the currently active IRenderWindowPart.

Parameters
requestTypeSpecifies the type of render windows for which an update will be requested.

Definition at line 406 of file QmitkAbstractView.cpp.

References mitk::IRenderWindowPart::GetRenderingManager(), GetRenderWindowPart(), and mitk::IRenderWindowPart::RequestUpdate().

void QmitkAbstractView::RestoreOverrideCursor ( )
protected

Convenient method to restore the standard cursor

Definition at line 456 of file QmitkAbstractView.cpp.

Referenced by BusyCursorOff(), and WaitCursorOff().

void QmitkAbstractView::SetDataManagerSelection ( const berry::ISelection::ConstPointer selection,
QItemSelectionModel::SelectionFlags  flags = QItemSelectionModel::ClearAndSelect 
) const
protected

Sets the selection of the data manager view if available.

Parameters
selectionThe new selection for the data manager.
flagsThe Qt selection flags for controlling the way how the selection is updated.

Definition at line 518 of file QmitkAbstractView.cpp.

References berry::SmartPointer< TObjectType >::Cast(), berry::WorkbenchPart::GetSite(), and berry::SmartPointer< TObjectType >::IsNull().

Referenced by SynchronizeDataManagerSelection().

void QmitkAbstractView::SynchronizeDataManagerSelection ( ) const
protected

Takes the current selection and sets it on the data manager. Only matching nodes in the data manager view will be selected.

Definition at line 527 of file QmitkAbstractView.cpp.

References berry::WorkbenchPart::GetSite(), berry::SmartPointer< TObjectType >::IsNull(), and SetDataManagerSelection().

void QmitkAbstractView::WaitCursorOff ( )
protected

Convenient method to restore the standard cursor

Definition at line 446 of file QmitkAbstractView.cpp.

References RestoreOverrideCursor().

void QmitkAbstractView::WaitCursorOn ( )
protected

Convenient method to set and reset a wait cursor ("hourglass")

Definition at line 436 of file QmitkAbstractView.cpp.


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