java - setting CSS style Uibinder Gwt -


i want change color of g:label using java code on onblur event. using eclipse, uibinder.

this have in mind although doesn't work.

in standarddocumentdownload.ui.xml file

<ui:style>         .teststyle {    }    .stylerequireddata    {         color:red;      }  </ui:style> 

this event in standarddocumentdownload.java file

@uihandler("combotitle") void oncombotitleblur(blurevent event) {     int title = combotitle.getselectedindex();      if(title == 0)     {         labtitlereq.settext("please enter value");         labtitle.addstylename("stylerequireddata");     }     else     {         labtitlereq.settext("");     }  } 

how add color red existing style of label upon firing of event.

kind regards

see here under programmatic access inline styles

for you, shoulbe :

<ui:style type="com.yourapp.yourclass.mystyle">          .teststyle {     }     .stylerequireddata     {         color:red;     } </ui:style>  public class yourclass extends widget {     interface mystyle extends cssresource {         string teststyle();         string stylerequireddata();     }      @uifield mystyle style;      /* ... */      @uihandler("combotitle")     void oncombotitleblur(blurevent event) {         int title = combotitle.getselectedindex();         if(title == 0){             labtitlereq.settext("please enter value");             labtitle.getelement().addclassname(style.stylerequireddata);         } else {             labtitlereq.settext("");         }     } } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -