| Summary: | Validator message not shown on ValidationTime.ON_UPDATE_TO_MODEL | ||
|---|---|---|---|
| Product: | [RT] Riena | Reporter: | Ralf Stuckert <ralf.stuckert> |
| Component: | UI | Assignee: | Sabine Achilles <achilles.sabine> |
| Status: | RESOLVED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 1.2.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows Vista | ||
| Whiteboard: | |||
|
Description
Ralf Stuckert
Hi Ralf, can you provide a snippet (standalone or in a comment) ? If your validation message is tied to a rule, it will only appear when that rule is validated. This may explain the above, but I would like to see a snippet to be sure. Kind regards, Elias. The problem seems to be specific to blocking validators like e.g. MaxLength in conjunction with ValidationTime.ON_UPDATE_TO_MODEL.
Try the following snippet. Enter >5 characters to both Text fields. They both have 5 character max length validator. The difference is, that the second field is using a "non-blocking" validator. Field two gets marked, field one doesn't. Can you reproduce that?
package org.eclipse.riena.sample.snippets;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.riena.ui.core.marker.ValidationTime;
import org.eclipse.riena.ui.ridgets.ITextRidget;
import org.eclipse.riena.ui.ridgets.marker.TooltipMessageMarkerViewer;
import org.eclipse.riena.ui.ridgets.swt.SwtRidgetFactory;
import org.eclipse.riena.ui.ridgets.validation.MaxLength;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import rst.riena.sample.beans.TextBean;
public final class BlockingValidatorProblem {
public static void main(String[] args) {
Display display = Display.getDefault();
try {
Shell shell = new Shell();
GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).spacing(20, 10).applyTo(shell);
Text text = new Text(shell, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(text);
ITextRidget textRidget = (ITextRidget) SwtRidgetFactory.createRidget(text);
textRidget.addValidationRule(new MaxLength(5), ValidationTime.ON_UPDATE_TO_MODEL);
textRidget.bindToModel(new TextBean(), "text");
Text text2 = new Text(shell, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(text2);
ITextRidget textRidget2 = (ITextRidget) SwtRidgetFactory.createRidget(text2);
textRidget2.addValidationRule(new NonBlockingMaxLength(5), ValidationTime.ON_UPDATE_TO_MODEL);
textRidget2.bindToModel(new TextBean(), "text");
TooltipMessageMarkerViewer tooltipMessageMarkerView = new TooltipMessageMarkerViewer();
tooltipMessageMarkerView.addRidget(textRidget);
tooltipMessageMarkerView.addRidget(textRidget2);
shell.setSize(200, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
} finally {
display.dispose();
}
}
}
class NonBlockingMaxLength extends MaxLength {
public NonBlockingMaxLength(int length) {
super(length, false);
}
}
This bug was fixed with report 289458 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=289458). Both TextFields in the snippet show an ErrorMarker now. Duplicate of resolved Bug. *** This bug has been marked as a duplicate of bug 289458 *** |