You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Greg Brown (JIRA)" <ji...@apache.org> on 2010/08/27 14:00:56 UTC
[jira] Updated: (PIVOT-612) TextInput validator problem when
modifying selected text
[ https://issues.apache.org/jira/browse/PIVOT-612?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Greg Brown updated PIVOT-612:
-----------------------------
Fix Version/s: 1.5.2
> TextInput validator problem when modifying selected text
> --------------------------------------------------------
>
> Key: PIVOT-612
> URL: https://issues.apache.org/jira/browse/PIVOT-612
> Project: Pivot
> Issue Type: Bug
> Affects Versions: 1.5
> Reporter: A.J.
> Fix For: 1.5.2, 2.0
>
>
> I have a validator on a textinput with strict validation set to true;
> The validator tries to match the text against a pattern.
> Everything is fine until i try to modify text that is selected (either partially or completely).
> And this because validation does not take into account that selected text should be replaced by typed characters;
> instead, it is trying to validate the concatenation of the new character and the actual text instead of replacing the selected part of the text.
> (lines 1059-1063 in class TerraTextInputSkin)
> I don't know if I'm clear.
> Consider this (pretty stupid) example that tries to accept only one digit in the text input :
> TextInput textInput = new TextInput();
> textInput.setMaximumLength(1);
> textInput.setStrictValidation(true);
> textInput.setValidator(new Validator() {
> @Override
> public boolean isValid(String text) {
> if (text.length() == 0)
> return true; // ok we accept empty field
> return text.length() == 1 && Character.isDigit(text.charAt(0));
> }
> });
>
> BoxPane boxPane = new BoxPane(Orientation.HORIZONTAL);
> boxPane.add(textInput);
> boxPane.add(new PushButton("Test"));
> window.setContent(boxPane);
> Steps:
> 1. start app.
> 2. put focus in textinput (should be empty)
> 3. enter a digit, ex : '5'; ok this should work
> 4. move focus on button then move focus back on textinput
> 5. text is selected in textinput
> 6. try to replace the selected value ('5') by another digit by simply typing it
> ==> doesnt work (while it should)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.