Good day
I have a custom TextBox that has a IndicatorTextBox.ui.xml file as well as IndicatorTextBox.java file. Ussually adding an evenhadler to a textbox is simple.
This is in my main .java file
@UiHandler("txtFirstName")
void onTxtFirstNameKeyUp(KeyUpEvent event){
validateFields();
}
How would I add the handler if the txtFirstName was the custom textbox with label that I am adding to this page.? So, in other words txtFirstnName is not @UiField TextBox txtFirstName but IndicatorTextField txtFirstName instead.
The IndicatorTextBox.java file looks as follow
import com.google.gwt.core.client.GWT;
public class IndicatorTextField extends Composite implements HasText{
public interface Binder extends UiBinder<Widget, IndicatorTextField> {
}
private static final Binder binder = GWT.create(Binder.class);
public interface Style extends CssResource{
String textStyling();
String requiredInputLabel();
String colorNotValidated();
}
@UiField Style style;
@UiField Label label;
@UiField TextBox textBox;
public IndicatorTextField()
{
initWidget(binder.createAndBindUi(this));
}
public void setBackgroundValidateTextbox(boolean validated)
{
if(validated)
{
textBox.getElement().addClassName(style.colorNotValidated());
}
else
{
textBox.getElement().removeClassName(style.colorNotValidated());
}
}
@Override
public String getText() {
return label.getText();
}
@Override
public void setText(String text) {
label.setText(text);
}