Examples of UIXHierarchy


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

  {
    Object newPath = context.getLocalProperty(0, _NEW_PATH_KEY, null);

    if (newPath != null)
    {
      UIXHierarchy component = getHierarchyBase(context, node);
      Object oldPath = component.getRowKey();
      component.setRowKey(newPath);
      UINode stamp = getStamp(context, node);
      int size = component.getRowCount();

      for (int i = 0; i < size; i++)
      {
        component.setRowIndex(i);
        renderChild(context, stamp);
      }

      component.setRowKey(oldPath);
    }

    super.renderContent(context, node);
  }
View Full Code Here

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

  protected void prerender(
    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {
    UIXHierarchy component = getHierarchyBase(context, node);
    UINode stamp = getStamp(context, node);

    if(stamp != null)
    {
      Object oldPath = component.getRowKey();
      boolean isNewPath = setNewPath(context, node, component);
      if (isNewPath)
      {
        // The postrender will only close out the DOM is newPath is non-null so we should only
        // prerender if newPath is also non-null.
        Object newPath = component.getRowKey();
        if (newPath != null)
        {
          context.setLocalProperty(_NEW_PATH_KEY, newPath);
          component.setRowKey(oldPath);

          // add core.js
          XhtmlLafUtils.addLib(context, "_commandChoice()");
          renderPreChoice(context, node);
          CommandNavigationItemRenderer.setNavigationItemRendererType(context,
View Full Code Here

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

    UINode           node
    ) throws IOException
  {

    Object newPath = context.getLocalProperty(0, _NEW_PATH_KEY, null);
    UIXHierarchy component = getHierarchyBase(context, node);
    Object oldPath = component.getRowKey()// Save the current key
    component.setRowKey(null);
    String nameString =
              BaseLafUtils.getStringAttributeValue(context, node, NAME_ATTR);
    String idString =
              BaseLafUtils.getStringAttributeValue(context, node, ID_ATTR);

    component.setRowKey(newPath);
    URLEncoder encoder = context.getURLEncoder();

    String eventKey  = encoder.encodeParameter(EVENT_PARAM);
    String sourceKey = encoder.encodeParameter(SOURCE_PARAM);
    String valueKey  = encoder.encodeParameter(VALUE_PARAM);
    String sizeKey   = encoder.encodeParameter(SIZE_PARAM);
    String partialTargetsKey = encoder.encodeParameter(PARTIAL_TARGETS_PARAM);

    // Get any partial targets - encoded in String form
    String partialTargets = _getPartialTargets(context, node);

    int totalItems = component.getRowCount();

    int selectedIndex = component.getRowIndex();

    if (totalItems <= 0)
    {
      component.setRowKey(oldPath);
      return;
    }

    int currentIndex = component.getRowIndex();
    UIComponent stamp = component.getFacet(UIXProcess.NODE_STAMP_FACET);
    int backButtonIndex = ProcessUtils.getBackIndex(component,
                                                    stamp,
                                                    currentIndex);
    int nextButtonIndex = ProcessUtils.getNextIndex(component,
                                                    stamp,
                                                    currentIndex);

    boolean showBackButton = backButtonIndex != ProcessUtils.NO_INDEX;
    boolean showNextButton = nextButtonIndex != ProcessUtils.NO_INDEX;
   
    boolean narrowScreenPDA = supportsNarrowScreen(context);

    // bail if no buttons shown
    if (!showBackButton && !showNextButton)
    {
      component.setRowKey(oldPath);
      return;
    }

    // get form name (#1308799)
    String formName = XhtmlLafUtils.getParentFormName(context);


    // If we don't support navigation (e.g., printable pages),
    // lie and claim we support scripting (even though we probably don't).
    // This will give us the highest fidelity output - that is,
    // we avoid creating submit buttons.
    boolean supportsScripting = (supportsScripting(context) ||
                                 !supportsNavigation(context));
    if (supportsScripting)
    {
      // render hidden fields to hold the form data
      _renderHiddenFields( context,
                          formName,
                          eventKey,
                          sourceKey,
                          valueKey,
                          sizeKey,
                          partialTargetsKey,
                          partialTargets);
    }

    UINode backButton = null;
    Object nonJSBackButtonText = null;
   
    // In the case of narrow-screen PDAs, the next and previous buttons
    // are not rendered to reduce the component's width.
    showBackButton = showBackButton && !narrowScreenPDA;
    showNextButton = showNextButton && !narrowScreenPDA;

    // set up the back button
    if (showBackButton)
    {
      BoundValue buttonTextandAccessKeyBV =
                           new SkinTranslatedBoundValue( _SINGLE_BACK_TEXT_KEY);


      Object buttonTextBV = new AccessKeyBoundValue(buttonTextandAccessKeyBV,
                                                    false);

      Object buttonAccessKeyBV = new AccessKeyBoundValue(
                                                    buttonTextandAccessKeyBV,
                                                    true);

      if (supportsScripting)
      {
        component.setRowIndex(backButtonIndex);
        boolean immediate = Boolean.TRUE.equals(
                          stamp.getAttributes().get(UIXCommand.IMMEDIATE_KEY));
        Object destination = stamp.getAttributes().get("destination");
        component.setRowIndex(currentIndex);

        backButton = createSingleItemSubmitButton(
                                true,
                                buttonTextBV,
                                buttonAccessKeyBV,
                                destination,
                                ProcessUtils.getSubmitScriptCall(
                                    context,
                                    formName,
                                    eventKey,
                                    sourceKey,
                                    nameString,
                                    valueKey,
                                    selectedIndex - 1,
                                    sizeKey,
                                    0,
                                    !immediate,
                                    null,
                                    null));
      }
      else
      {
        nonJSBackButtonText = buttonTextBV;
      }
    }

    UINode nextButton = null;

     // set up the next button
    if (showNextButton)
    {

      String buttonTextKey = ((totalItems == 2)
                              ? _SINGLE_CONTINUE_TEXT_KEY
                              : _SINGLE_NEXT_TEXT_KEY);

      BoundValue buttonTextandAccessKeyBV =
                           new SkinTranslatedBoundValue(buttonTextKey);


      Object buttonTextBV = new AccessKeyBoundValue( buttonTextandAccessKeyBV,
                                                     false);

      Object buttonAccessKeyBV = new AccessKeyBoundValue(
                                                      buttonTextandAccessKeyBV,
                                                      true);

      // The navBar needs its initial focus to be on the Next button,
      // according to the BLAF. Render a special id on the Next button
      // if this navBar is to have the initial focus. (unless it needs
      // initial focus, the Next button does not have an id on it)
      String buttonID = _getIDForFocus(context, node);


      // set the destination
      if (supportsScripting)
      {
        component.setRowIndex(nextButtonIndex);
        boolean immediate = Boolean.TRUE.equals(
                          stamp.getAttributes().get(UIXCommand.IMMEDIATE_KEY));
        Object destination = stamp.getAttributes().get("destination");
        component.setRowIndex(currentIndex);

        MutableUINode mutableNextButton =
        createSingleItemSubmitButton(false,
                                     buttonTextBV,
                                     buttonAccessKeyBV,
                                     destination,
                                     ProcessUtils.getSubmitScriptCall(
                                        context,
                                        formName,
                                        eventKey,
                                        sourceKey,
                                        nameString,
                                        valueKey,
                                        selectedIndex + 1,
                                        sizeKey,
                                        1,
                                        !immediate, null, null));
        if (buttonID != null)
        {
          mutableNextButton.setID(buttonID);
        }
        nextButton = mutableNextButton;
        context.setLocalProperty(_NEXT_BUTTON_KEY, nextButton);
      }
      else
      {
        // For Non-JavaScript browsers, encode the parameter name and value
        // pairs required for the next button's funtionality. This encoded 
        // value would be used as the name attribute of the element that   
        // would be rendered for the next button's funtionality.
        String nameAttri = XhtmlUtils.getEncodedNameAttribute (
                             // Array should be in the order of parameter
                             // name and value pair
                                 new String[]{SOURCE_PARAM,
                                              nameString,
                                              EVENT_PARAM,
                                              UIConstants.GOTO_EVENT,
                                              VALUE_PARAM,
                                              Long.toString(selectedIndex + 1),
                                              SIZE_PARAM,
                                              Integer.toString(1)});
                                                         
        context.setLocalProperty(_NON_JS_NEXT_BUTTON_NAME_ATTR, nameAttri);
        context.setLocalProperty(_NON_JS_NEXT_BUTTON_TEXT, buttonTextBV);
      }
    }

    // start the rendering
    ResponseWriter writer = context.getResponseWriter();
    boolean renderAsTable = _renderAsTable(context, node);

    if (renderAsTable)
    {
      writer.startElement("table", NodeUtils.getUIComponent(context, node));
      renderLayoutTableAttributes(context, "0", null);
      String uniqueId = UniqueCompositeId.getId(idString, null);
      writer.writeAttribute("id", uniqueId, null);
      writer.startElement("tr", null);
    }
    // we only want to render the ID in the "td" if renderAsTable is false.
    // render the base ID the first time only, then we render the subIDs.
    _renderStartTableCell(context, node, writer, renderAsTable, true);

    // don't render back button on first step
    if (showBackButton)
    {

      if (supportsScripting)
      {
        backButton.render(context);
      }
      else
      {
        // For Non-JavaScript browsers, render an input element(type= submit)
        // to submit the page. The name attribute of this element is encoded
        // with parameter name and value pairs thus it would enable browsers
        // to include the name of this element in its payLoad if it submits the
        // page.
        String nameAttri = XhtmlUtils.getEncodedNameAttribute (
                            // Array should be in the order of parameter name
                            // and value pair
                               new String[]{SOURCE_PARAM,
                                            nameString,
                                            EVENT_PARAM,
                                            UIConstants.GOTO_EVENT,
                                            VALUE_PARAM,
                                            Long.toString(selectedIndex - 1),
                                            SIZE_PARAM,
                                            Integer.toString(0)});

        String buttonText = ((AccessKeyBoundValue)nonJSBackButtonText)
                                              .getValue(context).toString();

        _renderSubmitButtonNonJSBrowser(context, buttonText, nameAttri);
      }
      writer.endElement("td");

      _renderSpacerCell(context);
      // we only want to render the ID in the "td" if renderAsTable is false.
      // render the subID.
      _renderStartTableCell(context, node, writer, renderAsTable, false);

    }

    //
    // create the label and render it
    //
    writer.writeAttribute(NOWRAP_ATTRIBUTE, Boolean.TRUE, null);
    component.setRowKey(oldPath);
  }
View Full Code Here

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

    // Render the leading separator icon
    IconData icons = _getIconData(context);
    renderTableDataIcon(context, icons.leadingSeparator, null);

    UIXHierarchy component = getHierarchyBase(context, node);
    UINode stamp = getStamp(context, node);

    if(stamp != null)
    {

      // Save the current key
      Object oldKey = component.getRowKey();
      boolean isNewPath = setNewPath(context, node, component);
      if (isNewPath)
      {
        int size = component.getRowCount();
        int rowIndex = component.getRowIndex();       
        boolean needsSeparator = false;
       
        for (int i = 0; i < size; i++)
        {
          component.setRowIndex(i);
          boolean isRendered =
                getBooleanAttributeValue(context, stamp, RENDERED_ATTR, true);
               
          if (isRendered)
          {
            if (needsSeparator)
              renderBetweenNodes(context);
            else
              needsSeparator = true;
             
            renderStamp(context, stamp,i == rowIndex)
          }
        }       

        if (getVisibleIndexedChildCount(context, node) > 0)
          renderBetweenNodes(context);

        // Restore the old path
        component.setRowKey(oldKey);
      }
    }

    // Now, render our children
    super.renderContent(context, node);
View Full Code Here

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

    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {

    UIXHierarchy component = getHierarchyBase(context, node);
    UINode stamp = getStamp(context, node);

    if(stamp != null)
    {

      // Save the current key
      Object oldPath = component.getRowKey();
      boolean isNewPath = setNewPath(context, node, component);
      if (isNewPath)
      {

        int size = component.getRowCount();
        int rowIndex = component.getRowIndex();

        for (int i = 0; i < size; i++)
        {
          component.setRowIndex(i);
          renderNode(context, stamp,i == rowIndex);
        }

        // Restore the old path
        component.setRowKey(oldPath);
      }
    }

    super.renderContent(context, node);
  }
View Full Code Here

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

      UINode           node
      ) throws IOException
    {
      boolean initialLinkSelectedStatus = LinkUtils.isSelected(context);

      UIXHierarchy component = getHierarchyBase(context, node);
      UINode stamp = getStamp(context, node);

      if(stamp != null)
      {

        // Save the current key
        Object oldPath = component.getRowKey();
        boolean isNewPath = setNewPath(context, node, component);

        if (isNewPath)
        {
          int size = component.getRowCount();
          int rowIndex = component.getRowIndex();

          for (int i = 0; i < size; i++)
          {
            component.setRowIndex(i);
            renderStamp(context, stamp,i == rowIndex);

            if ( i < (size - 1))
              renderBetweenIndexedChildren(context,node);

          }

          if (getVisibleIndexedChildCount(context, node) > 0)
            renderBetweenIndexedChildren(context,node);

          // Restore the old path
          component.setRowKey(oldPath);
        }
      }

      super.renderContent(context, node);
      //Reset the selected status, which might have been changed on rendering
View Full Code Here

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

    UINode           node
    ) throws IOException
  {
    super.prerender(context, node);

    UIXHierarchy component = getHierarchyBase(context, node);
    int childCount = _getItemCount(context, node, component);

    // no kids, no breadcrumbs -- but you still get the span.
    int minChildCount = 0;
    if ( !renderLastChild(context, node))
View Full Code Here

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

  protected void renderContent(
    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {
    UIXHierarchy component = getHierarchyBase(context, node);
    UINode stamp = getStamp(context, node);

    if(stamp != null)
    {
      // Save the current key
      Object oldPath = component.getRowKey();
      Object focusPath = getFocusPath(component);
      if (focusPath == null)
        return;
     
      List<Object> paths =
        new ArrayList<Object>(component.getAllAncestorContainerRowKeys(focusPath));
      paths.add(focusPath);
      int size = paths.size();
     
      int childCount = _getItemCount(context, node, component);

      // no kids, no breadcrumbs -- but you still get the span.
      int minChildCount = 0;
      if ( !renderLastChild(context, node))
        minChildCount = 1;

      if (childCount <= minChildCount )
      {
        component.setRowKey(oldPath);
        return;
      }

      // todo - I'm not calculating whether the item is visible or not
      int nextVisChildIndex = 1;

      for (int i = 0; i < size; i++)
      {
        //PageRendererUtils.setNewPath(context, component, i);

        if ( i + 1 == childCount)
          nextVisChildIndex=NO_CHILD_INDEX;
        else
          nextVisChildIndex = i + 1;
        component.setRowKey(paths.get(i));

        renderNode(context, stamp, nextVisChildIndex);
      }

      // Restore the old path
      component.setRowKey(oldPath);
    }

    super.renderContent(context, node);
  }
View Full Code Here

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

      UINode           node
      ) throws IOException
  {
    boolean initialLinkSelectedStatus = LinkUtils.isSelected(context);

    UIXHierarchy component = getHierarchyBase(context, node);
    UINode stamp = getStamp(context, node);

    if(stamp != null)
    {

      // Save the current key
      Object oldPath = component.getRowKey();
      boolean isNewPath = setNewPath(context, node, component);

      if (isNewPath)
      {
        int size = component.getRowCount();
        int rowIndex = component.getRowIndex();

        for (int i = 0; i < size; i++)
        {
          component.setRowIndex(i);
          renderStamp(context, stamp,i == rowIndex);

          if ( i < (size - 1))
            renderBetweenIndexedChildren(context,node,i);

        }

        if (getVisibleIndexedChildCount(context, node) > 0)
          renderBetweenIndexedChildren(context,node);

        // Restore the old path
        component.setRowKey(oldPath);
      }
    }

    super.renderContent(context, node);
    //Reset the selected status, which might have been changed on rendering
View Full Code Here

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

    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {

    UIXHierarchy component = getHierarchyBase(context, node);
    UINode stamp = getStamp(context, node);

    if(stamp != null)
    {

      // Save the current key
      Object oldPath = component.getRowKey();
      boolean isNewPath = setNewPath(context, node, component);
      if (isNewPath)
      {

        int size = component.getRowCount();
        for (int i = 0; i < size; i++)
        {
          component.setRowIndex(i);
          renderChild(context, stamp);

        }

        // Restore the old path
        component.setRowKey(oldPath);
      }
    }

    super.renderContent(context, node);
  }
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.