1. #1
    Ext User
    Join Date
    Apr 2008
    Location
    Seattle, WA
    Posts
    8
    Vote Rating
    0
    jgindin is on a distinguished road

      0  

    Default Unable to remove widget from container

    Unable to remove widget from container


    (FWIW, I made a nearly identical post to the old MyGWT forums, but (a) that was just days before they were shutdown; and (b) I didn't include a sample to demonstrate the problem.)

    It seems that if you create a container and add some widgets to it, and then you want to remove one or more of those widgets, the removal fails unless the container has been attached to the DOM. Why? Well, it appears that in the AbstractContainer::remove() method (which, in MyGWT 0.5.2 is the Container::remove() method) checks to see that the parent of widget being removed is "this". Well, before being attached, it appears that the parent has not yet been set.
    Code:
    package sampleApp.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.*;
    import com.google.gwt.user.client.Window;
    import net.mygwt.ui.client.widget.WidgetContainer;
    import net.mygwt.ui.client.widget.Viewport;
    
    /**
     * This class demonstrates a bug where you can add a child to a MyGWT parent before the parent
     *  has been attached to the DOM, but attempting to remove that child before the parent is attached
     *  silently fails.
     */
    public class RemoveBeforeAttached
      implements EntryPoint {
    
      public void onModuleLoad() {
    
        final Viewport viewport = new Viewport();
        viewport.setBounds(0, 0, Window.getClientWidth(), Window.getClientHeight());
    
        
        // First: Show that we cannot remove a widget when it's added before the parent
        //  has been attached...
        WidgetContainer firstContainer = new WidgetContainer();
    
        firstContainer.add( new HTML( "<b>Testing</b>" ) );
        if ( 1 != firstContainer.getWidgetCount() ) {
          Window.alert( "firstContainer: Expected only a single widget!" );
        }
    
        firstContainer.removeAll();
        if ( 0 != firstContainer.getWidgetCount() ) {
          Window.alert( "firstContainer: Expected NO MORE widgets!" );
        }
    
    
        // Now, show that if we wait until after being attached, we can remove children.
        WidgetContainer secondContainer = new WidgetContainer() {
          protected void onAttach() {
            super.onAttach();
    
            removeAll();
            if ( 0 != getWidgetCount() ) {
              Window.alert( "secondContainer: Expected NO MORE widgets!" );
            }
            else {
              Window.alert( "secondContainer: All's good when removed after attached!" );
            }
          }
        };
    
        secondContainer.add( new HTML( "<b>Testing</b>" ) );
        if ( 1 != secondContainer.getWidgetCount() ) {
          Window.alert( "secondContainer: Expected only a single widget!" );
        }
    
        viewport.add( secondContainer );
        viewport.layout( true );
      }
    }
    Now, I readily admit that I have not verified this in the 1.0 code base, except by inspection. I'm simply not setup to run GWT 1.5 yet... However, by inspection, it seems that the 1.0 code base still has this bug.


    jay

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

      0  

    Default


    Please do not post MyGWT related issues here and certainly do not post them as bugs. The Ext GWT 1.0 is radically different.

  3. #3
    Ext User
    Join Date
    Apr 2008
    Location
    Seattle, WA
    Posts
    8
    Vote Rating
    0
    jgindin is on a distinguished road

      0  

    Default


    OK. I can appreciate this. I'll do my best to demonstrate it really is a problem with 1.0.

    In the meantime, however, where *should* I be posting MyGWT issues? Or is that completely abandoned now?

    thanks,

    jay

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi