예제 #1
0
  @Override
  protected void doEncodeChildren(
      ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {

    AbstractTab tab = (AbstractTab) component;

    if (tab.shouldProcess() && !tab.isDisabled()) {
      super.doEncodeChildren(writer, context, tab);
    }
  }
예제 #2
0
 private String positionAbbreviation(AbstractTab tab) {
   if (tab.getParentPanel().isHeaderPositionedTop()) {
     return "top";
   } else {
     return "btm";
   }
 }
예제 #3
0
  private void encodeTabHeader(
      FacesContext context,
      AbstractTab tab,
      ResponseWriter writer,
      AbstractTogglePanelTitledItem.HeaderStates state)
      throws IOException {

    String headerStateClass = "rf-tab-hdr-" + state.abbreviation();
    String headerPositionClass = "rf-tab-hdr-" + positionAbbreviation(tab);

    writer.startElement(TD_ELEM, tab);
    writer.writeAttribute(ID_ATTRIBUTE, tab.getClientId(context) + ":header", null);
    renderPassThroughAttributes(context, tab, HEADER_ATTRIBUTES);
    writer.writeAttribute(
        CLASS_ATTRIBUTE,
        concatClasses(
            "rf-tab-hdr",
            headerStateClass,
            headerPositionClass,
            attributeAsString(tab, "headerClass"),
            attributeAsString(tab, state.headerClass())),
        null);
    writer.writeAttribute(STYLE_ATTRIBUTE, attributeAsString(tab, "headerStyle"), null);
    writer.writeAttribute("data-tabname", tab.getName(), null);

    writer.startElement(SPAN_ELEM, tab);
    writer.writeAttribute(CLASS_ATTRIBUTE, "rf-tab-lbl", null);

    UIComponent headerFacet = tab.getHeaderFacet(state);
    if (headerFacet != null && headerFacet.isRendered()) {
      headerFacet.encodeAll(context);
    } else {
      Object headerText = tab.getAttributes().get("header");
      if (headerText != null && !headerText.equals("")) {
        writer.writeText(headerText, null);
      }
    }

    writer.endElement(SPAN_ELEM);

    writer.endElement(TD_ELEM);
  }
예제 #4
0
  @Override
  protected void doDecode(FacesContext context, UIComponent component) {

    Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap();

    AbstractTab tab = (AbstractTab) component;
    String compClientId = component.getClientId(context);
    if (requestMap.get(compClientId) != null) {
      AbstractTabPanel parentTabPanel = getParentTabPanel(tab);

      if (parentTabPanel.isImmediate()) {
        tab.setImmediate(true);
      }
      new ActionEvent(tab).queue();

      if (context.getPartialViewContext().isPartialRequest()) {
        context.getPartialViewContext().getRenderIds().add(component.getClientId(context));
        addOnCompleteParam(context, tab.getName(), tab.getTabPanel().getClientId(context));
      }
    }
  }
예제 #5
0
 private void writeTopTabHeader(FacesContext context, ResponseWriter writer, AbstractTab tab)
     throws IOException {
   AbstractTogglePanelTitledItem.HeaderStates state =
       tab.isDisabled() ? disabled : tab.isActive() ? active : inactive;
   encodeTabHeader(context, tab, writer, state);
 }