Thanks again.
Maybe I can post you what I have done and you can pinpoint what I am missing
IndicatorTextField.java
public class IndicatorTextField extends Composite implements HasText, HasKeyUpHandlers, HasBlurHandlers{
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));
}
@Override
public String getText() {
return label.getText();
}
@Override
public void setText(String text) {
label.setText(text);
}
@Override
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
return textBox.addKeyUpHandler(handler);
//return addDomHandler(handler, KeyUpEvent.getType());
}
@UiHandler("textBox")
public void onKeyUp(KeyUpEvent event)
{
DomEvent.fireNativeEvent(event.getNativeEvent(), this);
}
@Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
return textBox.addBlurHandler(handler);
//return addDomHandler(handler, BlurEvent.getType());
}
@UiHandler("textBox")
public void onBlur(BlurEvent event)
{
DomEvent.fireNativeEvent(event.getNativeEvent(), this);
}
}
This is the code in my main class where I am applying the textbox
@UiField IndicatorTextField txtFirstName;
@UiHandler("txtFirstName")
void onKeyUp(KeyUpEvent event)
{
validateFields();
}
@UiHandler("txtFirstName")
void onBlur(BlurEvent event)
{
validateFields();
}
}
this should then fire validateFields() but still not.
Arian
The class where I want to use the custom textbox