Loading...
Searching...
No Matches
BALL::VIEW::DatasetController Class Reference

`#include <BALL/VIEW/DATATYPE/dataset.h>`

Inheritance diagram for BALL::VIEW::DatasetController:

## Public Slots

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

## Public Member Functions

| DatasetController ()
| DatasetController (DatasetController &dc)
virtual | ~DatasetController ()
void | setDatasetControl (DatasetControl *dc)
DatasetControl * | getDatasetControl ()
virtual bool | handle (DatasetMessage *msg)
virtual bool | insertDataset (Dataset *set)
virtual bool | deleteDataset (Dataset *set)
virtual bool | createMenuEntries ()
virtual QMenu * | buildContextMenu (QTreeWidgetItem *item)
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.
Dataset * | getSelectedDataset ()
bool | hasDataset (Dataset *set)
bool | hasItem (QTreeWidgetItem *item)
| Test if a given QTreeWidgetItem corresponds to a registered Dataset.
Dataset * | getDataset (QTreeWidgetItem *item)
| Get the Dataset for a QTreeWidgetItem.
String | getType ()
virtual void | checkMenu (MainControl &mc)
vector< String > | getSupportedFileFormats ()
Public Member Functions inherited from BALL::Embeddable
| Embeddable (const String &identifier="<Embeddable>")
| Embeddable (const Embeddable &embeddable)
virtual | ~Embeddable ()
void | setIdentifier (const String &identifier)
const String & | getIdentifier () const
void | unregisterThis ()
virtual void | registerThis ()
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const

## Protected Member Functions

void | setStatusbarText (const String &text, bool important=false)
void | setStatusbarText (const QString &text, bool important=false)
virtual bool | write (Dataset *, String, String)
virtual Dataset * | open (String, String)
String | getFileTypes_ ()
String | getNameFromFileName_ (String filename)
QAction * | insertMenuEntry_ (Position pid, const QString &name, const char *slot, const String &description="", QKeySequence accel=QKeySequence(), const QString &menu_hint="", UIOperationMode::OperationMode initial_mode=UIOperationMode::MODE_ALL)
virtual void | deleteDataset_ (Dataset *)

## Protected Attributes

String | type_
vector< String > | file_formats_
DatasetControl * | control_
vector< QAction * > | actions_
HashSet< QAction * > | actions_for_one_set_
HashMap< QTreeWidgetItem *, Dataset * > | item_to_dataset_
HashMap< Dataset *, QTreeWidgetItem * > | dataset_to_item_

## Friends

class | DatasetControl

## Additional Inherited Members

Public Types inherited from BALL::Embeddable
typedef std::vector< Embeddable * > | EmbeddableVector
static void | registerInstance_ (const std::type_info &type, const Embeddable *instance)
static void | unregisterInstance_ (const Embeddable *instance)
static Size | countInstances_ (const std::type_info &type)
static Embeddable * | getInstance_ (const std::type_info &type, Position index)
static Embeddable * | getInstance_ (const std::type_info &type, const String &identifier)

## 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:

- It can be registered at a DatasetControl with the method DatasetControl::registerController.
- It knows about its supported file formats, and can open them when requested. (see getSupportedFileFormats())
- It will then automatically call createMenuEntries and thus create the menu entries. Derived classes can add further entries, by overloading this method.
- The DatasetControl provides a context menu for the Datasets. Its entries are created in DatasetController::buildContextMenu.
- Since DatasetController is derived from Embeddable, access to individual instances (also to derived classes) is possible through getInstance().
- When a DatasetController is deleted, it deletes all Datasets and their data.

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

- getData
- buildContextMenu
- creatMenuEntries
- open
- write
- deleteDataset_

Furthermore

- add a static String member type
- assign file_formats_ in the derived classes constructor

See also
  DatasetControl
  Dataset
  DatasetMessage
  Embeddable

Definition at line 190 of file dataset.h.

## Constructor & Destructor Documentation

## DatasetController() [1/2]

BALL::VIEW::DatasetController::DatasetController | ( |  | ) |

## DatasetController() [2/2]

BALL::VIEW::DatasetController::DatasetController | ( | DatasetController & | dc | ) |

## ~DatasetController()

virtual BALL::VIEW::DatasetController::~DatasetController | ( |  | ) |

virtual

## Member Function Documentation

## buildContextMenu()

virtual QMenu * BALL::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 BALL::VIEW::DockResultController, BALL::VIEW::RaytraceableGridController, BALL::VIEW::RegularData3DController, BALL::VIEW::TrajectoryController, and BALL::VIEW::VectorGridController.

## checkMenu()

virtual void BALL::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.

## createMenuEntries()

virtual bool BALL::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 BALL::VIEW::DockResultController, BALL::VIEW::RaytraceableGridController, BALL::VIEW::RegularData3DController, BALL::VIEW::TrajectoryController, and BALL::VIEW::VectorGridController.

## deleteDataset [1/2]

virtual bool BALL::VIEW::DatasetController::deleteDataset | ( |  | ) |

virtual slot

Delete the currently highlighted Dataset.

## deleteDataset() [2/2]

virtual bool BALL::VIEW::DatasetController::deleteDataset | ( | Dataset * | set | ) |

virtual

## deleteDataset_()

virtual void BALL::VIEW::DatasetController::deleteDataset_ | ( | Dataset * |  | ) |

inline protected virtual

In the derived class: cast to concrete type and delete the data!

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

Definition at line 320 of file dataset.h.

## deleteDatasets

virtual bool BALL::VIEW::DatasetController::deleteDatasets | ( |  | ) |

virtual slot

Delete all Datasets.

## getDataset()

Dataset * BALL::VIEW::DatasetController::getDataset | ( | QTreeWidgetItem * | item | ) |

Get the Dataset for a QTreeWidgetItem.

## getDatasetControl()

DatasetControl * BALL::VIEW::DatasetController::getDatasetControl | ( |  | ) |

inline

Definition at line 215 of file dataset.h.

## getDatasets()

vector< Dataset * > BALL::VIEW::DatasetController::getDatasets | ( |  | ) |

Get all Datasets of this type in the DatasetControl.

## getFileTypes_()

String BALL::VIEW::DatasetController::getFileTypes_ | ( |  | ) |

protected

## getNameFromFileName_()

String BALL::VIEW::DatasetController::getNameFromFileName_ | ( | String | filename | ) |

protected

## getSelectedDataset()

Dataset * BALL::VIEW::DatasetController::getSelectedDataset | ( |  | ) |

Get one selected Datasets of this type in the DatasetControl. If multiple entries are selected in the DatasetControl, 0 is returned.

## getSelectedDatasets()

vector< Dataset * > BALL::VIEW::DatasetController::getSelectedDatasets | ( |  | ) |

Get all selected Datasets of this type in the DatasetControl.

## getSupportedFileFormats()

vector< String > BALL::VIEW::DatasetController::getSupportedFileFormats | ( |  | ) |

inline

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.

Definition at line 283 of file dataset.h.

## getType()

String BALL::VIEW::DatasetController::getType | ( |  | ) |

inline

Get the String type identifier for this data type.

Definition at line 268 of file dataset.h.

## handle()

virtual bool BALL::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.

## hasDataset()

bool BALL::VIEW::DatasetController::hasDataset | ( | Dataset * | set | ) |

Test if a Dataset is registered in this controller.

## hasItem()

bool BALL::VIEW::DatasetController::hasItem | ( | QTreeWidgetItem * | item | ) |

Test if a given QTreeWidgetItem corresponds to a registered Dataset.

## insertDataset()

virtual bool BALL::VIEW::DatasetController::insertDataset | ( | Dataset * | set | ) |

virtual

## insertMenuEntry_()

QAction * BALL::VIEW::DatasetController::insertMenuEntry_ | ( | Position | pid,
|  | const QString & | name,
|  | const char * | slot,
|  | const String & | description = "",
|  | QKeySequence | accel = QKeySequence(),
|  | const QString & | menu_hint = "",
|  | UIOperationMode::OperationMode | initial_mode = UIOperationMode::MODE_ALL )

protected

## open [1/2]

bool BALL::VIEW::DatasetController::open | ( |  | ) |

slot

Show a file dialog to open a data file. Calls open(String, String). Overload this method to support multiple file formats.

## open() [2/2]

virtual Dataset * BALL::VIEW::DatasetController::open | ( | String | ,
|  | String | )

protected virtual

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

## setDatasetControl()

void BALL::VIEW::DatasetController::setDatasetControl | ( | DatasetControl * | dc | ) |

inline

Definition at line 212 of file dataset.h.

## setStatusbarText() [1/2]

void BALL::VIEW::DatasetController::setStatusbarText | ( | const QString & | text,
|  | bool | important = false )

protected

## setStatusbarText() [2/2]

void BALL::VIEW::DatasetController::setStatusbarText | ( | const String & | text,
|  | bool | important = false )

protected

## write [1/2]

virtual bool BALL::VIEW::DatasetController::write | ( |  | ) |

virtual slot

Show a file dialog for writing the selected Dataset.

Reimplemented in BALL::VIEW::RegularData3DController.

## write() [2/2]

virtual bool BALL::VIEW::DatasetController::write | ( | Dataset * | ,
|  | String | ,
|  | String | )

protected virtual

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

## Friends And Related Symbol Documentation

## DatasetControl

friend class DatasetControl

friend

Definition at line 196 of file dataset.h.

## Member Data Documentation

## actions_

vector<QAction*> BALL::VIEW::DatasetController::actions_

protected

Definition at line 325 of file dataset.h.

## actions_for_one_set_

HashSet<QAction*> BALL::VIEW::DatasetController::actions_for_one_set_

protected

Definition at line 326 of file dataset.h.

## control_

DatasetControl* BALL::VIEW::DatasetController::control_

protected

Definition at line 324 of file dataset.h.

## dataset_to_item_

HashMap<Dataset*, QTreeWidgetItem*> BALL::VIEW::DatasetController::dataset_to_item_

protected

Definition at line 328 of file dataset.h.

## file_formats_

vector<String> BALL::VIEW::DatasetController::file_formats_

protected

Definition at line 323 of file dataset.h.

## item_to_dataset_

HashMap<QTreeWidgetItem*, Dataset*> BALL::VIEW::DatasetController::item_to_dataset_

protected

Definition at line 327 of file dataset.h.

## type_

String BALL::VIEW::DatasetController::type_

protected

Definition at line 322 of file dataset.h.