开发者

Vaadin edit json response

Im using Vaadin as the framework to represent a presentation layer for my application. I have a trouble with the Vaadin Table listing. I load 1000 rows with 5 columms (yes I need to load all 1000, there is also an option to load less. =)) but this is not very fast when using Vaadin. When I look at the Json sent I realize that there are lots of variables that i dont whant to be sent for everu table row.

This is the response i have as of now:

"domaind开发者_JAVA技巧om-000000938.co_uk",
    ["17",
        {"id": "PID783","readonly":true,"locale": "en_EN","format": "yyyy-MM-dd","strict":true,"wn":false,"parsable":true,
            "v":{"day":7,"month":2,"year":2011}}],
    ["17",
        {"id": "PID784","readonly":true,"locale": "en_EN","format": "yyyy-MM-dd","strict":true,"wn":false,"parsable":true,
            "v":{"day":7,"month":2,"year":2011}}],
    ["17",
        {"id": "PID785","readonly":true,"locale": "en_EN","format": "yyyy-MM-dd","strict":true,"wn":false,"parsable":true,
            "v":{"day":7,"month":2,"year":2012}}],
    "","","ENG"],
    ["tr",{"key":206},"

I would like to transform this Json to be more like

"domaindom-000000938.co_uk",
    ["17",
        {"id": "PID783","locale": "en_EN",,"strict":true,"wn":false,"v1":"2011-07-02", "v2":"2011-02-07", "v3":"2012-02-07"}],

As you can see I have removed a couple of variables and inserted the date varialble in the same clauses.

So my quiestion is this. In Vaadin, how do I modify the way Vaadin creates the Json response? I currently use the BeanItemContainer to hold my objects like this:

public BeanItemContainer getPagedDataSource(){
    List<Object> mylist = DAO.getDAO().createQuery(query, index, max);
    return new BeanItemContainer<Object>(type, mylist);
}

Thanks for any help or feedback!

/Marthin


First, that JSON is part of Vaadin's internal communication and you should not modify it. However, if you wish to check it out, it is the JsonPaintTarget along with the paintContent-method of the component in question (the Table) that creates the JSON.


Vaadin today operates in an unprecedented way. Everything will change in the application must be sent to the client. On the client side, each component is treated separately and therefore the response must address all components changed. Each row in the table is a separate component because the answer is so long.

My proposed solution:

  • write your own implementation of the table - hard
  • the imposition of restrictions - easy, but it's prosthesis
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜