X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkWtBlackBox.cxx;h=a5925d48a95cae3c3e3efb79b7b1a3aba041df73;hb=87efce51877a540d943b1aa26307994b38bba55b;hp=cdb6b79a3d39f06cdbed86ea159780593424fef1;hpb=75cedb45ce5353caf2b8cdd6c6f7fcff3b3a6555;p=bbtk.git diff --git a/kernel/src/bbtkWtBlackBox.cxx b/kernel/src/bbtkWtBlackBox.cxx index cdb6b79..a5925d4 100644 --- a/kernel/src/bbtkWtBlackBox.cxx +++ b/kernel/src/bbtkWtBlackBox.cxx @@ -1,3 +1,4 @@ + /* # --------------------------------------------------------------------- # @@ -44,8 +45,7 @@ #include "bbtkWtBlackBox.h" #include "bbtkBlackBoxOutputConnector.h" -//DELETE ME -#include + //#include "bbtkWxContainerBlackBox.h" //#include @@ -53,75 +53,137 @@ //#include "bbtkData.h" //#include "bbtkFactory.h" + + + namespace bbtk { + + +/* + class jScript + { + public: + jScript(); + std::string jScriptLine; + }; +*/ //========================================================================= - // WxFrame + // wtData structure //========================================================================= + // For the very first contruction of the application +/* struct wtServerData + { + std::string docRoot; + std::string port; + std::string address; + + }; + */ + struct wtData + { + Wt::WContainerWidget *parent; + WtBlackBox::Pointer b; + Wt::WString title; + }; + +/* jScript::jScript() + { + jScriptLine = ""; + } +*/ +// static bbtk::jScript* js = new bbtk::jScript(); + static wtData myWtData; +// static wtServerData loadedJS; + //static std::string* jss; + + + + //========================================================================= + // javaScript Line + //========================================================================= + //Contains all the JS statements needed for the bbwt. + + + //========================================================================= + // WxFrame + //========================================================================= + // Application WT deployed //================================================================== - class WtWContainer : public Wt::WContainerWidget + + + + class WtWFrame : public Wt::WApplication { public: - WtWContainer(WtBlackBox::Pointer b, - Wt::WContainerWidget *parent, - Wt::WString title/*, - wxSize size);*/ + WtWFrame( + const Wt::WEnvironment& env ); - ~WtWContainer(); - // void OnCloseWindow(wxCloseEvent& event); - + ~WtWFrame(); + + + + WtBlackBox::WeakPointer mBox; + - WtBlackBox::WeakPointer mBox; - // DECLARE_EVENT_TABLE(); - }; - - // BEGIN_EVENT_TABLE(WxFrame, wxFrame) - // EVT_CLOSE(WxFrame::OnCloseWindow) - //END_EVENT_TABLE(); - //================================================================== - - //================================================================== - - WtWContainer::WtWContainer(WtBlackBox::Pointer b, - Wt::WContainerWidget *parent, - Wt::WString title/*, - wxSize size) */ + + + WtWFrame::WtWFrame( + const Wt::WEnvironment& env ) : - Wt::WContainerWidget( parent), - mBox(b) - { - bbtkDebugMessage("widget",9,"["<bbGetName()<<"] Wt::Widget()" - <bbSetWindow(this); - // Insert the widget into the window - //wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - std::cout<<"Creando WebWIDGET DELETE ME ---- bbtkWtBlackBox.cxx.................30%"<objectName()<require("/home/gonzalez/Documents/CREATOOLS/wt_library/wt/bbtk_wt_PKG/src/js/xtk.js"); + + //this->require("http://get.goXTK.com/xtk.js"); + //this->useStyleSheet("css/demo.css"); + + + //this->require("http://get.goXTK.com/xtk.js"); + this->require( "resourcesXTK/xtk.js" ); + + + // this->require("http://get.goXTK.com/xtk_edge.js"); +// this->require("http://get.goXTK.com/xtk_xdat.gui.js"); + this->require( "resourcesXTK/xtk_xdat.gui.js" ); + + + this->useStyleSheet("resourcesXTK/styleWT.css"); + + + // std::cout<<"Cargado------------ "<setMinimumSize(800,500); std::cout<<"Creando WebWIDGET DELETE ME ---- bbtkWtBlackBox.cxx.................50%"<addWidget(new Wt::WContainerWidget()); - std::cout<<"Creando WebWIDGET DELETE ME ---- bbtkWtBlackBox.cxx.................58%"<bbUserCreateWidget(this); - Wt::WContainerWidget* widget = b->bbGetOutputWidget(); - this->addWidget(widget); - /* Wt::WWidget* widget = b->bbGetOutputWidget(); - sizer->Add( widget, 1, wxALL|wxGROW, 2); - SetSizer(sizer); - Layout(); -*/ + myWtData.b->bbUserCreateWidget(myCont); + root()->addWidget(myWtData.parent); + //bbmWindow = myCont; + this->refresh(); + //jss = WtBlackBox::jScript; + std::cout<<"Creando WebWIDGET DELETE ME ---- bbtkWtBlackBox.cxx.................80%"<doJavaScript(bbtk::jScript); + + } //================================================================== //================================================================== - WtWContainer::~WtWContainer() + WtWFrame::~WtWFrame() { if (mBox.lock()) bbtkDebugMessage("widget",9,"["<bbGetName() @@ -129,17 +191,22 @@ namespace bbtk <bbSetWindow(0); WWt::DecNbWindowsAlive(); } + + + Wt::WApplication *createApplication(const Wt::WEnvironment& env) + { + return new WtWFrame(env); + } - //================================================================== //========================================================================= - // WxDialog + // WxDialogWxBlackBox::Pointer box //========================================================================= //================================================================== @@ -151,7 +218,7 @@ namespace bbtk wxWindow *parent, wxString title, wxSize size); - ~WxDialog(); + ~WxDialog();Wt::GetTopWindow() void OnCloseWindow(wxCloseEvent& event); @@ -186,7 +253,7 @@ namespace bbtk mBox(b) { bbtkDebugMessage("widget",9,"WxDialog::WxDialog ["<bbGetName()<<"]" - <bbSetWindow(this); // Insert the widget into the window @@ -198,7 +265,7 @@ namespace bbtk Layout(); } //================================================================== - //================================================================== + //===========================organise======================================= WxDialog::~WxDialog() { bbtkDebugMessage("widget",9,"WxDialog::~WxDialog()"<bbSetWindow(0); + bbtkDebugMessage("widget",9,"WxDialog::OnCloseWindow()"<bbSetWindow(0); http://doodle.com/qx65tfxismf7d6ku5vxykghs/admin#table Wx::DecNbWindowsAlive(); this->Destroy(); } @@ -227,8 +294,18 @@ namespace bbtk //========================================================================= //========================================================================= BBTK_BLACK_BOX_IMPLEMENTATION(WtBlackBox,WidgetBlackBox); + + //std::string WtBlackBox::wtServerData::docRoot = "/home/gonzalez/Documents/pruebaResources"; + //std::string WtBlackBox::wtServerData::docRoot = "/usr/local/share/wtResources"; + //std::string WtBlackBox::wtServerData::port = "8081"; + + std::string WtBlackBox::wtServerData::docRoot = ""; + std::string WtBlackBox::wtServerData::port = ""; + std::string WtBlackBox::wtServerData::address = "0.0.0.0"; + int WtBlackBox::wtServerData::argc = 0; + char **WtBlackBox::wtServerData::argv = NULL; + //========================================================================= - //========================================================================= void WtBlackBox::bbUserSetDefaultValues() { @@ -240,10 +317,9 @@ namespace bbtk //========================================================================= void WtBlackBox::bbUserInitializeProcessing() { - //TODO delete this commment - std::cout<<"Initializing WT BlackBox --- DELETE this message bbtkWtBlackBox.cxx"< WtBlackBox::bbCreateDialogWindow() - No Dialog must be created, it is a web app" <(), - Wx::GetTopWindow(), - std2wx( bbGetInputWinTitle() - + " - bbtk (c) CREATIS"), - wxSize( bbGetInputWinWidth() , - bbGetInputWinHeight() ) ); - w->Show(false); - // w->ShowModal(); -*/ + } //========================================================================= @@ -278,35 +345,55 @@ namespace bbtk //================================================================== /// Callback for creating a Frame window - void WtBlackBox::bbCreateFrameWindow() - { + void WtBlackBox::bbCreateFrameWindow() + { + + bbtkBlackBoxDebugMessage("widget",3, + "==> WtBlackBox::bbCreateFrameWindow() - parent = " + <(); + myWtData.title = std2wt( bbGetInputWinTitle() + + " - bbtk (c) CREATIS"); + + + + - std::cout<<"Creating Container WT -- DELETE THIS MESSAGE bbtkWTBlackBox.cxx"< WtBlackBox::bbCreateFrameWindow() - parent = " - <(), - WWt::GetTopWindow(), - std2wt( bbGetInputWinTitle() - + " - bbtk (c) CREATIS") - ); - std::cout<<"Container created succesfully -- DELETE THIS MESSAGE bbtkWTBlackBox.cxx"<(), - Wx::GetTopWindow(), - std2wx( bbGetInputWinTitle() - + " - bbtk (c) CREATIS"), - wxSize( bbGetInputWinWidth() , - bbGetInputWinHeight() ) ); + //char *argv[7] = {"./WtTest","--docroot","/home/gonzalez/Documents/pruebaResources","--http-address","0.0.0.0","--http-port","8080"}; + //int argc = 7; - w->Show(); +/* + char *argv[7] = {"./WtTest" +,"--docroot",(char*)WtBlackBox::wtServerData::docRoot.c_str() +,"--http-address",(char*)WtBlackBox::wtServerData::address.c_str() +,"--http-port",(char*)WtBlackBox::wtServerData::port.c_str() +}; + int argc = 3; + std::cout<<" --- PUERTO :"<isRunning()) + { + std::cout<<"Checking the existence of a Server deployed -DELETE THIS MESSAGE bbtkWTBlackBox.cxx"<stop(); + } + */ + std::cout<<"EED WtBlackBox::bbCreateFrameWindow Deploying Server -- Definition of server parameters by default -DELETE THIS MESSAGE bbtkWTBlackBox.cxx"<Show(); - WWt::CreateWtAppIfNeeded(); + // WWt::CreateWtAppIfNeeded(); bbSetShown(true); } }