#include "HYDROGUI_DataModel.h"
#include "HYDROGUI_Module.h"
#include "HYDROGUI_DataObject.h"
+#include "HYDROGUI_NameValidator.h"
#include <HYDROData_Document.h>
#include <HYDROData_Entity.h>
#include <SUIT_Session.h>
#include <SUIT_Study.h>
+#include <LightApp_Application.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+
#include <QGroupBox>
#include <QLabel>
#include <QLayout>
// myObjectName = new QLineEdit( myObjectNameGroup );
myObjectName = new QLineEdit( aPage );
+ myValidator = new HYDROGUI_NameValidator(module(), myObjectName);
+ myObjectName->setValidator( myValidator );
+
+ connect( myValidator, SIGNAL( emptyName() ), this, SLOT( onEmptyName() ) );
+ connect( myValidator, SIGNAL( alreadyExists( QString ) ), this, SLOT( onAlreadyExists( QString ) ) );
//QBoxLayout* aNameLayout = new QHBoxLayout( myObjectNameGroup );
//aNameLayout->setMargin( 5 );
return aPage;
}
+void HYDROGUI_CalculationDlg::onEmptyName()
+{
+ QString aTitle = QObject::tr( "INSUFFICIENT_INPUT_DATA" );
+ QString aMessage = QObject::tr( "INCORRECT_OBJECT_NAME" );
+ SUIT_MessageBox::critical( module()->getApp()->desktop(), aTitle, aMessage );
+}
+
+void HYDROGUI_CalculationDlg::onAlreadyExists( QString theName )
+{
+ QString aTitle = QObject::tr( "INSUFFICIENT_INPUT_DATA" );
+ QString aMessage = QObject::tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( theName );
+ SUIT_MessageBox::critical( module()->getApp()->desktop(), aTitle, aMessage );
+}
+
QWizardPage* HYDROGUI_CalculationDlg::createZonesPage() {
QWizardPage* aPage = new QWizardPage( wizard() );
QFrame* aFrame = new QFrame( aPage );
void HYDROGUI_CalculationDlg::setEditedObject( const Handle(HYDROData_CalculationCase) theCase )
{
myEditedObject = theCase;
+ myValidator->setEditedObject( theCase );
HYDROGUI_DataObject* anobj = new HYDROGUI_DataObject( 0, NULL, "" );
myBrowser->setRoot(anobj);
LightApp_DataObject* aCaseItem = module()->getDataModel()->createObject( anobj,
myEditedObject, "", true );
-
myBrowser->updateTree();
myBrowser->openLevels();
}