ExamplesModel model = new ExamplesModel();
for (int i = 0; i < model.getChildren().size(); i++) {
Category cat = (Category) model.getChildren().get(i);
for (int j = 0; j < cat.getChildren().size(); j++) {
Entry entry = (Entry) cat.getChildren().get(j);
String id = entry.getId();
examples.put(id, entry);
}
}
Registry.register(MODEL, model);
String id = Window.Location.getParameter("id");
if (id == null || id == "") {
id = XDOM.getBody().getId();
}
Entry entry = examples.get(id);
if (entry == null) {
return;
}
viewport = new Viewport();
viewport.setLayout(new BorderLayout());
createNorth();
TabPanel panel = new TabPanel();
panel.setResizeTabs(true);
TabItem example = new TabItem("Example");
example.setScrollMode(Scroll.AUTO);
if (entry.isFill()) {
example.setLayout(new FitLayout());
example.setScrollMode(Scroll.NONE);
}
TabItem source = new TabItem("View Source");
source.setUrl(entry.getSourceUrl());
panel.add(example);
panel.add(source);
ToolBar toolBar = new ToolBar();
Button item = new Button("View Source");
toolBar.add(new FillToolItem());
toolBar.add(item);
example.add(entry.getExample());
viewport.add(panel, new BorderLayoutData(LayoutRegion.CENTER));
// viewport.add(new AggregationGridExample(), new BorderLayoutData(LayoutRegion.CENTER));
RootPanel.get().add(viewport);