Hello.
I'm not an Editor framework specialist, but from glancing at the code, I
would say IsEditor<LeafValueEditor<Date>> or LeafValueEditor<Date>, just
like the DateBox itself does.
Hope this helps
Regards
Nicolas
Le 2014-02-22 01:30, Ervin Hoxha a écrit :
> I have a composite widget composed by 3 TextBoxes that acts as a "date
> mask" field, like:[DD]/[MM]/[YYY] (dont ask why I am doing this :), I
> dont like DateBox and I have to force the user to keep given format,
> so I wrote my own widget). Here is the java code:
>
> import com.google.gwt.core.client.GWT;
> import com.google.gwt.event.dom.client.KeyUpEvent;
> import com.google.gwt.uibinder.client.UiBinder;
> import com.google.gwt.uibinder.client.UiField;
> import com.google.gwt.uibinder.client.UiHandler;
> import com.google.gwt.user.client.ui.Composite;`enter code here`
> import com.google.gwt.user.client.ui.TextBox;
> import com.google.gwt.user.client.ui.Widget;
>
> public class DateMaskWidget extends Composite {
>
> private static DateMaskWidgetUiBinder uiBinder = GWT
> .create(DateMaskWidgetUiBinder.class);
>
> interface DateMaskWidgetUiBinder extends UiBinder<Widget,
> DateMaskWidget> {
> }
>
> @UiField
> TextBox daysTextbox;
> @UiField
> TextBox monthsTextbox;
> @UiField
> TextBox yearsTextbox;
>
> public DateMaskWidget() {
> initWidget(uiBinder.createAndBindUi(this));
>
> daysTextbox.setMaxLength(2);
> monthsTextbox.setMaxLength(2);
> yearsTextbox.setMaxLength(4);
> }
>
> @UiHandler("daysTextbox")
> void onKeyUp(KeyUpEvent event)
> {
> //if 2 chars were entered focus the next box
> if(daysTextbox.getText().length()==daysTextbox.getMaxLength())
> monthsTextbox.setFocus(true);
> }
> @UiHandler("monthsTextbox")
> void onKeyUp2(KeyUpEvent event)
> {
> //if 2 chars were entered focus the next box
> if(monthsTextbox.getText().length()==monthsTextbox.getMaxLength())
> yearsTextbox.setFocus(true);
> }
>
> }
>
> Now I'd like this widget to behave as a single Editor (like a single
> TextBox), so i can set a value to it by passing a string like
> xx/xx/xxxx .
>
> THE QUESTION IS: WHICH INTERFACE DO I NEED TO IMPLEMENT AND WHICH
> METHODS DO I NEED TO OVERRIDE TO ACHIVE THIS?? WHICH METHODS ARE USED
> IN THE EDITOR FRAMEWORK TO SET/GET THE VALUE OF AN EDITOR??
>
> In the background, I will need to take the given string (probably
> passed in a method like setValue() ), split it in 3 parts, and assign
> each part to the right text box. And same thing for a getValue()
> method.
>
> Thanks for your help
>
> --
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to google-web-toolkit+unsubscribe@googlegroups.com.
> To post to this group, send email to
> google-web-toolkit@googlegroups.com.
> Visit this group at http://groups.google.com/group/google-web-toolkit
> [1].
> For more options, visit https://groups.google.com/groups/opt_out [2].
>
>
> Links:
> ------
> [1] http://groups.google.com/group/google-web-toolkit
> [2] https://groups.google.com/groups/opt_out
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment