Пример #1
0
  protected void encodeInputField(FacesContext context, FileUpload fileUpload, String clientId)
      throws IOException {
    ResponseWriter writer = context.getResponseWriter();

    writer.startElement("input", null);
    writer.writeAttribute("type", "file", null);
    writer.writeAttribute("id", clientId, null);
    writer.writeAttribute("name", clientId, null);

    if (fileUpload.isMultiple()) writer.writeAttribute("multiple", "multiple", null);
    if (fileUpload.getStyle() != null)
      writer.writeAttribute("style", fileUpload.getStyle(), "style");
    if (fileUpload.getStyleClass() != null)
      writer.writeAttribute("class", fileUpload.getStyleClass(), "styleClass");
    if (fileUpload.isDisabled()) writer.writeAttribute("disabled", "disabled", "disabled");

    writer.endElement("input");
  }
Пример #2
0
  protected void encodeSimpleInputField(
      FacesContext context, FileUpload fileUpload, String clientId, String style, String styleClass)
      throws IOException {
    ResponseWriter writer = context.getResponseWriter();

    writer.startElement("input", null);
    writer.writeAttribute("type", "file", null);
    writer.writeAttribute("id", clientId, null);
    writer.writeAttribute("name", clientId, null);

    if (fileUpload.isMultiple()) writer.writeAttribute("multiple", "multiple", null);
    if (fileUpload.isDisabled()) writer.writeAttribute("disabled", "disabled", "disabled");
    if (fileUpload.getAccept() != null)
      writer.writeAttribute("accept", fileUpload.getAccept(), null);
    if (style != null) writer.writeAttribute("style", style, "style");
    if (styleClass != null) writer.writeAttribute("class", styleClass, "styleClass");

    renderDynamicPassThruAttributes(context, fileUpload);

    writer.endElement("input");
  }
Пример #3
0
  protected void encodeInputField(FacesContext context, FileUpload fileUpload, String clientId)
      throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String inputId = clientId + "_input";

    writer.startElement("input", null);
    writer.writeAttribute("type", "file", null);
    writer.writeAttribute("id", inputId, null);
    writer.writeAttribute("name", inputId, null);

    if (fileUpload.isMultiple()) writer.writeAttribute("multiple", "multiple", null);
    if (fileUpload.isDisabled()) writer.writeAttribute("disabled", "disabled", "disabled");
    if (fileUpload.getAccept() != null)
      writer.writeAttribute("accept", fileUpload.getAccept(), null);

    renderDynamicPassThruAttributes(context, fileUpload);

    writer.writeAttribute("aria-labelledby", clientId + "_label", null);

    writer.endElement("input");
  }