I am talking about two buttons having the same text message in java.
private Button validateButtonOne = new Button();
private Button validateButtonTwo = new Button();
validateButtonOne.setText("Validate");
validateButtonTwo.setText("validate");
buttonlisteners(validateButtonOne);
buttonListeners(validateButtonTwo);;
private buttonListeners(Button button) {
button.addHandler(new ...) {
>>>>>>>>>>I need to add a separate logic based on button click...
For example, if validateButtonOne click then do logic related to button one
Elese add logic related to validateButtonTwo.
}
}
So how to identify which button is clicked within common handler method?
On Mon, Feb 7, 2011 at 8:00 PM, Hilco Wijbenga <[email protected]>wrote:
> On 7 February 2011 17:41, NAARAYANA REDDY NANDIGAMA
> <[email protected]> wrote:
> > I have another requirement.. I have two buttons with same name
> "validate". I
> > need to identify which button is clicked when I user click on any one of
> > validate buttton. I thought i can use button.getText but both buttons has
> > the same name so not sure what to do. Could you please advise me on this?
>
> I'm not sure what you mean by "the same name". You can't have the same
> id twice and I don't see why you would want that either.
>
> Just do something like
>
> <g:Button ui:field="validateOne">Validate</g:Button>
> <g:Button ui:field="validateTwo">Validate</g:Button>
>
> and in Java
>
> (if you want to do something with the buttons themselves)
> @UiField
> Button validateOne;
> @UiField
> Button validateTwo;
>
> (if you want to respond to clicks)
> @UiHandler("validateOne")
> void onClickValidateOne(ClickEvent event) {...}
> @UiHandler("validateTwo")
> void onClickValidateTwo(ClickEvent event) {...}
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.