Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

VIEW::DatasetController Class Reference

Controller base class for one type of Dataset A DatasetController provides all neccessary means to manage and manipulate a kind of data in the DatasetControl. More...

#include <dataset.h>

Inheritance diagram for VIEW::DatasetController:

Embeddable VIEW::DockResultController VIEW::RegularData3DController VIEW::TrajectoryController VIEW::VectorGridController List of all members.

Public Slots

virtual bool write ()
 Show a file dialog for writing the selected Dataset.
virtual bool open ()
 Show a file dialog to open a data file.
virtual bool deleteDatasets ()
 Delete all Datasets.
virtual bool deleteDataset ()
 Delete the currently highlighted Dataset.

Public Member Functions

 DatasetController (DatasetController &dc)
void setDatasetControl (DatasetControl *dc)
DatasetControlgetDatasetControl ()
virtual bool handle (DatasetMessage *msg)
 Message handling.
virtual bool insertDataset (Dataset *set)
virtual bool deleteDataset (Dataset *set)
virtual bool createMenuEntries ()
 Create menu entries for this data type.
virtual QMenu * buildContextMenu (QTreeWidgetItem *item)
 Create a context menu for this data type.
vector< Dataset * > getDatasets ()
 Get all Datasets of this type in the DatasetControl.
vector< Dataset * > getSelectedDatasets ()
 Get all selected Datasets of this type in the DatasetControl.
DatasetgetSelectedDataset ()
 Get one selected Datasets of this type in the DatasetControl.
bool hasDataset (Dataset *set)
 Test if a Dataset is registered in this controller.
bool hasItem (QTreeWidgetItem *item)
 Test if a given QTreeWidgetItem corresponds to a registered Dataset.
DatasetgetDataset (QTreeWidgetItem *item)
 Get the Dataset for a QTreeWidgetItem.
String getType ()
 Get the String type identifier for this data type.
virtual void checkMenu (MainControl &mc)
 Check the menu entries for this data type.
vector< StringgetSupportedFileFormats ()
 Return a vector with all supported file formats.

Protected Member Functions

void setStatusbarText (const String &text, bool important=false)
virtual bool write (Dataset *, String, String)
virtual Datasetopen (String, String)
String getFileTypes_ ()
String getNameFromFileName_ (String filename)
QAction * insertMenuEntry_ (Position pid, const String &name, const char *slot, QKeySequence accel=QKeySequence())
virtual void deleteDataset_ (Dataset *)
 In the derived class: cast to concrete type and delete the data!

Protected Attributes

String type_
vector< Stringfile_formats_
DatasetControlcontrol_
vector< QAction * > actions_
HashSet< QAction * > actions_for_one_set_
HashMap< QTreeWidgetItem *,
Dataset * > 
item_to_dataset_
HashMap< Dataset *, QTreeWidgetItem * > dataset_to_item_

Friends

class DatasetControl

Detailed Description

Controller base class for one type of Dataset A DatasetController provides all neccessary means to manage and manipulate a kind of data in the DatasetControl.

The class has the following features:

To use this class, derive a new class from it and overload/create the following methods: Furthermore
See also:
DatasetControl

Dataset

DatasetMessage

Embeddable


Member Function Documentation

virtual QMenu* VIEW::DatasetController::buildContextMenu QTreeWidgetItem *  item  )  [virtual]
 

Create a context menu for this data type.

Initial support for deleting and saving entries is included. Overload this method for providing further entries.

Reimplemented in VIEW::RegularData3DController, VIEW::TrajectoryController, VIEW::DockResultController, and VIEW::VectorGridController.

virtual void VIEW::DatasetController::checkMenu MainControl mc  )  [virtual]
 

Check the menu entries for this data type.

If the MainControl is currently busy, all entries are disabled. If multiple entries are selected, it is tested, if an QAction is included in actions_for_one_set_. If true, this QAction is disabled. Overload this method for more sophisticated behaviour.

virtual bool VIEW::DatasetController::createMenuEntries  )  [virtual]
 

Create menu entries for this data type.

Initial support for open file menu entry is included. Overload this method for providing further entries.

Reimplemented in VIEW::RegularData3DController, VIEW::TrajectoryController, VIEW::DockResultController, and VIEW::VectorGridController.

Dataset* VIEW::DatasetController::getSelectedDataset  ) 
 

Get one selected Datasets of this type in the DatasetControl.

If multiple entries are selected in the DatasetControl, 0 is returned.

vector<String> VIEW::DatasetController::getSupportedFileFormats  ) 
 

Return a vector with all supported file formats.

Set the member file_formats_ in the constructor of the derived class. The methods open(...) and write(...) must be overloaded such that they know how to handle the supported file formats.

String VIEW::DatasetController::getType  ) 
 

Get the String type identifier for this data type.

virtual bool VIEW::DatasetController::handle DatasetMessage msg  )  [virtual]
 

Message handling.

If a DatasetControl receives a DatasetMessage, it queries the data type and calls this method in the corresponding DatasetController. This method has intial support for DatasetMessage::ADD and DatasetMessage::REMOVE. For these cases, it calls insertDataset or respectively deleteDataset.

bool VIEW::DatasetController::hasDataset Dataset set  ) 
 

Test if a Dataset is registered in this controller.

virtual bool VIEW::DatasetController::open  )  [virtual, slot]
 

Show a file dialog to open a data file.

Calls open(String, String). Overload this method to support multiple file formats.