Examples of UIXShowDetail


Examples of org.apache.myfaces.trinidad.component.UIXShowDetail

      if (! (child instanceof UIXShowDetail) )
      {
        continue;
        // Can't do any thing with non-showDetail children.
      }
      UIXShowDetail detailItem = (UIXShowDetail) child;

      String childClientId = child.getClientId(context);
      out.startElement("tr", component);
      out.startElement("td", component);

      boolean isRTL = BaseLafUtils.isRightToLeft(rCtx);
      if (isRTL)
      {
        out.writeAttribute("align", "right", null);
      }
      else
      {
        out.writeAttribute("align", "left", null);
      }
      out.writeAttribute("valign", "top", null);
      out.writeAttribute("nowrap", Boolean.TRUE, null);

      out.startElement("span", component);
      out.writeAttribute("id",
                         childClientId + _RADIO_SPAN_SUFFIEX_ID_CONST,
                         null);

      Boolean disabledObj =
        (Boolean) detailItem.getAttributes().get(
          UIConstants.DISABLED_ATTR.getAttributeName());
      boolean disabled = false; // by default is enabled.
      if (disabledObj != null)
      {
        disabled = disabledObj.booleanValue();
      }

      if (! disclosedChildId.equals(childClientId) && (! disabled) )
      {
        boolean isImmediate = detailItem.isImmediate();
        String submitJS = _getRadioSubmitJS(component,
                                            rCtx,
                                            formName,
                                            compId,
                                            childClientId,
                                            isImmediate);
        //PH:onclick javascript handler for a HTML SPAN element is not supported
        //on PIE, IE Mobile or Blackberry 4.0. Therefore, create onclick
        //javascript for non-PDAs only.
        if(!CoreRenderer.isPDA(RenderingContext.getCurrentInstance()))
          out.writeAttribute("onclick", submitJS, null);
      }

      // render the radio button now
      out.startElement("input", component);
      out.writeAttribute("id", childClientId, null);
      out.writeAttribute("value", childClientId, null);
      out.writeAttribute("name", compId, null);
       
      //PH: onclick javascript handler for an INPUT element is supported on a
      //PDA. Therefore, create javascript for onclick on an INPUT element
      //instead of a SPAN element.
      if(CoreRenderer.isPDA(RenderingContext.getCurrentInstance()))
      {
         boolean isImmediate = detailItem.isImmediate();
         String submitJS = _getRadioSubmitJS(component,
                                             rCtx,
                                             formName,
                                             compId,
                                             childClientId,
                                             isImmediate);
         out.writeAttribute("onclick", submitJS, null);
      }
     
      if (disabled)
      {
        out.writeAttribute("disabled", Boolean.TRUE, null);
      }

      out.writeAttribute("type", "radio", null);
      if (disclosedChildId.equals(childClientId) )
      {
        out.writeAttribute("checked", Boolean.TRUE, null);
      }
      out.endElement("input");

      out.startElement("label", component);
      out.writeAttribute("for", childClientId, null);

      Character accessChar =
        (Character) detailItem.getAttributes().get("accessKey");
      if (accessChar != null)
      {
        out.writeAttribute("accessKey", accessChar.toString(), null);
      }

      out.startElement("span", component);

      String radioSpanClass = getFieldTextClass();
      if (disabled)
      {
        radioSpanClass = SkinSelectors.AF_FIELD_TEXT_DISABLED_STYLE_CLASS;
      }
      XhtmlLafRenderer.renderStyleClassAttribute(rCtx,
                                                 radioSpanClass);

      writeLabel(out,
                 detailItem,
                 encoder,
                 (String) detailItem.getAttributes().get("text"));

      out.endElement("span");
      out.endElement("label");
      out.endElement("span");
      out.endElement("td");
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.UIXShowDetail

  {
    _LOG.finer("Entering CorePanelAccordionRenderer.encodeBegin()");
    List<UIComponent> children = component.getChildren();
    int numChildren = children.size();
    UIComponent disclosedChild = null;
    UIXShowDetail renderableChild = null;

    for (int indxChild = 0; indxChild < numChildren ; indxChild++ )
    {
      UIComponent child =  children.get(indxChild);
      if (! (child instanceof UIXShowDetail) )
      {
        continue;
      }

      UIXShowDetail detailChild =  (UIXShowDetail) children.get(indxChild);

      if (detailChild.isRendered())
      {
        // Mark the first renderable child
        Object disabled =
          detailChild.getAttributes().get(
            UIConstants.DISABLED_ATTR.getAttributeName());
        if (Boolean.TRUE.equals(disabled))
        {
          continue;
        }
        if (renderableChild == null)
        {
          renderableChild = detailChild;
        }
        if (detailChild.isDisclosed())
        {
          disclosedChild = detailChild;
          // A diclosed child found. return.
          break;
        }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.UIXShowDetail

      // This is a special case where we must determine if we have to fix the
      // disclosure state of one of the items.
      int disclosedCount = 0;
      while (iter.hasNext())
      {
        UIXShowDetail detailItem = _getNextShowDetailChild(iter);
        if (detailItem == null)
        {
          continue;
        }
        if (detailItem.isDisclosed())
        {
          disclosedCount++;
          if (disclosedCount > 1)
          {
            break; // we have enough information at this point to stop counting
          }
        }
      }
      if (disclosedCount <= 1)
      {
        disclosedFixed = true;
      }

      // Reset the iterator for the 2nd pass
      iter = component.getChildren().listIterator();
    }

    boolean childAlreadyRendered = false;
    while (iter.hasNext())
    {
      UIXShowDetail detailItem = _getNextShowDetailChild(iter);
      if (detailItem == null)
      {
        continue;
      }

      Boolean disabledObj =
        (Boolean) detailItem.getAttributes().get(
          UIConstants.DISABLED_ATTR.getAttributeName());
      boolean disabled = false; // by default is enabled.
      if (disabledObj != null)
      {
        disabled = disabledObj.booleanValue();
      }

      String titleText = (String) detailItem.getAttributes().get("text");
      boolean disclosed = detailItem.isDisclosed();

      if (childAlreadyRendered)
      {
        // The detail child should be disclosed only when all three criteria met
        // 1. is marked as disclosed
        // 2. is not disabled and
        // 3. if a child is not already disclosed. This occurs when more than
        //    one showDetail child has it's disclosed property set to true.
        disclosed = false;
      }

      // Header renderer section.
      out.startElement("div", component);
      String detailItemId = detailItem.getClientId(context);
      out.writeAttribute("id", compId + detailItemId, null);

      if (disabled)
      {
        XhtmlRenderer.renderStyleClass(context, arc,
          getHeaderDisabledStyleClass());
      }
      else if (disclosed)
      {
        XhtmlRenderer.renderStyleClass(context, arc,
          getHeaderExpanedStyleClass());
      }
      else
      {
        XhtmlRenderer.renderStyleClass(context, arc,
            getHeaderCollapsedStyleClass());
      }

      out.startElement("a", null);
      out.writeAttribute("name", detailItemId, null);

      if (disabled)
      {
        XhtmlRenderer.renderStyleClass(context, arc,
          getLinkDisabledStyleClass());
      }
      else
      {
        XhtmlRenderer.renderStyleClass(context, arc,
          getLinkEnabledStyleClass());
      }

      // If the child is disclosable and enabled...
      boolean disclosable =
        discloseNone || (! disclosed) || (discloseMany && !disclosedFixed);
      if ( disclosable && (! disabled) )
      {
        if (formName == null)
        {
          // =-=rbaranwa: Do we need to handle this case any other way?
          _LOG.warning("Page does not contain any form element." +
                       "Page will not behave properly.");
        }
        else
        {
          boolean isImmediate = detailItem.isImmediate();
          String event;
          if (disclosed)
          {
            event = "hide";
          }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.UIXShowDetail

    boolean oneIsDisclosed = false;
    for (int i=0; i<childCount; i++)
    {
      if (children.get(i) instanceof UIXShowDetail)
      {
        UIXShowDetail child =  (UIXShowDetail) children.get(i);
        if (child.isDisclosed())
        {
          oneIsDisclosed = true;
          break;
        }
      } else
      {
        _LOG.warning("Only tr:showDetailItem is allowed as child of tr:panelTabbed.");
      }
    }

    // OK, nothing's selected: pick the first non-disabled item
    if (!oneIsDisclosed)
    {
      for (int i=0; i<childCount; i++)
      {
        if (children.get(i) instanceof UIXShowDetail)
        {
          UIXShowDetail child =  (UIXShowDetail) children.get(i);
          if (!child.isRendered())
            continue;

          Object disabled = child.getAttributes().get("disabled");
          if (Boolean.TRUE.equals(disabled))
            continue;

          child.setDisclosed(true);
          break;
        }
      }
    }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.UIXShowDetail

    while (children.hasNext())
    {
      UIComponent child = children.next();
      if (child instanceof UIXShowDetail)
      {
        UIXShowDetail detailItem = (UIXShowDetail) child;

        Boolean disabledObj =
          (Boolean) detailItem.getAttributes().get("disabled");

        boolean disabled = false; // by default is enabled.
        if (disabledObj != null)
        {
          disabled = disabledObj.booleanValue();
        }

        if (disabled)
        {
          // MSDN DHTML Reference says disabled not supported for option element
          // hence don't render disabled options at all to be consistent
          // across browsers. See Bug 4561967.
          continue;
        }

        String childTitle = (String) detailItem.getAttributes().get("text");
        if (childTitle != null)
        {
          childTitle = encoder.encodeParameter(childTitle);
        }
        String childClientId = child.getClientId(context);
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.UIXShowDetail

  {
    _LOG.entering("ShowOneListRendererBase", "encodeBegin");
    List<UIComponent> children = component.getChildren();
    int numChildren = children.size();
    UIComponent disclosedChild = null;
    UIXShowDetail renderableChild = null;

    for (int indxChild = 0; indxChild < numChildren ; indxChild++ )
    {
      UIComponent child = children.get(indxChild);
      if (! (child instanceof UIXShowDetail) )
      {
        continue;
      }

      UIXShowDetail detailChild = (UIXShowDetail) children.get(indxChild);

      if (detailChild.isRendered())
      {
        // Mark the first renderable child
        Object disabled =
          detailChild.getAttributes().get(
            UIConstants.DISABLED_ATTR.getAttributeName());
        if (Boolean.TRUE.equals(disabled))
        {
          continue;
        }
        if (renderableChild == null)
        {
          renderableChild = detailChild;
        }
        if (detailChild.isDisclosed())
        {
          disclosedChild = detailChild;
        }
      }
    }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.UIXShowDetail

      }

      // only CoreShowDetailItem children are rendered. Rest are ignored.
      if ( (child instanceof UIXShowDetail))
      {
        UIXShowDetail detailChild = (UIXShowDetail) child;
        if (detailChild.isDisclosed())
        {
          returnId = detailChild.getClientId(context);
          break;
        }
      }
    }
    return returnId;
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.UIXShowDetail

    }

    List<UIComponent> children = component.getChildren();
    int numChildren = children.size();
    UIComponent disclosedChild = null;
    UIXShowDetail renderableChild = null;

    for (int indxChild = 0; indxChild < numChildren ; indxChild++ )
    {
      UIComponent child =  children.get(indxChild);
      if (! (child instanceof UIXShowDetail) )
      {
        continue;
      }

      UIXShowDetail detailChild =  (UIXShowDetail) children.get(indxChild);

      if (detailChild.isRendered())
      {
        // Mark the first renderable child
        if (_isItemDisabled(detailChild))
        {
          continue;
        }
        if (renderableChild == null)
        {
          renderableChild = detailChild;
        }
        if (detailChild.isDisclosed())
        {
          disclosedChild = detailChild;
          // A diclosed child found. return.
          break;
        }
      }
    }

    // If we have a minimum of 1 disclosed child and none have been disclosed
    // yet, disclose the first rendered one:
    if ( (disclosedChild == null) && !getDiscloseNone(bean) &&
      (renderableChild != null) && !renderableChild.isDisclosedTransient())
    {
      renderableChild.setDisclosed(true);
    }

    ResponseWriter out = context.getResponseWriter();
    String compId = component.getClientId(context);

    out.startElement("div", component);

    renderId(context, component);
    renderAllAttributes(context, arc, bean);

    boolean discloseMany = getDiscloseMany(bean);
    boolean discloseNone = getDiscloseNone(bean);
    boolean disclosedFixed = false;
    if (discloseMany && !discloseNone) // must keep at least one item disclosed
    {
      // This is a special case where we must determine if we have to fix the
      // disclosure state of one of the items.
      int disclosedCount = 0;
      for (UIComponent child : (List<UIComponent>) component.getChildren())
      {
        if (!(child instanceof UIXShowDetail) ||
            !child.isRendered())
          continue;

        UIXShowDetail detailItem = (UIXShowDetail) child;
        if (detailItem.isDisclosed())
        {
          disclosedCount++;
          if (disclosedCount > 1)
          {
            break; // we have enough information at this point to stop counting
          }
        }
      }
      if (disclosedCount <= 1)
      {
        disclosedFixed = true;
      }
    }

    boolean childAlreadyRendered = false;
    for (UIComponent child : (List<UIComponent>) component.getChildren())
    {
      if (!(child instanceof UIXShowDetail) ||
          !child.isRendered())
        continue;
     
      UIXShowDetail detailItem = (UIXShowDetail) child;
      boolean disabled = _isItemDisabled(detailItem);
      String titleText = (String)
        detailItem.getAttributes().get(CoreShowDetailItem.TEXT_KEY.getName());
      boolean disclosed = detailItem.isDisclosed();

      if (childAlreadyRendered)
      {
        // The detail child should be disclosed only when all three criteria met
        // 1. is marked as disclosed
        // 2. is not disabled and
        // 3. if a child is not already disclosed. This occurs when more than
        //    one showDetail child has it's disclosed property set to true.
        disclosed = false;
      }

      // Header renderer section.
      out.startElement("div", detailItem);

      String detailItemId = detailItem.getClientId(context);
      String itemStyleClass;
      if (disabled)
        itemStyleClass = getHeaderDisabledStyleClass();
      else if (disclosed)
        itemStyleClass = getHeaderExpandedStyleClass();
      else
        itemStyleClass = getHeaderCollapsedStyleClass();
       
      renderStyleClass(context, arc, itemStyleClass);

      // Render the toolbar component, if any (we use float to keep
      // the toolbar on the right - or left, in RTL languages - so
      // it has to be rendered first)
      UIComponent toolbar = getFacet(detailItem,
                                     CoreShowDetailItem.TOOLBAR_FACET);
      if (toolbar != null)
      {
        out.startElement("div", detailItem);
        renderStyleClass(context, arc, SkinSelectors.AF_PANELACCORDION_TOOLBAR_STYLE_CLASS);
        encodeChild(context, toolbar);
        out.endElement("div");
      }
     
      boolean javaScriptSupport = supportsScripting(arc);
     
      if (javaScriptSupport)
      {
        out.startElement("a", null);
        out.writeAttribute("name", detailItemId, null);
      }
      else
      {
        // For Non-JavaScript browsers, render an input element(type=submit) to
        // submit the page. Encode the name attribute with the parameter name
        // and value thus it would enable the browsers to include the name of
        // this element in its payLoad if it submits the page.
        out.startElement("input", null);
        out.writeAttribute("type", "submit", null);
      }

      renderStyleClass(context, arc,
                       disabled
                         ? getLinkDisabledStyleClass()
                         : getLinkEnabledStyleClass());

      // If the child is disclosable and enabled...
      boolean disclosable =
        discloseNone || (! disclosed) || (discloseMany && !disclosedFixed);
      if ( disclosable && (! disabled) )
      {
        boolean isImmediate = detailItem.isImmediate();
        String event = disclosed ? "hide" : "show";
       
        if (javaScriptSupport)
        {
          String onClickHandler = _getFormSubmitScript(component,
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.UIXShowDetail

      if (! (child instanceof UIXShowDetail) )
      {
        continue;
        // Can't do any thing with non-showDetail children.
      }
      UIXShowDetail detailItem = (UIXShowDetail) child;

      String childClientId = child.getClientId(context);
      out.startElement("tr", component);
      out.startElement("td", component);

      boolean isRTL = BaseLafUtils.isRightToLeft(rCtx);
      if (isRTL)
      {
        out.writeAttribute("align", "right", null);
      }
      else
      {
        out.writeAttribute("align", "left", null);
      }
      out.writeAttribute("valign", "top", null);
      out.writeAttribute("nowrap", Boolean.TRUE, null);

      out.startElement("span", component);
      out.writeAttribute("id",
                         childClientId + _RADIO_SPAN_SUFFIX_ID_CONST,
                         null);

      Boolean disabledObj =
        (Boolean) detailItem.getAttributes().get(
          UIConstants.DISABLED_ATTR.getAttributeName());
      boolean disabled = false; // by default is enabled.
      if (disabledObj != null)
      {
        disabled = disabledObj.booleanValue();
      }

      if (! disclosedChildId.equals(childClientId) && (! disabled) )
      {
        boolean isImmediate = detailItem.isImmediate();
        String submitJS = _getRadioSubmitJS(component,
                                            rCtx,
                                            formName,
                                            compId,
                                            childClientId,
                                            isImmediate);
        //PH:onclick javascript handler for a HTML SPAN element is not supported
        //on PIE, IE Mobile or Blackberry 4.0. Therefore, create onclick
        //javascript for non-PDAs only.
        if(!CoreRenderer.isPDA(RenderingContext.getCurrentInstance()))
          out.writeAttribute("onclick", submitJS, null);
      }

      // render the radio button now
      out.startElement("input", component);
      out.writeAttribute("id", childClientId, null);
      out.writeAttribute("value", childClientId, null);
      out.writeAttribute("name", compId, null);
       
      //PH: onclick javascript handler for an INPUT element is supported on a
      //PDA. Therefore, create javascript for onclick on an INPUT element
      //instead of a SPAN element.
      if(CoreRenderer.isPDA(RenderingContext.getCurrentInstance()))
      {
         boolean isImmediate = detailItem.isImmediate();
         String submitJS = _getRadioSubmitJS(component,
                                             rCtx,
                                             formName,
                                             compId,
                                             childClientId,
                                             isImmediate);
         out.writeAttribute("onclick", submitJS, null);
      }
     
      if (disabled)
      {
        out.writeAttribute("disabled", Boolean.TRUE, null);
      }

      out.writeAttribute("type", "radio", null);
      if (disclosedChildId.equals(childClientId) )
      {
        out.writeAttribute("checked", Boolean.TRUE, null);
      }
      out.endElement("input");

      out.startElement("label", component);
      out.writeAttribute("for", childClientId, null);

      Character accessChar =
        (Character) detailItem.getAttributes().get("accessKey");
      if (accessChar != null)
      {
        out.writeAttribute("accessKey", accessChar.toString(), null);
      }

      out.startElement("span", component);

      String radioSpanClass = getFieldTextClass();
      if (disabled)
      {
        radioSpanClass = SkinSelectors.AF_FIELD_TEXT_DISABLED_STYLE_CLASS;
      }
      XhtmlLafRenderer.renderStyleClassAttribute(rCtx,
                                                 radioSpanClass);

      writeLabel(out,
                 detailItem,
                 (String) detailItem.getAttributes().get("text"));

      out.endElement("span");
      out.endElement("label");
      out.endElement("span");
      out.endElement("td");
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.UIXShowDetail

        if (comp == event.getComponent())
          continue;

        if (comp instanceof UIXShowDetail)
        {
          UIXShowDetail showDetail = (UIXShowDetail) comp;
          // Queue an event to hide the currently expanded showDetail
          if (showDetail.isDisclosed())
            (new DisclosureEvent(showDetail, false)).queue();
        }
      }
    }
    super.queueEvent(event);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.