Hi Thomas:

Thanks for the response.

"1. extend the cell to automatically switch to an isEditing() state on some
trigger"

Unless I bypass access by using JSNI, ViewData and isEditing are both
package access. I typically avoid doing what you suggested, although, I
have to admit, I've had to do it quite a lot in the past due to the
significant number of things with package access that I've come across.

I think I have sufficient info to use the suggested work arounds. However,
I still opened an issue for this as an enhancement/bug. One should be able
to say:

cellTable.getView().startEdit(row,cell) or better

cellTable.startEdit(row,cell) or something along those lines without having
to use all these work arounds.

Thanks all for your responses/help.

Alfredo

On Sat, Apr 14, 2012 at 10:54 AM, Thomas Broyer <[email protected]> wrote:

>
>
> On Friday, April 13, 2012 7:16:10 PM UTC+2, Alfredo Quiroga-Villamil wrote:
>>
>> Scenario is as follows:
>>
>> - CellTable with a column containing an EditTextCell.
>> - Add new record to the ListDataProvider.
>> - I can edit and do all the good stuff by hand to the newly added record
>> in the CellTable.
>>
>> Requirement:
>>
>> - Programmatically call a starttEdit on say the first cell of the newly
>> created row/record.
>>
>> My investigation results:
>>
>> After going through the code and investigating, all roads seem to point
>> to ViewData in EditTextCell. Specifically, ViewData in EditTextCell has
>> setEditing(boolean) which should do the trick. However, ViewData has
>> package access.
>>
>> Before I go and start to override, copy/paste things to be able to access
>> the ViewData member I need, I figured I ask first since this seems like a
>> basic operation when adding new records to a CellTable. I am thinking that
>> I am very likely missing something.
>>
>
> IMO, you should:
>
>    1. extend the cell to automatically switch to an isEditing() state on
>    some trigger
>    2. share something from your presenter/view/whatever with the cell to
>    tell it which value/index to "auto-edit"
>    3. trigger a redraw of the table, to trigger the auto-edit in the Cell
>    (this will probably be your setRowData that adds the new "record")
>
> To access the ViewData class, the easiest is to use JSNI, which allows
> bypassing access checks. For instance, when the "auto-edit" is triggered in
> your overridden render() method, to create the ViewData (before calling
> setViewData(context.getKey(), viewData) and then super.render()), use:
>
> private native Object createViewData(String text) /*-{
>    return
> @com.google.gwt.cell.client.EditTextCell::new(Ljava/lang/String;)(text);
> }-*/;
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/BUF4Zk_6K7cJ.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>



-- 
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM:  lawwton

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to