Class: ojConveyorBelt

Oracle® Fusion Middleware Oracle JavaScript Extension Toolkit (JET)
12c (12.1.4)

E54107-01

QuickNav

oj. ojConveyorBelt extends oj.baseComponent

JET ConveyorBelt Component

Description: Container component that manages overflow for its child components and allows scrolling among them.

A JET ConveyorBelt can be created from any <div> element that contains multiple child elements at the same level to scroll among. The root must be a <div> element because the ConveyorBelt will create additional DOM elements between the root and the scrollable child elements.

The size of the ConveyorBelt must somehow be constrained in order for there to be overflow to manage, for example by specifying CSS max-width or max-height.

If the elements to be scrolled among are direct children of the ConveyorBelt, then ConveyorBelt will ensure that they are laid out appropriately for its orientation. However, if the elements to be scrolled among are contained by a single nested descendant element, the contentParent, then it is up to calling code to ensure that the elements are laid out appropriately. For example, elements can be forced horizontal by using CSS white-space:nowrap, or vertical by using display:block, before creating the ConveyorBelt.


<div id="conveyorBelt" style="max-width:100px;"
     data-bind="ojComponent: {component: 'ojConveyorBelt'}">
  <button id="button1">Alpha</button>
  <button id="button2">Beta</button>
  <button id="button3">Gamma</button>
  <button id="button4">Delta</button>
  <button id="button5">Epsilon</button>
  <button id="button6">Zeta</button>
</div>

Keyboard interaction

ConveyorBelt does not directly support keyboard interaction.

Accessibility

ConveyorBelt itself does nothing special for accessibility. It is the responsibility of the application developer to make the items in the conveyor accessible. Sighted keyboard-only users need to be able to access the items in the conveyor just by using the keyboard. It is up to the child items of the ConveyorBelt to support keyboard navigation. If child items support tab navigation, the browser may scroll them into view when they receive focus. If child items support other forms of keyboard navigation, for example by using the arrow keys, it is up to the child items to scroll themselves into view. This may be done, for example, by calling the DOM function focus() or scrollIntoView() on the item. ConveyorBelt will be aware of tab based or programmatic scrolling and will honor it, updating itself to toggle visibility of the overflow indicators as needed.

Reading direction

As with any JET component, in the unusual case that the directionality (LTR or RTL) changes post-init, the conveyorBelt must be refresh()ed.

Pseudo-selectors

The :oj-conveyorbelt pseudo-selector can be used in jQuery expressions to select JET ConveyorBelt. For example:

$( ":oj-conveyorbelt" ) // selects all JET ConveyorBelts on the page
$myEventTarget.closest( ":oj-conveyorbelt" ) // selects the closest ancestor that is a JET ConveyorBelt

JET for jQuery UI developers

Event names for all JET components are prefixed with "oj", instead of component-specific prefixes like "conveyorBelt".

Initializer

.ojConveyorBelt()

Creates a JET ConveyorBelt.
Source:
Examples

Initialize the conveyorBelt with no options specified:

$( ".selector" ).ojConveyorBelt();

Initialize the conveyorBelt with some options specified:

$( ".selector" ).ojConveyorBelt( { "orientation": "vertical" } );

Initialize the conveyorBelt via the JET ojComponent binding:

<div id="conveyorBelt" data-bind="ojComponent: { component: 'ojConveyorBelt', orientation: 'vertical'}">

Options

#contentParent :string

Specify the selector of the descendant DOM element in the conveyorBelt that directly contains the items to scroll among.
Default Value:
  • null
Source:
Examples

Initialize the conveyorBelt with the contentParent option specified:

$( ".selector" ).ojConveyorBelt( { "contentParent": "#myContentDiv" } );

Get or set the contentParent option after initialization:

// getter
var contentParent = $( ".selector" ).ojConveyorBelt( "option", "contentParent" );

// setter
$( ".selector" ).ojConveyorBelt( "option", "contentParent", "#myContentDiv" );

#contextMenu :Object

JQ selector identifying the JET Menu that the component should launch as a context menu on right-click or Shift-F10. If specified, the browser's native context menu will be replaced by the specified JET Menu.

To specify a JET context menu on a DOM element that is not a JET component, see the ojContextMenu binding.

To make the page semantically accurate from the outset, applications are encouraged to specify the context menu via the standard HTML5 syntax shown in the below example. When the component is initialized, the context menu thus specified will be set on the component.

The JET Menu should be initialized before any component using it as a context menu.

Default Value:
  • null
Inherited From:
Source:
Examples

Initialize a JET component with a context menu:

// via recommended HTML5 syntax:
<div id="myComponent" contextmenu="myMenu" data-bind="ojComponent: { ... }>

// via JET initializer (less preferred) :
$( ".selector" ).ojFoo({ "contextMenu": "#myMenu" });

Get or set the contextMenu option, after initialization:

// getter
var menu = $( ".selector" ).ojFoo( "option", "contextMenu" );

// setter
$( ".selector" ).ojFoo( "option", "contextMenu", ".my-marker-class" );

Set a JET context menu on an ordinary HTML element:

<a href="#" id="myAnchor" contextmenu="myMenu" data-bind="ojContextMenu: {}">Some text

#orientation :string

Specify the orientation of the conveyorBelt.
Supported Values:
Name Type Description
"horizontal" string Orient the conveyorBelt horizontally.
"vertical" string Orient the conveyorBelt vertically.
Default Value:
  • "horizontal"
Source:
Examples

Initialize the conveyorBelt with the orientation option specified:

$( ".selector" ).ojConveyorBelt( { "orientation": "vertical" } );

Get or set the orientation option after initialization:

// getter
var orientation = $( ".selector" ).ojConveyorBelt( "option", "orientation" );

// setter
$( ".selector" ).ojConveyorBelt( "option", "orientation", "vertical" );

#rootAttributes :Object|undefined

Attributes specified here will be set on the component's root DOM element at creation time. This is particularly useful for components like Dialog that wrap themselves in a root element at creation time.

The specified class and style are appended to the current class and style, respectively. All other attributes overwrite any existing value.

Setting this option after component creation has no effect.

Default Value:
  • undefined
Inherited From:
Source:
Example

Initialize a JET component, specifying a set of attributes to be set on the component's root DOM element:

$( ".selector" ).ojFoo({ "rootAttributes": {
  'id': 'myId', 
  'style': 'max-width:100%; color:blue;', 
  'class': 'my-class'
}});

Methods

#getNodeBySubId(locator) → {Element|null}

Return the subcomponent node represented by the documented locator attribute values. Test authors should target sub elements using the following names:
  • oj-conveyorbelt-start-overflow-indicator: the start overflow indicator of a horizontal ConveyorBelt
  • oj-conveyorbelt-end-overflow-indicator: the end overflow indicator of a horizontal ConveyorBelt
  • oj-conveyorbelt-top-overflow-indicator: the top overflow indicator of a vertical ConveyorBelt
  • oj-conveyorbelt-bottom-overflow-indicator: the bottom overflow indicator of a vertical ConveyorBelt
Parameters:
Name Type Description
locator Object An Object containing at minimum a subId property whose value is a string, documented by the component, that allows the component to look up the subcomponent associated with that string. It contains:

component: optional - in the future there may be more than one component contained within a page element

subId: the string, documented by the component, that the component expects in getNodeBySubId to locate a particular subcomponent

Source:
Returns:
the subcomponent located by the subId string passed in locator, if found.

Type
Element | null

#getSubIdByNode(node) → {string|null}

Return the subId string for the given child DOM node
Parameters:
Name Type Description
node Element child DOM node
Inherited From:
Source:
Returns:
- the subId for the DOM node or null when none is found
Type
string | null

#option(optionName, value) → {Object|undefined}

This method has several overloads, which gets and set component options.

The first overload accepts a single optionName param as a string, and returns the current value of that option.

The second overload accepts two params, an optionName string and a new value to which that option will be set.

The third overload accepts no params, and returns a map of key/value pairs representing all the component options and their values.

The fourth overload accepts a single map of option-value pairs to set on the component.

Parameters:
Name Type Argument Description
optionName string | Object <optional>
the option name (string, first two overloads), or the map (Object, last overload). Omitted in the third overload.
value Object <optional>
a value to set for the option. Second overload only.
Inherited From:
Source:
Returns:
The getter overloads return the retrieved value(s). When called via the public jQuery syntax, the setter overloads return the object on which they were called, to facilitate method chaining.
Type
Object | undefined
Examples

First overload: get one option:

var isDisabled = $( ".selector" ).ojFoo( "option", "disabled" ); // Foo is Button, Menu, etc.

Second overload: set one option:

$( ".selector" ).ojFoo( "option", "disabled", true ); // Foo is Button, Menu, etc.

Third overload: get all options:

var options = $( ".selector" ).ojFoo( "option" ); // Foo is Button, Menu, etc.

Fourth overload: set one or more options:

$( ".selector" ).ojFoo( "option", { disabled: true } ); // Foo is Button, Menu, etc.

#refresh()

Refreshes the visual state of the conveyorBelt. JET components require a refresh() or re-init after the DOM is programmatically changed underneath the component.

This method does not accept any arguments.

Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.
Example

Invoke the refresh method:

$( ".selector" ).ojConveyorBelt( "refresh" );

Non-public Methods

Note: Extending JET components is not currently supported. Thus, non-public methods are for internal use only.

<protected> #_AfterCreate()

This method is called after _ComponentCreate. The JET base component does tasks here that must happen after the component (subclass) has created itself in its override of _ComponentCreate. Notably, the base component handles the rootAttributes and contextMenu options here, since those options operate on the component root node, which for some components is created in their override of _ComponentCreate.

Subclasses should override this method only if they have tasks that must happen after a superclass's implementation of this method, e.g. tasks that must happen after the context menu is set on the component.

Overrides of this method should call this._super first.

Inherited From:
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

<protected> #_ComponentCreate()

After _ComponentCreate and _AfterCreate, the widget should be 100% set up. this._super should be called first.
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

<protected> #_destroy()

Destroy the conveyorBelt.
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

<protected> #_GetReadingDirection() → {string}

Determines whether the component is LTR or RTL.

Component responsibilities:

  • All components must determine directionality exclusively by calling this protected superclass method. (So that any future updates to the logic can be made in this one place.)
  • Components that need to know the directionality must call this method from _create() and refresh(), and cache the value.
  • Components should not call this at other times, and should instead use the cached value. (This avoids constant DOM queries, and avoids any future issues if directional islands and component reparenting (e.g. popups) should coexist.)

App responsibilities:

  • The app specifies directionality by setting the HTML "dir" attribute on the <html> node. When omitted, the default is "ltr". (Per-component directionality / directional islands are not currently supported due to inadequate CSS support.)
  • As with any DOM change, the app must refresh() the component if the directionality changes dynamically. (This provides a hook for component housekeeping, and allows caching.)
Default Value:
  • "ltr"
Inherited From:
Source:
Returns:
the reading direction, either "ltr" or "rtl"
Type
string

<protected> #_GetSavedAttributes(element) → {Object}

Gets the saved attributes for the provided element. This is usually the original list of attributes set on the element.
Parameters:
Name Type Description
element Object jQuery selection, should be a single entry
Inherited From:
Source:
Returns:
savedAttributes - attributes that were saved for this element.
Type
Object

<protected> #_init()

Called every time ojConveyorBelt is called without attributes. It's essentially a hard-reset.
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

<protected> #_InitOptions()

This method is called before _ComponentCreate, at which point the component has not yet been rendered. Component options should be initialized in this method, so that their final values are in place when _ComponentCreate is called.

This includes getting option values from the DOM, where applicable, and coercing option values (however derived) to their appropriate data type. No other work should be done in this method. See below for details.

Overrides of this method should call this._super first.

Usage:

  • If the component has an option like disabled that can be set from the DOM at create time, then the "get from DOM" logic should live in this method. E.g. a typical override might say "if the disabled option still has its initial value of undefined (i.e., the option has not been set), then get the DOM property and set it on the option." (See also next bullet.)
  • For attributes that live on the component's root node, keep in mind that anything specified via the rootAttributes option will not be placed on the DOM until _AfterCreate. So when getting attributes from the root node, components must first look in the rootAttributes option, and then, only if the attribute is not found there, look on the component root (if it already exists).
  • For options that, unlike disabled, have no corresponding DOM property, and are not otherwise set from the DOM, there is nothing to do in this method.
  • Do NOT set anything on the DOM in this method (like the resolved disabled value, or any rootAttributes values). The resolved option values should be set on the DOM later, in _ComponentCreate, and the rootAttributes values are set in baseComponent._AfterCreate.
Inherited From:
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

<protected> #_RestoreAttributes()

Restores the saved element's attributes
Inherited From:
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

<protected> #_SaveAttributes(element)

Saves the element's attributes within an internal variable to be reset during the destroy function The JSON variable will be held as : [ { "element" : element[i], "attributes" : { attributes[m]["name"] : {"attr": attributes[m]["value"], "prop": $(element[i]).prop(attributes[m]["name"]) } } ]
Parameters:
Name Type Description
element Object jQuery selection to save attributes for
Inherited From:
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

<protected> #_setOption()

Set an option on the conveyorBelt.
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

<protected> #_SetRootAttributes()

Reads the rootAttributes option, and sets the root attributes on the component's root DOM element.

class and style are appended to the current class and style, respectively. All other attributes overwrite any existing value.

Inherited From:
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.