1 // File: LightApp_DataModel.cxx
2 // Created: 10/25/2004 10:36:06 AM
3 // Author: Sergey LITONIN
4 // Copyright (C) CEA 2004
6 #include "LightApp_DataModel.h"
7 #include "LightApp_Study.h"
8 #include "LightApp_RootObject.h"
9 #include "LightApp_DataObject.h"
10 #include "LightApp_Module.h"
11 #include "LightApp_Application.h"
13 #include <OB_Browser.h>
15 #include <SUIT_Application.h>
16 #include <SUIT_ResourceMgr.h>
17 #include <SUIT_Session.h>
18 #include <SUIT_DataObject.h>
23 LightApp_DataModel::LightApp_DataModel( CAM_Module* theModule )
24 : CAM_DataModel( theModule )
31 LightApp_DataModel::~LightApp_DataModel()
38 bool LightApp_DataModel::open( const QString&, CAM_Study* study, QStringList )
40 emit opened(); //TODO: is it really needed? to be removed maybe...
47 bool LightApp_DataModel::save( QStringList& )
56 bool LightApp_DataModel::saveAs( const QString&, CAM_Study*, QStringList& )
65 bool LightApp_DataModel::close()
72 Build whole data model tree
74 void LightApp_DataModel::build()
79 Updates data model presentation in some widgets (for example, in object browser
81 void LightApp_DataModel::updateWidgets()
83 LightApp_Application* app = dynamic_cast<LightApp_Application*>( module()->application() );
85 app->objectBrowser()->updateTree( 0, false );
89 Default behaviour of data model update for light modules
91 void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* )
93 LightApp_ModuleObject* modelRoot = dynamic_cast<LightApp_ModuleObject*>( root() );
97 ch = modelRoot->children();
98 for ( DataObjectListIterator it( ch ); it.current(); ++it )
99 it.current()->setParent( 0 );
103 for( DataObjectListIterator it( ch ); it.current(); ++it )
108 \return corresponding module
110 LightApp_Module* LightApp_DataModel::getModule() const
112 return dynamic_cast<LightApp_Module*>( module() );
116 \return corresponding study
118 LightApp_Study* LightApp_DataModel::getStudy() const
120 LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root()->root() );
123 return aRoot->study();
127 default implementation, always returns false so as not to mask study's isModified()
129 bool LightApp_DataModel::isModified() const
135 default implementation, always returns true so as not to mask study's isSaved()
137 bool LightApp_DataModel::isSaved() const