Wt examples
3.2.3
|
#include <JWtHome.h>
Public Member Functions | |
JWtHome (const WEnvironment &env) | |
Protected Member Functions | |
virtual WWidget * | examples () |
virtual WWidget * | createQuoteForm () |
virtual WWidget * | sourceViewer (const std::string &deployPath) |
virtual std::string | filePrefix () const |
WWidget * | wrapView (WWidget *(JWtHome::*createFunction)()) |
Private Member Functions | |
WWidget * | example (const char *textKey, const std::string &sourceDir) |
WWidget * | helloWorldExample () |
WWidget * | chartExample () |
WWidget * | composerExample () |
WWidget * | treeviewExample () |
WWidget * | chatExample () |
WWidget * | figtreeExample () |
WWidget * | widgetGalleryExample () |
Private Attributes | |
std::string | jwtExamplePath_ |
JWtHome::JWtHome | ( | const WEnvironment & | env | ) |
Definition at line 27 of file JWtHome.C.
: Home(env, "JWt, Java Web Toolkit", "jwt-home", "css/jwt") { addLanguage(Lang("en", "/", "en", "English")); char* jwtExamplePath = getenv("JWT_EXAMPLE_PATH"); if (jwtExamplePath) jwtExamplePath_ = jwtExamplePath; else jwtExamplePath_ = "/home/pieter/projects/jwt/wt-port/java/examples/"; init(); }
WWidget * JWtHome::chartExample | ( | ) | [private] |
WWidget * JWtHome::chatExample | ( | ) | [private] |
WWidget * JWtHome::composerExample | ( | ) | [private] |
WWidget * JWtHome::createQuoteForm | ( | ) | [protected, virtual] |
WWidget * JWtHome::example | ( | const char * | textKey, |
const std::string & | sourceDir | ||
) | [private] |
Definition at line 106 of file JWtHome.C.
{ WContainerWidget *result = new WContainerWidget(); new WText(tr(textKey), result); result->addWidget(linkSourceBrowser(sourceDir)); return result; }
WWidget * JWtHome::examples | ( | ) | [protected, virtual] |
Implements Home.
Definition at line 43 of file JWtHome.C.
{ WContainerWidget *result = new WContainerWidget(); WText *intro = new WText(tr("home.examples")); intro->setInternalPathEncoding(true); result->addWidget(intro); examplesMenu_ = new WTabWidget(result); WAnimation animation(WAnimation::SlideInFromRight, WAnimation::EaseIn); examplesMenu_->contentsStack()->setTransitionAnimation(animation, true); /* * The following code is functionally equivalent to: * * examplesMenu_->addTab(helloWorldExample(), "Hello world"); * * However, we optimize here for memory consumption (it is a homepage * after all, and we hope to be slashdotted some day) * * Therefore, we wrap all the static content (including the tree * widgets), into WViewWidgets with static models. In this way the * widgets are not actually stored in memory on the server. */ // The call ->setPathComponent() is to use "/examples/" instead of // "/examples/hello_world" as internal path examplesMenu_->addTab(wrapView(&JWtHome::helloWorldExample), tr("hello-world"))->setPathComponent(""); examplesMenu_->addTab(wrapView(&JWtHome::chartExample), tr("charts")); examplesMenu_->addTab(wrapView(&JWtHome::treeviewExample), tr("treeview")); examplesMenu_->addTab(wrapView(&JWtHome::composerExample), tr("mail-composer")); examplesMenu_->addTab(wrapView(&JWtHome::chatExample), tr("chat")); examplesMenu_->addTab(wrapView(&JWtHome::figtreeExample), tr("figtree")); examplesMenu_->addTab(wrapView(&JWtHome::widgetGalleryExample), tr("widget-gallery")); // Enable internal paths for the example menu examplesMenu_->setInternalPathEnabled("/examples"); examplesMenu_->currentChanged().connect(this, &Home::googleAnalyticsLogger); return result; }
WWidget * JWtHome::figtreeExample | ( | ) | [private] |
Definition at line 139 of file JWtHome.C.
{ WContainerWidget *result = new WContainerWidget(); WText *text = new WText(tr("home.examples.figtree"), result); text->setInternalPathEncoding(true); return result; }
virtual std::string JWtHome::filePrefix | ( | ) | const [inline, protected, virtual] |
WWidget * JWtHome::helloWorldExample | ( | ) | [private] |
WWidget * JWtHome::sourceViewer | ( | const std::string & | deployPath | ) | [protected, virtual] |
Implements Home.
Definition at line 101 of file JWtHome.C.
{ return new ExampleSourceViewer(deployPath, jwtExamplePath_ + "/", "JAVA"); }
WWidget * JWtHome::treeviewExample | ( | ) | [private] |
WWidget * JWtHome::widgetGalleryExample | ( | ) | [private] |
Definition at line 152 of file JWtHome.C.
{ return makeStaticModel(boost::bind(createWidget, this)); }
std::string JWtHome::jwtExamplePath_ [private] |