Package org.apache.myfaces.trinidadinternal.ui.beans

Examples of org.apache.myfaces.trinidadinternal.ui.beans.MarlinBean


  }

  private static UINode  _createCompositeUINode()
  {
    // add the tabs
    MarlinBean pageLayout = new MarlinBean(UIConstants.PAGE_LAYOUT_NAME);
    MutableUINode navigationGlobal =
                  new BaseMutableUINode(UIConstants.MARLIN_NAMESPACE,
                                        UIConstants.PAGE_MENU_BUTTONS_NAME);
    pageLayout.setNamedChild(UIConstants.NAVIGATION_GLOBAL_CHILD, navigationGlobal);

    // add the bar
    MutableUINode menuTabs =
                  new BaseMutableUINode(UIConstants.MARLIN_NAMESPACE,
                                        UIConstants.PAGE_MENU_TABS_NAME);
    menuTabs.setAttributeValue(UIConstants.LEVEL_ATTR,
                               1);
    pageLayout.setNamedChild(UIConstants.NAVIGATION1_CHILD, menuTabs);
    MutableUINode menuBar =
                  new BaseMutableUINode(UIConstants.MARLIN_NAMESPACE,
                                        UIConstants.PAGE_MENU_BAR_NAME);
    menuBar.setAttributeValue(UIConstants.LEVEL_ATTR,
                              2);
    pageLayout.setNamedChild(UIConstants.NAVIGATION2_CHILD, menuBar);

    // add the tree

    MutableUINode navigationTree =
                  new BaseMutableUINode(UIConstants.MARLIN_NAMESPACE,
                                        UIConstants.PAGE_NAVIGATION_TREE_NAME);
    navigationTree.setAttributeValue(UIConstants.START_LEVEL_ATTR,
                              3);

    BoundValue treeRenderedBV = new HasDataBoundValue(
                                  RootBoundValue.getBoundValue(), 3, true);
    navigationTree.setAttributeValue(UIConstants.RENDERED_ATTR, treeRenderedBV);
    // for PPR, an ID is required:
    navigationTree.setAttributeValue(UIConstants.ID_ATTR, new BoundValue()
    {
      public Object getValue(UIXRenderingContext context)
      {
        UINode pageNode = context.getParentContext().getAncestorNode(0);
        UIComponent component = pageNode.getUIComponent();
        return component.getClientId(context.getFacesContext()) +
               org.apache.myfaces.trinidadinternal.renderkit.uix.PageRenderer.TREE_SUFFIX;
      }
    }
                              );


    // add the list
    MutableUINode menuList =
                  new BaseMutableUINode(UIConstants.MARLIN_NAMESPACE,
                                        UIConstants.PAGE_MENU_LIST_NAME);
    menuList.setAttributeValue(UIConstants.LEVEL_ATTR,
                              3);
    BoundValue listRenderedBV = new HasDataBoundValue(
                                  RootBoundValue.getBoundValue(), 3, false);
    menuList.setAttributeValue(UIConstants.RENDERED_ATTR, listRenderedBV);


    MarlinBean navigation3Flow = new MarlinBean(UIConstants.FLOW_LAYOUT_NAME);
    navigation3Flow.addIndexedChild(menuList);
    navigation3Flow.addIndexedChild(navigationTree);
    navigation3Flow.setAttributeValue(UIConstants.RENDERED_ATTR,
                           new OrBoundValue(treeRenderedBV,listRenderedBV));
    pageLayout.setNamedChild(UIConstants.NAVIGATION3_CHILD, navigation3Flow);



    // add the path
    MutableUINode navigationPath =
                  new BaseMutableUINode(UIConstants.MARLIN_NAMESPACE,
                                        UIConstants.PAGE_NAVIGATION_PATH_NAME);

    BoundValue hasLocation =
          XhtmlLafUtils.createIsRenderedBoundValue(UIConstants.LOCATION_CHILD);
    navigationPath.setAttributeValue(UIConstants.RENDERED_ATTR,
                               new NotBoundValue(hasLocation));


    UINode location = ContextPoppingUINode.getUINode(UIConstants.LOCATION_CHILD);
    MarlinBean locationFlow = new MarlinBean(UIConstants.FLOW_LAYOUT_NAME);
    locationFlow.addIndexedChild(navigationPath);
    locationFlow.addIndexedChild(location);
    pageLayout.setNamedChild(UIConstants.LOCATION_CHILD, locationFlow);

    //_setPoppedChild(pageLayout, UIConstants.LOCATION_CHILD);
    _setPoppedChild(pageLayout, UIConstants.MENU_SWITCH_CHILD);
    _setPoppedChild(pageLayout, UIConstants.ACTIONS_CHILD);
View Full Code Here


public class PageHeaderLayoutRenderer extends UINodeRenderer
                                      implements UIConstants
{
  private static UINode _createCompositeUINode()
  {
    MarlinBean brandingFlow = new MarlinBean(FLOW_LAYOUT_NAME);

    MarlinBean spacer = new MarlinBean(SPACER_NAME);
    spacer.setAttributeValue(WIDTH_ATTR, "5");
    spacer.setAttributeValue(HEIGHT_ATTR, "1");

    brandingFlow.setNamedChild(SEPARATOR_CHILD, spacer);
    brandingFlow.addIndexedChild(
      ContextPoppingUINode.getUINode(BRANDING_CHILD));
    brandingFlow.addIndexedChild(
      ContextPoppingUINode.getUINode(BRANDING_APP_CHILD));
    brandingFlow.addIndexedChild(
      ContextPoppingUINode.getUINode(BRANDING_APP_CONTEXTUAL_CHILD));

    MarlinBean compositeRoot = new MarlinBean(STACK_LAYOUT_NAME);

    // delegate all of the attributes to the RootAttribtueMap
    compositeRoot.setAttributeMap(RootAttributeMap.getAttributeMap());

    compositeRoot.addIndexedChild(
      ContextPoppingUINode.getUINode(NAVIGATION_GLOBAL_CHILD));
    brandingFlow.addIndexedChild(
      ContextPoppingUINode.getUINode(MENU_SWITCH_CHILD));

    compositeRoot.addIndexedChild(brandingFlow);
    compositeRoot.addIndexedChild(
      ContextPoppingUINode.getUINode(NAVIGATION1_CHILD));
    compositeRoot.addIndexedChild(
      ContextPoppingUINode.getUINode(NAVIGATION2_CHILD));
    compositeRoot.addIndexedChild(
      ContextPoppingUINode.getUINode(SEARCH_CHILD));

    return compositeRoot;
  }
View Full Code Here

    long             value,
    String           sizeKey,
    int              size
    )
  {
    MarlinBean submitButton = new MarlinBean(UIConstants.SUBMIT_BUTTON_NAME);
    submitButton.setID(buttonID);
    submitButton.setAttributeValue(UIConstants.FORM_NAME_ATTR, formName);
    submitButton.setAttributeValue(UIConstants.UNVALIDATED_ATTR, Boolean.valueOf(!validate));
    submitButton.setAttributeValue(UIConstants.TEXT_ATTR, buttonText);
    submitButton.setAttributeValue(UIConstants.ACCESS_KEY_ATTR,
                                   buttonAccessKey);
    return submitButton;
  }
View Full Code Here

    {
      ResponseWriter writer = context.getResponseWriter();
      writer.endElement("map");
      String navBlockEndAnchorName = (String)context.getLocalProperty(0,
                                      _NAV_BLOCK_END_ANCHOR_NAME_KEY, null);
      MarlinBean navBlockEndAnchor = new MarlinBean(UIConstants.LINK_NAME);
      navBlockEndAnchor.setAttributeValue(UIConstants.NAME_ATTR, navBlockEndAnchorName);
      navBlockEndAnchor.render(context);
    }
  }
View Full Code Here

    UIXRenderingContext context,
    String skipNavigationAnchor,
    String altText
    ) throws IOException
  {
    MarlinBean skipLink = new MarlinBean(UIConstants.IMAGE_NAME);
    skipLink.setAttributeValue(UIConstants.DESTINATION_ATTR, "#"+skipNavigationAnchor);
    skipLink.setAttributeValue(UIConstants.SHORT_DESC_ATTR,
                               altText);
    skipLink.setAttributeValue(UIConstants.SOURCE_ATTR, new IconURIBoundValue(TRANSPARENT_GIF));
    //--pu-- Hack: Use the existing label hiding class for hiding images as well
    skipLink.setStyleClass(XhtmlLafConstants.HIDDEN_LABEL_STYLE_CLASS);
    skipLink.render(context);
  }
View Full Code Here

    Object           buttonText,
    Object           buttonAccessKey,
    String           destinationURL
    )
  {
    MarlinBean urlButton = new MarlinBean(BUTTON_NAME);

    urlButton.setAttributeValue(TEXT_ATTR, buttonText);
    urlButton.setAttributeValue(ACCESS_KEY_ATTR, buttonAccessKey);
    urlButton.setAttributeValue(DESTINATION_ATTR, destinationURL);

    return urlButton;
  }
View Full Code Here

    Object           buttonText,
    Object           buttonAccessKey,
    String           onClickJS
    )
  {
    MarlinBean submitButton = new MarlinBean(BUTTON_NAME);

    submitButton.setAttributeValue(TEXT_ATTR, buttonText);
    submitButton.setAttributeValue(ACCESS_KEY_ATTR, buttonAccessKey);

    submitButton.setOnClick(onClickJS);

    return submitButton;
  }
View Full Code Here

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

    BoundValue shortDescBoundValue =
      new SkinTranslatedBoundValue(_GO_BUTTON_TIP_KEY);
    BoundValue onClickBoundValue =
                       new ContextPropertyBoundValue( MARLIN_NAMESPACE,
                                                      _ON_CLICK_PROPERTY);
    MarlinBean button = new MarlinBean(BUTTON_NAME);
    button.setAttributeValue(TEXT_ATTR, buttonTextBV);
    button.setAttributeValue(ACCESS_KEY_ATTR, buttonAccessKeyBV);
    button.setAttributeValue(SHORT_DESC_ATTR, shortDescBoundValue);
    button.setAttributeValue(ON_CLICK_ATTR, onClickBoundValue);

    return button;
  }
View Full Code Here

                                           currentValue,
                                           blockSize,
                                           maxValue,
                                           null);

      MarlinBean rangeLabel = new MarlinBean(STYLED_TEXT_NAME);
     
      rangeLabel.setAttributeValue(TEXT_ATTR, rangeString);
      rangeLabel.setAttributeValue(STYLE_CLASS_ATTR, NAV_BAR_VIEW_STYLE_CLASS);

      rangeNode = rangeLabel;
    }
    else
    {
      // we know the size, so use the choice control
      MarlinBean choice = new MarlinBean(CHOICE_NAME);

      choice.setAttributeValue(SHORT_DESC_ATTR,
                               getTranslatedValue(context, _CHOICE_TIP_KEY));

      String onChange = null;
      int selectedIndex;

      if (form == null)
      {
        // Bug #1765747: if we're trying to render a choice,
        // Netscape will get very unhappy if there isn't a form,
        // and render wacky output that pretty much trashes the
        // navbar.
        // If a client was _directly_ adding a choice, then this
        // would be their fault, and we wouldn't try to work around
        // it.  But the NavigationBar implicitly adds the choice
        // for them, and the Back/Next buttons are still useable
        // even without the choice.  So, the nice thing to do
        // is just make the choice read-only.
        if (requiresForm(context))
        {
          if (getParentFormName(context) == null)
          {
            // No form - turn on read-only
            choice.setAttributeValue(READ_ONLY_ATTR, Boolean.TRUE);
          }
        }

        // create each of the choice options for parameterized URLs
        selectedIndex = _addNavigationOptions(context, navBar, choice, false,
                                          minValue, maxValue, currentValue,
                                          blockSize, sizeKey);
        int count = choice.getIndexedChildCount(context);
        if (count > 1)
        {
          onChange = _getChoiceOnChange(context,
                                        destination,
                                        sourceKey,
                                        eventKey,
                                        name,
                                        partialTargets,
                                        partialTargetsKey);
        }
        else
        {
          choice.setAttributeValue(READ_ONLY_ATTR, Boolean.TRUE);
        }
      }
      else
      {
        // create each of the choice options for form submit
        selectedIndex = _addNavigationOptions(context, navBar, choice, true,
                                          minValue, maxValue, currentValue,
                                          blockSize, sizeKey);
        int count = choice.getIndexedChildCount(context);
        if (count > 1)
        {
          onChange = _getChoiceOnChangeFormSubmitted(
                        context,
                        navBar,
                        form,
                        eventKey,
                        sourceKey,
                        name,
                        partialTargetsKey,
                        partialTargets);
        }
        else
        {
          choice.setAttributeValue(READ_ONLY_ATTR, Boolean.TRUE);
        }
      }

      if (onChange != null)
      {
        // set the onchange handler
        choice.setAttributeValue(ON_CHANGE_ATTR, onChange);

        // set the onfocus handler to save the initial value
        choice.setAttributeValue(ON_FOCUS_ATTR, _CHOICE_FORM_ON_FOCUS);
      }

      if (supportsID(context) &&
          (selectedIndex >= 0) &&
          !Boolean.TRUE.equals(choice.getAttributeValue(READ_ONLY_ATTR)))
      {
        String choiceId = XhtmlLafUtils.generateUniqueID(context);
        choice.setID(choiceId);

        StringBuffer text = new StringBuffer(26 + choiceId.length());
        text.append("_setSelectIndexById(\"");
        text.append(choiceId);
        text.append("\",");
        text.append(IntegerUtils.getString(selectedIndex));
        text.append(")");

        MarlinBean sb = new MarlinBean(SCRIPT_NAME);
        sb.setAttributeValue(TEXT_ATTR, text.toString());

        MarlinBean flb = new MarlinBean(FLOW_LAYOUT_NAME);
        flb.addIndexedChild(choice);
        flb.addIndexedChild(sb);

        rangeNode = flb;
      }
      else
      {
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidadinternal.ui.beans.MarlinBean

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.