return result;
}
public static void UpdateUI(JTextComponent comp, ValidationResult valResult){
Severity severity = ValidationComponentUtils.getSeverity(comp);
BalloonTip tip = (BalloonTip) comp.getClientProperty("Balloon");
if (tip!=null) tip.closeBalloon();
if (valResult.hasErrors()){
if (severity!=Severity.ERROR){
comp.setBackground(ERROR_BACKGROUND);
ValidationComponentUtils.setSeverity(comp, Severity.ERROR);
}
BalloonTipStyle tipStyle = new RoundedBalloonStyle(5,5,ERROR_BACKGROUND, Color.BLACK);
BalloonTip newTip = new BalloonTip(comp,new JLabel(valResult.getErrors().get(0).formattedText()),tipStyle,
Orientation.RIGHT_ABOVE, AttachLocation.WEST, 15, 15, false);
comp.putClientProperty("Balloon", newTip);
return;
}
if (valResult.hasWarnings()){
if (severity!=Severity.WARNING){
comp.setBackground(WARNING_BACKGROUND);
ValidationComponentUtils.setSeverity(comp, Severity.WARNING);
}
BalloonTipStyle tipStyle = new RoundedBalloonStyle(5,5,WARNING_BACKGROUND, Color.BLACK);
BalloonTip newTip = new BalloonTip(comp,new JLabel(valResult.getWarnings().get(0).formattedText()),tipStyle,
Orientation.RIGHT_ABOVE, AttachLocation.WEST, 15, 15, false);
ToolTipUtils.balloonToToolTip(newTip, 500, 10000);
comp.putClientProperty("Balloon", newTip);
return;