/** * default constructor. */ public AbstractFormatingTextBox() { super(); addKeyPressHandler(HandlerFactory.getFilterReplAndFormatStrKeyPressHandler()); addKeyUpHandler(HandlerFactory.getFormatStrKeyUpHandler()); sinkEvents(Event.ONPASTE); }
@Override public void reformatValue(final boolean fireEvents) { final ValueWithPos<String> unformatedEntry = new ValueWithPos<>(getValue(), getCursorPos()); formatValue(unformatedEntry, fireEvents); }
@Override public void reformatValue() { reformatValue(false); }
protected void setTextWithPos(final ValueWithPos<String> formatedEntry) { this.setValue(formatedEntry.getValue(), false); if (formatedEntry.getPos() > StringUtils.length(formatedEntry.getValue()) // || formatedEntry.getPos() < 0) { setCursorPos(formatedEntry.getValue().length()); } else { setCursorPos(formatedEntry.getPos()); } } }
@Override protected void setTextWithPos(final ValueWithPos<String> formatedEntry, final boolean fireEvents) { super.setTextWithPos(formatedEntry, fireEvents); if (bicInput != null && StringUtils.isEmpty(bicInput.getValue())) { final String bic = IbanUtil.getBicOfIban(formatedEntry.getValue()); if (StringUtils.isNotEmpty(bic)) { bicInput.setValue(bic); } } }
@Override public void formatValue(final ValueWithPos<String> pvalue) { formatValue(pvalue, false); }
protected void setTextWithPos(final ValueWithPos<String> formatedEntry, final boolean fireEvents) { this.setValue(formatedEntry.getValue(), fireEvents); if (formatedEntry.getPos() > StringUtils.length(formatedEntry.getValue()) // || formatedEntry.getPos() < 0) { setCursorPos(formatedEntry.getValue().length()); } else { setCursorPos(formatedEntry.getPos()); } } }
@Override protected void setTextWithPos(final ValueWithPos<String> formatedEntry) { super.setTextWithPos(formatedEntry); if (bicInput != null && StringUtils.isEmpty(bicInput.getValue())) { final String bic = IbanUtil.getBicOfIban(formatedEntry.getValue()); if (StringUtils.isNotEmpty(bic)) { bicInput.setValue(bic); } } }
@Override public void reformatValue() { final ValueWithPos<String> unformatedEntry = new ValueWithPos<>(getValue(), getCursorPos()); formatValue(unformatedEntry); }
/** * default constructor. */ public AbstractFormatingTextBox() { super(); addKeyPressHandler(HandlerFactory.getFilterReplAndFormatStrKeyPressHandler()); addKeyUpHandler(HandlerFactory.getFormatStrKeyUpHandler()); sinkEvents(Event.ONPASTE); }
@Override public void onBrowserEvent(final Event pevent) { // Checking for paste event if (pevent.getTypeInt() == Event.ONPASTE) { Scheduler.get().scheduleDeferred(() -> reformatValue()); return; } super.onBrowserEvent(pevent); }
@Override public void onBrowserEvent(final Event pevent) { // Checking for paste event if (pevent.getTypeInt() == Event.ONPASTE) { Scheduler.get().scheduleDeferred(() -> reformatValue()); return; } super.onBrowserEvent(pevent); }