@Override public boolean isAllowedCharacter(final char pcharacter) { return pcharacter >= '0' && pcharacter <= '9' || isFormatingCharacter(pcharacter); }
@Override public void onSuccess(final Method pmethod, final ValueWithPos<String> presponse) { if (presponse != null && StringUtils.isNotEmpty(presponse.getValue())) { AbstractPhoneNumberRestSuggestBox.this.setTextWithPos(presponse); } } };
@Override public void formatValue(final ValueWithPos<String> pvalue) { if (pvalue == null || StringUtils.isEmpty(pvalue.getValue())) { this.setValue(StringUtils.EMPTY); } else { final ValueWithPosAndCountry<String> unformatedEntry = new ValueWithPosAndCountry<>( pvalue.getValue(), pvalue.getPos(), Objects.toString(countryCodeField.getValue()), LocaleInfo.getCurrentLocale().getLocaleName()); try { final FutureResult<ValueWithPos<String>> result = cache.get(unformatedEntry); if (result.isDone()) { setTextWithPos(result.get()); } } catch (final ExecutionException e) { GWT.log(e.getMessage(), e); } } }
@Override public FutureResult<ValueWithPos<String>> load( final ValueWithPosAndCountry<String> pkey) { final FutureResult<ValueWithPos<String>> result = new FutureResult<>(); result.addCallback(callback); try { AbstractPhoneNumberRestSuggestBox.this.formatValue(pkey, result); } catch (final ExecutionException e) { GWT.log(e.getMessage(), e); } return result; } });
((TextBoxWithFormating) getValueBox()).setFormating(this); callback = new AbstractSimpleRestCallback<AbstractPhoneNumberRestSuggestBox, ValueWithPos<String>, //
@Override public void formatValue(final ValueWithPos<String> pvalue) { if (pvalue == null || StringUtils.isEmpty(pvalue.getValue())) { this.setValue(StringUtils.EMPTY); } else { final ValueWithPosAndCountry<String> unformatedEntry = new ValueWithPosAndCountry<>( pvalue.getValue(), pvalue.getPos(), Objects.toString(countryCodeField.getValue()), LocaleInfo.getCurrentLocale().getLocaleName()); try { final FutureResult<ValueWithPos<String>> result = cache.get(unformatedEntry); if (result.isDone()) { setTextWithPos(result.get()); } } catch (final ExecutionException e) { GWT.log(e.getMessage(), e); } } }
@Override public FutureResult<ValueWithPos<String>> load( final ValueWithPosAndCountry<String> pkey) { final FutureResult<ValueWithPos<String>> result = new FutureResult<>(); result.addCallback(callback); try { AbstractPhoneNumberRestSuggestBox.this.formatValue(pkey, result); } catch (final ExecutionException e) { GWT.log(e.getMessage(), e); } return result; } });
((TextBoxWithFormating) getValueBox()).setFormating(this); service = ServiceFactory.getPhoneNumberService(); callback = new MethodCallback<ValueWithPos<String>>() {
@Override public void onSuccess(final ValueWithPos<String> presponse) { if (presponse != null && StringUtils.isNotEmpty(presponse.getValue())) { AbstractPhoneNumberRestSuggestBox.this.setTextWithPos(presponse); } }
@Override public boolean isAllowedCharacter(final char pcharacter) { return pcharacter >= '0' && pcharacter <= '9' || isFormatingCharacter(pcharacter); }