public void encodeBegin()

in myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/output/ProgressRenderer.java [33:68]


    public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException {
        if (log.isLoggable(Level.FINE))
            log.fine("encodeBegin");

        super.encodeBegin(facesContext, uiComponent);

        RendererUtils.checkParamValidity(facesContext, uiComponent, AbstractProgress.class);

        ResponseWriter writer = facesContext.getResponseWriter();

        AbstractProgress component = (AbstractProgress) uiComponent;

        writer.startElement("progress", uiComponent);

        // write id
        writer.writeAttribute(HTML5.ID_ATTR, component.getClientId(facesContext), null);

        final Double value = component.getValue();
        if(value!= null && value < 0){
            throw new FacesException("Value of progress component cannot be negative, but " + value);
        }

        final Double maximum = component.getMaximum();
        if(maximum!=null && maximum < 0){
            throw new FacesException("Maximum value of progress component cannot be negative, but " + maximum);
        }

        if(value!=null && maximum!=null){
            if(value > maximum){
                throw new FacesException("Value of progress component cannot be greater than the maximum value. But " + value + " > " + maximum);
            }
        }


        renderPassThruAttrsAndEvents(facesContext, uiComponent);
    }