s ---
// In a real application this HTML could come from a CMS, a
// server-rendered template, or a static HTML file. Here it
// is the contents of a parent Canvas so the Showcase can
// display the Java source alongside the running sample.
Canvas dashboardPage = new Canvas();
dashboardPage.setWidth100();
dashboardPage.setHeight100();
dashboardPage.setOverflow(Overflow.AUTO);
dashboardPage.setContents(
"
" +
// Page header
"
" +
"
" +
"World Data Dashboard
" +
"
" +
"SmartGWT widgets embedded via " +
"htmlElement + matchElement
" +
"
" +
// Two-column area: grid + sidebar
"
" +
// Main grid placeholder
"
" +
// Sidebar detail placeholder
"
" +
"
" +
"
" +
"Country Detail
" +
"
" +
"
" +
"
" +
"
" +
"
" +
// Bottom bar: filter form placeholder
"
" +
"
" +
"Filter
" +
"
" +
"
" +
"
"
);
// After the Canvas draws its contents, the placeholder divs
// exist in the DOM. Connect each widget to its placeholder
// via setHtmlElement(), then draw.
dashboardPage.addDrawHandler(new DrawHandler() {
@Override
public void onDraw(DrawEvent event) {
Object[][] slots = {
{ embedGrid, "gridSlot" },
{ embedDetail, "detailSlot" },
{ embedFilter, "filterSlot" }
};
for (Object[] slot : slots) {
Canvas widget = (Canvas) slot[0];
Element el = Document.get().getElementById(
(String) slot[1]);
widget.setHtmlElement(el);
widget.draw();
}
}
});
HStack wrapper = new HStack();
wrapper.setWidth100();
wrapper.setHeight100();
wrapper.addMember(dashboardPage);
wrapper.draw();
}
}