/** * Returns the validation result message at the given index. * * @param index the index of the message to return * @return the validation result message at the given index * @see javax.swing.ListModel#getElementAt(int) */ @Override public Object getElementAt(int index) { return model.getResult().getMessages().get(index); }
/** * Returns the validation result message at the given index. * * @param index the index of the message to return * @return the validation result message at the given index * @see javax.swing.ListModel#getElementAt(int) */ public Object getElementAt(int index) { return model.getResult().getMessages().get(index); }
/** * Returns the number of validation result messages. * * @return the number of validation result messages * @see javax.swing.ListModel#getSize() */ public int getSize() { return model.getResult().size(); }
/** * Returns the number of validation result messages. * * @return the number of validation result messages * @see javax.swing.ListModel#getSize() */ @Override public int getSize() { return model.getResult().size(); }
/** * Returns the concatenation of all validation results that are held * by this container. * * @return the concatenation of all validation results that are held * by this container * * @see #getCollapsedValidationResult() */ public ValidationResult getExpandedValidationResult() { ValidationResult concatenation = new ValidationResult(); for (ValidationResultModel resultModel : childResultModels) { concatenation.addAllFrom(resultModel.getResult()); } return concatenation; }
/** * Returns the concatenation of all validation results that are held * by this container. * * @return the concatenation of all validation results that are held * by this container * * @see #getCollapsedValidationResult() */ public ValidationResult getExpandedValidationResult() { ValidationResult concatenation = new ValidationResult(); for (ValidationResultModel resultModel : childResultModels) { concatenation.addAllFrom(resultModel.getResult()); } return concatenation; }
/** * 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; }
/** * Creates and returns a label with icon and text that indicates * the validation state and displays the first message text. * * @param model the model that provides the observable validation result * @return a label with text and icon that shows the validation severity * and the first validation message text */ public static JLabel createReportIconAndTextLabel(ValidationResultModel model) { JLabel label = createReportIconLabel(model); LabelTextChangeHandler.updateText(label, model.getResult()); model.addPropertyChangeListener( ValidationResultModel.PROPERTYNAME_RESULT, new LabelTextChangeHandler(label)); return label; }
/** * Creates and returns a label with icon and text that indicates * the validation state and displays the first message text * with the highest severity. * * @param model the model that provides the observable validation result * @return a label with text and icon that shows the validation severity * and the first validation message text */ public static JLabel createReportIconAndTextLabel(ValidationResultModel model) { JLabel label = createReportIconLabel(model); LabelTextChangeHandler.updateText(label, model.getResult()); model.addPropertyChangeListener( ValidationResultModel.PROPERTY_RESULT, new LabelTextChangeHandler(label)); return label; }
private void updateFeedbackComponents() { removeAllFeedbackComponents(); visitComponentTree(content, model.getResult().keyMap(), 0, 0); repaint(); }
private void insertComponents() { ValidationResult result = model.getResult(); if (!result.isEmpty()) { for (ValidationMessage vm : result.getMessages()) { if (vm.key() instanceof JComponent) { Component c = (Component) vm.key(); if (c instanceof IToolTippableComponent) { c = ((IToolTippableComponent) c).getToolTipableComponent(); } List<ValidationMessage> vs = componentMap.get(c); if (vs == null) { vs = new ArrayList<ValidationMessage>(); componentMap.put(c, vs); c.addFocusListener(this); } vs.add(vm); Collections.sort(vs, SEVERITY_COMPARATOR); } } showWindow(); } }