Shortest way to get a List of widgets with text and a button (VerticalPanel, CellList..?)

54 views
Skip to first unread message

tanteanni

unread,
Apr 16, 2012, 9:25:22 AM4/16/12
to google-we...@googlegroups.com
i need a list of "label plus button entries" (the button says delete line). The List won't become very long (<100 entries). So the first question is: Is CellList a good approach? I tried VerticalPanel, but the alignment is odd. A second/third widget is added in the middle of remaining space instead of just below the first (could this be "fixed").
The second approach i know about is a CellList (but i don't like html fiddling - guess why i took gwt ;-))? To get an Text together with a button i guess i need a "custom cell"? Is there any example of a custom cell with a working button (reacting on click events?) I don't need any other interactions.
(the show case and the developer guid didn't help much on first sight also the source found here didn't help )

Thomas Broyer

unread,
Apr 16, 2012, 10:01:03 AM4/16/12
to google-we...@googlegroups.com

On Monday, April 16, 2012 3:25:22 PM UTC+2, tanteanni wrote:
i need a list of "label plus button entries" (the button says delete line). The List won't become very long (<100 entries). So the first question is: Is CellList a good approach? I tried VerticalPanel, but the alignment is odd. A second/third widget is added in the middle of remaining space instead of just below the first (could this be "fixed").

How about FlowPanel?
 
The second approach i know about is a CellList (but i don't like html fiddling - guess why i took gwt ;-))? To get an Text together with a button i guess i need a "custom cell"? Is there any example of a custom cell with a working button (reacting on click events?) I don't need any other interactions.

A CompositeCell might be enough; but if you want your buttons to be vertically aligned, then use a CellTable with 2 columns: one with a TextCell for your text, and one with an ActionCell (or a ButtonCell) for the button.

tanteanni

unread,
Apr 16, 2012, 10:20:18 AM4/16/12
to google-we...@googlegroups.com
Thx Thomas,

the problem i had! with flowpanel is that it renders children not surely vertically (if two children fit in one line they will be in one line) - but i think that could be easily resolved (by making children always large enough). 

now i began with cell-stuff. at the moment i try to extend ActionCell and overwrite it's render (just calls sb.append some text before calling super.render). I also tried (for 10min)  composite cell but i didn't realized what i should do about "hasCells". (i guess there is no "in deep" documentation of cell-stuff)
now i will try CellTable.

Thomas Broyer

unread,
Apr 16, 2012, 11:36:07 AM4/16/12
to google-we...@googlegroups.com


On Monday, April 16, 2012 4:20:18 PM UTC+2, tanteanni wrote:
Thx Thomas,

the problem i had! with flowpanel is that it renders children not surely vertically (if two children fit in one line they will be in one line) - but i think that could be easily resolved (by making children always large enough).

Or use display:block in CSS (or a "block" element –such as a div– as the root for your widget).

I'm sorry but GWT doesn't save you from learning HTML, JS, DOM and CSS. If you don't want to learn those, then maybe you shouldn't have chosen GWT to begin with: Flex or similar might have been a better choice (for you as a developer; I absolutely hate Flash and Flex as a user, so from my point of view this is absolutely not a "better choice", but this is just my opinion)

now i began with cell-stuff. at the moment i try to extend ActionCell and overwrite it's render (just calls sb.append some text before calling super.render). I also tried (for 10min)  composite cell but i didn't realized what i should do about "hasCells". (i guess there is no "in deep" documentation of cell-stuff)

A CompositeCell is similar to a CellTable except it renders things side by side, not in columns (and there are no headers/footers). Instead of defining Columns for a CellTable, you define HasCells for a CompositeCell, and instead of rendering each cell in a table column (as CellTable), CompositeCell renders them "side by side" as a single cell.

tanteanni

unread,
Apr 17, 2012, 9:22:23 AM4/17/12
to google-we...@googlegroups.com
thx again,

with flow panel it was very easy to implement. the problem was to get the "selected" line (the line the button was clicked). now i am using the cell stuff, with its "selection model" i can easily do what i want. ('til now i don't have any html/css in my code  - hope springs eternal ;-)) 
Reply all
Reply to author
Forward
0 new messages