/** * The ValidationResult of the observed ValidationResultModel * has changed. Updates this handler's text component's text * to the message text of the new ValidationResult. */ public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(ValidationResultModel.PROPERTYNAME_RESULT)) { updateText(textComponent, (ValidationResult) evt.getNewValue()); } }
/** * Creates and returns a text area that is intended to show validation * messages. The area is bound to the given {@link ValidationResultModel}: * the text content reflects the validation result message text, * and the component is visible if and only if the model has messages. * * @param model the model that provides the observable validation result * @param backgroundColor the color used to paint the area's background * @return a text area intended to show validation messages */ public static JTextArea createReportTextArea(ValidationResultModel model, Color backgroundColor) { JTextArea area = new JTextArea(); area.setEditable(false); area.setFocusable(false); area.setOpaque(true); area.setBackground(backgroundColor); MessageTextChangeHandler.updateText(area, model.getResult()); model.addPropertyChangeListener( ValidationResultModel.PROPERTY_RESULT, new MessageTextChangeHandler(area)); return area; }
/** * Creates and returns a text area that is intended to show validation * messages. The area is bound to the given {@link ValidationResultModel}: * the text content reflects the validation result message text, * and the component is visible if and only if the model has messages. * * @param model the model that provides the observable validation result * @param backgroundColor the color used to paint the area's background * @return a text area intended to show validation messages */ public static JTextArea createReportTextArea(ValidationResultModel model, Color backgroundColor) { JTextArea area = new JTextArea(); area.setEditable(false); area.setFocusable(false); area.setOpaque(true); area.setBackground(backgroundColor); MessageTextChangeHandler.updateText(area, model.getResult()); model.addPropertyChangeListener( ValidationResultModel.PROPERTYNAME_RESULT, new MessageTextChangeHandler(area)); return area; }
/** * The ValidationResult of the observed ValidationResultModel * has changed. Updates this handler's text component's text * to the message text of the new ValidationResult. */ @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(ValidationResultModel.PROPERTY_RESULT)) { updateText(textComponent, (ValidationResult) evt.getNewValue()); } }