Example usage for org.apache.wicket Page setVersioned

List of usage examples for org.apache.wicket Page setVersioned

Introduction

In this page you can find the example usage for org.apache.wicket Page setVersioned.

Prototype

public Component setVersioned(boolean versioned) 

Source Link

Usage

From source file:com.wiquery.plugins.jqgrid.component.GridXMLData.java

License:Apache License

@Override
protected String getXml() {
    String encoding = ((WebRequest) (WebRequestCycle.get().getRequest())).getHttpServletRequest()
            .getCharacterEncoding();/*from   w w w .j a v  a 2 s.co m*/
    //TODO: write directly to the output stream?
    StringBuffer writer = new StringBuffer();
    writer.append("<?xml version='1.0' encoding='");
    writer.append(encoding);
    writer.append("'?>");
    Page page = dataPanel.getPage();
    page.setVersioned(false);
    XMLDataRequestTarget target = new XMLDataRequestTarget(page);

    dataPanel.setOutputMarkupId(true);
    //dataPanel.setVisible(true);
    target.addComponent(dataPanel);
    StringBuffer temp = new StringBuffer();
    target.respond(RequestCycle.get(), temp);
    /*
    final BufferedWebResponse response = (BufferedWebResponse)RequestCycle.get().getResponse();      
    */
    //dataPanel.setVisible(false);
    page.setVersioned(true);
    String content = temp.toString();
    content = content.substring(content.indexOf("<rows"), content.indexOf("</rows>") + 7);
    content = content.replaceAll("<cell><span>", "<cell><![CDATA[");
    content = content.replaceAll("</span></cell>", "]]></cell>");
    writer.append(content);
    grid.setRowModels(dataPanel.getRowModels());
    return writer.toString();
}