class
SAPO.Component.NTimeline
Timeline for NextTV project
Version:
1.1
Since:
Defined in
Component/NTimeline/1.1/lib.js
February 2012
Constructor Summary
Function Summary
adds a new slot right at the end of the timeline
addSlotAt
(String
title, String|TimeEvent
start, String|TimeEvent
duration, [String
type], [custon
custom])
adds a new slot at the given position in time
Boolean
canZoomIn()
returns true if zoom in can be performed successfully
Boolean
canZoomOut()
returns true if zoom out can be performed successfully
...
either applies gravity (if forceGravity is enabled) or shifts collided slots to the future
TimeEvent
getScrollStart()
gets the current scroll start
set default duration, affecting slots which had no duration defined
Boolean
redo()
render()
renders initial NTimeline
setDefaultDuration
(TimeEvent
dfltDuration)
set default duration, affecting slots which had no duration defined
setForceGravity
(Boolean
val)
...
setScrollStart
(String|TimeEvent
evt)
sets the given scroll start
sets the given scroll to the beginning of the last slot.
sets the given scroll to the beginning of the last slot.
shuffle()
TODO
TODO
Boolean
undo()
Boolean
undoDiscarding()
Boolean
zoomIn()
performs zoom in. Returns true if successfull.
Boolean
zoomOut()
performs zoom out. Returns true if successfull.
Constructor Details
constructor NTimeline
NTimeline(String|DOMElement
container, Object
options)
Parameters:
container
- block element which will be populated with the timeline
options
-
[ Array slots ]
- array of arrays: startEvt, durationEvt, endEvt, title, type -
[ String cssURI ]
- URI to alternate CSS file for styling the NTimeline -
[ String startTime ]
- initial time for the NTimeline -
[ String endTime ]
- final time for the NTimeline -
[ String scrollStartTime ]
- scroll location at start -
[ Number fps ]
- number of frames per second to enforce during a drag operation -
[ Number zoomLevel ]
- index of the initial zoomSpans to use -
[ Object[] zoomSpans ]
- array of Objects with row, majorTick, minorTick strings (time spans) -
[ Boolean forceGravity ]
- if true, slots get next to one another, otherwise just warn about possible collisions -
[ Boolean defaultDuration ]
- if defined, all slots will with this duration -
[ Boolean contrastMode ]
- special UI mode to emphasize labels and limits (adds additional CSS classes to elements) -
[ Boolean showInfo ]
- shows info div in slot -
[ Boolean skipLabels ]
- if true, start and end time labels aren't shown on slots -
[ Function onLayoutReady ]
- callback which gets invoked once the component's layout is done -
[ Function onStateChanged ]
- callback which gets invoked when the state changes (slot is added/removed/moved or defaultDuration is set -
[ Function onSlotDeleted ]
- callback which gets invoked when the user presses the delete button on a slot -
[ Function labelFormatter ]
- receives a slot and must return a string, which will appear as the slot's label -
[ Function rowFormatter ]
- receives a TimeEvent and if it's absolute - must return a string, which will appear as row formatter -
[ Function majorTickFormatter ]
- receives a TimeEvent and must return a string, which will appear as major tick -
[ Function slotCtor ]
- receives an object with w, h, slot, slotEl, to customize what gets printed inside a slot and its layout -
[ String confirmDeleteMessage ]
- the message to display to confirm a slot deletion (i18n) -
Number rowHeight
- height of a row, in pixels -
[ String|DOMElement zoomInButton ]
- the component updates disabled state of this button if passed -
[ String|DOMElement zoomOutButton ]
- the component updates disabled state of this button if passed
Function Details
function addSlot
adds a new slot right at the end of the timeline
Parameters:
title
duration
- supports "HH:mm" or "HH:mm:ss" strings
[type]
- defaults to 'video'
[custom]
function addSlotAt
addSlotAt(String
title, String|TimeEvent
start, String|TimeEvent
duration, [String
type], [custon
custom])
adds a new slot at the given position in time
Parameters:
title
start
- supports "HH:mm" or "HH:mm:ss" strings
duration
- supports "HH:mm" or "HH:mm:ss" strings
[type]
- defaults to 'video'
[custom]
function canZoomIn
Boolean
canZoomIn()
returns true if zoom in can be performed successfully
function canZoomOut
Boolean
canZoomOut()
returns true if zoom out can be performed successfully
function clearSlots
clearSlots()
...
function correctSlots
correctSlots()
either applies gravity (if forceGravity is enabled) or shifts collided slots to the future
function getScrollStart
TimeEvent
getScrollStart()
gets the current scroll start
function getTimelineDuration
TimeEvent
getTimelineDuration(String
mode)
set default duration, affecting slots which had no duration defined
Parameters:
mode
- by default returns span between first and last slots.
in 'sinceStartTime' mode returns duration since timeline's startTime
in 'sumDurations' mode returns the some of slot durations ignoring any gaps between them function redo
Boolean
redo()
function render
render()
renders initial NTimeline
function setDefaultDuration
setDefaultDuration(TimeEvent
dfltDuration)
set default duration, affecting slots which had no duration defined
Parameters:
dfltDuration
function setForceGravity
setForceGravity(Boolean
val)
...
Parameters:
val
function setScrollStart
setScrollStart(String|TimeEvent
evt)
sets the given scroll start
Parameters:
evt
function setScrollToFirstSlot
setScrollToFirstSlot()
sets the given scroll to the beginning of the last slot.
function setScrollToLastSlot
setScrollToLastSlot()
sets the given scroll to the beginning of the last slot.
function shuffle
shuffle()
function toggleContrastMode
toggleContrastMode()
TODO
function toggleDefaultSize
toggleDefaultSize()
TODO
function undo
Boolean
undo()
function undoDiscarding
Boolean
undoDiscarding()
function zoomIn
Boolean
zoomIn()
performs zoom in. Returns true if successfull.
function zoomOut
Boolean
zoomOut()
performs zoom out. Returns true if successfull.