Wt examples  3.3.0
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
JWtHome Class Reference

#include <JWtHome.h>

Inheritance diagram for JWtHome:
Inheritance graph
[legend]

Public Member Functions

 JWtHome (const WEnvironment &env)
 
- Public Member Functions inherited from Home
 Home (const WEnvironment &env, const std::string &title, const std::string &resourceBundle, const std::string &cssPath)
 
virtual ~Home ()
 
void googleAnalyticsLogger ()
 
- Public Member Functions inherited from Wt::WApplication
 WApplication (const WEnvironment &environment)
 
 ~WApplication ()
 
const WEnvironmentenvironment () const
 
WContainerWidgetroot () const
 
WWidgetfindWidget (const std::string &name)
 
void setTitle (const WString &title)
 
const WStringtitle () const
 
const WStringcloseMessage () const
 
WLocalizedStringslocalizedStrings ()
 
void setLocalizedStrings (WLocalizedStrings *stringResolver)
 
WMessageResourceBundlemessageResourceBundle ()
 
void setLocale (const WLocale &locale)
 
const WLocalelocale () const
 
virtual void refresh ()
 
void bindWidget (WWidget *widget, const std::string &domId)
 
std::string docRoot () const
 
std::string sessionId () const
 
void changeSessionId ()
 
void processEvents ()
 
void setAjaxMethod (AjaxMethod method)
 
AjaxMethod ajaxMethod () const
 
virtual void initialize ()
 
virtual void finalize ()
 
void setTwoPhaseRenderingThreshold (int size)
 
void setCookie (const std::string &name, const std::string &value, int maxAge, const std::string &domain="", const std::string &path="", bool secure=false)
 
void removeCookie (const std::string &name, const std::string &domain="", const std::string &path="")
 
void addMetaLink (const std::string &href, const std::string &rel, const std::string &media, const std::string &hreflang, const std::string &type, const std::string &sizes, bool disabled)
 
void removeMetaLink (const std::string &href)
 
void addMetaHeader (const std::string &name, const WString &content, const std::string &lang="")
 
void addMetaHeader (MetaHeaderType type, const std::string &name, const WString &content, const std::string &lang="")
 
void removeMetaHeader (MetaHeaderType type, const std::string &name="")
 
WLogEntry log (const std::string &type) const
 
void setLoadingIndicator (WLoadingIndicator *indicator)
 
WLoadingIndicatorloadingIndicator () const
 
void quit ()
 
bool isQuited () const
 
bool hasQuit () const
 
::int64_t maximumRequestSize () const
 
Signal< ::int64_t > & requestTooLarge ()
 
void setConfirmCloseMessage (const WString &message)
 
void deferRendering ()
 
void resumeRendering ()
 
boost::function< void()> bind (const F &f)
 
std::string encodeUntrustedUrl (const std::string &url) const
 
void pushExposedConstraint (WWidget *w)
 
WCssStyleSheetstyleSheet ()
 
void useStyleSheet (const WLink &link, const std::string &media="all")
 
void useStyleSheet (const WLink &link, const std::string &condition, const std::string &media)
 
void useStyleSheet (const WCssStyleSheet &styleSheet, const std::string &condition="")
 
void setTheme (const WTheme *theme)
 
const WThemetheme () const
 
void setCssTheme (const std::string &name)
 
void setLayoutDirection (LayoutDirection direction)
 
LayoutDirection layoutDirection () const
 
void setBodyClass (const std::string &styleClass)
 
std::string bodyClass () const
 
void setHtmlClass (const std::string &styleClass)
 
std::string htmlClass () const
 
std::string url (const std::string &internalPath=std::string()) const
 
virtual std::string makeAbsoluteUrl (const std::string &url) const
 
std::string resolveRelativeUrl (const std::string &url) const
 
std::string bookmarkUrl () const
 
std::string bookmarkUrl (const std::string &internalPath) const
 
void setInternalPath (const std::string &path, bool emitChange=false)
 
void setInternalPathDefaultValid (bool valid)
 
bool internalPathDefaultValid () const
 
void setInternalPathValid (bool valid)
 
bool internalPathValid () const
 
std::string internalPath () const
 
std::string internalPathNextPart (const std::string &path) const
 
std::string internalSubPath (const std::string &path) const
 
bool internalPathMatches (const std::string &path) const
 
Signal< std::string > & internalPathChanged ()
 
Signal< std::string > & internalPathInvalid ()
 
void redirect (const std::string &url)
 
void enableUpdates (bool enabled=true)
 
bool updatesEnabled () const
 
void triggerUpdate ()
 
UpdateLock getUpdateLock ()
 
void attachThread (bool attach=true)
 
void doJavaScript (const std::string &javascript, bool afterLoaded=true)
 
void addAutoJavaScript (const std::string &javascript)
 
void declareJavaScriptFunction (const std::string &name, const std::string &function)
 
bool require (const std::string &url, const std::string &symbol=std::string())
 
bool requireJQuery (const std::string &url)
 
bool customJQuery () const
 
void setJavaScriptClass (const std::string &className)
 
std::string javaScriptClass ()
 
EventSignal< WKeyEvent > & globalKeyWentDown ()
 
EventSignal< WKeyEvent > & globalKeyPressed ()
 
EventSignal< WKeyEvent > & globalKeyWentUp ()
 
EventSignalglobalEnterPressed ()
 
EventSignalglobalEscapePressed ()
 

Protected Member Functions

virtual WWidgetexamples ()
 
virtual WWidgetcreateQuoteForm ()
 
virtual WWidgetsourceViewer (const std::string &deployPath)
 
virtual std::string filePrefix () const
 
WWidgetwrapView (WWidget *(JWtHome::*createFunction)())
 
- Protected Member Functions inherited from Home
void init ()
 
void addLanguage (const Lang &l)
 
WWidgetlinkSourceBrowser (const std::string &examplePath)
 
WString tr (const char *key)
 
std::string href (const std::string &url, const std::string &description)
 
void readReleases (WTable *releaseTable)
 
- Protected Member Functions inherited from Wt::WApplication
virtual void notify (const WEvent &e)
 
virtual bool isExposed (WWidget *w) const
 
virtual void enableAjax ()
 
virtual void unload ()
 

Private Member Functions

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

Private Attributes

std::string jwtExamplePath_
 

Additional Inherited Members

- Public Types inherited from Wt::WApplication
enum  AjaxMethod
 
typedef Wt::ApplicationCreator ApplicationCreator
 
typedef boost::function
< WApplication *(const
WEnvironment &)> 
ApplicationCreator
 
- Static Public Member Functions inherited from Wt::WApplication
static WApplicationinstance ()
 
static std::string resourcesUrl ()
 
static std::string relativeResourcesUrl ()
 
static std::string appRoot ()
 
static bool readConfigurationProperty (const std::string &name, std::string &value)
 
- Public Attributes inherited from Wt::WApplication
 XMLHttpRequest
 
 DynamicScriptTag
 
- Protected Attributes inherited from Home
WTabWidgetexamplesMenu_
 
WTablereleases_
 

Detailed Description

Definition at line 16 of file JWtHome.h.

Constructor & Destructor Documentation

JWtHome::JWtHome ( const WEnvironment env)

Definition at line 27 of file JWtHome.C.

28  : Home(env,
29  "JWt, Java Web Toolkit",
30  "jwt-home", "css/jwt")
31 {
32  addLanguage(Lang("en", "/", "en", "English"));
33 
34  char* jwtExamplePath = getenv("JWT_EXAMPLE_PATH");
35  if (jwtExamplePath)
36  jwtExamplePath_ = jwtExamplePath;
37  else
38  jwtExamplePath_ = "/home/pieter/projects/jwt/wt-port/java/examples/";
39 
40  init();
41 }

Member Function Documentation

WWidget * JWtHome::chartExample ( )
private

Definition at line 119 of file JWtHome.C.

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

Definition at line 134 of file JWtHome.C.

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

Definition at line 129 of file JWtHome.C.

130 {
131  return example("home.examples.composer", "composer");
132 }
WWidget * JWtHome::createQuoteForm ( )
protectedvirtual

Implements Home.

Definition at line 92 of file JWtHome.C.

93 {
94 #ifdef WT_EMWEB_BUILD
95  return new QuoteForm(QuoteForm::JWt);
96 #else
97  return 0;
98 #endif
99 }
WWidget * JWtHome::example ( const char *  textKey,
const std::string &  sourceDir 
)
private

Definition at line 106 of file JWtHome.C.

107 {
108  WContainerWidget *result = new WContainerWidget();
109  new WText(tr(textKey), result);
110  result->addWidget(linkSourceBrowser(sourceDir));
111  return result;
112 }
WWidget * JWtHome::examples ( )
protectedvirtual

Implements Home.

Definition at line 43 of file JWtHome.C.

44 {
45  WContainerWidget *result = new WContainerWidget();
46 
47  WText *intro = new WText(tr("home.examples"));
48  intro->setInternalPathEncoding(true);
49  result->addWidget(intro);
50 
51  examplesMenu_ = new WTabWidget(result);
52  WAnimation animation(WAnimation::SlideInFromRight, WAnimation::EaseIn);
54 
55  /*
56  * The following code is functionally equivalent to:
57  *
58  * examplesMenu_->addTab(helloWorldExample(), "Hello world");
59  *
60  * However, we optimize here for memory consumption (it is a homepage
61  * after all, and we hope to be slashdotted some day)
62  *
63  * Therefore, we wrap all the static content (including the tree
64  * widgets), into WViewWidgets with static models. In this way the
65  * widgets are not actually stored in memory on the server.
66  */
67 
68  // The call ->setPathComponent() is to use "/examples/" instead of
69  // "/examples/hello_world" as internal path
71  tr("hello-world"))->setPathComponent("");
73  tr("charts"));
75  tr("treeview"));
77  tr("mail-composer"));
79  tr("chat"));
81  tr("figtree"));
83  tr("widget-gallery"));
84 
85  // Enable internal paths for the example menu
88 
89  return result;
90 }
WWidget * JWtHome::figtreeExample ( )
private

Definition at line 139 of file JWtHome.C.

140 {
141  WContainerWidget *result = new WContainerWidget();
142  WText *text = new WText(tr("home.examples.figtree"), result);
143  text->setInternalPathEncoding(true);
144  return result;
145 }
virtual std::string JWtHome::filePrefix ( ) const
inlineprotectedvirtual

Implements Home.

Definition at line 25 of file JWtHome.h.

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

Definition at line 114 of file JWtHome.C.

115 {
116  return example("home.examples.hello", "hello");
117 }
WWidget * JWtHome::sourceViewer ( const std::string &  deployPath)
protectedvirtual

Implements Home.

Definition at line 101 of file JWtHome.C.

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

Definition at line 124 of file JWtHome.C.

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

Definition at line 147 of file JWtHome.C.

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

Definition at line 152 of file JWtHome.C.

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

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 May 31 2013 for the C++ Web Toolkit (Wt) by doxygen 1.8.3.1