@Test void checkTooltipIsRenderedOnValidationErrorWithTooltipAlreadyExists() throws Exception { final HtmlTooltip tooltip = new HtmlTooltip(); uiComponent.setValid(false); uiComponent.getChildren().add(tooltip); assertThat(uiComponent.getChildCount()).isEqualTo(1); renderer.renderTooltipIfNecessary(facesContextMock, uiComponent); assertThat(uiComponent.getChildCount()).isEqualTo(1); verifyNoMoreInteractions(facesContextMock.getResponseWriter()); }
public void renderTooltipIfNecessary(final FacesContext context, final UIComponent component) throws IOException { if (shouldRenderTooltip(component)) { boolean tooltipRendered = false; for (UIComponent uiComponent : component.getChildren()) { if (uiComponent instanceof HtmlTooltip) { if (uiComponent.isRendered()) { tooltipRendered = true; break; } } } if (!tooltipRendered) { final HtmlTooltip htmlTooltip = new HtmlTooltip(); htmlTooltip.setPlacement(((Validation) component).getValidationErrorPlacement()); htmlTooltip.setParent(component); htmlTooltip.encodeAll(context); } } }
TooltipValidationRenderer { public void renderTooltipIfNecessary(final FacesContext context, final UIComponent component) throws IOException { if (shouldRenderTooltip(component)) { boolean tooltipRendered = false; for (UIComponent uiComponent : component.getChildren()) { if (uiComponent instanceof HtmlTooltip) { if (uiComponent.isRendered()) { tooltipRendered = true; break; } } } if (!tooltipRendered) { final HtmlTooltip htmlTooltip = new HtmlTooltip(); htmlTooltip.setPlacement(((Validation) component).getValidationErrorPlacement()); htmlTooltip.setParent(component); htmlTooltip.encodeAll(context); } } } }
TooltipValidationRenderer { public void renderTooltipIfNecessary(final FacesContext context, final UIComponent component) throws IOException { if (shouldRenderTooltip(component)) { boolean tooltipRendered = false; for (UIComponent uiComponent : component.getChildren()) { if (uiComponent instanceof HtmlTooltip) { if (uiComponent.isRendered()) { tooltipRendered = true; break; } } } if (!tooltipRendered) { final HtmlTooltip htmlTooltip = new HtmlTooltip(); htmlTooltip.setPlacement(((Validation) component).getValidationErrorPlacement()); htmlTooltip.setParent(component); htmlTooltip.encodeAll(context); } } }  }
TooltipValidationRenderer { public void renderTooltipIfNecessary(final FacesContext context, final UIComponent component) throws IOException { if (shouldRenderTooltip(component)) { boolean tooltipRendered = false; for (UIComponent uiComponent : component.getChildren()) { if (uiComponent instanceof HtmlTooltip) { if (uiComponent.isRendered()) { tooltipRendered = true; break; } } } if (!tooltipRendered) { final HtmlTooltip htmlTooltip = new HtmlTooltip(); htmlTooltip.setPlacement(((Validation) component).getValidationErrorPlacement()); htmlTooltip.setParent(component); htmlTooltip.encodeAll(context); } } }  void renderTooltipIfNecessary(final FacesContext context, final UIComponent component); }
TooltipValidationRenderer { public void renderTooltipIfNecessary(final FacesContext context, final UIComponent component) throws IOException { if (shouldRenderTooltip(component)) { boolean tooltipRendered = false; for (UIComponent uiComponent : component.getChildren()) { if (uiComponent instanceof HtmlTooltip) { if (uiComponent.isRendered()) { tooltipRendered = true; break; } } } if (!tooltipRendered) { final HtmlTooltip htmlTooltip = new HtmlTooltip(); htmlTooltip.setPlacement(((Validation) component).getValidationErrorPlacement()); htmlTooltip.setParent(component); htmlTooltip.encodeAll(context); } } }  void renderTooltipIfNecessary(final FacesContext context, final UIComponent component);  }