Re: GWT Cell Table toggling readonly/editable cell

2014-03-20 Thread BM
Thanks Tom for the quick reply. 

Hmm. I don't know if it defeats the purpose of using cell table approach 
because we have to redraw it again. Or is it not?

What about custom EditTextCell and intercept the OnBrowserEvent and check 
for a boolean flag which would get set based on Edit button is clicked and 
Save button is clicked? I don't know if the following code will ever work 
when a EditTextCell is clicked in Read-only mode as it will intercept and 
since the boolean flag is false, it will not turn into editable cell. 

public class ButtonEnableEditTextCell extends EditTextCell {

private boolean click;

@Override
public void onBrowserEvent(Context context, Element parent, String value, 
NativeEvent event,
ValueUpdater valueUpdater) {
if (click) {
super.onBrowserEvent(context, parent, value, event, valueUpdater);
}
}

public void setClick(Boolean click) {
this.click = click;
}
}


On Thursday, March 20, 2014 1:21:39 PM UTC-5, Thomas Broyer wrote:
>
> Can't you use a Cell that delegates to either a TextCell or 
> EditableTextCell depending on a flag?
> And then your toggle button switches the flag and redraws the table.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


GWT Cell Table toggling readonly/editable cell

2014-03-20 Thread Thomas Broyer
Can't you use a Cell that delegates to either a TextCell or EditableTextCell 
depending on a flag?
And then your toggle button switches the flag and redraws the table.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


GWT Cell Table toggling readonly/editable cell

2014-03-20 Thread BM
I have a cell table and here is my requirement.

I want to show all rows and columns in cell table in read-only mode when 
the user first arrives.

If the user wants to update a cell, they click Edit button on top of the 
Screen which would change all the cells inside the cell table to Edit mode. 
The user can change values and Click save button on Top of the screen which 
saves the data and make the Cell Table Read-only Mode with updated data. 


Currently I can do this but my problem is when the Cell table is in 
Read-only mode, I can still click on cell to change to editable text box 
because I use Editable Text Cell. So Cell table doesn't really understand 
when not to make it editable.

Anyone can help to provide best way to handle my requirement?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.