Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: [FIXED] [1.2 r1129] SelectionEvent ClassCastException

  1. #1
    Ext GWT Premium Member
    Join Date
    May 2008
    Posts
    52

    Default [FIXED] [1.2 r1129] SelectionEvent ClassCastException

    There appears to be a type mismatch on SelectionEvent signals on the ListView object.

    From ListView

    line 337:
    Code:
    private void fireSelectionChange() {
      fireEvent(Events.SelectionChange, new SelectionEvent(this, new ArrayList(selected)));
      }
    line 77:
    Code:
    public void addSelectionChangedListener(SelectionChangedListener listener) {
           addListener(Events.SelectionChange, listener);
      }
    But in SelectionChangedListener

    line 29:
    Code:
       public void handleEvent(SelectionChangedEvent<M> se) {
      selectionChanged(se);
      }
    Which causes:
    Code:
    [ERROR] Uncaught exception escaped
    java.lang.ClassCastException: com.extjs.gxt.ui.client.event.SelectionEvent cannot be cast to com.extjs.gxt.ui.client.event.SelectionChangedEvent
        at com.extjs.gxt.ui.client.event.SelectionChangedListener.handleEvent(SelectionChangedListener.java:1)
        at com.extjs.gxt.ui.client.event.BaseObservable.fireEvent(BaseObservable.java:74)
        at com.extjs.gxt.ui.client.widget.selection.AbstractStoreSelectionModel.fireSelectionChange(AbstractStoreSelectionModel.java:338)
        at com.extjs.gxt.ui.client.widget.selection.AbstractStoreSelectionModel.doMultiSelect(AbstractStoreSelectionModel.java:272)
        at com.extjs.gxt.ui.client.widget.selection.AbstractStoreSelectionModel.doSelect(AbstractStoreSelectionModel.java:284)
        at com.extjs.gxt.ui.client.widget.ListViewSelectionModel.handleMouseDown(ListViewSelectionModel.java:107)
        at com.extjs.gxt.ui.client.widget.ListViewSelectionModel.onSelect(ListViewSelectionModel.java:147)
        at com.extjs.gxt.ui.client.widget.ListViewSelectionModel.handleEvent(ListViewSelectionModel.java:69)
        at com.extjs.gxt.ui.client.widget.ListViewSelectionModel.handleEvent(ListViewSelectionModel.java:1)
        at com.extjs.gxt.ui.client.event.BaseObservable.fireEvent(BaseObservable.java:74)
        at com.extjs.gxt.ui.client.widget.Component.fireEvent(Component.java:427)
        at com.extjs.gxt.ui.client.widget.ListView.onMouseDown(ListView.java:601)
        at com.extjs.gxt.ui.client.widget.ListView.onComponentEvent(ListView.java:329)
        at com.extjs.gxt.ui.client.widget.Component.onBrowserEvent(Component.java:666)
        at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)
        at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1287)
        at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1255)
        at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
        at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
        at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
        at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
        at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
        at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
        at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
        at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
        at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
        at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)
    Thanks,

    Nathan

  2. #2
    Sencha User
    Join Date
    Mar 2008
    Posts
    11

    Default

    +1
    in AbstractStoreSelectionModel
    line 333
    fireEvent(Events.SelectionChange, new SelectionEvent(this, new ArrayList(selected)));

    and SelectionChangedEvent != SelectionEvent

    This is my third bug of the day, you should really call GXT a beta, for me it has nothing to do with a release...

  3. #3
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572

    Default

    Thanks - fix for AbstractStoreSelectionModel is being worked on...

  4. #4
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572

    Default

    Fixed in SVN.

    samijaber, thanks for finding this - in future, can you pls just raise a new bug post so we can track them better.

  5. #5
    Ext User
    Join Date
    Sep 2008
    Location
    Latvia
    Posts
    30

    Default Same Problem in ComboBox

    ComboBox:1130
    Code:
        listView.getSelectionModel().addListener(Events.SelectionChange,
            new Listener<SelectionEvent>() {
              public void handleEvent(SelectionEvent se) {
                selectedItem = listView.getSelectionModel().getSelectedItem();
              }
            });
    ListViewSelectionModel<M extends ModelData> extends AbstractStoreSelectionModel<M>

    AbstractStoreSelectionModel:341
    Code:
      private void fireSelectionChange() {
        fireEvent(Events.SelectionChange, new SelectionChangedEvent(this, new ArrayList(selected)));
      }

  6. #6
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    Where do you have an issue with ComboBox, I dont see any error there.

    Post some code.

  7. #7
    Ext User
    Join Date
    Sep 2008
    Location
    Latvia
    Posts
    30

    Default

    In Combobox you add listener SelectionEventto listView - instanceof ListViewSelectionModel listView.getSelectionModel().addListener(Events.SelectionChange,
    new Listener<SelectionEvent>() {
    but ListViewSelectionModel in fireEvent method (implemented in AbstractStoreSelectionModel)
    SelectionChangedEvent fired

    private void fireSelectionChange() {
    fireEvent(Events.SelectionChange, new SelectionChangedEvent(this, new ArrayList(selected)));
    }
    so when we come to
    public void handleEvent(SelectionEvent se)
    we have SelectionChangedEvent as parameter, so we have ClassCastException

  8. #8
    Ext User
    Join Date
    Sep 2008
    Location
    Latvia
    Posts
    30

    Default

    This error appear after changing in AbstractStoreSelectionModel

    Code:
      private void fireSelectionChange() {
        fireEvent(Events.SelectionChange, new SelectionEvent(this, new ArrayList(selected)));
      }
    to
    Code:
    private void fireSelectionChange() {
      fireEvent(Events.SelectionChange, new SelectionChangedEvent(this, new ArrayList(selected)));
    }

  9. #9
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    Yes thanks for reporting. We are going to fix this.

  10. #10
    Sencha User darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242

    Default

    The correct event is SelectionChangedEvent with the SelectionChanged event type. We have updated all the code to use SelectionChangedEvent, including ComboBox. In addition, the selection field in SelectionEvent has been removed as it is not applicable.

    SelectionEvent is fired when an indiviudal model's selection state is changed (BeforeSelect). SelectionChangedEvent is fired when a components overall "selection" state changes (SelectionChanged).

    Fix is in SVN.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •