JWtHome Class Reference

#include <JWtHome.h>

Inheritance diagram for JWtHome:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 JWtHome (const WEnvironment &env)

Protected Member Functions

virtual WWidgetexamples ()
virtual WWidgetdownload ()
virtual WWidgetsourceViewer (const std::string &deployPath)
virtual std::string filePrefix () const
WWidgetwrapView (WWidget *(JWtHome::*createFunction)())

Private Member Functions

WWidgetexample (const char *textKey, const std::string &sourceDir)
WWidgethelloWorldExample ()
WWidgetchartExample ()
WWidgetcomposerExample ()
WWidgettreeviewExample ()

Private Attributes

std::string jwtExamplePath_


Detailed Description

Definition at line 16 of file JWtHome.h.


Constructor & Destructor Documentation

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 }


Member Function Documentation

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]

Implements Home.

Definition at line 25 of file JWtHome.h.

00025 { return "jwt-"; }

WWidget * JWtHome::wrapView ( WWidget *(JWtHome::*)()  createFunction  )  [protected]

Definition at line 126 of file JWtHome.C.

00127 {
00128   return makeStaticModel(boost::bind(createWidget, this));
00129 }

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]

Definition at line 106 of file JWtHome.C.

00107 {
00108   return example("home.examples.hello", "hello");
00109 }

WWidget * JWtHome::chartExample (  )  [private]

Definition at line 111 of file JWtHome.C.

00112 {
00113   return example("home.examples.chart", "charts");
00114 }

WWidget * JWtHome::composerExample (  )  [private]

Definition at line 121 of file JWtHome.C.

00122 {
00123   return example("home.examples.composer", "composer");
00124 }

WWidget * JWtHome::treeviewExample (  )  [private]

Definition at line 116 of file JWtHome.C.

00117 {
00118   return example("home.examples.treeview", "treeviewdragdrop");
00119 }


Member Data Documentation

std::string JWtHome::jwtExamplePath_ [private]

Definition at line 37 of file JWtHome.h.


The documentation for this class was generated from the following files:

Generated on Fri Mar 26 17:12:12 2010 for Wt by doxygen 1.5.6