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 
00073   return result;
00074 }

WWidget * JWtHome::download (  )  [protected, virtual]

Implements Home.

Definition at line 76 of file JWtHome.C.

00077 {
00078   WContainerWidget *result = new WContainerWidget();
00079   result->addWidget(new WText(tr("home.download")));
00080   result->addWidget(new WText(tr("home.download.license")));
00081   result->addWidget(new WText(tr("home.download.requirements")));
00082   result->addWidget(new WText(tr("home.download.cvs")));
00083   result->addWidget(new WText(tr("home.download.packages")));
00084 
00085   releases_ = new WTable();
00086   readReleases(releases_);
00087   result->addWidget(releases_);
00088 
00089   return result;
00090 }

WWidget * JWtHome::sourceViewer ( const std::string &  deployPath  )  [protected, virtual]

Implements Home.

Definition at line 92 of file JWtHome.C.

00093 {
00094   return new ExampleSourceViewer(deployPath, jwtExamplePath_ + "/", "JAVA");
00095 }

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 125 of file JWtHome.C.

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

WWidget * JWtHome::example ( const char *  textKey,
const std::string &  sourceDir 
) [private]

Definition at line 97 of file JWtHome.C.

00098 {
00099   WContainerWidget *result = new WContainerWidget();
00100   new WText(tr(textKey), result);
00101   result->addWidget(linkSourceBrowser(sourceDir));
00102   return result;
00103 }

WWidget * JWtHome::helloWorldExample (  )  [private]

Definition at line 105 of file JWtHome.C.

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

WWidget * JWtHome::chartExample (  )  [private]

Definition at line 110 of file JWtHome.C.

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

WWidget * JWtHome::composerExample (  )  [private]

Definition at line 120 of file JWtHome.C.

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

WWidget * JWtHome::treeviewExample (  )  [private]

Definition at line 115 of file JWtHome.C.

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


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 Tue Sep 1 17:51:23 2009 for Wt by doxygen 1.5.6