Thursday, May 29, 2014

Strange behavior of Chrome 35.0.1916 on Windows 7 when add/remove style of HTMLPanel

Hi,

I ran into very strange behaviour, which happens only in chrome 35/win 7. I use ListBox to change color of HTMLPanel with CssResource. When we change the value in the ListBox, the color of the panel should be changed but nothing happens, when we check the style via "Inspect Element"  the style was changed but visually not applied. Everything works fine until update to version Chrome 35.

Is anyone encounter the same problem? Any Ideas why when we change the style using addStyle()/removeStyle() the new style does not take affect?


I have no problems with Firefox


I use UIBibder.


public class SelectorImpl extends Composite {




 
@UiField

   
ListBox listBox;


 
@UiField

 
HTMLPanel panel;


 
interface Style extends CssResource {

   
String red();


   
String green();

 
}


 
@UiField

 
Style style;


 
private Map<Integer, String> colorsMap = new HashMap<Integer, String>();

 
private String currentColor;


 
public EmployeeAttendanceSchedulerViewImpl() {

       
...


      colorsMap
.put(1, style.red()) ;

      colorsMap
.put(2, style.green());


      currentColor
= style.red();

      panel
.addStyleName(currentColor);

 
}



 
@UiHandler("listBox")

 
public void onListSelected(ChangeEvent event){

    panel
.removeStyleName(currentColor);

    currentColor
=  colorsMap.get(listBox.getSelectedIndex());

    panel
.addStyleName(currentColor);

 
}

}


In ui.xml


<ui:style type="com.SelectorImpl.Style">



    .red {

      background-color: #FF0000;

    }


    .green {

       background-color: #00FF00;

    }


    .panelBoxStyle {

      box-sizing: border-box;

      border: solid 1px;

      width: 40px;

      height: 19px;

    }


 
</ui:style>


 
<g:HTMLPanel>

   
<g:ListBox ui:field="listBox"/>

   
<g:HTMLPanel ui:field="panel" styleName="{style.panelBoxStyle}"/>

 
</g:HTMLPanel>



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment