API Docs for: 1.8.0
Show:

photonui.Widget Class

Extends photonui.Base
Defined in: src/widget.js:46
Module: PhotonUI

Base class for all PhotonUI widgets.

wEvents:

  • show:

    • description: called when the widget is displayed (a change in the parent's visibility can also trigger this event).
    • callback: function(widget)
  • hide:

    • description: called when the widget is hidden (a change in the parent's visibility can also trigger this event).
    • callback: function(widget)

Constructor

photonui.Widget

(
  • params
)

Defined in src/widget.js:46

Parameters:

  • params Object

    An object that can contain any property of the widget (optional).

Methods

__onContextMenu

(
  • event
)
private

Defined in src/widget.js:445

Called when the context menu should be displayed.

Parameters:

__onLocaleChanged

() private

Defined in src/widget.js:460

Called when the locale is changed.

_bindEvent

(
  • id
  • element
  • evName
  • callback
  • [options]
)
private

Inherited from photonui.Base: src/base.js:229

Javascript event binding (for internal use).

Parameters:

  • id String

    An unique id for the event.

  • element DOMElement

    The element on which the event will be bind.

  • evName String

    The event name (e.g. "mousemove", "click",...).

  • callback Function

    The function that will be called when the event occured.

  • [options] Object optional

    options for addEventListener

_buildHtml

() private

Defined in src/widget.js:415

Build the widget HTML.

_callCallbacks

(
  • wEvent
  • params
)
private

Inherited from photonui.Base: src/base.js:292

Call all callbacks for the given wEvent.

NOTE: the first argument passed to the callback is the current widget. NOTEĀ²: if the thisArg of the callback is null, this will be binded to the current widget.

Parameters:

  • wEvent String

    The widget event.

  • params Array

    Parametters that will be sent to the callbacks.

_registerWEvents

(
  • wEvents
)
private

Inherited from photonui.Base: src/base.js:276

Register available wEvent.

Parameters:

_unbindEvent

(
  • id
)
private

Inherited from photonui.Base: src/base.js:257

Unbind javascript event.

Parameters:

  • id String

    The id of the event.

_updateProperties

(
  • properties
)
deprecated private

Inherited from photonui.Base: src/base.js:209

Force the update of the given properties.

This method is deprecated. One should use '@photonui-update' abitbol's annotation on concerned properties.

Parameters:

  • properties Array

    The properties to update.

_visibilityChanged

(
  • visibility
)
private

Defined in src/widget.js:425

Called when the visibility changes.

Parameters:

  • visibility Boolean

    Current visibility state (otptional, defaut=this.visible)

addClass

(
  • className
)

Defined in src/widget.js:378

Add a class to the outer HTML element of the widget.

Parameters:

  • className String

    The class to add.

destroy

()

Inherited from photonui.Base but overwritten in src/widget.js:367

Destroy the widget.

domInsert

(
  • widget
  • element
)
static

Defined in src/widget.js:511

Insert a widget in the DOM.

Parameters:

getAllWidgets

() Object static

Defined in src/widget.js:500

Get all instanciated PhotonUI widgets.

Returns:

Object:

An object containing all widgets {"widgetName": Widget, ...}

getWidget

(
  • name
)
Widget static

Defined in src/widget.js:485

Get a widget.

Parameters:

  • name String

    The widget name.

Returns:

Widget:

The widget or null.

hide

()

Defined in src/widget.js:345

Hide the widget (equivalent to widget.visible = false).

registerCallback

(
  • id
  • wEvent
  • callback
  • thisArg
)

Inherited from photonui.Base: src/base.js:169

Register a callback for any PhotonUI/Widget event (called wEvent).

Callback signature:

function (Object(Base/Widget) [, arg1 [, arg2 [, ...]]])

Parameters:

  • id String

    An unique id for the callback.

  • wEvent String

    the PhotonUI/Widget event name.

  • callback Function

    The callback function.

  • thisArg Object

    The value of this (optionnal, default = current widget).

removeCallback

(
  • id
)

Inherited from photonui.Base: src/base.js:193

Remove a registered callback.

Parameters:

  • id String

    The id of the callback.

removeClass

(
  • className
)

Defined in src/widget.js:395

Remove a class from the outer HTML element of the widget.

Parameters:

  • className String

    The class to remove.

show

()

Defined in src/widget.js:336

Display the widget (equivalent to widget.visible = true).

unparent

()

Defined in src/widget.js:354

Detache the widget from its parent.

Properties

__callbacks

Object private

Inherited from photonui.Base: src/base.js:142

Object containing references to registered callbacks.

__events

Object private

Inherited from photonui.Base: src/base.js:132

Object containing references javascript events binding (for widget internal use).

__html

Object private

Defined in src/widget.js:321

Object containing references to the widget HTML elements

absolutePosition

Object

Defined in src/widget.js:275

Absolute position of the widget on the page.

{x: Number, y: Number}

contextMenu

photonui.PopupWindow

Defined in src/widget.js:223

The managed contextual menu.

Default: null (= no context menu)

contextMenuName

String

Defined in src/widget.js:206

The name of the managed contextual menu (photonui.PopupWindow().name).

Default: null (= no context menu)

data

Object

Inherited from photonui.Base: src/base.js:113

Arbitrary data

Default: {}

e_parent

HTMLElement static

Defined in src/widget.js:477

Default: null

html

HTMLElement

Defined in src/widget.js:262

Html outer element of the widget (if any).

Default: null

layoutOptions

Object

Defined in src/widget.js:243

Layout options.

Default: {}

name

String

Defined in src/widget.js:109

The unique name of the widget.

Default: "widget-" + uuid.v4()

offsetHeight

Number

Defined in src/widget.js:305

Widget height (outer HTML element).

offsetWidth

Number

Defined in src/widget.js:291

Widget width (outer HTML element).

parent

photonui.Widget

Defined in src/widget.js:145

The parent widget.

Default: null (no parent)

parentName

String

Defined in src/widget.js:131

The parent widget name.

Default: null (no parent)

tooltip

String

Defined in src/widget.js:184

Tooltip.

Default: null

visible

Boolean

Defined in src/widget.js:157

Is the widget visible or hidden.

Default: true