I did not search the google bug list so far.

The bug occurs because of CompositeCell is not implementing isEditing.
To fix this issue, cerate a new class and derive it from CompositeCell
and add this few lines of code:

        /**
         * The isEditing() implementation is missing in CompositeCell.
         * Without this implementation,
         * You aren't able to edit included cells properly.
         */
        public boolean isEditing(Cell.Context context, Element parent, C
value) {
                for (HasCell<C, ?> hasCell : hasCells) {
                        if(isEditingImpl(context, parent, value, hasCell)) {
                                return true;
                        }
                }
                return false;
        };

        private <X> boolean isEditingImpl(Context context, Element parent, C
value,
                      HasCell<C, X> hasCell) {
                return hasCell.getCell().isEditing(context, parent,
hasCell.getValue(value));
        }

That's it and should fix it! :)

best regards,
Bernd

On 1 Feb., 23:23, Jason <jmitche...@gmail.com> wrote:
> Yes, the offending code lies in line 430 of
> DefaultSelectionEventManager. It tries to toggle the cell selection
> when you push the space key. CellList extends AbstractHasData which in
> turn uses the DefaultSelectionEventManager.
>
> The behaviour seems even stranger if you don't have a SelectionModel
> set for your CellList. If you set one (you can use 'new
> SingleSelectionModel<T>' on your CellList object, where T is your
> model class) and you will see that the space key event toggles the row
> selection..
>
> I'm not sure if there is abugreport for this yet? We will need to
> wait for it to be fixed / explained but until then I developed this
> little hack :) Paste it anywhere.. it's static. Tested on Chrome and
> FF4 but probably won't work on some older browsers.
>
> Event.addNativePreviewHandler(new NativePreviewHandler() {
>
>                         @Override
>                         public void onPreviewNativeEvent(NativePreviewEvent 
> event) {
>                                 NativeEvent nativeEvent = 
> event.getNativeEvent();
>                                 final int keyCode = nativeEvent.getKeyCode();
>
>                                 final boolean isNotAnInputElement = 
> !InputElement
>                                                 
> .is(nativeEvent.getEventTarget());
>                                 final boolean isNotTheSpaceKey = keyCode != 
> 32;
>
>                                 if (isNotAnInputElement || isNotTheSpaceKey) {
>                                         return;
>                                 }
>                                 String type = nativeEvent.getType();
>                                 event.cancel();
>                                 if (("keyup".equals(type))) {
>                                         InputElement element = 
> nativeEvent.getEventTarget().cast();
>                                         final int start = 
> element.getPropertyInt("selectionStart");
>                                         final int end = 
> element.getPropertyInt("selectionEnd");
>                                         if (start == end) {
>                                                 String before = 
> element.getValue();
>                                                 String after = 
> before.substring(0, start) + " "
>                                                                 + 
> before.substring(start);
>                                                 element.setValue(after);
>                                                 
> element.setPropertyInt("selectionStart", start + 1);
>                                                 
> element.setPropertyInt("selectionEnd", start + 1);
>                                         }
>
>                                 }
>                         }
>                 });
>
> On Jan 24, 11:06 am, Bernd <xbern...@hotmail.com> wrote:
>
> > Please try the following: Put anEditTextCellinto a CompositeCell and
> > add the CompositeCell to a CellTable Column. Now enter the
> > EditTextCells edit mode to change the text and try to add a space-char
> > by pressing your space key. Unfortunately, this doesn't work for me
> > (Firefox 3.5).
> > I checked the events which are forwarded by the Browser to the
> > CompositeCell. Interestingly, there is no "downkey" event delivered
> > for the space key. Maybe this has something to do with it?
>
> > Here is the sample code i used to generate the CellTable Column:
>
> >                finalEditTextCelleditTexCell = newEditTextCell();
>
> >                HasCell<String, String> hasC = new HasCell<String,
> > String>() {
>
> >                         @Override
> >                         public Cell<String> getCell() {
> >                                 return editTexCell;
> >                         }
>
> >                         @Override
> >                         public FieldUpdater<String, String> 
> > getFieldUpdater() {
> >                                 return null;
> >                         }
>
> >                         @Override
> >                         public String getValue(String object) {
> >                                 return object;
> >                         }
>
> >                 };
>
> >                 List<HasCell<String, ?>> listHC = new 
> > ArrayList<HasCell<String, ?>>();
>
> >                 listHC.add(hasC);
> >                 CompositeCell compCell = new CompositeCell<String>(listHC);
>
> >                 Column<RowOfData, String> compCellColumn = new 
> > Column<RowOfData,
> > String>(compCell) {
> >                         @Override
> >                         public String getValue(RowOfData object) {
> >                                 return "test123";
> >                         }
> >                 };
>
> > Is there a way to fix this problem?
> > A positive answer would help me a lot :)
> > Thanks!
> > Bernd

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

Reply via email to