pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: Pivot vs. ExtJS
Date Sat, 20 Feb 2010 13:17:15 GMT
> My thinking is that spanning multiple grid columns would also be tricky with the current
implementation.  Is there any plan to allow the TableView to contain components instead of
just data in the future?

TableView isn't meant to contain other components (it extends Component rather than Container).
For that, you'd want to use TablePane.

> 3.  Assigning values and display text to drop lists and radio buttons.  Let's say I create
a ButtonList.  I then create a GetQuery to retrieve some JSON from my application server,
which is automatically placed into an ArrayList of HashMaps by the JSON serializer.  So, let's
assume that I'm querying a product database, and I'm getting back an array of hashmaps that
look like {productID:33443435, productName:'Widget Number 1', productDescription:'Blah blah
blah'}, how do I put this into my ButtonList so that the user sees the product name in the
drop list, but when it is serialized and sent back to the server, the id is what is actually
sent?  When I simply setListData(myArrayofHashMaps), the drop list actually displays the results
of the toString() method of each hash map, which is not what is desired.  It almost seems
like the ButtonList.setListData() method will only accept a one dimensional array of strings.
> It sounds like what you need is a custom renderer for your ListButton that is capable
of rendering your hashmaps by displaying the product name.  In my Pivot apps, I've written
a custom "MapRenderer" that takes a JSON path property and renders maps by getting the value
associated with that key.  The list button's "data renderer" will render the selected item
when the dropdown is collapsed, and the "item renderer" will render each item in the dropdown
when it's expanded.
> I think I understand what you're saying here, but I'm not quite sure I understand how
the whole rendering system works well enough yet to make this happen, but I will attempt this
tomorrow and see if I can get it working.  I think I may have previously confused myself by
assuming that Pivot was converting my Map to a ListItem, and since the ListItem only had a
text and icon property, there was no place to store a separate value property.  Based on what
you said, now I realize (I think) that a ListItem is one of any object type you can put in
a ButtonList, there just happens to already be a renderer for it.  If you choose to use some
other Object type, then the default renderer will simply use that Object's toString() method
to render each option (which is of course exactly what I saw with my List of Maps).  I think
it's becoming more clear now, but correct me if I'm getting even farther off base...

Basically, renderers are treated like "rubber stamps". They don't actually exist in the component
hierarchy - they are used "behind the scenes" by the skin when the skin is called to paint().
The skin first paints itself, then calls the renderer's paint() method to draw the content.

The best way to learn about how renderers work is probably to look at the code in org.apache.pivot.wtk.content,
but please let us know if you have any additional questions.


View raw message