#include <JWtHome.h>
Public Member Functions | |
JWtHome (const WEnvironment &env) | |
Protected Member Functions | |
virtual WWidget * | examples () |
virtual WWidget * | download () |
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 () |
Private Attributes | |
std::string | jwtExamplePath_ |
Definition at line 16 of file JWtHome.h.
JWtHome::JWtHome | ( | const WEnvironment & | env | ) |
Definition at line 22 of file JWtHome.C.
00023 : Home(env, 00024 "JWt, Java Web Toolkit", 00025 "jwt-home", "css/jwt") 00026 { 00027 addLanguage(Lang("en", "/", "en", "English")); 00028 00029 char* jwtExamplePath = getenv("JWT_EXAMPLE_PATH"); 00030 if (jwtExamplePath) 00031 jwtExamplePath_ = jwtExamplePath; 00032 else 00033 jwtExamplePath_ = "/home/pieter/projects/jwt/wt-port/java/examples/"; 00034 00035 init(); 00036 }
WWidget * JWtHome::examples | ( | ) | [protected, virtual] |
Implements Home.
Definition at line 38 of file JWtHome.C.
00039 { 00040 WContainerWidget *result = new WContainerWidget(); 00041 00042 result->addWidget(new WText(tr("home.examples"))); 00043 00044 examplesMenu_ = new WTabWidget(AlignTop | AlignJustify, result); 00045 00046 /* 00047 * The following code is functionally equivalent to: 00048 * 00049 * examplesMenu_->addTab(helloWorldExample(), "Hello world"); 00050 * 00051 * However, we optimize here for memory consumption (it is a homepage 00052 * after all, and we hope to be slashdotted some day) 00053 * 00054 * Therefore, we wrap all the static content (including the tree 00055 * widgets), into WViewWidgets with static models. In this way the 00056 * widgets are not actually stored in memory on the server. 00057 */ 00058 00059 // The call ->setPathComponent() is to use "/examples/" instead of 00060 // "/examples/hello_world" as internal path 00061 examplesMenu_->addTab(wrapView(&JWtHome::helloWorldExample), 00062 tr("hello-world"))->setPathComponent(""); 00063 examplesMenu_->addTab(wrapView(&JWtHome::chartExample), 00064 tr("charts")); 00065 examplesMenu_->addTab(wrapView(&JWtHome::treeviewExample), 00066 tr("treeview")); 00067 examplesMenu_->addTab(wrapView(&JWtHome::composerExample), 00068 tr("mail-composer")); 00069 00070 // Enable internal paths for the example menu 00071 examplesMenu_->setInternalPathEnabled("/examples"); 00072 examplesMenu_->currentChanged().connect(SLOT(this, Home::googleAnalyticsLogger)); 00073 00074 return result; 00075 }
WWidget * JWtHome::download | ( | ) | [protected, virtual] |
Implements Home.
Definition at line 77 of file JWtHome.C.
00078 { 00079 WContainerWidget *result = new WContainerWidget(); 00080 result->addWidget(new WText(tr("home.download"))); 00081 result->addWidget(new WText(tr("home.download.license"))); 00082 result->addWidget(new WText(tr("home.download.requirements"))); 00083 result->addWidget(new WText(tr("home.download.cvs"))); 00084 result->addWidget(new WText(tr("home.download.packages"))); 00085 00086 releases_ = new WTable(); 00087 readReleases(releases_); 00088 result->addWidget(releases_); 00089 00090 return result; 00091 }
WWidget * JWtHome::sourceViewer | ( | const std::string & | deployPath | ) | [protected, virtual] |
Implements Home.
Definition at line 93 of file JWtHome.C.
00094 { 00095 return new ExampleSourceViewer(deployPath, jwtExamplePath_ + "/", "JAVA"); 00096 }
virtual std::string JWtHome::filePrefix | ( | ) | const [inline, protected, virtual] |
WWidget * JWtHome::example | ( | const char * | textKey, | |
const std::string & | sourceDir | |||
) | [private] |
Definition at line 98 of file JWtHome.C.
00099 { 00100 WContainerWidget *result = new WContainerWidget(); 00101 new WText(tr(textKey), result); 00102 result->addWidget(linkSourceBrowser(sourceDir)); 00103 return result; 00104 }
WWidget * JWtHome::helloWorldExample | ( | ) | [private] |
WWidget * JWtHome::chartExample | ( | ) | [private] |
WWidget * JWtHome::composerExample | ( | ) | [private] |
WWidget * JWtHome::treeviewExample | ( | ) | [private] |
std::string JWtHome::jwtExamplePath_ [private] |