use of com.jgoodies.validation.ValidationMessage in project kindergarten by clear-group-ausbildung.
the class IconFeedbackPanel method getMessagesToolTipText.
/**
* Returns a string representation of the given validation result, intended for
* tool tips. Unlike {@link ValidationResult#getMessagesText()} this method
* returns an HTML string. It is invoked by
* {@link #createFeedbackComponent(ValidationResult, Component)} and the result
* won't be empty.
*
* @param result
* provides the ValidationMessages to iterate over
* @return an HTML representation of the given result
*
* @since 1.3.1
*/
private static String getMessagesToolTipText(ValidationResult result) {
StringBuilder builder = new StringBuilder("<html>");
for (ValidationMessage message : result.getMessages()) {
if (builder.length() > 0) {
builder.append("<br>");
}
builder.append(message.formattedText());
}
builder.append("</html>");
return builder.toString();
}
use of com.jgoodies.validation.ValidationMessage in project kindergarten by clear-group-ausbildung.
the class Dialogs method vendorHasErrors.
// API ********************************************************************
/**
* @return {@code true} if canceled, {@code false} otherwise
*/
public static boolean vendorHasErrors(EventObject e, ValidationResult result) {
String title = "Fehler bei der Eingabepr\u00fcfung";
String mainInstruction = "Es konnte aufgrund folgender Fehler nicht gespeichert werden:";
StringBuilder contentTextBuilder = new StringBuilder("<html>");
contentTextBuilder.append(result.getMessages().stream().map(ValidationMessage::formattedText).collect(Collectors.joining("<br>")));
// ich kann den Punkt nur hier entfernen deswegen habe ich noch in
// VendorValidatable den PROPERTY String separat entfernt
String contentText = contentTextBuilder.toString().replace('.', ' ').trim();
TaskPane pane = new TaskPane(MessageType.ERROR, mainInstruction, contentText, CommandValue.CANCEL);
pane.setPreferredWidth(400);
pane.showDialog(e, title);
return pane.isCancelled();
}
Aggregations