Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

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 ()
WWidgetchatExample ()
WWidgetfigtreeExample ()
WWidgetwidgetGalleryExample ()

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.

  : 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();
}

Member Function Documentation

WWidget * JWtHome::chartExample (  ) [private]

Definition at line 117 of file JWtHome.C.

{
  return example("home.examples.chart", "charts");
}
WWidget * JWtHome::chatExample (  ) [private]

Definition at line 132 of file JWtHome.C.

{
  return example("home.examples.chat", "simplechat");
}
WWidget * JWtHome::composerExample (  ) [private]

Definition at line 127 of file JWtHome.C.

{
  return example("home.examples.composer", "composer");
}
WWidget * JWtHome::download (  ) [protected, virtual]

Implements Home.

Definition at line 83 of file JWtHome.C.

{
  WContainerWidget *result = new WContainerWidget();
  result->addWidget(new WText(tr("home.download")));
  result->addWidget(new WText(tr("home.download.license")));
  result->addWidget(new WText(tr("home.download.packages")));

  releases_ = new WTable();
  readReleases(releases_);
  result->addWidget(releases_);
  result->addWidget(new WText(tr("home.download.requirements")));
  result->addWidget(new WText(tr("home.download.cvs")));

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

Definition at line 104 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 38 of file JWtHome.C.

{
  WContainerWidget *result = new WContainerWidget();

  result->addWidget(new WText(tr("home.examples")));

  examplesMenu_ = new WTabWidget(AlignTop | AlignJustify, result);

  /*
   * 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 137 of file JWtHome.C.

{
  WContainerWidget *result = new WContainerWidget();
  new WText(tr("home.examples.figtree"), result);
  return result;
}
virtual std::string JWtHome::filePrefix (  ) const [inline, protected, virtual]

Implements Home.

Definition at line 25 of file JWtHome.h.

{ return "jwt-"; }
WWidget * JWtHome::helloWorldExample (  ) [private]

Definition at line 112 of file JWtHome.C.

{
  return example("home.examples.hello", "hello");
}
WWidget * JWtHome::sourceViewer ( const std::string &  deployPath ) [protected, virtual]

Implements Home.

Definition at line 99 of file JWtHome.C.

{
  return new ExampleSourceViewer(deployPath, jwtExamplePath_ + "/", "JAVA");
}
WWidget * JWtHome::treeviewExample (  ) [private]

Definition at line 122 of file JWtHome.C.

{
  return example("home.examples.treeview", "treeviewdragdrop");
}
WWidget * JWtHome::widgetGalleryExample (  ) [private]

Definition at line 144 of file JWtHome.C.

{
  return example("home.examples.widgetgallery", "widgetgallery");
}
WWidget * JWtHome::wrapView ( WWidget *(JWtHome::*)()  createFunction ) [protected]

Definition at line 149 of file JWtHome.C.

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

Member Data Documentation

std::string JWtHome::jwtExamplePath_ [private]

Definition at line 40 of file JWtHome.h.


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

Generated on Fri Feb 4 2011 for the C++ Web Toolkit (Wt) by doxygen 1.7.2