Package org.apache.myfaces.trinidadinternal.ui

Examples of org.apache.myfaces.trinidadinternal.ui.UINode


    }

    // get name
    String nameString = _getNameString(context, navBar);

    UINode backButton = null;
    UINode nextButton = null;

    // 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);
      // set the destination.
      if (formName == null)
      {
        backButton = createSingleItemURLButton(
                                    context,
                                    true,
                                    buttonTextBV,
                                    buttonAccessKeyBV,
                                    getSingleDestinationURL(context,
                                                            navBar,
                                                            eventKey,
                                                            sourceKey,
                                                            nameString,
                                                            valueKey,
                                                            currentValue-1));
      }
      else
      {
        if (supportsScripting)
        {
          backButton = createSingleItemSubmitButton(
                                  context,
                                  true,
                                  buttonTextBV,
                                  buttonAccessKeyBV,
                                  getSingleDestinationSubmit( context,
                                                              navBar,
                                                              formName,
                                                              eventKey,
                                                              sourceKey,
                                                              nameString,
                                                              valueKey,
                                                              currentValue - 1,
                                                              false));
        }
        else
        {
          backButton = createSubmitButton(context,
                                           buttonTextBV,
                                           buttonAccessKeyBV,
                                           null,
                                           formName,
                                           false,
                                           eventKey,
                                           sourceKey,
                                           nameString,
                                           valueKey,
                                           currentValue - 1,
                                           null,
                                           -1);
        }
      }
    }

    // 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, navBar);

      if (formName == null)
      {

        MutableUINode mutableNextButton =
            createSingleItemURLButton(
                                     context,
                                     false,
                                     buttonTextBV,
                                     buttonAccessKeyBV,
                                     getSingleDestinationURL(context,
                                                             navBar,
                                                             eventKey,
                                                             sourceKey,
                                                             nameString,
                                                             valueKey,
                                                             currentValue+1));
        if (buttonID != null)
        {
          mutableNextButton.setID(buttonID);
        }
        nextButton = mutableNextButton;
      }
      else
      {

        // set the destination
        if (supportsScripting)
        {
          MutableUINode mutableNextButton =
          createSingleItemSubmitButton(
                                       context,
                                       false,
                                       buttonTextBV,
                                       buttonAccessKeyBV,
                                       getSingleDestinationSubmit(
                                                  context,
                                                  navBar,
                                                  formName,
                                                  nameString,
                                                  currentValue + 1,
                                                  true));
          if (buttonID != null)
          {
            mutableNextButton.setID(buttonID);
          }
          nextButton = mutableNextButton;
        }
        else
        {

          nextButton = createSubmitButton(context,
                                           buttonTextBV,
                                           buttonAccessKeyBV,
                                           buttonID,
                                           formName,
                                           false,
                                           eventKey,
                                           sourceKey,
                                           nameString,
                                           valueKey,
                                           currentValue + 1,
                                           null,
                                           -1);
        }
      }
    }

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

    if (renderAsTable)
    {
      writer.startElement("table", navBar.getUIComponent());
      renderLayoutTableAttributes(context, "0", null);
      renderID(context, navBar);
      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, navBar, writer, renderAsTable, true);

    // don't render back button on first step
    if (showBackButton)
    {
      backButton.render(context);
      writer.endElement("td");

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

    }

    //
    // create the label and render it
    //
    writer.writeAttribute(NOWRAP_ATTRIBUTE, Boolean.TRUE, null);

    // Now, we create one of two things.  Normally, we'll create
    // a simple range string.  But, when there are link children,
    // we create a ChoiceBean
    if ((childCount == 0) ||
        // No form when we require one means no choice
        ((formName == null) && requiresForm(context)) ||
        // No scripting also means no choice
        !supportsScripting(context))
    {
      // No "Step 1 of X" when there's 1 or two steps
      if (totalItems > 2)
      {
        // the string to be displayed between buttons
        String rangeString = _getRangeString(context,
                                             navBar,
                                             currentValue,
                                             SINGLE_STEP,
                                             totalItems,
                                             null);

        MarlinBean stepLabel = new MarlinBean(STYLED_TEXT_NAME);
        stepLabel.setAttributeValue(TEXT_ATTR, rangeString);
        stepLabel.setStyleClass(NAV_BAR_VIEW_STYLE_CLASS);
        stepLabel.render(context);
      }
    }
    else
    {
      // Gather the children
      DataObjectList links = LinkDataObject.getLinkDataList(context,
                                                            navBar);
      MarlinBean     choice = new MarlinBean(CHOICE_NAME);

      int maxVisited = (int) currentValue;
      Object maxVisitedObj = navBar.getAttributeValue(context,
                                                      MAX_VISITED_ATTR);
      if (maxVisitedObj instanceof Number)
        maxVisited = ((Number) maxVisitedObj).intValue();

      // Sanity check the "maxVisited" attribute
      maxVisited = Math.min(maxVisited,
                            links == null ? 0 : links.getLength());
      // Add one option per link, but only go up to the "maxVisited"
      // value.  (BTW, since maxVisited is 1-indexed, but i is 0-indexed,
      // this is an _inclusive_ range here)
      for (int i = 0; i < maxVisited; i++)
      {
        DataObject link = links.getItem(i);
        MarlinBean option = new MarlinBean(OPTION_NAME);
        option.setAttributeValue(TEXT_ATTR,
                                 link.selectValue(context, TEXT_ATTR));
        option.setAttributeValue(VALUE_ATTR, IntegerUtils.getString(i + 1));

        if (currentValue == i + 1)
          option.setAttributeValue(SELECTED_ATTR, Boolean.TRUE);
        choice.addIndexedChild(option);
      }

      if (choice.getIndexedChildCount(context) > 0)
      {
        String onChange;

        // get name
        String name = _getNameString(context, navBar);

        // Two options: formSubmitted mode and non-formSubmitted mode.
        // First, non-formSubmitted mode.
        if (formName == null)
        {
          onChange = _getChoiceOnChange(context,
                                        _getDestinationString(context, navBar),
                                        sourceKey,
                                        eventKey,
                                        name,
                                        null,
                                        null);
        }
        else
        {
          onChange = _getChoiceOnChangeFormSubmitted(context,
                                                     navBar,
                                                     formName,
                                                     eventKey,
                                                     sourceKey,
                                                     name,
                                                     partialTargetsKey,
                                                     null);
        }

        choice.setAttributeValue(ON_CHANGE_ATTR, onChange);
      }
      else
      {
        choice.setAttributeValue(READ_ONLY_ATTR, Boolean.TRUE);
      }

      choice.render(context);
    }

    // don't render the next button on last step
    if (showNextButton)
    {
      writer.endElement("td");

      _renderSpacerCell(context);

      _renderStartTableCell(context, navBar, writer, renderAsTable, false);

      nextButton.render(context);
    }

    writer.endElement("td");

    if (renderAsTable)
View Full Code Here


    String prevDestination = null;
    String nextDestination = null;
    String prevOnClick     = null;
    String nextOnClick     = null;

    UINode leftArrow  = null;
    UINode rightArrow = null;
    UINode leftLink   = null;
    UINode rightLink  = null;

    boolean validate = false;
    boolean createSubmitButton = false;

    boolean showDisabledNavigation = disabledNavigationShown(context);
    boolean hasBackRecords = (backRecords > 0);
    boolean hasNextRecords = (nextRecords > 0);

    boolean showBackButton = hasBackRecords || showDisabledNavigation;
    boolean showNextButton = hasNextRecords || showDisabledNavigation;
    if (!supportsNavigation(context))
    {
      showBackButton = false;
      showNextButton = false;
    }

    Object showAll = navBar.getAttributeValue(context, SHOW_ALL_ATTR);
    boolean atShowAll = SHOW_ALL_ACTIVE.equals(showAll);
    if (atShowAll)
    {
      backRecords = 0;
      nextRecords = 0;
    }

    if (formName == null)
    {
      // use parameterized URLs
      if (hasBackRecords && !atShowAll)
      {
        prevDestination = _getMultiDestinationURL(destinationString,
                                                  eventKey,
                                                  sourceKey,
                                                  nameString,
                                                  valueKey,
                                                  backValue,
                                                  sizeKey,
                                                  partialTargetsKey,
                                                  backRecords,
                                                  partialTargets);

        if (partialTargets != null)
        {
          // If we're doing partial page rendering, we need to
          // generate the _firePartialChange() onclick handler
          prevOnClick = XhtmlLafUtils.getFirePartialChangeHandler(
                                        prevDestination);
          prevDestination = "#";
        }
      }

      if (hasNextRecords && !atShowAll)
      {
        nextDestination = _getMultiDestinationURL(destinationString,
                                                  eventKey,
                                                  sourceKey,
                                                  nameString,
                                                  valueKey,
                                                  nextValue,
                                                  sizeKey,
                                                  partialTargetsKey,
                                                  nextRecords,
                                                  partialTargets);

        if (partialTargets != null)
        {
          // If we're doing partial page rendering, we need to
          // generate the _firePartialChange() onclick handler
          nextOnClick = XhtmlLafUtils.getFirePartialChangeHandler(
                                        nextDestination);
          nextDestination = "#";
        }
      }
    }
    else
    {
      // determine whether we need to validate on submit
      validate = _doValidate(context, navBar);

      // use form submit
      if (supportsScripting(context))
      {
        if (hasBackRecords && !atShowAll)
        {
          prevDestination = "#";
          prevOnClick = _getMultiDestinationSubmit(context,
                                                   formName,
                                                   eventKey,
                                                   sourceKey,
                                                   nameString,
                                                   valueKey,
                                                   backValue,
                                                   sizeKey,
                                                   backRecords,
                                                   validate,
                                                   partialTargetsKey,
                                                   partialTargets);
        }

        if (hasNextRecords && !atShowAll)
        {
          nextDestination = "#";
          nextOnClick =  _getMultiDestinationSubmit(context,
                                                    formName,
                                                    eventKey,
                                                    sourceKey,
                                                    nameString,
                                                    valueKey,
                                                    nextValue,
                                                    sizeKey,
                                                    nextRecords,
                                                    validate,
                                                    partialTargetsKey,
                                                    partialTargets);
        }

        // render hidden fields to hold the form data
        if (hasBackRecords || hasNextRecords)
          renderHiddenFields( context,
                              formName,
                              true,
                              eventKey,
                              sourceKey,
                              valueKey,
                              sizeKey,
                              partialTargetsKey,
                              partialTargets);
      }
      else
      {
        // create submit buttons to handle submission
        createSubmitButton = true;
      }
    }

    //
    // create the anonymous link nodes
    //
    if (createSubmitButton)
    {
      if (showBackButton)
      {
        // create back submit button bean
        leftArrow = createSubmitButton(context,
                                        _getMultiSubmitButtonText(context,
                                                                  true,
                                                                  backRecords),
                                        null,
                                        null,
                                        formName,
                                        validate,
                                        eventKey,
                                        sourceKey,
                                        nameString,
                                        valueKey,
                                        backValue,
                                        sizeKey,
                                        backRecords);
      }

      // create next submit button bean
      if (showNextButton)
      {
        rightArrow = createSubmitButton(context,
                                         _getMultiSubmitButtonText(context,
                                                                  false,
                                                                  nextRecords),
                                         null,
                                         null,
                                         formName,
                                         validate,
                                         eventKey,
                                         sourceKey,
                                         nameString,
                                         valueKey,
                                         nextValue,
                                         sizeKey,
                                         nextRecords);
      }
    }
    else
    {
      if (showBackButton)
      {
        leftArrow  = _createArrowImage(context,
                                       true,
                                       prevDestination,
                                       prevOnClick);

        leftLink   = _createTextLink(context,
                                     navBar,
                                     true,
                                     prevDestination,
                                     prevOnClick,
                                     backRecords);
      }

      if (showNextButton)
      {
        rightArrow = _createArrowImage(context,
                                       false,
                                       nextDestination,
                                       nextOnClick);

        rightLink  = _createTextLink(context,
                                     navBar,
                                     false,
                                     nextDestination,
                                     nextOnClick,
                                     nextRecords);

      }
    }

    UINode rangeNode  = _createRangeNode(context,
                                         navBar,
                                         destinationString,
                                         nameString,
                                         formName,
                                         minValue,
                                         currentValue,
                                         blockSize,
                                         maxValue,
                                         eventKey,
                                         sourceKey,
                                         sizeKey,
                                         partialTargetsKey,
                                         partialTargets);

    // ready to render
    ResponseWriter writer = context.getResponseWriter();
    boolean renderAsTable = _renderAsTable(context, navBar);



    // The following strange code is part of the work around for
    // bug 2275703.  IE has problems re-laying out a TableBean
    // after a partial page replacement.  In particular, pieces
    // of the table's top navigation bar, such as the previous link
    // or icon, or sometimes the entire navigation bar,  may shift to
    // the left.  In some cases, pieces of the navigation bar (the previous
    // icon) may disappear during re-layout!  There doesn't seem to be
    // any clean way to avoid this apparent IE bug.  However, we explicitly
    // pareform a partial replacement of the navigation bar's previous icon
    // *after* the entire table has been replaced, everything seems to lay
    // out just fine.
    //
    // So, if we are rendering a TableBean's navigation bar with
    // PPR enabled on IE, then we generate an ID for the nav bar's
    // previous icon, and we add this to the list of rendered partial
    // targets during the partial page render.  This forces the icon
    // to be replaced as part of the partial page update, and fixes
    // our layout problems.
    String iconID = null;
    Object id = (supportsID(context) ? getID(context, navBar) : null);
    TrinidadAgent agent = context.getAgent();

    if ((id != null) &&
        (partialTargets != null) &&
        (agent.getAgentApplication() == TrinidadAgent.APPLICATION_IEXPLORER))
    {
      iconID = id.toString() + "-i";
    }

    // if we need to render standalone, create a table and table row...
    if (renderAsTable)
    {
      writer.startElement("table", null);
      renderLayoutTableAttributes(context, "0", null);

      // We should always render the ID, but we particularly need
      // to make sure that the ID is rendered if the NavBar is being
      // used to navigate a TableBean, since we explicitly target
      // TableBean NavBars when using PPR to re-render TableBeans...
      renderID(context, navBar);
      writer.startElement("tr", null);
    }

    // we only want to render the baseID, if needed, once. Then we
    // render the subIDs. So we need to keep track of this.
    boolean isBaseID = true;
    if (leftArrow != null)
    {
      // We assign an id to the left arrow so that we can target it as
      // a partial target to work around bug 2275703 - see note above.
      if (iconID != null)
      {
        writer.startElement("td", null);
        renderAttribute(context, "id", iconID);

        // If the navigation bar that we are currently rendering
        // is included in a partial page response, add the icon
        // id to the list of partial targets.
        PartialPageContext pprContext = context.getPartialPageContext();
        if ((pprContext != null) &&
            pprContext.isInsidePartialTarget())
        {
          pprContext.addRenderedPartialTarget(iconID);
        }
      }
      else
      {
        // not in PPR mode, so just render the td (and id if not in a table
        // for the Visual Editor)
        _renderStartTableCell(context, navBar, writer, renderAsTable, isBaseID);
        isBaseID = false;
      }

      writer.writeAttribute(VALIGN_ATTRIBUTE, "middle", null);
      leftArrow.render(context);
      writer.endElement("td");
      _renderSpacerCell(context);
    }

    if (leftLink != null)
    {
      _renderStartTableCell(context, navBar, writer, renderAsTable, isBaseID);
      isBaseID = false;
      writer.writeAttribute(VALIGN_ATTRIBUTE, "middle", null);
      writer.writeAttribute(NOWRAP_ATTRIBUTE, Boolean.TRUE, null);
      leftLink.render(context);
      writer.endElement("td");
      _renderSpacerCell(context);
    }

    _renderStartTableCell(context, navBar, writer, renderAsTable, isBaseID);
    isBaseID = false;
    writer.writeAttribute(VALIGN_ATTRIBUTE, "middle", null);
    writer.writeAttribute(NOWRAP_ATTRIBUTE, Boolean.TRUE, null);
    rangeNode.render(context);
    writer.endElement("td");

    if (rightLink != null)
    {
      _renderSpacerCell(context);
View Full Code Here

    String sizeKey,
    String partialTargetsKey,
    String partialTargets
    )
  {
    UINode rangeNode = null;

    // if there is no blockSize to step by, or there are no items in the
    // table, then we don't render a choice
    if ((blockSize <= 0) ||
        ((maxValue < minValue) &&
View Full Code Here

    renderRelatedLinksBlockStart(context, "af_panelSideBar.BLOCK_TITLE");   
    super.prerender(context, node);

    ResponseWriter writer = context.getResponseWriter();

    UINode filter = node.getNamedChild(context, FILTER_CHILD);
   
    if ( filter != null)
    {
      renderNamedChild(context, node, filter, FILTER_CHILD);
      writer.startElement(HORIZONTAL_RULE_ELEMENT, null);
View Full Code Here

    UIXRenderingContext context,
    UINode           node
    ) throws IOException
  {
    boolean initialLinkSelectedStatus = LinkUtils.isSelected(context);
    UINode pageNode = context.getParentContext().getAncestorNode(0);
    UIXPage component = (UIXPage) pageNode.getUIComponent();

    UINode stamp = this.getNamedChild(context, pageNode, NODE_STAMP_CHILD);
    if(stamp == null)
      return;

    // Save the current path
    int startDepth = getIntAttributeValue(context, node, LEVEL_ATTR, 0);
View Full Code Here

  protected boolean isEmpty(
    UIXRenderingContext context,
    UINode           node
    )
  {
    UINode pageNode = context.getParentContext().getAncestorNode(0);
    UIXPage component = (UIXPage) pageNode.getUIComponent();
    int startDepth = getIntAttributeValue(context, node, LEVEL_ATTR, 0);

    return PageRendererUtils.isEmpty(context, component, startDepth);
  }
View Full Code Here

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

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

      if(stamp != null)
      {

        // Save the current key
View Full Code Here

    ) throws IOException
  {
    ResponseWriter writer = context.getResponseWriter();

    // get the child about to be rendered
    UINode nextChild = node.getIndexedChild( context, nextIndex);


    // if the next child about to be rendered is not visible to the user
    // then don't render anything
    // =-=AEW This doesn't catch formValues inside of contextPopping nodes
    if (!nextChild.getNodeRole(context).satisfiesRole(
                                      USER_INVISIBLE_ROLE))
    {
      writer.startElement("div", null);

      UINode separatorChild = getNamedChild(context, node, SEPARATOR_CHILD);

      if (separatorChild != null)
      {
        renderNamedChild(context, node, separatorChild, SEPARATOR_CHILD);
      }
View Full Code Here

    UINode           node
    ) throws IOException
  {
    ResponseWriter writer    = context.getResponseWriter();

    UINode largeAd           = getNamedChild(context, node,
                                             ADVERTISEMENT_LARGE_CHILD);
    UINode mediumAd          = getNamedChild(context, node,
                                             ADVERTISEMENT_MEDIUM_CHILD);
    UINode corporateBranding = getNamedChild(context, node,
                                             BRANDING_CHILD);
    UINode productBranding   = getNamedChild(context, node,
                                             BRANDING_APP_CHILD);
    UINode inContextBranding = getNamedChild(context, node,
                                             BRANDING_APP_CONTEXTUAL_CHILD);
    UINode cobranding        = getNamedChild(context, node,
                                             BRANDING_COOPERATIVE_CHILD);
    UINode globalButtons     = getNamedChild(context, node,
                                             NAVIGATION_GLOBAL_CHILD);
    UINode tabBar            = getNamedChild(context, node,
                                             NAVIGATION1_CHILD);
    UINode globalHeader      = getNamedChild(context, node,
                                             NAVIGATION2_CHILD);
    UINode menuSwitch        = getNamedChild(context, node,
                                             MENU_SWITCH_CHILD);
    UINode quickSearch       = getNamedChild(context, node,
                                             SEARCH_CHILD);

    // chromeType is an attribute on pageLayout and pageHeaderLayout.
    // The attribute values are compact or expanded.
    // For now, this controls the productBranding. If compact, then the
View Full Code Here

    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();
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidadinternal.ui.UINode

Copyright © 2018 www.massapicom. 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.