@Override public void showErrors(final List<EditorError> perrors) { final Set<String> messages = perrors.stream().filter(error -> editorErrorMatches(error)) .map(error -> error.getMessage()).collect(Collectors.toSet()); ((ValueBoxBaseWithEditorErrors<String>) getValueBox()).showErrors(messages); }
@Override public void setText(final String ptext) { super.setText(ptext); fillBankName(ptext); }
@Override public void setValue(final String pvalue, final boolean pfireEvents) { super.setValue(pvalue, pfireEvents); fillBankName(pvalue); }
@Override public void setAutofocus(final boolean arg) { ((ValueBoxBaseWithEditorErrors<String>) getValueBox()).setAutofocus(arg); }
/** * Constructor for {@link SuggestBox}. The text box will be removed from it's current location and * wrapped by the {@link SuggestBox}. * * @param oracle supplies suggestions based upon the current contents of the text widget * @param box the text widget * @param suggestDisplay the class used to display suggestions */ public SuggestBoxWithEditorErrors(final SuggestOracle oracle, final ValueBoxBaseWithEditorErrors<String> box, final SuggestionDisplay suggestDisplay) { super(); suggestBox = new SuggestBox(oracle, box, suggestDisplay); initWidget(suggestBox); addSelectionHandler(event -> { suggestBox.setValue(StringUtils.EMPTY, false); suggestBox.setValue(event.getSelectedItem().getReplacementString(), true); }); }
@Override public void onBrowserEvent(final Event pevent) { // Checking for paste event if (pevent.getTypeInt() == Event.ONPASTE) { Scheduler.get().scheduleDeferred(() -> reformatValue()); return; } super.onBrowserEvent(pevent); }
/** * Checks if a error belongs to this widget. * * @param perror editor error to check * @return true if the error belongs to this widget */ protected boolean editorErrorMatches(final EditorError perror) { return perror != null && perror.getEditor() != null && (equals(perror.getEditor()) || perror.getEditor().equals(asEditor())); }
@Override public void setRequired(final boolean arg) { ((ValueBoxBaseWithEditorErrors<String>) getValueBox()).setRequired(arg); }
/** * Constructor for {@link SuggestBox}. The text box will be removed from it's current location and * wrapped by the {@link SuggestBox}. * * @param oracle supplies suggestions based upon the current contents of the text widget * @param box the text widget * @param suggestDisplay the class used to display suggestions */ public SuggestBoxWithEditorErrors(final SuggestOracle oracle, final ValueBoxBaseWithEditorErrors<String> box, final SuggestionDisplay suggestDisplay) { super(); suggestBox = new SuggestBox(oracle, box, suggestDisplay); initWidget(suggestBox); addSelectionHandler(event -> { suggestBox.setValue(StringUtils.EMPTY, false); suggestBox.setValue(event.getSelectedItem().getReplacementString(), true); }); }
@Override public void onBrowserEvent(final Event pevent) { // Checking for paste event if (pevent.getTypeInt() == Event.ONPASTE) { Scheduler.get().scheduleDeferred(() -> reformatValue()); return; } super.onBrowserEvent(pevent); }
/** * Checks if a error belongs to this widget. * * @param perror editor error to check * @return true if the error belongs to this widget */ protected boolean editorErrorMatches(final EditorError perror) { return perror != null && perror.getEditor() != null && (equals(perror.getEditor()) || perror.getEditor().equals(asEditor())); }
@Override public void setValidationMessageElement(final HTMLPanel pelement) { ((ValueBoxBaseWithEditorErrors<String>) getValueBox()).setValidationMessageElement(pelement); }
@Override public void showErrors(final List<EditorError> perrors) { final Set<String> messages = perrors.stream().filter(error -> editorErrorMatches(error)) .map(error -> error.getMessage()).collect(Collectors.toSet()); ((ValueBoxBaseWithEditorErrors<String>) getValueBox()).showErrors(messages); }
@Override public void setText(final String ptext) { super.setText(ptext); fillBankName(ptext); }
@Override public void setValue(final String pvalue, final boolean pfireEvents) { super.setValue(pvalue, pfireEvents); fillBankName(pvalue); }
@Override public HTMLPanel getValidationMessageElement() { return ((ValueBoxBaseWithEditorErrors<String>) getValueBox()).getValidationMessageElement(); }
@Override public void setAutocomplete(final String arg) { ((ValueBoxBaseWithEditorErrors<String>) getValueBox()).setAutocomplete(arg); } }
@Override public HandlerRegistration addFocusHandler(final FocusHandler phandler) { return getValueBox().addFocusHandler(phandler); }
@Override public HandlerRegistration addKeyUpHandler(final KeyUpHandler handler) { return getValueBox().addKeyUpHandler(handler); }
@Override public HandlerRegistration addKeyDownHandler(final KeyDownHandler handler) { return getValueBox().addKeyDownHandler(handler); }