Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Replacing getConfiguredValidateOnAnyKey() in Mars
Replacing getConfiguredValidateOnAnyKey() in Mars [message #1713223] Mon, 02 November 2015 14:12 Go to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
We've been using the "ValidateOnAnyKey" property on string fields to allow filtering of user input (e.g. allowing only numbers and the asterisk) by defining

@Override
protected boolean getConfiguredValidateOnAnyKey() {
  return true;
}


We then also overrode execValidateValue() which filtered the rawValue and returned the filtered value to be set again. This worked flawlessly with Scout Luna SR2 but since we switched to Scout Mars SR1 this has not worked reliably any more (returning a filtered value from execValidateValue() only works the first time, not on subsequent calls).

While trying to put together a minimal project demonstrating this issue I noticed that getConfiguredValidateOnAnyKey() is now deprecated. Trying to recreate the same behaviour using the recommended replacement methods I've come up with the following code:

  @Override
  protected boolean getConfiguredUpdateDisplayTextOnModify() {
    return true;
  }

  @Override
  protected void execChangedDisplayText() {
    try {
      String validatedValue = interceptValidateValue(getDisplayText());
      setDisplayText(validatedValue);
    } catch (ProcessingException e) {
      LOGT.warn("Exception while validating changed display text", e);
    }
  }


Is this the way this was intended to be done or is there an easier way?
Re: Replacing getConfiguredValidateOnAnyKey() in Mars [message #1713230 is a reply to message #1713223] Mon, 02 November 2015 15:01 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
From what I read in the "New And Noteworthy Mars guide"
https://wiki.eclipse.org/Scout/NewAndNoteworthy/5.0#Replacement_for_ValidateOnAnyKey_mechanism
(I agree we could add a small example and a text description on this page)

You should use:
setUpdateDisplayTextOnModify(validatedValue);


PS: I did not test this.

[Updated on: Mon, 02 November 2015 15:06]

Report message to a moderator

Re: Replacing getConfiguredValidateOnAnyKey() in Mars [message #1713377 is a reply to message #1713230] Tue, 03 November 2015 16:11 Go to previous message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Thanks, I'll try this tomorrow.
Previous Topic:[NOOB QUESTION] Change Page Title at Runtime
Next Topic:Maven build / OSGi / Tycho / manifest-first
Goto Forum:
  


Current Time: Fri Apr 19 01:25:47 GMT 2024

Powered by FUDForum. Page generated in 0.02469 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top