class sap.ui.unified.ContentSwitcher

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/unified/ContentSwitcher
Application Component: CA-UI5-TBL

Switches between two control areas and animates it via CSS transitions


Constructor

Constructor for a new ContentSwitcher.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.unified.ContentSwitcher(sId?, mSettings?)
Param Type Default Value Description
sId? string

id for the new control, generated automatically if no id is given

mSettings? object

initial settings for the new control


Properties

Name Type Default Value Description
activeContent int 1

The number of the currently active content (1 or 2).

Visibility: public
animation string None

Set the used animation when changing content. This just sets a CSS-class named "sapUiUnifiedACSwitcherAnimation" + this value on the root element of the control. The animation has to be implemented in CSS. This also enables applications to implement their own animations via CSS by reacting to the parent class. See the types sap.ui.unified.ContentSwitcherAnimation for default implementations.

Visibility: public

Aggregations

Default Aggregation:

Name Cardinality Type Description
content1 0..n sap.ui.core.Control

The controls that should be shown in the first content

content2 0..n sap.ui.core.Control

The controls that should be shown in the second content


Methods Overview

Method Description
addContent1

Adds some content1 to the aggregation content1.

addContent2

Adds some content2 to the aggregation content2.

destroyContent1

Destroys all the content1 in the aggregation content1.

destroyContent2

Destroys all the content2 in the aggregation content2.

sap.ui.unified.ContentSwitcher.extend

Creates a new subclass of class sap.ui.unified.ContentSwitcher with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

getActiveContent

Gets current value of property activeContent.

The number of the currently active content (1 or 2).

Default value is 1.

getAnimation

Gets current value of property animation.

Set the used animation when changing content. This just sets a CSS-class named "sapUiUnifiedACSwitcherAnimation" + this value on the root element of the control. The animation has to be implemented in CSS. This also enables applications to implement their own animations via CSS by reacting to the parent class. See the types sap.ui.unified.ContentSwitcherAnimation for default implementations.

Default value is 'None'.

getContent1

Gets content of aggregation content1.

The controls that should be shown in the first content

getContent2

Gets content of aggregation content2.

The controls that should be shown in the second content

sap.ui.unified.ContentSwitcher.getMetadata

Returns a metadata object for class sap.ui.unified.ContentSwitcher.

indexOfContent1

Checks for the provided sap.ui.core.Control in the aggregation content1. and returns its index if found or -1 otherwise.

indexOfContent2

Checks for the provided sap.ui.core.Control in the aggregation content2. and returns its index if found or -1 otherwise.

insertContent1

Inserts a content1 into the aggregation content1.

insertContent2

Inserts a content2 into the aggregation content2.

removeAllContent1

Removes all the controls from the aggregation content1.

Additionally, it unregisters them from the hosting UIArea.

removeAllContent2

Removes all the controls from the aggregation content2.

Additionally, it unregisters them from the hosting UIArea.

removeContent1

Removes a content1 from the aggregation content1.

removeContent2

Removes a content2 from the aggregation content2.

setActiveContent

Sets a new value for property activeContent.

The number of the currently active content (1 or 2).

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 1.

setAnimation

Sets a new value for property animation.

Set the used animation when changing content. This just sets a CSS-class named "sapUiUnifiedACSwitcherAnimation" + this value on the root element of the control. The animation has to be implemented in CSS. This also enables applications to implement their own animations via CSS by reacting to the parent class. See the types sap.ui.unified.ContentSwitcherAnimation for default implementations.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 'None'.

switchContent

Changes the currently active content to the other one. If content 1 is active, content 2 will be activated and the other way around.

addContent1

Adds some content1 to the aggregation content1.

Param Type DefaultValue Description
oContent1 sap.ui.core.Control

The content1 to add; if empty, nothing is inserted

addContent2

Adds some content2 to the aggregation content2.

Param Type DefaultValue Description
oContent2 sap.ui.core.Control

The content2 to add; if empty, nothing is inserted

destroyContent1

Destroys all the content1 in the aggregation content1.

destroyContent2

Destroys all the content2 in the aggregation content2.

sap.ui.unified.ContentSwitcher.extend

Creates a new subclass of class sap.ui.unified.ContentSwitcher with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

getActiveContent

Gets current value of property activeContent.

The number of the currently active content (1 or 2).

Default value is 1.

getAnimation

Gets current value of property animation.

Set the used animation when changing content. This just sets a CSS-class named "sapUiUnifiedACSwitcherAnimation" + this value on the root element of the control. The animation has to be implemented in CSS. This also enables applications to implement their own animations via CSS by reacting to the parent class. See the types sap.ui.unified.ContentSwitcherAnimation for default implementations.

Default value is 'None'.

getContent1

Gets content of aggregation content1.

The controls that should be shown in the first content

getContent2

Gets content of aggregation content2.

The controls that should be shown in the second content

sap.ui.unified.ContentSwitcher.getMetadata

Returns a metadata object for class sap.ui.unified.ContentSwitcher.

indexOfContent1

Checks for the provided sap.ui.core.Control in the aggregation content1. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oContent1 sap.ui.core.Control

The content1 whose index is looked for

indexOfContent2

Checks for the provided sap.ui.core.Control in the aggregation content2. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oContent2 sap.ui.core.Control

The content2 whose index is looked for

insertContent1

Inserts a content1 into the aggregation content1.

Param Type DefaultValue Description
oContent1 sap.ui.core.Control

The content1 to insert; if empty, nothing is inserted

iIndex int

The 0-based index the content1 should be inserted at; for a negative value of iIndex, the content1 is inserted at position 0; for a value greater than the current size of the aggregation, the content1 is inserted at the last position

insertContent2

Inserts a content2 into the aggregation content2.

Param Type DefaultValue Description
oContent2 sap.ui.core.Control

The content2 to insert; if empty, nothing is inserted

iIndex int

The 0-based index the content2 should be inserted at; for a negative value of iIndex, the content2 is inserted at position 0; for a value greater than the current size of the aggregation, the content2 is inserted at the last position

removeAllContent1

Removes all the controls from the aggregation content1.

Additionally, it unregisters them from the hosting UIArea.

removeAllContent2

Removes all the controls from the aggregation content2.

Additionally, it unregisters them from the hosting UIArea.

removeContent1

Removes a content1 from the aggregation content1.

Param Type DefaultValue Description
vContent1 int string sap.ui.core.Control

The content1 to remove or its index or id

removeContent2

Removes a content2 from the aggregation content2.

Param Type DefaultValue Description
vContent2 int string sap.ui.core.Control

The content2 to remove or its index or id

setActiveContent

Sets a new value for property activeContent.

The number of the currently active content (1 or 2).

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 1.

Param Type DefaultValue Description
iActiveContent int 1

New value for property activeContent

setAnimation

Sets a new value for property animation.

Set the used animation when changing content. This just sets a CSS-class named "sapUiUnifiedACSwitcherAnimation" + this value on the root element of the control. The animation has to be implemented in CSS. This also enables applications to implement their own animations via CSS by reacting to the parent class. See the types sap.ui.unified.ContentSwitcherAnimation for default implementations.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 'None'.

Param Type DefaultValue Description
sAnimation string 'None'

New value for property animation

switchContent

Changes the currently active content to the other one. If content 1 is active, content 2 will be activated and the other way around.