/** * Constructor for {@link SuggestBox}. Creates a {@link TextBox} to use with this * {@link SuggestBox}. * * @param poracle the oracle for this <code>SuggestBox</code> */ public AbstractFormatingSuggestBox(final SuggestOracle poracle) { super(poracle); addKeyPressHandler(HandlerFactory.getFilterReplAndFormatStrKeyPressHandler()); addKeyUpHandler(HandlerFactory.getFormatStrKeyUpHandler()); sinkEvents(Event.ONPASTE); }
@Override public void reformatValue(final boolean fireEvents) { final ValueWithPos<String> unformatedEntry = new ValueWithPos<>(getValue(), getValueBox().getCursorPos()); formatValue(unformatedEntry, fireEvents); }
@Override public void reformatValue() { reformatValue(true); }
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) { getValueBox().setCursorPos(formatedEntry.getValue().length()); } else { getValueBox().setCursorPos(formatedEntry.getPos()); } } }
@Override public void formatValue(final ValueWithPos<String> pvalue) { formatValue(pvalue, true); }
protected void setTextWithPos(final ValueWithPos<String> formatedEntry) { this.setValue(formatedEntry.getValue(), true); if (formatedEntry.getPos() > StringUtils.length(formatedEntry.getValue()) // || formatedEntry.getPos() < 0) { getValueBox().setCursorPos(formatedEntry.getValue().length()); } else { getValueBox().setCursorPos(formatedEntry.getPos()); } } }
/** * Constructor for {@link SuggestBox}. Creates a {@link TextBox} to use with this * {@link SuggestBox}. * * @param poracle the oracle for this <code>SuggestBox</code> */ public AbstractFormatingSuggestBox(final SuggestOracle poracle) { super(poracle); addKeyPressHandler(HandlerFactory.getFilterReplAndFormatStrKeyPressHandler()); addKeyUpHandler(HandlerFactory.getFormatStrKeyUpHandler()); sinkEvents(Event.ONPASTE); }
@Override public void reformatValue() { final ValueWithPos<String> unformatedEntry = new ValueWithPos<>(getValue(), getValueBox().getCursorPos()); formatValue(unformatedEntry); }
@Override public void onBrowserEvent(final Event pevent) { // Checking for paste event if (pevent.getTypeInt() == Event.ONPASTE) { Scheduler.get().scheduleDeferred(() -> reformatValue()); return; } super.onBrowserEvent(pevent); }
/** * Constructor for {@link SuggestBox}. Creates a {@link TextBox} to use with this * {@link SuggestBox}. * * @param poracle the oracle for this <code>SuggestBox</code> * @param pbox value box used for input */ public AbstractFormatingSuggestBox(final SuggestOracle poracle, final ValueBoxBaseWithEditorErrors<String> pbox) { super(poracle, pbox); 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); }
/** * Constructor for {@link SuggestBox}. Creates a {@link TextBox} to use with this * {@link SuggestBox}. * * @param poracle the oracle for this <code>SuggestBox</code> * @param pbox value box used for input */ public AbstractFormatingSuggestBox(final SuggestOracle poracle, final ValueBoxBaseWithEditorErrors<String> pbox) { super(poracle, pbox); addKeyPressHandler(HandlerFactory.getFilterReplAndFormatStrKeyPressHandler()); addKeyUpHandler(HandlerFactory.getFormatStrKeyUpHandler()); sinkEvents(Event.ONPASTE); }