I also ran into this problem.  I managed to get around it by 
extending CheckboxCell to listen for the "click" event, instead of the 
"change" event.

To do this, in my new class, I just overrode getConsumedEvents:
@Override
public Set<String> getConsumedEvents() {
HashSet<String> result = new HashSet<String>();
 result.add("click"); // Listen for the click event
 return result;
}

And then overrode onBrowserEvent copying the entire method, but adding the 
"click" event:
@Override
public void onBrowserEvent(Context context, Element parent, Boolean value, 
NativeEvent event, ValueUpdater<Boolean> valueUpdater) {
...
if ("click".equals(type) || "change".equals(type) || enterPressed) {
...
}

And it all worked!  I have no idea if what I did will work for all 
situations, so use it at your own risk.


On Wednesday, 15 June 2011 05:06:44 UTC+10, bb.f.pav wrote:
>
> Ok, np, Thx you Juan for your patience/ efforts 
>
> On 14 Jun., 13:10, Juan Pablo Gardella <[email protected]> 
> wrote: 
> > The only difference I see is addSelectionChangeHandler. I don't see an 
> > error, sorry 
> > 
> > 2011/6/14 bb.f.pav <[email protected]> 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > Hi Patrick, 
> > 
> > > unfortunately i'll need the single selection model for the purpose of 
> > > the project ;) 
> > 
> > > Thx 
> > > bb.f.pav 
> > 
> > > On 13 Jun., 22:42, Patrick Tucker <[email protected]> wrote: 
> > > > If you don't need the selection model, try NoSelectionModel. 
> > 
> > > > On Jun 13, 2:56 pm, "bb.f.pav" <[email protected]> wrote: 
> > 
> > > > > Hi Juan, 
> > 
> > > > > 1) i'm not yet reached that point. i'm using the stockwatcher 
> examples 
> > > > > as basis for my celltable example and run it via eclipse as web 
> > > > > application 
> > > > >     that's my module.gwt.xml 
> > 
> > > > > <?xml version="1.0" encoding="UTF-8"?> 
> > > > > <module rename-to='mysamplegwtohnemaven'> 
> > > > >   <!-- Inherit the core Web Toolkit stuff.                       
>  --> 
> > > > >   <inherits name='com.google.gwt.user.User'/> 
> > 
> > > > >   <!-- Inherit the default GWT style sheet.  You can change       
> --> 
> > > > >   <!-- the theme of your GWT application by uncommenting         
>  --> 
> > > > >   <!-- any one of the following lines.                           
>  --> 
> > > > >   <inherits name='com.google.gwt.user.theme.standard.Standard'/> 
> > 
> > > > >   <!-- Specify the app entry point class.                         
> --> 
> > > > >   <entry-point 
> > > > > 
> class='de.f10rian.mySampleGwtOhneMaven.client.MySampleGwtOhneMaven'/> 
> > 
> > > > >   <!-- Specify the paths for translatable code                   
>  --> 
> > > > >   <source path='client'/> 
> > > > >   <source path='shared'/> 
> > 
> > > > > </module> 
> > 
> > > > > 2) Here is my CellTableExample code. hopefully you'll see my 
> error: 
> > 
> > > > > public class CellTableExample extends Composite { 
> > 
> > > > >         private static CellTableExampleUiBinder uiBinder = GWT 
> > > > >                         .create(CellTableExampleUiBinder.class); 
> > 
> > > > >         interface CellTableExampleUiBinder extends 
> > > > >                         UiBinder<Widget, CellTableExample> { 
> > > > >         } 
> > 
> > > > >         @UiField 
> > > > >         CellTable<Person> ct; 
> > 
> > > > >         List<Long> checkBoxSelectedIds = new ArrayList<Long>(); 
> > 
> > > > >         private final ListDataProvider<Person> dataProvider = new 
> > > > > ListDataProvider<Person>(); 
> > > > >         private final SingleSelectionModel<Person> 
> singleSelectionModel 
> > > = new 
> > > > > SingleSelectionModel<Person>(); 
> > 
> > > > >         { 
> > > > >                 singleSelectionModel.addSelectionChangeHandler(new 
> > > Handler() { 
> > > > >                         @Override 
> > > > >                         public void 
> > > onSelectionChange(SelectionChangeEvent event) { 
> > > > >                                 GWT.log("getSelectedObject" + 
> > > > > singleSelectionModel.getSelectedObject().toString()); 
> > > > >                         } 
> > > > >                 }); 
> > > > >         } 
> > 
> > > > >         public CellTableExample() { 
> > > > >                 initWidget(uiBinder.createAndBindUi(this)); 
> > 
> > > > >                 // name column 
> > > > >                 Column<Person, String> nameCol = new 
> Column<Person, 
> > > String>( 
> > > > >                                 new TextInputCell()){ 
> > > > >                         public String getValue(Person object) { 
> > > > >                                 return object.getName(); 
> > > > >                         } 
> > > > >                 }; 
> > 
> > > > >                 nameCol.setFieldUpdater(new FieldUpdater<Person, 
> > > String>() { 
> > > > >                         public void update(int index, Person 
> object, 
> > > String value) { 
> > > > >                                 object.setName(value); 
> > > > >                         } 
> > > > >                 }); 
> > 
> > > > >                 // title column 
> > > > >                 Column<Person, String> forenameCol = new 
> Column<Person, 
> > > String>( 
> > > > >                                 new TextInputCell()){ 
> > > > >                         public String getValue(Person object) { 
> > > > >                                 return object.getForeName(); 
> > > > >                         } 
> > > > >                 }; 
> > 
> > > > >                 forenameCol.setFieldUpdater(new 
> FieldUpdater<Person, 
> > > String>() { 
> > > > >                         public void update(int index, Person 
> object, 
> > > String value) { 
> > > > >                                 object.setForeName(value); 
> > > > >                         } 
> > > > >                 }); 
> > 
> > > > >                 /* 
> > > > >                  * add check column 
> > > > >                  */ 
> > > > >                 Column<Person, Boolean> cbCol = new Column<Person, 
> > > Boolean>(new 
> > > > >CheckboxCell()) { 
> > > > >                         public Boolean getValue(Person object) { 
> > > > >                                 GWT.log("cbCol.getValue: " + 
> > > Boolean.FALSE); 
> > > > >                                 return object.isSelected(); 
> > > > >                         } 
> > > > >                 }; 
> > 
> > > > >                 cbCol.setFieldUpdater(new FieldUpdater<Person, 
> > > Boolean>() { 
> > > > >                         public void update(int index, Person 
> object, 
> > > Boolean value) { 
> > > > >                                 GWT.log("cbCol.setValue: " + 
> value); 
> > > > >                                 object.setSelected(value); 
> > > > >                         } 
> > > > >                 }); 
> > 
> > > > >                 // Add the columns. 
> > > > >                 ct.addColumn(forenameCol, "Forname"); 
> > > > >                 ct.addColumn(nameCol, "Name"); 
> > > > >                 ct.addColumn(cbCol, "Check"); 
> > 
> > > > >             // Set the width of the table and put the table in 
> fixed 
> > > width 
> > > > > mode. 
> > > > >                 ct.setWidth("100%", true); 
> > 
> > > > >             // Set the width of each column. 
> > > > >                 ct.setColumnWidth(forenameCol, 200.0, Unit.PX); 
> > > > >                 ct.setColumnWidth(nameCol, 50.0, Unit.PCT); 
> > > > >                 ct.setColumnWidth(cbCol, 50.0, Unit.PCT); 
> > 
> > > > >                 ct.setSelectionModel(this.singleSelectionModel); 
> > > > >                 dataProvider.addDataDisplay(ct); 
> > 
> > > > >                 addData(); 
> > > > >         } 
> > 
> > > > >         private void addData() { 
> > > > >                 List<Person> values = new ArrayList<Person>(); 
> > 
> > > > >                 values.add(new Person("Dirk", "Nowitzki", 
> > > Gender.Male)); 
> > > > >                 values.add(new Person("Dwyane", "Wade", 
> Gender.Male)); 
> > > > >                 values.add(new Person("LeBron", "James", 
> Gender.Male)); 
> > 
> > > > >                 dataProvider.setList(values); 
> > > > >         } 
> > 
> > > > > } 
> > 
> > > > > Thx 
> > > > > bb.f.pav 
> > 
> > > > > On 11 Jun., 00:37, Juan Pablo Gardella <
> [email protected]> 
> > > > > wrote: 
> > 
> > > > > > 1)  are you sure the code compile for other browser? 
> > 
> > > > > > 2) I do the same thing without problems: 
> > 
> > > > > > CheckBoxColumn<MyEntity> seleccionado = new 
> > > CheckBoxColumn<MyEntity>() { 
> > > > > > @Override 
> > > > > > public Boolean getValue(MyEntity object) { 
> > > > > > return object.isSeleccionado();} 
> > > > > > }; 
> > 
> > > > > > seleccionado.setFieldUpdater(fieldUpdaterForMyEntity()); 
> > 
> > > > > > ... 
> > 
> > > > > > private FieldUpdater<MyEntity , Boolean> 
> > > fieldUpdaterParaDeclaracion() { 
> > 
> > > > > > return new FieldUpdater<MyEntity , Boolean>() { 
> > > > > > @Override 
> > > > > > public void update(int index, MyEntity object, 
> > > > > > Boolean value) { 
> > > > > > if (value != null ) { 
> > > > > > object.setSelected(value.booleanValue()); 
> > 
> > > > > > } 
> > > > > > }; 
> > > > > > }; 
> > > > > > } 
> > 
> > > > > > I have a selected var. instance (is transient) for query if the 
> > > entity is 
> > > > > > selectable. 
> > 
> > > > > > Juan 
> > 
> > > > > > 2011/6/10 bb.f.pav <[email protected]> 
> > 
> > > > > > > Hi, 
> > 
> > > > > > > I have a celltable with several columns, one of them 
> > > holdsCheckboxCell 
> > > > > > > ´s. Additional I use a SingleSelectionModel for that 
> celltable. The 
> > > > > > >CheckboxCellcolumn should be independent from the 
> > > > > > > SingleSelectionModel. The user should be able to check more 
> that 
> > > one 
> > > > > > > checkbox and select only one row via mouse click or keyboard. 
> > > That's 
> > > > > > > why I Instantiate them as follows: 
> > 
> > > > > > > celltable.setSelectionModel(new 
> > > > > > > SingleSelectionModel<MyDomainObject>()); 
> > > > > > > Column<MyDomainObject, Boolean> selCol = new 
> Column<MyDomainObject, 
> > > > > > > Boolean>(newCheckboxCell()) { 
> > > > > > >   ... 
> > > > > > > }; 
> > 
> > > > > > > selCol.setFieldUpdater(new FieldUpdater<MyDomainObject, 
> Boolean>() 
> > > { 
> > > > > > >   ... 
> > > > > > > }); 
> > 
> > > > > > > celltablekurzansicht.addColumn(selCol, "Select"); 
> > 
> > > > > > > I chrome everything works as planned, the user can check 
> several 
> > > > > > > checkboxes. After a Checkbox is clicked, row is selected, 
> status 
> > > > > > > changed and setFieldUpdater is called. 
> > 
> > > > > > > In firefox 3.6 - 4.0 and ie7 the user can check several 
> checkboxes, 
> > > > > > > too, but only after two clicks. After the 1st click the row 
> will 
> > > only 
> > > > > > > be selected. Only the 2nd click on a selected row will change 
> the 
> > > > > > > status and call setFieldUpdater. 
> > 
> > > > > > > I hope someone can bring light into the darkness and help me 
> to 
> > > > > > > achieve the chrome behaviour in firefox (from 3.6) and ie7, 
> too. 
> > 
> > > > > > > thx in advance! 
> > > > > > > bb.f.pav 
> > 
> > > > > > > -- 
> > > > > > > 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] <javascript:>. 
> > > > > > > To unsubscribe from this group, send email to 
> > > > > > > [email protected] <javascript:>. 
>
> > > > > > > For more options, visit this group at 
> > > > > > >http://groups.google.com/group/google-web-toolkit?hl=en. 
> > 
> > > -- 
> > > 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]<javascript:>. 
>
> > > To unsubscribe from this group, send email to 
> > > [email protected] <javascript:>. 
> > > For more options, visit this group at 
> > >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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/-/-h1ingkkPeUJ.
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