<w:PopupMenu>

A PopupMenu is a container for PopupMenuItem's. To define a menu, you only need to provide a menuId, and then define a series of PopupMenuItem's within the PopupMenu contiainer. Since the menu definition may appear in a repetition and, therefore, must have a unique menuId for each menu rendered, you may also provide an index for the menuId which will be used by PopupMenu to build a menuId from the concateation of the menuId and the index. For example:

<a:For list="$list" item="$currentItem" index="$currentIndex">
    <w:PopupMenu menuId="Move" index="$currentIndex">
        <w:PopupMenuItem action="$moveLeftClicked">Move Left</w:PopupMenuItem>
        <w:PopupMenuItem action="$moveRightClicked">Move Right</w:PopupMenuItem>
    </w:PopupMenu>
        :
 </a:For>

Of course, you will need to define a reference to the menu using a PopupMenuLink (or PopupMenuButton) and provide the same menuId (and optional index):

:
 <w:PopupMenuLink menuId="Move" index="$currentIndex">$currentItem</w:PopupMenuLink>
:

There are two modes in which you can use these menus -- shared or 1:1. The above axample shows how to use the menu in 1:1 mode (one menu per menu reference). [Actually, in 1:1 mode, the PopupMenu and PopupMenuLink usually appear within the same repetition, so the context for both is identical]

For 1:1 mode, it does not matter whether then PopupMenu comes before the PopupMenuLink since the context of the action bound to the PopupMenuItem will be the same in either case (assuming they are defined within the same repetition as they generally will be). However, in shared-menu mode, the PopupMenuLink should appear before the PopupMenu so that the link can provide the proper setup before the action of the PopupMenuItem is invoked (more on this below). Also in shared mode, the PopupMenu and its corresponding PopupMenuLink's are not within the same repetition (or context).

What does it mean for a PopupMenuLink to 'setup' before the action of the PopupMenuItem? Well, when you click on the PopupMenuLink in a shared scenario, that link represents some object that you are selecting on which you want one of the operations defined in the menu to operate. However, since the context of the link is separate from the context of the Menu itself, you must stash the value(s) you want from the link's context so they'll be available in the PopupMenuItem's context. To make this easy to do, you can define "assignment bindings" on the link itself and stash away these values. An assignment binding is one where the left hand side of the binding expression is the name of a variable in your component. For example:

<w:PopupMenuLink menuId="Foo" actionSetup="$actionSetup"/>
   :

In this case, when this link is clicked, no action will be invoked, but the $currentItem will be evaluated and pushed into the "selectedItem" variable in your component and the same for $currentValue -> selectedValue. Of course, you may use any names you want on the left side as long as there's ivar's in your component with those names. Now that the selectedItem and selectedValue are stashed away, you can use them in whatever actions are defined on the shared component that displays when this PopupMenuLink is clicked.

Bindings
menuId *

The menuId is used to associate a PopupMenuLink and its corresponding PopupMenu. You must avoid name collisions with other menus (especially menus you import into your application via reusable components). One way to do this is to get an elementId from the requestContext and use this for both the PopupMenuLink and the PopupMenu. Note that a single PopupMenu may be shared by many PopupMenuLinks -- all those links will have the same id as their shared PopupMenu.

String
(get)
index

If you are generating PopupMenu/Links in a repetition, each iteration will require a different menuId. The index binding makes this easy as you can provide a static menuId and pass the index from the repetition and let PopupMenu/Link do the concatenation for you (in a more efficient way, as well).

int
(get)
onDisplayHandler

Javascript function name which is invoked everytime the popup menu is displayed. Will be passed the element for the menu div as the argument to the handler. Note if the PopupMenu contains an AWLazyDiv, then the contents of the PopupMenu may not be retrieved the first time this method is called. In this case, the act of retrieving content for the AWLazyDiv should probably also call this same javascript statement(s).

String
(get)
class

Override the default css class (awmenu)

String
(get)
closeTimeout

Time in millisecond to automatically close the popup menu (minimum is 3 sec)

Integer
(get)

ariba.ui.widgets
Class PopupMenu

java.lang.Object
  extended by ariba.ui.aribaweb.util.AWBaseObject
      extended by ariba.ui.aribaweb.core.AWComponent
          extended by ariba.ui.widgets.PopupMenu
All Implemented Interfaces:
AWCycleable, AWCycleableReference, AWResponseGenerating, AWResponseGenerating.ResponseSubstitution, AWObject

public final class PopupMenu
extends AWComponent


Nested Class Summary
 
Nested classes/interfaces inherited from class ariba.ui.aribaweb.core.AWComponent
AWComponent.RenderingFilter, AWComponent.RenderingListener
 
Nested classes/interfaces inherited from interface ariba.ui.aribaweb.core.AWResponseGenerating
AWResponseGenerating.ResponseSubstitution
 
Constructor Summary
PopupMenu()
           
 
Method Summary
 AWEncodedString actionNameKey()
           
 int autoCloseTimeout()
           
static void flagHasCollapsedItem(AWComponent item)
           
 boolean isStateless()
          Overridden by AWComponent subclasses to indicate whether component instances should be preserved with the page/session (i.e.
 AWEncodedString menuId()
           
 AWEncodedString menuLinkSenderIdKey()
           
 void renderResponse(AWRequestContext requestContext, AWComponent component)
          The receiver should render its content to the AWRequestContext.response()
 boolean shouldAutoClose()
           
 
Methods inherited from class ariba.ui.aribaweb.core.AWComponent
_topLevelApplyValues, _topLevelInvokeAction, _topLevelRenderResponse, allowEmbeddedKeyPaths, allowsWhitespaceCompression, application, applyValues, awcyclePageAndLog, bindingForName, bindingForName, bindings, booleanValueForBinding, booleanValueForBinding, booleanValueForBinding, booleanValueForBinding, browserMaxWidth, browserMinWidth, characterEncoding, clearValidationError, clientTimeZone, componentConfiguration, componentDefinition, componentPath, componentReference, createPageWithName, defaultTemplateParser, determineInstance, determineInstance, dict, dict, dict, doubleValueForBinding, doubleValueForBinding, doubleValueForBinding, encodedStringValueForBinding, encodedStringValueForBinding, ensureAwake, ensureFieldValuesClear, env, errorManager, escapeAttribute, escapeString, escapeUnsafeString, extendedFields, formValueManager, generateResponse, generateResponse, generateResponse, generateStringContents, getAWParameter, getDrivingBusinessObject, getFoldInSituOnWindowSizeParam, getPageRenderVersion, getThis, hasBinding, hasBinding, hasContentForTagName, hasContentNamed, hasMultipleTemplates, hasSubTemplateNamed, httpSession, init, init, initTemplateResourceManager, intValueForBinding, intValueForBinding, intValueForBinding, invokeAction, isBidirectional, isBrowserMicrosoft, isClientPanel, isMacintosh, isRenderAW5, isStrictTagNaming, isUserCommunityEnabled, isValidationEnabled, languageDirection, languageLeft, languageRight, loadTemplate, localizedJavaString, markBacktrackState, name, namePath, notifyChange, otherBindings, otherBindingsValues, page, pageComponent, pageWithClass, pageWithClass, pageWithName, pageWithName, parent, postTakeValueActions, preferredLocale, recordBacktrackState, recordBacktrackState, recordValidationError, recordValidationError, recordValidationError, recordValidationErrors, recordValidationWarning, redirectToPage, registerRenderingListener, registerXmlNodeWithName, removeBacktrackState, replacementResponse, request, requestContext, requiresPreGlidCompatibility, resourceClassName, resourceManager, response, restoreFromBacktrackState, session, session, setCharacterEncoding, setClientPanel, setClientTimeZone, setComponentConfiguration, setDefaultTemplateParser, setEnv, setPerfDestinationInfo, setPreferredLocale, setResourceManager, setTemplateParser, setupForNextCycle, setValueForBinding, setValueForBinding, setValueForBinding, setValueForBinding, setValueForBinding, setValueForBinding, shouldCachePage, shouldCloseElements, strings, stringValueForBinding, stringValueForBinding, stringValueForBinding, supportedBindingNames, template, templateName, templateParser, templateResource, templateResourceManager, truncateBacktrackState, truncateBacktrackState, urlForResourceNamed, urlForResourceNamed, urlForResourceNamed, useXmlEscaping, valueForBinding, valueForBinding, valueForBinding, xml
 
Methods inherited from class ariba.ui.aribaweb.util.AWBaseObject
debugString, getFieldValue, isKindOfClass, localizedJavaString, logString, logWarning, setFieldValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ariba.ui.aribaweb.util.AWObject
getFieldValue, isKindOfClass, setFieldValue
 

Field Detail

_menuIdBinding

public AWBinding _menuIdBinding

_indexBinding

public AWBinding _indexBinding

_hasCollapsed

public boolean _hasCollapsed

debug_MenuIDListKey

public static final java.lang.String debug_MenuIDListKey
See Also:
Constant Field Values
Constructor Detail

PopupMenu

public PopupMenu()
Method Detail

isStateless

public boolean isStateless()
Description copied from class: AWComponent
Overridden by AWComponent subclasses to indicate whether component instances should be preserved with the page/session (i.e. are "stateful") or can be pooled and reused for each phase of request processing (i.e. are stateless) Default is to be stateless unless the component is used as the top-level (page) component.

Overrides:
isStateless in class AWComponent

menuId

public AWEncodedString menuId()

menuLinkSenderIdKey

public AWEncodedString menuLinkSenderIdKey()

actionNameKey

public AWEncodedString actionNameKey()

renderResponse

public void renderResponse(AWRequestContext requestContext,
                           AWComponent component)
Description copied from interface: AWCycleable
The receiver should render its content to the AWRequestContext.response()

Specified by:
renderResponse in interface AWCycleable
Overrides:
renderResponse in class AWComponent
Parameters:
requestContext - the context for the current request.
component - the current parent component

flagHasCollapsedItem

public static void flagHasCollapsedItem(AWComponent item)

shouldAutoClose

public boolean shouldAutoClose()

autoCloseTimeout

public int autoCloseTimeout()


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.