Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext GWT Premium Member
    Join Date
    Jul 2009
    Posts
    34
    Vote Rating
    0
    mnilson is on a distinguished road

      0  

    Default [FIXED] GXT 2.1.0 WidgetComponent Bug

    [FIXED] GXT 2.1.0 WidgetComponent Bug


    Now that WidgetComponent calls setParent and removeFromParent I believe it should be implementing hasWidgets. Otherwise if you insert a WidgetComponent into a Container, removing it from the container, and then try inserting it into a Container again the call to Widget.removeFromParent() throws an IllegalStateException. Image is the widget in particular that I am trying to move around between containers.

    Here is the relevant part of the stack trace.
    Code:
    java.lang.IllegalStateException: This widget's parent does not implement HasWidgets
    	at com.google.gwt.user.client.ui.Widget.removeFromParent(Widget.java:117)
    	at com.extjs.gxt.ui.client.widget.WidgetComponent.<init>(WidgetComponent.java:54)
    	at com.extjs.gxt.ui.client.widget.Container.wrapWidget(Container.java:628)
    	at com.extjs.gxt.ui.client.widget.LayoutContainer.insert(LayoutContainer.java:201)
    	at com.extjs.gxt.ui.client.widget.LayoutContainer.add(LayoutContainer.java:116)
    thanks,
    Michael

  2. #2
    Ext GWT Premium Member
    Join Date
    Aug 2008
    Posts
    82
    Vote Rating
    0
    cravemusic is on a distinguished road

      0  

    Default


    I've run into this exact same problem as well -- I have a custom widget which is continually swapping out the components inside of the outer container. I've had no problem with that code before this release.

  3. #3
    Ext GWT Premium Member
    Join Date
    Jul 2008
    Posts
    33
    Vote Rating
    0
    Adam Ward is on a distinguished road

      0  

    Default


    I have the exact same issue, including the fact that we are adding/removing an Image object to the same container. If you use the same object reference, it seems to break. Here is some sample code:

    Code:
    public class WidgetComponentBug implements EntryPoint {
    	/**
    	 * This is the entry point method.
    	 */
    	public void onModuleLoad() {
    		final LayoutContainer lc = new LayoutContainer(new FitLayout());
    		final Image image = new Image("http://www.extjs.com/assets/images/extjs2.png");
    		lc.setSize(200, 200);
    		
    		lc.add(image);
    		
    		VerticalPanel vp = new VerticalPanel();
    		vp.add(lc);
    		
    		Button button = new Button("Swap Pics");
    		button.addSelectionListener(new SelectionListener<ButtonEvent>() {
    			
    			@Override
    			public void componentSelected(ButtonEvent ce) {
    				lc.removeAll();
    				lc.add(image);
    				lc.layout();
    			}
    		});
    		vp.add(button);
    		RootPanel.get().add(vp);
     	}
    }

  4. #4
    Ext GWT Premium Member
    Join Date
    Jul 2008
    Posts
    33
    Vote Rating
    0
    Adam Ward is on a distinguished road

      0  

    Default


    P.S. the "lc.setSize(200, 200)" is not necessary to repro the bug.

  5. #5
    Ext GWT Premium Member
    Join Date
    Jul 2008
    Posts
    33
    Vote Rating
    0
    Adam Ward is on a distinguished road

      0  

    Default


    The following code DOES NOT throw the exception:

    Code:
    public void onModuleLoad() {
    		final LayoutContainer lc = new LayoutContainer(new FitLayout());
    		final Image image = new Image("http://www.extjs.com/assets/images/extjs2.png");
    		final WidgetComponent wc = new WidgetComponent(image);
    		lc.setSize(200, 200);
    		
    		lc.add(wc);
    		
    		VerticalPanel vp = new VerticalPanel();
    		vp.add(lc);
    		
    		Button button = new Button("Swap Pics");
    		button.addSelectionListener(new SelectionListener<ButtonEvent>() {
    			
    			@Override
    			public void componentSelected(ButtonEvent ce) {
    				lc.removeAll();
    				image.setUrl("http://www.google.com/intl/en_ALL/images/logo.gif");
    				lc.add(wc);
    				lc.layout();
    			}
    		});
    		vp.add(button);
    		RootPanel.get().add(vp);
     	}
    The key difference between this code and the code I posted before is that the object that is being added/removed from the LayoutContainer is a WidgetComponent instead of an Image object. This workaround has fixed my problem. Perhaps better documentation guiding users of the newer APIs and framework paradigms could have helped to avoid this type of breakage

  6. #6
    Ext GWT Premium Member
    Join Date
    Jul 2009
    Posts
    34
    Vote Rating
    0
    mnilson is on a distinguished road

      0  

    Default


    Quote Originally Posted by Adam Ward View Post
    The following code DOES NOT throw the exception:
    ...
    I understand that your work around will avoid the bug; I have chosen a different workaround for my particular case. I still maintain that this is a bug though. If a widget needs to be wrapped in a WidgetContainer then it either needs to be the developers responsibility to wrap the widget (ie container shouldn't call wrapWidget as a convenience method) or GXT needs to be completely responsible for handling the widget wrapping. I'm sure the former (removing the call to wrapWidget) would cause many breaking changes and that this is just a small oversight in the recent changes to WidgetComponent that will get fixed.

  7. #7
    Ext GWT Premium Member
    Join Date
    Aug 2008
    Posts
    82
    Vote Rating
    0
    cravemusic is on a distinguished road

      0  

    Default


    I completely agree with mnilson's statement. To rephrase it simply, there should be consistency in the wrapping API, and this is the bug that should be addressed.

  8. #8
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    This bug is fixed in the releases/2.1 branch and is now available in the 2.1.1-beta release available here.

  9. #9
    Ext GWT Premium Member
    Join Date
    Jul 2009
    Posts
    34
    Vote Rating
    0
    mnilson is on a distinguished road

      0  

    Default


    Thanks

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar