Exemplo n.º 1
0
  private NGSecurityFilter findAndVerifySecurityFilter(FacesContext context, UIComponent component)
      throws IOException {
    String checkedBy = (String) component.getAttributes().get("checkedBy");
    NGSecurityFilter filter = new NGDefaultSecurityFilter();

    if (null != checkedBy) {
      try {
        Class<?> clazz = Class.forName(checkedBy);
        filter = (NGSecurityFilter) clazz.newInstance();
      } catch (ClassNotFoundException e) {
        context
            .getResponseWriter()
            .append(
                "<div style=\"color:#F00\">Configuration error: security class filter not found</div>");
      } catch (InstantiationException e) {
        context
            .getResponseWriter()
            .append(
                "<div style=\"color:#F00\">Configuration error: security class filter could not be instantiated</div>");
      } catch (IllegalAccessException e) {
        context
            .getResponseWriter()
            .append(
                "<div style=\"color:#F00\">Configuration error: security class filter has been forbidden to be instantiated</div>");
      }
      NGSecureUtilities.setCheckedBy(filter);
    }
    return filter;
  }
Exemplo n.º 2
0
  public void encodeMetaComponent(
      FacesContext context, UIComponent component, String metaComponentId) throws IOException {
    AbstractDataGrid table = (AbstractDataGrid) component;

    if (UIDataTableBase.HEADER.equals(metaComponentId)) {
      encodeHeader(context.getResponseWriter(), context, table, true);
    } else if (UIDataTableBase.FOOTER.equals(metaComponentId)) {
      encodeFooter(context.getResponseWriter(), context, table, true);
    } else if (UIDataTableBase.BODY.equals(metaComponentId)) {
      encodeTBody(context.getResponseWriter(), context, table, true);
    } else {
      throw new IllegalArgumentException("Unsupported metaComponentIdentifier: " + metaComponentId);
    }
  }
Exemplo n.º 3
0
  public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
    if (!component.isRendered()) return;

    if (!isDisabled(context, component)) {
      // use default link rendering, after closing open span tag
      ResponseWriter writer = context.getResponseWriter();
      writer.write(""); // normaly just close the span
      super.encodeBegin(context, component);
    } else {
      // setup to render the disabled link ourselves - close open span tag after adding inactive
      // attributes
      ResponseWriter writer = context.getResponseWriter();
      writer.write(""); // normally, add aria and class attributes and close the span
    }
  }
Exemplo n.º 4
0
  public void encodeEnd(FacesContext context, UIComponent component) throws IOException {

    if ((context == null) || (component == null)) {
      throw new NullPointerException(
          Util.getExceptionMessageString(Util.NULL_PARAMETERS_ERROR_MESSAGE_ID));
    }
    if (!component.isRendered()) {
      if (log.isTraceEnabled()) {
        log.trace(
            "No encoding necessary "
                + component.getId()
                + " since "
                + "rendered attribute is set to false ");
      }
      return;
    }
    UIData data = (UIData) component;
    data.setRowIndex(-1);
    ResponseWriter writer = context.getResponseWriter();

    // Render the ending of this table
    writer.endElement("table");
    writer.writeText("\n", null);
    if (log.isTraceEnabled()) {
      log.trace("End encoding component " + component.getId());
    }
  }
Exemplo n.º 5
0
  @Override
  protected void encodeMarkup(FacesContext context, AbstractMenu abstractMenu) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    Menu menu = (Menu) abstractMenu;
    String clientId = menu.getClientId(context);
    String style = menu.getStyle();
    String styleClass = menu.getStyleClass();
    styleClass =
        (styleClass == null)
            ? Menu.MOBILE_CONTAINER_CLASS
            : Menu.MOBILE_CONTAINER_CLASS + " " + styleClass;

    writer.startElement("ul", null);
    writer.writeAttribute("id", clientId, "id");
    writer.writeAttribute("class", styleClass, "styleClass");
    if (style != null) {
      writer.writeAttribute("style", style, "style");
    }

    renderDynamicPassThruAttributes(context, menu);

    if (menu.getElementsCount() > 0) {
      encodeElements(context, menu, menu.getElements());
    }

    writer.endElement("ul");
  }
Exemplo n.º 6
0
  protected void encodeRowExpansion(FacesContext context, DataTable table) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    Map<String, String> params = context.getExternalContext().getRequestParameterMap();
    int expandedRowIndex =
        Integer.parseInt(params.get(table.getClientId(context) + "_expandedRowIndex"));
    String rowIndexVar = table.getRowIndexVar();

    table.setRowIndex(expandedRowIndex);

    if (rowIndexVar != null) {
      context.getExternalContext().getRequestMap().put(rowIndexVar, expandedRowIndex);
    }

    writer.startElement("tr", null);
    writer.writeAttribute("style", "display:none", null);
    writer.writeAttribute(
        "class", DataTable.EXPANDED_ROW_CONTENT_CLASS + " ui-widget-content", null);

    writer.startElement("td", null);
    writer.writeAttribute("colspan", table.getColumnsCount(), null);

    table.getRowExpansion().encodeAll(context);

    writer.endElement("td");

    writer.endElement("tr");

    table.setRowIndex(-1);
  }
Exemplo n.º 7
0
  protected void encodeFrozenRows(FacesContext context, DataTable table) throws IOException {
    Collection<?> frozenRows = table.getFrozenRows();
    if (frozenRows == null || frozenRows.isEmpty()) {
      return;
    }

    ResponseWriter writer = context.getResponseWriter();
    String clientId = table.getClientId(context);
    String var = table.getVar();
    String rowIndexVar = table.getRowIndexVar();
    Map<String, Object> requestMap = context.getExternalContext().getRequestMap();

    writer.startElement("tbody", null);
    writer.writeAttribute("class", DataTable.DATA_CLASS, null);

    int index = 0;
    for (Iterator<? extends Object> it = frozenRows.iterator(); it.hasNext(); ) {
      requestMap.put(var, it.next());

      if (rowIndexVar != null) {
        requestMap.put(rowIndexVar, index);
      }

      encodeRow(context, table, clientId, index, rowIndexVar);
    }

    writer.endElement("tbody");
  }
Exemplo n.º 8
0
  protected void encodeScrollAreaEnd(FacesContext context) throws IOException {
    ResponseWriter writer = context.getResponseWriter();

    writer.endElement("table");
    writer.endElement("div");
    writer.endElement("div");
  }
Exemplo n.º 9
0
  protected void encodeMarkup(FacesContext context, Editor editor) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String clientId = editor.getClientId(context);
    String valueToRender = ComponentUtils.getValueToRender(context, editor);
    String inputId = clientId + "_input";

    String style = editor.getStyle();
    style = style == null ? "visibility:hidden" : "visibility:hidden;" + style;

    writer.startElement("div", editor);
    writer.writeAttribute("id", clientId, null);
    writer.writeAttribute("style", style, null);
    if (editor.getStyleClass() != null) {
      writer.writeAttribute("class", editor.getStyleClass(), null);
    }

    writer.startElement("textarea", null);
    writer.writeAttribute("id", inputId, null);
    writer.writeAttribute("name", inputId, null);

    if (valueToRender != null) {
      writer.write(valueToRender);
    }

    writer.endElement("textarea");

    writer.endElement("div");
  }
  protected void encodeFilter(FacesContext context, SelectOneListbox listbox) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String id = listbox.getClientId(context) + "_filter";
    boolean disabled = listbox.isDisabled();
    String filterClass =
        disabled
            ? SelectOneListbox.FILTER_CLASS + " ui-state-disabled"
            : SelectOneListbox.FILTER_CLASS;

    writer.startElement("div", null);
    writer.writeAttribute("class", SelectOneListbox.FILTER_CONTAINER_CLASS, null);

    writer.startElement("span", null);
    writer.writeAttribute("class", SelectOneListbox.FILTER_ICON_CLASS, id);
    writer.endElement("span");

    writer.startElement("input", null);
    writer.writeAttribute("class", filterClass, null);
    writer.writeAttribute("id", id, null);
    writer.writeAttribute("name", id, null);
    writer.writeAttribute("type", "text", null);
    writer.writeAttribute("autocomplete", "off", null);
    if (disabled) writer.writeAttribute("disabled", "disabled", null);

    writer.endElement("input");

    writer.endElement("div");
  }
Exemplo n.º 11
0
  @Override
  public void encodeEnd(FacesContext context) throws IOException {
    // call create here so that we'll have a valid chart
    createITextObject(context);

    if (imageData != null) {
      ResponseWriter response = context.getResponseWriter();
      response.startElement("img", null);
      GraphicImageStore store = GraphicImageStore.instance();
      String key = store.put(new ImageWrapper(imageData, Type.IMAGE_JPEG));
      String url =
          context.getExternalContext().getRequestContextPath()
              + GraphicImageResource.GRAPHIC_IMAGE_RESOURCE_PATH
              + "/"
              + key
              + Type.IMAGE_JPEG.getExtension();

      response.writeAttribute("src", url, null);

      response.writeAttribute("height", getHeight(), null);
      response.writeAttribute("width", getWidth(), null);

      response.endElement("img");
    }

    super.encodeEnd(context);
  }
  @Override
  public void encodeBegin(final FacesContext context, final UIComponent component)
      throws IOException {
    if (!component.isRendered()) {
      return;
    }

    final ResponseWriter writer = context.getResponseWriter();
    final HtmlWaitingPanel waitingPanel = (HtmlWaitingPanel) component;

    final String style = waitingPanel.getStyle();
    final String styleClass = waitingPanel.getStyleClass();

    writer.startElement(ELEMENT_DIV, component);

    this.writeIdAttribute(context, writer, component);

    if (StringUtils.isNotEmpty(style)) {
      writer.writeAttribute("style", style, null);
    }

    if (StringUtils.isNotEmpty(styleClass)) {
      writer.writeAttribute("class", "butter-component-waitingPanel " + styleClass, null);
    } else {
      writer.writeAttribute("class", "butter-component-waitingPanel", null);
    }
  }
  @Override
  public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    if (!component.isRendered()) {
      return;
    }

    // Get the response renderer
    ResponseWriter writer = context.getResponseWriter();

    // Do not render if it is not needed
    if (AjaxUtil.isAjaxNullResponseWriter(writer)) {
      return;
    }

    // Get the UIInput
    if (!(component instanceof UIInput)) {
      return;
    }
    UIInput uiInput = (UIInput) component;

    // And write the value
    String currentValue = computeValueAsISOString(context, uiInput);
    writeTag(context, uiInput, writer, currentValue);

    // TODO should change this to use InputRendererUtil.encodeValidation,
    // once it has been updated to support delegating to the renderer.
    //        InputRendererUtil.encodeValidation(context, writer, uiInput);
    encodeValidation(context, writer, uiInput);

    InputRendererUtil.encodeDirtyState(context, writer, uiInput);
  }
Exemplo n.º 14
0
  protected void encodeToolbarGroups(FacesContext context, Toolbar toolbar) throws IOException {
    ResponseWriter writer = context.getResponseWriter();

    for (UIComponent child : toolbar.getChildren()) {
      if (child.isRendered() && child instanceof ToolbarGroup) {
        ToolbarGroup group = (ToolbarGroup) child;

        String defaultGroupClass = "ui-toolbar-group-" + group.getAlign();
        String groupClass = group.getStyleClass();
        String groupStyle = group.getStyle();
        groupClass = groupClass == null ? defaultGroupClass : defaultGroupClass + " " + groupClass;

        writer.startElement("div", null);
        writer.writeAttribute("class", groupClass, null);
        if (groupStyle != null) {
          writer.writeAttribute("style", groupStyle, null);
        }

        for (UIComponent groupChild : group.getChildren()) {
          if (groupChild instanceof UISeparator && groupChild.isRendered())
            encodeSeparator(context, (UISeparator) groupChild);
          else groupChild.encodeAll(context);
        }

        writer.endElement("div");
      }
    }
  }
Exemplo n.º 15
0
  @Override
  public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    Toolbar toolbar = (Toolbar) component;
    ResponseWriter writer = context.getResponseWriter();
    String style = toolbar.getStyle();
    String styleClass = toolbar.getStyleClass();
    styleClass =
        styleClass == null ? Toolbar.CONTAINER_CLASS : Toolbar.CONTAINER_CLASS + " " + styleClass;

    writer.startElement("div", toolbar);
    writer.writeAttribute("id", toolbar.getClientId(context), null);
    writer.writeAttribute("class", styleClass, null);
    if (style != null) {
      writer.writeAttribute("style", style, null);
    }

    if (toolbar.getChildCount() > 0) {
      encodeToolbarGroups(context, toolbar);
    } else {
      encodeFacet(context, toolbar, "left");
      encodeFacet(context, toolbar, "right");
    }

    writer.endElement("div");
  }
  protected void encodeInput(
      FacesContext context, SelectManyMenu menu, String clientId, List<SelectItem> selectItems)
      throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String inputid = clientId + "_input";

    writer.startElement("div", null);
    writer.writeAttribute("class", "ui-helper-hidden-accessible", null);

    writer.startElement("select", null);
    writer.writeAttribute("id", inputid, "id");
    writer.writeAttribute("name", inputid, null);
    writer.writeAttribute("multiple", "multiple", null);
    writer.writeAttribute(
        "size", "2", null); // prevent browser to send value when no item is selected

    renderDomEvents(context, menu, SelectManyMenu.DOM_EVENTS);

    if (menu.getTabindex() != null) {
      writer.writeAttribute("tabindex", menu.getTabindex(), null);
    }

    if (RequestContext.getCurrentInstance()
        .getApplicationContext()
        .getConfig()
        .isClientSideValidationEnabled()) {
      renderValidationMetadata(context, menu);
    }

    encodeSelectItems(context, menu, selectItems);

    writer.endElement("select");

    writer.endElement("div");
  }
  protected void encodeList(
      FacesContext context, SelectOneListbox listbox, List<SelectItem> selectItems)
      throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    Converter converter = listbox.getConverter();
    Object values = getValues(listbox);
    Object submittedValues = getSubmittedValues(listbox);
    boolean customContent = listbox.getVar() != null;

    writer.startElement("div", listbox);
    writer.writeAttribute("class", SelectOneListbox.LIST_CONTAINER_CLASS, null);
    writer.writeAttribute(
        "style", "height:" + calculateWrapperHeight(listbox, selectItems.size()), null);

    if (customContent) {
      writer.startElement("table", null);
      writer.writeAttribute("class", SelectOneListbox.LIST_CLASS, null);
      writer.startElement("tbody", null);
      for (SelectItem selectItem : selectItems) {
        encodeItem(context, listbox, selectItem, values, submittedValues, converter, customContent);
      }
      writer.endElement("tbody");
      writer.endElement("table");
    } else {
      writer.startElement("ul", null);
      writer.writeAttribute("class", SelectOneListbox.LIST_CLASS, null);
      for (SelectItem selectItem : selectItems) {
        encodeItem(context, listbox, selectItem, values, submittedValues, converter, customContent);
      }
      writer.endElement("ul");
    }

    writer.endElement("div");
  }
Exemplo n.º 18
0
  protected void encodeScript(FacesContext context, Password password) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String clientId = password.getClientId(context);
    boolean feedback = password.isFeedback();

    startScript(writer, clientId);

    writer.write("$(function(){");

    writer.write("PrimeFaces.cw('Password','" + password.resolveWidgetVar() + "',{");
    writer.write("id:'" + clientId + "'");

    if (feedback) {
      writer.write(",feedback:true");
      writer.write(",inline:" + password.isInline());

      if (password.getPromptLabel() != null)
        writer.write(",promptLabel:'" + password.getPromptLabel() + "'");
      if (password.getWeakLabel() != null)
        writer.write(",weakLabel:'" + password.getWeakLabel() + "'");
      if (password.getGoodLabel() != null)
        writer.write(",goodLabel:'" + password.getGoodLabel() + "'");
      if (password.getStrongLabel() != null)
        writer.write(",strongLabel:'" + password.getStrongLabel() + "'");
    }

    encodeClientBehaviors(context, password);

    writer.write("});});");

    endScript(writer);
  }
  protected void encodeMarkup(FacesContext context, SelectOneListbox listbox) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String clientId = listbox.getClientId(context);
    List<SelectItem> selectItems = getSelectItems(context, listbox);

    String style = listbox.getStyle();
    String styleClass = listbox.getStyleClass();
    styleClass =
        styleClass == null
            ? SelectOneListbox.CONTAINER_CLASS
            : SelectOneListbox.CONTAINER_CLASS + " " + styleClass;
    styleClass = listbox.isDisabled() ? styleClass + " ui-state-disabled" : styleClass;
    styleClass = !listbox.isValid() ? styleClass + " ui-state-error" : styleClass;

    writer.startElement("div", listbox);
    writer.writeAttribute("id", clientId, "id");
    writer.writeAttribute("class", styleClass, "styleClass");
    if (style != null) {
      writer.writeAttribute("style", style, "style");
    }

    if (listbox.isFilter()) {
      encodeFilter(context, listbox);
    }

    encodeInput(context, listbox, clientId, selectItems);
    encodeList(context, listbox, selectItems);

    writer.endElement("div");
  }
Exemplo n.º 20
0
  protected void encodeMarkup(FacesContext context, Password password) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String clientId = password.getClientId(context);
    boolean disabled = password.isDisabled();

    String inputClass = Password.STYLE_CLASS;
    inputClass = password.isValid() ? inputClass : inputClass + " ui-state-error";
    inputClass = !disabled ? inputClass : inputClass + " ui-state-disabled";
    String styleClass =
        password.getStyleClass() == null ? inputClass : inputClass + " " + password.getStyleClass();

    writer.startElement("input", password);
    writer.writeAttribute("id", clientId, "id");
    writer.writeAttribute("name", clientId, null);
    writer.writeAttribute("type", "password", null);
    writer.writeAttribute("class", styleClass, null);
    if (password.getStyle() != null) {
      writer.writeAttribute("style", password.getStyle(), null);
    }

    String valueToRender = ComponentUtils.getValueToRender(context, password);
    if (!isValueEmpty(valueToRender) && password.isRedisplay()) {
      writer.writeAttribute("value", valueToRender, null);
    }

    renderPassThruAttributes(context, password, HTML.INPUT_TEXT_ATTRS);

    if (disabled) writer.writeAttribute("disabled", "disabled", null);
    if (password.isReadonly()) writer.writeAttribute("readonly", "readonly", null);

    writer.endElement("input");
  }
  private void writeSimulatorResources(
      FacesContext facesContext, DeviceResource component, Theme theme) throws IOException {
    ResponseWriter writer = facesContext.getResponseWriter();

    Resource simulatorCss =
        facesContext
            .getApplication()
            .getResourceHandler()
            .createResource(CSS_SIMULATOR, CSS_LOCATION, "text/css");
    writer.startElement(HTML.LINK_ELEM, component);
    writer.writeAttribute(HTML.TYPE_ATTR, HTML.LINK_TYPE_TEXT_CSS, HTML.TYPE_ATTR);
    writer.writeAttribute(HTML.REL_ATTR, HTML.STYLE_REL_STYLESHEET, HTML.REL_ATTR);
    writer.writeURIAttribute(HTML.HREF_ATTR, simulatorCss.getRequestPath(), HTML.HREF_ATTR);
    writer.endElement(HTML.LINK_ELEM);

    Resource simulatorScript =
        facesContext
            .getApplication()
            .getResourceHandler()
            .createResource(SCRIPT_SIMULATOR, UTIL_RESOURCE);
    String src = simulatorScript.getRequestPath();
    writer.startElement("script", component);
    writer.writeAttribute("type", "text/javascript", null);
    writer.writeAttribute("src", src, null);
    writer.endElement("script");

    writer.startElement("script", null);
    writer.writeAttribute("type", "text/javascript", null);
    writer.writeText("console.log('Welcome to the Matrix');", null);
    writer.endElement("script");
  }
Exemplo n.º 22
0
  @Override
  public void encodeEnd(final FacesContext context, final UIComponent component)
      throws IOException {
    final ResponseWriter writer = context.getResponseWriter();
    final ImageAreaSelect imageAreaSelect = (ImageAreaSelect) component;
    final String clientId = imageAreaSelect.getClientId(context);
    final String widgetVar = imageAreaSelect.resolveWidgetVar();
    final String target =
        SearchExpressionFacade.resolveComponentForClient(
            context, imageAreaSelect, imageAreaSelect.getFor());

    startScript(writer, clientId);

    writer.write("$(function() {");
    writer.write(
        "PrimeFacesExt.cw('" + ImageAreaSelect.class.getSimpleName() + "', '" + widgetVar + "', {");

    WidgetRenderer.renderOptions(clientId, writer, imageAreaSelect);

    writer.write(",target:'" + target + "'");

    encodeClientBehaviors(context, imageAreaSelect);

    writer.write("}, true);});");
    endScript(writer);
  }
Exemplo n.º 23
0
  protected void encodeColumnFooter(FacesContext context, DataTable table, UIColumn column)
      throws IOException {
    if (!column.isRendered()) {
      return;
    }

    ResponseWriter writer = context.getResponseWriter();

    String style = column.getStyle();
    String styleClass = column.getStyleClass();
    styleClass =
        styleClass == null
            ? DataTable.COLUMN_FOOTER_CLASS
            : DataTable.COLUMN_FOOTER_CLASS + " " + styleClass;

    writer.startElement("td", null);
    writer.writeAttribute("class", styleClass, null);

    if (style != null) writer.writeAttribute("style", style, null);
    if (column.getRowspan() != 1) writer.writeAttribute("rowspan", column.getRowspan(), null);
    if (column.getColspan() != 1) writer.writeAttribute("colspan", column.getColspan(), null);

    // Footer content
    UIComponent facet = column.getFacet("footer");
    String text = column.getFooterText();
    if (facet != null) {
      facet.encodeAll(context);
    } else if (text != null) {
      writer.write(text);
    }

    writer.endElement("td");
  }
Exemplo n.º 24
0
  protected void encodeProgressStateProlog(
      FacesContext context, UIComponent component, ProgressBarState currentState)
      throws IOException {

    ResponseWriter responseWriter = context.getResponseWriter();
    responseWriter.startElement(HtmlConstants.DIV_ELEM, component);
    responseWriter.writeAttribute(
        HtmlConstants.ID_ATTRIBUTE, component.getClientId(context) + ".rmng", null);
    responseWriter.writeAttribute(
        HtmlConstants.CLASS_ATTRIBUTE,
        HtmlUtil.concatClasses("rf-pb-rmng", component.getAttributes().get("remainingClass")),
        null);

    responseWriter.writeAttribute(
        HtmlConstants.STYLE_ATTRIBUTE,
        getContentStyle(currentState == ProgressBarState.progressState),
        null);

    responseWriter.startElement(HtmlConstants.DIV_ELEM, component);
    responseWriter.writeAttribute(
        HtmlConstants.CLASS_ATTRIBUTE,
        HtmlUtil.concatClasses("rf-pb-prgs", component.getAttributes().get("progressClass")),
        null);
    responseWriter.writeAttribute(
        HtmlConstants.ID_ATTRIBUTE, component.getClientId(context) + ".prgs", null);
    responseWriter.writeAttribute(
        HtmlConstants.STYLE_ATTRIBUTE, "width: " + getWidth(component) + "%", null);
    responseWriter.endElement(HtmlConstants.DIV_ELEM);
  }
Exemplo n.º 25
0
  protected void encodeCell(
      FacesContext context, DataTable table, UIColumn column, String clientId, boolean selected)
      throws IOException {
    if (!column.isRendered()) {
      return;
    }

    ResponseWriter writer = context.getResponseWriter();
    boolean selectionEnabled = column.getSelectionMode() != null;
    String style = column.getStyle();
    String styleClass =
        selectionEnabled
            ? DataTable.SELECTION_COLUMN_CLASS
            : (column.getCellEditor() != null) ? DataTable.EDITABLE_COLUMN_CLASS : null;
    String userStyleClass = column.getStyleClass();
    styleClass =
        userStyleClass == null
            ? styleClass
            : (styleClass == null) ? userStyleClass : styleClass + " " + userStyleClass;

    writer.startElement("td", null);
    writer.writeAttribute("role", "gridcell", null);
    if (style != null) writer.writeAttribute("style", style, null);
    if (styleClass != null) writer.writeAttribute("class", styleClass, null);

    if (selectionEnabled) encodeColumnSelection(context, table, clientId, column, selected);
    else column.encodeAll(context);

    writer.endElement("td");
  }
Exemplo n.º 26
0
  protected void encodeProgressStateEpilog(
      FacesContext context, UIComponent component, ProgressBarState currentState)
      throws IOException {

    ResponseWriter responseWriter = context.getResponseWriter();
    responseWriter.endElement(HtmlConstants.DIV_ELEM);
  }
Exemplo n.º 27
0
  protected void encodeRadio(
      FacesContext context, DataTable table, boolean checked, boolean disabled) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String boxClass = HTML.RADIOBUTTON_BOX_CLASS;
    String iconClass = HTML.RADIOBUTTON_ICON_CLASS;
    boxClass = disabled ? boxClass + " ui-state-disabled" : boxClass;
    boxClass = checked ? boxClass + " ui-state-active" : boxClass;
    iconClass = checked ? iconClass + " " + HTML.RADIOBUTTON_CHECKED_ICON_CLASS : iconClass;

    writer.startElement("div", null);
    writer.writeAttribute("class", HTML.RADIOBUTTON_CLASS, null);

    writer.startElement("div", null);
    writer.writeAttribute("class", "ui-helper-hidden-accessible", null);
    writer.startElement("input", null);
    writer.writeAttribute("type", "radio", null);
    writer.writeAttribute("name", table.getClientId(context) + "_radio", null);
    writer.endElement("input");
    writer.endElement("div");

    writer.startElement("div", null);
    writer.writeAttribute("class", boxClass, null);

    writer.startElement("span", null);
    writer.writeAttribute("class", iconClass, null);
    writer.endElement("span");

    writer.endElement("div");
    writer.endElement("div");
  }
Exemplo n.º 28
0
  private void encodeStateFacet(
      FacesContext context,
      UIComponent component,
      ProgressBarState state,
      ProgressBarState currentState)
      throws IOException {

    if (!state.hasContent(context, component)) {
      return;
    }

    String clientId = state.getStateClientId(context, component);

    ResponseWriter responseWriter = context.getResponseWriter();

    responseWriter.startElement(HtmlConstants.DIV_ELEM, component);
    responseWriter.writeAttribute(
        HtmlConstants.CLASS_ATTRIBUTE, state.getStyleClass(context, component), null);
    responseWriter.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId, null);

    responseWriter.writeAttribute(
        HtmlConstants.STYLE_ATTRIBUTE, getContentStyle(state == currentState), null);

    if (!renderContentAsPlaceHolders || state == currentState) {
      state.encodeContent(context, component);
    }

    responseWriter.endElement(HtmlConstants.DIV_ELEM);
  }
Exemplo n.º 29
0
  protected void encodeSubmenu(FacesContext context, Menu menu, Submenu submenu)
      throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String label = submenu.getLabel();
    String style = submenu.getStyle();
    String styleClass = submenu.getStyleClass();
    styleClass =
        (styleClass == null)
            ? Menu.MOBILE_DIVIDER_CLASS
            : Menu.MOBILE_DIVIDER_CLASS + " " + styleClass;

    writer.startElement("li", null);
    writer.writeAttribute("class", styleClass, "styleClass");
    if (style != null) {
      writer.writeAttribute("style", style, "style");
    }

    if (label != null) {
      writer.writeText(label, "value");
    }

    writer.endElement("li");

    encodeElements(context, menu, submenu.getElements());
  }
  public void encodeBegin(FacesContext context, UIComponent component) throws IOException {

    if (!component.isRendered()) {
      return;
    }

    ResponseWriter writer = context.getResponseWriter();
    String jsfId = (String) RendererUtil.getAttribute(context, component, "id");
    String id = jsfId;

    if (component.getId() != null && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) {
      id = component.getClientId(context);
    }

    String title = (String) RendererUtil.getAttribute(context, component, "title");
    Object tmpFoldStr = RendererUtil.getAttribute(context, component, "hideByDefault");
    String key = (String) RendererUtil.getAttribute(context, component, "key");

    writer.write("<fieldset>");
    writer.write("<legend>");
    writer.write(
        "<a role='button' data-toggle='collapse' aria-expanded='true' aria-target='"
            + id
            + "' href='#"
            + id
            + "' data-target=\"[id='"
            + id
            + "']\">"
            + title
            + "</a>");
    writer.write("</legend>");

    writer.write("<div class='collapse in' " + " id=\"" + id + "\">");
  }