Copy import static org . jboss . elemento . Elements . * ;
import static org . jboss . elemento . EventType . * ;
import static org . jboss . elemento . InputType . checkbox ;
import static org . jboss . elemento . InputType . text ;
HTMLLIElement listItem = li()
. add ( div() . css ( "view" )
. add ( input(checkbox)
. css ( "toggle" )
. on (change , event -> toggle() ))
. add ( label()
. textContent ( "Taste Elemento" )
. on (dblclick , event -> edit() ))
. add ( button()
. css ( "destroy" )
. on (click , event -> destroy() )))
. add ( input(text)
. css ( "edit" )
. on (keydown , this :: keyDown)
. on (blur , event -> blur() ))
. element ();
Copy import org . gwtproject . event . shared . HandlerRegistration ;
import static elemental2 . dom . DomGlobal . alert ;
import static org . jboss . elemento . EventType . bind ;
import static org . jboss . elemento . EventType . click ;
HandlerRegistration handler = bind(listItem , click , event -> alert( "Clicked" )) ;
Copy import elemental2 . dom . KeyboardEvent ;
import static org . jboss . elemento . Key . Escape ;
import static org . jboss . elemento . Key . Enter ;
void keyDown( KeyboardEvent event) {
if ( Escape . match (event)) {
...
} else if ( Enter . match (event)) {
...
}
}