panel.setHeading("Basic Template");
panel.setWidth(300);
panel.setBodyStyleName("pad-text");
ToolBar toolbar = new ToolBar();
Button apply = new Button("Apply Template");
apply.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
Template template = new Template(getBasicTemplate());
template.overwrite(panel.getBody().dom, Util.getJsObject(person));
}
});
toolbar.add(apply);
panel.setTopComponent(toolbar);
final ContentPanel xpanel = new ContentPanel();
xpanel.setHeading("XTemplate Playground");
xpanel.setWidth(300);
xpanel.setBodyStyleName("pad-text");
ToolBar toolBar = new ToolBar();
toolBar.add(new Button("Apply Template", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
XTemplate tpl = XTemplate.create(getTemplate());
xpanel.removeAll();
xpanel.addText(tpl.applyTemplate(Util.getJsObject(person, 3)));
xpanel.layout();
}
}));
xpanel.setTopComponent(toolBar);
final ContentPanel cpanel = new ContentPanel();
cpanel.setHeading("XTemplate Test");
cpanel.setWidth(500);
cpanel.setBodyStyleName("pad-text");
final Html html = new Html();
html.setStyleName("pad-text");
final TextArea area = new TextArea();
area.setSize(485, 150);
toolBar = new ToolBar();
toolBar.add(new Button("Apply Template", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
String template = area.getValue();
XTemplate tpl = XTemplate.create(template);
tpl.overwrite(html.getElement(), Util.getJsObject(person, 3));