Skip to content

Commit c2d3b9b

Browse files
author
Koen Deforche
committed
see Changelog
1 parent 2c2b638 commit c2d3b9b

File tree

162 files changed

+6103
-1952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+6103
-1952
lines changed

Changelog

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
10-05-2010:
2+
* WTableView: now supports (almost) same API as WTreeView, with the
3+
similar style, but better performance for tabular data.
4+
5+
* WTableView, WTreeView, WAbstractItemView: support non-AJAX rendering
6+
using a paging bar.
7+
8+
* WAbstractItemDelegate, WItemDelegate, WAbstractItemView:
9+
supports editing
10+
11+
* Dbo/QueryModel: a Wt model for viewing data from a Dbo::Query
12+
result (a first version).
13+
14+
* Dbo/SqlTraits: sql_result_traits was renamed to query_result_traits,
15+
and its API updated to allow more robust query creation and result
16+
interpretation as a list of boost::any's
17+
18+
* Signal: SignalBase and EventSignalBase are now documented API
19+
20+
* WFlashObject: reimplemented with support for layout managers and
21+
new API for alternative content
22+
23+
* WHTML5Video: HTML-5 video implementation, will become part of
24+
generic video support later
25+
26+
* http/Reply.C, http/StaticReply.C: support for http range header
27+
and partial content
28+
29+
* web/CgiParser.C: fix parsing logic error for multi-part/formdata
30+
131
28-04-2010:
232
* WTimer: implement singleShot(f) with f a function object variant
333

INSTALL.win32.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h2>Requirements</h2>
5656
<h2>Step by step instructions to build and install the Wt library</h2>
5757

5858
Up to date instructions are located on the Wt wiki page:
59-
<a href="http://www.webtoolkit.eu/wt/wiki/index.php/Installing_Wt_2.1_on_MS_Windows">Installing Wt on MS Windows</a>
59+
<a href="http://redmine.emweb.be/projects/wt/wiki/Installing_Wt_on_MS_Windows">Installing Wt on MS Windows</a>
6060

6161
<h2>Trying the examples (or your own Wt application) using wthttpd</h3>
6262

examples/blog/BlogRSSFeed.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ BlogRSSFeed::BlogRSSFeed(const std::string& sqliteDb,
2121
const std::string& url,
2222
const std::string& description)
2323
: session_(new BlogSession(sqliteDb)),
24-
url_(url),
2524
title_(title),
25+
url_(url),
2626
description_(description)
2727
{ }
2828

examples/blog/view/BlogView.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public:
3737
BlogImpl(const std::string& basePath, const std::string& sqliteDb,
3838
const std::string& rssFeedUrl)
3939
: basePath_(basePath),
40-
session_(sqliteDb),
41-
rssFeedUrl_(rssFeedUrl)
40+
rssFeedUrl_(rssFeedUrl),
41+
session_(sqliteDb)
4242
{
4343
WApplication *app = wApp;
4444

examples/charts/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ADD_EXECUTABLE(charts.wt
55
CsvUtil.C
66
ChartsApplication.C
77
)
8-
TARGET_LINK_LIBRARIES(charts.wt wtext ${EXAMPLES_CONNECTOR})
8+
TARGET_LINK_LIBRARIES(charts.wt wt ${EXAMPLES_CONNECTOR})
99

1010
#
1111
# If you have Wt installed somehwere, you should use the
@@ -25,5 +25,3 @@ CONFIGURE_FILE(
2525
${WT_SOURCE_DIR}/deploy.sh
2626
${CMAKE_CURRENT_BINARY_DIR}/deploy.sh
2727
)
28-
29-
ADD_DEPENDENCIES(charts.wt wt wtext ${EXAMPLES_CONNECTOR})

examples/charts/ChartsApplication.C

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,24 @@ using namespace Wt;
1212
class ChartsApplication: public WApplication
1313
{
1414
public:
15-
ChartsApplication(const WEnvironment& env): WApplication(env) {
16-
setTitle("Charts example");
15+
ChartsApplication(const WEnvironment& env)
16+
: WApplication(env)
17+
{
18+
setTitle("Charts example");
1719

18-
messageResourceBundle().use("charts");
20+
setCssTheme("polished");
21+
messageResourceBundle().use("charts");
1922

20-
root()->setPadding(10);
21-
root()->resize(WLength::Auto, WLength::Auto);
23+
root()->setPadding(10);
24+
root()->resize(WLength::Auto, WLength::Auto);
2225

23-
new ChartsExample(root());
26+
new ChartsExample(root());
2427

2528

26-
/*
27-
* Set our style sheet last, so that it loaded after the ext stylesheets.
28-
*/
29-
useStyleSheet("charts.css");
29+
/*
30+
* Set our style sheet last, so that it loaded after the ext stylesheets.
31+
*/
32+
useStyleSheet("charts.css");
3033
}
3134
};
3235

examples/charts/ChartsExample.C

Lines changed: 58 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,15 @@
1414
#include <Wt/WApplication>
1515
#include <Wt/WDate>
1616
#include <Wt/WEnvironment>
17+
#include <Wt/WItemDelegate>
1718
#include <Wt/WStandardItemModel>
1819
#include <Wt/WText>
1920

2021
#include <Wt/WBorderLayout>
2122
#include <Wt/WFitLayout>
2223

23-
#include <Wt/Ext/Calendar>
24-
#include <Wt/Ext/Container>
25-
#include <Wt/Ext/DateField>
26-
#include <Wt/Ext/LineEdit>
27-
#include <Wt/Ext/NumberField>
28-
#include <Wt/Ext/Panel>
29-
#include <Wt/Ext/TableView>
24+
#include <Wt/WStandardItem>
25+
#include <Wt/WTableView>
3026

3127
#include <Wt/Chart/WCartesianChart>
3228
#include <Wt/Chart/WPieChart>
@@ -42,6 +38,11 @@ namespace {
4238

4339
if (f) {
4440
readFromCsv(f, model);
41+
42+
for (int row = 0; row < model->rowCount(); ++row)
43+
for (int col = 0; col < model->columnCount(); ++col)
44+
model->item(row, col)->setFlags(ItemIsSelectable | ItemIsEditable);
45+
4546
return model;
4647
} else {
4748
WString error(WString::tr("error-missing-data"));
@@ -73,30 +74,45 @@ CategoryExample::CategoryExample(Wt::WContainerWidget *parent):
7374
if (!model)
7475
return;
7576

76-
/*
77-
* If we have JavaScript, show an Ext table view that allows editing
78-
* of the model.
79-
*/
80-
if (wApp->environment().javaScript()) {
81-
WContainerWidget *w = new WContainerWidget(this);
82-
Ext::TableView *table = new Ext::TableView(w);
83-
table->setMargin(10, Top | Bottom);
84-
table->setMargin(WLength::Auto, Left | Right);
85-
table->resize(500, 175);
86-
table->setModel(model);
87-
table->setAutoExpandColumn(0);
88-
89-
table->setEditor(0, new Ext::LineEdit());
90-
91-
for (int i = 1; i < model->columnCount(); ++i) {
92-
Ext::NumberField *nf = new Ext::NumberField();
93-
table->setEditor(i, nf);
94-
}
77+
// Show a view that allows editing of the model.
78+
WContainerWidget *w = new WContainerWidget(this);
79+
WTableView *table = new WTableView(w);
80+
81+
table->setMargin(10, Top | Bottom);
82+
table->setMargin(WLength::Auto, Left | Right);
83+
84+
table->setModel(model);
85+
table->setSortingEnabled(true);
86+
table->setColumnResizeEnabled(true);
87+
table->setSelectionMode(NoSelection);
88+
table->setAlternatingRowColors(true);
89+
table->setColumnAlignment(0, AlignCenter);
90+
table->setHeaderAlignment(0, AlignCenter);
91+
table->setRowHeight(22); // height needed for line edit in IE
92+
93+
if (WApplication::instance()->environment().ajax()) {
94+
table->resize(600, 20 + 5*22);
95+
table->setEditTriggers(WAbstractItemView::SingleClicked);
96+
} else {
97+
table->resize(600, WLength::Auto);
98+
99+
// Editing does not really work without Ajax, it would require an
100+
// additional button somewhere to confirm the edited value
101+
table->setEditTriggers(WAbstractItemView::NoEditTrigger);
95102
}
96103

104+
WItemDelegate *delegate = new WItemDelegate(this);
105+
delegate->setTextFormat("%.f");
106+
table->setItemDelegate(delegate);
107+
108+
table->setColumnWidth(0, 80);
109+
for (int i = 1; i < model->columnCount(); ++i)
110+
table->setColumnWidth(i, 120);
111+
97112
/*
98113
* Create the category chart.
99114
*/
115+
100116
WCartesianChart *chart = new WCartesianChart(this);
101117
chart->setModel(model); // set the model
102118
chart->setXSeriesColumn(0); // set the column that holds the categories
@@ -235,23 +251,22 @@ PieExample::PieExample(WContainerWidget *parent):
235251
if (!model)
236252
return;
237253

238-
/*
239-
* If we have JavaScript, show an Ext table view that allows editing
240-
* of the model.
241-
*/
242-
if (wApp->environment().javaScript()) {
243-
WContainerWidget *w = new WContainerWidget(this);
244-
Ext::TableView *table = new Ext::TableView(w);
245-
table->setMargin(10, Top | Bottom);
246-
table->setMargin(WLength::Auto, Left | Right);
247-
table->resize(300, 175);
248-
table->setModel(model);
249-
table->setAutoExpandColumn(0);
250-
251-
table->setEditor(0, new Ext::LineEdit());
252-
253-
for (int i = 1; i < model->columnCount(); ++i)
254-
table->setEditor(i, new Ext::NumberField());
254+
WContainerWidget *w = new WContainerWidget(this);
255+
WTableView* table = new WTableView(w);
256+
257+
table->setMargin(10, Top | Bottom);
258+
table->setMargin(WLength::Auto, Left | Right);
259+
table->setSortingEnabled(true);
260+
table->setModel(model);
261+
table->setColumnWidth(1, 100);
262+
table->setRowHeight(22); // height needed for line edit in IE
263+
264+
if (WApplication::instance()->environment().ajax()) {
265+
table->resize(150 + 100 + 14, 20 + 6 * 22);
266+
table->setEditTriggers(WAbstractItemView::SingleClicked);
267+
} else {
268+
table->resize(150 + 100 + 14, WLength::Auto);
269+
table->setEditTriggers(WAbstractItemView::NoEditTrigger);
255270
}
256271

257272
/*

examples/charts/category.csv

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"Age","Rural Male","Rural Female","Urban Male","Urban Female"
2-
"70-74",66,54.3,71.1,50
3-
"65-69",41,30.9,54.6,35.1
4-
"60-64",126.9,20.3,37,19.3
5-
"55-59",18.1,149,24.3,13.6
2+
"70-74",66.0,54.3,71.1,50.0
3+
"65-69",41.0,30.9,54.6,35.1
4+
"60-64",126.9,20.3,37.0,19.3
5+
"55-59",18.1,149.0,24.3,13.6
66
"50-54",11.7,8.7,15.4,8.4

examples/planner/CalendarCell.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ void CalendarCell::update(const ptr<UserAccount>& user, const WDate& date)
6262
.arg((int)(entries.size() - maxEntries)));
6363
extra->setStyleClass("cell-extra");
6464
addWidget(extra);
65-
66-
extra->clicked().setPreventDefault(true);
65+
66+
extra->clicked().preventPropagation();
6767
extra->clicked().connect(SLOT(this, CalendarCell::showAllEntriesDialog));
6868

6969
break;

examples/planner/MyCaptcha.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ using namespace Wt;
1010

1111
MyCaptcha::MyCaptcha(WContainerWidget* parent,
1212
const int width, const int height)
13-
: completed(this),
14-
WContainerWidget(parent)
13+
: WContainerWidget(parent),
14+
completed(this)
1515
{
1616
setStyleClass("captcha");
1717

0 commit comments

Comments
 (0)