1. #1
    Ext GWT Premium Member
    Join Date
    Jul 2008
    Posts
    26
    Vote Rating
    0
    Alex.Leshkin is on a distinguished road

      0  

    Default [FIXED] Component.removeStyleName(...) doesn't works for not rendered component

    [FIXED] Component.removeStyleName(...) doesn't works for not rendered component


    Detailed description of the problem
    If a Component instance is not rendered, then removeStyleName do nothing.

    GXT version
    1.0.2

    Host mode / web mode / both
    both

    Browser and version
    IE, FF

    Operating System
    Windows XP Home SP2

    Sample code
    This sample first appends x-item-disabled style name, then removes this style.
    After rendering field looks like disabled.

    Code:
    public class TestCase extends ContentPanel implements EntryPoint {
    
        public TestCase() {
            final TextField<String> field = new TextField<String>();
            field.addStyleName("x-item-disabled");
            field.removeStyleName("x-item-disabled");
            this.add(field);
        }
        
        public void onModuleLoad() {
            final Viewport viewport = new Viewport();
            viewport.setLayout(new FitLayout());
            viewport.add(this);
            RootPanel.get().add(viewport);
        }
    
    }
    Suggestion
    I think style is not removed because removeStyleName method has no affect for not rendered component:

    com.extjs.gxt.ui.client.widget.Component.removeStyleName(String) source code for 1.0.2:
    Code:
      public void removeStyleName(String style) {
        if (rendered) {
          fly(getStyleElement()).removeStyleName(style);
        } else if (style != null) {
          String[] s = style.split(" ");
          style = "";
          for (int i = 0; i < s.length; i++) {
            if (!s[i].equals(style)) {
              style += " " + s[i];
            }
          }
        }
      }
    This method should looks like:
    Code:
      public void removeStyleName(String style) {
        if (rendered) {
          fly(getStyleElement()).removeStyleName(style);
        } else if (style != null && cls != null) {
          String[] s = cls.split(" ");
          cls = "";
          for (int i = 0; i < s.length; i++) {
            if (!s[i].equals(style)) {
              cls += " " + s[i];
            }
          }
        }
      }

  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


    This has previously been fixed in SVN. Thanks.

  3. #3
    Ext GWT Premium Member
    Join Date
    Jul 2008
    Posts
    26
    Vote Rating
    0
    Alex.Leshkin is on a distinguished road

      0  

    Default [REOPENED] Component.removeStyleName(...) doesn't works for not rendered component

    [REOPENED] Component.removeStyleName(...) doesn't works for not rendered component


    It is desirable to check cls field not null value and avoid NPE for not rendered component w/o style:

    Something like:
    Code:
        if (rendered) {
    ....
        } else if (style != null && cls != null) {
    ....
        }

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